Changeset 6568
- Timestamp:
- Oct 21, 2014, 1:07:45 PM (9 years ago)
- Location:
- trunk/www/common/annotations
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/common/annotations/list.js
r6255 r6568 33 33 Events.addEventHandler(element, 'click', list.editAnnotation); 34 34 } 35 36 list.initListPage = function() 37 { 38 if (Doc.element('annotations')) 39 { 40 var allWithValues = Data.int('annotations-stat', 'all-with-values'); 41 var allOfCategory = Data.int('annotations-stat', 'all-of-category'); 42 Events.addEventHandler('view_all', 'click', list.setViewFilter); 43 Events.addEventHandler('view_values', 'click', list.setViewFilter); 44 Events.addEventHandler('view_category', 'click', list.setViewFilter); 45 Doc.element('allWithValues').innerHTML = allWithValues; 46 if (Doc.element('allOfCategory')) 47 { 48 Doc.element('allOfCategory').innerHTML = allOfCategory; 49 } 50 if (allWithValues == 0 && allOfCategory == 0) 51 { 52 Doc.element('view_all').checked = true; 53 } 54 list.setViewFilter(); 55 } 56 } 57 35 58 if (Doc.getPageId() == 'list-annotations') 36 59 { 37 60 Doc.addElementInitializer(list.initEditLink); 61 Doc.onLoad(list.initListPage); 38 62 } 39 63 … … 66 90 } 67 91 92 list.setViewFilter = function() 93 { 94 var frm = document.forms['annotations']; 95 var filter = Forms.getCheckedRadio(frm.view).value; 96 Doc.element('annotations-data').className = 'data ' + filter; 97 } 98 68 99 return list; 69 100 }(); -
trunk/www/common/annotations/list_annotations.jsp
r6384 r6568 38 38 import="net.sf.basedb.core.Subtypable" 39 39 import="net.sf.basedb.core.ItemSubtype" 40 import="net.sf.basedb.core.BioPlate" 41 import="net.sf.basedb.core.BioPlateType" 40 42 import="net.sf.basedb.core.ItemQuery" 41 43 import="net.sf.basedb.core.ItemResultList" … … 43 45 import="net.sf.basedb.core.query.Orders" 44 46 import="net.sf.basedb.core.query.Hql" 47 import="net.sf.basedb.core.query.Restrictions" 48 import="net.sf.basedb.core.query.Expressions" 45 49 import="net.sf.basedb.core.snapshot.AnnotationSetSnapshot" 46 50 import="net.sf.basedb.core.snapshot.AnnotationSnapshot" … … 140 144 annotationTypes.removeAll(protocolParameters); 141 145 } 146 // Load the current subtype 147 // NOTE! User may have selected a different subtype in the form than what is 148 // currently saved so if a subtype_id is sent in the request we use that 149 String selectedCategoryName = null; 150 try 151 { 152 ItemSubtype subtype = null; 153 if (item instanceof Subtypable) 154 { 155 subtype = ((Subtypable)item).getItemSubtype(); 156 } 157 else if (item instanceof BioPlate) 158 { 159 BioPlateType bpt = ((BioPlate)item).getBioPlateType(); 160 subtype = bpt.getItemSubtype(); 161 if (subtype == null) selectedCategoryName = bpt.getName(); 162 } 163 if (subtype != null) selectedCategoryName = subtype.getName(); 164 } 165 catch (PermissionDeniedException ex) 166 {} 167 Set<AnnotationType> annotationTypesInCategory = new HashSet<AnnotationType>(); 168 if (selectedCategoryName != null) 169 { 170 ItemQuery<AnnotationType> query = AnnotationType.getQuery(item.getType()); 171 query.join(Hql.innerJoin("categories", "ct")); 172 query.restrict(Restrictions.eq(Hql.property("ct", "name"), Expressions.string(selectedCategoryName))); 173 annotationTypesInCategory.addAll(query.list(dc)); 174 } 142 175 %> 143 176 <base:page type="iframe" id="list-annotations"> 144 <base:head scripts="~list.js" styles="table.css" /> 177 <base:head scripts="~list.js" styles="table.css"> 178 <style> 179 #annotations-data.all 180 {} 181 182 #annotations-data.values .novalues 183 { 184 display: none; 185 } 186 187 #annotations-data.category .nocategory 188 { 189 display: none; 190 } 191 </style> 192 </base:head> 145 193 <base:body> 146 194 <% … … 157 205 > 158 206 <% 207 int allWithValues = 0; 208 int allOfCategory = 0; 159 209 if (annotationTypes.size() == 0) 160 210 { … … 185 235 title="Description" 186 236 /> 187 <tbl:data> 237 <div class="panelgroup topborder leftborder rightborder"> 238 <tbl:panel style="height: auto; padding: 2px;"> 239 <b>View:</b> 240 <% 241 if (selectedCategoryName != null) 242 { 243 %> 244 <label><input type="radio" name="view" id="view_category" value="category" checked>All of <i><%=HTML.encodeTags(selectedCategoryName)%></i> category</label> (<span id="allOfCategory">?</span>) 245 <% 246 } 247 %> 248 <label><input type="radio" name="view" id="view_values" value="values" <%=selectedCategoryName == null ? "checked" : ""%>>All with values</label> (<span id="allWithValues">?</span>) 249 <label><input type="radio" name="view" id="view_all" value="all">All annotations</label> (<%=annotationTypes.size()%>) 250 </tbl:panel> 251 </div> 252 <tbl:data id="annotations-data"> 188 253 <tbl:headers> 189 254 <tbl:headerrow> … … 206 271 if (values != null || !at.isRemoved()) 207 272 { 208 %> 209 <tbl:row> 273 String rowClass = ""; 274 if (values == null || values.size() == 0) 275 { 276 rowClass += " novalues"; 277 } 278 else 279 { 280 allWithValues++; 281 } 282 if (!annotationTypesInCategory.contains(at)) 283 { 284 rowClass += " nocategory"; 285 } 286 else 287 { 288 allOfCategory++; 289 } 290 %> 291 <tbl:row subclass="<%=rowClass%>"> 210 292 <tbl:cell column="annotation"><base:icon 211 293 image="deleted.png" … … 237 319 } 238 320 %> 321 <div id="annotations-stat" class="datacontainer" 322 data-all-with-values="<%=allWithValues %>" 323 data-all-of-category="<%=allOfCategory%>" 324 ></div> 325 239 326 </base:section> 240 327
Note: See TracChangeset
for help on using the changeset viewer.