source: branches/3.2-stable/www/views/physicalbioassays/edit_bioassay.jsp @ 6339

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

Fixes #1776: Change sort order for extract in physical bioassays edit dialog

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 25.8 KB
Line 
1<%-- $Id: edit_bioassay.jsp 6339 2013-10-30 10:42:17Z 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("srcevt", "position")));
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  final String clazz = "class=\"text\"";
241  final String requiredClazz = "class=\"text required\"";
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,annotations.js,linkitems.js,subtypes.js,ajax.js,json2.js" styles="tabcontrol.css">
251    <ext:scripts context="<%=jspContext%>" />
252    <ext:stylesheets context="<%=jspContext%>" />
253    <script language="JavaScript">
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        alert("You must enter a name");
261        frm.name.focus();
262        return false;
263      }
264      else if (!Numbers.isInteger(frm.size.value))
265      {
266        alert("'" + frm.size.value + "' is not a valid number");
267        frm.size.focus();
268        return false;
269      }
270      else if (parseInt(frm.size.value) <= 0)
271      {
272        alert("Size must be > 0");
273        frm.size.focus();
274        return false;
275      }
276      return true;
277    }
278
279    // Submit the form
280    function saveSettings()
281    {
282      var frm = document.forms['bioassay'];
283      if (TabControl.validateActiveTab('settings'))
284      {
285        if (annotationsLoaded)
286        {
287          Annotations.addModifiedAnnotationsToForm(frames.annotations, frm);
288        }
289        if (inheritedAnnotationsLoaded)
290        {
291          Annotations.addInheritedAnnotationsToForm(frames.inheritedAnnotations, frm);
292        }
293        frm.modifiedExtracts.value = Link.exportModified(frm, 'E', true).join(',');
294        frm.removedExtracts.value = Link.getActionIds(-1, 'E').join(',');
295        frm.submit();
296      }
297    }
298   
299    var annotationsLoaded = false;
300    var inheritedAnnotationsLoaded = false;
301    var parentsChanged = false;
302    var protocolChanged = false;
303    function switchTab(tabControlId, tabId)
304    {
305      if (TabControl.setActiveTab(tabControlId, tabId))
306      {
307        if (tabId == 'annotations' && (protocolChanged || !annotationsLoaded))
308        {
309          Annotations.loadAnnotateFrame(frames.annotations, '<%=ID%>', '<%=itemType.name()%>', <%=pba == null ? 0 : pba.getId()%>, getProtocolId());
310          annotationsLoaded = true;
311          protocolChanged = false;
312        }
313        else if (tabId == 'inheritedAnnotations' && 
314          (parentsChanged || !inheritedAnnotationsLoaded))
315        {
316          Annotations.loadInheritFrame(frames.inheritedAnnotations, '<%=ID%>', '<%=itemType.name()%>', <%=itemId%>, getParents());
317          inheritedAnnotationsLoaded = true;
318          parentsChanged = false;
319        }
320      }
321    }
322   
323    function getProtocolId()
324    {
325      var frm = document.forms['bioassay'];
326      var protocolId = 0;
327      if (frm.protocol_id.length > 0 && !frm.protocol_id.disabled)
328      {
329        protocolId = Math.abs(parseInt(frm.protocol_id[frm.protocol_id.selectedIndex].value));       
330      }
331      return protocolId;
332    }
333   
334    function getParents()
335    {
336      var frm = document.forms['bioassay'];
337      var parents = new Array();
338
339      var arraySlideId = Math.abs(parseInt(frm.arrayslide_id[frm.arrayslide_id.selectedIndex].value));
340      if (arraySlideId > 0) parents[parents.length] = 'ARRAYSLIDE:'+arraySlideId;
341
342      var ids = Link.getListIds(frm.extracts, 'L');
343      if (ids.length > 0)
344      {
345        parents[parents.length] = 'EXTRACT:'+ids.join(':');
346      }
347      return parents;
348    }
349
350    function subtypeOnChange()
351    {
352      var frm = document.forms['bioassay'];
353      var subtypeId = ItemSubtype.getSubtypeId('bioassay');
354      var recentInfo = ItemSubtype.getRecentAndRelatedInfo(subtypeId, 'BIOASSAY', ['PROTOCOL', 'HARDWARE']);
355     
356      protocolChanged = ItemSubtype.updateSelectionList(frm.protocol_id, recentInfo.PROTOCOL['recent'], recentInfo.PROTOCOL['default']);
357      ItemSubtype.updateSelectionList(frm.hardware_id, recentInfo.HARDWARE['recent'], recentInfo.HARDWARE['default']);
358    }
359   
360    function selectProtocolOnClick()
361    {
362      var frm = document.forms['bioassay'];
363      var url = '../../admin/protocols/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone';
364      url += '&callback=setProtocolCallback&resetTemporary=1';
365      url += ItemSubtype.createRelatedFilter('bioassay', 'PROTOCOL');
366      if (frm.protocol_id.length > 1)
367      {
368        var id = Math.abs(parseInt(frm.protocol_id[1].value));       
369        url += '&item_id='+id;
370      }
371      Main.openPopup(url, 'SelectProtocol', 1050, 700);
372    }
373    function setProtocolCallback(id, name)
374    {
375      var frm = document.forms['bioassay'];
376      var list = frm.protocol_id;
377      if (list.length < 2 || list[1].value == '0') // >
378      {
379        Forms.addListOption(list, 1, new Option());
380      }
381      list[1].value = id;
382      list[1].text = name;
383      list.selectedIndex = 1;
384      protocolChanged = true;
385    }
386    function protocolOnChange()
387    {
388      protocolChanged = true;
389    }
390   
391    function selectHardwareOnClick()
392    {
393      var frm = document.forms['bioassay'];
394      var url = '../../admin/hardware/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone';
395      url += '&callback=setHardwareCallback&resetTemporary=1';
396      url += ItemSubtype.createRelatedFilter('bioassay', 'HARDWARE');
397      if (frm.hardware_id.length > 1)
398      {
399        var id = Math.abs(parseInt(frm.hardware_id[1].value));       
400        url += '&item_id='+id;
401      }
402      Main.openPopup(url, 'SelectHardware', 1050, 700);
403    }
404    function setHardwareCallback(id, name)
405    {
406      var frm = document.forms['bioassay'];
407      var list = frm.hardware_id;
408      if (list.length < 2 || list[1].value == '0') // >
409      {
410        Forms.addListOption(list, 1, new Option());
411      }
412      list[1].value = id;
413      list[1].text = name;
414      list.selectedIndex = 1;
415    }
416   
417    function arraySlideOnChange()
418    {
419      var frm = document.forms['bioassay'];
420      var selectedIndex = frm.arrayslide_id.selectedIndex
421      var arraySlideId = frm.arrayslide_id[selectedIndex].value;
422      if (arraySlideId > 0) updateSize(arraySlideId);
423      parentsChanged = true;
424    }
425    function selectArraySlideOnClick()
426    {
427      var frm = document.forms['bioassay'];
428      var url = '../../lims/arrayslides/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setArraySlideCallback';
429      if (frm.arrayslide_id.length > 1)
430      {
431        var id = Math.abs(parseInt(frm.arrayslide_id[1].value));       
432        url += '&item_id='+id;
433      }
434      url += '&resetTemporary=1&tmpfilter:STRING:physicalBioAssay.name==';
435      url += '&tmpfilter:BOOLEAN:destroyed=false';
436      Main.openPopup(url, 'SelectArraySlide', 1050, 700);
437    }
438    function setArraySlideCallback(arraySlideId, name)
439    {
440      var frm = document.forms['bioassay'];
441      if (frm.arrayslide_id.length < 2) // >
442      {
443        frm.arrayslide_id[frm.arrayslide_id.length] = new Option();
444      }
445      frm.arrayslide_id[1].value = arraySlideId;
446      frm.arrayslide_id[1].text = name;
447      frm.arrayslide_id.selectedIndex = 1;
448      updateSize(arraySlideId);
449      parentsChanged = true;
450    }
451    function updateSize(arraySlideId)
452    {
453      var request = Ajax.getXmlHttpRequest();
454      if (request != null)
455      {
456        var url = '../../lims/arrayslides/ajax.jsp?ID=<%=ID%>&cmd=GetArrayDesign&item_id=' + arraySlideId;
457        request.open("GET", url, true);
458        Ajax.setReadyStateHandler(request, updateSizeCallback);
459        request.send(null);
460      }
461      return request != null;
462    }
463    function updateSizeCallback(request)
464    {
465      var frm = document.forms['bioassay'];
466      var response = Ajax.parseJsonResponse(request.responseText);
467      if (response.status != 'ok')
468      {
469        alert(response.message);
470        return false;
471      }
472
473      if (response.numArrays)
474      {
475        frm.size.value = response.numArrays;
476      }
477    }
478   
479    function addExtractsOnClick()
480    {
481      var frm = document.forms['bioassay'];
482      var ids = Link.getListIds(frm.extracts, 'L');
483      var excludes = ids.join(',');
484     
485      var url = '../../biomaterials/extracts/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectmultiple';
486      url += '&callback=addExtractCallback&resetTemporary=1';
487      url += ItemSubtype.createRelatedFilter('bioassay', 'EXTRACT');
488      url += '&exclude='+excludes;
489      Main.openPopup(url, 'AddExtracts', 1050, 700);
490    }
491    function addExtractCallback(extractId, name)
492    {
493      var item = Link.getItem('E', extractId);
494      if (!item) item = new Item('E', extractId, '1: '+name+' [-]', '', '');
495      Link.addItem(document.forms['bioassay'].extracts, item);
496      parentsChanged = true;
497      extractsOnChange();
498    }
499    function extractsOnChange()
500    {
501      var frm = document.forms['bioassay'];
502      var item = frm.extracts[frm.extracts.selectedIndex].item;
503      if (item && item.id)
504      {
505        var i = item.value ? item.value.indexOf(':') : -1;
506        frm.used_quantity.value = i >= 0 ? item.value.substring(0, i) : item.value;
507        frm.position.value = i >= 0 ? item.value.substring(i+1) : '1';
508        frm.used_quantity.focus();
509      }
510      else
511      {
512        frm.used_quantity.value = '';
513        frm.position.value = '1';
514      }
515    }
516    function usedQuantityOnBlur()
517    {
518      var frm = document.forms['bioassay'];
519      var usedQuantity = frm.used_quantity.value;
520      var position = frm.position.value;
521      var size = parseInt(frm.size.value);
522      if (position != '' && (position > size || position <= 0))
523      {
524        alert('Position must be between 1 and ' + size);
525        return;
526      }
527      if (position == '') position = 1;
528      var displayQuantity = usedQuantity == '' ? '-' : usedQuantity+' µg';
529      for (var i = 0; i < frm.extracts.length; i++) // >
530      {
531        var option = frm.extracts[i];
532        if (option.selected && option.item.id)
533        {
534          option.item.value = usedQuantity + ':' + position;
535          var text = option.text.replace(/\[.*\]/, '['+displayQuantity+']');
536          text = text.replace(/\d*\:/, position + ':');
537          option.text = text;
538        }
539      }
540    }
541    function positionOnBlur()
542    {
543      usedQuantityOnBlur();
544    }
545
546    function removeOnClick()
547    {
548      Link.removeSelected(document.forms['bioassay'].extracts);
549      parentsChanged = true;
550    }
551
552   
553    function init()
554    {
555      var frm = document.forms['bioassay'];
556      var extracts = frm.extracts;
557      <%
558      if (pba == null)
559      {
560        %>
561        frm.name.focus();
562        frm.name.select();
563        <%
564      }
565      if (parentExtracts != null)
566      {
567        for (Extract extract : parentExtracts)
568        {
569          if (pba == null)
570          {
571            %>
572            Link.addItem(extracts, new Item('E', <%=extract.getId()%>, '1: <%=HTML.javaScriptEncode(extract.getName())%> [-]', ':1'));
573            <%
574          }
575          else
576          {
577            BioMaterialEventSource evtSrc = creationEvent.getEventSource(extract);
578            Float used = evtSrc.getUsedQuantity();
579            String usedQuantity = Values.formatNumber(used, -1);
580            String usedWithUnit = used == null ? "-" : usedQuantity + " µg";
581            int position = evtSrc.getPosition();
582            %>
583            Link.addNewItem(extracts, new Item('E', <%=extract.getId()%>, '<%=position + ": " + HTML.javaScriptEncode(extract.getName())%> [<%=usedWithUnit%>]', '<%=usedQuantity%>:<%=position%>'));
584            <%
585          }
586        }
587      }
588      %>
589    }
590    </script>
591  </base:head>
592  <base:body onload="init()">
593    <h1><%=title%> <base:help tabcontrol="settings" /></h1>
594
595    <form action="index.jsp?ID=<%=ID%>" method="post" name="bioassay" onsubmit="return false;">
596    <input type="hidden" name="cmd" value="UpdateItem">
597
598    <t:tabcontrol id="settings"
599      subclass="content dialogtabcontrol"
600      position="bottom"  remember="<%=pba != null%>" switch="switchTab"
601      extensions="<%=invoker%>">
602    <t:tab id="info" title="Physical bioassay" validate="validatePhysicalBioAssay()" helpid="physicalbioassay.edit">
603      <table class="fullform input100">
604      <tr>
605        <th>Name</th>
606        <td><input <%=requiredClazz%> type="text" name="name" 
607          value="<%=name%>" 
608          maxlength="<%=PhysicalBioAssay.MAX_NAME_LENGTH%>"></td>
609        <td></td>
610      </tr>
611      <tr>
612        <th>Type</th>
613        <td>
614          <select name="subtype_id"
615            <%=!readCurrentSubtype ? "disabled readonly class=\"disabled selectionlist\"" : "class=\"selectionlist\""%>
616            onchange="subtypeOnChange()"
617            >
618          <%
619          if (!readCurrentSubtype)
620          {
621            %>
622            <option value="-1">- denied -
623            <%
624          }
625          else
626          {
627            int currentSubtypeId = currentSubtype == null ? 0 : currentSubtype.getId();
628            %>
629            <option value="0">-none-
630            <%
631            for (ItemSubtype subtype : subtypesQuery.list(dc))
632            {
633              int id = subtype.getId();
634              if (id != currentSubtypeId && subtype.isRemoved()) continue;
635              %>
636              <option value="<%=id == currentSubtypeId && pba != null ? -id : id%>" 
637                <%=id == currentSubtypeId ? "selected" : ""%>
638                title="<%=HTML.encodeTags(subtype.getDescription()) %>"
639                ><%=HTML.encodeTags(subtype.getName())%>
640              <%
641            }
642          }
643          %>
644          </select>
645        </td>
646        <td></td>
647      </tr>
648      <tr>
649        <th>Size</th>
650        <td><input <%=requiredClazz%> type="text" name="size" style="width: 15em;"
651          value="<%=pba == null ? Values.getString(cc.getPropertyValue("size"), "1") : pba.getSize()%>" 
652          maxlength="10" onkeypress="return Numbers.integerOnly(event)"></td>
653        <td></td>
654      </tr>
655      <tr>
656        <th>Created</th>
657        <td>
658          <table>
659          <tr>
660          <td>
661            <input <%=clazz%> type="text" name="event_date" style="width: 15em;"
662              value="<%=HTML.encodeTags(dateFormatter.format(eventDate))%>" 
663              maxlength="20" title="Enter date in format: <%=htmlDateFormat%>">
664          </td>
665          <td>
666          <base:button 
667            onclick="<%="Dates.selectDate('Created', 'bioassay', 'event_date', null, '"+jsDateFormat+"')"%>"
668            image="calendar.png"
669            title="Calendar&hellip;" 
670            tooltip="Select a date from a calendar" 
671          />
672          </td>
673          </tr>
674          </table>
675        </td>
676        <td></td>
677      </tr>
678      <tr>
679        <th>Registered</th>
680        <td><%=dateFormatter.format(creationEvent == null ? new Date() : creationEvent.getEntryDate())%></td>
681        <td></td>
682      </tr>
683      <tr>
684        <th>Protocol</th>
685        <td>
686          <base:select 
687            id="protocol_id"
688            clazz="selectionlist"
689            required="false"
690            current="<%=currentProtocol%>"
691            denied="<%=!readCurrentProtocol%>"
692            recent="<%=recentProtocols%>"
693            defaultitems="<%=defaultProtocols%>"
694            newitem="<%=pba == null%>"
695            onselect="selectProtocolOnClick()"
696            onchange="protocolOnChange()"
697          />
698        </td>
699        <td></td>
700      </tr>
701      <tr>
702        <th>Hardware</th>
703        <td>
704          <base:select 
705            id="hardware_id"
706            clazz="selectionlist"
707            required="false"
708            current="<%=currentHardware%>"
709            denied="<%=!readCurrentHardware%>"
710            recent="<%=recentHardware%>"
711            defaultitems="<%=defaultHardware%>"
712            newitem="<%=pba == null%>"
713            onselect="selectHardwareOnClick()"
714          />
715        </td>
716        <td></td>
717      </tr>
718      <tr>
719        <th>Array slide</th>
720        <td>
721          <base:select 
722            id="arrayslide_id"
723            clazz="selectionlist"
724            required="false"
725            current="<%=currentArraySlide%>"
726            denied="<%=!readCurrentArraySlide%>"
727            newitem="<%=pba == null%>"
728            onselect="selectArraySlideOnClick()"
729            onchange="arraySlideOnChange()"
730          />
731        </td>
732        <td></td>
733      </tr>
734      <tr class="dynamic">
735        <th>Description</th>
736        <td>
737          <textarea <%=clazz%> rows="6" name="description" 
738            ><%=HTML.encodeTags(pba == null ? cc.getPropertyValue("description") : pba.getDescription())%></textarea>
739        </td>
740        <td style="width: 20px;">
741          <base:icon image="zoom.png" 
742            onclick="Main.zoom('Description', 'bioassay', 'description')"
743            tooltip="Edit in larger window"
744          />
745        </td>
746      </tr>
747      </table>
748    </t:tab>
749   
750    <t:tab id="extracts" title="Extracts" helpid="physicalbioassay.extracts">
751      <input type="hidden" name="modifiedExtracts" value="">
752      <input type="hidden" name="removedExtracts" value="">
753   
754      <table class="fullform input100">
755      <tr class="big">
756        <th>Extracts</th>
757        <td>
758          <div class="selectionlist">
759          <table>
760          <tr>
761          <td>
762            <select name="extracts" size="15" multiple onchange="extractsOnChange()">
763            </select>
764          </td>
765          <td style="vertical-align: top;">
766            <base:buttongroup vertical="true">
767              <base:button 
768                subclass="leftaligned"
769                style="width: 12em;"
770                onclick="addExtractsOnClick()" 
771                title="Add&nbsp;extracts&hellip;" 
772                tooltip="Add extracts"
773              />
774              <base:button 
775                subclass="leftaligned"
776                style="width: 12em;"
777                onclick="removeOnClick()" 
778                title="Remove" 
779                tooltip="Remove the selected extracts"
780              />
781            </base:buttongroup>
782          </td>
783          </tr>
784          </table>
785          </div>
786        </td>
787      </tr>
788     
789      <tr>
790        <th class="subprompt">used quantity</th>
791        <td>
792            <input <%=clazz%> type="text" name="used_quantity"  style="width: 15em;" 
793              value="" maxlength="10" onkeypress="return Numbers.numberOnly(event)"
794              onkeyup="usedQuantityOnBlur()"
795            > (µg)
796        </td>
797      </tr>
798
799      <tr>
800        <th class="subprompt">position</th>
801        <td>
802            <input <%=clazz%> type="text" name="position" style="width: 15em;" 
803              maxlength="10" onkeypress="return Numbers.numberOnly(event)"
804              onkeyup="positionOnBlur()"
805            > (1 -- size of bioassay)
806        </td>
807      </tr>
808      <tr class="dynamic">
809        <th></th>
810        <td></td>
811      </tr>
812      </table>
813    </t:tab>
814
815    <t:tab id="annotations" title="Annotations &amp; parameters" helpid="annotations.edit"><iframe 
816      name="annotations" id="idAnnotations" src="../../common/annotations/wait.jsp" 
817      style="width: 100%; height: 100%;"></iframe></t:tab>
818   
819    <t:tab id="inheritedAnnotations" title="Inherited annotations" 
820      helpid="annotations.edit.inherited"><iframe 
821        name="inheritedAnnotations" id="idInheritedAnnotations" src="../../common/annotations/wait.jsp" 
822        style="width: 100%; height: 100%;"></iframe></t:tab>
823    </t:tabcontrol>
824    </form>
825   
826    <div class="legend">
827      <base:icon image="required.png" />= required information
828    </div>
829
830    <base:buttongroup subclass="dialogbuttons">
831      <base:button onclick="saveSettings()" title="Save" />
832      <base:button onclick="window.close()" title="Cancel" />
833    </base:buttongroup>
834  </base:body>
835  </base:page>
836  <%
837}
838finally
839{
840  if (dc != null) dc.close();
841}
842%>
Note: See TracBrowser for help on using the repository browser.