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

Last change on this file since 6254 was 6254, checked in by Nicklas Nordborg, 10 years ago

References #1729 and #1730. Use lazy loading of 'Annotations'/'Inherited annotations' for all other items.

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