From f12f5af2221919e5b2dfb512a4c70e4b35eedb8f Mon Sep 17 00:00:00 2001
From: buczekp <buczekp>
Date: Tue, 11 Jan 2011 15:04:54 +0000
Subject: [PATCH] [LMS-1949] minor: introduce Script submenu in Administration
 menu

SVN: 19364
---
 .../client/web/client/application/Dict.java   |  4 ++
 .../framework/ComponentProvider.java          |  2 +-
 .../web/client/application/menu/TopMenu.java  |  4 +-
 .../administration/AdministrationMenu.java    |  5 +-
 .../menu/administration/ScriptMenu.java       | 47 +++++++++++++++++++
 .../cisd/openbis/public/common-dictionary.js  |  6 ++-
 6 files changed, 62 insertions(+), 6 deletions(-)
 create mode 100644 openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/administration/ScriptMenu.java

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
index 02206c53111..cb09d15b4c2 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/Dict.java
@@ -382,6 +382,8 @@ public abstract class Dict
 
     public static final String MANAGED = "managed";
 
+    public static final String SCRIPTABLE = "scriptable";
+
     public static final String SECTION_TOOLTIP = "section_tooltip";
 
     public static final String DEFAULT_VALUE = "default_value";
@@ -555,6 +557,8 @@ public abstract class Dict
 
     public static final String MENU_VOCABULARY = "menu_vocabulary";
 
+    public static final String MENU_SCRIPT = "menu_script";
+
     public static final String MENU_DATA_SET = "menu_data_set";
 
     public static final String MENU_EXPERIMENT = "menu_experiment";
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/ComponentProvider.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/ComponentProvider.java
index 5d5c782ef9c..5f89276d4bc 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/ComponentProvider.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/framework/ComponentProvider.java
@@ -846,7 +846,7 @@ public final class ComponentProvider
                 {
                     Component component =
                             ScriptRegistrationForm.create(viewContext, entityKindOrNull);
-                    return DefaultTabItem.createUnaware(getTabTitle(), component, true);
+                    return createSimpleTab(getTabTitle(), component, true);
                 }
 
                 @Override
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/TopMenu.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/TopMenu.java
index 328612bb57a..d9ff1ecf5c7 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/TopMenu.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/TopMenu.java
@@ -50,7 +50,7 @@ public class TopMenu extends LayoutContainer
     /** {@link ActionMenu} kind enum with names matching dictionary keys */
     public static enum ActionMenuKind implements IActionMenuItem
     {
-        ADMINISTRATION_MENU_MANAGE_GROUPS, ADMINISTRATION_MENU_SCRIPTS,
+        ADMINISTRATION_MENU_MANAGE_GROUPS,
 
         AUTHORIZATION_MENU_USERS, AUTHORIZATION_MENU_ROLES,
         AUTHORIZATION_MENU_AUTHORIZATION_GROUPS,
@@ -68,6 +68,8 @@ public class TopMenu extends LayoutContainer
         SAMPLE_MENU_SEARCH, SAMPLE_MENU_BROWSE, SAMPLE_MENU_NEW, SAMPLE_MENU_IMPORT,
         SAMPLE_MENU_MASS_UPDATE, SAMPLE_MENU_TYPES,
 
+        SCRIPT_MENU_BROWSE, SCRIPT_MENU_NEW,
+
         PROJECT_MENU_BROWSE, PROJECT_MENU_NEW,
 
         PROPERTY_TYPES_MENU_BROWSE_PROPERTY_TYPES, PROPERTY_TYPES_MENU_BROWSE_ASSIGNMENTS,
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/administration/AdministrationMenu.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/administration/AdministrationMenu.java
index 26ec065d10b..e20df7990c3 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/administration/AdministrationMenu.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/administration/AdministrationMenu.java
@@ -47,11 +47,10 @@ public class AdministrationMenu extends TopMenuItem
         submenu.add(new ProjectMenu(messageProvider, componentProvider));
         submenu.add(new VocabularyMenu(messageProvider, componentProvider));
         submenu.add(new PropertyTypesMenu(messageProvider, componentProvider));
+        submenu.add(new ScriptMenu(messageProvider, componentProvider));
+        submenu.add(new AuthorizationMenu(messageProvider, componentProvider));
         submenu.add(new ActionMenu(TopMenu.ActionMenuKind.DATA_SET_MENU_FILE_FORMATS,
                 messageProvider, componentProvider.getFileFormatTypeBrowser()));
-        submenu.add(new ActionMenu(TopMenu.ActionMenuKind.ADMINISTRATION_MENU_SCRIPTS,
-                messageProvider, componentProvider.getScriptBrowser()));
-        submenu.add(new AuthorizationMenu(messageProvider, componentProvider));
         if (viewContext.isLoggingEnabled())
         {
             submenu.add(new ActionMenu(TopMenu.ActionMenuKind.LOGGING_CONSOLE, messageProvider,
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/administration/ScriptMenu.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/administration/ScriptMenu.java
new file mode 100644
index 00000000000..bf12a54506b
--- /dev/null
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/client/web/client/application/menu/administration/ScriptMenu.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009 ETH Zuerich, CISD
+ *
+ * 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.
+ */
+
+package ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.administration;
+
+import com.extjs.gxt.ui.client.widget.menu.Menu;
+import com.extjs.gxt.ui.client.widget.menu.MenuItem;
+
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.Dict;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.framework.ComponentProvider;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.ActionMenu;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.menu.TopMenu;
+import ch.systemsx.cisd.openbis.generic.client.web.client.application.util.IMessageProvider;
+
+/**
+ * Script top submenu.
+ * 
+ * @author Piotr Buczek
+ */
+public class ScriptMenu extends MenuItem
+{
+
+    public ScriptMenu(IMessageProvider messageProvider, ComponentProvider componentProvider)
+    {
+        super(messageProvider.getMessage(Dict.MENU_SCRIPT));
+
+        Menu menu = new Menu();
+        menu.add(new ActionMenu(TopMenu.ActionMenuKind.SCRIPT_MENU_BROWSE, messageProvider,
+                componentProvider.getScriptBrowser()));
+        menu.add(new ActionMenu(TopMenu.ActionMenuKind.SCRIPT_MENU_NEW, messageProvider,
+                componentProvider.getScriptRegistration(null)));
+        setSubMenu(menu);
+    }
+}
diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
index 0b6e2bc6fed..e2cd9b58d85 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/public/common-dictionary.js
@@ -286,6 +286,7 @@ var common = {
   is_dynamic: "Dynamic?",
   is_managed: "Managed?",
   script: "Script",
+  scriptable: "Handled by Script",
   unassign_button_label: "Release Assignment",
   unassignment_confirmation_dialog_title: "Unassignment Confirmation",
   unassignment_confirmation_template_without_properties: "Removing assignment between {0} type {1} and property type {2}. This can be safely done because no {0} has this property filled in.<br><br>Do you want to remove the assignment?",
@@ -349,6 +350,10 @@ var common = {
   PROPERTY_TYPES_MENU_ASSIGN_TO_MATERIAL_TYPE: "Assign To Material Type",
   PROPERTY_TYPES_MENU_ASSIGN_TO_DATA_SET_TYPE: "Assign To Data Set Type", 
   
+  menu_script: "Script",
+  SCRIPT_MENU_BROWSE: "Browse",
+  SCRIPT_MENU_NEW: "New",
+
   menu_vocabulary: "Vocabulary",
   VOCABULARY_MENU_BROWSE: "Browse",
   VOCABULARY_MENU_NEW: "New",
@@ -713,7 +718,6 @@ add_script_title: "Add a new script",
 title_choose_script: "Choose a {0} Script",
 script_browser: "Scripts",
 script_type: "Script Type",
-ADMINISTRATION_MENU_SCRIPTS: "Scripts",
 script_registration: "Script Registration",
 evaluation_result: "Evaluation Result",
 script_tester: "Script Tester",
-- 
GitLab