Changeset 5474
- Timestamp:
- Nov 3, 2010, 9:07:50 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/test/roles/index.html
r5319 r5474 613 613 <th>Name</th> 614 614 <th>Biomaterial type</th> 615 <th> Locked wells</th>615 <th>Well lock mode</th> 616 616 </tr> 617 617 <tr> 618 618 <td>Bioplate type A</td> 619 <td> all</td>620 <td> no</td>619 <td>Any</td> 620 <td>Unlocked</td> 621 621 </tr> 622 622 </table> -
trunk/src/clients/web/net/sf/basedb/clients/web/Base.java
r5450 r5474 502 502 503 503 // Record this in the list of recently view items 504 if (itemId != null )504 if (itemId != null && Nameable.class.isAssignableFrom(itemType.getItemClass())) 505 505 { 506 506 String recent = sc.getUserClientSetting("menu.mostRecent.viewed"); -
trunk/src/clients/web/net/sf/basedb/clients/web/resources/common.properties
r5413 r5474 108 108 item.bioplate Bioplate 109 109 item.bioplate+ Bioplates 110 item.biowell Biowell 111 item.biowell+ Biowells 110 112 item.bioplatetype Bioplate type 111 113 item.bioplatetype+ Bioplate types … … 120 122 item.plate Plate 121 123 item.plate+ Plates 124 item.well Well 125 item.well+ Wells 122 126 item.platemapping Plate mapping 123 127 item.platemapping+ Plate mappings 124 128 item.arraydesign Array design 125 129 item.arraydesign+ Array designs 130 item.feature Feature 131 item.feature+ Features 126 132 item.arraybatch Array batch 127 133 item.arraybatch+ Array batches … … 144 150 item.client Client 145 151 item.client+ Clients 152 item.help Help 153 item.help+ Help 146 154 item.news News 147 155 item.news+ News -
trunk/src/clients/web/net/sf/basedb/clients/web/resources/menu.properties
r5413 r5474 47 47 menu.projects.tooltip.1 Switch active project 48 48 menu.projects.tooltip.0 Set active project 49 recentprojects.title Recently used projects 49 50 noactiveproject.title no active project 50 51 noactiveproject.tooltip.1 No project is active -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/PresetSelector.java
r4889 r5474 260 260 sb.append("<option value=\"\">------------------\n"); 261 261 sb.append("<option value=\"option:columns:all\" title=\"Show all columns\">All columns\n"); 262 sb.append("<option value=\"option:columns: \" title=\"Show only required columns\">Required columns\n");262 sb.append("<option value=\"option:columns:-\" title=\"Show only required columns\">Required columns\n"); 263 263 String defaultColumns = (String)cc.getObject("defaultColumns"); 264 264 if (defaultColumns != null) -
trunk/src/clients/web/net/sf/basedb/clients/web/taglib/table/Table.java
r5384 r5474 554 554 allVisible = false; 555 555 visibleColumns = new LinkedHashSet<String>( Arrays.asList(columns.split(",") )); 556 visibleColumns.remove("-"); // "-" represents the required columns 556 557 } 557 558 -
trunk/www/biomaterials/bioplates/wells/list_biowells.jsp
r5459 r5474 34 34 import="net.sf.basedb.core.BioWell" 35 35 import="net.sf.basedb.core.MeasuredBioMaterial" 36 import="net.sf.basedb.core.BioMaterialEvent" 36 37 import="net.sf.basedb.core.ItemQuery" 37 38 import="net.sf.basedb.core.ItemResultIterator" … … 112 113 { 113 114 final ItemQuery<BioWell> query = Base.getConfiguredQuery(dc, cc, true, bioplate.getBioWells(), mode); 114 query.join(Hql.leftJoin(null, "bioMaterial", "mbm", null, false)); 115 query.join(Hql.leftJoin(null, "bioMaterial", "mbm", null, true)); 116 query.join(Hql.leftJoin("mbm", "creationEvent", "evt", null, true)); 115 117 if (!"row".equals(cc.getSortProperty())) query.order(Orders.asc(Hql.property("row"))); 116 118 if (!"column".equals(cc.getSortProperty())) query.order(Orders.asc(Hql.property("column"))); … … 260 262 <tbl:columndef 261 263 id="bioMaterial.name" 262 property=" bioMaterial.name"264 property="$mbm.name" 263 265 datatype="string" 264 266 title="[Biomtrl] Name" … … 269 271 <tbl:columndef 270 272 id="bioMaterial.description" 271 property=" bioMaterial.description"273 property="$mbm.description" 272 274 datatype="string" 273 275 title="[Biomtrl] Description" … … 278 280 <tbl:columndef 279 281 id="bioMaterial.entryDate" 280 property=" bioMaterial.entryDate"282 property="$evt.entryDate" 281 283 datatype="date" 282 284 title="[Biomtrl] Registered" … … 391 393 index++; 392 394 numListed++; 395 MeasuredBioMaterial bioMaterial = null; 396 BioMaterialEvent creationEvent = null; 397 boolean editWellPermission = true; 398 try 399 { 400 bioMaterial = item.getBioMaterial(); 401 if (bioMaterial != null) 402 { 403 creationEvent = bioMaterial.getCreationEvent(); 404 editWellPermission = bioMaterial.hasPermission(Permission.WRITE) && !bioMaterial.isLockedInWell(); 405 } 406 else 407 { 408 editWellPermission = item.canAddBioMaterial(); 409 } 410 } 411 catch (PermissionDeniedException ex) 412 { 413 editWellPermission = false; 414 } 393 415 %> 394 416 <tbl:row> … … 439 461 </tbl:cell> 440 462 <tbl:cell column="column" value="<%=item.getColumn()%>" /> 441 <tbl:cell column="bioMaterial.name"> 442 <% 443 MeasuredBioMaterial bioMaterial = null; 444 boolean editWellPermission = true; 445 try 446 { 447 bioMaterial = item.getBioMaterial(); 448 if (bioMaterial != null) 449 { 450 editWellPermission = bioMaterial.hasPermission(Permission.WRITE) && !bioMaterial.isLockedInWell(); 451 } 452 else 453 { 454 editWellPermission = item.canAddBioMaterial(); 455 } 456 } 457 catch (PermissionDeniedException ex) 458 { 459 editWellPermission = false; 460 } 461 %> 463 <tbl:cell column="bioMaterial.name"> 462 464 <base:propertyvalue 463 465 item="<%=item%>" … … 478 480 /> 479 481 </tbl:cell> 482 <tbl:cell column="bioMaterial.description"><base:propertyvalue item="<%=item%>" property="bioMaterial.description"/></tbl:cell> 483 <tbl:cell column="bioMaterial.entryDate" value="<%=creationEvent == null ? null : creationEvent.getEntryDate() %>" /> 480 484 <tbl:cell column="originalBioMaterial.name"><base:propertyvalue item="<%=item%>" property="originalBioMaterial" /></tbl:cell> 481 485 <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell> -
trunk/www/biomaterials/extracts/edit_extract.jsp
r5459 r5474 398 398 } 399 399 url += '&bioplate_id='+bioplateId; 400 url += '&resetTemporary=1&tmpfilter:STRING: bioMaterial.name='+escape('=');400 url += '&resetTemporary=1&tmpfilter:STRING:$mbm.name='+escape('='); 401 401 url += '&tmpfilter:STRING:originalBioMaterial.name='+escape('='); 402 402 url += '&columns=row,column'; -
trunk/www/biomaterials/labeledextracts/edit_labeledextract.jsp
r5459 r5474 429 429 } 430 430 url += '&bioplate_id='+bioplateId; 431 url += '&resetTemporary=1&tmpfilter:STRING: bioMaterial.name='+escape('=');431 url += '&resetTemporary=1&tmpfilter:STRING:$mbm.name='+escape('='); 432 432 url += '&tmpfilter:STRING:originalBioMaterial.name='+escape('='); 433 433 url += '&columns=row,column'; -
trunk/www/biomaterials/samples/edit_sample.jsp
r5459 r5474 400 400 } 401 401 url += '&bioplate_id='+bioplateId; 402 url += '&resetTemporary=1&tmpfilter:STRING: bioMaterial.name='+escape('=');402 url += '&resetTemporary=1&tmpfilter:STRING:$mbm.name='+escape('='); 403 403 url += '&tmpfilter:STRING:originalBioMaterial.name='+escape('='); 404 404 url += '&columns=row,column'; -
trunk/www/include/menu.jsp
r5452 r5474 51 51 import="net.sf.basedb.core.Include" 52 52 import="net.sf.basedb.core.ItemResultList" 53 import="net.sf.basedb.core.Type" 53 54 import="net.sf.basedb.core.query.Orders" 54 55 import="net.sf.basedb.core.query.Order" 55 56 import="net.sf.basedb.core.query.Hql" 57 import="net.sf.basedb.core.query.Restrictions" 58 import="net.sf.basedb.core.query.Expressions" 56 59 import="net.sf.basedb.clients.web.Base" 57 60 import="net.sf.basedb.clients.web.util.HTML" … … 73 76 import="java.util.Arrays" 74 77 import="java.util.Iterator" 78 import="java.util.Set" 79 import="java.util.HashSet" 75 80 %> 76 81 <%@ taglib prefix="m" uri="/WEB-INF/menu.tld" %> … … 97 102 style="display: none" 98 103 > 104 <% 105 final DbControl dc = sc.newDbControl(); 106 boolean menuSeparatorBeforeDeactivate = true; 107 try 108 { 109 List<Project> projects = new ArrayList<Project>(); 110 int lastRecentActiveIndex = 0; 111 // 1. Load the most recently active projects 112 String tmp = sc.getUserClientSetting("projects.recentActive"); 113 Set<Integer> recentProjects = new HashSet<Integer>(); 114 if (tmp != null) 115 { 116 for (String id : tmp.split(":")) 117 { 118 try 119 { 120 Project p = Project.getById(dc, Values.getInt(id)); 121 if (!p.isRemoved()) 122 { 123 recentProjects.add(p.getId()); 124 projects.add(p); 125 lastRecentActiveIndex++; 126 } 127 } 128 catch (RuntimeException ex) 129 {} 130 } 131 } 132 133 // 2. Load more projects 134 final ItemContext projectCC = sc.getCurrentContext(Item.PROJECT); 135 final ItemQuery<Project> projectQuery = Project.getQuery(); 136 projectQuery.include(Include.MINE, Include.SHARED); 137 projectQuery.restrict(Restrictions.not(Restrictions.in(Hql.property("id"), Expressions.parameter("projects")))); 138 projectQuery.setParameter("projects", recentProjects, Type.INT); 139 Order projectSortOrder = projectCC.getSortOrder(); 140 if (projectSortOrder != null) projectQuery.order(projectSortOrder); 141 projectQuery.order(Orders.asc(Hql.property("name"))); 142 projectQuery.setCacheResult(true); 143 projects.addAll(projectQuery.list(dc)); 144 boolean breakAt15 = projects.size() > 16; 145 int index = 0; 146 String thisIsTheActiveProject = menu.getString("activeproject.tooltip"); 147 String thisIsNotTheActiveProject = menu.getString("inactiveproject.tooltip"); 148 if (lastRecentActiveIndex > 0) 149 { 150 %> 151 <m:menuitem 152 title="<%=menu.getString("recentprojects.title")%>" 153 style="font-weight: bold; color: #000000; background: #e8e8e8;" 154 enabled="false" 155 /> 156 <m:menuseparator /> 157 <% 158 } 159 Set<Integer> shownProjects = new HashSet<Integer>(); 160 for (Project p : projects) 161 { 162 if (index == 15 && breakAt15) break; 163 index++; 164 int projectId = p.getId(); 165 boolean active = activeProjectId == projectId; 166 String prefix = index <= lastRecentActiveIndex ? index + ". " : ""; 167 shownProjects.add(p.getId()); 168 String link = active ? 169 "Menu.openUrl('"+root+"my_base/projects/index.jsp?ID="+ID+"&cmd=ViewItem&item_id=" + projectId + "')" : 170 "Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"&project_id="+p.getId()+"', 'ActivateProject', 300, 140)"; 171 %> 172 <m:menuitem 173 title="<%=prefix + HTML.encodeTags(p.getName())%>" 174 style="<%=active ? "color: #000000; font-weight: bold;" : null %>" 175 onclick="<%=link%>" 176 icon="<%=active ? "checkedmenu.gif" : null%>" 177 tooltip="<%=active ? thisIsTheActiveProject : thisIsNotTheActiveProject%>" 178 /> 179 <% 180 if (index == lastRecentActiveIndex) 181 { 182 %> 183 <m:menuseparator /> 184 <% 185 menuSeparatorBeforeDeactivate = false; 186 } 187 else 188 { 189 menuSeparatorBeforeDeactivate = true; 190 } 191 } 192 if (breakAt15) 193 { 194 int more = projects.size() - 15; 195 %> 196 <m:menuitem 197 title="<%="…" + menu.getString("moreprojects.title", Integer.toString(more))%>" 198 onclick="<%="Menu.openUrl('"+root+"my_base/projects/index.jsp?ID="+ID+"&cmd=UpdateContext&tmpfilter:INT:id=<>"+Values.getString(shownProjects, "|", true)+"')"%>" 199 tooltip="<%=menu.getString("moreprojects.tooltip")%>" 200 /> 201 <% 202 } 203 } 204 catch (Throwable t) 205 { 206 t.printStackTrace(); 207 menuSeparatorBeforeDeactivate = false; 208 %> 209 <m:menuseparator /> 210 <m:menuitem 211 title="<%=menu.getString("projects.error.title")%>" 212 tooltip="<%=menu.getString("projects.error.tooltip", t.getMessage())%>" 213 enabled="false" 214 icon="error.gif" 215 /> 216 <% 217 } 218 finally 219 { 220 if (dc != null) dc.close(); 221 } 222 if (menuSeparatorBeforeDeactivate) 223 { 224 %> 225 <m:menuseparator /> 226 <% 227 } 228 %> 99 229 <m:menuitem 100 230 title="<%="<i>- " + menu.getString("noactiveproject.title") + " -</i>"%>" … … 104 234 tooltip="<%=menu.getString("noactiveproject.tooltip", activeProjectId == 0)%>" 105 235 /> 106 <%107 final DbControl dc = sc.newDbControl();108 try109 {110 final ItemContext projectCC = sc.getCurrentContext(Item.PROJECT);111 final ItemQuery<Project> projectQuery = Project.getQuery();112 projectQuery.include(Include.MINE, Include.SHARED);113 Order projectSortOrder = projectCC.getSortOrder();114 if (projectSortOrder != null) projectQuery.order(projectSortOrder);115 projectQuery.order(Orders.asc(Hql.property("name")));116 projectQuery.setCacheResult(true);117 ItemResultList<Project> projects = projectQuery.list(dc);118 boolean breakAt20 = projects.size() > 25;119 int index = 0;120 String thisIsTheActiveProject = menu.getString("activeproject.tooltip");121 String thisIsNotTheActiveProject = menu.getString("inactiveproject.tooltip");122 for (Project p : projects)123 {124 if (index == 20 && breakAt20) break;125 index++;126 int projectId = p.getId();127 boolean active = activeProjectId == projectId;128 %>129 <m:menuitem130 title="<%=HTML.encodeTags(p.getName())%>"131 style="<%=active ? "color: #000000; font-weight: bold;" : null %>"132 onclick="<%="Main.openPopup('"+root+"my_base/projects/set_active.jsp?ID="+ID+"&project_id="+p.getId()+"', 'ActivateProject', 300, 140)"%>"133 icon="<%=active ? "checkedmenu.gif" : null%>"134 enabled="<%=!active%>"135 tooltip="<%=active ? thisIsTheActiveProject : thisIsNotTheActiveProject%>"136 />137 <%138 }139 if (breakAt20)140 {141 int more = projects.size() - 20;142 %>143 <m:menuseparator />144 <m:menuitem145 title="<%=menu.getString("moreprojects.title", Integer.toString(more))%>"146 onclick="<%="Menu.openUrl('"+root+"my_base/projects/index.jsp?ID="+ID+"')"%>"147 tooltip="<%=menu.getString("moreprojects.tooltip")%>"148 />149 <%150 }151 }152 catch (Throwable t)153 {154 t.printStackTrace();155 %>156 <m:menuseparator />157 <m:menuitem158 title="<%=menu.getString("projects.error.title")%>"159 tooltip="<%=menu.getString("projects.error.tooltip", t.getMessage())%>"160 enabled="false"161 icon="error.gif"162 />163 <%164 }165 finally166 {167 if (dc != null) dc.close();168 }169 %>170 236 </m:menu> 171 237 <% -
trunk/www/my_base/index.jsp
r5426 r5474 55 55 import="net.sf.basedb.clients.web.formatter.FormatterFactory" 56 56 import="net.sf.basedb.util.Values" 57 import="java.util.Date" 57 import="java.util.Date" 58 import="java.util.List" 59 import="java.util.ArrayList" 60 import="java.util.Set" 61 import="java.util.HashSet" 58 62 %> 59 63 <%@ taglib … … 108 112 ItemResultList<Message> messages = messageQuery.list(dc); 109 113 114 List<Project> projects = new ArrayList<Project>(); 115 String tmp = sc.getUserClientSetting("projects.recentActive"); 116 Set<Integer> recentProjects = new HashSet<Integer>(); 117 if (tmp != null) 118 { 119 for (String id : tmp.split(":")) 120 { 121 try 122 { 123 Project p = Project.getById(dc, Values.getInt(id)); 124 if (!p.isRemoved()) 125 { 126 recentProjects.add(p.getId()); 127 projects.add(p); 128 } 129 } 130 catch (RuntimeException ex) 131 {} 132 } 133 } 110 134 ItemQuery<Project> projectQuery = Project.getQuery(); 111 135 projectQuery.order(Orders.asc(Hql.property("name"))); 112 136 projectQuery.include(Include.MINE, Include.SHARED); 113 ItemResultList<Project> projects = projectQuery.list(dc); 137 projectQuery.restrict(Restrictions.not(Restrictions.in(Hql.property("id"), Expressions.parameter("projects")))); 138 projectQuery.setParameter("projects", recentProjects, Type.INT); 139 projects.addAll(projectQuery.list(dc)); 114 140 115 141 QuotaType totalQuotaType = QuotaType.getById(dc, SystemItems.getId(QuotaType.TOTAL)); -
trunk/www/my_base/projects/set_active.jsp
r5426 r5474 32 32 import="net.sf.basedb.core.Include" 33 33 import="net.sf.basedb.core.ItemContext" 34 import="net.sf.basedb.core.StringUtil" 34 35 import="net.sf.basedb.clients.web.Base" 35 36 import="net.sf.basedb.util.Values" 36 37 import="net.sf.basedb.clients.web.util.HTML" 38 import="java.util.List" 39 import="java.util.ArrayList" 40 import="java.util.Arrays" 37 41 %> 38 42 <%@ taglib … … 60 64 sc.setActiveProject(p); 61 65 sc.setUserClientSetting("projects.lastactive", projectId == 0 ? null : Integer.toString(projectId)); 66 if (projectId != 0) 67 { 68 String recent = sc.getUserClientSetting("projects.recentActive"); 69 List<String> recentActive = null; 70 if (recent == null) 71 { 72 recentActive = new ArrayList<String>(); 73 } 74 else 75 { 76 // Need a new list since Arrays.asList returns a read-only list 77 recentActive = new ArrayList<String>(Arrays.asList(recent.split(":"))); 78 } 79 String thisProject = Integer.toString(projectId); 80 recentActive.remove(thisProject); 81 recentActive.add(0, thisProject); 82 int maxRecent = Values.getInt(sc.getUserClientSetting("menu.mostRecent.maxViewed"), 6); 83 if (recentActive.size() > maxRecent) recentActive = recentActive.subList(0, maxRecent); 84 sc.setUserClientSetting("projects.recentActive", StringUtil.join(recentActive, ":", true)); 85 } 62 86 sc.setSessionSetting("menu.standard.html", null); 63 87 if (p == null)
Note: See TracChangeset
for help on using the changeset viewer.