portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From morci...@apache.org
Subject cvs commit: jakarta-jetspeed/webapp/WEB-INF/templates/vm/controllers/html multicolumn-customize.vm
Date Thu, 12 May 2005 18:15:59 GMT
morciuch    2005/05/12 11:15:59

  Modified:    src/java/org/apache/jetspeed/modules/actions/controllers
                        MultiColumnControllerAction.java
               src/java/org/apache/jetspeed/modules/parameters
                        RegistryEntryListBox.java
               webapp/WEB-INF/conf admin.xreg
               webapp/WEB-INF/templates/vm/controllers/html
                        multicolumn-customize.vm
  Log:
  Added ability to change portlet security ref and skin in portlet set customizer (see issue
http://issues.apache.org/jira/browse/JS1-546)
  
  Revision  Changes    Path
  1.35      +89 -24    jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java
  
  Index: MultiColumnControllerAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controllers/MultiColumnControllerAction.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- MultiColumnControllerAction.java	12 Apr 2005 22:55:27 -0000	1.34
  +++ MultiColumnControllerAction.java	12 May 2005 18:15:59 -0000	1.35
  @@ -17,47 +17,44 @@
   package org.apache.jetspeed.modules.actions.controllers;
   
   // Jetspeed stuff
  -import org.apache.jetspeed.om.registry.PortletEntry;
  -import org.apache.jetspeed.om.profile.IdentityElement;
  +import java.util.ArrayList;
  +import java.util.Collections;
  +import java.util.Enumeration;
  +import java.util.HashMap;
  +import java.util.Iterator;
  +import java.util.List;
  +import java.util.Map;
  +import java.util.StringTokenizer;
  +import java.util.Vector;
  +
  +import org.apache.jetspeed.om.BaseSecurityReference;
   import org.apache.jetspeed.om.profile.Entry;
  -import org.apache.jetspeed.om.profile.psml.PsmlControl;
  -import org.apache.jetspeed.om.profile.MetaInfo;
  +import org.apache.jetspeed.om.profile.IdentityElement;
   import org.apache.jetspeed.om.profile.Layout;
  +import org.apache.jetspeed.om.profile.MetaInfo;
   import org.apache.jetspeed.om.profile.Parameter;
   import org.apache.jetspeed.om.profile.Portlets;
   import org.apache.jetspeed.om.profile.Reference;
  -import org.apache.jetspeed.om.profile.psml.PsmlParameter;
  +import org.apache.jetspeed.om.profile.psml.PsmlControl;
   import org.apache.jetspeed.om.profile.psml.PsmlLayout;
  +import org.apache.jetspeed.om.profile.psml.PsmlParameter;
  +import org.apache.jetspeed.om.profile.psml.PsmlSkin;
  +import org.apache.jetspeed.om.registry.PortletEntry;
   import org.apache.jetspeed.portal.Portlet;
  -import org.apache.jetspeed.portal.PortletSet;
   import org.apache.jetspeed.portal.PortletController;
  +import org.apache.jetspeed.portal.PortletSet;
  +import org.apache.jetspeed.services.PsmlManager;
  +import org.apache.jetspeed.services.Registry;
   import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.services.resources.JetspeedResources;
   import org.apache.jetspeed.services.rundata.JetspeedRunData;
  -import org.apache.jetspeed.services.Registry;
   import org.apache.jetspeed.services.statemanager.SessionState;
  -import org.apache.jetspeed.services.PsmlManager;
  -
  -// Turbine stuff
   import org.apache.turbine.modules.ActionLoader;
   import org.apache.turbine.util.RunData;
  -
  -// Velocity Stuff
   import org.apache.velocity.context.Context;
   
  -// Java stuff
  -import java.util.ArrayList;
  -import java.util.Collections;
  -import java.util.Vector;
  -import java.util.List;
  -import java.util.Enumeration;
  -import java.util.Iterator;
  -import java.util.Map;
  -import java.util.HashMap;
  -import java.util.StringTokenizer;
  -
   /**
    * This action builds a context suitable for controllers handling
    * grid positioned layout using PortletSet.Constraints
  @@ -592,6 +589,74 @@
           }
       }
   
  +	public void doSkin(RunData data, Context context)
  +	{
  +		JetspeedRunData jdata = (JetspeedRunData) data;
  +
  +		String skinName = data.getParameters().getString("portletSkin");
  +		String id = data.getParameters().getString("js_peid");
  +
  +		try
  +		{
  +			Entry entry = jdata.getCustomizedProfile().getDocument().getEntryById(id);
  +
  +			if (entry != null)
  +			{
  +				if (skinName != null && skinName.trim().length() > 0)
  +				{
  +					PsmlSkin skin = new PsmlSkin();
  +					skin.setName(skinName);
  +					if (skin != null)
  +					{
  +						entry.setSkin(skin);
  +					}
  +				}
  +				else
  +				{
  +					entry.setSkin(null);
  +				}
  +			}
  +		}
  +		catch (Exception e)
  +		{
  +			logger.error("Exception setting skin", e);
  +		}
  +	}
  +
  +	public void doSecurity(RunData data, Context context)
  +	{
  +		JetspeedRunData jdata = (JetspeedRunData) data;
  +
  +		String securityRefName = data.getParameters().getString("portletSecurityRef");
  +		String id = data.getParameters().getString("js_peid");
  +
  +		try
  +		{
  +			Entry entry = jdata.getCustomizedProfile().getDocument().getEntryById(id);
  +
  +			if (entry != null)
  +			{
  +				if (securityRefName != null && securityRefName.trim().length() > 0)
  +				{
  +					BaseSecurityReference securityRef = new BaseSecurityReference();
  +					securityRef.setParent(securityRefName);
  +					if (securityRef != null)
  +					{
  +						entry.setSecurityRef(securityRef);
  +					}
  +				}
  +				else
  +				{
  +					entry.setSecurityRef(null);
  +				}
  +			}
  +		}
  +		catch (Exception e)
  +		{
  +			logger.error("Exception setting security", e);
  +		}
  +	}
  +
       protected static void setPosition(IdentityElement identityElement, int col, int row)
       {
           boolean colFound = false;
  
  
  
  1.10      +5 -1      jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/RegistryEntryListBox.java
  
  Index: RegistryEntryListBox.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/RegistryEntryListBox.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- RegistryEntryListBox.java	29 Aug 2004 22:32:15 -0000	1.9
  +++ RegistryEntryListBox.java	12 May 2005 18:15:59 -0000	1.10
  @@ -167,6 +167,10 @@
           {
               label = "Client";
           }
  +		else if (regName.equals(Registry.SKIN))
  +		{
  +			label = CustomLocalization.getString("CUSTOMIZER_SKIN", data);;
  +		}
           else
           {
               label = "";
  
  
  
  1.50      +18 -1     jakarta-jetspeed/webapp/WEB-INF/conf/admin.xreg
  
  Index: admin.xreg
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/conf/admin.xreg,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- admin.xreg	11 May 2005 01:33:13 -0000	1.49
  +++ admin.xreg	12 May 2005 18:15:59 -0000	1.50
  @@ -43,7 +43,7 @@
   			</parameter-style>
   		</parameter>
   		<parameter name="_control" value="" type="style" hidden="false">
  -			<security-ref parent="user-only"/>		
  +			<security-ref parent="user-only"/>
   			<parameter-style name="RegistryEntryListBox">
   				<style-option name="registry" value="PortletControl"/>
   				<style-option name="select-hidden" value="true"/>
  @@ -66,6 +66,15 @@
   				<style-option name="javascript:onchange" value="document.securityRefs.submit()"/>
   			</parameter-style>
   		</parameter>
  +		<parameter name="portletSecurityRef" value="" type="style" hidden="false">
  +			<security-ref parent="user-only"/>
  +			<parameter-style name="RegistryEntryListBox">
  +				<style-option name="registry" value="Security"/>
  +				<style-option name="disabled-if-wml" value="true"/>
  +				<style-option name="javascript:onchange" value="this.form.submit()"/>
  +				<style-option name="set-label" value="true"/>				
  +			</parameter-style>
  +		</parameter>
   		<parameter name="skin" value="" type="style" hidden="false">
   			<parameter-style name="RegistryEntryListBox">
   				<style-option name="registry" value="Skin"/>
  @@ -73,6 +82,14 @@
   				<style-option name="javascript:onchange" value="document.skins.submit()"/>
   			</parameter-style>
   		</parameter>
  +		<parameter name="portletSkin" value="" type="style" hidden="false">
  +			<parameter-style name="RegistryEntryListBox">
  +				<style-option name="registry" value="Skin"/>
  +				<style-option name="disabled-if-wml" value="true"/>
  +				<style-option name="javascript:onchange" value="this.form.submit()"/>
  +				<style-option name="set-label" value="true"/>				
  +			</parameter-style>
  +		</parameter>
   		<parameter name="control" value="" type="style" hidden="false">
   			<parameter-style name="RegistryEntryListBox">
   				<style-option name="registry" value="PortletControl"/>
  
  
  
  1.23      +36 -7     jakarta-jetspeed/webapp/WEB-INF/templates/vm/controllers/html/multicolumn-customize.vm
  
  Index: multicolumn-customize.vm
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/controllers/html/multicolumn-customize.vm,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- multicolumn-customize.vm	17 Mar 2004 19:17:27 -0000	1.22
  +++ multicolumn-customize.vm	12 May 2005 18:15:59 -0000	1.23
  @@ -41,7 +41,7 @@
         <tr>
           <td width="100%">
         <form action="#psmlLink($jslink.Template)" method="post">
  -#if ($action) <input type="hidden" name="$jslink.ActionKey" value="$action" /> #end
  +		  #if ($action) <input type="hidden" name="$jslink.ActionKey" value="$action" />
#end
             <input type="hidden" name="id" value="$portlet.id" />
             <input type="hidden" name="col" value="$col" />
             <input type="hidden" name="row" value="$row" />
  @@ -78,6 +78,7 @@
                 <td class="PTitleRight" style="font-size:1pt;">&nbsp;</td>
   #end
               </tr>
  +            </form>
   ## Portlet "content" (properties)
               <tr>
                 #if (${skin.PortletSkinClass})
  @@ -102,24 +103,52 @@
     #set ($portletSkin = "-- Default --")
   #end
   
  +#if ($portlet.Skin) 
  +   #set ($psListBox = $jetspeed.getPortletParameter($data, $data.User.getTemp("customizer"),
"portletSkin", $portlet.Skin.Name))
  + #else 
  +   #set ($psListBox = $jetspeed.getPortletParameter($data, $data.User.getTemp("customizer"),
"portletSkin")) 
  +#end
  +
   ## Set $portletSecurityRef.  If no Security Reference exists for the portlet, then set
to "-- Default --"
   #set($securityReference = $jetspeed.getSecurityReference($portlet))
   #if ($securityReference)
     #set ($portletSecurityRef = $securityReference.Parent)
  +  ##set ($portletSecurityRef = "")
     #if($jetspeed.getSecuritySource($portlet) == 1)
  -    #set ($portletSecurityRef = "$portletSecurityRef <span style='color:red'><br
/>$l10n.SECURITY_IS_REGISTRY_LEVEL.</span>")
  +    #set ($portletSecurityRef = "<span style='color:red'><br />$l10n.SECURITY_IS_REGISTRY_LEVEL.</span>")
     #elseif($jetspeed.getSecuritySource($portlet) == 2)
  -    #set ($portletSecurityRef = "$portletSecurityRef <span style='color:red'><br
/>$l10n.SECURITY_IS_SYSTEM_DEFAULT.</span>")
  +    #set ($portletSecurityRef = "<span style='color:red'><br />$l10n.SECURITY_IS_SYSTEM_DEFAULT.</span>")
     #end
   #else
     #set ($portletSecurityRef = "-- Default --")
   #end
  +
  +#if ($securityReference) 
  +   #set ($srListBox = $jetspeed.getPortletParameter($data, $data.User.getTemp("customizer"),
"portletSecurityRef", $securityReference.Parent))
  + #else 
  +   #set ($srListBox = $jetspeed.getPortletParameter($data, $data.User.getTemp("customizer"),
"portletSecurityRef")) 
  +#end
  +
   		  <tr>
   		    <td width="50%">
  -		      $l10n.CUSTOMIZER_SKIN : $portletSkin
  +				<form name="pskins$ndx" action="#psmlLink($jslink.Template)" method="post">
  +				#if ($action) 
  +					<input name="$jslink.ActionKey" type="hidden" value="$action"> 
  +				#end
  +					<input name="js_peid" type="hidden" value="$portlet.id"> 
  +					<input type="hidden" name="eventSubmit_doSkin" value="doSkin">        
  +					$psListBox
  +				</form>		      
   		    </td>
   		    <td width="50%">
  -		       $l10n.CUSTOMIZER_SECURITY_REF : $portletSecurityRef
  +				<form name="pSecs$ndx" action="#psmlLink($jslink.Template)" method="post">
  +				#if ($action) 
  +					<input name="$jslink.ActionKey" type="hidden" value="$action"> 
  +				#end
  +					<input name="js_peid" type="hidden" value="$portlet.id"> 
  +					<input type="hidden" name="eventSubmit_doSecurity" value="doSecurity">     
  
  +					$srListBox $portletSecurityRef
  +				</form>		      
   		    </td>
   		  </tr>
   ## Include path for references
  @@ -130,7 +159,7 @@
   		    </td>
   		  </tr>
   #end
  -</form>
  +##</form>
   #if ($portlet.Control.Name) 
      #set ($controlListBox = $jetspeed.getPortletParameter($data, $data.User.getTemp("customizer"),
"control", $portlet.Control.Name))
    #else 
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message