18 package org.turro.elephant.zul.menu;
20 import org.turro.string.Strings;
21 import org.turro.annotation.ExternalMenu;
22 import org.turro.auth.Authentication;
23 import org.turro.command.Context;
24 import org.turro.elephant.context.Application;
25 import org.turro.entities.EntityCombobox;
26 import org.turro.i18n.I_;
27 import org.turro.menu.ElephantMenu;
28 import org.turro.menu.ElephantMenuBar;
29 import org.turro.menu.ElephantSubmenu;
30 import org.turro.security.Permission;
31 import org.turro.timetracker.TimeTrackerExporter;
32 import org.turro.zkoss.dialog.InputDialog;
33 import org.turro.zkoss.dialog.InputField;
34 import org.turro.zul.frame.Framework;
35 import org.zkoss.zk.ui.HtmlBasedComponent;
36 import org.zkoss.zk.ui.event.Event;
37 import org.zkoss.zk.ui.event.EventListener;
38 import org.zkoss.zk.ui.util.Clients;
49 submenu.
addMenuitem(
"Impersonate",
"spy", (EventListener) (Event event) -> {
51 I_.
get(
"Impersonate"),
53 new InputField(
"Contact", null, null, 0) {
55 protected HtmlBasedComponent createEditor() {
56 EntityCombobox ec = new EntityCombobox();
57 ec.setRoot(
"contact");
61 protected Object getEditorValue() {
62 return ((EntityCombobox) editor).getObjectValue();
65 }, (Context context) -> {
67 if(fields.length > 0) {
69 if(
"Contact".equals(f.getLabel())) {
71 Clients.evalJavaScript(
"exitWanted=true;");
82 .
addMenuitem(
"Back to self",
"no-spy", (EventListener) (Event event) -> {
84 Clients.evalJavaScript(
"exitWanted=true;");
86 }, Permission.from(() -> {
89 .
addMenuitem(
"Tags",
"tag",
"/commons/tagEntities.zul",
true)
90 .
addMenuitem(
"Warnings",
"warn",
"/error/warnings.zul")
91 .
addMenuitem(
"Log",
"log", (EventListener) (Event event) -> {
93 }, Permission.from(
"contact:log"))
94 .addMenuitem(
"Skills",
"/commons/rootSkills.zul");
102 .
addMenuitem(
"Occurrences",
"/bs/apis/occurrences.zul")
106 .
addMenuitem(
"Export time tracker", (EventListener) (Event event) -> {
110 .
addMenuitem(
"Reset site settings", (EventListener) (Event event) -> {
113 .
addMenuitem(
"Reset schemes", (EventListener) (Event event) -> {
124 .
addMenuitem(
"Rankings",
"ranking",
"/statistics/rankings.zul",
false)
125 .
addMenuitem(
"Matchings",
"matching",
"/statistics/matchings.zul",
false);
129 showZulFile(
"Warnings",
"/error/warnings.zul");
132 public static void showLog(String generatorPath, String entityPath) {
135 if(!Strings.isBlank(generatorPath)) {
137 }
else if(!Strings.isBlank(entityPath)) {
142 "/log/systemLog.zul",
null);
static void impersonateIContact(IContact contact)
static boolean canImpersonate()
static void impersonateContact(Object contact)
static boolean isBehaving()
static void resetSchemes()
abstract void sendRedirect(String uri)
static void resetSettings()
static Application getApplication()
static String get(String msg)
static Permission from(String... roles)
static void exportTimeTracker()
static Framework getCurrent()
static void setAttribute(Object object, String key, Object value)