kimptoc 02/01/18 04:39:43
Modified: build build.xml
src/java/org/apache/jetspeed/modules/actions/controls
Close.java
src/java/org/apache/jetspeed/portal/controls
VelocityPortletControl.java
webapp/WEB-INF/psml/user/turbine/html default.psml
Log:
bug # 5688 - close control on portlet removes portlet from users set of portlets
Revision Changes Path
1.121 +2 -2 jakarta-jetspeed/build/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/build/build.xml,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -r1.120 -r1.121
--- build.xml 22 Dec 2001 15:32:06 -0000 1.120
+++ build.xml 18 Jan 2002 12:39:43 -0000 1.121
@@ -791,10 +791,10 @@
<exclude name="CVS"/>
</fileset>
<fileset dir="${src.java.dir}/org/apache/jetspeed/xml/api/portletmarkup">
- <exclude name="CVS"/>
+ <include name="**.java"/>
</fileset>
<fileset dir="${src.java.dir}/org/apache/jetspeed/xml/api/jcm">
- <exclude name="CVS"/>
+ <include name="**.java"/>
</fileset>
</delete>
</target>
1.5 +32 -4
jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Close.java
Index: Close.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/controls/Close.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Close.java 22 Jul 2001 20:31:11 -0000 1.4
+++ Close.java 18 Jan 2002 12:39:43 -0000 1.5
@@ -57,6 +57,7 @@
// Turbine stuff
import org.apache.turbine.modules.Action;
import org.apache.turbine.util.RunData;
+import org.apache.turbine.util.Log;
// Jetspeed stuff
import org.apache.jetspeed.portal.Portlet;
@@ -64,6 +65,7 @@
import org.apache.jetspeed.services.PortletFactory;
import org.apache.jetspeed.services.Registry;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
+import org.apache.jetspeed.xml.api.portletmarkup.Portlets;
/**
* Change the internal state of a portlet from normal to closed
@@ -75,22 +77,48 @@
{
public void doPerform( RunData rundata ) throws Exception
{
-
if( rundata.getUser() == null || !rundata.getUser().hasLoggedIn() )
{
return;
}
- String name = ((JetspeedRunData)rundata).getPortlet();
+ JetspeedRunData jdata = (JetspeedRunData)rundata;
+
+ String name = jdata.getPortlet();
if ( name == null )
{
return;
}
+ // This code handles the case where a portlet is on several tabs
+ // only removing it from the tab that you selected.
+ //
+ // FIXME: Portlet name may not be unique, eg when a portlet is on the same
tab twice
+ // ...but I could not find a reliable way of uniquely identifying the
+ // portlet.
+
Portlet portlet = PortletFactory.getPortlet( name );
- if (( portlet != null )&&( portlet instanceof PortletState ))
+
+ if ( portlet != null )
{
- ((PortletState)portlet).setClosed( true, rundata );
+ String parentContainer = jdata.getParameters().getString("container");
+ if (parentContainer == null) return;
+
+ Portlets portlets = jdata.getProfile()
+ .getDocument()
+ .getPortlets(parentContainer);
+
+ if (portlets != null)
+ {
+ for (int i=0; i < portlets.getEntryCount(); i++)
+ {
+ if ( name.equals(portlets.getEntry(i).getParent()) )
+ {
+ portlets.removeEntry(i);
+ }
+ }
+ }
+
}
}
}
1.11 +4 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java
Index: VelocityPortletControl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/VelocityPortletControl.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- VelocityPortletControl.java 16 Aug 2001 15:08:54 -0000 1.10
+++ VelocityPortletControl.java 18 Jan 2002 12:39:43 -0000 1.11
@@ -259,10 +259,13 @@
while( i.hasNext() )
{
PortletAction action = (PortletAction)i.next();
-
+
+ String container = "na";
+ if ( portlet.getPortletConfig().getPortletSet() != null) container =
portlet.getPortletConfig().getPortletSet().getName();
action.setLink( new RelativeDynamicURI( rundata )
.addQueryData("action", getAction( action.getName()
) )
.addQueryData("portlet", portlet.getName() )
+ .addQueryData("container", container )
.toString() );
}
1.11 +60 -26
jakarta-jetspeed/webapp/WEB-INF/psml/user/turbine/html/default.psml
Index: default.psml
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/psml/user/turbine/html/default.psml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- default.psml 29 Dec 2001 00:43:16 -0000 1.10
+++ default.psml 18 Jan 2002 12:39:43 -0000 1.11
@@ -1,26 +1,60 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<portlets xmlns="http://xml.apache.org/jetspeed/2000/psml">
-
- <controller name="TabController"/>
- <control name="TabControl"/>
- <skin name="orange-red"/>
-
- <portlets>
- <metainfo>
- <title>Home</title>
- </metainfo>
-
- <controller name="TwoColumns"/>
-
- <entry parent="LoggedInWelcome"/>
- <entry parent="HelloVelocity"/>
- <entry parent="StockQuote"/>
- <entry parent="http://jakarta.apache.org/jetspeed/channels/jetspeed.rss"/>
- <entry parent="http://www.xmlhack.com/rsscat.php"/>
- <entry parent="http://jakarta.apache.org/jetspeed/channels/turbine.rss"/>
- <entry parent="http://www.mozilla.org/news.rdf"/>
- <entry parent="http://www.apacheweek.com/issues/apacheweek-headlines.xml"/>
-
- </portlets>
-
-</portlets>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+<portlets xmlns="http://www.apache.org/2000/02/CVS">
+ <controller name="TabController"/>
+ <control name="TabControl"/>
+ <skin name="orange-red"/>
+ <portlets>
+ <controller name="TwoColumns"/>
+ <metainfo>
+ <title>Home</title>
+ </metainfo>
+ <entry parent="LoggedInWelcome">
+ <layout>
+ <property name="column" value="0"/>
+ <property name="row" value="0"/>
+ </layout>
+ </entry>
+ <entry parent="HelloVelocity">
+ <layout>
+ <property name="column" value="1"/>
+ <property name="row" value="0"/>
+ </layout>
+ </entry>
+ <entry parent="StockQuote">
+ <layout>
+ <property name="column" value="0"/>
+ <property name="row" value="1"/>
+ </layout>
+ </entry>
+ <entry parent="http://jakarta.apache.org/jetspeed/channels/jetspeed.rss">
+ <layout>
+ <property name="column" value="1"/>
+ <property name="row" value="1"/>
+ </layout>
+ </entry>
+ <entry parent="http://www.xmlhack.com/rsscat.php">
+ <layout>
+ <property name="column" value="0"/>
+ <property name="row" value="2"/>
+ </layout>
+ </entry>
+ <entry parent="http://jakarta.apache.org/jetspeed/channels/turbine.rss">
+ <layout>
+ <property name="column" value="1"/>
+ <property name="row" value="2"/>
+ </layout>
+ </entry>
+ <entry parent="http://www.mozilla.org/news.rdf">
+ <layout>
+ <property name="column" value="0"/>
+ <property name="row" value="3"/>
+ </layout>
+ </entry>
+ <entry parent="http://www.apacheweek.com/issues/apacheweek-headlines.xml">
+ <layout>
+ <property name="column" value="1"/>
+ <property name="row" value="3"/>
+ </layout>
+ </entry>
+ </portlets>
+</portlets>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>