morciuch 2002/11/12 14:19:01
Modified: docs/site changes.html
webapp/WEB-INF/conf admin.xreg
webapp/WEB-INF/templates/vm/portlets/html
customizer-portlet.vm
customizer-portletset-layout.vm
xdocs changes.xml
Added: src/java/org/apache/jetspeed/modules/parameters
RegistryEntryListBox.java
webapp/WEB-INF/templates/vm/parameters/html
RegistryEntryListBox.vm
Log:
Security Ref list box in the customizers (PortletCustomizer and
PortletSetCustomizer) is now visible to admin only.
This behaviour can be modified by changing the security ref for "_security_ref"
parameter in PortletCustomizer and security ref for "securityRef" parameter in
PortletSetCustomizer. Currently security constraint "user-view_admin-all" is used to
control availability of Security Ref list box.
Revision Changes Path
1.68 +3 -0 jakarta-jetspeed/docs/site/changes.html
Index: changes.html
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/docs/site/changes.html,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- changes.html 11 Nov 2002 22:35:19 -0000 1.67
+++ changes.html 12 Nov 2002 22:19:00 -0000 1.68
@@ -131,6 +131,9 @@
</li>
-->
<li>
+ Add - 2002/12/8 - Security Ref in the customizers is now only visible to admin
(MO)
+</li>
+<li>
Fix - Bug # 11264 - 2002/11/8 - Modified JetspeedPaneTag to support maximize mode
when JSP is the default template engine (MO)
</li>
<li>
1.1
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/parameters/RegistryEntryListBox.java
Index: RegistryEntryListBox.java
===================================================================
package org.apache.jetspeed.modules.parameters;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Jetspeed" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache" or
* "Apache Jetspeed", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Comparator;
import org.apache.jetspeed.om.profile.ProfileLocator;
import org.apache.jetspeed.om.registry.PortletInfoEntry;
import org.apache.jetspeed.om.registry.RegistryEntry;
import org.apache.jetspeed.om.security.JetspeedUser;
import org.apache.jetspeed.services.JetspeedSecurity;
import org.apache.jetspeed.services.Registry;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.jetspeed.services.security.PortalResource;
import org.apache.turbine.services.localization.Localization;
import org.apache.turbine.util.RunData;
import org.apache.velocity.context.Context;
/**
* Returns list box control populated with registry entries from selected registry.
* <p>Options:
* <UL>
* <LI><code>registry</code>
[Portlet|Security|PortletControl|PortletController|Skin|security|MediaType|Client] -
registry name</LI>
* <LI><code>sort</code> [<strong>true</strong>|false] - return sorted list of
items</LI>
* <LI><code>select-hidden</code> [<strong>false</strong>|true] - allow multiple
selections</LI>
* <LI><code>null-if-empty</code> [<strong>true</strong>|false] - do not return a
select control if item list is empty</LI>
* <LI><code>set-label</code> [<strong>false</strong>|true] - put label in front of
the list box based on the registry name</LI>
* <LI><code>disabled-if-wml</code> [<strong>false</strong>|true] - set disabled
attribute for the list box if using wml</LI>
* </UL>
* @author <a href="[EMAIL PROTECTED]">Mark Orciuch</a>
* @version $Id: RegistryEntryListBox.java,v 1.1 2002/11/12 22:19:00 morciuch Exp $
*/
public class RegistryEntryListBox extends VelocityParameterPresentationStyle
{
public static final String OPTION_REGISTRY = "registry";
public static final String OPTION_SORT = "sort";
public static final String OPTION_SELECT_HIDDEN = "select-hidden";
public static final String OPTION_NULL_IF_EMPTY = "null-if-empty";
public static final String OPTION_SET_LABEL = "set-label";
public static final String OPTION_DISABLED_IF_WML = "disabled-if-wml";
/**
* Put custom objects in the velocity context
*
* @param data
* @param name
* @param value
* @param parms
* @param context
*/
public void buildContext(RunData data, String name, String value, Map parms,
Context context)
{
// Initialize options
JetspeedRunData jdata = (JetspeedRunData)data;
String mediaType = jdata.getProfile().getMediaType();
String regName = (String)getParm(OPTION_REGISTRY, Registry.PORTLET);
boolean sort = (new Boolean((String)getParm(OPTION_SORT,
"true"))).booleanValue();
boolean selectHidden = (new Boolean((String)getParm(OPTION_SELECT_HIDDEN,
"false"))).booleanValue();
String nullIfEmpty = (String)getParm(OPTION_NULL_IF_EMPTY, "true");
boolean setLabel = (new Boolean((String)getParm(OPTION_SET_LABEL,
"false"))).booleanValue();
boolean disabledIfWML = (new Boolean((String)getParm(OPTION_DISABLED_IF_WML,
"false"))).booleanValue();
// Iterate thru entries from selected registry
List list = new ArrayList();
for (Iterator i = Registry.get(regName).listEntryNames(); i.hasNext();)
{
RegistryEntry entry = Registry.getEntry(regName, (String)i.next());
boolean selected = false;
selected =
JetspeedSecurity.checkPermission((JetspeedUser)data.getUser(), new
PortalResource(entry), "customize");
if (selected && !selectHidden)
selected = !entry.isHidden();
if (selected && (entry instanceof PortletInfoEntry))
selected = ((PortletInfoEntry)entry).hasMediaType(mediaType);
if (selected)
list.add(entry);
}
// Perform optional sort of list box items
if (sort)
Collections.sort(list,
new Comparator()
{
public int compare(Object o1, Object o2)
{
String t1 = (((RegistryEntry) o1).getTitle() !=
null)
? ((RegistryEntry) o1).getTitle()
: ((RegistryEntry) o1).getName();
String t2 = (((RegistryEntry) o2).getTitle() !=
null)
? ((RegistryEntry) o2).getTitle()
: ((RegistryEntry) o2).getName();
return t1.compareTo(t2);
}
});
// Set list box label
String label = null;
if (regName.equals(Registry.PORTLET))
{
label = Localization.getString("CUSTOMIZER_PORTLET");
}
else if (regName.equals(Registry.SECURITY))
{
label = Localization.getString("CUSTOMIZER_SECURITY_REF");
}
else if (regName.equals(Registry.MEDIA_TYPE))
{
label = Localization.getString("CUSTOMIZER_MEDIATYPE");
}
else if (regName.equals(Registry.PORTLET_CONTROLLER))
{
label = Localization.getString("CUSTOMIZER_LAYOUT");
}
else if (regName.equals(Registry.PORTLET_CONTROL))
{
label = Localization.getString("CUSTOMIZER_DECORATION");
}
else
{
label = "";
}
context.put("entries", list);
context.put("nullIfEmpty", nullIfEmpty);
if (setLabel)
context.put("label", label);
if (disabledIfWML && mediaType.equalsIgnoreCase("wml"))
context.put("disabled", "disabled");
context.put("events", getJavascriptEvents());
}
}
1.26 +20 -0 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.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- admin.xreg 8 Nov 2002 22:12:21 -0000 1.25
+++ admin.xreg 12 Nov 2002 22:19:00 -0000 1.26
@@ -14,6 +14,14 @@
<classname>org.apache.jetspeed.portal.portlets.VelocityPortlet</classname>
<parameter name="template" value="customizer-portlet"/>
<parameter name="action" value="portlets.CustomizeAction"/>
+ <parameter name="_security_ref" value="" type="style" hidden="false"
cachedOnName="true" cachedOnValue="true">
+ <security-ref parent="user-view_admin-all"/>
+ </parameter>
+ <parameter name="_security_ref.style" value="RegistryEntryListBox"
hidden="false" cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="_security_ref.style.registry" value="Security" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="_skin" value="" type="style" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="_skin.style" value="RegistryEntryListBox" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="_skin.style.registry" value="Skin" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
<meta-info>
<title>Customize portlet</title>
</meta-info>
@@ -27,6 +35,18 @@
<classname>org.apache.jetspeed.portal.portlets.VelocityPortlet</classname>
<parameter name="template" value="customizer-portletset"/>
<parameter name="action" value="portlets.CustomizeSetAction"/>
+ <parameter name="securityRef" value="" type="style" hidden="false"
cachedOnName="true" cachedOnValue="true">
+ <security-ref parent="user-view_admin-all"/>
+ </parameter>
+ <parameter name="securityRef.style" value="RegistryEntryListBox" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="securityRef.style.registry" value="Security" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="securityRef.style.disabled-if-wml" value="true" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="securityRef.style.javascript:onchange"
value="document.securityRefs.submit()" hidden="false" cachedOnName="true"
cachedOnValue="true"/>
+ <parameter name="skin" value="" type="style" hidden="false" cachedOnName="true"
cachedOnValue="true"/>
+ <parameter name="skin.style" value="RegistryEntryListBox" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="skin.style.registry" value="Skin" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="skin.style.disabled-if-wml" value="true" hidden="false"
cachedOnName="true" cachedOnValue="true"/>
+ <parameter name="skin.style.javascript:onchange"
value="document.skins.submit()" hidden="false" cachedOnName="true"
cachedOnValue="true"/>
<meta-info>
<title>Customize pane</title>
</meta-info>
1.1
jakarta-jetspeed/webapp/WEB-INF/templates/vm/parameters/html/RegistryEntryListBox.vm
Index: RegistryEntryListBox.vm
===================================================================
## $Id: RegistryEntryListBox.vm,v 1.1 2002/11/12 22:19:00 morciuch Exp $
$!label
<select name="$name" $!disabled #foreach($event in $events.keySet())
$event="$events.get($event)" #end>
<option value="">-- Default --
#foreach ($entry in $entries)
<option value="$entry.Name" #if ($entry.Name == $!value) SELECTED #end>
#if ($entry.Title) $entry.Title #else $entry.Name #end
#end
</select>
1.13 +27 -9
jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/customizer-portlet.vm
Index: customizer-portlet.vm
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/customizer-portlet.vm,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- customizer-portlet.vm 9 Sep 2002 18:48:14 -0000 1.12
+++ customizer-portlet.vm 12 Nov 2002 22:19:00 -0000 1.13
@@ -10,6 +10,7 @@
#if ($action)
<input name="$jslink.ActionKey" type="hidden" value="$action">
#end
+ <input name="js_peid" type="hidden" value="$data.getJs_peid()">
#if ($parameters.size() == 0)
<br>
<center>$l10n.CUSTOMIZER_NOPARAMETERS</center>
@@ -25,19 +26,36 @@
<hr/>
</td>
</tr>
-#parse ("/portlets/html/customize-skin_row.vm")
+
+#if ($current_skin)
+ #set ($skinListBox = $jetspeed.getPortletParameter($data, $customizer, "_skin",
$current_skin))
+#else
+ #set ($skinListBox = $jetspeed.getPortletParameter($data, $customizer, "_skin"))
+#end
+#if ($skinListBox)
<tr>
- <td colspan="2">
- <hr/>
- </td>
- </tr>
-#parse ("/portlets/html/customize-securityref_row.vm")
+ <td><b>$l10n.CUSTOMIZER_SKIN</b></td>
+ <td>$skinListBox</td>
+ </tr>
<tr>
- <td colspan="2">
- <hr/>
- </td>
+ <td colspan="2"><hr/></td>
</tr>
+#end
+#if ($security_ref)
+ #set ($securityRefListBox = $jetspeed.getPortletParameter($data, $customizer,
"_security_ref", $security_ref))
+#else
+ #set ($securityRefListBox = $jetspeed.getPortletParameter($data, $customizer,
"_security_ref"))
+#end
+#if ($securityRefListBox)
+ <tr>
+ <td><b>$l10n.CUSTOMIZER_SECURITY_REF</b></td>
+ <td>$securityRefListBox</td>
+ </tr>
+ <tr>
+ <td colspan="2"><hr/></td>
+ </tr>
+#end
#foreach ( $param in $parameters )
<tr>
<td align="left" nowrap><b>#if ($param.Title) $param.Title #else $param.Name
#end</b></td>
1.11 +28 -41
jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/customizer-portletset-layout.vm
Index: customizer-portletset-layout.vm
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/portlets/html/customizer-portletset-layout.vm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- customizer-portletset-layout.vm 23 Jul 2002 00:03:56 -0000 1.10
+++ customizer-portletset-layout.vm 12 Nov 2002 22:19:00 -0000 1.11
@@ -68,7 +68,15 @@
</form>
</td>
#end
- #if ($skins)
+
+ #if ($currentSkin)
+ #set ($skinListBox = $jetspeed.getPortletParameter($data, $customizer,
"skin", $currentSkin))
+ #else
+ #set ($skinListBox = $jetspeed.getPortletParameter($data, $customizer,
"skin"))
+ #end
+
+ #if($skinListBox)
+
<td> </td>
<td valign="middle">
$l10n.CUSTOMIZER_SKIN :
@@ -80,31 +88,24 @@
#else
<form name="skins" action="$jslink.Template" method="post">
#end
- #if ($action) <input name="$jslink.ActionKey" type="hidden" value="$action"
> #end
- <input type="hidden" name="eventSubmit_doSkin" value="skin"> ## No
Controller-Selection for WML Profiles
- #if (($!mtype=="wml") || ($!mtype=="WML"))
- <select name="skin" onChange="document.skins.submit()" disabled>
- #else
- <select name="skin" onChange="document.skins.submit()">
- #end
- <option value="">-- Default--
- #foreach ($skin in $skins)
- <option value="$skin.Name" #if ($skin.Name == $!currentSkin) SELECTED
#end>
- #if ($skin.Title) $skin.Title #else $skin.Name #end
- #end
- </select>
-
- ## No submit-Button for WML Profiles
- #if (($!mtype=="wml") || ($!mtype=="WML"))
-## <input type="submit" value="OK" disabled>
- #else
-## <input type="submit" value="OK">
+ #if ($action)
+ <input name="$jslink.ActionKey" type="hidden" value="$action">
#end
- </form>
+ <input type="hidden" name="eventSubmit_doSkin" value="skin">
+ $skinListBox
+ </form>
</td>
#end
<td> </td>
- #if ($securitys)
+
+ #if ($currentSecurityRef)
+ #set ($securityRefListBox = $jetspeed.getPortletParameter($data,
$customizer, "securityRef", $currentSecurityRef.Parent))
+ #else
+ #set ($securityRefListBox = $jetspeed.getPortletParameter($data,
$customizer, "securityRef"))
+ #end
+
+ #if ($securityRefListBox)
+
<td> </td>
<td valign="middle">
$l10n.CUSTOMIZER_SECURITY_REF :
@@ -115,29 +116,15 @@
#else
<form name="securityRefs" action="$jslink.Template" method="post">
#end
- #if ($action) <input name="$jslink.ActionKey" type="hidden" value="$action"
> #end
- <input type="hidden" name="eventSubmit_doSecurity" value="securityRef">
## No Controller-Selection for WML Profiles
- #if (($!mtype=="wml") || ($!mtype=="WML"))
- <select name="securityRef" onChange="document.securityRefs.submit()"
disabled>
- #else
- <select name="securityRef" onChange="document.securityRefs.submit()">
- #end
- <option value="">-- Default--
- #foreach ($security in $securitys)
- <option value="$security.Name" #if ($security.Name ==
$!currentSecurityRef.Parent) SELECTED #end>
- #if ($security.Title) $security.Title #else $security.Name #end
- #end
- </select>
-
- ## No submit-Button for WML Profiles
- #if (($!mtype=="wml") || ($!mtype=="WML"))
-## <input type="submit" value="OK" disabled>
- #else
-## <input type="submit" value="OK">
+ #if ($action)
+ <input name="$jslink.ActionKey" type="hidden" value="$action">
#end
+ <input type="hidden" name="eventSubmit_doSecurity" value="securityRef">
+ $securityRefListBox
</form>
</td>
#end
+
</tr>
</table>
</center>
1.89 +4 -1 jakarta-jetspeed/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- changes.xml 11 Nov 2002 22:35:19 -0000 1.88
+++ changes.xml 12 Nov 2002 22:19:01 -0000 1.89
@@ -23,6 +23,9 @@
</li>
-->
<li>
+ Add - 2002/12/8 - Security Ref in the customizers is now only visible to admin
(MO)
+</li>
+<li>
Fix - Bug # 11264 - 2002/11/8 - Modified JetspeedPaneTag to support maximize mode
when JSP is the default template engine (MO)
</li>
<li>
--
To unsubscribe, e-mail: <mailto:jetspeed-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@;jakarta.apache.org>