source: extensions/net.sf.basedb.reggie/trunk/resources/index.jsp @ 1284

Last change on this file since 1284 was 1284, checked in by Nicklas Nordborg, 12 years ago

References #292: Check/create annotation types, etc. required by reggie

This should now work with the items that we need so far for the personal information registration wizard.

File size: 2.3 KB
Line 
1<%@ page
2  pageEncoding="UTF-8"
3  session="false"
4  import="net.sf.basedb.core.Application"
5  import="net.sf.basedb.core.User"
6  import="net.sf.basedb.core.Role"
7  import="net.sf.basedb.core.Group"
8  import="net.sf.basedb.core.DbControl"
9  import="net.sf.basedb.core.SessionControl"
10  import="net.sf.basedb.core.SystemItems"
11  import="net.sf.basedb.core.ItemQuery"
12  import="net.sf.basedb.core.query.Expressions"
13  import="net.sf.basedb.core.query.Hql"
14  import="net.sf.basedb.core.query.Restrictions"
15  import="net.sf.basedb.clients.web.Base"
16  import="net.sf.basedb.clients.web.util.HTML"
17  import="net.sf.basedb.util.Values"
18  import="java.util.List"
19%>
20<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
21<%@ taglib prefix="p" uri="/WEB-INF/path.tld" %>
22<%
23final SessionControl sc = Base.getExistingSessionControl(request, true);
24final String ID = sc.getId();
25final float scale = Base.getScale(sc);
26DbControl dc = null;
27try
28{
29  dc = sc.newDbControl();
30  final User user = User.getById(dc, sc.getLoggedInUserId());
31  boolean isAdmin = false;
32  boolean isPatientCurator = false;
33  try
34  {
35    Role admin = Role.getById(dc, SystemItems.getId(Role.ADMINISTRATOR));
36    isAdmin = sc.isMemberOf(admin);
37  }
38  catch (RuntimeException ex)
39  {}
40  try
41  {
42    ItemQuery<Group> query = Group.getQuery();
43    query.restrict(Restrictions.eq(Hql.property("name"), Expressions.string("PatientCurator")));
44    List<Group> result = query.list(dc);
45    if (result.size() == 1)
46    {
47      isPatientCurator = sc.isMemberOf(result.get(0));
48    }
49  }
50  catch (RuntimeException ex)
51  {}
52%>
53<base:page type="default" >
54<base:head styles="path.css">
55</base:head>
56<base:body>
57
58  <p:path>
59    <p:pathelement title="Reggie" />
60  </p:path>
61
62  <table border="0" cellspacing="0" cellpadding="0" width="100%">
63  <tr valign="top">
64    <td width="50%">
65 
66    <h3 class="light">Reggie wizards</h3>
67    <div class="boxedbottom">
68      <ul>
69      <%
70      if (isAdmin)
71      {
72        %>
73        <li><a href="install.jsp?ID=<%=ID%>">Verify/install required annotation types and other items</a>
74        <%
75      }
76      if (isPatientCurator || isAdmin)
77      {
78        %>
79        <li><a href="persinfo.jsp?ID=<%=ID%>">Personal information registration</a>
80        <%
81      }
82      %>
83      </ul>
84   
85    </div>
86    </td>
87    <td width="50%">
88    </td>
89  </tr>
90  </table>
91
92
93</base:body>
94</base:page>
95<%
96}
97finally
98{
99  if (dc != null) dc.close();
100}
101%>
Note: See TracBrowser for help on using the repository browser.