Ignore:
Timestamp:
Aug 29, 2011, 2:41:51 PM (12 years ago)
Author:
Nicklas Nordborg
Message:

References #1597: Subtypes of items

The place-on-plate wizard now uses item subtypes when selecting plate, protocol and hardware if all selected items are of the same subtype.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/biomaterials/wizards/place_on_plate.jsp

    r5557 r5710  
    2828  import="net.sf.basedb.core.Hardware"
    2929  import="net.sf.basedb.core.Protocol"
     30  import="net.sf.basedb.core.ItemSubtype"
    3031  import="net.sf.basedb.core.DbControl"
     32  import="net.sf.basedb.core.SystemItems"
    3133  import="net.sf.basedb.core.Item"
    3234  import="net.sf.basedb.core.ItemContext"
     
    6466  ItemQuery<MeasuredBioMaterial> query = (ItemQuery<MeasuredBioMaterial>)cc.getQuery();
    6567  List<MeasuredBioMaterial> bioMaterial = Collections.emptyList();
     68  ItemSubtype commonSubtype = null;
    6669  if (query != null)
    6770  {
     
    106109      itemList = new ItemList('itemlist');
    107110      <%
     111      boolean first = true;
    108112      for (MeasuredBioMaterial bm : bioMaterial)
    109113      {
    110114        String itemId = Integer.toString(bm.getId());
     115        if (first)
     116        {
     117          commonSubtype = bm.getItemSubtype();
     118          first = false;
     119        }
     120        else if (commonSubtype != null)
     121        {
     122          if (!commonSubtype.equals(bm.getItemSubtype()))
     123          {
     124            commonSubtype = null;
     125          }
     126        }
    111127        %>
    112128        itemList.addItem(<%=itemId%>, '<%=HTML.javaScriptEncode(bm.getName())%>');
     
    390406      var url = '../bioplates/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setBioPlateCallback';
    391407      url += '&resetTemporary=1&tmpfilter:INT:bioPlateType.bioMaterialType=|<%=itemType.getValue()%>'
     408      <%
     409      if (commonSubtype != null)
     410      {
     411        %>
     412        url += '&tmpfilter:INT:bioPlateType.itemSubtype=|<%=commonSubtype.getId()%>'
     413        <%
     414      }
     415      %>
    392416      Main.openPopup(url, 'SelectBioPlate', 1000, 700);
    393417    }
     
    535559      }
    536560      url += '&resetTemporary=1';
     561      <%
     562      if (commonSubtype != null)
     563      {
     564        ItemSubtype hardwareType = commonSubtype.getRelatedSubtype(Item.HARDWARE);
     565        if (hardwareType != null)
     566        {
     567          %>
     568          url += '&tmpfilter:INT:itemSubtype=<%=hardwareType.getId()%>';
     569          <%
     570        }
     571      }
     572      %>
    537573      Main.openPopup(url, 'SelectHardware', 1000, 700);
    538574    }
     
    560596      }
    561597      url += '&resetTemporary=1';
     598      <%
     599      ItemSubtype protocolType = null;
     600      if (commonSubtype != null)
     601      {
     602        protocolType = commonSubtype.getRelatedSubtype(Item.PROTOCOL);
     603      }
     604      if (protocolType == null)
     605      {
     606        String defaultId = Protocol.getDefaultSystemId(itemType);
     607        if (defaultId != null) protocolType = ItemSubtype.getById(dc, SystemItems.getId(defaultId));
     608      }
     609      if (protocolType != null)
     610      {
     611        %>
     612        url += '&tmpfilter:INT:itemSubtype=<%=protocolType.getId()%>';
     613        <%
     614      }
     615      %>
    562616      Main.openPopup(url, 'SelectProtocol', 1000, 700);
    563617    }
     
    698752      <tr valign="top">
    699753        <td style="width: 280px;">
    700           <b>Items to place</b>
     754          <b>Items to place</b> <%=commonSubtype != null ? "<span class=\"itemsubtype\">[" + HTML.encodeTags(commonSubtype.getName()) + "]</span>" : "" %>
    701755          <div id="itemlist" class="biomateriallist" style="height: <%=(int)(scale*320)%>px; width:270px;" onscroll="onItemListScroll()">
    702756          <table border="0" cellspacing="0" cellpadding="0" width="100%">
Note: See TracChangeset for help on using the changeset viewer.