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

Last change on this file since 5767 was 5767, checked in by Nicklas Nordborg, 11 years ago

Fixes #1626: Center-align text on buttons

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 26.2 KB
Line 
1<%-- $Id: edit_bioassay.jsp 5767 2011-09-28 07:31:39Z 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     
355      protocolChanged = ItemSubtype.updateSelectionList(frm.protocol_id, recentInfo.PROTOCOL['recent'], recentInfo.PROTOCOL['default']);
356      ItemSubtype.updateSelectionList(frm.hardware_id, recentInfo.HARDWARE['recent'], recentInfo.HARDWARE['default']);
357    }
358   
359    function selectProtocolOnClick()
360    {
361      var frm = document.forms['bioassay'];
362      var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone';
363      url += '&callback=setProtocolCallback&resetTemporary=1';
364      url += ItemSubtype.createRelatedFilter('bioassay', 'PROTOCOL');
365      if (frm.protocol_id.length > 1)
366      {
367        var id = Math.abs(parseInt(frm.protocol_id[1].value));       
368        url += '&item_id='+id;
369      }
370      Main.openPopup(url, 'SelectProtocol', 1000, 700);
371    }
372    function setProtocolCallback(id, name)
373    {
374      var frm = document.forms['bioassay'];
375      var list = frm.protocol_id;
376      if (list.length < 2 || list[1].value == '0') // >
377      {
378        Forms.addListOption(list, 1, new Option());
379      }
380      list[1].value = id;
381      list[1].text = name;
382      list.selectedIndex = 1;
383      protocolChanged = true;
384    }
385    function protocolOnChange()
386    {
387      protocolChanged = true;
388    }
389   
390    function selectHardwareOnClick()
391    {
392      var frm = document.forms['bioassay'];
393      var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone';
394      url += '&callback=setHardwareCallback&resetTemporary=1';
395      url += ItemSubtype.createRelatedFilter('bioassay', 'HARDWARE');
396      if (frm.hardware_id.length > 1)
397      {
398        var id = Math.abs(parseInt(frm.hardware_id[1].value));       
399        url += '&item_id='+id;
400      }
401      Main.openPopup(url, 'SelectHardware', 1000, 700);
402    }
403    function setHardwareCallback(id, name)
404    {
405      var frm = document.forms['bioassay'];
406      var list = frm.hardware_id;
407      if (list.length < 2 || list[1].value == '0') // >
408      {
409        Forms.addListOption(list, 1, new Option());
410      }
411      list[1].value = id;
412      list[1].text = name;
413      list.selectedIndex = 1;
414    }
415   
416    function arraySlideOnChange()
417    {
418      var frm = document.forms['bioassay'];
419      var selectedIndex = frm.arrayslide_id.selectedIndex
420      var arraySlideId = frm.arrayslide_id[selectedIndex].value;
421      if (arraySlideId > 0) updateSize(arraySlideId);
422      parentsChanged = true;
423    }
424    function selectArraySlideOnClick()
425    {
426      var frm = document.forms['bioassay'];
427      var url = '../../lims/arrayslides/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setArraySlideCallback';
428      if (frm.arrayslide_id.length > 1)
429      {
430        var id = Math.abs(parseInt(frm.arrayslide_id[1].value));       
431        url += '&item_id='+id;
432      }
433      url += '&resetTemporary=1&tmpfilter:STRING:physicalBioAssay.name==';
434      url += '&tmpfilter:BOOLEAN:destroyed=false';
435      Main.openPopup(url, 'SelectArraySlide', 1000, 700);
436    }
437    function setArraySlideCallback(arraySlideId, name)
438    {
439      var frm = document.forms['bioassay'];
440      if (frm.arrayslide_id.length < 2) // >
441      {
442        frm.arrayslide_id[frm.arrayslide_id.length] = new Option();
443      }
444      frm.arrayslide_id[1].value = arraySlideId;
445      frm.arrayslide_id[1].text = name;
446      frm.arrayslide_id.selectedIndex = 1;
447      updateSize(arraySlideId);
448      parentsChanged = true;
449    }
450    function updateSize(arraySlideId)
451    {
452      var request = Ajax.getXmlHttpRequest();
453      if (request != null)
454      {
455        var url = '../../lims/arrayslides/ajax.jsp?ID=<%=ID%>&cmd=GetArrayDesign&item_id=' + arraySlideId;
456        request.open("GET", url, true);
457        Ajax.setReadyStateHandler(request, updateSizeCallback);
458        request.send(null);
459      }
460      return request != null;
461    }
462    function updateSizeCallback(request)
463    {
464      var frm = document.forms['bioassay'];
465      var response = Ajax.parseJsonResponse(request.responseText);
466      if (response.status != 'ok')
467      {
468        alert(response.message);
469        return false;
470      }
471
472      if (response.numArrays)
473      {
474        frm.size.value = response.numArrays;
475      }
476    }
477   
478    function addExtractsOnClick()
479    {
480      var frm = document.forms['bioassay'];
481      var ids = Link.getListIds(frm.extracts, 'L');
482      var excludes = ids.join(',');
483     
484      var url = '../../biomaterials/extracts/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectmultiple';
485      url += '&callback=addExtractCallback&resetTemporary=1';
486      url += ItemSubtype.createRelatedFilter('bioassay', 'EXTRACT');
487      url += '&exclude='+excludes;
488      Main.openPopup(url, 'AddExtracts', 1000, 700);
489    }
490    function addExtractCallback(extractId, name)
491    {
492      var item = Link.getItem('E', extractId);
493      if (!item) item = new Item('E', extractId, '1: '+name+' [-]', '', '');
494      Link.addItem(document.forms['bioassay'].extracts, item);
495      parentsChanged = true;
496      extractsOnChange();
497    }
498    function extractsOnChange()
499    {
500      var frm = document.forms['bioassay'];
501      var item = frm.extracts[frm.extracts.selectedIndex].item;
502      if (item && item.id)
503      {
504        var i = item.value ? item.value.indexOf(':') : -1;
505        frm.used_quantity.value = i >= 0 ? item.value.substring(0, i) : item.value;
506        frm.position.value = i >= 0 ? item.value.substring(i+1) : '1';
507        frm.used_quantity.focus();
508      }
509      else
510      {
511        frm.used_quantity.value = '';
512        frm.position.value = '1';
513      }
514    }
515    function usedQuantityOnBlur()
516    {
517      var frm = document.forms['bioassay'];
518      var usedQuantity = frm.used_quantity.value;
519      var position = frm.position.value;
520      var size = parseInt(frm.size.value);
521      if (position != '' && (position > size || position <= 0))
522      {
523        alert('Position must be between 1 and ' + size);
524        return;
525      }
526      if (position == '') position = 1;
527      var displayQuantity = usedQuantity == '' ? '-' : usedQuantity+' µg';
528      for (var i = 0; i < frm.extracts.length; i++) // >
529      {
530        var option = frm.extracts[i];
531        if (option.selected && option.item.id)
532        {
533          option.item.value = usedQuantity + ':' + position;
534          var text = option.text.replace(/\[.*\]/, '['+displayQuantity+']');
535          text = text.replace(/\d*\:/, position + ':');
536          option.text = text;
537        }
538      }
539    }
540    function positionOnBlur()
541    {
542      usedQuantityOnBlur();
543    }
544
545    function removeOnClick()
546    {
547      Link.removeSelected(document.forms['bioassay'].extracts);
548      parentsChanged = true;
549    }
550
551   
552    function init()
553    {
554      var frm = document.forms['bioassay'];
555      var extracts = frm.extracts;
556      <%
557      if (pba == null)
558      {
559        %>
560        frm.name.focus();
561        frm.name.select();
562        <%
563      }
564      if (parentExtracts != null)
565      {
566        for (Extract extract : parentExtracts)
567        {
568          if (pba == null)
569          {
570            %>
571            Link.addItem(extracts, new Item('E', <%=extract.getId()%>, '1: <%=HTML.javaScriptEncode(extract.getName())%> [-]', ':1'));
572            <%
573          }
574          else
575          {
576            BioMaterialEventSource evtSrc = creationEvent.getEventSource(extract);
577            Float used = evtSrc.getUsedQuantity();
578            String usedQuantity = Values.formatNumber(used, -1);
579            String usedWithUnit = used == null ? "-" : usedQuantity + " µg";
580            int position = evtSrc.getPosition();
581            %>
582            Link.addNewItem(extracts, new Item('E', <%=extract.getId()%>, '<%=position + ": " + HTML.javaScriptEncode(extract.getName())%> [<%=usedWithUnit%>]', '<%=usedQuantity%>:<%=position%>'));
583            <%
584          }
585        }
586      }
587      %>
588    }
589    </script>
590  </base:head>
591  <base:body onload="init()">
592    <p>
593    <form action="index.jsp?ID=<%=ID%>" method="post" name="bioassay" onsubmit="return false;">
594    <input type="hidden" name="cmd" value="UpdateItem">
595
596    <h3 class="docked"><%=title%> <base:help tabcontrol="settings" /></h3>
597    <t:tabcontrol id="settings" contentstyle="<%="height: "+(int)(scale*370)+"px;"%>" 
598      position="bottom"  remember="<%=pba != null%>" switch="switchTab"
599      extensions="<%=invoker%>">
600    <t:tab id="info" title="Physical bioassay" validate="validatePhysicalBioAssay()" helpid="physicalbioassay.edit">
601      <table class="form" cellspacing=0>
602      <tr>
603        <td class="prompt">Name</td>
604        <td><input <%=requiredClazz%> type="text" name="name" 
605          value="<%=name%>" 
606          size="40" maxlength="<%=PhysicalBioAssay.MAX_NAME_LENGTH%>"></td>
607      </tr>
608      <tr valign="top">
609        <td class="prompt">Type</td>
610        <td colspan="2">
611          <select name="subtype_id"
612            <%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%>
613            onchange="subtypeOnChange()"
614            >
615          <%
616          if (!readCurrentSubtype)
617          {
618            %>
619            <option value="-1">- denied -
620            <%
621          }
622          else
623          {
624            int currentSubtypeId = currentSubtype == null ? 0 : currentSubtype.getId();
625            %>
626            <option value="0">-none-
627            <%
628            for (ItemSubtype subtype : subtypesQuery.list(dc))
629            {
630              int id = subtype.getId();
631              if (id != currentSubtypeId && subtype.isRemoved()) continue;
632              %>
633              <option value="<%=id == currentSubtypeId && pba != null ? -id : id%>" 
634                <%=id == currentSubtypeId ? "selected" : ""%>
635                title="<%=HTML.encodeTags(subtype.getDescription()) %>"
636                ><%=HTML.encodeTags(subtype.getName())%>
637              <%
638            }
639          }
640          %>
641          </select>
642        </td>
643      </tr>
644      <tr>
645        <td class="prompt">Size</td>
646        <td><input <%=requiredClazz%> type="text" name="size" 
647          value="<%=pba == null ? Values.getString(cc.getPropertyValue("size"), "1") : pba.getSize()%>" 
648          size="12" maxlength="10" onkeypress="return Numbers.integerOnly(event)"></td>
649      </tr>
650      <tr>
651        <td class="prompt">Created</td>
652        <td>
653          <table border="0" cellspacing="0" cellpadding="0">
654          <tr>
655          <td>
656            <input <%=clazz%> type="text" name="event_date" 
657              value="<%=HTML.encodeTags(dateFormatter.format(eventDate))%>" 
658              size="20" maxlength="20" title="Enter date in format: <%=htmlDateFormat%>">
659            &nbsp;
660          </td>
661          <td>
662          <base:button 
663            onclick="<%="Dates.selectDate('Created', 'bioassay', 'event_date', null, '"+jsDateFormat+"')"%>"
664            image="calendar.png"
665            title="Calendar&hellip;" 
666            tooltip="Select a date from a calendar" 
667          />
668          </td>
669          </tr>
670          </table>
671        </td>
672      </tr>
673      <tr>
674        <td class="prompt">Registered</td>
675        <td><%=dateFormatter.format(creationEvent == null ? new Date() : creationEvent.getEntryDate())%></td>
676      </tr>
677      <tr>
678        <td class="prompt">Protocol</td>
679        <td>
680          <base:select 
681            id="protocol_id"
682            clazz="selectionlist"
683            required="false"
684            current="<%=currentProtocol%>"
685            denied="<%=!readCurrentProtocol%>"
686            recent="<%=recentProtocols%>"
687            defaultitems="<%=defaultProtocols%>"
688            newitem="<%=pba == null%>"
689            onselect="selectProtocolOnClick()"
690            onchange="protocolOnChange()"
691          />
692        </td>
693      </tr>
694      <tr>
695        <td class="prompt">Hardware</td>
696        <td>
697          <base:select 
698            id="hardware_id"
699            clazz="selectionlist"
700            required="false"
701            current="<%=currentHardware%>"
702            denied="<%=!readCurrentHardware%>"
703            recent="<%=recentHardware%>"
704            defaultitems="<%=defaultHardware%>"
705            newitem="<%=pba == null%>"
706            onselect="selectHardwareOnClick()"
707          />
708        </td>
709      </tr>
710      <tr>
711        <td class="prompt">Array slide</td>
712        <td>
713          <base:select 
714            id="arrayslide_id"
715            clazz="selectionlist"
716            required="false"
717            current="<%=currentArraySlide%>"
718            denied="<%=!readCurrentArraySlide%>"
719            newitem="<%=pba == null%>"
720            onselect="selectArraySlideOnClick()"
721            onchange="arraySlideOnChange()"
722          />
723        </td>
724      </tr>
725      <tr valign=top>
726        <td class="prompt">Description</td>
727        <td nowrap>
728          <textarea <%=clazz%> rows="4" cols="40" name="description" wrap="virtual"
729            ><%=HTML.encodeTags(pba == null ? cc.getPropertyValue("description") : pba.getDescription())%></textarea>
730          <a href="javascript:Main.zoom('Description', 'bioassay', 'description')"
731            title="Edit in larger window"><base:icon image="zoom.gif" /></a>
732        </td>
733      </tr>
734      </table>
735      <div align=right>&nbsp;<i><base:icon image="required.gif" /> = required information</i></div>
736    </t:tab>
737   
738    <t:tab id="extracts" title="Extracts" helpid="physicalbioassay.extracts">
739      <input type="hidden" name="modifiedExtracts" value="">
740      <input type="hidden" name="removedExtracts" value="">
741   
742      <table class="form" cellspacing=0>
743      <tr valign="top">
744        <td class="prompt">Extracts</td>
745        <td>
746          <table border="0" cellspacing="0" cellpadding="0">
747          <tr valign="top">
748          <td>
749            <select name="extracts" size="15" multiple style="width: 20em;" 
750              onchange="extractsOnChange()">
751            </select>&nbsp;<br>
752          </td>
753          <td>
754            <table border="0">
755            <tr><td width="150"><base:button 
756              clazz="leftaligned buttonclass"
757              onclick="addExtractsOnClick()" 
758              title="Add&nbsp;extracts&hellip;" 
759              tooltip="Add extracts"
760              /></td></tr>
761            <tr><td width="150"><base:button 
762              clazz="leftaligned buttonclass"
763              onclick="removeOnClick()" 
764              title="Remove" 
765              tooltip="Remove the selected extracts"
766            /></td></tr>
767            </table>
768          </td>
769          </tr>
770          </table>
771        </td>
772      </tr>
773     
774      <tr>
775        <td style="text-align: right; padding-right: 5px;">- used quantity</td>
776        <td>
777            <input <%=clazz%> type="text" name="used_quantity" value=""
778              size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)"
779              onkeyup="usedQuantityOnBlur()"
780            > (µg)
781        </td>
782      </tr>
783
784      <tr>
785        <td style="text-align: right; padding-right: 5px;">- position</td>
786        <td>
787            <input <%=clazz%> type="text" name="position" value=""
788              size="12" maxlength="10" onkeypress="return Numbers.numberOnly(event)"
789              onkeyup="positionOnBlur()"
790            > (1 -- size of bioassay)
791        </td>
792      </tr>
793
794      </table>
795    </t:tab>
796
797    <t:tab id="annotations" title="Annotations &amp; parameters" 
798      helpid="annotations.edit" tooltip="Enter values for annotations and protocol parameters">
799      <iframe name="annotations" id="idAnnotations" src="../../common/annotations/wait.jsp" 
800        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
801        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
802    </t:tab>
803   
804    <t:tab id="inheritedAnnotations" title="Inherited annotations" helpid="annotations.edit.inherited">
805   
806      <iframe name="inheritedAnnotations" id="idInheritedAnnotations" src="../../common/annotations/wait.jsp" 
807        width="100%"  height="<%=(int)(scale*370)%>" frameborder=0 vspace=0 hspace=0
808        marginwidth=0 marginheight=0 scrolling="auto" style="overflow: visible"></iframe>
809    </t:tab>
810    </t:tabcontrol>
811
812    <table align="center">
813    <tr>
814      <td width="50%"><base:button onclick="saveSettings()" title="Save" /></td>
815      <td width="50%"><base:button onclick="window.close()" title="Cancel" /></td>
816    </tr>
817    </table>
818    </form>
819  </base:body>
820  </base:page>
821  <%
822}
823finally
824{
825  if (dc != null) dc.close();
826}
827%>
Note: See TracBrowser for help on using the repository browser.