Changeset 5541


Ignore:
Timestamp:
Jan 17, 2011, 11:00:42 AM (11 years ago)
Author:
Nicklas Nordborg
Message:

References #1564: Move biomaterial on plates

  • Added support for using a predefined plate mapping when moving biomaterial.
  • Display mapped well coordinates on the destination plate.
Location:
trunk/www
Files:
2 added
4 edited

Legend:

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

    r5536 r5541  
    128128    ItemContext cc = sc.getCurrentContext(Item.BIOPLATEEVENT, BioPlateEventType.MOVE);
    129129    final int maxRecent = Base.getMaxRecent(sc);
     130    sc.setUserClientSetting("move-biomaterial.show-source-coordinates",
     131        Values.getBoolean(request.getParameter("showSourceCoordinates")) ? "1" : "0");
    130132
    131133    BioPlate sourcePlate = BioPlate.getById(dc, Values.getInt(request.getParameter("sourceplate_id")));
  • trunk/www/biomaterials/wizards/move_biomaterial.jsp

    r5539 r5541  
    7171  final String jsDateFormat = HTML.javaScriptEncode(dateFormat);
    7272  final String htmlDateFormat = HTML.encodeTags(dateFormat);
     73  final boolean showSourceCoordinates = Values.getBoolean(sc.getUserClientSetting("move-biomaterial.show-source-coordinates"), true);
    7374  %>
    7475  <base:page type="popup" title="Move biomaterial">
     
    456457            }
    457458          }
    458           html += '<td id="'+prefix+'.'+r+'.'+c+'" class="' + cls + '"' + onclick + onmouseover + onmouseout+' title="'+title+'"></td>';
     459          html += '<td id="'+prefix+'.'+r+'.'+c+'" class="' + cls + '"' + onclick + onmouseover + onmouseout+' title="'+title+'">';
     460          html += '<div class="info" id="'+prefix+'.'+r+'.'+c+'.info"></div></td>';
    459461        }
    460462        html += '</tr>';
     
    472474        document.getElementById('plate.dest.name').innerHTML = Main.encodeTags(name);
    473475        destPlate = plate;
    474         Main.show('toolbar.mappings');
     476        Main.showHide('plate.dest.options', !bigPlate);
     477        showSourceCoordinatesOnClick();
    475478      }
    476479    }
     
    571574      list[1].text = name;
    572575      list.selectedIndex = 1;
     576    }
     577   
     578    function selectPlateMappingOnClick()
     579    {
     580      if (!destPlate)
     581      {
     582        alert('No destination plate has been selected');
     583        return;
     584      }
     585      var url = '../../lims/platemappings/index.jsp?ID=<%=ID%>&cmd=UpdateContext&mode=selectone&callback=setPlateMappingCallback';
     586      url += '&resetTemporary=1';
     587      url += '&tmpfilter:INT:sourceGeometry.rows='+sourcePlate.rows;
     588      url += '&tmpfilter:INT:sourceGeometry.columns='+sourcePlate.columns;
     589      url += '&tmpfilter:INT:sourceCount=1';
     590      url += '&tmpfilter:INT:destinationGeometry.rows='+destPlate.rows;
     591      url += '&tmpfilter:INT:destinationGeometry.columns='+destPlate.columns;
     592      url += '&tmpfilter:INT:destinationCount=1';
     593      Main.openPopup(url, 'SelectPlateMapping', 1000, 700);
     594    }
     595   
     596    function setPlateMappingCallback(plateMappingId, name)
     597    {
     598      var request = Ajax.getXmlHttpRequest();
     599      var url = '../../lims/platemappings/ajax.jsp?ID=<%=ID%>&cmd=GetMappingDetails&item_id=' + plateMappingId;
     600      request.open("GET", url, false);
     601      request.send(null);
     602      var response = Ajax.parseResponse(request.responseText);
     603      if (response.isError())
     604      {
     605        alert(response.getErrorMessage());
     606        return false;
     607      }
     608     
     609      var records = response.getElements();
     610      var mappingInfo = records[0];
     611      if (mappingInfo['source.plates'] != '1' || mappingInfo['source.rows'] != sourcePlate.rows || mappingInfo['source.columns'] != sourcePlate.columns)
     612      {
     613        if (!confirm("The selected mapping doesn't match the geometry of the source plate.\nContinue mapping overlapping positions?")) return;
     614      }
     615      else if (mappingInfo['destination.plates'] != '1' || mappingInfo['destination.rows'] != destPlate.rows || mappingInfo['destination.columns'] != destPlate.columns)
     616      {
     617        if (!confirm("The selected mapping doesn't match the geometry of the destination plate.\nContinue mapping overlapping positions?")) return;
     618      }
     619     
     620      var mappings = records[1];
     621      var numMapped = 0;
     622      for (var i = 0; i < mappings.length; i++)
     623      {
     624        var mapping = mappings[i].split(',');
     625        var srcWell = sourcePlate.getWell(parseInt(mapping[1]), parseInt(mapping[2]));
     626        var destWell = destPlate.getWell(parseInt(mapping[4]), parseInt(mapping[5]));
     627        if (srcWell && destWell)
     628        {
     629          if (!destWell.mappedWell && !destWell.locked && srcWell.id && !srcWell.locked && !srcWell.mappedWell)
     630          {
     631            srcWell.mapToWell(destWell);
     632            numMapped++;
     633          }
     634        }
     635      }
     636    }
     637   
     638    function showSourceCoordinatesOnClick()
     639    {
     640      var frm = document.forms['main'];
     641      Main.addOrRemoveClass(document.getElementById('plate.dest'), 'noinfo', !frm.showSourceCoordinates.checked);
    573642    }
    574643    </script>
     
    678747          tooltip="Place remaining items; start with columns"
    679748        />
     749        <tbl:button title="Predefined mapping&hellip;"
     750          onclick="selectPlateMappingOnClick()"
     751          image="star.png"
     752          tooltip="Select a predefined plate mapping"
     753        />
    680754      </tbl:toolbar>
    681755 
     
    692766            <b>Destination plate:</b> <span id="plate.dest.name"><i>not selected</i></span>
    693767            <div id="plate.dest"></div>
     768            <div id="plate.dest.options" style="display: none;">
     769            <input type="checkbox" name="showSourceCoordinates"
     770              <%=showSourceCoordinates ? "checked" : ""%> value="1"
     771              onclick="showSourceCoordinatesOnClick()">Show source coordinates
     772            </div>
    694773          </div>
    695774        </td>
  • trunk/www/include/scripts/plate.js

    r5532 r5541  
    391391  }
    392392
     393  /**
     394    Set the contents of the well element. The tag should have an ID combined
     395    of 'plate-prefix.row.column.info'.
     396  */
     397  Well.prototype.setInfo = function(info)
     398  {
     399    var infoTag = document.getElementById(this.plate.prefix+'.'+this.row+'.'+this.column + '.info');
     400    if (!infoTag) return;
     401    infoTag.innerHTML = info;
     402  }
     403 
    393404  /**
    394405    Mark the well as selected/deselected.
     
    497508    this.addClass(this.plate.mappedWellClass);
    498509    well.addClass(well.plate.mappedWellClass);
     510    well.setInfo(this.getCoordinate());
    499511  }
    500512
     
    505517  {
    506518    if (!this.mappedWell) return;
     519    this.mappedWell.setInfo('');
    507520    this.removeClass(this.plate.mappedWellClass);
    508521    this.mappedWell.removeClass(this.mappedWell.plate.mappedWellClass);
    509522    this.mappedWell.mappedWell = null;
    510     this.mappedWell = null;   
     523    this.mappedWell = null;
    511524  }
    512525 
  • trunk/www/include/styles/plate.css

    r5538 r5541  
    5656  border-top: 1px solid #E0E0E0;
    5757  border-left: 1px solid #E0E0E0;
    58   text-align: center;
     58  text-align: right;
     59  vertical-align: bottom;
    5960  overflow: hidden;
    6061  background: #FFFFFF;
    6162  background-repeat: no-repeat;
    6263  background-position: center;
     64}
     65
     66.well .info {
     67  font-size: xx-small;
     68  font-weight: bold;
     69}
     70
     71.bigplate .well .info, .noinfo .plate .well .info {
     72  display: none;
    6373}
    6474
     
    6878  max-width: 18px;
    6979  max-height: 18px;
     80  min-height: 18px;
     81  min-width: 18px;
    7082}
    7183
Note: See TracChangeset for help on using the changeset viewer.