morciuch 2002/09/10 08:12:09
Modified: docs/site changes.html security.html todo.html
src/java/org/apache/jetspeed/portal BasePortletSet.java
PortletState.java
src/java/org/apache/jetspeed/portal/controls
AbstractPortletControl.java
VelocityPortletControl.java
src/java/org/apache/jetspeed/portal/portlets
AbstractPortlet.java
src/java/org/apache/jetspeed/portal/security/portlets
StatefulPortletWrapper.java
webapp/WEB-INF/templates/vm/controls/html jetspeed.vm
xdocs changes.xml security.xml todo.xml
Log:
Implemented "Print Friendly Format" portlet action icon (see Bugzilla bug# 11741).
Also, made necessary changes for displaying action icons' alt text in proper case and
user friendly description (for example, "Information" rather than "info").
Initial implementation uses content.vm layout to display the portlet without any
decorations. Note that this layout has no link to get back to prior page so the user
has to click browser's previous button. Based on individual requirements, the layout
may be customized with addition of "Back to prior page" link. To override the layout,
change portlet.action.print.template in jr.props.
Revision Changes Path
1.54 +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.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- changes.html 9 Sep 2002 01:31:52 -0000 1.53
+++ changes.html 10 Sep 2002 15:12:08 -0000 1.54
@@ -129,6 +129,9 @@
</li>
-->
<li>
+ Add - Bug # 11741 - 2002/09/10 - Implemented Print Friendly Format portlet action
(MO)
+</li>
+<li>
Update - 2002/09/08 - Updated Velocity to v1.3 (PS)
</li>
<li>
1.8 +21 -0 jakarta-jetspeed/docs/site/security.html
Index: security.html
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/docs/site/security.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- security.html 25 Aug 2002 20:30:37 -0000 1.7
+++ security.html 10 Sep 2002 15:12:08 -0000 1.8
@@ -933,6 +933,27 @@
</font>
</td>
</tr>
+ <tr>
+ <td bgcolor="#a0ddf0" colspan="" rowspan="" valign="top"
align="left">
+ <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+
+ <img src="../images/print.gif" />
+
+ </font>
+</td>
+ <td bgcolor="#a0ddf0" colspan="" rowspan=""
valign="top" align="left">
+ <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+ print
+ </font>
+</td>
+ <td bgcolor="#a0ddf0" colspan="" rowspan=""
valign="top" align="left">
+ <font color="#000000" size="-1" face="arial,helvetica,sanserif">
+ Allows to display current portlet in "print friendly format"
(without navigation and portlet control). Note that the
+ default screen template/layout used may be overriden by setting
<code>action.print.template</code> property in jr.props to your
+ custom screen template.
+ </font>
+</td>
+ </tr>
</table>
<br />
<p>
1.41 +1 -1 jakarta-jetspeed/docs/site/todo.html
Index: todo.html
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/docs/site/todo.html,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- todo.html 9 Sep 2002 01:31:52 -0000 1.40
+++ todo.html 10 Sep 2002 15:12:08 -0000 1.41
@@ -533,7 +533,7 @@
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan=""
valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
- "Print Friendly Format" action icon
+ "Print Friendly Format" action icon <strong>Done</strong>
</font>
</td>
<td bgcolor="#a0ddf0" colspan="" rowspan=""
valign="top" align="left">
1.29 +13 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java
Index: BasePortletSet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- BasePortletSet.java 2 Sep 2002 17:44:23 -0000 1.28
+++ BasePortletSet.java 10 Sep 2002 15:12:08 -0000 1.29
@@ -87,6 +87,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Mark Orciuch</a>
* @version $Id$
*/
public class BasePortletSet implements PortletSet, Portlet, PortletState
@@ -679,6 +680,17 @@
* @param rundata the RunData object for the current request
*/
public boolean allowInfo(RunData rundata)
+ {
+ return false;
+ }
+
+ /**
+ * Implements the default print friendly format behavior: not
+ * available for the portlet set
+ *
+ * @param rundata the RunData object for the current request
+ */
+ public boolean allowPrintFriendly(RunData rundata)
{
return false;
}
1.4 +9 -0
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletState.java
Index: PortletState.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/PortletState.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PortletState.java 29 May 2001 22:57:41 -0000 1.3
+++ PortletState.java 10 Sep 2002 15:12:08 -0000 1.4
@@ -66,6 +66,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Mark Orciuch</a>
*/
public interface PortletState
{
@@ -134,4 +135,12 @@
* @param data the RunData for this request
*/
public void setMinimized(boolean minimized, RunData data);
+
+ /**
+ * Returns true if the portlet allows the user to display it in print friendly
format.
+ *
+ * @param rundata the RunData object for the current request
+ */
+ public boolean allowPrintFriendly( RunData rundata );
+
}
1.17 +27 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java
Index: AbstractPortletControl.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/controls/AbstractPortletControl.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- AbstractPortletControl.java 28 Jun 2002 05:37:32 -0000 1.16
+++ AbstractPortletControl.java 10 Sep 2002 15:12:08 -0000 1.17
@@ -724,6 +724,32 @@
}
/**
+ * Implements the default info behavior: any authenticated user may
+ * display portlet in print friendly format
+ *
+ * @param rundata the RunData object for the current request
+ */
+ public boolean allowPrintFriendly( RunData rundata )
+ {
+ Portlet p = getPortlet();
+
+ if (p==null) return false;
+
+ if ((p instanceof PortletSet)
+ ||(JetspeedSecurity.checkPermission((JetspeedUser) rundata.getUser(),
+ p,
+
JetspeedSecurity.PERMISSION_PRINT_FRIENDLY)))
+ {
+ if (p instanceof PortletState)
+ {
+ return ((PortletState)p).allowPrintFriendly(rundata);
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Returns true if this portlet is currently minimized
*/
public boolean isMinimized(RunData rundata)
1.21 +31 -12
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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- VelocityPortletControl.java 7 Aug 2002 06:02:15 -0000 1.20
+++ VelocityPortletControl.java 10 Sep 2002 15:12:08 -0000 1.21
@@ -110,7 +110,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Roberto Carrasco</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
- * @author <a href="[EMAIL PROTECTED]">Mark Orciuch</a>
+ * @author <a href="mailto:[EMAIL PROTECTED]">Mark Orciuch</a>
*
* @version $Id$
*
@@ -236,41 +236,46 @@
{
if (! customized )
{
- actions.add( new PortletAction("customize") );
+ actions.add( new PortletAction("customize", "Customize") );
}
}
else
{
if ( state.allowInfo( rundata ) )
{
- actions.add( new PortletAction("info") );
+ actions.add( new PortletAction("info", "Information") );
}
}
+ if ( (!customized) && state.allowPrintFriendly( rundata ) )
+ {
+ actions.add( new PortletAction("print", "Print Friendly Format") );
+ }
+
if ( (!customized) && state.allowInfo( rundata ) &&
(!actions.contains("info")) )
{
- actions.add( new PortletAction("info") );
+ actions.add( new PortletAction("info", "Information") );
}
if ( (!customized) && (!maximized) && state.allowClose( rundata ) )
{
- actions.add( new PortletAction("close") );
+ actions.add( new PortletAction("close", "Close") );
}
if ( state.isMinimized( rundata ) || maximized )
{
- actions.add( new PortletAction("restore") );
+ actions.add( new PortletAction("restore", "Restore") );
}
else
{
if ( state.allowMinimize( rundata ) )
{
- actions.add( new PortletAction("minimize") );
+ actions.add( new PortletAction("minimize", "Minimize") );
}
if ( state.allowMaximize( rundata ) )
{
- actions.add( new PortletAction("maximize") );
+ actions.add( new PortletAction("maximize", "Maximize") );
}
}
}
@@ -279,12 +284,12 @@
// the portlet only knows about edit and maximize
if ( portlet.getAllowEdit( rundata ) )
{
- actions.add( new PortletAction("info") );
+ actions.add( new PortletAction("info", "Information") );
}
if ( portlet.getAllowMaximize( rundata ) )
{
- actions.add( new PortletAction("maximize") );
+ actions.add( new PortletAction("maximize", "Maximize") );
}
}
@@ -336,10 +341,18 @@
{
String name = null;
String link = null;
+ String alt = null;
- protected PortletAction( String name )
+ /**
+ * Constructor
+ *
+ * @param name Name of the action
+ * @param alt Alternative text description (localized)
+ */
+ protected PortletAction( String name, String alt )
{
this.name = name;
+ this.alt = alt;
}
public String getName()
@@ -356,6 +369,12 @@
{
this.link = link;
}
+
+ public String getAlt()
+ {
+ return this.alt;
+ }
+
}
}
1.58 +15 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java
Index: AbstractPortlet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- AbstractPortlet.java 24 Jul 2002 03:21:18 -0000 1.57
+++ AbstractPortlet.java 10 Sep 2002 15:12:08 -0000 1.58
@@ -109,6 +109,7 @@
@author <A HREF="mailto:[EMAIL PROTECTED]">Rapha�l Luta</A>
@author <A HREF="mailto:[EMAIL PROTECTED]">Santiago Gala</A>
@author <A HREF="mailto:[EMAIL PROTECTED]">Paul Spencer</A>
+@author <A HREF="mailto:[EMAIL PROTECTED]">Mark Orciuch</A>
@version $Id$
*/
public abstract class AbstractPortlet implements Portlet, PortletState, Cacheable,
Refreshable
@@ -755,6 +756,19 @@
* @param rundata The RunData object for the current request
*/
public boolean allowMinimize( RunData rundata )
+ {
+ //Security will not allow this call to succeed if there are
+ //not enough permissions
+ return true;
+ }
+
+ /**
+ * Implements the default print friendly format behavior:
+ * security permissions will be checked.
+ *
+ * @param rundata The RunData object for the current request
+ */
+ public boolean allowPrintFriendly( RunData rundata )
{
//Security will not allow this call to succeed if there are
//not enough permissions
1.3 +14 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/StatefulPortletWrapper.java
Index: StatefulPortletWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/StatefulPortletWrapper.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StatefulPortletWrapper.java 28 Jan 2002 11:20:19 -0000 1.2
+++ StatefulPortletWrapper.java 10 Sep 2002 15:12:08 -0000 1.3
@@ -72,6 +72,7 @@
</p>
@author <A HREF="mailto:[EMAIL PROTECTED]">Santiago Gala</A>
+@author <A HREF="mailto:[EMAIL PROTECTED]">Mark Orciuch</A>
@version $Id$
*/
public class StatefulPortletWrapper extends PortletWrapper implements PortletState
@@ -221,4 +222,16 @@
}
}
+ /**
+ * Implements the default info behavior: any authenticated user may
+ * view portlet in print friendly format
+ *
+ * @param rundata the RunData object for the current request
+ */
+ public boolean allowPrintFriendly( RunData rundata )
+ {
+ return checkPermission(rundata,
+ JetspeedSecurity.PERMISSION_PRINT_FRIENDLY );
+ }
+
}
1.12 +1 -1
jakarta-jetspeed/webapp/WEB-INF/templates/vm/controls/html/jetspeed.vm
Index: jetspeed.vm
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/webapp/WEB-INF/templates/vm/controls/html/jetspeed.vm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- jetspeed.vm 13 Aug 2002 15:35:25 -0000 1.11
+++ jetspeed.vm 10 Sep 2002 15:12:08 -0000 1.12
@@ -53,7 +53,7 @@
</td>
<td align="right" nowrap="true" valign="middle" #if (${skin.TitleStyleClass})
class="${skin.TitleStyleClass}" #end #if (${titlestyle}) style="${titlestyle}" #end>
#foreach ( $action in $actions )
- <a href="${action.Link}" title="${action.Name}" ><img
src="images/${action.Name}.gif" alt="${action.Name}" border="0"></a>
+ <a href="${action.Link}" title="${action.Name}" ><img
src="images/${action.Name}.gif" alt="${action.Alt}" border="0"></a>
#end
</td>
</tr>
1.72 +4 -1 jakarta-jetspeed/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/changes.xml,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- changes.xml 9 Sep 2002 01:31:52 -0000 1.71
+++ changes.xml 10 Sep 2002 15:12:08 -0000 1.72
@@ -23,6 +23,9 @@
</li>
-->
<li>
+ Add - Bug # 11741 - 2002/09/10 - Implemented Print Friendly Format portlet action
(MO)
+</li>
+<li>
Update - 2002/09/08 - Updated Velocity to v1.3 (PS)
</li>
<li>
1.6 +9 -0 jakarta-jetspeed/xdocs/security.xml
Index: security.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/security.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- security.xml 25 Aug 2002 20:30:37 -0000 1.5
+++ security.xml 10 Sep 2002 15:12:08 -0000 1.6
@@ -347,6 +347,15 @@
<td>close</td>
<td>Allows to temporarily close a portlet (hide its caption and
content)</td>
</tr>
+ <tr>
+ <td>
+ <img src="../images/print.gif"/>
+ </td>
+ <td>print</td>
+ <td>Allows to display current portlet in "print friendly format"
(without navigation and portlet control). Note that the
+ default screen template/layout used may be overriden by setting
<code>action.print.template</code> property in jr.props to your
+ custom screen template.</td>
+ </tr>
</table>
<br/>
<p>
1.30 +3 -3 jakarta-jetspeed/xdocs/todo.xml
Index: todo.xml
===================================================================
RCS file: /home/cvs/jakarta-jetspeed/xdocs/todo.xml,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- todo.xml 9 Sep 2002 01:31:52 -0000 1.29
+++ todo.xml 10 Sep 2002 15:12:08 -0000 1.30
@@ -172,13 +172,13 @@
</tr>
<tr>
<td>11599</td>
- <td>On-Line Profile Import-Export <strong>Done</strong>
+ <td>On-Line Profile Import-Export. <strong>Done</strong>
</td>
<td>MO</td>
</tr>
<tr>
<td>11741</td>
- <td>"Print Friendly Format" action icon</td>
+ <td>"Print Friendly Format" action icon. <strong>Done</strong></td>
<td>MO</td>
</tr>
</table>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>