diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/index.html b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/index.html index 93d2d1ceb596b032b8054ae33033721e4faad0db..fd2c2934c9186ede407bbf411b3bd78a273caeb1 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/index.html +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/index.html @@ -104,6 +104,11 @@ <script type="text/javascript" src="./js/views/Examine/ExamineModel.js"></script> <script type="text/javascript" src="./js/views/Examine/ExamineView.js"></script> --> + + <script type="text/javascript" src="./js/views/SpaceForm/SpaceFormController.js"></script> + <script type="text/javascript" src="./js/views/SpaceForm/SpaceFormModel.js"></script> + <script type="text/javascript" src="./js/views/SpaceForm/SpaceFormView.js"></script> + <script type="text/javascript" src="./js/views/ProjectForm/ProjectFormController.js"></script> <script type="text/javascript" src="./js/views/ProjectForm/ProjectFormModel.js"></script> <script type="text/javascript" src="./js/views/ProjectForm/ProjectFormView.js"></script> diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js index be8d37f0d6a07d07829ad0afee2feef297d8f082..0044ac9fbe7e7bf0c53d881aaba2336d673bad56 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/controllers/MainController.js @@ -186,6 +186,14 @@ function MainController(profile) { this._showSearchPage(arg); window.scrollTo(0,0); break; + case "showSpacePage": + var _this = this; + this.serverFacade.getSpaceFromCode(arg, function(space) { + document.title = "Space " + space.code; + _this._showSpacePage(space); + window.scrollTo(0,0); + }); + break; case "showProjectPageFromIdentifier": var _this = this; this.serverFacade.getProjectFromIdentifier(arg, function(project) { @@ -406,6 +414,13 @@ function MainController(profile) { }); } + this._showSpacePage = function(space) { + //Show Form + var spaceFormController = new SpaceFormController(this, space); + spaceFormController.init($("#mainContainer")); + this.currentView = spaceFormController; + } + this._showCreateProjectPage = function(spaceCode) { //Show Form var projectFormController = new ProjectFormController(this, FormMode.CREATE, {spaceCode : spaceCode}); diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js index 0331c28568c2177abc2525c322332a48aa46594a..652f9c4b23279e8ea2536f808bdbe7bbd6308ff9 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/server/ServerFacade.js @@ -65,6 +65,16 @@ function ServerFacade(openbisServer) { this.openbisServer.listSpacesWithProjectsAndRoleAssignments(somethingOrNull, callbackFunction); } + this.getSpaceFromCode = function(spaceCode, callbackFunction) { + this.openbisServer.listSpacesWithProjectsAndRoleAssignments(null, function(data) { + data.result.forEach(function(space){ + if(space.code === spaceCode) { + callbackFunction(space); + } + }); + }); + } + this.listExperiments = function(projects, callbackFunction) { this.openbisServer.listExperiments(projects, null, callbackFunction); } diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormController.js new file mode 100644 index 0000000000000000000000000000000000000000..cc6e4c4bcb2b65ed7bef82a593e339509c4fbf1f --- /dev/null +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormController.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 SpaceFormController(mainController, space) { + this._mainController = mainController; + this._spaceFormModel = new SpaceFormModel(space); + this._spaceFormView = new SpaceFormView(this, this._spaceFormModel); + + this.init = function($container) { + this._spaceFormView.repaint($container); + } +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormModel.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormModel.js new file mode 100644 index 0000000000000000000000000000000000000000..6d01ebb7f20412e12b38fd28fbfa6a77e6120e41 --- /dev/null +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormModel.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 SpaceFormModel(space) { + this.space = space; +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormView.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormView.js new file mode 100644 index 0000000000000000000000000000000000000000..4201534fc4d66af9a26f9dd8e73f17dfda6da7b3 --- /dev/null +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SpaceForm/SpaceFormView.js @@ -0,0 +1,35 @@ +/* + * 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 SpaceFormView(spaceFormController, spaceFormModel) { + this._spaceFormController = spaceFormController; + this._spaceFormModel = spaceFormModel; + + this.repaint = function($container) { + var _this = this; + $container.empty(); + + var $form = $("<div>", { "class" : "form-horizontal row"}); + var $formColumn = $("<div>", { "class" : FormUtil.formColumClass }); + + $form.append($formColumn); + + var $formTitle = $("<h2>").append("Space " + this._spaceFormModel.space.code); + $formColumn.append($formTitle); + + $container.append($form); + } +} \ No newline at end of file diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SideMenuWidget.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SideMenuWidget.js index 8eeec787aa357c09cfe39a5b627f1d36d7f93e50..8ca10dba2639e5479979c999b4163834471cece0 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SideMenuWidget.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/widgets/SideMenuWidget.js @@ -158,7 +158,7 @@ function SideMenuWidget(mainController, containerId, serverFacade) { var newMenuIfSelectedSpace = { children : [] } - var menuItemSpace = new SideMenuWidgetComponent(true, false, space.code, _this._menuStructure, newMenuIfSelectedSpace, 'showBlancPage', null, "(Space)"); + var menuItemSpace = new SideMenuWidgetComponent(true, false, space.code, _this._menuStructure, newMenuIfSelectedSpace, 'showSpacePage', space.code, "(Space)"); _this._menuStructure.newMenuIfSelected.children.push(menuItemSpace); //Fill Projects