Ignore:
Timestamp:
Feb 8, 2011, 9:45:46 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

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:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/index.jsp

    r1283 r1284  
    44  import="net.sf.basedb.core.Application"
    55  import="net.sf.basedb.core.User"
     6  import="net.sf.basedb.core.Role"
     7  import="net.sf.basedb.core.Group"
    68  import="net.sf.basedb.core.DbControl"
    79  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"
    815  import="net.sf.basedb.clients.web.Base"
    916  import="net.sf.basedb.clients.web.util.HTML"
    1017  import="net.sf.basedb.util.Values"
     18  import="java.util.List"
    1119%>
    1220<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
     
    2129  dc = sc.newDbControl();
    2230  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  {}
    2352%>
    2453<base:page type="default" >
     
    3867    <div class="boxedbottom">
    3968      <ul>
    40       <li><a href="persinfo.jsp?ID=<%=ID%>">Personal information registration</a>
     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      %>
    4183      </ul>
    4284   
Note: See TracChangeset for help on using the changeset viewer.