Changeset 4731


Ignore:
Timestamp:
Jan 20, 2009, 9:02:44 AM (14 years ago)
Author:
Martin Svensson
Message:

References #979 The implementation of bioplates/biowells in the webclient is now done.

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/BioWell.java

    r4677 r4731  
    112112  */
    113113  /**
    114     Adds the {@link MeasureBioMaterial},used in this well, to the Set.
     114    Adds the {@link MeasuredBioMaterial},used in this well, to the Set.
    115115   */
    116116  @Override
  • trunk/src/core/net/sf/basedb/core/data/BioWellData.java

    r4685 r4731  
    4040  /**
    4141    The bioplate this well belongs to.
    42     @see BioPlateData#getWells()
     42    @see BioPlateData#getBioWells()
    4343    @hibernate.many-to-one column="`bioplate_id`" not-null="true" outer-join="false" update="false"
    4444  */
  • trunk/www/biomaterials/bioplates/wells/index.jsp

    r4729 r4731  
    3333  import="net.sf.basedb.core.ItemQuery"
    3434  import="net.sf.basedb.core.DataQuery"
     35  import="net.sf.basedb.core.MeasuredBioMaterial"
    3536  import="net.sf.basedb.core.Permission"
    3637  import="net.sf.basedb.core.PermissionDeniedException"
     
    110111    // Update the properties on an item (will close the popup)
    111112    ItemContext cc = Base.getAndSetCurrentContext(sc, itemType, null, defaultContext);
    112     dc = sc.newDbControl();
    113     BioWell biowell = (BioWell)cc.getObject("item");
    114     dc.reattachItem(biowell);
    115     message = "biowell updated";
     113    final int maxRecent = Base.getMaxRecent(sc);   
     114    message = "biowell updated";   
    116115   
    117     dc.commit();
     116    int biomaterialId = Values.getInt(request.getParameter("biomaterial_id"));
     117    if (biomaterialId >= 0)
     118    {     
     119      dc = sc.newDbControl();
     120      BioWell biowell = (BioWell)cc.getObject("item");
     121      dc.reattachItem(biowell);
     122      MeasuredBioMaterial oldMbm = biowell.getBioMaterial();
     123      if (oldMbm != null)
     124      {
     125        dc.reattachItem(oldMbm);
     126        oldMbm.setBioWell(null);       
     127      }
     128      dc.commit();
     129      if (biomaterialId > 0)
     130      {
     131        dc = sc.newDbControl();
     132        Item biomaterialType = Item.valueOf(request.getParameter("biomaterial_type"));
     133        MeasuredBioMaterial newMbm = (MeasuredBioMaterial)biomaterialType.getById(dc, biomaterialId);
     134        newMbm.setBioWell(biowell);
     135        dc.commit();
     136      }
     137     
     138    }   
    118139    cc.removeObject("item");
    119140  }
  • trunk/www/biomaterials/bioplates/wells/list_biowells.jsp

    r4730 r4731  
    109109    var submitPage = 'index.jsp';
    110110    var formId = 'biowells';
    111    
     111
     112    function editItem(itemId)
     113    {
     114      Main.viewOrEditItem('<%=ID%>', '<%=itemType.name()%>', itemId, true);
     115    }
    112116    function itemOnClick(itemId)
    113117    {
     
    146150 
    147151  <base:body>
    148     <p>
    149     <p:path>
    150       <p:pathelement title="Bioplates" href="<%="../index.jsp?ID="+ID%>" />
    151       <p:pathelement title="<%=HTML.encodeTags(bioplate.getName())%>" />
    152     </p:path>
    153 
    154     <t:tabcontrol id="main" active="biowells" switch="switchTab">
     152    <%
     153    if (!mode.isSelectionMode())
     154    {
     155      %>
     156      <p>
     157      <p:path>
     158        <p:pathelement title="Bioplates" href="<%="../index.jsp?ID="+ID%>" />
     159        <p:pathelement title="<%=HTML.encodeTags(bioplate.getName())%>" />
     160      </p:path>
     161      <%
     162    }
     163    %>
     164
     165    <t:tabcontrol id="main" active="biowells" switch="switchTab" notabs="<%=mode.isSelectionMode()%>">
    155166    <t:tab id="properties" title="Properties" />
    156167    <t:tab id="annotations" title="Annotations" />       
     
    386397                </tbl:cell>
    387398                <tbl:cell column="column"><%=item.getColumn()%></tbl:cell>
    388                 <tbl:cell column="bioMaterial.name">
     399                <tbl:cell column="bioMaterial.name">                 
    389400                <%
    390                   MeasuredBioMaterial bioMaterial = item.getBioMaterial();
    391                   if (bioMaterial == null)
     401                MeasuredBioMaterial bioMaterial = null;
     402                boolean bmWritePermission = true;
     403                try
     404                {
     405                  bioMaterial = item.getBioMaterial();
     406                  if (bioMaterial != null)
    392407                  {
    393                     %>
    394                     <i>- none -</i>
    395                     <%
     408                    bmWritePermission = bioMaterial.hasPermission(Permission.WRITE);                   
    396409                  }
    397                   else
    398                   {
    399                     %>
    400                     <%=Base.getLink(ID, bioMaterial.getName(), bioMaterial.getType(), bioMaterial.getId(), true)%>
    401                     <%
    402                   }
     410                }
     411                catch (PermissionDeniedException ex)
     412                {
     413                  bmWritePermission = false;
     414                }
    403415                %>
    404                 <base:icon
    405                   image="edit.gif"
    406                   tooltip="Change biomaterial of this biowell"
    407                   onclick="changeBioMaterial()"
    408                 />
     416                  <base:propertyvalue
     417                      item="<%=item%>"
     418                      property="bioMaterial"
     419                      enableEditLink="<%=mode.hasEditLink() && bmWritePermission%>"
     420                      enablePropertyLink="<%=mode.hasPropertyLink()%>"
     421                  />
     422                  <base:icon
     423                    image="<%=bmWritePermission ? "edit.gif" : "edit_disabled.gif" %>"
     424                    tooltip="<%=bmWritePermission ? "Change the biomaterial in this biowell" :
     425                      "You have not permission to change the current biomaterial"%>"
     426                    onclick="<%=bmWritePermission ? "editItem("+item.getId()+")" : ""%>"
     427                  />               
    409428                </tbl:cell>
    410429                <tbl:cell column="permission"><%=PermissionUtil.getShortPermissions(item)%></tbl:cell>
  • trunk/www/include/scripts/main.js

    r4704 r4731  
    427427    this.controllers['BIOMATERIALLIST'] = { url:'biomaterials/lists/index.jsp', width:800, height:500 };
    428428    this.controllers['BIOPLATE'] = { url:'biomaterials/bioplates/index.jsp', width:800, height:500 };
    429     this.controllers['BIOWELL'] = { url:'biomaterials/bioplates/wells/index.jsp', width:800, height:500 };
     429    this.controllers['BIOWELL'] = { url:'biomaterials/bioplates/wells/index.jsp', width:450, height:280 };
    430430    this.controllers['MESSAGE'] = { url:'my_base/messages/index.jsp', width:600, height:420, popup:true, edit:false };
    431431    this.controllers['PROJECT'] = { url:'my_base/projects/index.jsp', width:600, height:460 };
Note: See TracChangeset for help on using the changeset viewer.