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 dc7255c155c122f767000dbfd9a4cb6fa1920f86..a2e09644f561e136e49a0016805e4b10db9c98ac 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 @@ -171,6 +171,10 @@ <script type="text/javascript" src="./js/views/legacy/SampleLinksWidget.js"></script> <script type="text/javascript" src="./js/views/legacy/SampleHierarchy.js"></script> + <script type="text/javascript" src="./js/views/DrawingBoards/DrawingBoardsController.js"></script> + <script type="text/javascript" src="./js/views/DrawingBoards/DrawingBoardsModel.js"></script> + <script type="text/javascript" src="./js/views/DrawingBoards/DrawingBoardsView.js"></script> + <script type="text/javascript"> // // Configurations Available (Available under the js/config folder) diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js index a5c1cf2feb80096ef2f1ff0f0bbbc1e0a1859e39..58b03d4d0538702da37d7dab1dc3a4349c1e8aaa 100644 --- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/controllers/MainController.js @@ -411,30 +411,9 @@ function MainController(profile) { } this._showDrawingBoard = function() { - var mainContainer = $("#mainContainer"); - mainContainer.empty(); - - var containerWidth = $(document).width() - $("#sideMenu").width() - 20; - var containerHeight = $(document).height() - 60; - - var $drawingboard = $("<div>", { "id" : "scratchboard", "style" : "width: " + containerWidth + "px; height: " + containerHeight + "px; padding: 10px;" }); - mainContainer.append($drawingboard); - - //pass options and add custom controls to a board - var customBoard = new DrawingBoard.Board('scratchboard', { - background: "#ffffff", - color: "#000", - webStorage: false, - size: 30, - controls: [ - { Size: { type: "dropdown" } }, - { Navigation: { back: false, forward: false } }, - 'DrawingMode', - 'Color', - 'Download' - ], - webStorage: 'local' - }); + var drawingBoardsController = new DrawingBoardsController(this); + drawingBoardsController.init($("#mainContainer")); + this.currentView = drawingBoardsController; } this._showUserManager = function() { diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DrawingBoards/DrawingBoardsController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DrawingBoards/DrawingBoardsController.js new file mode 100644 index 0000000000000000000000000000000000000000..0d306e5564e54533566d706443cadbfefcf4fa21 --- /dev/null +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DrawingBoards/DrawingBoardsController.js @@ -0,0 +1,25 @@ +/* + * 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 DrawingBoardsController(mainController) { + this._mainController = mainController; + this._drawingBoardsModel = new DrawingBoardsModel(); + this._drawingBoardsView = new DrawingBoardsView(this, this._drawingBoardsModel); + + this.init = function($container) { + this._drawingBoardsView.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/DrawingBoards/DrawingBoardsModel.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DrawingBoards/DrawingBoardsModel.js new file mode 100644 index 0000000000000000000000000000000000000000..dede9b4375ded34dd94b8a426cc81b65eac4b8d9 --- /dev/null +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DrawingBoards/DrawingBoardsModel.js @@ -0,0 +1,19 @@ +/* + * 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 DrawingBoardsModel() { + +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DrawingBoards/DrawingBoardsView.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DrawingBoards/DrawingBoardsView.js new file mode 100644 index 0000000000000000000000000000000000000000..ad4fcab3a569fde1cfd38778fcc7270895203e4b --- /dev/null +++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/DrawingBoards/DrawingBoardsView.js @@ -0,0 +1,53 @@ +/* + * 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 DrawingBoardsView(drawingBoardsController, drawingBoardsModel) { + this._drawingBoardsController = drawingBoardsController; + this._drawingBoardsModel = drawingBoardsModel; + + this.repaint = function($container) { + $container.empty(); + var $wrapper = $('<form>', { class : 'form-horizontal ', 'id' : 'mainDataSetForm', 'role' : 'form'}); + var $title = $('<h2>').append('Drawing Board'); + $wrapper.append($title); + var $createNewBtn = FormUtil.getButtonWithText('New Drawing Board', function() { + $container.empty(); + + var containerWidth = $(document).width() - $("#sideMenu").width() - 20; + var containerHeight = $(document).height() - 60; + + var $drawingboard = $("<div>", { "id" : "scratchboard", "style" : "width: " + containerWidth + "px; height: " + containerHeight + "px; padding: 10px;" }); + $container.append($drawingboard); + + //pass options and add custom controls to a board + var customBoard = new DrawingBoard.Board('scratchboard', { + background: "#ffffff", + color: "#000", + webStorage: false, + size: 30, + controls: [ + { Size: { type: "dropdown" } }, + { Navigation: { back: false, forward: false } }, + 'DrawingMode', + 'Color', + 'Download' + ] + }); + }); + $wrapper.append($createNewBtn); + $container.append($wrapper); + } +} \ No newline at end of file