diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css index 7829f5190a1b539827d808e433c729035ec97084..3588c18264f0a3e7737eb13324046238c44ff0fc 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/css/style.css @@ -461,35 +461,29 @@ table.downloads { } /* - * Storage Widget + * Plate Widget */ -.storageTable { - width: 80%; - border-spacing: 2px; - border-collapse: separate; +.gridTable { + border : none !important; } - -.storageTable th, -.storageTable td { - height:40px; - width: 10%; - - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; +.gridTable th { + border : none !important; } -.storageTable td:hover { - background-color: #CCAABB; +.gridTable td:hover { + background-color: #E7E7E7; cursor : pointer; } -.storageTable td { +.gridTable td { border-style:solid; border-width:1px; border-color: #CCCCCC; } +/* + * Storage Widget + */ .storageSelectedRack { background-color: #CCCCCC; } diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html index b40bcb0165cd494dfa8197ed5f5fffa20159a133..786e7d25f7bb2b47f32d043feefdb1759ae24eff 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/index.html @@ -81,7 +81,7 @@ <script type="text/javascript" src="./js/config/OBISELNTestProfile.js"></script> <script type="text/javascript" src="./js/config/ELNPaperProfile.js"></script> <script type="text/javascript" src="./js/config/BSAProfile.js"></script> - <script type="text/javascript" src="./js/config/MuellerProfile.js"></script> + <script type="text/javascript" src="./js/config/MuellerProfile.js"></script> <script type="text/javascript" src="./js/server/ServerFacade.js"></script> @@ -131,6 +131,9 @@ <script type="text/javascript" src="./js/views/SampleForm/widgets/CommentsController.js"></script> <script type="text/javascript" src="./js/views/SampleForm/widgets/CommentsModel.js"></script> <script type="text/javascript" src="./js/views/SampleForm/widgets/CommentsView.js"></script> + <script type="text/javascript" src="./js/views/SampleForm/widgets/PlateController.js"></script> + <script type="text/javascript" src="./js/views/SampleForm/widgets/PlateModel.js"></script> + <script type="text/javascript" src="./js/views/SampleForm/widgets/PlateView.js"></script> <script type="text/javascript" src="./js/views/SpaceForm/SpaceFormController.js"></script> <script type="text/javascript" src="./js/views/SpaceForm/SpaceFormModel.js"></script> diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js index 4f3c0b530039e8f145d01855d72a5091c543259c..b4bc8930ac0d04017c68d5a12db1824fd5de2076 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/SampleFormView.js @@ -428,6 +428,18 @@ function SampleFormView(sampleFormController, sampleFormModel) { $formColumn.append($fieldset); } + // + // Plate View + // + if(this._sampleFormModel.sample.sampleTypeCode === "PLATE") { + var plateContainer = $("<div>", { 'id' : 'sample-form-plate-view' }); + $formColumn.append($("<legend>").append("Plate")); + var plateController = new PlateController(this._sampleFormModel.sample); + plateController.init(plateContainer); + $formColumn.append(plateContainer); + } + + // // Storage // diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js new file mode 100644 index 0000000000000000000000000000000000000000..b9046a63aba805fdede7b6cbf926338e5331b773 --- /dev/null +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js @@ -0,0 +1,24 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function PlateController(sample) { + this._plateModel = new PlateModel(sample); + this._plateView = new PlateView(this, this._plateModel); + + this.init = function($container) { + this._plateView.repaint($container); + } +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateModel.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateModel.js new file mode 100644 index 0000000000000000000000000000000000000000..2f5248f941d82a261afa2991d5e1901dad8a744d --- /dev/null +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateModel.js @@ -0,0 +1,43 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +function PlateModel(sample) { + this.sample = sample; + + var getRowsAndColsFromPlateSample = function(sample) { + try { + var geometryProperty = sample.properties["PLATE_GEOMETRY"]; + var dimension = geometryProperty.substring(geometryProperty.lastIndexOf("_") + 1); + var rowsAndCols = dimension.split("X"); + rowsAndCols[0] = parseInt(rowsAndCols[0]); + rowsAndCols[1] = parseInt(rowsAndCols[1]); + return rowsAndCols; + } catch(err) { + alert("Property PLATE_GEOMETRY can't be parsed for " + sample.identifier); + } + return null; + } + + this.numRows = getRowsAndColsFromPlateSample(sample)[0]; + this.numColumns = getRowsAndColsFromPlateSample(sample)[1]; + + + this.getAlphabetLabel = function(number) { + var alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']; + return alphabet[number]; + } + +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js new file mode 100644 index 0000000000000000000000000000000000000000..52f1798e24d04933c9e1f0ad78a2e710af6e0133 --- /dev/null +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateView.js @@ -0,0 +1,44 @@ +/* + * Copyright 2014 ETH Zuerich, Scientific IT Services + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +function PlateView(plateController, plateModel) { + this._plateController = plateController; + this._plateModel = plateModel; + + this.repaint = function($container) { + var _this = this; + var gridTable = $("<table>", { "class" : "table table-bordered gridTable" }); + + for(var i = 0; i <= this._plateModel.numRows; i++) { + var $row = $("<tr>"); + for(var j = 0; j <= this._plateModel.numColumns; j++) { + var $cell = null; + if(i === 0 && j === 0) { //Empty cell at the top left + $cell = $("<th>"); + } else if (i === 0 && j !== 0){ //header with column numbers + $cell = $("<th>").append(j); + } else if (j === 0){ //header with row letter + $cell = $("<th>").append(this._plateModel.getAlphabetLabel(i-1)); + } else { + $cell = $("<td>"); + } + $row.append($cell); + } + gridTable.append($row); + } + + $container.append(gridTable); + } +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js index 1d81b36c814d33f7ddd9d8b1b978b41747b9d423..f83cbc2395a28bcabe3547d83a86b4a9688d5f24 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/StorageManager/widgets/GridView.js @@ -33,7 +33,7 @@ function GridView(gridModel) { this._getGridTable = function() { var _this = this; - var gridTable = $("<table>", { "class" : "storageTable" }); + var gridTable = $("<table>", { "class" : "table table-bordered gridTable" }); var $headerRow = $("<tr>"); var $emptyCell = $("<th>"); $headerRow.append($emptyCell);