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

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

References #1153: Handling short read transcript sequence data

Removed the old "hack" with UsedQuantity and the dummy column used to store the array index. This has now been replaced with BioMaterialEventSource which is almost a full-fledged item and it should be easier to handle and create queries using the information.

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