You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by ta...@apache.org on 2005/04/30 01:21:14 UTC
svn commit: r165367 -
/incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java
Author: taylor
Date: Fri Apr 29 18:21:12 2005
New Revision: 165367
URL: http://svn.apache.org/viewcvs?rev=165367&view=rev
Log:
added support for init parameter to set a stylesheet for the document
best used with frames/iframes
TODO: really need to move the HTML out into a template
Modified:
incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java
Modified: incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java?rev=165367&r1=165366&r2=165367&view=diff
==============================================================================
--- incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java (original)
+++ incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java Fri Apr 29 18:21:12 2005
@@ -58,7 +58,8 @@
public final static String JAVASCRIPT = "<script language='JavaScript'>" +
"function setAnchor(anchor) { location.hash = anchor; } </script>";
- private ContentModelService cms;
+ protected ContentModelService cms;
+ protected String stylesheet;
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
{
@@ -86,11 +87,19 @@
}
if ((doc.getContentType().indexOf("html") != -1) || isText)
- {
+ {
+ // TODO: !! move all of this HTML into JSP or VM
+
String contextPath = request.getContextPath();
String linkage = "<a target='_new' href='" +
contextPath + "/FileServlet?uri=" + currentFile + "'>Print</a>";
- String currentDocument = "<b>" + title + "</b>";
+ String currentDocument = "<b>" + title + "</b>";
+ if (stylesheet != null)
+ {
+ String styledef = "<link rel='stylesheet' type='text/css' media='all' href='" +
+ stylesheet + "'/>";
+ response.getPortletOutputStream().write(styledef.getBytes());
+ }
String out = "<table width='100%'><tr><td align='left' style='font-size:9pt'>"
+ currentDocument + "</td><td align='left'>" + linkage + "</td></tr></table>";
String anchors = "<hr/>"; //createAnchors(doc);
@@ -250,6 +259,7 @@
{
throw new PortletException("Failed to load CMS service");
}
+ stylesheet = config.getInitParameter("stylesheet");
}
}