Changeset 6993
- Timestamp:
- Nov 3, 2015, 9:03:01 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/core/Install.java
r6992 r6993 474 474 475 475 // Kit subtypes 476 createItemSubtype(Item.KIT, Kit.SAMPLING, "Sampling", "Kits used for creating samples."); 476 477 createItemSubtype(Item.KIT, Kit.EXTRACTION, "Extraction", "Kits used for creating extracts."); 477 478 ItemSubtypeData labelingKit = createItemSubtype(Item.KIT, Kit.LABELING, -
trunk/src/core/net/sf/basedb/core/Kit.java
r6992 r6993 47 47 48 48 /** 49 The ID for the sampling kit type, for example a kit 50 used when creating a {@link Sample} from a {@link 51 Biosource}. 52 */ 53 public static final String SAMPLING = "net.sf.basedb.core.KitType.SAMPLING"; 54 55 /** 49 56 The ID for the extraction kit type, for example a kit 50 57 used when creating an {@link Extract} from a {@link -
trunk/src/core/net/sf/basedb/core/Sample.java
r6881 r6993 144 144 @Override 145 145 @SupportsPushAnnotations 146 @SubtypableRelatedItems({Item.PROTOCOL, Item. HARDWARE, Item.BIOSOURCE, Item.SAMPLE})146 @SubtypableRelatedItems({Item.PROTOCOL, Item.KIT, Item.HARDWARE, Item.BIOSOURCE, Item.SAMPLE}) 147 147 public ItemSubtype getItemSubtype() 148 148 { -
trunk/www/biomaterials/events/edit_event.jsp
r6306 r6993 32 32 import="net.sf.basedb.core.BioMaterialEvent" 33 33 import="net.sf.basedb.core.MeasuredBioMaterial" 34 import="net.sf.basedb.core.Kit" 34 35 import="net.sf.basedb.core.Protocol" 35 36 import="net.sf.basedb.core.BaseException" … … 71 72 boolean readCurrentProtocol = true; 72 73 Protocol currentProtocol = null; 73 74 boolean readCurrentKit = true; 75 Kit currentKit = null; 76 74 77 // Load recently used items 75 78 List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL); 79 List<Kit> recentKits = (List<Kit>)cc.getRecent(dc, Item.KIT); 76 80 77 81 if (itemId == 0) … … 80 84 cc.removeObject("item"); 81 85 eventDate = (Date)cc.getPropertyObject("eventDate"); 86 if (cc.getPropertyFilter("protocol.name") != null) 87 { 88 currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("protocol.name")); 89 } 90 if (cc.getPropertyFilter("kit.name") != null) 91 { 92 currentKit = Base.getFirstMatching(dc, Kit.getQuery(), "name", cc.getPropertyFilter("kit.name")); 93 } 82 94 } 83 95 else … … 96 108 { 97 109 readCurrentProtocol = false; 110 } 111 try 112 { 113 currentKit = event.getKit(); 114 } 115 catch (PermissionDeniedException ex) 116 { 117 readCurrentKit = false; 98 118 } 99 119 } … … 167 187 <td></td> 168 188 </tr> 189 <tr> 190 <th>Kit</th> 191 <td> 192 <base:select 193 id="kit_id" 194 clazz="selectionlist" 195 required="false" 196 current="<%=currentKit%>" 197 denied="<%=!readCurrentKit%>" 198 recent="<%=recentKits%>" 199 newitem="<%=event == null%>" 200 /> 201 </td> 202 <td></td> 203 </tr> 169 204 <tr class="dynamic"> 170 205 <th>Comment</th> -
trunk/www/biomaterials/events/events.js
r6400 r6993 45 45 Buttons.addClickHandler('protocol_id.select', biomaterialevents.selectProtocol); 46 46 Events.addEventHandler('protocol_id', 'base-selected', biomaterialevents.setProtocolCallback); 47 // Kit 48 Buttons.addClickHandler('kit_id.select', biomaterialevents.selectKit); 49 Events.addEventHandler('kit_id', 'base-selected', biomaterialevents.setKitCallback); 47 50 48 51 // Used quantity … … 135 138 } 136 139 140 biomaterialevents.selectKit = function() 141 { 142 var frm = document.forms['event']; 143 var url = '&resetTemporary=1'; 144 url += '&tmpfilter:BOOLEAN:inactive=0'; 145 if (frm.kit_id.length > 1) 146 { 147 var id = Math.abs(parseInt(frm.kit_id[1].value)); 148 url += '&item_id='+id; 149 } 150 Dialogs.selectItem('KIT', 'kit_id', 0, url); 151 } 137 152 153 biomaterialevents.setKitCallback = function(event) 154 { 155 var id = event.detail.id; 156 var name = event.detail.name; 157 var frm = document.forms['event']; 158 var list = frm.kit_id; 159 if (list.length < 2 || list[1].value == '0') 160 { 161 Forms.addListOption(list, 1, new Option()); 162 } 163 list[1].value = id; 164 list[1].text = name; 165 list.selectedIndex = 1; 166 } 167 138 168 return biomaterialevents; 139 169 }(); -
trunk/www/biomaterials/events/index.jsp
r6192 r6993 31 31 import="net.sf.basedb.core.BioMaterialEvent" 32 32 import="net.sf.basedb.core.MeasuredBioMaterial" 33 import="net.sf.basedb.core.Kit" 33 34 import="net.sf.basedb.core.Protocol" 34 35 import="net.sf.basedb.core.ItemQuery" … … 159 160 if (pt != null) cc.setRecent(pt, maxRecent); 160 161 } 162 int kitId = Values.getInt(request.getParameter("kit_id"), -1); 163 if (kitId >= 0) // < 0 = denied or unchanged 164 { 165 Kit kit = kitId == 0 ? null : Kit.getById(dc, kitId); 166 event.setKit(kit); 167 if (kit != null) cc.setRecent(kit, maxRecent); 168 } 161 169 162 170 // OnSave extensions -
trunk/www/biomaterials/events/list_events.jsp
r6834 r6993 248 248 datatype="string" 249 249 title="Protocol" 250 sortable="true" 251 filterable="true" 252 exportable="true" 253 /> 254 <tbl:columndef 255 id="kit" 256 property="kit.name" 257 datatype="string" 258 title="Kit" 250 259 sortable="true" 251 260 filterable="true" … … 589 598 enablePropertyLink="<%=mode.hasPropertyLink()%>" 590 599 /></tbl:cell> 600 <tbl:cell column="kit" 601 ><base:propertyvalue 602 item="<%=item%>" 603 property="kit" 604 enableEditLink="<%=mode.hasEditLink()%>" 605 enablePropertyLink="<%=mode.hasPropertyLink()%>" 606 /></tbl:cell> 591 607 <tbl:cell column="user" 592 608 ><base:propertyvalue -
trunk/www/biomaterials/events/view_event.jsp
r6605 r6993 314 314 </tr> 315 315 <tr> 316 <th>Kit</th> 317 <td><base:propertyvalue item="<%=event%>" property="kit"/></td> 318 </tr> 319 <tr> 316 320 <th>User</th> 317 321 <td><base:propertyvalue item="<%=event%>" property="user"/></td> -
trunk/www/biomaterials/extracts/extracts.js
r6992 r6993 318 318 var frm = document.forms['extract']; 319 319 var url = '&resetTemporary=1'; 320 url += '&tmpfilter:BOOLEAN:inactive=0'; 320 321 url += ItemSubtype.createRelatedFilter('subtype_id', 'PROTOCOL', Data.int('page-data', 'extraction-protocoltype-id')); 321 322 if (frm.protocol_id.length > 1) -
trunk/www/biomaterials/samples/edit_sample.jsp
r6947 r6993 39 39 import="net.sf.basedb.core.BioPlate" 40 40 import="net.sf.basedb.core.BioWell" 41 import="net.sf.basedb.core.Kit" 41 42 import="net.sf.basedb.core.Protocol" 42 43 import="net.sf.basedb.core.Project" … … 99 100 boolean readCurrentProtocol = true; 100 101 Protocol currentProtocol = null; 102 boolean readCurrentKit = true; 103 Kit currentKit = null; 101 104 boolean readCurrentBioSource = true; 102 105 BioSource currentBioSource = null; … … 119 122 currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("creationEvent.protocol.name")); 120 123 } 124 if (cc.getPropertyFilter("creationEvent.kit.name") != null) 125 { 126 currentKit = Base.getFirstMatching(dc, Kit.getQuery(), "name", cc.getPropertyFilter("creationEvent.kit.name")); 127 } 121 128 int bioSourceId = Values.getInt(request.getParameter("biosource_id")); 122 129 int sampleId = Values.getInt(request.getParameter("sample_id")); … … 203 210 { 204 211 readCurrentProtocol = false; 212 } 213 214 try 215 { 216 currentKit = creationEvent.getKit(); 217 } 218 catch (PermissionDeniedException ex) 219 { 220 readCurrentKit = false; 205 221 } 206 222 … … 252 268 // Load recently used items 253 269 List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL, currentSubtype); 270 List<Kit> recentKits = (List<Kit>)cc.getRecent(dc, Item.KIT, currentSubtype); 254 271 List<BioSource> recentBioSources = (List<BioSource>)cc.getRecent(dc, Item.BIOSOURCE); 255 272 List<BioPlate> recentBioPlates = (List<BioPlate>)cc.getRecent(dc, Item.BIOPLATE, currentSubtype); … … 303 320 <div id="page-data" class="datacontainer" 304 321 data-sampling-protocoltype-id="<%=SystemItems.getId(Protocol.SAMPLING)%>" 322 data-sampling-kittype-id="<%=SystemItems.getId(Kit.SAMPLING)%>" 305 323 data-sample-type="<%=Item.SAMPLE.getValue()%>" 306 324 <% … … 415 433 recent="<%=recentProtocols%>" 416 434 defaultitems="<%=defaultProtocols%>" 435 newitem="<%=sample == null%>" 436 disabled="<%=lockEventProperties %>" 437 /> 438 </td> 439 <td></td> 440 </tr> 441 <tr> 442 <th>Kit</th> 443 <td> 444 <base:select 445 id="kit_id" 446 clazz="selectionlist" 447 required="false" 448 current="<%=currentKit%>" 449 denied="<%=!readCurrentKit%>" 450 recent="<%=recentKits%>" 417 451 newitem="<%=sample == null%>" 418 452 disabled="<%=lockEventProperties %>" -
trunk/www/biomaterials/samples/index.jsp
r6756 r6993 36 36 import="net.sf.basedb.core.ItemSubtype" 37 37 import="net.sf.basedb.core.Extract" 38 import="net.sf.basedb.core.Kit" 38 39 import="net.sf.basedb.core.Protocol" 39 40 import="net.sf.basedb.core.ItemQuery" … … 248 249 if (pt != null) cc.setRecent(pt, subtype, maxRecent); 249 250 } 251 int kitId = Values.getInt(request.getParameter("kit_id"), -1); 252 if (kitId >= 0) // < 0 = denied or unchanged 253 { 254 Kit kit = kitId == 0 ? null : Kit.getById(dc, kitId); 255 creationEvent.setKit(kit); 256 if (kit != null) cc.setRecent(kit, subtype, maxRecent); 257 } 250 258 } 251 259 -
trunk/www/biomaterials/samples/list_samples.jsp
r6834 r6993 290 290 /> 291 291 <tbl:columndef 292 id="kit" 293 property="creationEvent.kit" 294 sortproperty="creationEvent.kit.name" 295 filterproperty="creationEvent.kit.name" 296 exportproperty="creationEvent.kit.name" 297 datatype="string" 298 title="Kit" 299 sortable="true" 300 filterable="true" 301 exportable="true" 302 /> 303 <tbl:columndef 292 304 id="eventDate" 293 305 property="creationEvent.eventDate" … … 718 730 item="<%=creationEvent%>" 719 731 property="protocol" 732 enableEditLink="<%=mode.hasEditLink()%>" 733 enablePropertyLink="<%=mode.hasPropertyLink()%>" 734 /></tbl:cell> 735 <tbl:cell column="kit" 736 ><base:propertyvalue 737 item="<%=creationEvent%>" 738 property="kit" 720 739 enableEditLink="<%=mode.hasEditLink()%>" 721 740 enablePropertyLink="<%=mode.hasPropertyLink()%>" -
trunk/www/biomaterials/samples/samples.js
r6947 r6993 49 49 Buttons.addClickHandler('protocol_id.select', samples.selectProtocol); 50 50 Events.addEventHandler('protocol_id', 'base-selected', samples.setProtocolCallback); 51 // Protocol 52 Buttons.addClickHandler('kit_id.select', samples.selectKit); 53 Events.addEventHandler('kit_id', 'base-selected', samples.setKitCallback); 51 54 // Subtype 52 55 Events.addEventHandler('subtype_id', 'change', samples.subtypeOnChange); … … 340 343 list.selectedIndex = 1; 341 344 } 345 346 samples.selectKit = function() 347 { 348 var frm = document.forms['sample']; 349 var url = '&resetTemporary=1'; 350 url += '&tmpfilter:BOOLEAN:inactive=0'; 351 url += ItemSubtype.createRelatedFilter('subtype_id', 'KIT', Data.int('page-data', 'sampling-kittype-id')); 352 if (frm.kit_id.length > 1) 353 { 354 var id = Math.abs(parseInt(frm.kit_id[1].value)); 355 url += '&item_id='+id; 356 } 357 Dialogs.selectItem('KIT', 'kit_id', 0, url); 358 } 359 360 samples.setKitCallback = function(event) 361 { 362 var frm = document.forms['sample']; 363 var list = frm.kit_id; 364 if (list.length < 2 || list[1].value == '0') 365 { 366 Forms.addListOption(list, 1, new Option()); 367 } 368 list[1].value = event.detail.id; 369 list[1].text = event.detail.name; 370 list.selectedIndex = 1; 371 } 342 372 343 373 samples.subtypeOnChange = function() -
trunk/www/biomaterials/samples/view_sample.jsp
r6605 r6993 271 271 <tr> 272 272 <th>Protocol</th> 273 <td><base:propertyvalue item="<%=creationEvent%>" 274 property="protocol" /></td> 273 <td><base:propertyvalue item="<%=creationEvent%>" property="protocol" /></td> 274 </tr> 275 <tr> 276 <th>Kit</th> 277 <td><base:propertyvalue item="<%=creationEvent%>" property="kit" /></td> 275 278 </tr> 276 279 <tr>
Note: See TracChangeset
for help on using the changeset viewer.