Changeset 2486
- Timestamp:
- Aug 3, 2006, 5:20:10 PM (17 years ago)
- Location:
- trunk/www/lims/plates/events
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/lims/plates/events/edit_event.jsp
r2456 r2486 33 33 import="net.sf.basedb.core.SystemItems" 34 34 import="net.sf.basedb.core.Permission" 35 import="net.sf.basedb.core.Hardware" 36 import="net.sf.basedb.core.HardwareType" 35 37 import="net.sf.basedb.core.Include" 36 38 import="net.sf.basedb.core.Plate" … … 79 81 ProtocolType currentProtocolType = null; 80 82 boolean readCurrentProtocolType = true; 83 Hardware currentHardware = null; 84 boolean readCurrentHardware = true; 81 85 82 86 ItemResultList<PlateEventType> eventTypes = null; … … 97 101 throw new WebException("popup", "No more event types can be created", 98 102 "One event of each event type has already been created for this plate."); 99 } 100 103 } 101 104 102 105 if (cc.getPropertyFilter("protocolType.name") != null) … … 126 129 { 127 130 readCurrentProtocolType = false; 131 } 132 try 133 { 134 currentHardware = event.getHardware(); 135 } 136 catch(PermissionDeniedException ex) 137 { 138 readCurrentHardware = false; 128 139 } 129 140 } … … 157 168 } 158 169 159 var protocolTypeFilter = <%=currentProtocolType != null ? currentProtocolType.getId() : 0%>; 170 var protocolTypeFilter = <%=currentProtocolType != null ? currentProtocolType.getId() : 0%>; 160 171 function selectProtocolOnClick() 161 172 { … … 183 194 frm.protocol_id[1].text = name; 184 195 frm.protocol_id.selectedIndex = 1; 196 } 197 function selectHardwareOnClick() 198 { 199 var frm = document.forms['event']; 200 var url = '../../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setHardwareCallback'; 201 if (frm.hardware_id.length > 1) 202 { 203 var id = Math.abs(parseInt(frm.hardware_id[1].value)); 204 url += '&item_id='+id; 205 } 206 Main.openPopup(url, 'SelectHardware', 1000, 700); 207 } 208 function setHardwareCallback(hardwareId, name) 209 { 210 var frm = document.forms['event']; 211 if (frm.hardware_id.length < 2) 212 { 213 frm.hardware_id[frm.hardware_id.length] = new Option(); 214 } 215 frm.hardware_id[1].value = hardwareId; 216 frm.hardware_id[1].text = name; 217 frm.hardware_id.selectedIndex = 1; 185 218 } 186 219 … … 329 362 </td> 330 363 </tr> 364 <tr> 365 <td class="prompt">Hardware</td> 366 <td> 367 <table border="0" cellspacing="0" cellpadding="0"> 368 <tr> 369 <td> 370 <select name="hardware_id" size="1" 371 <%=!readCurrentHardware ? "disabled readonly class=\"disabled\"" : ""%> 372 style="width: 20em;"> 373 <% 374 if (!readCurrentHardware) 375 { 376 %> 377 <option value="-1">- denied - 378 <% 379 } 380 else 381 { 382 %> 383 <option value="0">- none - 384 <% 385 if (currentHardware != null) 386 { 387 %> 388 <option value="<%=event == null ? currentHardware.getId() : -currentHardware.getId()%>" 389 selected><%=HTML.encodeTags(currentHardware.getName())%> 390 <% 391 } 392 } 393 %> 394 </select> 395 396 </td> 397 <td><base:button onclick="selectHardwareOnClick()" 398 title="Select…" disabled="<%=!readCurrentHardware%>"/></td> 399 </tr> 400 </table> 401 </td> 402 </tr> 331 403 <tr valign=top> 332 404 <td class="prompt">Comment</td> -
trunk/www/lims/plates/events/index.jsp
r2446 r2486 28 28 import="net.sf.basedb.core.SessionControl" 29 29 import="net.sf.basedb.core.DbControl" 30 import="net.sf.basedb.core.Hardware" 30 31 import="net.sf.basedb.core.Item" 31 32 import="net.sf.basedb.core.ItemContext" … … 146 147 event.setProtocol(pt); 147 148 } 149 int hardwareId = Values.getInt(request.getParameter("hardware_id"), -1); 150 if (hardwareId >= 0) // < 0 = denied or unchanged 151 { 152 Hardware hw = hardwareId == 0 ? null : Hardware.getById(dc, hardwareId); 153 event.setHardware(hw); 154 } 148 155 dc.commit(); 149 156 cc.removeObject("item"); -
trunk/www/lims/plates/events/list_events.jsp
r2446 r2486 260 260 title="Protocol" 261 261 sortable="true" 262 filterable="true" 263 exportable="true" 264 /> 265 <tbl:columndef 266 id="hardware" 267 property="hardware.name" 268 datatype="string" 269 title="Hardware" 270 sortable="true" 262 271 filterable="true" 263 272 exportable="true" … … 419 428 enablePropertyLink="<%=mode.hasPropertyLink()%>" 420 429 /></tbl:cell> 430 <tbl:cell column="hardware" 431 ><base:propertyvalue 432 item="<%=item%>" 433 property="hardware" 434 enableEditLink="<%=mode.hasEditLink()%>" 435 enablePropertyLink="<%=mode.hasPropertyLink()%>" 436 /></tbl:cell> 421 437 <tbl:cell column="entryDate"><%=Values.formatDate(item.getEntryDate())%></tbl:cell> 422 438 <tbl:cell column="eventDate"><%=Values.formatDate(item.getEventDate())%></tbl:cell> -
trunk/www/lims/plates/events/view_event.jsp
r2446 r2486 82 82 readCurrentEventType = false; 83 83 } 84 Protocol currentProtocol = null;85 boolean readCurrentProtocol = true;86 try87 {88 currentProtocol = event.getProtocol();89 }90 catch (PermissionDeniedException ex)91 {92 readCurrentProtocol = false;93 }94 84 95 85 final boolean writePermission = event.hasPermission(Permission.WRITE); … … 202 192 </tr> 203 193 <tr> 194 <td class="prompt">Hardware</td> 195 <td><base:propertyvalue item="<%=event%>" property="hardware" /></td> 196 </tr> 197 <tr> 204 198 <td class="prompt">Comment</td> 205 199 <td><%=HTML.niceFormat(event.getComment())%></td>
Note: See TracChangeset
for help on using the changeset viewer.