1 | <%-- $Id: menu.jsp 5267 2010-03-12 07:59:58Z 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 session="false" |
---|
38 | import="net.sf.basedb.core.SessionControl" |
---|
39 | import="net.sf.basedb.core.DbControl" |
---|
40 | import="net.sf.basedb.core.BasicItem" |
---|
41 | import="net.sf.basedb.core.Nameable" |
---|
42 | import="net.sf.basedb.core.Permission" |
---|
43 | import="net.sf.basedb.core.Item" |
---|
44 | import="net.sf.basedb.core.ItemContext" |
---|
45 | import="net.sf.basedb.core.User" |
---|
46 | import="net.sf.basedb.core.Project" |
---|
47 | import="net.sf.basedb.core.BioAssaySet" |
---|
48 | import="net.sf.basedb.core.Client" |
---|
49 | import="net.sf.basedb.core.StringUtil" |
---|
50 | import="net.sf.basedb.core.ItemQuery" |
---|
51 | import="net.sf.basedb.core.Include" |
---|
52 | import="net.sf.basedb.core.ItemResultList" |
---|
53 | import="net.sf.basedb.core.query.Orders" |
---|
54 | import="net.sf.basedb.core.query.Order" |
---|
55 | import="net.sf.basedb.core.query.Hql" |
---|
56 | import="net.sf.basedb.clients.web.Base" |
---|
57 | import="net.sf.basedb.clients.web.util.HTML" |
---|
58 | import="net.sf.basedb.util.Values" |
---|
59 | import="net.sf.basedb.clients.web.extensions.ExtensionsControl" |
---|
60 | import="net.sf.basedb.clients.web.extensions.JspContext" |
---|
61 | import="net.sf.basedb.clients.web.extensions.menu.MenuItemAction" |
---|
62 | import="net.sf.basedb.util.extensions.Extension" |
---|
63 | import="net.sf.basedb.util.extensions.ExtensionsInvoker" |
---|
64 | import="net.sf.basedb.util.extensions.ActionIterator" |
---|
65 | import="java.util.HashMap" |
---|
66 | import="java.util.Map" |
---|
67 | import="java.util.ArrayList" |
---|
68 | import="java.util.LinkedList" |
---|
69 | import="java.util.List" |
---|
70 | import="java.util.Arrays" |
---|
71 | import="java.util.Iterator" |
---|
72 | %> |
---|
73 | <%@ taglib prefix="m" uri="/WEB-INF/menu.tld" %> |
---|
74 | <% |
---|
75 | final SessionControl sc = Base.getSessionControl(pageContext, false); |
---|
76 | final String ID = sc == null ? "" : sc.getId(); |
---|
77 | String name = Values.getString(request.getParameter("name"), "login"); |
---|
78 | final String root = request.getContextPath()+"/"; |
---|
79 | if ("exception".equals(name) && sc != null && sc.isLoggedIn()) name = "standard"; |
---|
80 | |
---|
81 | if ("login".equals(name)) |
---|
82 | { |
---|
83 | } |
---|
84 | else if ("projects".equals(name) && sc != null && sc.isLoggedIn()) |
---|
85 | { |
---|
86 | // Projects menu |
---|
87 | int activeProjectId = sc.getActiveProjectId(); |
---|
88 | %> |
---|
89 | <m:menu |
---|
90 | id="projects" |
---|
91 | style="display: none" |
---|
92 | > |
---|
93 | <m:menuitem |
---|
94 | title="<i>- no active project -</i>" |
---|
95 | onclick="<%="Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"', 'ActivateProject', 300, 140)"%>" |
---|
96 | icon="<%=activeProjectId == 0 ? "checkedmenu.gif" : null%>" |
---|
97 | enabled="<%=activeProjectId != 0%>" |
---|
98 | tooltip="<%=activeProjectId == 0 ? "No project is active" : "Disable the currently active project"%>" |
---|
99 | /> |
---|
100 | <% |
---|
101 | final DbControl dc = sc.newDbControl(); |
---|
102 | try |
---|
103 | { |
---|
104 | final ItemContext projectCC = sc.getCurrentContext(Item.PROJECT); |
---|
105 | final ItemQuery<Project> projectQuery = Project.getQuery(); |
---|
106 | projectQuery.include(Include.MINE, Include.SHARED); |
---|
107 | Order projectSortOrder = projectCC.getSortOrder(); |
---|
108 | if (projectSortOrder != null) projectQuery.order(projectSortOrder); |
---|
109 | projectQuery.order(Orders.asc(Hql.property("name"))); |
---|
110 | projectQuery.setCacheResult(true); |
---|
111 | ItemResultList<Project> projects = projectQuery.list(dc); |
---|
112 | boolean breakAt20 = projects.size() > 25; |
---|
113 | int index = 0; |
---|
114 | for (Project p : projects) |
---|
115 | { |
---|
116 | if (index == 20 && breakAt20) break; |
---|
117 | index++; |
---|
118 | int projectId = p.getId(); |
---|
119 | boolean active = activeProjectId == projectId; |
---|
120 | %> |
---|
121 | <m:menuitem |
---|
122 | title="<%=HTML.encodeTags(p.getName())%>" |
---|
123 | style="<%=active ? "color: #000000; font-weight: bold;" : null %>" |
---|
124 | onclick="<%="Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"&project_id="+p.getId()+"', 'ActivateProject', 300, 140)"%>" |
---|
125 | icon="<%=active ? "checkedmenu.gif" : null%>" |
---|
126 | enabled="<%=!active%>" |
---|
127 | tooltip="<%=active ? "This is the active project" : "Set this project to the active project"%>" |
---|
128 | /> |
---|
129 | <% |
---|
130 | } |
---|
131 | if (breakAt20) |
---|
132 | { |
---|
133 | int more = projects.size() - 20; |
---|
134 | %> |
---|
135 | <m:menuseparator /> |
---|
136 | <m:menuitem |
---|
137 | title="<%=more + " more" %>" |
---|
138 | onclick="<%="Menu.openUrl('"+root+"my_base/projects/index.jsp?ID="+ID+"')"%>" |
---|
139 | tooltip="Show more projects" |
---|
140 | /> |
---|
141 | <% |
---|
142 | } |
---|
143 | } |
---|
144 | catch (Throwable t) |
---|
145 | { |
---|
146 | t.printStackTrace(); |
---|
147 | %> |
---|
148 | <m:menuitem |
---|
149 | title="Error loading projects" |
---|
150 | tooltip="<%=t.getMessage() + ": Check log file for more details"%>" |
---|
151 | enabled="false" |
---|
152 | icon="error.gif" |
---|
153 | /> |
---|
154 | <% |
---|
155 | } |
---|
156 | finally |
---|
157 | { |
---|
158 | if (dc != null) dc.close(); |
---|
159 | } |
---|
160 | %> |
---|
161 | </m:menu> |
---|
162 | <% |
---|
163 | } |
---|
164 | else if ("recentItems".equals(name) && sc != null && sc.isLoggedIn()) |
---|
165 | { |
---|
166 | // Recently used items menu |
---|
167 | String stickyItems = Values.getString(sc.getUserClientSetting("menu.mostRecent"), |
---|
168 | "EXPERIMENT:BIOASSAYSET:TRANSFORMATION"); |
---|
169 | boolean loadNames = Values.getBoolean(sc.getUserClientSetting("menu.mostRecent.loadNames"), |
---|
170 | true); |
---|
171 | String recentItems = sc.getUserClientSetting("menu.mostRecent.viewed"); |
---|
172 | DbControl dc = loadNames ? sc.newDbControl() : null; |
---|
173 | try |
---|
174 | { |
---|
175 | %> |
---|
176 | <m:menu |
---|
177 | id="mostRecent" |
---|
178 | style="display: none;" |
---|
179 | > |
---|
180 | <% |
---|
181 | int numItems = 0; |
---|
182 | // Recently viewed items |
---|
183 | List<String> recentlyViewed = recentItems == null ? |
---|
184 | new ArrayList<String>() : Arrays.asList(recentItems.split(":")); |
---|
185 | if (recentlyViewed.size() > 0) |
---|
186 | { |
---|
187 | %> |
---|
188 | <m:menuitem |
---|
189 | title="Recently viewed items" |
---|
190 | style="font-weight: bold; color: #000000; background: #e8e8e8;" |
---|
191 | enabled="false" |
---|
192 | /> |
---|
193 | <m:menuseparator /> |
---|
194 | <% |
---|
195 | for (String recent : recentlyViewed) |
---|
196 | { |
---|
197 | try |
---|
198 | { |
---|
199 | String[] tmp = recent.split("="); |
---|
200 | Item itemType = Item.valueOf(tmp[0]); |
---|
201 | int itemId = Values.getInt(tmp[1], 0); |
---|
202 | if (itemId != 0) |
---|
203 | { |
---|
204 | String shortName = ""; |
---|
205 | String fullName = ""; |
---|
206 | if (loadNames) |
---|
207 | { |
---|
208 | try |
---|
209 | { |
---|
210 | BasicItem item = itemType.getById(dc, itemId); |
---|
211 | fullName = ((Nameable)item).getName(); |
---|
212 | shortName = HTML.encodeTags(StringUtil.trimString(fullName, 35)); |
---|
213 | } |
---|
214 | catch (Throwable t) |
---|
215 | { |
---|
216 | continue; |
---|
217 | } |
---|
218 | } |
---|
219 | else |
---|
220 | { |
---|
221 | fullName = itemType.toString() + "; id=" + itemId; |
---|
222 | shortName = itemType + " (id=" + itemId + ")"; |
---|
223 | } |
---|
224 | numItems++; |
---|
225 | %> |
---|
226 | <m:menuitem |
---|
227 | title="<%=numItems + ". " + shortName%>" |
---|
228 | onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + itemId + ")"%>" |
---|
229 | tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>" |
---|
230 | /> |
---|
231 | <% |
---|
232 | } |
---|
233 | } |
---|
234 | catch (Throwable t) |
---|
235 | {} |
---|
236 | } |
---|
237 | } |
---|
238 | if (stickyItems != null && stickyItems.length() > 0) |
---|
239 | { |
---|
240 | int numSticky = 0; |
---|
241 | if (numItems > 0) |
---|
242 | { |
---|
243 | %> |
---|
244 | <m:menuseparator /> |
---|
245 | <% |
---|
246 | } |
---|
247 | %> |
---|
248 | <m:menuitem |
---|
249 | title="Sticky items" |
---|
250 | style="font-weight: bold; color: #000000; background: #e8e8e8;" |
---|
251 | enabled="false" |
---|
252 | /> |
---|
253 | <m:menuseparator /> |
---|
254 | <% |
---|
255 | // Sticky items |
---|
256 | for (String recentItem : stickyItems.split(":")) |
---|
257 | { |
---|
258 | try |
---|
259 | { |
---|
260 | BasicItem item = null; |
---|
261 | Item itemType = Item.valueOf(recentItem); |
---|
262 | ItemContext cc = sc.getCurrentContext(itemType); |
---|
263 | if (cc.getId() != 0) |
---|
264 | { |
---|
265 | String shortName = ""; |
---|
266 | String fullName = ""; |
---|
267 | if (loadNames) |
---|
268 | { |
---|
269 | try |
---|
270 | { |
---|
271 | item = itemType.getById(dc, cc.getId()); |
---|
272 | fullName = ((Nameable)item).getName(); |
---|
273 | shortName = ": " + HTML.encodeTags(StringUtil.trimString(fullName, 30)); |
---|
274 | } |
---|
275 | catch (Throwable t) |
---|
276 | { |
---|
277 | continue; |
---|
278 | } |
---|
279 | } |
---|
280 | else |
---|
281 | { |
---|
282 | fullName = itemType.toString() + "; id=" + cc.getId(); |
---|
283 | shortName = " (id=" + cc.getId() + ")"; |
---|
284 | } |
---|
285 | numItems++; |
---|
286 | numSticky++; |
---|
287 | %> |
---|
288 | <m:menuitem |
---|
289 | title="<%=itemType + shortName%>" |
---|
290 | onclick="<%="Main.viewOrEditItem('" + ID + "', '" + itemType.name() + "', " + cc.getId() + ")"%>" |
---|
291 | tooltip="<%="Go to " + HTML.encodeTags(fullName) + " (" + itemType + ")"%>" |
---|
292 | /> |
---|
293 | <% |
---|
294 | if (itemType == Item.BIOASSAYSET) |
---|
295 | { |
---|
296 | // Add menu for Experiment explorer as well |
---|
297 | %> |
---|
298 | <m:menuitem |
---|
299 | title="<%="Experiment explorer"+HTML.encodeTags(shortName)%>" |
---|
300 | onclick="<%="location.href = '"+root+"views/experiments/explorer/view/index.jsp?ID=" + ID + "&bioassayset_id="+cc.getId()+"'"%>" |
---|
301 | tooltip="Go to experiment explorer" |
---|
302 | visible="<%=item == null || ((BioAssaySet)item).getNumSpots() > 0 %>" |
---|
303 | /> |
---|
304 | <% |
---|
305 | } |
---|
306 | } |
---|
307 | } |
---|
308 | catch (Throwable t) |
---|
309 | {} |
---|
310 | } |
---|
311 | if (numSticky == 0) |
---|
312 | { |
---|
313 | %> |
---|
314 | <m:menuitem |
---|
315 | title="<i>- no sticky items -</i>" |
---|
316 | enabled="false" |
---|
317 | /> |
---|
318 | <% |
---|
319 | } |
---|
320 | } |
---|
321 | %> |
---|
322 | <m:menuseparator /> |
---|
323 | <m:menuitem |
---|
324 | title="Options…" |
---|
325 | onclick="<%="Main.openPopup('"+root+"my_base/user/preferences.jsp?ID="+ID+"&page=mostRecent', 'Preferences', 500, 400);"%>" |
---|
326 | tooltip="Change options for this menu" |
---|
327 | /> |
---|
328 | </m:menu> |
---|
329 | <% |
---|
330 | } |
---|
331 | finally |
---|
332 | { |
---|
333 | if (dc != null) dc.close(); |
---|
334 | } |
---|
335 | } |
---|
336 | else if ("standard".equals(name)) |
---|
337 | { |
---|
338 | final DbControl dc = sc.newDbControl(); |
---|
339 | StringBuilder fillText = new StringBuilder(); |
---|
340 | try |
---|
341 | { |
---|
342 | Project activeProject = sc.getActiveProjectId() == 0 ? null : Project.getById(dc, sc.getActiveProjectId()); |
---|
343 | if (activeProject == null) |
---|
344 | { |
---|
345 | fillText.append("<img src=\""+root+"images/no_active_project.gif\" border=\"0\"> "); |
---|
346 | fillText.append("<a href=\"javascript:void(0)\" style=\"color:#FF0000;\" title=\"Set active project\""); |
---|
347 | } |
---|
348 | else |
---|
349 | { |
---|
350 | fillText.append("<img src=\""+root+"images/project.gif\" border=\"0\"> "); |
---|
351 | fillText.append("<a href=\"javascript:void(0)\" title=\"Switch active project\""); |
---|
352 | } |
---|
353 | |
---|
354 | fillText.append(" onclick=\"Menu.toggleTopMenu(document.getElementById('projects'), event.clientX-50, event.clientY); event.cancelBubble = true;\">"); |
---|
355 | fillText.append(activeProject == null ? "<i>- no active project -</i>" : HTML.encodeTags(activeProject.getName())); |
---|
356 | fillText.append(" <img src=\""+root+"images/sort_asc.gif\" border=\"0\"></a><span class=\"menuseparator\"> </span>"); |
---|
357 | |
---|
358 | fillText.append("<a href=\"javascript:void(0)\" title=\"Refresh current page\""); |
---|
359 | fillText.append(" onclick=\"location.reload()\">"); |
---|
360 | fillText.append("<img src=\""+root+"images/refresh.gif\" border=\"0\"></a><span class=\"menuseparator\"> </span>"); |
---|
361 | |
---|
362 | fillText.append("<a href=\"javascript:void(0)\" title=\"Go to the most recently viewed item\""); |
---|
363 | fillText.append(" onclick=\"Menu.toggleTopMenu(document.getElementById('mostRecent'), event.clientX-200, event.clientY); event.cancelBubble = true;\">"); |
---|
364 | fillText.append(" <img src=\""+root+"images/recent.png\" border=\"0\"><img src=\""+root+"images/sort_asc.gif\" border=\"0\"></a><span class=\"menuseparator\"> </span>"); |
---|
365 | |
---|
366 | User user = User.getById(dc, sc.getLoggedInUserId()); |
---|
367 | String userPrompt = sc.isImpersonated() ? "Impersonated" : "User"; |
---|
368 | fillText.append("<img src=\""+root+"images/take_ownership.png\" border=\"0\"> <a href=\"javascript:void(0)\" title=\"Switch user/logout\""); |
---|
369 | fillText.append(" onclick=\"javascript:Menu.toggleTopMenu(document.getElementById('switchuser'), event.clientX-100, event.clientY); event.cancelBubble = true;\">"); |
---|
370 | fillText.append(HTML.encodeTags(user.getLogin())); |
---|
371 | fillText.append(" (").append(user.getName()).append(") <img src=\""+root+"images/sort_asc.gif\" border=\"0\"></a>"); |
---|
372 | %> |
---|
373 | <% |
---|
374 | // Permission settings |
---|
375 | final boolean hasFiles = !sc.hasPermission(Permission.DENIED, Item.FILE); |
---|
376 | final boolean createFiles = sc.hasPermission(Permission.CREATE, Item.FILE); |
---|
377 | |
---|
378 | final boolean hasProjects = !sc.hasPermission(Permission.DENIED, Item.PROJECT); |
---|
379 | final boolean createProjects = sc.hasPermission(Permission.CREATE, Item.PROJECT); |
---|
380 | |
---|
381 | final boolean hasMessages = !sc.hasPermission(Permission.DENIED, Item.MESSAGE); |
---|
382 | final boolean createMessages = sc.hasPermission(Permission.CREATE, Item.MESSAGE); |
---|
383 | |
---|
384 | final boolean hasHybridizations = !sc.hasPermission(Permission.DENIED, Item.HYBRIDIZATION); |
---|
385 | final boolean createHybridizations = sc.hasPermission(Permission.CREATE, Item.HYBRIDIZATION); |
---|
386 | |
---|
387 | final boolean hasScans = !sc.hasPermission(Permission.DENIED, Item.SCAN); |
---|
388 | final boolean createScans = sc.hasPermission(Permission.CREATE, Item.SCAN); |
---|
389 | final boolean hasRawBioAssays = !sc.hasPermission(Permission.DENIED, Item.RAWBIOASSAY); |
---|
390 | final boolean createRawBioAssays = sc.hasPermission(Permission.CREATE, Item.RAWBIOASSAY); |
---|
391 | final boolean hasExperiments = !sc.hasPermission(Permission.DENIED, Item.EXPERIMENT); |
---|
392 | final boolean createExperiments = sc.hasPermission(Permission.CREATE, Item.EXPERIMENT); |
---|
393 | final boolean hasFormulas = !sc.hasPermission(Permission.DENIED, Item.FORMULA); |
---|
394 | final boolean createFormulas = sc.hasPermission(Permission.CREATE, Item.FORMULA); |
---|
395 | |
---|
396 | final boolean hasReporters = !sc.hasPermission(Permission.DENIED, Item.REPORTER); |
---|
397 | final boolean hasReporterLists = !sc.hasPermission(Permission.DENIED, Item.REPORTERLIST); |
---|
398 | final boolean createReporters = sc.hasPermission(Permission.CREATE, Item.REPORTER); |
---|
399 | final boolean hasJobs = !sc.hasPermission(Permission.DENIED, Item.JOB); |
---|
400 | final boolean hasSessions = !sc.hasPermission(Permission.DENIED, Item.SESSION); |
---|
401 | %> |
---|
402 | <m:menu |
---|
403 | id="view" |
---|
404 | style="display: none" |
---|
405 | > |
---|
406 | <m:menuitem |
---|
407 | title="Home" |
---|
408 | onclick="<%="Menu.openUrl('"+root+"my_base/index.jsp?ID="+ID+"')"%>" |
---|
409 | /> |
---|
410 | <m:menuitem |
---|
411 | title="All items" |
---|
412 | tooltip="View all items that you are the owner of" |
---|
413 | onclick="<%="Menu.openUrl('"+root+"views/items/index.jsp?ID="+ID+"')"%>" |
---|
414 | /> |
---|
415 | <m:menuitem |
---|
416 | title="Trashcan" |
---|
417 | tooltip="View all items that have been marked for deletion" |
---|
418 | onclick="<%="Menu.openUrl('"+root+"views/trashcan/index.jsp?ID="+ID+"')"%>" |
---|
419 | /> |
---|
420 | <m:menuseparator /> |
---|
421 | <m:menuitem |
---|
422 | title="Files" |
---|
423 | onclick="<%="Menu.openUrl('"+root+"filemanager/index.jsp?ID="+ID+"')"%>" |
---|
424 | tooltip="<%=hasFiles ? "Manage files" : "You do not have permission to manage files"%>" |
---|
425 | enabled="<%=hasFiles%>" |
---|
426 | /> |
---|
427 | <m:menuitem |
---|
428 | title="Projects" |
---|
429 | onclick="<%="Menu.openUrl('"+root+"my_base/projects/index.jsp?ID="+ID+"')"%>" |
---|
430 | tooltip="Manage projects" |
---|
431 | enabled="<%=hasProjects%>" |
---|
432 | /> |
---|
433 | <m:menuitem |
---|
434 | title="Messages" |
---|
435 | onclick="<%="Menu.openUrl('"+root+"my_base/messages/index.jsp?ID="+ID+"')"%>" |
---|
436 | tooltip="<%=hasMessages ? "Read your messages" : "You do not have permission to read messages"%>" |
---|
437 | enabled="<%=hasMessages%>" |
---|
438 | /> |
---|
439 | <m:menuitem |
---|
440 | title="Jobs" |
---|
441 | onclick="<%="Menu.openUrl('"+root+"views/jobs/index.jsp?ID="+ID+"')"%>" |
---|
442 | tooltip="<%=hasJobs ? "Check the status of your jobs" : "You do not have permission to access jobs"%>" |
---|
443 | enabled="<%=hasJobs%>" |
---|
444 | /> |
---|
445 | <m:menuitem |
---|
446 | title="Sessions" |
---|
447 | onclick="<%="Menu.openUrl('"+root+"views/sessions/index.jsp?ID="+ID+"')"%>" |
---|
448 | tooltip="<%=hasSessions ? "Check you login sessions" : "You do not have permission to access sessions"%>" |
---|
449 | enabled="<%=hasSessions%>" |
---|
450 | /> |
---|
451 | <m:menuseparator /> |
---|
452 | <m:menuitem |
---|
453 | title="Hybridizations" |
---|
454 | onclick="<%="Menu.openUrl('"+root+"views/hybridizations/index.jsp?ID="+ID+"')"%>" |
---|
455 | tooltip="<%=hasHybridizations ? "Manage hybridizations" : "You do not have permission to manage hybridizations"%>" |
---|
456 | enabled="<%=hasHybridizations%>" |
---|
457 | /> |
---|
458 | <m:menuitem |
---|
459 | title="Scans" |
---|
460 | onclick="<%="Menu.openUrl('"+root+"views/scans/index.jsp?ID="+ID+"')"%>" |
---|
461 | tooltip="<%=hasScans ? "Manage scans" : "You do not have permission to manage scans"%>" |
---|
462 | enabled="<%=hasScans%>" |
---|
463 | /> |
---|
464 | <m:menuitem |
---|
465 | title="Raw bioassays" |
---|
466 | onclick="<%="Menu.openUrl('"+root+"views/rawbioassays/index.jsp?ID="+ID+"')"%>" |
---|
467 | tooltip="<%=hasRawBioAssays ? "Manage raw bioassays" : "You do not have permission to manage raw bioassays"%>" |
---|
468 | enabled="<%=hasRawBioAssays%>" |
---|
469 | /> |
---|
470 | <m:menuitem |
---|
471 | title="Experiments" |
---|
472 | onclick="<%="Menu.openUrl('"+root+"views/experiments/index.jsp?ID="+ID+"')"%>" |
---|
473 | tooltip="<%=hasExperiments ? "Manage experiments" : "You do not have permission to manage experiments"%>" |
---|
474 | enabled="<%=hasExperiments%>" |
---|
475 | /> |
---|
476 | <m:menuitem |
---|
477 | title="Formulas" |
---|
478 | onclick="<%="Menu.openUrl('"+root+"views/formulas/index.jsp?ID="+ID+"')"%>" |
---|
479 | tooltip="<%=hasFormulas ? "Manage formulas" : "You do not have permission to manage formulas"%>" |
---|
480 | enabled="<%=hasFormulas%>" |
---|
481 | /> |
---|
482 | <m:menuseparator /> |
---|
483 | <m:menuitem |
---|
484 | title="Reporters" |
---|
485 | onclick="<%="Menu.openUrl('"+root+"views/reporters/index.jsp?ID="+ID+"')"%>" |
---|
486 | tooltip="<%=hasReporters ? "Manage reporters" : "You do not have permission to manage reporters"%>" |
---|
487 | enabled="<%=hasReporters%>" |
---|
488 | /> |
---|
489 | <m:menuitem |
---|
490 | title="Reporter lists" |
---|
491 | onclick="<%="Menu.openUrl('"+root+"views/reporterlists/index.jsp?ID="+ID+"')"%>" |
---|
492 | tooltip="<%=hasReporterLists ? "Manage reporter lists" : "You do not have permission to manage reporter lists"%>" |
---|
493 | enabled="<%=hasReporterLists%>" |
---|
494 | /> |
---|
495 | </m:menu> |
---|
496 | |
---|
497 | <m:menu |
---|
498 | id="base" |
---|
499 | style="display: none" |
---|
500 | > |
---|
501 | <m:submenu |
---|
502 | subid="projects" |
---|
503 | title="Select project" |
---|
504 | enabled="<%=hasProjects%>" |
---|
505 | /> |
---|
506 | <m:menuseparator /> |
---|
507 | <m:menuitem |
---|
508 | title="Contact information…" |
---|
509 | onclick="<%="Main.openPopup('"+root+"my_base/user/settings.jsp?ID="+ID+"&page=contact', 'Settings', 500, 360);"%>" |
---|
510 | tooltip="Set your address, phone, email, etc." |
---|
511 | /> |
---|
512 | <m:menuitem |
---|
513 | title="Change password…" |
---|
514 | onclick="<%="Main.openPopup('"+root+"my_base/user/settings.jsp?ID="+ID+"&page=password', 'Settings', 500, 360);"%>" |
---|
515 | tooltip="Set your password" |
---|
516 | /> |
---|
517 | <m:menuitem |
---|
518 | title="Other information…" |
---|
519 | onclick="<%="Main.openPopup('"+root+"my_base/user/settings.jsp?ID="+ID+"&page=other', 'Settings', 500, 360);"%>" |
---|
520 | tooltip="Other user-related information" |
---|
521 | /> |
---|
522 | <m:menuseparator /> |
---|
523 | <m:menuitem |
---|
524 | title="Preferences…" |
---|
525 | onclick="<%="Main.openPopup('"+root+"my_base/user/preferences.jsp?ID="+ID+"', 'Preferences', 500, 400);"%>" |
---|
526 | tooltip="Change font sizes, etc." |
---|
527 | /> |
---|
528 | <m:menuitem |
---|
529 | title="Reload permissions" |
---|
530 | onclick="<%="Main.openPopup('"+root+"my_base/user/submit_user.jsp?ID="+ID+"&cmd=ReloadPermissions', 'ReloadPermissions', 300, 200);"%>" |
---|
531 | tooltip="Reload permissions" |
---|
532 | /> |
---|
533 | <m:menuitem |
---|
534 | title="Reset list settings…" |
---|
535 | onclick="<%="Main.openPopup('"+root+"my_base/user/reset_filters.jsp?ID="+ID+"', 'ResetFilter', 400, 300);"%>" |
---|
536 | tooltip="Reset visible columns, sort order, filters, etc. to default settings on all lists" |
---|
537 | /> |
---|
538 | <m:menuseparator /> |
---|
539 | <m:menuitem |
---|
540 | title="Logout…" |
---|
541 | onclick="<%="Main.openPopup('"+root+"logout.jsp?ID="+ID+"', 'Logout', 360, 200);"%>" |
---|
542 | tooltip="Exit from BASE" |
---|
543 | /> |
---|
544 | </m:menu> |
---|
545 | |
---|
546 | <% |
---|
547 | // BioLIMS - menu |
---|
548 | final boolean hasLabels = !sc.hasPermission(Permission.DENIED, Item.LABEL); |
---|
549 | final boolean createLabels = sc.hasPermission(Permission.CREATE, Item.LABEL); |
---|
550 | |
---|
551 | final boolean hasBioSources = !sc.hasPermission(Permission.DENIED, Item.BIOSOURCE); |
---|
552 | final boolean createBioSources = sc.hasPermission(Permission.CREATE, Item.BIOSOURCE); |
---|
553 | |
---|
554 | final boolean hasSamples = !sc.hasPermission(Permission.DENIED, Item.SAMPLE); |
---|
555 | final boolean createSamples = sc.hasPermission(Permission.CREATE, Item.SAMPLE); |
---|
556 | |
---|
557 | final boolean hasExtracts = !sc.hasPermission(Permission.DENIED, Item.EXTRACT); |
---|
558 | final boolean createExtracts = sc.hasPermission(Permission.CREATE, Item.EXTRACT); |
---|
559 | |
---|
560 | final boolean hasLabeledExtracts = !sc.hasPermission(Permission.DENIED, Item.LABELEDEXTRACT); |
---|
561 | final boolean createLabeledExtracts = sc.hasPermission(Permission.CREATE, Item.LABELEDEXTRACT); |
---|
562 | |
---|
563 | final boolean hasBioMaterialLists = !sc.hasPermission(Permission.DENIED, Item.BIOMATERIALLIST); |
---|
564 | |
---|
565 | final boolean hasBioPlates = !sc.hasPermission(Permission.DENIED, Item.BIOPLATE); |
---|
566 | final boolean createBioPlates = sc.hasPermission(Permission.CREATE, Item.BIOPLATE); |
---|
567 | final boolean hasBioLims = hasLabels || hasBioSources || hasSamples || hasExtracts || |
---|
568 | hasLabeledExtracts || hasBioMaterialLists; |
---|
569 | |
---|
570 | if (hasBioLims) |
---|
571 | { |
---|
572 | %> |
---|
573 | <m:menu |
---|
574 | id="biolims" |
---|
575 | style="display: none" |
---|
576 | > |
---|
577 | <m:menuitem |
---|
578 | title="Biosources" |
---|
579 | onclick="<%="Menu.openUrl('"+root+"biomaterials/biosources/index.jsp?ID="+ID+"')"%>" |
---|
580 | tooltip="<%=hasBioSources ? "Manage biosources" : "You do not have permission to manage biosources"%>" |
---|
581 | enabled="<%=hasBioSources%>" |
---|
582 | /> |
---|
583 | <m:menuitem |
---|
584 | title="Samples" |
---|
585 | onclick="<%="Menu.openUrl('"+root+"biomaterials/samples/index.jsp?ID="+ID+"')"%>" |
---|
586 | tooltip="<%=hasSamples ? "Manage samples" : "You do not have permission to manage samples"%>" |
---|
587 | enabled="<%=hasSamples%>" |
---|
588 | /> |
---|
589 | <m:menuitem |
---|
590 | title="Extracts" |
---|
591 | onclick="<%="Menu.openUrl('"+root+"biomaterials/extracts/index.jsp?ID="+ID+"')"%>" |
---|
592 | tooltip="<%=hasExtracts ? "Manage extracts" : "You do not have permission to manage extracts"%>" |
---|
593 | enabled="<%=hasExtracts%>" |
---|
594 | /> |
---|
595 | <m:menuitem |
---|
596 | title="Labeled extracts" |
---|
597 | onclick="<%="Menu.openUrl('"+root+"biomaterials/labeledextracts/index.jsp?ID="+ID+"')"%>" |
---|
598 | tooltip="<%=hasLabeledExtracts ? "Manage labeled extracts" : "You do not have permission to manage labeled extracts"%>" |
---|
599 | enabled="<%=hasLabeledExtracts%>" |
---|
600 | /> |
---|
601 | <m:menuitem |
---|
602 | title="Labels" |
---|
603 | onclick="<%="Menu.openUrl('"+root+"biomaterials/labels/index.jsp?ID="+ID+"')"%>" |
---|
604 | tooltip="<%=hasLabels ? "Manage labels" : "You do not have permission to manage labels"%>" |
---|
605 | enabled="<%=hasLabels%>" |
---|
606 | /> |
---|
607 | <m:menuseparator /> |
---|
608 | <m:menuitem |
---|
609 | title="Bioplates" |
---|
610 | onclick="<%="Menu.openUrl('"+root+"biomaterials/bioplates/index.jsp?ID="+ID+"')"%>" |
---|
611 | tooltip="<%=hasBioPlates ? "Manage bio plates" : "You do not have permission to manage bio plates"%>" |
---|
612 | enabled="<%=hasBioPlates%>" |
---|
613 | /> |
---|
614 | <m:menuitem |
---|
615 | title="Biomaterial lists" |
---|
616 | onclick="<%="Menu.openUrl('"+root+"biomaterials/lists/index.jsp?ID="+ID+"')"%>" |
---|
617 | tooltip="<%=hasBioMaterialLists ? "Manage biomaterial lists" : "You do not have permission to manage biomaterial lists"%>" |
---|
618 | enabled="<%=hasBioMaterialLists%>" |
---|
619 | /> |
---|
620 | </m:menu> |
---|
621 | <% |
---|
622 | } |
---|
623 | |
---|
624 | // Array LIMS - menu |
---|
625 | final boolean hasPlateGeometries = sc.hasPermission(Permission.READ, Item.PLATEGEOMETRY); |
---|
626 | final boolean hasPlateTypes = !sc.hasPermission(Permission.DENIED, Item.PLATETYPE); |
---|
627 | final boolean hasPlates = !sc.hasPermission(Permission.DENIED, Item.PLATE); |
---|
628 | final boolean hasPlateMappings = !sc.hasPermission(Permission.DENIED, Item.PLATEMAPPING); |
---|
629 | final boolean hasArraySlides = !sc.hasPermission(Permission.DENIED, Item.ARRAYSLIDE); |
---|
630 | final boolean hasArrayBatches = !sc.hasPermission(Permission.DENIED, Item.ARRAYBATCH); |
---|
631 | final boolean hasArrayDesigns = !sc.hasPermission(Permission.DENIED, Item.ARRAYDESIGN); |
---|
632 | final boolean hasLims = hasPlateGeometries || hasPlateTypes || hasPlates || hasPlateMappings || |
---|
633 | hasArraySlides || hasArrayBatches || hasArrayDesigns; |
---|
634 | if (hasLims) |
---|
635 | { |
---|
636 | %> |
---|
637 | <m:menu |
---|
638 | id="lims" |
---|
639 | style="display: none" |
---|
640 | > |
---|
641 | <m:menuitem |
---|
642 | title="Plate geometries" |
---|
643 | onclick="<%="Menu.openUrl('"+root+"lims/geometries/index.jsp?ID="+ID+"')"%>" |
---|
644 | tooltip="<%=hasPlateGeometries ? "Manage plate geometries" : "You do not have permission to manage plate geometries"%>" |
---|
645 | enabled="<%=hasPlateGeometries%>" |
---|
646 | /> |
---|
647 | <m:menuitem |
---|
648 | title="Plate types" |
---|
649 | onclick="<%="Menu.openUrl('"+root+"lims/platetypes/index.jsp?ID="+ID+"')"%>" |
---|
650 | tooltip="<%=hasPlateTypes ? "Manage plate types" : "You do not have permission to manage plate types"%>" |
---|
651 | enabled="<%=hasPlateTypes%>" |
---|
652 | /> |
---|
653 | <m:menuitem |
---|
654 | title="Plates" |
---|
655 | onclick="<%="Menu.openUrl('"+root+"lims/plates/index.jsp?ID="+ID+"')"%>" |
---|
656 | tooltip="<%=hasPlates ? "Manage plates" : "You do not have permission to manage plates"%>" |
---|
657 | enabled="<%=hasPlates%>" |
---|
658 | /> |
---|
659 | <m:menuitem |
---|
660 | title="Plate mappings" |
---|
661 | onclick="<%="Menu.openUrl('"+root+"lims/platemappings/index.jsp?ID="+ID+"')"%>" |
---|
662 | tooltip="<%=hasPlateTypes ? "Manage plate mappings" : "You do not have permission to manage plate mappings"%>" |
---|
663 | enabled="<%=hasPlateTypes%>" |
---|
664 | /> |
---|
665 | <m:menuseparator /> |
---|
666 | <m:menuitem |
---|
667 | title="Array designs" |
---|
668 | onclick="<%="Menu.openUrl('"+root+"lims/arraydesigns/index.jsp?ID="+ID+"')"%>" |
---|
669 | tooltip="<%=hasArrayDesigns ? "Manage array designs" : "You do not have permission to manage array designs"%>" |
---|
670 | enabled="<%=hasArrayDesigns%>" |
---|
671 | /> |
---|
672 | <m:menuitem |
---|
673 | title="Array batches" |
---|
674 | onclick="<%="Menu.openUrl('"+root+"lims/arraybatches/index.jsp?ID="+ID+"')"%>" |
---|
675 | tooltip="<%=hasArrayBatches ? "Manage array batches" : "You do not have permission to manage array batches"%>" |
---|
676 | enabled="<%=hasArrayBatches%>" |
---|
677 | /> |
---|
678 | <m:menuitem |
---|
679 | title="Array slides" |
---|
680 | onclick="<%="Menu.openUrl('"+root+"lims/arrayslides/index.jsp?ID="+ID+"')"%>" |
---|
681 | tooltip="<%=hasArraySlides ? "Manage array slides" : "You do not have permission to manage array slides"%>" |
---|
682 | enabled="<%=hasArraySlides%>" |
---|
683 | /> |
---|
684 | </m:menu> |
---|
685 | <% |
---|
686 | } |
---|
687 | %> |
---|
688 | <% |
---|
689 | // Administrate -> Types menu |
---|
690 | final boolean hasQuotaTypes = sc.hasPermission(Permission.READ, Item.QUOTATYPE); |
---|
691 | final boolean hasProtocolTypes = sc.hasPermission(Permission.READ, Item.PROTOCOLTYPE); |
---|
692 | final boolean hasFileTypes = sc.hasPermission(Permission.READ, Item.FILETYPE); |
---|
693 | final boolean hasMimeTypes = sc.hasPermission(Permission.READ, Item.MIMETYPE); |
---|
694 | final boolean hasHardwareTypes = sc.hasPermission(Permission.READ, Item.HARDWARETYPE); |
---|
695 | final boolean hasSoftwareTypes = sc.hasPermission(Permission.READ, Item.SOFTWARETYPE); |
---|
696 | final boolean hasAnnotationTypeCategories = !sc.hasPermission(Permission.DENIED, Item.ANNOTATIONTYPECATEGORY); |
---|
697 | final boolean hasAnnotationTypes = !sc.hasPermission(Permission.DENIED, Item.ANNOTATIONTYPE); |
---|
698 | final boolean hasReporterTypes = !sc.hasPermission(Permission.DENIED, Item.REPORTERTYPE); |
---|
699 | final boolean hasExtraValueTypes = !sc.hasPermission(Permission.DENIED, Item.EXTRAVALUETYPE); |
---|
700 | final boolean hasQuantities = !sc.hasPermission(Permission.DENIED, Item.QUANTITY); |
---|
701 | final boolean hasTypes = hasFileTypes || hasProtocolTypes || hasMimeTypes || hasQuotaTypes || |
---|
702 | hasSoftwareTypes || hasHardwareTypes || hasAnnotationTypeCategories || hasAnnotationTypes || |
---|
703 | hasReporterTypes || hasExtraValueTypes || hasQuantities; |
---|
704 | if (hasTypes) |
---|
705 | { |
---|
706 | %> |
---|
707 | <m:menu |
---|
708 | id="types" |
---|
709 | style="display: none" |
---|
710 | > |
---|
711 | <m:menuitem |
---|
712 | title="Quota types" |
---|
713 | onclick="<%="Menu.openUrl('"+root+"admin/quotatypes/index.jsp?ID="+ID+"')"%>" |
---|
714 | tooltip="<%=hasQuotaTypes ? "Administrate quota types" : "You do not have permission to administrate quota types"%>" |
---|
715 | enabled="<%=hasQuotaTypes%>" |
---|
716 | /> |
---|
717 | <m:menuitem |
---|
718 | title="Protocol types" |
---|
719 | onclick="<%="Menu.openUrl('"+root+"admin/protocoltypes/index.jsp?ID="+ID+"')"%>" |
---|
720 | tooltip="<%=hasProtocolTypes ? "Administrate protocol types" : "You do not have permission to administrate protocol types"%>" |
---|
721 | enabled="<%=hasProtocolTypes%>" |
---|
722 | /> |
---|
723 | <m:menuitem |
---|
724 | title="File types" |
---|
725 | onclick="<%="Menu.openUrl('"+root+"admin/filetypes/index.jsp?ID="+ID+"')"%>" |
---|
726 | tooltip="<%=hasFileTypes ? "Administrate file types" : "You do not have permission to administrate file types"%>" |
---|
727 | enabled="<%=hasFileTypes%>" |
---|
728 | /> |
---|
729 | <m:menuitem |
---|
730 | title="MIME types" |
---|
731 | onclick="<%="Menu.openUrl('"+root+"admin/mimetypes/index.jsp?ID="+ID+"')"%>" |
---|
732 | tooltip="<%=hasMimeTypes ? "Administrate MIME types" : "You do not have permission to administrate mime types"%>" |
---|
733 | enabled="<%=hasMimeTypes%>" |
---|
734 | /> |
---|
735 | <m:menuitem |
---|
736 | title="Software types" |
---|
737 | onclick="<%="Menu.openUrl('"+root+"admin/softwaretypes/index.jsp?ID="+ID+"')"%>" |
---|
738 | tooltip="<%=hasSoftwareTypes ? "Administrate software types" : "You do not have permission to administrate software types"%>" |
---|
739 | enabled="<%=hasSoftwareTypes%>" |
---|
740 | /> |
---|
741 | <m:menuitem |
---|
742 | title="Hardware types" |
---|
743 | onclick="<%="Menu.openUrl('"+root+"admin/hardwaretypes/index.jsp?ID="+ID+"')"%>" |
---|
744 | tooltip="<%=hasHardwareTypes ? "Administrate hardware types" : "You do not have permission to administrate hardware types"%>" |
---|
745 | enabled="<%=hasHardwareTypes%>" |
---|
746 | /> |
---|
747 | <m:menuitem |
---|
748 | title="Annotation type categories" |
---|
749 | onclick="<%="Menu.openUrl('"+root+"admin/annotationtypecategories/index.jsp?ID="+ID+"')"%>" |
---|
750 | tooltip="<%=hasAnnotationTypeCategories ? "Administrate annotation type categories" : "You do not have permission to administrate annotation types categories"%>" |
---|
751 | enabled="<%=hasAnnotationTypeCategories%>" |
---|
752 | /> |
---|
753 | <m:menuitem |
---|
754 | title="Annotation types" |
---|
755 | onclick="<%="Menu.openUrl('"+root+"admin/annotationtypes/index.jsp?ID="+ID+"')"%>" |
---|
756 | tooltip="<%=hasAnnotationTypes ? "Administrate annotation types" : "You do not have permission to administrate annotation types"%>" |
---|
757 | enabled="<%=hasAnnotationTypes%>" |
---|
758 | /> |
---|
759 | <m:menuitem |
---|
760 | title="Units and quantities" |
---|
761 | onclick="<%="Menu.openUrl('"+root+"admin/quantities/index.jsp?ID="+ID+"')"%>" |
---|
762 | tooltip="<%=hasQuantities ? "Administrate quantities" : "You do not have permission to administrate quantities"%>" |
---|
763 | enabled="<%=hasQuantities%>" |
---|
764 | /> |
---|
765 | <m:menuitem |
---|
766 | title="Reporter types" |
---|
767 | onclick="<%="Menu.openUrl('"+root+"admin/reportertypes/index.jsp?ID="+ID+"')"%>" |
---|
768 | tooltip="<%=hasReporterTypes ? "Administrate reporter types" : "You do not have permission to administrate reporter types"%>" |
---|
769 | enabled="<%=hasReporterTypes%>" |
---|
770 | /> |
---|
771 | <m:menuitem |
---|
772 | title="Extra value types" |
---|
773 | onclick="<%="Menu.openUrl('"+root+"admin/extravaluetypes/index.jsp?ID="+ID+"')"%>" |
---|
774 | tooltip="<%=hasExtraValueTypes ? "Administrate extra value types" : "You do not have permission to administrate extra value types"%>" |
---|
775 | enabled="<%=hasExtraValueTypes%>" |
---|
776 | /> |
---|
777 | </m:menu> |
---|
778 | <% |
---|
779 | } |
---|
780 | %> |
---|
781 | <% |
---|
782 | // Administrate -> Platforms menu |
---|
783 | final boolean hasPlatforms = sc.hasPermission(Permission.READ, Item.PLATFORM); |
---|
784 | final boolean hasFileSetMemberTypes = sc.hasPermission(Permission.READ, Item.DATAFILETYPE); |
---|
785 | final boolean hasTopPlatforms = hasPlatforms || hasFileSetMemberTypes; |
---|
786 | if (hasTopPlatforms) |
---|
787 | { |
---|
788 | %> |
---|
789 | <m:menu |
---|
790 | id="platforms" |
---|
791 | style="display: none" |
---|
792 | > |
---|
793 | <m:menuitem |
---|
794 | title="Experimental platforms" |
---|
795 | onclick="<%="Menu.openUrl('"+root+"admin/platforms/index.jsp?ID="+ID+"')"%>" |
---|
796 | tooltip="<%=hasPlatforms ? "Administrate experimental platforms" : "You do not have permission to administrate experimental platforms"%>" |
---|
797 | enabled="<%=hasPlatforms%>" |
---|
798 | /> |
---|
799 | <m:menuitem |
---|
800 | title="Data file types" |
---|
801 | onclick="<%="Menu.openUrl('"+root+"admin/datafiletypes/index.jsp?ID="+ID+"')"%>" |
---|
802 | tooltip="<%=hasFileSetMemberTypes ? "Administrate data file types" : "You do not have permission to administrate data file types"%>" |
---|
803 | enabled="<%=hasFileSetMemberTypes%>" |
---|
804 | /> |
---|
805 | </m:menu> |
---|
806 | <% |
---|
807 | } |
---|
808 | %> |
---|
809 | |
---|
810 | <% |
---|
811 | // Plugins menu |
---|
812 | final boolean hasPluginTypes = !sc.hasPermission(Permission.DENIED, Item.PLUGINTYPE); |
---|
813 | final boolean hasPluginDefinitions = !sc.hasPermission(Permission.DENIED, Item.PLUGINDEFINITION); |
---|
814 | final boolean hasPluginConfigurations = !sc.hasPermission(Permission.DENIED, Item.PLUGINCONFIGURATION); |
---|
815 | final boolean hasJobAgents = sc.hasPermission(Permission.READ, Item.JOBAGENT); |
---|
816 | final boolean hasPlugins = hasPluginTypes || hasPluginDefinitions || |
---|
817 | hasPluginConfigurations || hasJobAgents; |
---|
818 | |
---|
819 | if (hasPlugins) |
---|
820 | { |
---|
821 | %> |
---|
822 | <m:menu |
---|
823 | id="plugins" |
---|
824 | style="display: none" |
---|
825 | > |
---|
826 | <m:menuitem |
---|
827 | title="Types" |
---|
828 | onclick="<%="Menu.openUrl('"+root+"admin/plugintypes/index.jsp?ID="+ID+"')"%>" |
---|
829 | tooltip="<%=hasPluginDefinitions ? "Administrate plugin types" : "You do not have permission to administrate plugin types"%>" |
---|
830 | enabled="<%=hasPluginTypes%>" |
---|
831 | /> |
---|
832 | <m:menuitem |
---|
833 | title="Definitions" |
---|
834 | onclick="<%="Menu.openUrl('"+root+"admin/plugindefinitions/index.jsp?ID="+ID+"')"%>" |
---|
835 | tooltip="<%=hasPluginDefinitions ? "Administrate plugin definitions" : "You do not have permission to administrate plugin definitions"%>" |
---|
836 | enabled="<%=hasPluginDefinitions%>" |
---|
837 | /> |
---|
838 | <m:menuitem |
---|
839 | title="Configurations" |
---|
840 | onclick="<%="Menu.openUrl('"+root+"admin/pluginconfigurations/index.jsp?ID="+ID+"')"%>" |
---|
841 | tooltip="<%=hasPluginConfigurations ? "Administrate plugin configurations" : "You do not have permission to administrate plugin configurations"%>" |
---|
842 | enabled="<%=hasPluginConfigurations%>" |
---|
843 | /> |
---|
844 | <m:menuseparator /> |
---|
845 | <m:menuitem |
---|
846 | title="Job agents" |
---|
847 | onclick="<%="Menu.openUrl('"+root+"admin/jobagents/index.jsp?ID="+ID+"')"%>" |
---|
848 | tooltip="<%=hasJobAgents ? "Administrate job agents" : "You do not have permission to administrate job agents"%>" |
---|
849 | enabled="<%=hasJobAgents%>" |
---|
850 | /> |
---|
851 | </m:menu> |
---|
852 | <% |
---|
853 | } |
---|
854 | %> |
---|
855 | |
---|
856 | <% |
---|
857 | // Administrate menu |
---|
858 | final boolean hasUsers = !sc.hasPermission(Permission.DENIED, Item.USER); |
---|
859 | final boolean hasGroups = !sc.hasPermission(Permission.DENIED, Item.GROUP); |
---|
860 | final boolean hasRoles = sc.hasPermission(Permission.READ, Item.ROLE); |
---|
861 | final boolean hasQuota = sc.hasPermission(Permission.READ, Item.QUOTA); |
---|
862 | final boolean hasSoftware = !sc.hasPermission(Permission.DENIED, Item.SOFTWARE); |
---|
863 | final boolean hasHardware = !sc.hasPermission(Permission.DENIED, Item.HARDWARE); |
---|
864 | final boolean hasProtocols = !sc.hasPermission(Permission.DENIED, Item.PROTOCOL); |
---|
865 | final boolean hasClients = sc.hasPermission(Permission.READ, Item.CLIENT); |
---|
866 | final boolean hasNews = sc.hasPermission(Permission.READ, Item.NEWS); |
---|
867 | final boolean hasDiskUsage = sc.hasPermission(Permission.READ, Item.DISKUSAGE); |
---|
868 | final Client currentClient = Client.getById(dc, sc.getClientId()); |
---|
869 | final boolean hasServer = currentClient.hasPermission(Permission.WRITE); |
---|
870 | |
---|
871 | final boolean hasAdministrate = |
---|
872 | hasUsers || hasGroups || hasRoles || hasQuota || hasTypes || hasPlugins || |
---|
873 | hasSoftware || hasHardware || hasProtocols || hasClients || hasNews || |
---|
874 | hasDiskUsage || hasServer || hasTopPlatforms; |
---|
875 | |
---|
876 | if (hasAdministrate) |
---|
877 | { |
---|
878 | %> |
---|
879 | <m:menu |
---|
880 | id="administrate" |
---|
881 | style="display: none" |
---|
882 | > |
---|
883 | <m:menuitem |
---|
884 | title="Users" |
---|
885 | onclick="<%="Menu.openUrl('"+root+"admin/users/index.jsp?ID="+ID+"')"%>" |
---|
886 | tooltip="<%=hasUsers ? "Administrate users" : "You do not have permission to administrate users"%>" |
---|
887 | enabled="<%=hasUsers%>" |
---|
888 | /> |
---|
889 | <m:menuitem |
---|
890 | title="Groups" |
---|
891 | onclick="<%="Menu.openUrl('"+root+"admin/groups/index.jsp?ID="+ID+"')"%>" |
---|
892 | tooltip="<%=hasGroups ? "Administrate groups" : "You do not have permission to administrate groups"%>" |
---|
893 | enabled="<%=hasGroups%>" |
---|
894 | /> |
---|
895 | <m:menuitem |
---|
896 | title="Roles" |
---|
897 | onclick="<%="Menu.openUrl('"+root+"admin/roles/index.jsp?ID="+ID+"')"%>" |
---|
898 | tooltip="<%=hasRoles ? "Administrate roles" : "You do not have permission to administrate roles"%>" |
---|
899 | enabled="<%=hasRoles%>" |
---|
900 | /> |
---|
901 | <m:menuseparator /> |
---|
902 | <m:submenu |
---|
903 | subid="plugins" |
---|
904 | title="Plugins" |
---|
905 | tooltip="Administrate plugin definitions and configurations" |
---|
906 | enabled="<%=hasPlugins%>" |
---|
907 | /> |
---|
908 | <m:menuseparator /> |
---|
909 | <m:menuitem |
---|
910 | title="Quota" |
---|
911 | onclick="<%="Menu.openUrl('"+root+"admin/quota/index.jsp?ID="+ID+"')"%>" |
---|
912 | tooltip="<%=hasQuota ? "Administrate quota" : "You do not have permission to administrate quota"%>" |
---|
913 | enabled="<%=hasQuota%>" |
---|
914 | /> |
---|
915 | <m:menuitem |
---|
916 | title="Software" |
---|
917 | onclick="<%="Menu.openUrl('"+root+"admin/software/index.jsp?ID="+ID+"')"%>" |
---|
918 | tooltip="<%=hasSoftware ? "Administrate software" : "You do not have permission to administrate software"%>" |
---|
919 | enabled="<%=hasSoftware%>" |
---|
920 | /> |
---|
921 | <m:menuitem |
---|
922 | title="Hardware" |
---|
923 | onclick="<%="Menu.openUrl('"+root+"admin/hardware/index.jsp?ID="+ID+"')"%>" |
---|
924 | tooltip="<%=hasHardware ? "Administrate hardware" : "You do not have permission to administrate hardware"%>" |
---|
925 | enabled="<%=hasHardware%>" |
---|
926 | /> |
---|
927 | <m:menuitem |
---|
928 | title="Protocols" |
---|
929 | onclick="<%="Menu.openUrl('"+root+"admin/protocols/index.jsp?ID="+ID+"')"%>" |
---|
930 | tooltip="<%=hasProtocols ? "Administrate protocols" : "You do not have permission to administrate protocols"%>" |
---|
931 | enabled="<%=hasProtocols%>" |
---|
932 | /> |
---|
933 | <m:menuitem |
---|
934 | title="Clients" |
---|
935 | onclick="<%="Menu.openUrl('"+root+"admin/clients/index.jsp?ID="+ID+"')"%>" |
---|
936 | tooltip="<%=hasClients ? "Administrate client applications" : "You do not have permission to administrate client applications"%>" |
---|
937 | enabled="<%=hasClients%>" |
---|
938 | /> |
---|
939 | <m:menuitem |
---|
940 | title="News" |
---|
941 | onclick="<%="Menu.openUrl('"+root+"admin/news/index.jsp?ID="+ID+"')"%>" |
---|
942 | tooltip="<%=hasNews ? "Administrate news" : "You do not have permission to administrate news"%>" |
---|
943 | enabled="<%=hasNews%>" |
---|
944 | /> |
---|
945 | <m:menuseparator /> |
---|
946 | <m:submenu |
---|
947 | subid="platforms" |
---|
948 | title="Platforms" |
---|
949 | tooltip="Administrate experimental platforms" |
---|
950 | enabled="<%=hasTopPlatforms%>" |
---|
951 | /> |
---|
952 | <m:submenu |
---|
953 | subid="types" |
---|
954 | title="Types" |
---|
955 | tooltip="Administrate quota, file, hardware and software types" |
---|
956 | enabled="<%=hasTypes%>" |
---|
957 | /> |
---|
958 | <m:menuseparator /> |
---|
959 | <m:menuitem |
---|
960 | title="Disk usage" |
---|
961 | onclick="<%="Menu.openUrl('"+root+"admin/diskusage/index.jsp?ID="+ID+"')"%>" |
---|
962 | tooltip="<%=hasDiskUsage ? "Check disk usage" : "You do not have permission to check disk usage"%>" |
---|
963 | enabled="<%=hasDiskUsage%>" |
---|
964 | /> |
---|
965 | <m:menuitem |
---|
966 | title="Server settings…" |
---|
967 | onclick="<%="Main.openPopup('"+root+"admin/server/configure.jsp?ID="+ID+"', 'ServerSettings', 500, 400);"%>" |
---|
968 | tooltip="<%=hasServer ? "Configure the server" : "You do not have permission to configure the server"%>" |
---|
969 | enabled="<%=hasServer%>" |
---|
970 | /> |
---|
971 | <m:menuitem |
---|
972 | title="Broadcast message…" |
---|
973 | onclick="<%="Main.openPopup('"+root+"admin/server/broadcast.jsp?ID="+ID+"', 'BroadcastMessage', 640, 400);"%>" |
---|
974 | tooltip="<%=hasServer ? "Broadcast a message to all logged in users" : "You do not have permission to send messages"%>" |
---|
975 | enabled="<%=hasServer%>" |
---|
976 | /> |
---|
977 | <m:menuitem |
---|
978 | title="Services" |
---|
979 | tooltip="<%=hasServer ? "Manage service extensions" : "You do not have permission to manage services" %>" |
---|
980 | onclick="<%="Menu.openUrl('"+root+"admin/services/index.jsp?ID="+ID+"')"%>" |
---|
981 | enabled="<%=hasServer%>" |
---|
982 | /> |
---|
983 | </m:menu> |
---|
984 | <% |
---|
985 | } |
---|
986 | %> |
---|
987 | <% |
---|
988 | // Help menu |
---|
989 | final String helplink = Values.getStringOrNull(sc.getClientDefaultSetting("server.links.help")); |
---|
990 | final String faqlink = Values.getStringOrNull(sc.getClientDefaultSetting("server.links.faq")); |
---|
991 | final String reportbuglink = Values.getStringOrNull(sc.getClientDefaultSetting("server.links.reportbug")); |
---|
992 | %> |
---|
993 | <m:menu id="help" style="display: none"> |
---|
994 | <m:menuitem |
---|
995 | visible="<%=HTML.isValidUrl(helplink)%>" |
---|
996 | title="Help…" |
---|
997 | onclick="<%="window.open('"+helplink+"','Help')"%>" |
---|
998 | /> |
---|
999 | <m:menuitem |
---|
1000 | visible="<%=HTML.isValidUrl(faqlink)%>" |
---|
1001 | title="FAQ…" |
---|
1002 | onclick="<%="window.open('"+faqlink+"','FAQ')"%>" |
---|
1003 | /> |
---|
1004 | <m:menuseparator /> |
---|
1005 | |
---|
1006 | <m:menuitem |
---|
1007 | title="About…" |
---|
1008 | onclick="<%="Main.openPopup('"+root+"info/about.jsp?ID="+ID+"&page=about', 'About', 500, 350)"%>" |
---|
1009 | /> |
---|
1010 | |
---|
1011 | <m:menuitem |
---|
1012 | title="License…" |
---|
1013 | onclick="<%="Main.openPopup('"+root+"info/about.jsp?ID="+ID+"&page=license', 'About', 500, 350)"%>" |
---|
1014 | |
---|
1015 | /> |
---|
1016 | <m:menuitem |
---|
1017 | visible="<%=HTML.isValidUrl(reportbuglink)%>" |
---|
1018 | title="Report a bug…" |
---|
1019 | onclick="<%="window.open('"+reportbuglink+"','Reportbug')"%>" |
---|
1020 | /> |
---|
1021 | <m:menuseparator /> |
---|
1022 | <m:menuitem |
---|
1023 | title="Base project site" onclick="<%="Menu.openUrl('http://base.thep.lu.se', 'basesite')"%>" |
---|
1024 | /> |
---|
1025 | </m:menu> |
---|
1026 | |
---|
1027 | <% |
---|
1028 | //Switch user/logout menu |
---|
1029 | final boolean hasImpersonate = |
---|
1030 | !sc.isImpersonated() && sc.hasSystemPermission(Permission.ACT_AS_ANOTHER_USER); |
---|
1031 | %> |
---|
1032 | <m:menu |
---|
1033 | id="switchuser" |
---|
1034 | style="display: none;" |
---|
1035 | > |
---|
1036 | <m:menuitem |
---|
1037 | title="Switch user…" |
---|
1038 | onclick="<%="Main.openPopup('"+root+"switch.jsp?ID="+ID+"', 'Switch', 360, 200);"%>" |
---|
1039 | tooltip="Login as another user" |
---|
1040 | /> |
---|
1041 | <m:menuitem |
---|
1042 | title="Impersonate…" |
---|
1043 | onclick="<%="Main.openPopup('"+root+"impersonate.jsp?ID="+ID+"', 'Impersonate', 480, 240);"%>" |
---|
1044 | tooltip="Login as another user without knowing the password" |
---|
1045 | visible="<%=hasImpersonate%>" |
---|
1046 | /> |
---|
1047 | <m:menuitem |
---|
1048 | title="Logout…" |
---|
1049 | onclick="<%="Main.openPopup('"+root+"logout.jsp?ID="+ID+"', 'Logout', 360, 200);"%>" |
---|
1050 | tooltip="Exit from BASE" |
---|
1051 | /> |
---|
1052 | </m:menu> |
---|
1053 | |
---|
1054 | <% |
---|
1055 | // Extensions menu |
---|
1056 | JspContext context = ExtensionsControl.createContext(dc, pageContext); |
---|
1057 | ExtensionsInvoker<MenuItemAction> invoker = |
---|
1058 | (ExtensionsInvoker<MenuItemAction>)ExtensionsControl.useExtensions(context, |
---|
1059 | "net.sf.basedb.clients.web.menu.extensions"); |
---|
1060 | ExtensionsControl ec = ExtensionsControl.get(dc); |
---|
1061 | ActionIterator<MenuItemAction> it = invoker.iterate(); |
---|
1062 | Map<String, List<MenuItemAction>> menus = new HashMap<String, List<MenuItemAction>>(); |
---|
1063 | menus.put("extensions", new LinkedList<MenuItemAction>()); |
---|
1064 | while (it.hasNext()) |
---|
1065 | { |
---|
1066 | MenuItemAction action = it.next(); |
---|
1067 | String menuId = action.getMenuId(); |
---|
1068 | menuId = menuId == null ? "extensions" : "extensions." + menuId; |
---|
1069 | List<MenuItemAction> actions = menus.get(menuId); |
---|
1070 | if (actions == null) |
---|
1071 | { |
---|
1072 | actions = new LinkedList<MenuItemAction>(); |
---|
1073 | menus.put(menuId, actions); |
---|
1074 | } |
---|
1075 | actions.add(action); |
---|
1076 | } |
---|
1077 | |
---|
1078 | for (Map.Entry<String, List<MenuItemAction>> entry : menus.entrySet()) |
---|
1079 | { |
---|
1080 | String menuId = entry.getKey(); |
---|
1081 | List<MenuItemAction> actions = entry.getValue(); |
---|
1082 | %> |
---|
1083 | <m:menu id="<%=menuId%>" style="display: none;"> |
---|
1084 | <% |
---|
1085 | for (MenuItemAction action : actions) |
---|
1086 | { |
---|
1087 | if (action.getType() == MenuItemAction.MenuType.SEPARATOR) |
---|
1088 | { |
---|
1089 | %> |
---|
1090 | <m:menuseparator style="<%=action.getStyle()%>" visible="<%=action.isVisible()%>" /> |
---|
1091 | <% |
---|
1092 | } |
---|
1093 | else if (action.getType() == MenuItemAction.MenuType.MENUITEM) |
---|
1094 | { |
---|
1095 | %> |
---|
1096 | <m:menuitem |
---|
1097 | style="<%=action.getStyle()%>" |
---|
1098 | title="<%=action.getTitle()%>" |
---|
1099 | icon="<%=action.getIcon()%>" |
---|
1100 | iconabsolute="true" |
---|
1101 | tooltip="<%=action.getTooltip()%>" |
---|
1102 | enabled="<%=action.isEnabled()%>" |
---|
1103 | visible="<%=action.isVisible()%>" |
---|
1104 | onclick="<%=action.getOnClick()%>" |
---|
1105 | /> |
---|
1106 | <% |
---|
1107 | } |
---|
1108 | else if (action.getType() == MenuItemAction.MenuType.SUBMENU) |
---|
1109 | { |
---|
1110 | %> |
---|
1111 | <m:submenu |
---|
1112 | subid="<%="extensions." + action.getSubmenuId()%>" |
---|
1113 | style="<%=action.getStyle()%>" |
---|
1114 | title="<%=action.getTitle()%>" |
---|
1115 | icon="<%=action.getIcon()%>" |
---|
1116 | iconabsolute="true" |
---|
1117 | tooltip="<%=action.getTooltip()%>" |
---|
1118 | enabled="<%=action.isEnabled()%>" |
---|
1119 | visible="<%=action.isVisible()%>" |
---|
1120 | /> |
---|
1121 | <% |
---|
1122 | } |
---|
1123 | } |
---|
1124 | if ("extensions".equals(menuId)) |
---|
1125 | { |
---|
1126 | if (actions.size() > 0) |
---|
1127 | { |
---|
1128 | %> |
---|
1129 | <m:menuseparator /> |
---|
1130 | <% |
---|
1131 | } |
---|
1132 | %> |
---|
1133 | <m:menuitem |
---|
1134 | title="Installed extensions" |
---|
1135 | onclick="<%="Menu.openUrl('"+root+"admin/extensions/index.jsp?ID="+ID+"')"%>" |
---|
1136 | tooltip="Display and administrate installed extensions" |
---|
1137 | /> |
---|
1138 | <m:menuitem |
---|
1139 | title="Manual scan…" |
---|
1140 | onclick="<%="Main.openPopup('"+root+"admin/extensions/manual_scan.jsp?ID=" + ID + "', 'ManualScan', 500, 400);"%>" |
---|
1141 | enabled="<%=ec.hasPermission(Permission.WRITE)%>" |
---|
1142 | tooltip="Start a manual scan for new, updated and deleted extensions" |
---|
1143 | /> |
---|
1144 | <% |
---|
1145 | } |
---|
1146 | %> |
---|
1147 | </m:menu> |
---|
1148 | <% |
---|
1149 | } |
---|
1150 | %> |
---|
1151 | |
---|
1152 | <% |
---|
1153 | // Main menu |
---|
1154 | %> |
---|
1155 | <div style="position: fixed; top: 0px; left: 0px; width: 100%; height: 30px; background: #ffffff;"> |
---|
1156 | <m:menu |
---|
1157 | type="horizontal" |
---|
1158 | clazz="menu_horizontal" |
---|
1159 | id="menubar" |
---|
1160 | style="top: 5px; left: 8px; width: 98%" |
---|
1161 | open="click" |
---|
1162 | filltext="<%=fillText.toString()%>" |
---|
1163 | > |
---|
1164 | <m:submenu |
---|
1165 | subid="base" |
---|
1166 | title="BASE" |
---|
1167 | /> |
---|
1168 | <m:submenu |
---|
1169 | subid="view" |
---|
1170 | title="View" |
---|
1171 | /> |
---|
1172 | <m:submenu |
---|
1173 | subid="biolims" |
---|
1174 | title="Biomaterial LIMS" |
---|
1175 | /> |
---|
1176 | <m:submenu |
---|
1177 | subid="lims" |
---|
1178 | title="Array LIMS" |
---|
1179 | /> |
---|
1180 | <m:submenu |
---|
1181 | subid="administrate" |
---|
1182 | title="Administrate" |
---|
1183 | visible="<%=hasAdministrate%>" |
---|
1184 | /> |
---|
1185 | <m:submenu |
---|
1186 | subid="extensions" |
---|
1187 | title="Extensions" |
---|
1188 | /> |
---|
1189 | <m:submenu |
---|
1190 | subid="help" |
---|
1191 | title="Help" |
---|
1192 | /> |
---|
1193 | </m:menu></div> |
---|
1194 | <br><br> |
---|
1195 | <% |
---|
1196 | } |
---|
1197 | finally |
---|
1198 | { |
---|
1199 | if (dc != null) dc.close(); |
---|
1200 | } |
---|
1201 | |
---|
1202 | } |
---|
1203 | %> |
---|
1204 | |
---|
1205 | |
---|
1206 | |
---|