Changeset 5192


Ignore:
Timestamp:
Nov 23, 2009, 9:27:03 AM (12 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1439: Switch active project list in the top menu too long

Location:
branches/2.14-stable
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.14-stable/doc/src/docbook/userdoc/project_permission.xml

    r5017 r5192  
    408408                automatically be inactivated.
    409409              </para>
     410              <para>
     411                The drop-down menu can display a maximum of 25 projects. If you are a
     412                member of more projects, the last menu entry will take you to the
     413                complete list of projects.
     414              </para>
     415              <tip>
     416                <para>
     417                The sort order in the menu is the same as the sort order on the
     418                projects list page. If you, for example, want to sort the newest
     419                project first, select to sort by the <guilabel>Registered</guilabel>
     420                column in descending order on the list page. The menu will automatically
     421                use the same order.
     422                </para>
     423              </tip>
    410424            </listitem>
    411425         
  • branches/2.14-stable/doc/src/docbook/userdoc/webclient.xml

    r5017 r5192  
    264264            <para>
    265265            A list of all projects you are a member of. Selecting a project in the
    266             list will make that project the active project.
    267             </para>
     266            list will make that project the active project. The list can display
     267            a maximum of 25 projects. If you are a member of more projects, the last
     268            menu entry will take you to the complete list of projects.
     269            </para>
     270            <tip>
     271              <para>
     272              The sort order in the menu is the same as the sort order on the
     273              projects list page. If you, for example, want to sort the newest
     274              project first, select to sort by the <guilabel>Registered</guilabel>
     275              column in descending order on the list page. The menu will automatically
     276              use the same order.
     277              </para>
     278            </tip>
    268279          </listitem>
    269280        </varlistentry>
  • branches/2.14-stable/src/clients/web/net/sf/basedb/clients/web/taglib/Body.java

    r5116 r5192  
    296296        BodyContent menuBody = pageContext.pushBody();
    297297        pageContext.include("/include/menu.jsp?name=recentItems");
     298        pageContext.include("/include/menu.jsp?name=projects");
    298299        pageContext.popBody();
    299300        sb.append(menuBody.getString());
  • branches/2.14-stable/www/include/menu.jsp

    r5017 r5192  
    5252  import="net.sf.basedb.core.ItemResultList"
    5353  import="net.sf.basedb.core.query.Orders"
     54  import="net.sf.basedb.core.query.Order"
    5455  import="net.sf.basedb.core.query.Hql"
    5556  import="net.sf.basedb.clients.web.Base"
     
    8081if ("login".equals(name))
    8182{
     83}
     84else if ("projects".equals(name) && sc != null && sc.isLoggedIn())
     85{
     86  // Projects menu
     87  final ItemContext projectCC = sc.getCurrentContext(Item.PROJECT);
     88  int activeProjectId = sc.getActiveProjectId();
     89  final ItemQuery<Project> projectQuery = Project.getQuery();
     90  projectQuery.include(Include.MINE, Include.SHARED);
     91  Order projectSortOrder = projectCC.getSortOrder();
     92  if (projectSortOrder != null) projectQuery.order(projectSortOrder);
     93  projectQuery.order(Orders.asc(Hql.property("name")));
     94  projectQuery.setCacheResult(true);
     95  final DbControl dc = sc.newDbControl();
     96  try
     97  {
     98    %>
     99    <m:menu 
     100      id="projects"
     101      style="display: none"
     102      >
     103      <m:menuitem
     104        title="<i>- no active project -</i>"
     105        onclick="<%="Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"', 'ActivateProject', 300, 140)"%>"
     106        icon="<%=activeProjectId == 0 ? "checkedmenu.gif" : null%>"
     107        enabled="<%=activeProjectId != 0%>"
     108        tooltip="<%=activeProjectId == 0 ? "No project is active" : "Disable the currently active project"%>"
     109      />
     110      <%
     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    </m:menu>
     145    <%
     146  }
     147  finally
     148  {
     149    if (dc != null) dc.close();
     150  }
    82151}
    83152else if ("recentItems".equals(name) && sc != null && sc.isLoggedIn())
     
    255324else if ("standard".equals(name))
    256325{
    257   final DbControl dc = sc.newDbControl();
    258   ItemResultList<Project> projects = null;
     326  final DbControl dc = sc.newDbControl();
    259327  StringBuilder fillText = new StringBuilder();
    260328  try
     
    542610    }
    543611   
    544     // Projects menu
    545     int activeProjectId = sc.getActiveProjectId();
    546     final ItemQuery<Project> projectQuery = Project.getQuery();
    547     projectQuery.include(Include.MINE, Include.SHARED);
    548     projectQuery.order(Orders.asc(Hql.property("name")));
    549     projectQuery.setCacheResult(true);
    550     %>
    551     <m:menu 
    552       id="projects"
    553       style="display: none"
    554       >
    555       <m:menuitem
    556         title="<i>- no active project -</i>"
    557         onclick="<%="Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"', 'ActivateProject', 300, 140)"%>"
    558         icon="<%=activeProjectId == 0 ? "checkedmenu.gif" : null%>"
    559         enabled="<%=activeProjectId != 0%>"
    560         tooltip="<%=activeProjectId == 0 ? "No project is active" : "Disable the currently active project"%>"
    561       />
    562       <%
    563       projects = projectQuery.list(dc);
    564       for (Project p : projects)
    565       {
    566         int projectId = p.getId();
    567         boolean active = activeProjectId == projectId;
    568         %>
    569         <m:menuitem
    570           title="<%=HTML.encodeTags(p.getName())%>"
    571           style="<%=active ? "color: #000000; font-weight: bold;" : null %>"
    572           onclick="<%="Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"&project_id="+p.getId()+"', 'ActivateProject', 300, 140)"%>"
    573           icon="<%=active ? "checkedmenu.gif" : null%>"
    574           enabled="<%=!active%>"
    575           tooltip="<%=active ? "This is the active project" : "Set this project to the active project"%>"
    576         />
    577         <%
    578       }
    579       %>
    580     </m:menu>
    581    
    582     <%
    583612    // Array LIMS - menu
    584613    final boolean hasPlateGeometries = sc.hasPermission(Permission.READ, Item.PLATEGEOMETRY);
Note: See TracChangeset for help on using the changeset viewer.