1 | <%-- $Id: menu.jsp 7605 2019-02-26 10:10:15Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2005 Nicklas Nordborg, Gregory Vincic |
---|
4 | Copyright (C) 2006 Jari Häkkinen, Nicklas Nordborg, Martin Svensson, Gregory Vincic |
---|
5 | Copyright (C) 2007 Nicklas Nordborg |
---|
6 | |
---|
7 | This file is part of BASE - BioArray Software Environment. |
---|
8 | Available at http://base.thep.lu.se/ |
---|
9 | |
---|
10 | BASE is free software; you can redistribute it and/or |
---|
11 | modify it under the terms of the GNU General Public License |
---|
12 | as published by the Free Software Foundation; either version 3 |
---|
13 | of the License, or (at your option) any later version. |
---|
14 | |
---|
15 | BASE is distributed in the hope that it will be useful, |
---|
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | GNU General Public License for more details. |
---|
19 | |
---|
20 | You should have received a copy of the GNU General Public License |
---|
21 | along with BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
22 | ------------------------------------------------------------------ |
---|
23 | |
---|
24 | This page is included from the <base:page> taglib to display the |
---|
25 | meny. |
---|
26 | |
---|
27 | @param name |
---|
28 | The name of the menu to display: |
---|
29 | - standard: The standard menu for a logged in user |
---|
30 | - login: The menu used on pages where no user is logged in |
---|
31 | - exception: Used on error pages, does not display a menu at all |
---|
32 | - auto: Will display either the "standard" or "login" menu |
---|
33 | |
---|
34 | @author Nicklas |
---|
35 | @version 2.0 |
---|
36 | --%> |
---|
37 | <%@ page pageEncoding="UTF-8" session="false" |
---|
38 | import="net.sf.basedb.core.Application" |
---|
39 | import="net.sf.basedb.core.SessionControl" |
---|
40 | import="net.sf.basedb.core.DbControl" |
---|
41 | import="net.sf.basedb.core.BasicItem" |
---|
42 | import="net.sf.basedb.core.Nameable" |
---|
43 | import="net.sf.basedb.core.Permission" |
---|
44 | import="net.sf.basedb.core.Item" |
---|
45 | import="net.sf.basedb.core.ItemContext" |
---|
46 | import="net.sf.basedb.core.User" |
---|
47 | import="net.sf.basedb.core.Project" |
---|
48 | import="net.sf.basedb.core.BioAssaySet" |
---|
49 | import="net.sf.basedb.core.Client" |
---|
50 | import="net.sf.basedb.core.StringUtil" |
---|
51 | import="net.sf.basedb.core.ItemQuery" |
---|
52 | import="net.sf.basedb.core.Include" |
---|
53 | import="net.sf.basedb.core.ItemResultList" |
---|
54 | import="net.sf.basedb.core.Type" |
---|
55 | import="net.sf.basedb.core.Role" |
---|
56 | import="net.sf.basedb.core.query.Orders" |
---|
57 | import="net.sf.basedb.core.query.Order" |
---|
58 | import="net.sf.basedb.core.query.Hql" |
---|
59 | import="net.sf.basedb.core.query.Restrictions" |
---|
60 | import="net.sf.basedb.core.query.Expressions" |
---|
61 | import="net.sf.basedb.clients.web.Base" |
---|
62 | import="net.sf.basedb.clients.web.util.HTML" |
---|
63 | import="net.sf.basedb.clients.web.resources.Bundle" |
---|
64 | import="net.sf.basedb.util.EmailUtil" |
---|
65 | import="net.sf.basedb.util.Values" |
---|
66 | import="net.sf.basedb.util.resources.ResourceBundleWrapper" |
---|
67 | import="net.sf.basedb.util.resources.ResourceBundleFactory" |
---|
68 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
69 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
70 | import="net.sf.basedb.clients.web.extensions.menu.MenuItemAction" |
---|
71 | import="net.sf.basedb.util.extensions.Extension" |
---|
72 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
73 | import="net.sf.basedb.util.extensions.ActionIterator" |
---|
74 | import="net.sf.basedb.clients.web.extensions.DynamicActionAttributes" |
---|
75 | import="net.sf.basedb.clients.web.extensions.DynamicActionAttribute" |
---|
76 | import="java.util.HashMap" |
---|
77 | import="java.util.Map" |
---|
78 | import="java.util.ArrayList" |
---|
79 | import="java.util.LinkedList" |
---|
80 | import="java.util.List" |
---|
81 | import="java.util.Arrays" |
---|
82 | import="java.util.Iterator" |
---|
83 | import="java.util.Set" |
---|
84 | import="java.util.HashSet" |
---|
85 | %> |
---|
86 | <%@ taglib prefix="m" uri="/WEB-INF/menu.tld" %> |
---|
87 | <%@ taglib prefix="ext" uri="/WEB-INF/extensions.tld" %> |
---|
88 | <% |
---|
89 | SessionControl sc = null; |
---|
90 | try |
---|
91 | { |
---|
92 | sc = Application.isRunning() ? Base.getSessionControl(pageContext, false) : null; |
---|
93 | } |
---|
94 | catch (RuntimeException ex) |
---|
95 | {} |
---|
96 | final String ID = sc == null ? "" : sc.getId(); |
---|
97 | String name = Values.getString(request.getParameter("name"), "login"); |
---|
98 | final String root = request.getContextPath()+"/"; |
---|
99 | if ("exception".equals(name) && sc != null && sc.isLoggedIn()) name = "standard"; |
---|
100 | |
---|
101 | final ResourceBundleWrapper common = ResourceBundleFactory.getResourceBundle(Bundle.COMMON, sc); |
---|
102 | final ResourceBundleWrapper menu = ResourceBundleFactory.getResourceBundle(Bundle.MENU, sc); |
---|
103 | |
---|
104 | if ("login".equals(name)) |
---|
105 | { |
---|
106 | } |
---|
107 | else if ("projects".equals(name) && sc != null && sc.isLoggedIn()) |
---|
108 | { |
---|
109 | // Projects menu |
---|
110 | int activeProjectId = sc.getActiveProjectId(); |
---|
111 | %> |
---|
112 | <m:menu |
---|
113 | id="menu.projects" |
---|
114 | style="display: none" |
---|
115 | > |
---|
116 | <% |
---|
117 | final DbControl dc = sc.newDbControl(); |
---|
118 | boolean menuSeparatorBeforeDeactivate = true; |
---|
119 | try |
---|
120 | { |
---|
121 | List<Project> projects = new ArrayList<Project>(); |
---|
122 | int lastRecentActiveIndex = 0; |
---|
123 | // 1. Load the most recently active projects |
---|
124 | String tmp = sc.getUserClientSetting("projects.recentActive"); |
---|
125 | Set<Integer> recentProjects = new HashSet<Integer>(); |
---|
126 | if (tmp != null) |
---|
127 | { |
---|
128 | for (String id : tmp.split(":")) |
---|
129 | { |
---|
130 | try |
---|
131 | { |
---|
132 | Project p = Project.getById(dc, Values.getInt(id)); |
---|
133 | if (!p.isRemoved()) |
---|
134 | { |
---|
135 | recentProjects.add(p.getId()); |
---|
136 | projects.add(p); |
---|
137 | lastRecentActiveIndex++; |
---|
138 | } |
---|
139 | } |
---|
140 | catch (RuntimeException ex) |
---|
141 | {} |
---|
142 | } |
---|
143 | } |
---|
144 | |
---|
145 | // 2. Load more projects |
---|
146 | final ItemContext projectCC = sc.getCurrentContext(Item.PROJECT); |
---|
147 | final ItemQuery<Project> projectQuery = Project.getQuery(); |
---|
148 | projectQuery.include(Include.MINE, Include.SHARED); |
---|
149 | projectQuery.restrict(Restrictions.not(Restrictions.in(Hql.property("id"), Expressions.parameter("projects")))); |
---|
150 | projectQuery.setParameter("projects", recentProjects, Type.INT); |
---|
151 | Order projectSortOrder = projectCC.getSortOrder(); |
---|
152 | if (projectSortOrder != null) projectQuery.order(projectSortOrder); |
---|
153 | projectQuery.order(Orders.asc(Hql.property("name"))); |
---|
154 | projectQuery.setCacheResult(true); |
---|
155 | projects.addAll(projectQuery.list(dc)); |
---|
156 | boolean breakAt15 = projects.size() > 16; |
---|
157 | int index = 0; |
---|
158 | String thisIsTheActiveProject = menu.getString("activeproject.tooltip"); |
---|
159 | String thisIsNotTheActiveProject = menu.getString("inactiveproject.tooltip"); |
---|
160 | if (lastRecentActiveIndex > 0) |
---|
161 | { |
---|
162 | %> |
---|
163 | <m:menuitem |
---|
164 | title="<%=menu.getString("recentprojects.title")%>" |
---|
165 | subclass="menusection" |
---|
166 | enabled="false" |
---|
167 | /> |
---|
168 | <m:menuseparator /> |
---|
169 | <% |
---|
170 | } |
---|
171 | Set<Integer> shownProjects = new HashSet<Integer>(); |
---|
172 | for (Project p : projects) |
---|
173 | { |
---|
174 | if (index == 15 && breakAt15) break; |
---|
175 | index++; |
---|
176 | int projectId = p.getId(); |
---|
177 | boolean active = activeProjectId == projectId; |
---|
178 | String prefix = index <= lastRecentActiveIndex ? index + ". " : ""; |
---|
179 | shownProjects.add(p.getId()); |
---|
180 | String url = active ? |
---|
181 | root+"my_base/projects/index.jsp?ID="+ID+"&cmd=ViewItem&item_id=" + projectId : |
---|
182 | root+"my_base/projects/set_active.jsp?ID="+ID+"&project_id="+p.getId(); |
---|
183 | %> |
---|
184 | <m:menuitem |
---|
185 | title="<%=prefix + HTML.encodeTags(p.getName())%>" |
---|
186 | subclass="active" |
---|
187 | url="<%=url%>" |
---|
188 | data-popup="<%=active ? "" : "ActivateProject, 300, 200"%>" |
---|
189 | icon="<%=active ? "checkedmenu.png" : null%>" |
---|
190 | tooltip="<%=active ? thisIsTheActiveProject : thisIsNotTheActiveProject%>" |
---|
191 | /> |
---|
192 | <% |
---|
193 | if (index == lastRecentActiveIndex) |
---|
194 | { |
---|
195 | %> |
---|
196 | <m:menuseparator /> |
---|
197 | <% |
---|
198 | menuSeparatorBeforeDeactivate = false; |
---|
199 | } |
---|
200 | else |
---|
201 | { |
---|
202 | menuSeparatorBeforeDeactivate = true; |
---|
203 | } |
---|
204 | } |
---|
205 | if (breakAt15) |
---|
206 | { |
---|
207 | int more = projects.size() - 15; |
---|
208 | %> |
---|
209 | <m:menuitem |
---|
210 | title="<%="…" + menu.getString("moreprojects.title", Integer.toString(more))%>" |
---|
211 | url="<%=root+"my_base/projects/index.jsp?ID="+ID+"&cmd=UpdateContext&tmpfilter:INT:id=<>"+Values.getString(shownProjects, "|", true)%>" |
---|
212 | tooltip="<%=menu.getString("moreprojects.tooltip")%>" |
---|
213 | /> |
---|
214 | <% |
---|
215 | } |
---|
216 | } |
---|
217 | catch (Throwable t) |
---|
218 | { |
---|
219 | t.printStackTrace(); |
---|
220 | menuSeparatorBeforeDeactivate = false; |
---|
221 | %> |
---|
222 | <m:menuseparator /> |
---|
223 | <m:menuitem |
---|
224 | title="<%=menu.getString("projects.error.title")%>" |
---|
225 | tooltip="<%=menu.getString("projects.error.tooltip", t.getMessage())%>" |
---|
226 | enabled="false" |
---|
227 | icon="error.png" |
---|
228 | /> |
---|
229 | <% |
---|
230 | } |
---|
231 | finally |
---|
232 | { |
---|
233 | if (dc != null) dc.close(); |
---|
234 | } |
---|
235 | if (menuSeparatorBeforeDeactivate) |
---|
236 | { |
---|
237 | %> |
---|
238 | <m:menuseparator /> |
---|
239 | <% |
---|
240 | } |
---|
241 | %> |
---|
242 | <m:menuitem |
---|
243 | title="<%="<i>- " + menu.getString("noactiveproject.title") + " -</i>"%>" |
---|
244 | url="<%=root+"my_base/projects/set_active.jsp?ID="+ID%>" |
---|
245 | data-popup="ActivateProject, 300, 200" |
---|
246 | icon="<%=activeProjectId == 0 ? "checkedmenu.png" : null%>" |
---|
247 | enabled="<%=activeProjectId != 0%>" |
---|
248 | tooltip="<%=menu.getString("noactiveproject.tooltip", activeProjectId == 0)%>" |
---|
249 | /> |
---|
250 | </m:menu> |
---|
251 | <% |
---|
252 | } |
---|
253 | else if ("recentItems".equals(name) && sc != null && sc.isLoggedIn()) |
---|
254 | { |
---|
255 | // Recently used items menu |
---|
256 | String stickyItems = Values.getString(sc.getUserClientSetting("menu.mostRecent"), |
---|
257 | "EXPERIMENT:BIOASSAYSET:TRANSFORMATION"); |
---|
258 | boolean loadNames = Values.getBoolean(sc.getUserClientSetting("menu.mostRecent.loadNames"), |
---|
259 | true); |
---|
260 | String recentItems = sc.getUserClientSetting("menu.mostRecent.viewed"); |
---|
261 | DbControl dc = loadNames ? sc.newDbControl() : null; |
---|
262 | try |
---|
263 | { |
---|
264 | %> |
---|
265 | <m:menu |
---|
266 | id="menu.mostRecent" |
---|
267 | style="display: none;" |
---|
268 | > |
---|
269 | <% |
---|
270 | int numItems = 0; |
---|
271 | // Recently viewed items |
---|
272 | List<String> recentlyViewed = recentItems == null ? |
---|
273 | new ArrayList<String>() : Arrays.asList(recentItems.split(":")); |
---|
274 | if (recentlyViewed.size() > 0) |
---|
275 | { |
---|
276 | %> |
---|
277 | <m:menuitem |
---|
278 | title="<%=menu.getString("recentitems.title")%>" |
---|
279 | subclass="menusection" |
---|
280 | enabled="false" |
---|
281 | /> |
---|
282 | <m:menuseparator /> |
---|
283 | <% |
---|
284 | for (String recent : recentlyViewed) |
---|
285 | { |
---|
286 | try |
---|
287 | { |
---|
288 | String[] tmp = recent.split("="); |
---|
289 | Item itemType = Item.valueOf(tmp[0]); |
---|
290 | String itemTextKey = "item." + itemType.name().toLowerCase(); |
---|
291 | String itemText = common.getString(itemTextKey); |
---|
292 | if (itemText == itemTextKey) itemText = itemType.toString(); |
---|
293 | int itemId = Values.getInt(tmp[1], 0); |
---|
294 | if (itemId != 0) |
---|
295 | { |
---|
296 | String shortName = ""; |
---|
297 | String fullName = ""; |
---|
298 | int noEdit = 1; |
---|
299 | if (loadNames) |
---|
300 | { |
---|
301 | try |
---|
302 | { |
---|
303 | BasicItem item = itemType.getById(dc, itemId); |
---|
304 | fullName = ((Nameable)item).getName(); |
---|
305 | shortName = HTML.encodeTags(StringUtil.trimString(fullName, 35)); |
---|
306 | noEdit = item.hasPermission(Permission.WRITE) ? 0 : 1; |
---|
307 | } |
---|
308 | catch (Throwable t) |
---|
309 | { |
---|
310 | continue; |
---|
311 | } |
---|
312 | } |
---|
313 | else |
---|
314 | { |
---|
315 | fullName = itemText + "; id=" + itemId; |
---|
316 | shortName = itemText + " (id=" + itemId + ")"; |
---|
317 | } |
---|
318 | numItems++; |
---|
319 | %> |
---|
320 | <m:menuitem |
---|
321 | title="<%=numItems + ". " + shortName%>" |
---|
322 | subclass="auto-init" |
---|
323 | data-auto-init="item-link" |
---|
324 | data-item-type="<%=itemType.name() %>" |
---|
325 | data-item-id="<%=itemId %>" |
---|
326 | data-no-edit="<%=noEdit %>" |
---|
327 | tooltip="<%=menu.getString("gotorecentitem.tooltip", fullName, itemText)%>" |
---|
328 | /> |
---|
329 | <% |
---|
330 | } |
---|
331 | } |
---|
332 | catch (Throwable t) |
---|
333 | {} |
---|
334 | } |
---|
335 | } |
---|
336 | if (stickyItems != null && stickyItems.length() > 0) |
---|
337 | { |
---|
338 | int numSticky = 0; |
---|
339 | if (numItems > 0) |
---|
340 | { |
---|
341 | %> |
---|
342 | <m:menuseparator /> |
---|
343 | <% |
---|
344 | } |
---|
345 | %> |
---|
346 | <m:menuitem |
---|
347 | title="<%=menu.getString("stickyitems.title")%>" |
---|
348 | subclass="menusection" |
---|
349 | enabled="false" |
---|
350 | /> |
---|
351 | <m:menuseparator /> |
---|
352 | <% |
---|
353 | // Sticky items |
---|
354 | for (String recentItem : stickyItems.split(":")) |
---|
355 | { |
---|
356 | try |
---|
357 | { |
---|
358 | BasicItem item = null; |
---|
359 | Item itemType = Item.valueOf(recentItem); |
---|
360 | ItemContext cc = sc.getCurrentContext(itemType); |
---|
361 | String itemTextKey = "item." + itemType.name().toLowerCase(); |
---|
362 | String itemText = common.getString(itemTextKey); |
---|
363 | if (itemText == itemTextKey) itemText = itemType.toString(); |
---|
364 | if (cc.getId() != 0) |
---|
365 | { |
---|
366 | String shortName = ""; |
---|
367 | String fullName = ""; |
---|
368 | int noEdit = 1; |
---|
369 | if (loadNames) |
---|
370 | { |
---|
371 | try |
---|
372 | { |
---|
373 | item = itemType.getById(dc, cc.getId()); |
---|
374 | fullName = ((Nameable)item).getName(); |
---|
375 | shortName = ": " + HTML.encodeTags(StringUtil.trimString(fullName, 30)); |
---|
376 | noEdit = item.hasPermission(Permission.WRITE) ? 0 : 1; |
---|
377 | } |
---|
378 | catch (Throwable t) |
---|
379 | { |
---|
380 | continue; |
---|
381 | } |
---|
382 | } |
---|
383 | else |
---|
384 | { |
---|
385 | fullName = itemText + "; id=" + cc.getId(); |
---|
386 | shortName = " (id=" + cc.getId() + ")"; |
---|
387 | } |
---|
388 | numItems++; |
---|
389 | numSticky++; |
---|
390 | %> |
---|
391 | <m:menuitem |
---|
392 | title="<%=itemText + shortName%>" |
---|
393 | subclass="auto-init" |
---|
394 | data-auto-init="item-link" |
---|
395 | data-item-type="<%=itemType.name() %>" |
---|
396 | data-item-id="<%=cc.getId() %>" |
---|
397 | data-no-edit="<%=noEdit %>" |
---|
398 | tooltip="<%=menu.getString("gotorecentitem.tooltip", fullName, itemText)%>" |
---|
399 | /> |
---|
400 | <% |
---|
401 | if (itemType == Item.BIOASSAYSET) |
---|
402 | { |
---|
403 | // Add menu for Experiment explorer as well |
---|
404 | %> |
---|
405 | <m:menuitem |
---|
406 | title="<%=menu.getString("experimentexplorer.title", shortName)%>" |
---|
407 | url="<%=root+"views/experiments/explorer/view/index.jsp?ID=" + ID + "&bioassayset_id="+cc.getId()%>" |
---|
408 | tooltip="<%=menu.getString("experimentexplorer.tooltip")%>" |
---|
409 | visible="<%=item == null || ((BioAssaySet)item).getNumSpots() > 0 %>" |
---|
410 | /> |
---|
411 | <% |
---|
412 | } |
---|
413 | } |
---|
414 | } |
---|
415 | catch (Throwable t) |
---|
416 | {} |
---|
417 | } |
---|
418 | if (numSticky == 0) |
---|
419 | { |
---|
420 | %> |
---|
421 | <m:menuitem |
---|
422 | title="<%="<i>- " + menu.getString("nostickyitems.title") + " -</i>"%>" |
---|
423 | enabled="false" |
---|
424 | /> |
---|
425 | <% |
---|
426 | } |
---|
427 | } |
---|
428 | %> |
---|
429 | <m:menuseparator /> |
---|
430 | <m:menuitem |
---|
431 | title="<%=menu.getString("recentoptions.title") + "…"%>" |
---|
432 | url="<%=root+"my_base/user/preferences.jsp?ID="+ID+"&page=mostRecent"%>" |
---|
433 | data-popup="Preferences, 600, 400" |
---|
434 | tooltip="<%=menu.getString("recentoptions.tooltip")%>" |
---|
435 | /> |
---|
436 | </m:menu> |
---|
437 | <% |
---|
438 | } |
---|
439 | finally |
---|
440 | { |
---|
441 | if (dc != null) dc.close(); |
---|
442 | } |
---|
443 | } |
---|
444 | else if ("standard".equals(name)) |
---|
445 | { |
---|
446 | final DbControl dc = sc.newDbControl(); |
---|
447 | StringBuilder fillText = new StringBuilder(); |
---|
448 | try |
---|
449 | { |
---|
450 | Project activeProject = sc.getActiveProjectId() == 0 ? null : Project.getById(dc, sc.getActiveProjectId()); |
---|
451 | if (activeProject == null) |
---|
452 | { |
---|
453 | fillText.append("<img src=\""+root+"images/no_active_project.png\" alt=\"\"> "); |
---|
454 | fillText.append("<span style=\"color:#FF0000;\" title=\"" + menu.getString("menu.projects.tooltip.0") + "\""); |
---|
455 | } |
---|
456 | else |
---|
457 | { |
---|
458 | fillText.append("<img src=\""+root+"images/project.png\" alt=\"\"> "); |
---|
459 | fillText.append("<span title=\"" + menu.getString("menu.projects.tooltip.1") + "\""); |
---|
460 | } |
---|
461 | |
---|
462 | fillText.append(" class=\"link auto-init\" data-auto-init=\"menu-anchor\" data-menu-id=\"menu.projects\" data-align-right=\"1\">"); |
---|
463 | fillText.append(activeProject == null ? "<i>" + menu.getString("noactiveproject.title") + "</i>" : HTML.encodeTags(activeProject.getName())); |
---|
464 | fillText.append("<img src=\""+root+"images/sort_asc.png\" alt=\"▼\"></span><span class=\"menuseparator\"></span>"); |
---|
465 | |
---|
466 | fillText.append("<span id=\"page-reload\" class=\"link\" title=\"" + menu.getString("menu.refresh.tooltip") + "\">"); |
---|
467 | fillText.append("<img src=\""+root+"images/refresh.png\" alt=\"Reload\"></span>"); |
---|
468 | fillText.append("<span class=\"menuseparator\"></span>"); |
---|
469 | |
---|
470 | fillText.append("<span class=\"link auto-init\" title=\"").append(menu.getString("menu.recentitems.tooltip")).append("\""); |
---|
471 | fillText.append(" data-auto-init=\"menu-anchor\" data-menu-id=\"menu.mostRecent\" data-align-right=\"1\">"); |
---|
472 | fillText.append("<img src=\""+root+"images/recent.png\" alt=\"Recent\"><img src=\""+root+"images/sort_asc.png\" alt=\"▼\"></span>"); |
---|
473 | fillText.append("<span class=\"menuseparator\"></span>"); |
---|
474 | |
---|
475 | User user = User.getById(dc, sc.getLoggedInUserId()); |
---|
476 | fillText.append("<img src=\""+root+"images/take_ownership.png\" alt=\"\"> "); |
---|
477 | fillText.append("<span class=\"link auto-init\" title=\"").append(menu.getString("menu.user.tooltip")).append("\""); |
---|
478 | fillText.append(" data-auto-init=\"menu-anchor\" data-menu-id=\"menu.switchuser\" data-align-right=\"1\">"); |
---|
479 | fillText.append(HTML.encodeTags(user.getLogin())); |
---|
480 | fillText.append(" (").append(user.getName()).append(")<img src=\""+root+"images/sort_asc.png\" alt=\"▼\"></span>"); |
---|
481 | |
---|
482 | // Permission settings |
---|
483 | final boolean hasItemLists = !sc.hasPermission(Permission.DENIED, Item.ITEMLIST); |
---|
484 | final boolean hasFiles = !sc.hasPermission(Permission.DENIED, Item.FILE); |
---|
485 | final boolean createFiles = sc.hasPermission(Permission.CREATE, Item.FILE); |
---|
486 | final boolean hasFileServers = !sc.hasPermission(Permission.DENIED, Item.FILESERVER); |
---|
487 | |
---|
488 | final boolean hasProjects = !sc.hasPermission(Permission.DENIED, Item.PROJECT); |
---|
489 | final boolean createProjects = sc.hasPermission(Permission.CREATE, Item.PROJECT); |
---|
490 | final boolean hasPermissionTemplates = !sc.hasPermission(Permission.DENIED, Item.PERMISSIONTEMPLATE); |
---|
491 | |
---|
492 | final boolean hasMessages = !sc.hasPermission(Permission.DENIED, Item.MESSAGE); |
---|
493 | final boolean createMessages = sc.hasPermission(Permission.CREATE, Item.MESSAGE); |
---|
494 | |
---|
495 | final boolean hasPhysicalBioAssays = !sc.hasPermission(Permission.DENIED, Item.PHYSICALBIOASSAY); |
---|
496 | final boolean hasDerivedBioAssays = !sc.hasPermission(Permission.DENIED, Item.DERIVEDBIOASSAY); |
---|
497 | |
---|
498 | final boolean hasRawBioAssays = !sc.hasPermission(Permission.DENIED, Item.RAWBIOASSAY); |
---|
499 | final boolean createRawBioAssays = sc.hasPermission(Permission.CREATE, Item.RAWBIOASSAY); |
---|
500 | final boolean hasExperiments = !sc.hasPermission(Permission.DENIED, Item.EXPERIMENT); |
---|
501 | final boolean createExperiments = sc.hasPermission(Permission.CREATE, Item.EXPERIMENT); |
---|
502 | final boolean hasFormulas = !sc.hasPermission(Permission.DENIED, Item.FORMULA); |
---|
503 | final boolean createFormulas = sc.hasPermission(Permission.CREATE, Item.FORMULA); |
---|
504 | |
---|
505 | final boolean hasReporters = !sc.hasPermission(Permission.DENIED, Item.REPORTER); |
---|
506 | final boolean hasReporterLists = !sc.hasPermission(Permission.DENIED, Item.REPORTERLIST); |
---|
507 | final boolean createReporters = sc.hasPermission(Permission.CREATE, Item.REPORTER); |
---|
508 | final boolean hasJobs = !sc.hasPermission(Permission.DENIED, Item.JOB); |
---|
509 | final boolean hasSessions = !sc.hasPermission(Permission.DENIED, Item.SESSION); |
---|
510 | final boolean hasDevices = !sc.hasPermission(Permission.DENIED, Item.USERDEVICE); |
---|
511 | final boolean supportsDeviceVerification = EmailUtil.isEnabled() && |
---|
512 | (user.getUseDeviceVerification() || sc.hasPermission(Permission.READ, Item.USERDEVICE)); |
---|
513 | %> |
---|
514 | <m:menu |
---|
515 | id="menu.view" |
---|
516 | style="display: none" |
---|
517 | > |
---|
518 | <m:menuitem |
---|
519 | title="<%=menu.getString("home.title")%>" |
---|
520 | tooltip="<%=menu.getString("home.tooltip")%>" |
---|
521 | url="<%=root+"my_base/index.jsp?ID="+ID%>" |
---|
522 | /> |
---|
523 | <m:menuitem |
---|
524 | title="<%=menu.getString("allitems.title")%>" |
---|
525 | tooltip="<%=menu.getString("allitems.tooltip")%>" |
---|
526 | url="<%=root+"views/items/index.jsp?ID="+ID%>" |
---|
527 | /> |
---|
528 | <m:menuitem |
---|
529 | title="<%=menu.getString("itemlists.title")%>" |
---|
530 | tooltip="<%=menu.getString("itemlists.tooltip", hasItemLists)%>" |
---|
531 | url="<%=root+"views/itemlists/index.jsp?ID="+ID%>" |
---|
532 | enabled="<%=hasItemLists%>" |
---|
533 | /> |
---|
534 | <m:menuitem |
---|
535 | title="<%=menu.getString("trashcan.title")%>" |
---|
536 | tooltip="<%=menu.getString("trashcan.tooltip")%>" |
---|
537 | url="<%=root+"views/trashcan/index.jsp?ID="+ID%>" |
---|
538 | /> |
---|
539 | <m:menuseparator /> |
---|
540 | <m:menuitem |
---|
541 | title="<%=common.getString("item.file+")%>" |
---|
542 | url="<%=root+"filemanager/index.jsp?ID="+ID%>" |
---|
543 | tooltip="<%=menu.getString("files.tooltip", hasFiles)%>" |
---|
544 | enabled="<%=hasFiles%>" |
---|
545 | /> |
---|
546 | <m:menuitem |
---|
547 | title="<%=common.getString("item.fileserver+")%>" |
---|
548 | url="<%=root+"filemanager/fileservers/index.jsp?ID="+ID%>" |
---|
549 | tooltip="<%=menu.getString("fileservers.tooltip", hasFileServers)%>" |
---|
550 | enabled="<%=hasFileServers%>" |
---|
551 | /> |
---|
552 | <m:menuitem |
---|
553 | title="<%=common.getString("item.project+")%>" |
---|
554 | url="<%=root+"my_base/projects/index.jsp?ID="+ID%>" |
---|
555 | tooltip="<%=menu.getString("projects.tooltip", hasProjects)%>" |
---|
556 | enabled="<%=hasProjects%>" |
---|
557 | /> |
---|
558 | <m:menuitem |
---|
559 | title="<%=common.getString("item.permissiontemplate+")%>" |
---|
560 | url="<%=root+"views/permissiontemplates/index.jsp?ID="+ID%>" |
---|
561 | tooltip="<%=menu.getString("permissiontemplates.tooltip", hasPermissionTemplates)%>" |
---|
562 | enabled="<%=hasPermissionTemplates%>" |
---|
563 | /> |
---|
564 | <m:menuitem |
---|
565 | title="<%=common.getString("item.message+")%>" |
---|
566 | url="<%=root+"my_base/messages/index.jsp?ID="+ID%>" |
---|
567 | tooltip="<%=menu.getString("messages.tooltip", hasMessages)%>" |
---|
568 | enabled="<%=hasMessages%>" |
---|
569 | /> |
---|
570 | <m:menuitem |
---|
571 | title="<%=common.getString("item.job+")%>" |
---|
572 | url="<%=root+"views/jobs/index.jsp?ID="+ID%>" |
---|
573 | tooltip="<%=menu.getString("jobs.tooltip", hasJobs)%>" |
---|
574 | enabled="<%=hasJobs%>" |
---|
575 | /> |
---|
576 | <m:menuseparator /> |
---|
577 | <m:menuitem |
---|
578 | title="<%=common.getString("item.physicalbioassay+")%>" |
---|
579 | url="<%=root+"views/physicalbioassays/index.jsp?ID="+ID%>" |
---|
580 | tooltip="<%=menu.getString("physicalbioassays.tooltip", hasPhysicalBioAssays)%>" |
---|
581 | enabled="<%=hasPhysicalBioAssays%>" |
---|
582 | /> |
---|
583 | <m:menuitem |
---|
584 | title="<%=common.getString("item.derivedbioassay+")%>" |
---|
585 | url="<%=root+"views/derivedbioassays/index.jsp?ID="+ID%>" |
---|
586 | tooltip="<%=menu.getString("derivedbioassays.tooltip", hasDerivedBioAssays)%>" |
---|
587 | enabled="<%=hasDerivedBioAssays%>" |
---|
588 | /> |
---|
589 | <m:menuitem |
---|
590 | title="<%=common.getString("item.rawbioassay+")%>" |
---|
591 | url="<%=root+"views/rawbioassays/index.jsp?ID="+ID%>" |
---|
592 | tooltip="<%=menu.getString("rawbioassays.tooltip", hasRawBioAssays)%>" |
---|
593 | enabled="<%=hasRawBioAssays%>" |
---|
594 | /> |
---|
595 | <m:menuitem |
---|
596 | title="<%=common.getString("item.experiment+")%>" |
---|
597 | url="<%=root+"views/experiments/index.jsp?ID="+ID%>" |
---|
598 | tooltip="<%=menu.getString("experiments.tooltip", hasExperiments)%>" |
---|
599 | enabled="<%=hasExperiments%>" |
---|
600 | /> |
---|
601 | <m:menuitem |
---|
602 | title="<%=common.getString("item.formula+")%>" |
---|
603 | url="<%=root+"views/formulas/index.jsp?ID="+ID%>" |
---|
604 | tooltip="<%=menu.getString("formulas.tooltip", hasFormulas)%>" |
---|
605 | enabled="<%=hasFormulas%>" |
---|
606 | /> |
---|
607 | <m:menuseparator /> |
---|
608 | <m:menuitem |
---|
609 | title="<%=common.getString("item.reporter+")%>" |
---|
610 | url="<%=root+"views/reporters/index.jsp?ID="+ID%>" |
---|
611 | tooltip="<%=menu.getString("reporters.tooltip", hasReporters)%>" |
---|
612 | enabled="<%=hasReporters%>" |
---|
613 | /> |
---|
614 | <m:menuitem |
---|
615 | title="<%=common.getString("item.reporterlist+")%>" |
---|
616 | url="<%=root+"views/reporterlists/index.jsp?ID="+ID%>" |
---|
617 | tooltip="<%=menu.getString("reporterlists.tooltip", hasReporterLists)%>" |
---|
618 | enabled="<%=hasReporterLists%>" |
---|
619 | /> |
---|
620 | </m:menu> |
---|
621 | |
---|
622 | <m:menu |
---|
623 | id="menu.base" |
---|
624 | style="display: none" |
---|
625 | > |
---|
626 | <m:submenu |
---|
627 | subid="menu.projects" |
---|
628 | title="<%=menu.getString("menu.projects")%>" |
---|
629 | tooltip="<%=menu.getString("menu.projects.tooltip", activeProject != null)%>" |
---|
630 | enabled="<%=hasProjects%>" |
---|
631 | /> |
---|
632 | <m:menuseparator /> |
---|
633 | <m:menuitem |
---|
634 | title="<%=menu.getString("contactinfo.title") + "…"%>" |
---|
635 | url="<%=root+"my_base/user/settings.jsp?ID="+ID+"&page=contact"%>" |
---|
636 | data-popup="Settings, 600, 400" |
---|
637 | tooltip="<%=menu.getString("contactinfo.tooltip")%>" |
---|
638 | /> |
---|
639 | <m:menuitem |
---|
640 | title="<%=menu.getString("password.title") + "…"%>" |
---|
641 | url="<%=root+"my_base/user/settings.jsp?ID="+ID+"&page=password"%>" |
---|
642 | data-popup="Settings, 600, 400" |
---|
643 | tooltip="<%=menu.getString("password.tooltip")%>" |
---|
644 | /> |
---|
645 | <m:menuitem |
---|
646 | title="<%=menu.getString("other.title") + "…"%>" |
---|
647 | url="<%=root+"my_base/user/settings.jsp?ID="+ID+"&page=other"%>" |
---|
648 | data-popup="Settings, 600, 400" |
---|
649 | tooltip="<%=menu.getString("other.tooltip")%>" |
---|
650 | /> |
---|
651 | <m:menuseparator /> |
---|
652 | <m:menuitem |
---|
653 | title="<%=menu.getString("preferences.title") + "…"%>" |
---|
654 | url="<%=root+"my_base/user/preferences.jsp?ID="+ID%>" |
---|
655 | data-popup="Preferences, 600, 400" |
---|
656 | tooltip="<%=menu.getString("preferences.tooltip")%>" |
---|
657 | /> |
---|
658 | <m:menuitem |
---|
659 | title="<%=menu.getString("reloadpermissions.title") + "…"%>" |
---|
660 | url="<%=root+"my_base/user/submit_user.jsp?ID="+ID+"&cmd=ReloadPermissions"%>" |
---|
661 | data-popup="ReloadPermissions, 300, 200" |
---|
662 | tooltip="<%=menu.getString("reloadpermissions.tooltip")%>" |
---|
663 | /> |
---|
664 | <m:menuitem |
---|
665 | title="<%=menu.getString("resetlistsettings.title") + "…"%>" |
---|
666 | url="<%=root+"my_base/user/reset_filters.jsp?ID="+ID%>" |
---|
667 | data-popup="ResetFilter, 450, 300" |
---|
668 | tooltip="<%=menu.getString("resetlistsettings.tooltip")%>" |
---|
669 | /> |
---|
670 | <m:menuseparator /> |
---|
671 | <m:menuitem |
---|
672 | title="<%=common.getString("item.userdevice+")%>" |
---|
673 | url="<%=root+"views/devices/index.jsp?ID="+ID%>" |
---|
674 | tooltip="<%=menu.getString("devices.tooltip", hasDevices)%>" |
---|
675 | enabled="<%=hasDevices%>" |
---|
676 | visible="<%=supportsDeviceVerification %>" |
---|
677 | /> |
---|
678 | <m:menuitem |
---|
679 | title="<%=common.getString("item.session+")%>" |
---|
680 | url="<%=root+"views/sessions/index.jsp?ID="+ID%>" |
---|
681 | tooltip="<%=menu.getString("sessions.tooltip", hasSessions)%>" |
---|
682 | enabled="<%=hasSessions%>" |
---|
683 | /> |
---|
684 | <m:menuseparator /> |
---|
685 | <m:menuitem |
---|
686 | title="<%=menu.getString("logout.title") + "…"%>" |
---|
687 | url="<%=root+"logout.jsp?ID="+ID%>" |
---|
688 | data-popup="Logout, 300, 200" |
---|
689 | tooltip="<%=menu.getString("logout.tooltip")%>" |
---|
690 | /> |
---|
691 | </m:menu> |
---|
692 | <% |
---|
693 | // BioLIMS - menu |
---|
694 | final boolean hasTags = !sc.hasPermission(Permission.DENIED, Item.TAG); |
---|
695 | final boolean createTags = sc.hasPermission(Permission.CREATE, Item.TAG); |
---|
696 | |
---|
697 | final boolean hasBioSources = !sc.hasPermission(Permission.DENIED, Item.BIOSOURCE); |
---|
698 | final boolean createBioSources = sc.hasPermission(Permission.CREATE, Item.BIOSOURCE); |
---|
699 | |
---|
700 | final boolean hasSamples = !sc.hasPermission(Permission.DENIED, Item.SAMPLE); |
---|
701 | final boolean createSamples = sc.hasPermission(Permission.CREATE, Item.SAMPLE); |
---|
702 | |
---|
703 | final boolean hasExtracts = !sc.hasPermission(Permission.DENIED, Item.EXTRACT); |
---|
704 | final boolean createExtracts = sc.hasPermission(Permission.CREATE, Item.EXTRACT); |
---|
705 | |
---|
706 | final boolean hasBioPlates = !sc.hasPermission(Permission.DENIED, Item.BIOPLATE); |
---|
707 | final boolean createBioPlates = sc.hasPermission(Permission.CREATE, Item.BIOPLATE); |
---|
708 | final boolean hasBioPlateTypes = !sc.hasPermission(Permission.DENIED, Item.BIOPLATETYPE); |
---|
709 | final boolean hasBioPlateEventTypes = !sc.hasPermission(Permission.DENIED, Item.BIOPLATEEVENTTYPE); |
---|
710 | |
---|
711 | final boolean hasKits = !sc.hasPermission(Permission.DENIED, Item.KIT); |
---|
712 | |
---|
713 | final boolean hasBioLims = hasTags || hasBioSources || hasSamples || hasExtracts || |
---|
714 | hasBioPlates || hasBioPlateTypes || hasBioPlateEventTypes || |
---|
715 | hasKits; |
---|
716 | |
---|
717 | if (hasBioLims) |
---|
718 | { |
---|
719 | %> |
---|
720 | <m:menu |
---|
721 | id="menu.biolims" |
---|
722 | style="display: none" |
---|
723 | > |
---|
724 | <m:menuitem |
---|
725 | title="<%=common.getString("item.biosource+")%>" |
---|
726 | url="<%=root+"biomaterials/biosources/index.jsp?ID="+ID%>" |
---|
727 | tooltip="<%=menu.getString("biosources.tooltip", hasBioSources)%>" |
---|
728 | enabled="<%=hasBioSources%>" |
---|
729 | /> |
---|
730 | <m:menuitem |
---|
731 | title="<%=common.getString("item.sample+")%>" |
---|
732 | url="<%=root+"biomaterials/samples/index.jsp?ID="+ID%>" |
---|
733 | tooltip="<%=menu.getString("samples.tooltip", hasSamples)%>" |
---|
734 | enabled="<%=hasSamples%>" |
---|
735 | /> |
---|
736 | <m:menuitem |
---|
737 | title="<%=common.getString("item.extract+")%>" |
---|
738 | url="<%=root+"biomaterials/extracts/index.jsp?ID="+ID%>" |
---|
739 | tooltip="<%=menu.getString("extracts.tooltip", hasExtracts)%>" |
---|
740 | enabled="<%=hasExtracts%>" |
---|
741 | /> |
---|
742 | <m:menuseparator /> |
---|
743 | <m:menuitem |
---|
744 | title="<%=common.getString("item.tag+")%>" |
---|
745 | url="<%=root+"biomaterials/tags/index.jsp?ID="+ID%>" |
---|
746 | tooltip="<%=menu.getString("tags.tooltip", hasTags)%>" |
---|
747 | enabled="<%=hasTags%>" |
---|
748 | /> |
---|
749 | <m:menuitem |
---|
750 | title="<%=common.getString("item.kit+")%>" |
---|
751 | url="<%=root+"biomaterials/kits/index.jsp?ID="+ID%>" |
---|
752 | tooltip="<%=menu.getString("kits.tooltip", hasKits)%>" |
---|
753 | enabled="<%=hasKits%>" |
---|
754 | /> |
---|
755 | <m:menuseparator /> |
---|
756 | <m:menuitem |
---|
757 | title="<%=common.getString("item.bioplate+")%>" |
---|
758 | url="<%=root+"biomaterials/bioplates/index.jsp?ID="+ID%>" |
---|
759 | tooltip="<%=menu.getString("bioplates.tooltip", hasBioPlates)%>" |
---|
760 | enabled="<%=hasBioPlates%>" |
---|
761 | /> |
---|
762 | <m:menuitem |
---|
763 | title="<%=common.getString("item.bioplatetype+")%>" |
---|
764 | url="<%=root+"biomaterials/bioplatetypes/index.jsp?ID="+ID%>" |
---|
765 | tooltip="<%=menu.getString("bioplatetypes.tooltip", hasBioPlateTypes)%>" |
---|
766 | enabled="<%=hasBioPlateTypes%>" |
---|
767 | /> |
---|
768 | <m:menuitem |
---|
769 | title="<%=common.getString("item.bioplateeventtype+")%>" |
---|
770 | url="<%=root+"biomaterials/bioplateeventtypes/index.jsp?ID="+ID%>" |
---|
771 | tooltip="<%=menu.getString("bioplateeventtypes.tooltip", hasBioPlateEventTypes)%>" |
---|
772 | enabled="<%=hasBioPlateEventTypes%>" |
---|
773 | /> |
---|
774 | </m:menu> |
---|
775 | <% |
---|
776 | } |
---|
777 | |
---|
778 | // Array LIMS - menu |
---|
779 | final boolean hasPlateGeometries = sc.hasPermission(Permission.READ, Item.PLATEGEOMETRY); |
---|
780 | final boolean hasPlateTypes = !sc.hasPermission(Permission.DENIED, Item.PLATETYPE); |
---|
781 | final boolean hasPlates = !sc.hasPermission(Permission.DENIED, Item.PLATE); |
---|
782 | final boolean hasPlateMappings = !sc.hasPermission(Permission.DENIED, Item.PLATEMAPPING); |
---|
783 | final boolean hasArraySlides = !sc.hasPermission(Permission.DENIED, Item.ARRAYSLIDE); |
---|
784 | final boolean hasArrayBatches = !sc.hasPermission(Permission.DENIED, Item.ARRAYBATCH); |
---|
785 | final boolean hasArrayDesigns = !sc.hasPermission(Permission.DENIED, Item.ARRAYDESIGN); |
---|
786 | final boolean hasLims = hasPlateGeometries || hasPlateTypes || hasPlates || hasPlateMappings || |
---|
787 | hasArraySlides || hasArrayBatches || hasArrayDesigns; |
---|
788 | if (hasLims) |
---|
789 | { |
---|
790 | %> |
---|
791 | <m:menu |
---|
792 | id="menu.lims" |
---|
793 | style="display: none" |
---|
794 | > |
---|
795 | <m:menuitem |
---|
796 | title="<%=common.getString("item.plategeometry+")%>" |
---|
797 | url="<%=root+"lims/geometries/index.jsp?ID="+ID%>" |
---|
798 | tooltip="<%=menu.getString("plategeometries.tooltip", hasPlateGeometries)%>" |
---|
799 | enabled="<%=hasPlateGeometries%>" |
---|
800 | /> |
---|
801 | <m:menuitem |
---|
802 | title="<%=common.getString("item.platetype+")%>" |
---|
803 | url="<%=root+"lims/platetypes/index.jsp?ID="+ID%>" |
---|
804 | tooltip="<%=menu.getString("platetypes.tooltip", hasPlateTypes)%>" |
---|
805 | enabled="<%=hasPlateTypes%>" |
---|
806 | /> |
---|
807 | <m:menuitem |
---|
808 | title="<%=common.getString("item.plate+")%>" |
---|
809 | url="<%=root+"lims/plates/index.jsp?ID="+ID%>" |
---|
810 | tooltip="<%=menu.getString("plates.tooltip", hasPlates)%>" |
---|
811 | enabled="<%=hasPlates%>" |
---|
812 | /> |
---|
813 | <m:menuitem |
---|
814 | title="<%=common.getString("item.platemapping+")%>" |
---|
815 | url="<%=root+"lims/platemappings/index.jsp?ID="+ID%>" |
---|
816 | tooltip="<%=menu.getString("platetypes.tooltip", hasPlateTypes)%>" |
---|
817 | enabled="<%=hasPlateTypes%>" |
---|
818 | /> |
---|
819 | <m:menuseparator /> |
---|
820 | <m:menuitem |
---|
821 | title="<%=common.getString("item.arraydesign+")%>" |
---|
822 | url="<%=root+"lims/arraydesigns/index.jsp?ID="+ID%>" |
---|
823 | tooltip="<%=menu.getString("arraydesigns.tooltip", hasArrayDesigns)%>" |
---|
824 | enabled="<%=hasArrayDesigns%>" |
---|
825 | /> |
---|
826 | <m:menuitem |
---|
827 | title="<%=common.getString("item.arraybatch+")%>" |
---|
828 | url="<%=root+"lims/arraybatches/index.jsp?ID="+ID%>" |
---|
829 | tooltip="<%=menu.getString("arraybatches.tooltip", hasArrayBatches)%>" |
---|
830 | enabled="<%=hasArrayBatches%>" |
---|
831 | /> |
---|
832 | <m:menuitem |
---|
833 | title="<%=common.getString("item.arrayslide+")%>" |
---|
834 | url="<%=root+"lims/arrayslides/index.jsp?ID="+ID%>" |
---|
835 | tooltip="<%=menu.getString("arrayslides.tooltip", hasArraySlides)%>" |
---|
836 | enabled="<%=hasArraySlides%>" |
---|
837 | /> |
---|
838 | </m:menu> |
---|
839 | <% |
---|
840 | } |
---|
841 | // Administrate -> Types menu |
---|
842 | final boolean hasQuotaTypes = sc.hasPermission(Permission.READ, Item.QUOTATYPE); |
---|
843 | final boolean hasMimeTypes = sc.hasPermission(Permission.READ, Item.MIMETYPE); |
---|
844 | final boolean hasAnnotationTypeCategories = !sc.hasPermission(Permission.DENIED, Item.ANNOTATIONTYPECATEGORY); |
---|
845 | final boolean hasAnnotationTypes = !sc.hasPermission(Permission.DENIED, Item.ANNOTATIONTYPE); |
---|
846 | final boolean hasReporterTypes = !sc.hasPermission(Permission.DENIED, Item.REPORTERTYPE); |
---|
847 | final boolean hasExtraValueTypes = !sc.hasPermission(Permission.DENIED, Item.EXTRAVALUETYPE); |
---|
848 | final boolean hasQuantities = !sc.hasPermission(Permission.DENIED, Item.QUANTITY); |
---|
849 | final boolean hasItemSubtypes = sc.hasPermission(Permission.READ, Item.ITEMSUBTYPE); |
---|
850 | final boolean hasTypes = hasMimeTypes || hasQuotaTypes || |
---|
851 | hasAnnotationTypeCategories || hasAnnotationTypes || |
---|
852 | hasReporterTypes || hasExtraValueTypes || hasQuantities || hasItemSubtypes; |
---|
853 | if (hasTypes) |
---|
854 | { |
---|
855 | %> |
---|
856 | <m:menu |
---|
857 | id="menu.types" |
---|
858 | style="display: none" |
---|
859 | > |
---|
860 | <m:menuitem |
---|
861 | title="<%=common.getString("item.itemsubtype+")%>" |
---|
862 | url="<%=root+"admin/itemsubtypes/index.jsp?ID="+ID%>" |
---|
863 | tooltip="<%=menu.getString("itemsubtypes.tooltip", hasItemSubtypes)%>" |
---|
864 | enabled="<%=hasItemSubtypes%>" |
---|
865 | /> |
---|
866 | <m:menuseparator /> |
---|
867 | <m:menuitem |
---|
868 | title="<%=common.getString("item.annotationtype+")%>" |
---|
869 | url="<%=root+"admin/annotationtypes/index.jsp?ID="+ID%>" |
---|
870 | tooltip="<%=menu.getString("annotationtypes.tooltip", hasAnnotationTypes)%>" |
---|
871 | enabled="<%=hasAnnotationTypes%>" |
---|
872 | /> |
---|
873 | <m:menuitem |
---|
874 | title="<%=common.getString("item.annotationtypecategory+")%>" |
---|
875 | url="<%=root+"admin/annotationtypecategories/index.jsp?ID="+ID%>" |
---|
876 | tooltip="<%=menu.getString("annotationtypecategories.tooltip", hasAnnotationTypeCategories)%>" |
---|
877 | enabled="<%=hasAnnotationTypeCategories%>" |
---|
878 | /> |
---|
879 | <m:menuseparator /> |
---|
880 | <m:menuitem |
---|
881 | title="<%=common.getString("item.mimetype+")%>" |
---|
882 | url="<%=root+"admin/mimetypes/index.jsp?ID="+ID%>" |
---|
883 | tooltip="<%=menu.getString("mimetypes.tooltip", hasMimeTypes)%>" |
---|
884 | enabled="<%=hasMimeTypes%>" |
---|
885 | /> |
---|
886 | <m:menuitem |
---|
887 | title="<%=common.getString("item.quotatype+")%>" |
---|
888 | url="<%=root+"admin/quotatypes/index.jsp?ID="+ID%>" |
---|
889 | tooltip="<%=menu.getString("quotatypes.tooltip", hasQuotaTypes)%>" |
---|
890 | enabled="<%=hasQuotaTypes%>" |
---|
891 | /> |
---|
892 | <m:menuitem |
---|
893 | title="<%=common.getString("item.reportertype+")%>" |
---|
894 | url="<%=root+"admin/reportertypes/index.jsp?ID="+ID%>" |
---|
895 | tooltip="<%=menu.getString("reportertypes.tooltip", hasReporterTypes)%>" |
---|
896 | enabled="<%=hasReporterTypes%>" |
---|
897 | /> |
---|
898 | <m:menuitem |
---|
899 | title="<%=common.getString("item.extravaluetype+")%>" |
---|
900 | url="<%=root+"admin/extravaluetypes/index.jsp?ID="+ID%>" |
---|
901 | tooltip="<%=menu.getString("extravaluetypes.tooltip", hasExtraValueTypes)%>" |
---|
902 | enabled="<%=hasExtraValueTypes%>" |
---|
903 | /> |
---|
904 | <m:menuseparator /> |
---|
905 | <m:menuitem |
---|
906 | title="<%=menu.getString("units+quantities.title")%>" |
---|
907 | url="<%=root+"admin/quantities/index.jsp?ID="+ID%>" |
---|
908 | tooltip="<%=menu.getString("units+quantities.tooltip", hasQuantities)%>" |
---|
909 | enabled="<%=hasQuantities%>" |
---|
910 | /> |
---|
911 | </m:menu> |
---|
912 | <% |
---|
913 | } |
---|
914 | // Administrate -> Platforms menu |
---|
915 | final boolean hasPlatforms = sc.hasPermission(Permission.READ, Item.PLATFORM); |
---|
916 | final boolean hasFileSetMemberTypes = sc.hasPermission(Permission.READ, Item.DATAFILETYPE); |
---|
917 | final boolean hasTopPlatforms = hasPlatforms || hasFileSetMemberTypes; |
---|
918 | if (hasTopPlatforms) |
---|
919 | { |
---|
920 | %> |
---|
921 | <m:menu |
---|
922 | id="menu.platforms" |
---|
923 | style="display: none" |
---|
924 | > |
---|
925 | <m:menuitem |
---|
926 | title="<%=common.getString("item.platform+")%>" |
---|
927 | url="<%=root+"admin/platforms/index.jsp?ID="+ID%>" |
---|
928 | tooltip="<%=menu.getString("platforms.tooltip", hasPlatforms)%>" |
---|
929 | enabled="<%=hasPlatforms%>" |
---|
930 | /> |
---|
931 | <m:menuitem |
---|
932 | title="<%=common.getString("item.datafiletype+")%>" |
---|
933 | url="<%=root+"admin/datafiletypes/index.jsp?ID="+ID%>" |
---|
934 | tooltip="<%=menu.getString("datafiletypes.tooltip", hasFileSetMemberTypes)%>" |
---|
935 | enabled="<%=hasFileSetMemberTypes%>" |
---|
936 | /> |
---|
937 | </m:menu> |
---|
938 | <% |
---|
939 | } |
---|
940 | // Plugins menu |
---|
941 | final boolean hasPluginTypes = !sc.hasPermission(Permission.DENIED, Item.PLUGINTYPE); |
---|
942 | final boolean hasPluginDefinitions = !sc.hasPermission(Permission.DENIED, Item.PLUGINDEFINITION); |
---|
943 | final boolean hasPluginConfigurations = !sc.hasPermission(Permission.DENIED, Item.PLUGINCONFIGURATION); |
---|
944 | final boolean hasJobAgents = sc.hasPermission(Permission.READ, Item.JOBAGENT); |
---|
945 | final boolean hasPlugins = hasPluginTypes || hasPluginDefinitions || |
---|
946 | hasPluginConfigurations || hasJobAgents; |
---|
947 | |
---|
948 | if (hasPlugins) |
---|
949 | { |
---|
950 | %> |
---|
951 | <m:menu |
---|
952 | id="menu.plugins" |
---|
953 | style="display: none" |
---|
954 | > |
---|
955 | <m:menuitem |
---|
956 | title="<%=menu.getString("installedextensions.title")%>" |
---|
957 | url="<%=root+"admin/extensions/index.jsp?ID="+ID%>" |
---|
958 | tooltip="<%=menu.getString("installedextensions.tooltip")%>" |
---|
959 | /> |
---|
960 | <m:menuseparator /> |
---|
961 | <m:menuitem |
---|
962 | title="<%=menu.getString("plugintypes.title")%>" |
---|
963 | url="<%=root+"admin/plugintypes/index.jsp?ID="+ID%>" |
---|
964 | tooltip="<%=menu.getString("plugintypes.tooltip", hasPluginTypes)%>" |
---|
965 | enabled="<%=hasPluginTypes%>" |
---|
966 | /> |
---|
967 | <m:menuitem |
---|
968 | title="<%=menu.getString("plugindefinitions.title")%>" |
---|
969 | url="<%=root+"admin/plugindefinitions/index.jsp?ID="+ID%>" |
---|
970 | tooltip="<%=menu.getString("plugindefinitions.tooltip", hasPluginDefinitions)%>" |
---|
971 | enabled="<%=hasPluginDefinitions%>" |
---|
972 | /> |
---|
973 | <m:menuitem |
---|
974 | title="<%=menu.getString("pluginconfigurations.title")%>" |
---|
975 | url="<%=root+"admin/pluginconfigurations/index.jsp?ID="+ID%>" |
---|
976 | tooltip="<%=menu.getString("pluginconfigurations.tooltip", hasPluginConfigurations)%>" |
---|
977 | enabled="<%=hasPluginConfigurations%>" |
---|
978 | /> |
---|
979 | <m:menuseparator /> |
---|
980 | <m:menuitem |
---|
981 | title="<%=common.getString("item.jobagent+")%>" |
---|
982 | url="<%=root+"admin/jobagents/index.jsp?ID="+ID%>" |
---|
983 | tooltip="<%=menu.getString("jobagents.tooltip", hasJobAgents)%>" |
---|
984 | enabled="<%=hasJobAgents%>" |
---|
985 | /> |
---|
986 | </m:menu> |
---|
987 | <% |
---|
988 | } |
---|
989 | // Administrate menu |
---|
990 | final boolean hasUsers = !sc.hasPermission(Permission.DENIED, Item.USER); |
---|
991 | final boolean hasGroups = !sc.hasPermission(Permission.DENIED, Item.GROUP); |
---|
992 | final boolean hasRoles = sc.hasPermission(Permission.READ, Item.ROLE); |
---|
993 | final boolean hasQuota = sc.hasPermission(Permission.READ, Item.QUOTA); |
---|
994 | final boolean hasSoftware = !sc.hasPermission(Permission.DENIED, Item.SOFTWARE); |
---|
995 | final boolean hasHardware = !sc.hasPermission(Permission.DENIED, Item.HARDWARE); |
---|
996 | final boolean hasProtocols = !sc.hasPermission(Permission.DENIED, Item.PROTOCOL); |
---|
997 | final boolean hasClients = sc.hasPermission(Permission.READ, Item.CLIENT); |
---|
998 | final boolean hasNews = sc.hasPermission(Permission.READ, Item.NEWS); |
---|
999 | final boolean hasReporterCloneTemplates = !sc.hasPermission(Permission.DENIED, Item.REPORTERCLONETEMPLATE); |
---|
1000 | final boolean hasDiskUsage = sc.hasPermission(Permission.READ, Item.DISKUSAGE); |
---|
1001 | final Client currentClient = Client.getById(dc, sc.getClientId()); |
---|
1002 | final boolean hasServer = currentClient.hasPermission(Permission.WRITE); |
---|
1003 | |
---|
1004 | final boolean hasAdministrate = |
---|
1005 | hasUsers || hasGroups || hasRoles || hasQuota || hasTypes || hasPlugins || |
---|
1006 | hasSoftware || hasHardware || hasProtocols || hasClients || hasNews || hasReporterCloneTemplates || |
---|
1007 | hasDiskUsage || hasServer || hasTopPlatforms; |
---|
1008 | |
---|
1009 | if (hasAdministrate) |
---|
1010 | { |
---|
1011 | %> |
---|
1012 | <m:menu |
---|
1013 | id="menu.administrate" |
---|
1014 | style="display: none" |
---|
1015 | > |
---|
1016 | <m:menuitem |
---|
1017 | title="<%=common.getString("item.user+")%>" |
---|
1018 | url="<%=root+"admin/users/index.jsp?ID="+ID%>" |
---|
1019 | tooltip="<%=menu.getString("users.tooltip", hasUsers)%>" |
---|
1020 | enabled="<%=hasUsers%>" |
---|
1021 | /> |
---|
1022 | <m:menuitem |
---|
1023 | title="<%=common.getString("item.group+")%>" |
---|
1024 | url="<%=root+"admin/groups/index.jsp?ID="+ID%>" |
---|
1025 | tooltip="<%=menu.getString("groups.tooltip", hasGroups)%>" |
---|
1026 | enabled="<%=hasGroups%>" |
---|
1027 | /> |
---|
1028 | <m:menuitem |
---|
1029 | title="<%=common.getString("item.role+")%>" |
---|
1030 | url="<%=root+"admin/roles/index.jsp?ID="+ID%>" |
---|
1031 | tooltip="<%=menu.getString("roles.tooltip", hasRoles)%>" |
---|
1032 | enabled="<%=hasRoles%>" |
---|
1033 | /> |
---|
1034 | <m:menuseparator /> |
---|
1035 | <m:submenu |
---|
1036 | subid="menu.plugins" |
---|
1037 | title="<%=menu.getString("menu.plugins")%>" |
---|
1038 | tooltip="<%=menu.getString("menu.plugins.tooltip")%>" |
---|
1039 | enabled="<%=hasPlugins%>" |
---|
1040 | /> |
---|
1041 | <m:menuseparator /> |
---|
1042 | <m:menuitem |
---|
1043 | title="<%=common.getString("item.quota+")%>" |
---|
1044 | url="<%=root+"admin/quota/index.jsp?ID="+ID%>" |
---|
1045 | tooltip="<%=menu.getString("quota.tooltip", hasQuota)%>" |
---|
1046 | enabled="<%=hasQuota%>" |
---|
1047 | /> |
---|
1048 | <m:menuitem |
---|
1049 | title="<%=common.getString("item.software+")%>" |
---|
1050 | url="<%=root+"admin/software/index.jsp?ID="+ID%>" |
---|
1051 | tooltip="<%=menu.getString("software.tooltip", hasSoftware)%>" |
---|
1052 | enabled="<%=hasSoftware%>" |
---|
1053 | /> |
---|
1054 | <m:menuitem |
---|
1055 | title="<%=common.getString("item.hardware+")%>" |
---|
1056 | url="<%=root+"admin/hardware/index.jsp?ID="+ID%>" |
---|
1057 | tooltip="<%=menu.getString("hardware.tooltip", hasHardware)%>" |
---|
1058 | enabled="<%=hasHardware%>" |
---|
1059 | /> |
---|
1060 | <m:menuitem |
---|
1061 | title="<%=common.getString("item.protocol+")%>" |
---|
1062 | url="<%=root+"admin/protocols/index.jsp?ID="+ID%>" |
---|
1063 | tooltip="<%=menu.getString("protocols.tooltip", hasProtocols)%>" |
---|
1064 | enabled="<%=hasProtocols%>" |
---|
1065 | /> |
---|
1066 | <m:menuitem |
---|
1067 | title="<%=common.getString("item.client+")%>" |
---|
1068 | url="<%=root+"admin/clients/index.jsp?ID="+ID%>" |
---|
1069 | tooltip="<%=menu.getString("clients.tooltip", hasClients)%>" |
---|
1070 | enabled="<%=hasClients%>" |
---|
1071 | /> |
---|
1072 | <m:menuitem |
---|
1073 | title="<%=common.getString("item.news+")%>" |
---|
1074 | url="<%=root+"admin/news/index.jsp?ID="+ID%>" |
---|
1075 | tooltip="<%=menu.getString("news.tooltip", hasNews)%>" |
---|
1076 | enabled="<%=hasNews%>" |
---|
1077 | /> |
---|
1078 | <m:menuitem |
---|
1079 | title="<%=common.getString("item.reporterclonetemplate+")%>" |
---|
1080 | url="<%=root+"admin/reporterclonetemplates/index.jsp?ID="+ID%>" |
---|
1081 | tooltip="<%=menu.getString("reporterclonetemplates.tooltip", hasReporterCloneTemplates)%>" |
---|
1082 | enabled="<%=hasReporterCloneTemplates%>" |
---|
1083 | /> |
---|
1084 | <m:menuseparator /> |
---|
1085 | <m:submenu |
---|
1086 | subid="menu.platforms" |
---|
1087 | title="<%=menu.getString("menu.platforms")%>" |
---|
1088 | tooltip="<%=menu.getString("menu.platforms.tooltip")%>" |
---|
1089 | enabled="<%=hasTopPlatforms%>" |
---|
1090 | /> |
---|
1091 | <m:submenu |
---|
1092 | subid="menu.types" |
---|
1093 | title="<%=menu.getString("menu.types")%>" |
---|
1094 | tooltip="<%=menu.getString("menu.types.tooltip")%>" |
---|
1095 | enabled="<%=hasTypes%>" |
---|
1096 | /> |
---|
1097 | <m:menuseparator /> |
---|
1098 | <m:menuitem |
---|
1099 | title="<%=common.getString("item.diskusage+")%>" |
---|
1100 | url="<%=root+"admin/diskusage/index.jsp?ID="+ID%>" |
---|
1101 | tooltip="<%=menu.getString("diskusage.tooltip", hasDiskUsage)%>" |
---|
1102 | enabled="<%=hasDiskUsage%>" |
---|
1103 | /> |
---|
1104 | <m:menuitem |
---|
1105 | title="<%=menu.getString("serversettings.title")+"…"%>" |
---|
1106 | url="<%=root+"admin/server/configure.jsp?ID="+ID%>" |
---|
1107 | data-popup="ServerSettings, 600, 400" |
---|
1108 | tooltip="<%=menu.getString("serversettings.tooltip", hasServer)%>" |
---|
1109 | enabled="<%=hasServer%>" |
---|
1110 | /> |
---|
1111 | <m:menuitem |
---|
1112 | title="<%=menu.getString("broadcast.title")+"…"%>" |
---|
1113 | url="<%=root+"admin/server/broadcast.jsp?ID="+ID%>" |
---|
1114 | data-popup="BroadcastMessage, 600, 400" |
---|
1115 | tooltip="<%=menu.getString("broadcast.tooltip", hasServer)%>" |
---|
1116 | enabled="<%=hasServer%>" |
---|
1117 | /> |
---|
1118 | <m:menuitem |
---|
1119 | title="<%=menu.getString("services.title")%>" |
---|
1120 | tooltip="<%=menu.getString("services.tooltip", hasServer)%>" |
---|
1121 | url="<%=root+"admin/services/index.jsp?ID="+ID%>" |
---|
1122 | enabled="<%=hasServer%>" |
---|
1123 | /> |
---|
1124 | </m:menu> |
---|
1125 | <% |
---|
1126 | } |
---|
1127 | // Help menu |
---|
1128 | final String helplink = Values.getStringOrNull(sc.getClientDefaultSetting("server.links.help")); |
---|
1129 | final String faqlink = Values.getStringOrNull(sc.getClientDefaultSetting("server.links.faq")); |
---|
1130 | final String reportbuglink = Values.getStringOrNull(sc.getClientDefaultSetting("server.links.reportbug")); |
---|
1131 | %> |
---|
1132 | <m:menu id="menu.help" style="display: none"> |
---|
1133 | <m:menuitem |
---|
1134 | visible="<%=HTML.isValidUrl(helplink)%>" |
---|
1135 | title="<%=menu.getString("menu.help") + "…"%>" |
---|
1136 | url="<%=helplink%>" |
---|
1137 | data-target="Help" |
---|
1138 | /> |
---|
1139 | <m:menuitem |
---|
1140 | visible="<%=HTML.isValidUrl(faqlink)%>" |
---|
1141 | title="<%=menu.getString("faq.title") + "…"%>" |
---|
1142 | url="<%=faqlink%>" |
---|
1143 | data-target="FAQ" |
---|
1144 | tooltip="<%=menu.getString("faq.tooltip") %>" |
---|
1145 | /> |
---|
1146 | <m:menuseparator /> |
---|
1147 | |
---|
1148 | <m:menuitem |
---|
1149 | title="<%=menu.getString("about.title") + "…"%>" |
---|
1150 | url="<%=root+"info/about.jsp?ID="+ID+"&page=about"%>" |
---|
1151 | data-popup="About, 600, 400" |
---|
1152 | /> |
---|
1153 | <m:menuitem |
---|
1154 | title="<%=menu.getString("license.title") + "…"%>" |
---|
1155 | url="<%=root+"info/about.jsp?ID="+ID+"&page=license"%>" |
---|
1156 | data-popup="About, 600, 400" |
---|
1157 | /> |
---|
1158 | <m:menuitem |
---|
1159 | visible="<%=HTML.isValidUrl(reportbuglink)%>" |
---|
1160 | title="<%=menu.getString("bugreport.title") + "…"%>" |
---|
1161 | url="<%=reportbuglink%>" |
---|
1162 | data-target="ReportBug" |
---|
1163 | tooltip="<%=menu.getString("bugreport.tooltip")%>" |
---|
1164 | /> |
---|
1165 | <m:menuseparator /> |
---|
1166 | <m:menuitem |
---|
1167 | title="<%=menu.getString("basesite.title") + "…"%>" |
---|
1168 | url="http://base.thep.lu.se" |
---|
1169 | data-target="basesite" |
---|
1170 | tooltip="<%=menu.getString("basesite.tooltip")%>" |
---|
1171 | /> |
---|
1172 | </m:menu> |
---|
1173 | <% |
---|
1174 | //Switch user/logout menu |
---|
1175 | final boolean hasImpersonate = |
---|
1176 | !sc.isImpersonated() && sc.hasSystemPermission(Permission.ACT_AS_ANOTHER_USER); |
---|
1177 | |
---|
1178 | List<Role> roles = null; |
---|
1179 | Set<Integer> roleIds = sc.getAllRoles(); |
---|
1180 | if (roleIds != null && roleIds.size() > 0) |
---|
1181 | { |
---|
1182 | ItemQuery<Role> roleQuery = Role.getQuery(); |
---|
1183 | roleQuery.restrict(Restrictions.in(Hql.property("id"), Expressions.parameter("roles"))); |
---|
1184 | roleQuery.setParameter("roles", roleIds, Type.INT); |
---|
1185 | roleQuery.order(Orders.asc(Hql.property("name"))); |
---|
1186 | roles = roleQuery.list(dc); |
---|
1187 | } |
---|
1188 | %> |
---|
1189 | <m:menu |
---|
1190 | id="menu.switchuser" |
---|
1191 | style="display: none;" |
---|
1192 | > |
---|
1193 | <m:menuitem |
---|
1194 | title="<%=menu.getString("switchuser.title") + "…"%>" |
---|
1195 | url="<%=root+"switch.jsp?ID="+ID%>" |
---|
1196 | data-popup="Switch, 540, 360" |
---|
1197 | tooltip="<%=menu.getString("switchuser.tooltip")%>" |
---|
1198 | /> |
---|
1199 | <m:menuitem |
---|
1200 | title="<%=menu.getString("impersonate.title") + "…"%>" |
---|
1201 | url="<%=root+"impersonate.jsp?ID="+ID%>" |
---|
1202 | data-popup="Impersonate, 480, 320" |
---|
1203 | tooltip="<%=menu.getString("impersonate.tooltip")%>" |
---|
1204 | visible="<%=hasImpersonate%>" |
---|
1205 | /> |
---|
1206 | <m:menuitem |
---|
1207 | title="<%=menu.getString("logout.title") + "…"%>" |
---|
1208 | url="<%=root+"logout.jsp?ID="+ID%>" |
---|
1209 | data-popup="Logout, 360, 240" |
---|
1210 | tooltip="<%=menu.getString("logout.tooltip")%>" |
---|
1211 | /> |
---|
1212 | <% |
---|
1213 | if (roles != null && roles.size() > 0) |
---|
1214 | { |
---|
1215 | %> |
---|
1216 | <m:menuseparator /> |
---|
1217 | <m:menuitem |
---|
1218 | title="<%=menu.getString("myroles.title")%>" |
---|
1219 | subclass="menusection" |
---|
1220 | enabled="false" |
---|
1221 | /> |
---|
1222 | <m:menuseparator /> |
---|
1223 | <% |
---|
1224 | for (Role r : roles) |
---|
1225 | { |
---|
1226 | boolean isInactive = sc.isRoleInactive(r.getId()); |
---|
1227 | %> |
---|
1228 | <m:menuitem |
---|
1229 | title="<%=HTML.encodeTags(r.getName()) %>" |
---|
1230 | tooltip="<%=menu.getString("myroles.tooltip", isInactive)%>" |
---|
1231 | icon="<%=isInactive ? "option_unselected.png" : "option_selected.png"%>" |
---|
1232 | url="<%=root+"my_base/toggle_active_role.jsp?ID="+ID+"&role_id="+r.getId()%>" |
---|
1233 | data-popup="ActivateRole, 300, 200" |
---|
1234 | /> |
---|
1235 | <% |
---|
1236 | } |
---|
1237 | %> |
---|
1238 | <m:menuseparator /> |
---|
1239 | <m:menuitem |
---|
1240 | title="<%=menu.getString("myroles.options") + "…"%>" |
---|
1241 | url="<%=root+"my_base/user/preferences.jsp?ID="+ID+"&page=inactiveRoles"%>" |
---|
1242 | data-popup="Preferences, 600, 400" |
---|
1243 | tooltip="<%=menu.getString("myroles.options.tooltip")%>" |
---|
1244 | /> |
---|
1245 | <% |
---|
1246 | } |
---|
1247 | %> |
---|
1248 | </m:menu> |
---|
1249 | <% |
---|
1250 | // Extensions menu |
---|
1251 | JspContext jspContext = ExtensionsControl.createContext(dc, pageContext); |
---|
1252 | ExtensionsInvoker<MenuItemAction> invoker = ExtensionsControl.useExtensions(jspContext, |
---|
1253 | "net.sf.basedb.clients.web.menu.extensions"); |
---|
1254 | ExtensionsControl ec = ExtensionsControl.get(dc); |
---|
1255 | ActionIterator<MenuItemAction> it = invoker.iterate(); |
---|
1256 | Map<String, List<MenuItemAction>> menus = new HashMap<String, List<MenuItemAction>>(); |
---|
1257 | menus.put("extensions", new LinkedList<MenuItemAction>()); |
---|
1258 | int numExtensionMenues = 0; |
---|
1259 | while (it.hasNext()) |
---|
1260 | { |
---|
1261 | MenuItemAction action = it.next(); |
---|
1262 | String menuId = action.getMenuId(); |
---|
1263 | menuId = menuId == null ? "extensions" : "extensions." + menuId; |
---|
1264 | List<MenuItemAction> actions = menus.get(menuId); |
---|
1265 | if (actions == null) |
---|
1266 | { |
---|
1267 | actions = new LinkedList<MenuItemAction>(); |
---|
1268 | menus.put(menuId, actions); |
---|
1269 | } |
---|
1270 | actions.add(action); |
---|
1271 | } |
---|
1272 | for (Map.Entry<String, List<MenuItemAction>> entry : menus.entrySet()) |
---|
1273 | { |
---|
1274 | String menuId = entry.getKey(); |
---|
1275 | List<MenuItemAction> actions = entry.getValue(); |
---|
1276 | if (actions.size() == 0) continue; |
---|
1277 | %> |
---|
1278 | <m:menu id="<%="menu."+menuId%>" style="display: none;"> |
---|
1279 | <% |
---|
1280 | for (MenuItemAction action : actions) |
---|
1281 | { |
---|
1282 | numExtensionMenues++; |
---|
1283 | Iterator<DynamicActionAttribute> dynamicAttributes = |
---|
1284 | action instanceof DynamicActionAttributes ? |
---|
1285 | ((DynamicActionAttributes)action).getDynamicActionAttributes() : null; |
---|
1286 | if (action.getType() == MenuItemAction.MenuType.SEPARATOR) |
---|
1287 | { |
---|
1288 | %> |
---|
1289 | <m:menuseparator |
---|
1290 | id="<%=action.getId() %>" |
---|
1291 | subclass="<%=action.getClazz() %>" |
---|
1292 | style="<%=action.getStyle()%>" |
---|
1293 | visible="<%=action.isVisible()%>" |
---|
1294 | dynamic="<%=dynamicAttributes%>" |
---|
1295 | /> |
---|
1296 | <% |
---|
1297 | } |
---|
1298 | else if (action.getType() == MenuItemAction.MenuType.MENUITEM) |
---|
1299 | { |
---|
1300 | %> |
---|
1301 | <m:menuitem |
---|
1302 | id="<%=action.getId() %>" |
---|
1303 | subclass="<%=action.getClazz() %>" |
---|
1304 | style="<%=action.getStyle()%>" |
---|
1305 | title="<%=action.getTitle()%>" |
---|
1306 | icon="<%=action.getIcon()%>" |
---|
1307 | tooltip="<%=action.getTooltip()%>" |
---|
1308 | enabled="<%=action.isEnabled()%>" |
---|
1309 | visible="<%=action.isVisible()%>" |
---|
1310 | dynamic="<%=dynamicAttributes%>" |
---|
1311 | /> |
---|
1312 | <% |
---|
1313 | } |
---|
1314 | else if (action.getType() == MenuItemAction.MenuType.SUBMENU) |
---|
1315 | { |
---|
1316 | %> |
---|
1317 | <m:submenu |
---|
1318 | id="<%=action.getId() %>" |
---|
1319 | subclass="<%=action.getClazz() %>" |
---|
1320 | subid="<%="menu.extensions." + action.getSubmenuId()%>" |
---|
1321 | style="<%=action.getStyle()%>" |
---|
1322 | title="<%=action.getTitle()%>" |
---|
1323 | icon="<%=action.getIcon()%>" |
---|
1324 | tooltip="<%=action.getTooltip()%>" |
---|
1325 | enabled="<%=action.isEnabled()%>" |
---|
1326 | visible="<%=action.isVisible()%>" |
---|
1327 | dynamic="<%=dynamicAttributes%>" |
---|
1328 | /> |
---|
1329 | <% |
---|
1330 | } |
---|
1331 | } |
---|
1332 | %> |
---|
1333 | </m:menu> |
---|
1334 | <% |
---|
1335 | } |
---|
1336 | // Main menu |
---|
1337 | %> |
---|
1338 | <ext:scripts context="<%=jspContext%>" /> |
---|
1339 | <ext:stylesheets context="<%=jspContext%>" /> |
---|
1340 | <m:menu |
---|
1341 | type="horizontal" |
---|
1342 | id="menubar" |
---|
1343 | style="top: 0px; left: 0px; right: 0px;" |
---|
1344 | open="click" |
---|
1345 | filltext="<%=fillText.toString()%>" |
---|
1346 | > |
---|
1347 | <m:submenu |
---|
1348 | subid="menu.base" |
---|
1349 | title="<%=menu.getString("menu.base")%>" |
---|
1350 | /> |
---|
1351 | <m:submenu |
---|
1352 | subid="menu.view" |
---|
1353 | title="<%=menu.getString("menu.view")%>" |
---|
1354 | /> |
---|
1355 | <m:submenu |
---|
1356 | subid="menu.biolims" |
---|
1357 | title="<%=menu.getString("menu.biolims")%>" |
---|
1358 | /> |
---|
1359 | <m:submenu |
---|
1360 | subid="menu.lims" |
---|
1361 | title="<%=menu.getString("menu.arraylims")%>" |
---|
1362 | /> |
---|
1363 | <m:submenu |
---|
1364 | subid="menu.administrate" |
---|
1365 | title="<%=menu.getString("menu.administrate")%>" |
---|
1366 | visible="<%=hasAdministrate%>" |
---|
1367 | /> |
---|
1368 | <m:submenu |
---|
1369 | subid="menu.extensions" |
---|
1370 | title="<%=menu.getString("menu.extensions")%>" |
---|
1371 | visible="<%=numExtensionMenues > 0 %>" |
---|
1372 | /> |
---|
1373 | <m:submenu |
---|
1374 | subid="menu.help" |
---|
1375 | title="<%=menu.getString("menu.help")%>" |
---|
1376 | /> |
---|
1377 | </m:menu> |
---|
1378 | <% |
---|
1379 | } |
---|
1380 | finally |
---|
1381 | { |
---|
1382 | if (dc != null) dc.close(); |
---|
1383 | } |
---|
1384 | |
---|
1385 | } |
---|
1386 | %> |
---|
1387 | |
---|
1388 | |
---|