source: trunk/www/views/physicalbioassays/edit_bioassay.jsp @ 5687

Last change on this file since 5687 was 5687, checked in by Nicklas Nordborg, 12 years ago

References #1597: Subtypes of items

Smarter selection of default subtypes and related items (protocols, etc) have now been implemented in the other important edit dialogs.

Added support for also loading and displaying project default items dynamically based on the selected subtype.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 26.3 KB
Line 
1<%-- $Id: edit_bioassay.jsp 5687 2011-08-09 11:39:40Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2005 Nicklas Nordborg, Gregory Vincic
4  Copyright (C) 2006 Johan Enell, Jari Häkkinen, Nicklas Nordborg, Martin Svensson
5
6  This file is part of BASE - BioArray Software Environment.
7  Available at http://base.thep.lu.se/
8
9  BASE is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License
11  as published by the Free Software Foundation; either version 3
12  of the License, or (at your option) any later version.
13
14  BASE is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  GNU General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with BASE. If not, see <http://www.gnu.org/licenses/>.
21  ------------------------------------------------------------------
22
23  @author Nicklas
24  @version 2.0
25--%>
26<%@ page pageEncoding="UTF-8" session="false"
27  import="net.sf.basedb.core.SessionControl"
28  import="net.sf.basedb.core.DbControl"
29  import="net.sf.basedb.core.Item"
30  import="net.sf.basedb.core.ItemContext"
31  import="net.sf.basedb.core.SystemItems"
32  import="net.sf.basedb.core.Permission"
33  import="net.sf.basedb.core.Include"
34  import="net.sf.basedb.core.Hardware"
35  import="net.sf.basedb.core.PhysicalBioAssay"
36  import="net.sf.basedb.core.BioMaterialEvent"
37  import="net.sf.basedb.core.BioMaterialEventSource"
38  import="net.sf.basedb.core.ItemSubtype"
39  import="net.sf.basedb.core.ArraySlide"
40  import="net.sf.basedb.core.Protocol"
41  import="net.sf.basedb.core.Project"
42  import="net.sf.basedb.core.Extract"
43  import="net.sf.basedb.core.ItemQuery"
44  import="net.sf.basedb.core.ItemResultList"
45  import="net.sf.basedb.core.PermissionDeniedException"
46  import="net.sf.basedb.core.BaseException"
47  import="net.sf.basedb.core.Type"
48  import="net.sf.basedb.core.query.Restrictions"
49  import="net.sf.basedb.core.query.Expressions"
50  import="net.sf.basedb.core.query.Orders"
51  import="net.sf.basedb.core.query.Hql"
52  import="net.sf.basedb.clients.web.Base"
53  import="net.sf.basedb.clients.web.util.HTML"
54  import="net.sf.basedb.util.Values"
55  import="net.sf.basedb.util.ListUtil"
56  import="net.sf.basedb.util.formatter.Formatter"
57  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
58  import="net.sf.basedb.clients.web.formatter.FormatterSettings"
59  import="net.sf.basedb.core.plugin.GuiContext"
60  import="net.sf.basedb.clients.web.extensions.ExtensionsControl"
61  import="net.sf.basedb.clients.web.extensions.JspContext"
62  import="net.sf.basedb.clients.web.extensions.edit.EditUtil"
63  import="net.sf.basedb.util.extensions.ExtensionsInvoker"
64  import="java.util.List"
65  import="java.util.Set"
66  import="java.util.HashSet"
67  import="java.util.Date"
68  import="java.util.Collections"
69%>
70<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
71<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
72<%
73final Item itemType = Item.PHYSICALBIOASSAY;
74final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
75final ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, null);
76final int itemId = cc.getId();
77final String ID = sc.getId();
78final float scale = Base.getScale(sc);
79final DbControl dc = sc.newDbControl();
80try
81{
82  String title = null;
83  String name = null;
84  PhysicalBioAssay pba = null;
85  BioMaterialEvent creationEvent = null;
86  Date eventDate = null;
87  List<Extract> parentExtracts = null;
88 
89  boolean readCurrentSubtype = true;
90  ItemSubtype currentSubtype = null;
91  boolean readCurrentArraySlide = true;
92  ArraySlide currentArraySlide = null;
93 
94  boolean readCurrentProtocol = true;
95  Protocol currentProtocol = null;
96 
97  boolean readCurrentHardware = true;
98  Hardware currentHardware = null;
99
100  if (itemId == 0)
101  {
102    title = "Create physical bioassay";
103    cc.removeObject("item");
104    if (cc.getPropertyFilter("creationEvent.protocol.name") != null)
105    {
106      currentProtocol = Base.getFirstMatching(dc, Protocol.getQuery(), "name", cc.getPropertyFilter("creationEvent.protocol.name"));
107    }
108    if (cc.getPropertyFilter("creationEvent.hardware.name") != null)
109    {
110      currentHardware = Base.getFirstMatching(dc, Hardware.getQuery(), "name", cc.getPropertyFilter("creationEvent.hardware.name"));
111    }
112    if (cc.getPropertyFilter("arraySlide.name") != null)
113    {
114      currentArraySlide = Base.getFirstMatching(dc, ArraySlide.getQuery(), "name", cc.getPropertyFilter("arraySlide.name"));
115    }
116    name = Values.getString(cc.getPropertyValue("name"), "New physical bioassay");
117    eventDate = (Date)cc.getPropertyObject("creationEvent.eventDate");
118   
119    int currentSubtypeId = Values.getInt(request.getParameter("subtype_id"));
120    List<ItemSubtype> relatedToParent = Collections.emptyList();
121    ItemQuery<Extract> extractsQuery = null;
122    if (Values.getBoolean(request.getParameter("useParents")))
123    {
124      ItemContext lc = sc.getCurrentContext(Item.EXTRACT);
125      if (lc.getSelected().size() > 0)
126      {
127        extractsQuery = Extract.getQuery();
128        extractsQuery.include(Include.ALL);
129        extractsQuery.order(Orders.asc(Hql.property("name")));
130        extractsQuery.restrict(Restrictions.in(Hql.property("id"), 
131          Expressions.parameter("selected", lc.getSelected(), Type.INT)));
132      }
133    }
134    else if (request.getParameter("extract_id") != null)
135    {
136      int leId = Values.getInt(request.getParameter("extract_id"));
137      extractsQuery = Extract.getQuery();
138      extractsQuery.include(Include.ALL);
139      extractsQuery.restrict(Restrictions.eq(Hql.property("id"), 
140        Expressions.integer(leId)));
141    }
142   
143    if (extractsQuery != null)
144    {
145      parentExtracts = extractsQuery.list(dc);
146      if (currentSubtypeId == 0 && parentExtracts.size() > 0)
147      {
148        relatedToParent = ItemSubtype.getParentSubtypes(dc, parentExtracts.get(0), Item.PHYSICALBIOASSAY);
149      }
150    }
151   
152    if (currentSubtypeId == 0) 
153    {
154      if (relatedToParent.size() > 0)
155      {
156        // Find most recently used related subtype
157        List<ItemSubtype> recentSubtypes = (List<ItemSubtype>)cc.getRecent(dc, Item.ITEMSUBTYPE);
158        currentSubtype = ListUtil.findFirstCommon(recentSubtypes, relatedToParent, relatedToParent.get(0));
159      }
160      else
161      {
162        int recentSubtypeId = Values.getInt(cc.getRecent(Item.ITEMSUBTYPE.name(), 0));
163        currentSubtypeId = Values.getInt(cc.getPropertyValue("itemSubtype"), recentSubtypeId);
164        if (currentSubtypeId > 0) currentSubtype = ItemSubtype.getById(dc, currentSubtypeId);
165      }
166    }
167  }
168  else
169  {
170    pba = PhysicalBioAssay.getById(dc, itemId);
171    pba.checkPermission(Permission.WRITE);
172    creationEvent = pba.getCreationEvent();
173    eventDate = creationEvent.getEventDate();
174    cc.setObject("item", pba);
175    title = "Edit physical bioassay -- " + HTML.encodeTags(pba.getName());
176    name = pba.getName();
177   
178    try
179    {
180      currentSubtype = pba.getItemSubtype();
181    }
182    catch (PermissionDeniedException ex)
183    {
184      readCurrentSubtype = false;
185    }
186
187    try
188    {
189      currentArraySlide = pba.getArraySlide();
190    }
191    catch (PermissionDeniedException ex)
192    {
193      readCurrentArraySlide = false;
194    }
195    try
196    {
197      currentProtocol = creationEvent.getProtocol();
198    }
199    catch (PermissionDeniedException ex)
200    {
201      readCurrentProtocol = false;
202    }
203    try
204    {
205      currentHardware = creationEvent.getHardware();
206    }
207    catch (PermissionDeniedException ex)
208    {
209      readCurrentHardware = false;
210    }
211   
212    // Query to retrieve source extracts
213    ItemQuery<Extract> extractsQuery = (ItemQuery<Extract>)creationEvent.getSources();
214    extractsQuery.include(Include.ALL);
215    extractsQuery.order(Orders.asc(Hql.property("name")));
216    parentExtracts = extractsQuery.list(dc);
217   
218  }
219 
220  // Default items
221  int activeProjectId = sc.getActiveProjectId();
222  List<Protocol> defaultProtocols = null;
223  List<Hardware> defaultHardware = null;
224  if (activeProjectId > 0)
225  {
226    Project activeProject = Project.getById(dc, activeProjectId);
227    defaultProtocols = (List<Protocol>)activeProject.findDefaultItemsOfRelatedSubtype(dc, currentSubtype, Item.PROTOCOL);
228    defaultHardware = (List<Hardware>)activeProject.findDefaultItemsOfRelatedSubtype(dc, currentSubtype, Item.HARDWARE);
229  }
230 
231  // Load recently used items
232  List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL, currentSubtype);
233  List<Hardware> recentHardware = (List<Hardware>)cc.getRecent(dc, Item.HARDWARE, currentSubtype);
234 
235  // Query to retrieve item types
236  final ItemQuery<ItemSubtype> subtypesQuery = Base.getSubtypesQuery(itemType);
237  subtypesQuery.include(Include.ALL);
238
239  final String clazz = "class=\"text\"";
240  final String requiredClazz = "class=\"text required\"";
241  Formatter<Date> dateFormatter = FormatterFactory.getDateFormatter(sc);
242  String dateFormat = FormatterSettings.getDateFormat(sc);
243  String jsDateFormat = HTML.javaScriptEncode(dateFormat);
244  String htmlDateFormat = HTML.encodeTags(dateFormat);
245  JspContext jspContext = ExtensionsControl.createContext(dc, pageContext, GuiContext.item(itemType), pba);
246  ExtensionsInvoker invoker = EditUtil.useEditExtensions(jspContext);
247  %>
248  <base:page type="popup" title="<%=title%>">
249  <base:head scripts="tabcontrol.js,annotations.js,linkitems.js,subtypes.js,ajax.js,json2.js" styles="tabcontrol.css">
250    <ext:scripts context="<%=jspContext%>" />
251    <ext:stylesheets context="<%=jspContext%>" />
252    <script language="JavaScript">
253    // Validate the "Physical bioassay" tab
254    function validatePhysicalBioAssay()
255    {
256      var frm = document.forms['bioassay'];
257      if (Main.trimString(frm.name.value) == '')
258      {
259        alert("You must enter a name");
260        frm.name.focus();
261        return false;
262      }
263      else if (!Numbers.isInteger(frm.size.value))
264      {
265        alert("'" + frm.size.value + "' is not a valid number");
266        frm.size.focus();
267        return false;
268      }
269      else if (parseInt(frm.size.value) <= 0)
270      {
271        alert("Size must be > 0");
272        frm.size.focus();
273        return false;
274      }
275      return true;
276    }
277
278    // Submit the form
279    function saveSettings()
280    {
281      var frm = document.forms['bioassay'];
282      if (TabControl.validateActiveTab('settings'))
283      {
284        if (annotationsLoaded)
285        {
286          Annotations.addModifiedAnnotationsToForm(frames.annotations, frm);
287        }
288        if (inheritedAnnotationsLoaded)
289        {
290          Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm);
291        }
292        frm.modifiedExtracts.value = Link.exportModified(frm, 'E', true).join(',');
293        frm.removedExtracts.value = Link.getActionIds(-1, 'E').join(',');
294        frm.submit();
295      }
296    }
297   
298    var annotationsLoaded = false;
299    var inheritedAnnotationsLoaded = false;
300    var parentsChanged = false;
301    var protocolChanged = false;
302    function switchTab(tabControlId, tabId)
303    {
304      if (TabControl.setActiveTab(tabControlId, tabId))
305      {
306        if (tabId == 'annotations' && (protocolChanged || !annotationsLoaded))
307        {
308          Annotations.loadAnnotateFrame(frames.annotations, '<%=ID%>', '<%=itemType.name()%>', <%=pba == null ? 0 : pba.getId()%>, getProtocolId());
309          annotationsLoaded = true;
310          protocolChanged = false;
311        }
312        else if (tabId == 'inheritedAnnotations' && 
313          (parentsChanged || !inheritedAnnotationsLoaded))
314        {
315          Annotations.loadInheritFrame(frames.inheritedAnnotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getParents());
316          inheritedAnnotationsLoaded = true;
317          parentsChanged = false;
318        }
319      }
320    }
321   
322    function getProtocolId()
323    {
324      var frm = document.forms['bioassay'];
325      var protocolId = 0;
326      if (frm.protocol_id.length > 0 && !frm.protocol_id.disabled)
327      {
328        protocolId = Math.abs(parseInt(frm.protocol_id[frm.protocol_id.selectedIndex].value));       
329      }
330      return protocolId;
331    }
332   
333    function getParents()
334    {
335      var frm = document.forms['bioassay'];
336      var parents = new Array();
337
338      var arraySlideId = Math.abs(parseInt(frm.arrayslide_id[frm.arrayslide_id.selectedIndex].value));
339      if (arraySlideId > 0) parents[parents.length] = 'ARRAYSLIDE:'+arraySlideId;
340
341      var ids = Link.getListIds(frm.extracts, 'L');
342      if (ids.length > 0)
343      {
344        parents[parents.length] = 'EXTRACT:'+ids.join(':');
345      }
346      return parents;
347    }
348
349    function subtypeOnChange()
350    {
351      var frm = document.forms['bioassay'];
352      var subtypeId = ItemSubtype.getSubtypeId('bioassay');
353      var recentInfo = ItemSubtype.getRecentAndRelatedInfo(subtypeId, 'BIOASSAY', ['PROTOCOL', 'HARDWARE']);
354      protocolChanged = ItemSubtype.updateRecentItemsInList(frm.protocol_id, recentInfo.PROTOCOL['recent']);
355      ItemSubtype.updateDefaultItemsInList(frm.protocol_id, recentInfo.PROTOCOL['default']);
356      ItemSubtype.updateRecentItemsInList(frm.hardware_id, recentInfo.HARDWARE['recent']);
357      ItemSubtype.updateDefaultItemsInList(frm.hardware_id, recentInfo.HARDWARE['default']);
358    }
359   
360    function selectProtocolOnClick()
361    {
362      var frm = document.forms['bioassay'];
363      var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone';
364      url += '&callback=setProtocolCallback&resetTemporary=1';
365      url += ItemSubtype.createRelatedFilter('bioassay', 'PROTOCOL');
366      if (frm.protocol_id.length > 1)
367      {
368        var id = Math.abs(parseInt(frm.protocol_id[1].value));       
369        url += '&item_id='+id;
370      }
371      Main.openPopup(url, 'SelectProtocol', 1000, 700);
372    }
373    function setProtocolCallback(id, name)
374    {
375      var frm = document.forms['bioassay'];
376      var list = frm.protocol_id;
377      if (list.length < 2 || list[1].value == '0') // >
378      {
379        Forms.addListOption(list, 1, new Option());
380      }
381      list[1].value = id;
382      list[1].text = name;
383      list.selectedIndex = 1;
384      protocolChanged = true;
385    }
386    function protocolOnChange()
387    {
388      protocolChanged = true;
389    }
390   
391    function selectHardwareOnClick()
392    {
393      var frm = document.forms['bioassay'];
394      var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone';
395      url += '&callback=setHardwareCallback&resetTemporary=1';
396      url += ItemSubtype.createRelatedFilter('bioassay', 'HARDWARE');
397      if (frm.hardware_id.length > 1)
398      {
399        var id = Math.abs(parseInt(frm.hardware_id[1].value));       
400        url += '&item_id='+id;
401      }
402      Main.openPopup(url, 'SelectHardware', 1000, 700);
403    }
404    function setHardwareCallback(id, name)
405    {
406      var frm = document.forms['bioassay'];
407      var list = frm.hardware_id;
408      if (list.length < 2 || list[1].value == '0') // >
409      {
410        Forms.addListOption(list, 1, new Option());
411      }
412      list[1].value = id;
413      list[1].text = name;
414      list.selectedIndex = 1;
415    }
416   
417    function arraySlideOnChange()
418    {
419      var frm = document.forms['bioassay'];
420      var selectedIndex = frm.arrayslide_id.selectedIndex
421      var arraySlideId = frm.arrayslide_id[selectedIndex].value;
422      if (arraySlideId > 0) updateSize(arraySlideId);
423      parentsChanged = true;
424    }
425    function selectArraySlideOnClick()
426    {
427      var frm = document.forms['bioassay'];
428      var url = '../../lims/arrayslides/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setArraySlideCallback';
429      if (frm.arrayslide_id.length > 1)
430      {
431        var id = Math.abs(parseInt(frm.arrayslide_id[1].value));       
432        url += '&item_id='+id;
433      }
434      url += '&resetTemporary=1&tmpfilter:STRING:physicalBioAssay.name==';
435      url += '&tmpfilter:BOOLEAN:destroyed=false';
436      Main.openPopup(url, 'SelectArraySlide', 1000, 700);
437    }
438    function setArraySlideCallback(arraySlideId, name)
439    {
440      var frm = document.forms['bioassay'];
441      if (frm.arrayslide_id.length < 2) // >
442      {
443        frm.arrayslide_id[frm.arrayslide_id.length] = new Option();
444      }
445      frm.arrayslide_id[1].value = arraySlideId;
446      frm.arrayslide_id[1].text = name;
447      frm.arrayslide_id.selectedIndex = 1;
448      updateSize(arraySlideId);
449      parentsChanged = true;
450    }
451    function updateSize(arraySlideId)
452    {
453      var request = Ajax.getXmlHttpRequest();
454      if (request != null)
455      {
456        var url = '../../lims/arrayslides/ajax.jsp?ID=<%=ID%>&cmd=GetArrayDesign&item_id=' + arraySlideId;
457        request.open("GET", url, true);
458        Ajax.setReadyStateHandler(request, updateSizeCallback);
459        request.send(null);
460      }
461      return request != null;
462    }
463    function updateSizeCallback(request)
464    {
465      var frm = document.forms['bioassay'];
466      var response = Ajax.parseJsonResponse(request.responseText);
467      if (response.status != 'ok')
468      {
469        alert(response.message);
470        return false;
471      }
472
473      if (response.numArrays)
474      {
475        frm.size.value = response.numArrays;
476      }
477    }
478   
479    function addExtractsOnClick()
480    {
481      var frm = document.forms['bioassay'];
482      var ids = Link.getListIds(frm.extracts, 'L');
483      var excludes = ids.join(',');
484     
485      var url = '../../biomaterials/extracts/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectmultiple';
486      url += '&callback=addExtractCallback&resetTemporary=1';
487      url += ItemSubtype.createRelatedFilter('bioassay', 'EXTRACT');
488      url += '&exclude='+excludes;
489      Main.openPopup(url, 'AddExtracts', 1000, 700);
490    }
491    function addExtractCallback(extractId, name)
492    {
493      var item = Link.getItem('E', extractId);
494      if (!item) item = new Item('E', extractId, '1: '+name+' [-]', '', '');
495      Link.addItem(document.forms['bioassay'].extracts, item);
496      parentsChanged = true;
497      extractsOnChange();
498    }
499    function extractsOnChange()
500    {
501      var frm = document.forms['bioassay'];
502      var item = frm.extracts[frm.extracts.selectedIndex].item;
503      if (item && item.id)
504      {
505        var i = item.value ? item.value.indexOf(':') : -1;
506        frm.used_quantity.value = i >= 0 ? item.value.substring(0, i) : item.value;
507        frm.position.value = i >= 0 ? item.value.substring(i+1) : '1';
508        frm.used_quantity.focus();
509      }
510      else
511      {
512        frm.used_quantity.value = '';
513        frm.position.value = '1';
514      }
515    }
516    function usedQuantityOnBlur()
517    {
518      var frm = document.forms['bioassay'];
519      var usedQuantity = frm.used_quantity.value;
520      var position = frm.position.value;
521      var size = parseInt(frm.size.value);
522      if (position != '' && (position > size || position <= 0))
523      {
524        alert('Position must be between 1 and ' + size);
525        return;
526      }
527      if (position == '') position = 1;
528      var displayQuantity = usedQuantity == '' ? '-' : usedQuantity+' µg';
529      for (var i = 0; i < frm.extracts.length; i++) // >
530      {
531        var option = frm.extracts[i];
532        if (option.selected && option.item.id)
533        {
534          option.item.value = usedQuantity + ':' + position;
535          var text = option.text.replace(/\[.*\]/, '['+displayQuantity+']');
536          text = text.replace(/\d*\:/, position + ':');
537          option.text = text;
538        }
539      }
540    }
541    function positionOnBlur()
542    {
543      usedQuantityOnBlur();
544    }
545
546    function removeOnClick()
547    {
548      Link.removeSelected(document.forms['bioassay'].extracts);
549      parentsChanged = true;
550    }
551
552   
553    function init()
554    {
555      var frm = document.forms['bioassay'];
556      var extracts = frm.extracts;
557      <%
558      if (pba == null)
559      {
560        %>
561        frm.name.focus();
562        frm.name.select();
563        <%
564      }
565      if (parentExtracts != null)
566      {
567        for (Extract extract : parentExtracts)
568        {
569          if (pba == null)
570          {
571            %>
572            Link.addItem(extracts, new Item('E', <%=extract.getId()%>, '1: <%=HTML.javaScriptEncode(extract.getName())%> [-]', ':1'));
573            <%
574          }
575          else
576          {
577            BioMaterialEventSource evtSrc = creationEvent.getEventSource(extract);
578            Float used = evtSrc.getUsedQuantity();
579            String usedQuantity = Values.formatNumber(used, -1);
580            String usedWithUnit = used == null ? "-" : usedQuantity + " µg";
581            int position = evtSrc.getPosition();
582            %>
583            Link.addNewItem(extracts, new Item('E', <%=extract.getId()%>, '<%=position + ": " + HTML.javaScriptEncode(extract.getName())%> [<%=usedWithUnit%>]', '<%=usedQuantity%>:<%=position%>'));
584            <%
585          }
586        }
587      }
588      %>
589    }
590    </script>
591  </base:head>
592  <base:body onload="init()">
593    <p>
594    <form action="index.jsp?ID=<%=ID%>" method="post" name="bioassay" onsubmit="return false;">
595    <input type="hidden" name="cmd" value="UpdateItem">
596
597    <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3>
598    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" 
599      position="bottom"  remember="<%=pba != null%>" switch="switchTab"
600      extensions="<%=invoker%>">
601    <t:tab id="info" title="Physical bioassay" validate="validatePhysicalBioAssay()" helpid="physicalbioassay.edit">
602      <table class="form" cellspacing=0>
603      <tr>
604        <td class="prompt">Name</td>
605        <td><input <%=requiredClazz%> type="text" name="name" 
606          value="<%=name%>" 
607          size="40" maxlength="<%=PhysicalBioAssay.MAX_NAME_LENGTH%>"></td>
608      </tr>
609      <tr valign="top">
610        <td class="prompt">Type</td>
611        <td colspan="2">
612          <select name="subtype_id"
613            <%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%>
614            onchange="subtypeOnChange()"
615            >
616          <%
617          if (!readCurrentSubtype)
618          {
619            %>
620            <option value="-1">- denied -
621            <%
622          }
623          else
624          {
625            int currentSubtypeId = currentSubtype == null ? 0 : currentSubtype.getId();
626            %>
627            <option value="0">-none-
628            <%
629            for (ItemSubtype subtype : subtypesQuery.list(dc))
630            {
631              int id = subtype.getId();
632              if (id != currentSubtypeId && subtype.isRemoved()) continue;
633              %>
634              <option value="<%=id == currentSubtypeId && pba != null ? -id : id%>" 
635                <%=id == currentSubtypeId ? "selected" : ""%>
636                title="<%=HTML.encodeTags(subtype.getDescription()) %>"
637                ><%=HTML.encodeTags(subtype.getName())%>
638              <%
639            }
640          }
641          %>
642          </select>
643        </td>
644      </tr>
645      <tr>
646        <td class="prompt">Size</td>
647        <td><input <%=requiredClazz%> type="text" name="size" 
648          value="<%=pba == null ? Values.getString(cc.getPropertyValue("size"), "1") : pba.getSize()%>" 
649          size="12" maxlength="10" onkeypress="return Numbers.integerOnly(event)"></td>
650      </tr>
651      <tr>
652        <td class="prompt">Created</td>
653        <td>
654          <table border="0" cellspacing="0" cellpadding="0">
655          <tr>
656          <td>
657            <input <%=clazz%> type="text" name="event_date" 
658              value="<%=HTML.encodeTags(dateFormatter.format(eventDate))%>" 
659              size="20" maxlength="20" title="Enter date in format: <%=htmlDateFormat%>">
660            &nbsp;
661          </td>
662          <td>
663          <base:button 
664            onclick="<%="Dates.selectDate('Created', 'bioassay', 'event_date', null, '"+jsDateFormat+"')"%>"
665            image="calendar.png"
666            title="Calendar&hellip;" 
667            tooltip="Select a date from a calendar" 
668          />
669          </td>
670          </tr>
671          </table>
672        </td>
673      </tr>
674      <tr>
675        <td class="prompt">Registered</td>
676        <td><%=dateFormatter.format(creationEvent == null ? new Date() : creationEvent.getEntryDate())%></td>
677      </tr>
678      <tr>
679        <td class="prompt">Protocol</td>
680        <td>
681          <base:select 
682            id="protocol_id"
683            clazz="selectionlist"
684            required="false"
685            current="<%=currentProtocol%>"
686            denied="<%=!readCurrentProtocol%>"
687            recent="<%=recentProtocols%>"
688            defaultitems="<%=defaultProtocols%>"
689            newitem="<%=pba == null%>"
690            onselect="selectProtocolOnClick()"
691            onchange="protocolOnChange()"
692          />
693        </td>
694      </tr>
695      <tr>
696        <td class="prompt">Hardware</td>
697        <td>
698          <base:select 
699            id="hardware_id"
700            clazz="selectionlist"
701            required="false"
702            current="<%=currentHardware%>"
703            denied="<%=!readCurrentHardware%>"
704            recent="<%=recentHardware%>"
705            defaultitems="<%=defaultHardware%>"
706            newitem="<%=pba == null%>"
707            onselect="selectHardwareOnClick()"
708          />
709        </td>
710      </tr>
711      <tr>
712        <td class="prompt">Array slide</td>
713        <td>
714          <base:select 
715            id="arrayslide_id"
716            clazz="selectionlist"
717            required="false"
718            current="<%=currentArraySlide%>"
719            denied="<%=!readCurrentArraySlide%>"
720            newitem="<%=pba == null%>"
721            onselect="selectArraySlideOnClick()"
722            onchange="arraySlideOnChange()"
723          />
724        </td>
725      </tr>
726      <tr valign=top>
727        <td class="prompt">Description</td>
728        <td nowrap>
729          <textarea <%=clazz%> rows="4" cols="40" name="description" wrap="virtual"
730            ><%=HTML.encodeTags(pba == null ? cc.getPropertyValue("description") : pba.getDescription())%></textarea>
731          <a href="javascript:Main.zoom('Description', 'bioassay', 'description')"
732            title="Edit in larger window"><base:icon image="zoom.gif" /></a>
733        </td>
734      </tr>
735      </table>
736      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
737    </t:tab>
738   
739    <t:tab id="extracts" title="Extracts" helpid="physicalbioassay.extracts">
740      <input type="hidden" name="modifiedExtracts" value="">
741      <input type="hidden" name="removedExtracts" value="">
742   
743      <table class="form" cellspacing=0>
744      <tr valign="top">
745        <td class="prompt">Extracts</td>
746        <td>
747          <table border="0" cellspacing="0" cellpadding="0">
748          <tr valign="top">
749          <td>
750            <select name="extracts" size="5" multiple style="width: 20em;" 
751              onchange="extractsOnChange()">
752            </select>&nbsp;<br>
753          </td>
754          <td>
755            <table border="0">
756            <tr><td width="150"><base:button 
757              onclick="addExtractsOnClick()" 
758              title="Add&nbsp;extracts&hellip;" 
759              tooltip="Add extracts"
760              /></td></tr>
761            <tr><td width="150"><base:button 
762              onclick="removeOnClick()" 
763              title="Remove" 
764              tooltip="Remove the selected extracts"
765            /></td></tr>
766            </table>
767          </td>
768          </tr>
769          </table>
770        </td>
771      </tr>
772     
773      <tr>
774        <td style="text-align: right; padding-right: 5px;">- used quantity</td>
775        <td>
776            <input <%=clazz%> type="text" name="used_quantity" value=""
777              size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)"
778              onkeyup="usedQuantityOnBlur()"
779            > (µg)
780        </td>
781      </tr>
782
783      <tr>
784        <td style="text-align: right; padding-right: 5px;">- position</td>
785        <td>
786            <input <%=clazz%> type="text" name="position" value=""
787              size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)"
788              onkeyup="positionOnBlur()"
789            > (1 -- size of bioassay)
790        </td>
791      </tr>
792
793      </table>
794    </t:tab>
795
796    <t:tab id="annotations" title="Annotations &amp; parameters" 
797      helpid="annotations.edit" tooltip="Enter values for annotations and protocol parameters">
798      <iframe name="annotations" id="idAnnotations" src="../../common/annotations/wait.jsp" 
799        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
800        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
801    </t:tab>
802   
803    <t:tab id="inheritedAnnotations" title="Inherited annotations" helpid="annotations.edit.inherited">
804   
805      <iframe name="inheritedAnnotations" id="idInheritedAnnotations" src="../../common/annotations/wait.jsp" 
806        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
807        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
808    </t:tab>
809    </t:tabcontrol>
810
811    <table align="center">
812    <tr>
813      <td width="50%"><base:button onclick="saveSettings()" title="Save" /></td>
814      <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td>
815    </tr>
816    </table>
817    </form>
818  </base:body>
819  </base:page>
820  <%
821}
822finally
823{
824  if (dc != null) dc.close();
825}
826%>
Note: See TracBrowser for help on using the repository browser.