taylor 2004/09/03 15:51:56
Modified: portal/src/java/org/apache/jetspeed/velocity
JetspeedPowerTool.java
Log:
Fix for:
http://nagoya.apache.org/jira/browse/JS2-86
Portlet Modes Decorator Implementation Incomplete
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.22 +32 -15
jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java
Index: JetspeedPowerTool.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/velocity/JetspeedPowerTool.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- JetspeedPowerTool.java 3 Sep 2004 18:23:41 -0000 1.21
+++ JetspeedPowerTool.java 3 Sep 2004 22:51:56 -0000 1.22
@@ -67,6 +67,7 @@
import org.apache.jetspeed.services.information.PortletURLProviderImpl;
import org.apache.pluto.Constants;
import org.apache.pluto.om.entity.PortletEntity;
+import org.apache.pluto.om.portlet.ContentTypeSet;
import org.apache.velocity.context.Context;
import org.apache.velocity.io.VelocityWriter;
import org.apache.velocity.tools.view.context.ViewContext;
@@ -846,37 +847,51 @@
{
return actions; // allow nothing
}
+
+ ContentTypeSet content = portlet.getContentTypeSet();
if (state.equals(WindowState.NORMAL.toString()))
{
- createAction(actions, JetspeedActions.INDEX_MINIMIZE,
portlet.getUniqueName());
- createAction(actions, JetspeedActions.INDEX_MAXIMIZE,
portlet.getUniqueName());
+ createAction(actions, JetspeedActions.INDEX_MINIMIZE, portlet);
+ createAction(actions, JetspeedActions.INDEX_MAXIMIZE, portlet);
}
else if (state.equals(WindowState.MAXIMIZED.toString()))
{
- createAction(actions, JetspeedActions.INDEX_MINIMIZE,
portlet.getUniqueName());
- createAction(actions, JetspeedActions.INDEX_NORMAL,
portlet.getUniqueName());
+ createAction(actions, JetspeedActions.INDEX_MINIMIZE, portlet);
+ createAction(actions, JetspeedActions.INDEX_NORMAL, portlet);
}
else // minimized
{
- createAction(actions, JetspeedActions.INDEX_MAXIMIZE,
portlet.getUniqueName());
- createAction(actions, JetspeedActions.INDEX_NORMAL,
portlet.getUniqueName());
+ createAction(actions, JetspeedActions.INDEX_MAXIMIZE, portlet);
+ createAction(actions, JetspeedActions.INDEX_NORMAL, portlet);
}
if (mode.equals(PortletMode.VIEW.toString()))
{
- createAction(actions, JetspeedActions.INDEX_EDIT,
portlet.getUniqueName());
- createAction(actions, JetspeedActions.INDEX_HELP,
portlet.getUniqueName());
+ if (content.supportsPortletMode(PortletMode.EDIT))
+ {
+ createAction(actions, JetspeedActions.INDEX_EDIT, portlet);
+ }
+ if (content.supportsPortletMode(PortletMode.HELP))
+ {
+ createAction(actions, JetspeedActions.INDEX_HELP, portlet);
+ }
}
else if (mode.equals(PortletMode.EDIT.toString()))
{
- createAction(actions, JetspeedActions.INDEX_VIEW,
portlet.getUniqueName());
- createAction(actions, JetspeedActions.INDEX_HELP,
portlet.getUniqueName());
+ createAction(actions, JetspeedActions.INDEX_VIEW, portlet);
+ if (content.supportsPortletMode(PortletMode.HELP))
+ {
+ createAction(actions, JetspeedActions.INDEX_HELP, portlet);
+ }
}
else // help
{
- createAction(actions, JetspeedActions.INDEX_VIEW,
portlet.getUniqueName());
- createAction(actions, JetspeedActions.INDEX_EDIT,
portlet.getUniqueName());
+ createAction(actions, JetspeedActions.INDEX_VIEW, portlet);
+ if (content.supportsPortletMode(PortletMode.EDIT))
+ {
+ createAction(actions, JetspeedActions.INDEX_EDIT, portlet);
+ }
}
return actions;
}
@@ -911,10 +926,12 @@
* @return
* @throws Exception
*/
- public DecoratorAction createAction(List actions, int actionId, String
resource) throws Exception
+ public DecoratorAction createAction(List actions, int actionId,
PortletDefinitionComposite portlet)
+ throws Exception
{
+ String resource = portlet.getUniqueName();
String actionName = JetspeedActions.ACTIONS[actionId];
- if (checkPermission(resource, actionName))
+ if (checkPermission(resource, actionName)) // TODO: should be
!checkPermission
{
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]