Author: taylor
Date: Tue Jun 27 17:44:07 2006
New Revision: 417626

URL: http://svn.apache.org/viewvc?rev=417626&view=rev
Log:
fix to security permission portlet to work with new dojo

Modified:
    
portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java
    
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java

Modified: 
portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java?rev=417626&r1=417625&r2=417626&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java
 (original)
+++ 
portals/jetspeed-2/trunk/applications/gems/src/java/org/apache/portals/gems/file/FilePortlet.java
 Tue Jun 27 17:44:07 2006
@@ -16,15 +16,16 @@
 package org.apache.portals.gems.file;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import javax.portlet.PortletConfig;
 import javax.portlet.PortletException;
+import javax.portlet.PortletPreferences;
 import javax.portlet.RenderRequest;
 import javax.portlet.RenderResponse;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletPreferences;
 
 import org.apache.jetspeed.PortalReservedParameters;
 import org.apache.portals.bridges.common.GenericServletPortlet;
@@ -53,7 +54,13 @@
      */
     public static final String PARAM_SOURCE_FILE_PATH = "filepath";
 
-
+    /**
+     * Is the file stored in the webapp or outside of the webapp?
+     * valid values "webapp" and "filesystem", defaults to webapp
+     */
+    public static final String PARAM_LOCATION = "location";
+    private boolean webappLocation = true;
+    
     /**
      * Default URL for the source file
      */
@@ -70,6 +77,11 @@
         super.init(config);
         this.defaultSourceFile = config.getInitParameter(PARAM_SOURCE_FILE);
         this.defaultSourceBasePath = 
config.getInitParameter(PARAM_SOURCE_BASE_PATH);
+        String location = config.getInitParameter(PARAM_LOCATION);
+        if (location != null && location.equals("filesystem"))
+            webappLocation = false;
+        else
+            webappLocation = true;
     }
 
 
@@ -106,9 +118,11 @@
         else
         {
             // default to 'content' area
-            File temp = new File(path);             
-            path = "/WEB-INF/" + temp.getPath();            
-
+            File temp = new File(path);
+            if (webappLocation)
+            {
+                path = "/WEB-INF/" + temp.getPath();            
+            }
             setContentType(path, response);        
             renderFile(response, path);
         }        
@@ -146,7 +160,16 @@
     protected void renderFile(RenderResponse response, String fileName)
     throws PortletException, IOException
     {
-        InputStream is = 
this.getPortletContext().getResourceAsStream(fileName);
+        InputStream is = null;
+        
+        if (this.webappLocation)
+        {
+            is = this.getPortletContext().getResourceAsStream(fileName);
+        }
+        else
+        {
+            is = new FileInputStream(fileName);
+        }
         if (is == null)
         {
             byte [] bytes = ("File " + fileName + " not found.").getBytes();

Modified: 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
URL: 
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java?rev=417626&r1=417625&r2=417626&view=diff
==============================================================================
--- 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
 (original)
+++ 
portals/jetspeed-2/trunk/applications/j2-admin/src/java/org/apache/jetspeed/portlets/security/permissions/SecurityPermissionsPortlet.java
 Tue Jun 27 17:44:07 2006
@@ -83,19 +83,40 @@
                 "Could not get instance of portal role manager component");    
    
     }
 
+
+    /*              
+      
+        // detect jetspeed-desktop
+        String requestEncoder = 
(String)requestContext.getRequest().getParameter("encoder");
+
+        boolean isJetspeedDesktop = ((requestEncoder == null) || 
!requestEncoder.equals("desktop")) ? false : true;
+
+
+    */
+
     protected void includeDojoRequires(StringBuffer headerInfoText)
     {
         appendHeaderText(headerInfoText, "dojo.lang.*");
         appendHeaderText(headerInfoText, "dojo.event.*");
         appendHeaderText(headerInfoText, "dojo.io");
+    }
+    protected void includeDojoWidgetRequires(StringBuffer headerInfoText)
+    {
+        super.includeDojoWidgetRequires(headerInfoText);
+        appendHeaderText(headerInfoText, "dojo.widget.Manager");
         appendHeaderText(headerInfoText, "dojo.widget.LayoutContainer");
         appendHeaderText(headerInfoText, "dojo.widget.ContentPane");
-        appendHeaderText(headerInfoText, "dojo.widget.LinkPane");
         appendHeaderText(headerInfoText, "dojo.widget.SplitContainer");
         appendHeaderText(headerInfoText, "dojo.widget.TabContainer");
-        appendHeaderText(headerInfoText, "dojo.widget.Tree");
-        appendHeaderText(headerInfoText, "dojo.widget.SortableTable");
         appendHeaderText(headerInfoText, "dojo.widget.Checkbox");
+        appendHeaderText(headerInfoText, "dojo.widget.Dialog");
+        appendHeaderText(headerInfoText, "dojo.widget.Button");
+        appendHeaderText(headerInfoText, "dojo.widget.Menu2");
+    }
+    protected void includeDojoCustomWidgetRequires(StringBuffer headerInfoText)
+    {
+        super.includeDojoCustomWidgetRequires(headerInfoText);
+        appendHeaderText(headerInfoText, "jetspeed.ui.widget.EditorTable");
     }
     
     public void doView(RenderRequest request, RenderResponse response)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to