[gatein-commits] gatein SVN: r470 - in portal/trunk: component/portal/src/main/java/org/exoplatform/portal/resource/config/xml and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Nov 1 20:58:21 EST 2009


Author: hoang_to
Date: 2009-11-01 20:58:21 -0500 (Sun, 01 Nov 2009)
New Revision: 470

Added:
   portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigParser.java
   portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptTask.java
Removed:
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java
Modified:
   portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptDeployer.java
   portal/trunk/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml
   portal/trunk/web/portal/src/main/webapp/WEB-INF/gatein-resources.xml
Log:
GTNPORTAL-131: Javascript deployment

Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java	2009-11-01 22:40:14 UTC (rev 469)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/tasks/JavascriptTask.java	2009-11-02 01:58:21 UTC (rev 470)
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.resource.config.tasks;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-
-import org.exoplatform.web.application.javascript.JavascriptConfigService;
-
-/**
- * @author <a href="mailto:hoang281283 at gmail.com">Minh Hoang TO</a>
- * @version $Id$
- *
- */
-public class JavascriptTask
-{
-   
-   private List<Parameter> parameters;
-   
-   public JavascriptTask(){
-      parameters = new ArrayList<Parameter>();
-   }
-   
-   public void execute(JavascriptConfigService service, ServletContext scontext){
-      for(Parameter param : parameters){
-         service.addJavascript(param.moduleName, param.scriptPath, scontext);
-      }
-   }
-   
-   public void addParam(String moduleName, String scriptPath){
-      parameters.add(new Parameter(moduleName, scriptPath));
-   }
-   
-   private class Parameter {
-      
-      private String moduleName;
-      private String scriptPath;
-      
-      Parameter(String _moduleName, String _scriptPath){
-         moduleName = _moduleName;
-         scriptPath = _scriptPath;
-      }     
-   }
-}

Deleted: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java	2009-11-01 22:40:14 UTC (rev 469)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/resource/config/xml/JavascriptConfigParser.java	2009-11-02 01:58:21 UTC (rev 470)
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.exoplatform.portal.resource.config.xml;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.ServletContext;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.exoplatform.portal.resource.config.tasks.JavascriptTask;
-import org.exoplatform.web.application.javascript.JavascriptConfigService;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * @author <a href="mailto:hoang281283 at gmail.com">Minh Hoang TO</a>
- * @version $Id$
- *
- */
-public class JavascriptConfigParser
-{
-
-   public static void processConfigResource(InputStream is, JavascriptConfigService service, ServletContext scontext){
-      List<JavascriptTask> tasks = fetchTasks(is);
-      if(tasks != null){
-         for(JavascriptTask task : tasks){
-            task.execute(service, scontext);
-         }
-      }
-   }
-   
-   private static List<JavascriptTask> fetchTasks(InputStream is)
-   {
-      try
-      {
-         DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-         Document document = docBuilder.parse(is);
-         return fetchTasksFromXMLConfig(document);
-      }
-      catch (Exception ex)
-      {
-         return null;
-      }
-   }
-   
-   private static List<JavascriptTask> fetchTasksFromXMLConfig(Document document){
-      List<JavascriptTask> tasks = new ArrayList<JavascriptTask>();
-      Element element = document.getDocumentElement();
-      NodeList nodes = element.getElementsByTagName(GateinResource.JAVA_SCRIPT_TAG);
-      
-      for(int i = nodes.getLength() - 1 ; i >= 0; i--){
-         JavascriptTask task = xmlToTask((Element)nodes.item(i));
-         if(task != null){
-            tasks.add(task);
-         }
-      }
-      return tasks;
-   }
-   
-   private static JavascriptTask xmlToTask(Element element){
-      try{
-         JavascriptTask task = new JavascriptTask();
-         NodeList nodes = element.getElementsByTagName(GateinResource.JAVA_SCRIPT_PARAM);
-         for(int i = nodes.getLength() - 1 ; i >= 0; i--){
-            Element param_ele = (Element)nodes.item(i);
-            task.addParam(param_ele.getFirstChild().getNodeValue(), param_ele.getLastChild().getNodeValue());
-         }
-         return task;
-      }catch(Exception ex){
-         return null;
-      }
-   }
-   
-   
-}

Added: portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigParser.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigParser.java	                        (rev 0)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptConfigParser.java	2009-11-02 01:58:21 UTC (rev 470)
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.web.application.javascript;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author <a href="mailto:hoang281283 at gmail.com">Minh Hoang TO</a>
+ * @version $Id$
+ *
+ */
+public class JavascriptConfigParser
+{
+
+   public static void processConfigResource(InputStream is, JavascriptConfigService service, ServletContext scontext){
+      List<JavascriptTask> tasks = fetchTasks(is);
+      if(tasks != null){
+         for(JavascriptTask task : tasks){
+            task.execute(service, scontext);
+         }
+      }
+   }
+   
+   private static List<JavascriptTask> fetchTasks(InputStream is)
+   {
+      try
+      {
+         DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+         Document document = docBuilder.parse(is);
+         return fetchTasksFromXMLConfig(document);
+      }
+      catch (Exception ex)
+      {
+         return null;
+      }
+   }
+   
+   private static List<JavascriptTask> fetchTasksFromXMLConfig(Document document){
+      List<JavascriptTask> tasks = new ArrayList<JavascriptTask>();
+      Element element = document.getDocumentElement();
+      //NodeList nodes = element.getElementsByTagName(GateinResource.JAVA_SCRIPT_TAG);
+      NodeList nodes = element.getElementsByTagName("javascript");
+      int length = nodes.getLength();
+      for(int i = 0; i < length; i++){
+         JavascriptTask task = xmlToTask((Element)nodes.item(i));
+         if(task != null){
+            tasks.add(task);
+         }
+      }
+      return tasks;
+   }
+   
+   private static JavascriptTask xmlToTask(Element element){
+      //if(!GateinResource.JAVA_SCRIPT_TAG.equals(element.getTagName())){
+      if(!"javascript".equals(element.getTagName())){
+         return null;
+      }
+      try{
+         JavascriptTask task = new JavascriptTask();
+         //NodeList nodes = element.getElementsByTagName(GateinResource.JAVA_SCRIPT_PARAM);
+         NodeList nodes = element.getElementsByTagName("param");
+         int length = nodes.getLength();
+         for(int i = 0; i < length ; i++){
+            Element param_ele = (Element)nodes.item(i);
+            String js_module = param_ele.getElementsByTagName("js-module").item(0).getFirstChild().getNodeValue();
+            String js_path = param_ele.getElementsByTagName("js-path").item(0).getFirstChild().getNodeValue();
+            task.addParam(js_module, js_path);
+         }
+         return task;
+      }catch(Exception ex){
+         ex.printStackTrace();
+         return null;
+      }
+   }   
+}

Modified: portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptDeployer.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptDeployer.java	2009-11-01 22:40:14 UTC (rev 469)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptDeployer.java	2009-11-02 01:58:21 UTC (rev 470)
@@ -88,8 +88,8 @@
             {
                scontext = event.getWebApp().getServletContext();
 
-               InputStream is = scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/JavascriptScript.groovy");
-               //InputStream is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
+               //InputStream is = scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/JavascriptScript.groovy");
+               InputStream is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
                if (is == null)
                   return;
                try
@@ -124,15 +124,16 @@
       InputStream is = null;
       try
       {
-         is = scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/JavascriptScript.groovy");
-         //is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
-         Binding binding = new Binding();
+         //is = scontext.getResourceAsStream("/WEB-INF/conf/script/groovy/JavascriptScript.groovy");
+         is = scontext.getResourceAsStream(GATEIN_CONFIG_RESOURCE);
+         /*Binding binding = new Binding();
          binding.setVariable("JavascriptService", javascriptService);
          binding.setVariable("ServletContext", scontext);
          binding.setVariable("ServletContextName", scontext.getServletContextName());
          binding.setVariable("PortalContainerName", container.getName());
          GroovyShell shell = new GroovyShell(binding);
-         shell.evaluate(is);
+         shell.evaluate(is);*/
+         JavascriptConfigParser.processConfigResource(is, javascriptService, scontext);
       }
       catch (Exception ex)
       {

Added: portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptTask.java
===================================================================
--- portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptTask.java	                        (rev 0)
+++ portal/trunk/component/web/src/main/java/org/exoplatform/web/application/javascript/JavascriptTask.java	2009-11-02 01:58:21 UTC (rev 470)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.exoplatform.web.application.javascript;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+
+
+/**
+ * @author <a href="mailto:hoang281283 at gmail.com">Minh Hoang TO</a>
+ * @version $Id$
+ *
+ */
+public class JavascriptTask
+{
+   
+   private List<Parameter> parameters;
+   
+   public JavascriptTask(){
+      parameters = new ArrayList<Parameter>();
+   }
+   
+   public void execute(JavascriptConfigService service, ServletContext scontext){
+      for(Parameter param : parameters){
+         service.addJavascript(param.moduleName, param.scriptPath, scontext);
+      }
+   }
+   
+   public void addParam(String moduleName, String scriptPath){
+      parameters.add(new Parameter(moduleName, scriptPath));
+   }
+   
+   private class Parameter {
+      
+      private String moduleName;
+      private String scriptPath;
+      
+      Parameter(String _moduleName, String _scriptPath){
+         moduleName = _moduleName;
+         scriptPath = _scriptPath;
+      }     
+   }
+}

Modified: portal/trunk/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
--- portal/trunk/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml	2009-11-01 22:40:14 UTC (rev 469)
+++ portal/trunk/web/eXoResources/src/main/webapp/WEB-INF/gatein-resources.xml	2009-11-02 01:58:21 UTC (rev 470)
@@ -112,4 +112,79 @@
 		</style-theme>
 	</window-style>
 	
+	<javascript>
+		<param>
+			<js-module>eXo</js-module>
+			<js-path>/javascript/eXo.js</js-path>
+		</param>
+	</javascript>
+
+<!-- CORE Javascripts -->
+<javascript>
+<param><js-module>eXo.core.Utils</js-module><js-path>/javascript/eXo/core/Util.js</js-path></param>
+<param><js-module>eXo.core.DOMUtil</js-module><js-path>/javascript/eXo/core/DOMUtil.js</js-path></param>
+<param><js-module>eXo.core.Browser</js-module><js-path>/javascript/eXo/core/Browser.js</js-path></param>
+<param><js-module>eXo.core.MouseEventManager</js-module><js-path>/javascript/eXo/core/MouseEventManager.js</js-path></param>
+<param><js-module>eXo.core.UIMaskLayer</js-module><js-path>/javascript/eXo/core/UIMaskLayer.js</js-path></param>
+<param><js-module>eXo.core.Skin</js-module><js-path>/javascript/eXo/core/Skin.js</js-path></param>
+<param><js-module>eXo.core.DragDrop</js-module><js-path>/javascript/eXo/core/DragDrop.js</js-path></param>
+<param><js-module>eXo.core.DragDrop2</js-module><js-path>/javascript/eXo/core/DragDrop2.js</js-path></param>
+<param><js-module>eXo.core.Topic</js-module><js-path>/javascript/eXo/core/Topic.js</js-path></param>
+<param><js-module>eXo.core.JSON</js-module><js-path>/javascript/eXo/core/JSON.js</js-path></param>
+<param><js-module>eXo.core.Cometd</js-module><js-path>/javascript/eXo/core/Cometd.js</js-path></param>
+<param><js-module>eXo.core.Spliter</js-module><js-path>/javascript/eXo/core/Spliter.js</js-path></param>
+<param><js-module>eXo.core.Notification</js-module><js-path>/javascript/eXo/core/Notification.js</js-path></param>
+<param><js-module>eXo.core.Loader</js-module><js-path>/javascript/eXo/core/Loader.js</js-path></param>
+<param><js-module>eXo.core.I18n</js-module><js-path>/javascript/eXo/core/I18n.js</js-path></param>
+</javascript>
+
+<!-- Gadget Javascripts -->
+<javascript>
+	<param>
+	<js-module>eXo.gadget.UIGadget</js-module>
+	<js-path>/javascript/eXo/gadget/UIGadget.js</js-path>
+	</param>
+</javascript>
+
+<!-- WebUI Javascripts -->
+<javascript> 
+<param><js-module>eXo.webui.UIItemSelector</js-module><js-path>/javascript/eXo/webui/UIItemSelector.js</js-path></param>
+<param><js-module>eXo.webui.UIForm</js-module><js-path>/javascript/eXo/webui/UIForm.js</js-path></param>
+<param><js-module>eXo.webui.UIPopup</js-module><js-path>/javascript/eXo/webui/UIPopup.js</js-path></param>
+<param><js-module>eXo.webui.UIPopupSelectCategory</js-module><js-path>/javascript/eXo/webui/UIPopupSelectCategory.js</js-path></param>
+<param><js-module>eXo.webui.UIPopupWindow</js-module><js-path>/javascript/eXo/webui/UIPopupWindow.js</js-path></param>
+<param><js-module>eXo.webui.UIHorizontalTabs</js-module><js-path>/javascript/eXo/webui/UIHorizontalTabs.js</js-path></param>
+<param><js-module>eXo.webui.UIPopupMenu</js-module><js-path>/javascript/eXo/webui/UIPopupMenu.js</js-path></param>
+<param><js-module>eXo.webui.UIDropDownControl</js-module><js-path>/javascript/eXo/webui/UIDropDownControl.js</js-path></param>
+<param><js-module>eXo.webui.UIRightClickPopupMenu</js-module><js-path>/javascript/eXo/webui/UIRightClickPopupMenu.js</js-path></param>
+<param><js-module>eXo.webui.UIVerticalSlideTabs</js-module><js-path>/javascript/eXo/webui/UIVerticalSlideTabs.js</js-path></param>
+<param><js-module>eXo.webui.UIPermissionSelectorTab</js-module><js-path>/javascript/eXo/webui/UIPermissionSelectorTab.js</js-path></param>
+<param><js-module>eXo.webui.UIDashboard</js-module><js-path>/javascript/eXo/webui/UIDashboard.js</js-path></param>
+<param><js-module>eXo.webui.UIDashboardUtil</js-module><js-path>/javascript/eXo/webui/UIDashboardUtil.js</js-path></param>
+<param><js-module>eXo.webui.UINotification</js-module><js-path>/javascript/eXo/webui/UINotification.js</js-path></param>
+<param><js-module>eXo.webui.UIUserSelector</js-module><js-path>/javascript/eXo/webui/UIUserSelector.js</js-path></param>
+<param><js-module>eXo.webui.UICombobox</js-module><js-path>/javascript/eXo/webui/UICombobox.js</js-path></param>
+<param><js-module>eXo.webui.UICombobox</js-module><js-path>/javascript/eXo/webui/UIVirtualList.js</js-path></param>
+<param><js-module>eXo.webui.UIColorPicker</js-module><js-path>/javascript/eXo/webui/UIColorPicker.js</js-path></param>
+</javascript>
+
+<!-- Portal Javascripts -->
+<javascript>
+	<param><js-module>eXo.portal.PortalHttpRequest</js-module><js-path>/javascript/eXo/portal/PortalHttpRequest.js</js-path></param>
+	<param><js-module>eXo.portal.UIPortal</js-module><js-path>/javascript/eXo/portal/UIPortal.js</js-path></param>
+	<param><js-module>eXo.portal.UIWorkspace</js-module><js-path>/javascript/eXo/portal/UIWorkspace.js</js-path></param>
+	<param><js-module>eXo.portal.UIPortalControl</js-module><js-path>/javascript/eXo/portal/UIPortalControl.js</js-path></param>
+	<param><js-module>eXo.portal.PortalDragDrop</js-module><js-path>/javascript/eXo/portal/PortalDragDrop.js</js-path></param>
+	<param><js-module>eXo.portal.UIPortalNavigation</js-module><js-path>/javascript/eXo/portal/UIPortalNavigation.js</js-path></param>
+	<param><js-module>eXo.portal.UIPortalNavigation2</js-module><js-path>/javascript/eXo/portal/UIPortalNavigation2.js</js-path></param>
+	<param><js-module>eXo.portal.UIMaskWorkspace</js-module><js-path>/javascript/eXo/portal/UIMaskWorkspace.js</js-path></param>
+	<param><js-module>eXo.portal.UIBrowseContent</js-module><js-path>/javascript/eXo/portal/UIBrowseContent.js</js-path></param>
+</javascript>
+
+<javascript>
+	<param>
+		<js-module>eXo.webui.UIPortlet</js-module>
+		<js-path>/javascript/eXo/webui/UIPortlet.js</js-path>
+	</param>
+</javascript>
 </gatein-resources>

Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/gatein-resources.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/gatein-resources.xml	2009-11-01 22:40:14 UTC (rev 469)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/gatein-resources.xml	2009-11-02 01:58:21 UTC (rev 470)
@@ -32,5 +32,12 @@
 		<css-path>/templates/skin/webui/component/UIHomePagePortlet/DefaultStylesheet.css</css-path>
 	</portlet-skin>
 	
+	<!-- External libraries -->
+	<javascript>
+		<param>
+			<js-module>FCKEditor</js-module>
+			<js-path>/fckeditor/fckeditor.js</js-path>
+		</param>
+	</javascript>
 </gatein-resources>
 



More information about the gatein-commits mailing list