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 cl...@apache.org on 2006/09/20 19:37:21 UTC
svn commit: r448311 [8/25] - in /incubator/graffito/trunk: ./ api/
api/src/java/org/apache/portals/graffito/context/
api/src/java/org/apache/portals/graffito/exception/
api/src/java/org/apache/portals/graffito/services/core/
api/src/java/org/apache/por...
Modified: incubator/graffito/trunk/applications/framework-portlets/test/pages_if.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/framework-portlets/test/pages_if.xml?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/test/pages_if.xml (original)
+++ incubator/graffito/trunk/applications/framework-portlets/test/pages_if.xml Wed Sep 20 12:37:05 2006
@@ -1,79 +1,79 @@
-<pages>
- <actions>
- <action id="cmsobject" class="org.apache.portals.graffito.portlets.browser.actions.CmsObjectAction" />
- <action id="folder" class="org.apache.portals.graffito.portlets.browser.actions.FolderAction" />
- <action id="document" class="org.apache.portals.graffito.portlets.browser.actions.DocumentAction" />
- <action id="permission" class="org.apache.portals.graffito.portlets.browser.actions.PermissionAction" />
- <action id="forward" class="org.apache.portals.graffito.portlets.browser.actions.ForwardAction" forward = "true" />
- </actions>
-
- <view>
- <page id = "folderViewer" action="folder.retrieve" template="/WEB-INF/view/folder/folder-browser.vm" defaultPage="true" />
- <page id = "documentHtmlTextViewer" action="document.retrieve"
- template="/WEB-INF/view/document/document-view-text-html.vm">
- <editpage portletPageId="documentEdit" />
- </page>
- <page id = "documentUploadViewer" action="document.retrieve" template="/WEB-INF/view/document/document-view-upload.vm">
- <editpage portletPageId="documentEdit" />
- </page>
- </view>
-
- <edit>
- <page id = "folderEdit" template="/WEB-INF/view/folder/folder-tab.vm" defaultPage="true">
- <tab id="folder-edit">
- <page id="children" label="tab.folder-edit.children" template="/WEB-INF/view/folder/folder-children.vm" action =
- "folder.retrieve" defaultTabPage="true" />
- <page id="metadata" label="tab.folder-edit.metadata" template="/WEB-INF/view/folder/folder-metadata.vm" action =
- "folder.retrieve" />
- <page id="security" label="tab.security" template="/WEB-INF/view/security/security-browser.vm" action
- ="permission.retrieve" />
- </tab>
- </page>
-
- <page id = "folderCreate" action="folder.create" template="/WEB-INF/view/folder/folder-metadata.vm" >
- <viewpage portletPageId="folderViewer" />
- </page>
-
- <page id = "documentEdit" template="/WEB-INF/view/document/document-tab.vm">
- <tab id="document-edit">
- <page id="content" label="tab.document-edit.content" >
- <if condition='documentDTO.getDocument().getContentType() == "text/plain"'
- template="/WEB-INF/view/document/document-edit-text.vm"
- action="document.retrieve" defaultTabPage="true" />
- <if condition='documentDTO.getDocument().getContentType() == "text/html"'
- template="/kupu/kupu.vm"
- action="document.retrieve" defaultTabPage="true" />
- <if condition='( !documentDTO.getDocument().getContentType() == "text/html") || (documentDTO.getDocument().getContentType() == "text/plain")'
- template="/WEB-INF/view/document/document-edit-upload.vm"
- action="document.retrieve" defaultTabPage="true" />
- </page>
- <page id="metadata" label="tab.document-edit.metadata" template= "/WEB-INF/view/document/document-edit-metadata.vm" action="document.retrieve" />
- <page id="security" label="tab.security" template= "/WEB-INF/view/security/security-browser.vm"
- action="permission.retrieve" />
- </tab>
-
- <!-- Order is important for the view page reference :
- the engine will the select the first viewpage which has a condition returning true -->
- <viewpage
- condition='documentDTO.getDocument().getContentType().equals("text/plain") || documentDTO.getDocument().getContentType().equals("text/html")'
- portletPageId="documentHtmlTextViewer" />
- <viewpage portletPageId="documentUploadViewer" />
- </page>
-
- <page id = "documentCreate" action="document.createWizard" template="/WEB-INF/view/document/document-edit-metadata.vm" />
-
- <page id = "textEdit" action="document.createWizard" template="/WEB-INF/view/document/document-edit-text.vm" >
- <viewpage portletPageId="documentHtmlTextViewer" />
- </page>
-
- <page id = "htmlEdit" action="document.createWizard" template="/kupu/kupu.vm" >
- <viewpage portletPageId="documentHtmlTextViewer" />
- </page>
-
- <page id = "uploadEdit" action="document.createWizard" template="/WEB-INF/view/document/document-edit-upload.vm" >
- <viewpage portletPageId="documentUploadViewer" />
- </page>
-
- <page id = "permissionCreate" action="permission.create" template="/WEB-INF/view/security/security-permission.vm" />
- </edit>
+<pages>
+ <actions>
+ <action id="cmsobject" class="org.apache.portals.graffito.portlets.browser.actions.CmsObjectAction" />
+ <action id="folder" class="org.apache.portals.graffito.portlets.browser.actions.FolderAction" />
+ <action id="document" class="org.apache.portals.graffito.portlets.browser.actions.DocumentAction" />
+ <action id="permission" class="org.apache.portals.graffito.portlets.browser.actions.PermissionAction" />
+ <action id="forward" class="org.apache.portals.graffito.portlets.browser.actions.ForwardAction" forward = "true" />
+ </actions>
+
+ <view>
+ <page id = "folderViewer" action="folder.retrieve" template="/WEB-INF/view/folder/folder-browser.vm" defaultPage="true" />
+ <page id = "documentHtmlTextViewer" action="document.retrieve"
+ template="/WEB-INF/view/document/document-view-text-html.vm">
+ <editpage portletPageId="documentEdit" />
+ </page>
+ <page id = "documentUploadViewer" action="document.retrieve" template="/WEB-INF/view/document/document-view-upload.vm">
+ <editpage portletPageId="documentEdit" />
+ </page>
+ </view>
+
+ <edit>
+ <page id = "folderEdit" template="/WEB-INF/view/folder/folder-tab.vm" defaultPage="true">
+ <tab id="folder-edit">
+ <page id="children" label="tab.folder-edit.children" template="/WEB-INF/view/folder/folder-children.vm" action =
+ "folder.retrieve" defaultTabPage="true" />
+ <page id="metadata" label="tab.folder-edit.metadata" template="/WEB-INF/view/folder/folder-metadata.vm" action =
+ "folder.retrieve" />
+ <page id="security" label="tab.security" template="/WEB-INF/view/security/security-browser.vm" action
+ ="permission.retrieve" />
+ </tab>
+ </page>
+
+ <page id = "folderCreate" action="folder.create" template="/WEB-INF/view/folder/folder-metadata.vm" >
+ <viewpage portletPageId="folderViewer" />
+ </page>
+
+ <page id = "documentEdit" template="/WEB-INF/view/document/document-tab.vm">
+ <tab id="document-edit">
+ <page id="content" label="tab.document-edit.content" >
+ <if condition='documentDTO.getDocument().getContentType() == "text/plain"'
+ template="/WEB-INF/view/document/document-edit-text.vm"
+ action="document.retrieve" defaultTabPage="true" />
+ <if condition='documentDTO.getDocument().getContentType() == "text/html"'
+ template="/kupu/kupu.vm"
+ action="document.retrieve" defaultTabPage="true" />
+ <if condition='( !documentDTO.getDocument().getContentType() == "text/html") || (documentDTO.getDocument().getContentType() == "text/plain")'
+ template="/WEB-INF/view/document/document-edit-upload.vm"
+ action="document.retrieve" defaultTabPage="true" />
+ </page>
+ <page id="metadata" label="tab.document-edit.metadata" template= "/WEB-INF/view/document/document-edit-metadata.vm" action="document.retrieve" />
+ <page id="security" label="tab.security" template= "/WEB-INF/view/security/security-browser.vm"
+ action="permission.retrieve" />
+ </tab>
+
+ <!-- Order is important for the view page reference :
+ the engine will the select the first viewpage which has a condition returning true -->
+ <viewpage
+ condition='documentDTO.getDocument().getContentType().equals("text/plain") || documentDTO.getDocument().getContentType().equals("text/html")'
+ portletPageId="documentHtmlTextViewer" />
+ <viewpage portletPageId="documentUploadViewer" />
+ </page>
+
+ <page id = "documentCreate" action="document.createWizard" template="/WEB-INF/view/document/document-edit-metadata.vm" />
+
+ <page id = "textEdit" action="document.createWizard" template="/WEB-INF/view/document/document-edit-text.vm" >
+ <viewpage portletPageId="documentHtmlTextViewer" />
+ </page>
+
+ <page id = "htmlEdit" action="document.createWizard" template="/kupu/kupu.vm" >
+ <viewpage portletPageId="documentHtmlTextViewer" />
+ </page>
+
+ <page id = "uploadEdit" action="document.createWizard" template="/WEB-INF/view/document/document-edit-upload.vm" >
+ <viewpage portletPageId="documentUploadViewer" />
+ </page>
+
+ <page id = "permissionCreate" action="permission.create" template="/WEB-INF/view/security/security-permission.vm" />
+ </edit>
</pages>
Propchange: incubator/graffito/trunk/applications/framework-portlets/test/pages_if.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/graffito/trunk/applications/graffito-portlets/maven.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/applications/graffito-portlets/project.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/graffito-portlets/project.xml?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/applications/graffito-portlets/project.xml (original)
+++ incubator/graffito/trunk/applications/graffito-portlets/project.xml Wed Sep 20 12:37:05 2006
@@ -1,251 +1,251 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-Copyright 2004 The Apache Software Foundation
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
- $Id: project.xml 189937 2005-06-10 10:51:53Z ate $
--->
-<project>
- <extend>${basedir}/./../../project.xml</extend>
- <pomVersion>3</pomVersion>
- <artifactId>graffito-portlets</artifactId>
- <name>Graffito Portlets</name>
- <groupId>org.apache.portals.graffito</groupId>
- <description>Graffito Portlets</description>
- <shortDescription>Graffito Portlets</shortDescription>
- <repository>
- <connection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/applications/graffito-portlets</connection>
- <developerConnection>
- scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/applications/graffito-portlets</developerConnection>
- <url>http://svn.apache.org/viewcvs</url>
- </repository>
- <dependencies>
- <dependency>
- <id>graffito-commons</id>
- <groupId>org.apache.portals.graffito</groupId>
- <version>${graffito.version}</version>
- </dependency>
-
- <dependency>
- <id>graffito-api</id>
- <groupId>org.apache.portals.graffito</groupId>
- <version>${graffito.version}</version>
- </dependency>
- <dependency>
- <id>servletapi</id>
- <version>${servlet.api.version}</version>
- <properties>
- <war.bundle>false</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>portlet-api</groupId>
- <artifactId>portlet-api</artifactId>
- <version>${portlet.api.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>false</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>org.apache.portals.jetspeed-2</groupId>
- <artifactId>jetspeed-commons</artifactId>
- <version>${jetspeed.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>false</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>org.apache.portals.jetspeed-2</groupId>
- <artifactId>jetspeed-components</artifactId>
- <version>${jetspeed.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>org.apache.portals.bridges</groupId>
- <artifactId>portals-bridges-common</artifactId>
- <version>${portals.bridges.common.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>org.apache.portals.bridges</groupId>
- <artifactId>portals-bridges-velocity</artifactId>
- <version>${portals.bridges.velocity.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <id>velocity</id>
- <version>${velocity.version}</version>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <id>velocity-tools</id>
- <version>${velocity.tools.version}</version>
- <url>http://jakarta.apache.org/velocity</url>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>${commons.logging.version}</version>
- <type>jar</type>
- <url>http://jakarta.apache.org/commons/logging.html</url>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>${commons.beanutils.version}</version>
- <url>http://jakarta.apache.org/commons/beanutils.html</url>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons.codec.version}</version>
- <url>http://jakarta.apache.org/commons/codec/</url>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>${commons.collections.version}</version>
- <url>http://jakarta.apache.org/commons/collections.html</url>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>${commons.digester.version}</version>
- <url>http://jakarta.apache.org/commons/digester.html</url>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>commons-el</groupId>
- <artifactId>commons-el</artifactId>
- <version>${commons.el.version}</version>
- <url>http://jakarta.apache.org/commons/el/</url>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>${commons.fileupload.version}</version>
- <url>http://jakarta.apache.org/commons/fileupload/</url>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
-
- <dependency>
- <groupId>org.apache.portals.jetspeed-2</groupId>
- <artifactId>jetspeed2-taglib-treecontrol</artifactId>
- <version>${jetspeed.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
-
- <dependency>
- <id>springframework:spring</id>
- <version>${spring.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
-
- <dependency>
- <id>cglib</id>
- <version>${cglib.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
-
- <dependency>
- <id>aopalliance</id>
- <version>${aopalliance.version}</version>
- <type>jar</type>
- <properties>
- <war.bundle>true</war.bundle>
- </properties>
- </dependency>
-
- </dependencies>
- <build>
- <sourceDirectory>src/java</sourceDirectory>
- <resources>
- <resource>
- <directory>${basedir}/src/java/</directory>
- <includes>
- <include>**/*.properties</include>
- </includes>
- <filtering>false</filtering>
- </resource>
- </resources>
- </build>
- <reports>
- <report>maven-jdepend-plugin</report>
- <report>maven-checkstyle-plugin</report>
- <report>maven-pmd-plugin</report>
- <report>maven-changelog-plugin</report>
- <report>maven-file-activity-plugin</report>
- <report>maven-developer-activity-plugin</report>
- <report>maven-license-plugin</report>
- <report>maven-javadoc-plugin</report>
- <report>maven-jxr-plugin</report>
- <report>maven-junit-report-plugin</report>
- <report>maven-tasklist-plugin</report>
- </reports>
- <properties/>
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+ $Id: project.xml 189937 2005-06-10 10:51:53Z ate $
+-->
+<project>
+ <extend>${basedir}/./../../project.xml</extend>
+ <pomVersion>3</pomVersion>
+ <artifactId>graffito-portlets</artifactId>
+ <name>Graffito Portlets</name>
+ <groupId>org.apache.portals.graffito</groupId>
+ <description>Graffito Portlets</description>
+ <shortDescription>Graffito Portlets</shortDescription>
+ <repository>
+ <connection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/applications/graffito-portlets</connection>
+ <developerConnection>
+ scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/applications/graffito-portlets</developerConnection>
+ <url>http://svn.apache.org/viewcvs</url>
+ </repository>
+ <dependencies>
+ <dependency>
+ <id>graffito-commons</id>
+ <groupId>org.apache.portals.graffito</groupId>
+ <version>${graffito.version}</version>
+ </dependency>
+
+ <dependency>
+ <id>graffito-api</id>
+ <groupId>org.apache.portals.graffito</groupId>
+ <version>${graffito.version}</version>
+ </dependency>
+ <dependency>
+ <id>servletapi</id>
+ <version>${servlet.api.version}</version>
+ <properties>
+ <war.bundle>false</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>portlet-api</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>${portlet.api.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>false</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.jetspeed-2</groupId>
+ <artifactId>jetspeed-commons</artifactId>
+ <version>${jetspeed.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>false</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.jetspeed-2</groupId>
+ <artifactId>jetspeed-components</artifactId>
+ <version>${jetspeed.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-common</artifactId>
+ <version>${portals.bridges.common.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.bridges</groupId>
+ <artifactId>portals-bridges-velocity</artifactId>
+ <version>${portals.bridges.velocity.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <id>velocity</id>
+ <version>${velocity.version}</version>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <id>velocity-tools</id>
+ <version>${velocity.tools.version}</version>
+ <url>http://jakarta.apache.org/velocity</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ <type>jar</type>
+ <url>http://jakarta.apache.org/commons/logging.html</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>${commons.beanutils.version}</version>
+ <url>http://jakarta.apache.org/commons/beanutils.html</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
+ <url>http://jakarta.apache.org/commons/codec/</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>${commons.collections.version}</version>
+ <url>http://jakarta.apache.org/commons/collections.html</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>${commons.digester.version}</version>
+ <url>http://jakarta.apache.org/commons/digester.html</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-el</groupId>
+ <artifactId>commons-el</artifactId>
+ <version>${commons.el.version}</version>
+ <url>http://jakarta.apache.org/commons/el/</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>${commons.fileupload.version}</version>
+ <url>http://jakarta.apache.org/commons/fileupload/</url>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.portals.jetspeed-2</groupId>
+ <artifactId>jetspeed2-taglib-treecontrol</artifactId>
+ <version>${jetspeed.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <id>springframework:spring</id>
+ <version>${spring.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <id>cglib</id>
+ <version>${cglib.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <id>aopalliance</id>
+ <version>${aopalliance.version}</version>
+ <type>jar</type>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
+ </dependencies>
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/java/</directory>
+ <includes>
+ <include>**/*.properties</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </build>
+ <reports>
+ <report>maven-jdepend-plugin</report>
+ <report>maven-checkstyle-plugin</report>
+ <report>maven-pmd-plugin</report>
+ <report>maven-changelog-plugin</report>
+ <report>maven-file-activity-plugin</report>
+ <report>maven-developer-activity-plugin</report>
+ <report>maven-license-plugin</report>
+ <report>maven-javadoc-plugin</report>
+ <report>maven-jxr-plugin</report>
+ <report>maven-junit-report-plugin</report>
+ <report>maven-tasklist-plugin</report>
+ </reports>
+ <properties/>
</project>
Propchange: incubator/graffito/trunk/applications/graffito-portlets/project.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/AbstractTreePortlet.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/AbstractTreePortlet.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/AbstractTreePortlet.java (original)
+++ incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/AbstractTreePortlet.java Wed Sep 20 12:37:05 2006
@@ -1,220 +1,220 @@
-/*
- * Copyright 2000-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.portals.graffito.portlets;
-
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-
-import org.apache.portals.bridges.common.GenericServletPortlet;
-import org.apache.portals.graffito.model.core.Content;
-import org.apache.portals.graffito.model.core.Folder;
-import org.apache.portals.graffito.portlets.tree.CMSTreeLoader;
-import org.apache.portals.graffito.portlets.util.ServiceAccessor;
-import org.apache.portals.graffito.services.core.ContentModelService;
-import org.apache.portals.graffito.services.search.ContentSearchService;
-
-
-/**
- * AbstractGraffitoPortlet
- *
- * @author <a href="mailto:dtaylor@itgroundwork.com">David Sean Taylor</a>
- * @version $Id: $
- */
-
-public class AbstractTreePortlet extends GenericServletPortlet
-{
- protected ContentSearchService search = null;
- protected ContentModelService cms = null;
- protected CMSTreeLoader loader ;
- protected String anchorImage;
- protected Map imageMap = new HashMap();
- protected String folderImage;
- protected String documentImage;
- protected String rootImage;
- protected String rootLabel;
-
- public void init(PortletConfig config) throws PortletException
- {
- super.init(config);
-
- search = (ContentSearchService)ServiceAccessor.getSearchService();
- if (search == null)
- {
- throw new PortletException("Failed to load CMS Search service");
- }
- cms = ServiceAccessor.getModelService();
- if (cms == null)
- {
- throw new PortletException("Failed to load CMS service");
- }
-
- loader = createTreeLoader(cms);
-
- String extensions = config.getInitParameter("extensions");
- String images = config.getInitParameter("images");
- anchorImage = config.getInitParameter("anchorImage");
- folderImage = config.getInitParameter("folderImage");
- documentImage = config.getInitParameter("documentImage");
- rootImage = config.getInitParameter("rootImage");
- rootLabel = config.getInitParameter("rootLabel");
-
- if (extensions == null)
- {
- extensions = "text/html,text/plain,application/pdf";
- }
- if (images == null)
- {
- images = "html-document.gif, text-document.gif, pdficon.jpg";
- }
- if (anchorImage == null)
- {
- anchorImage = "anchorLink.gif";
- }
- if (folderImage == null)
- {
- folderImage = "folder.gif";
- }
- if (documentImage == null)
- {
- documentImage = "document.gif";
- }
- if (rootImage == null)
- {
- rootImage = "bookshelf.gif";
- }
- if (rootLabel == null)
- {
- rootLabel = "Bookshelf";
- }
-
- String[]ext = stringToArray(extensions, ", ");
- String[]img = stringToArray(images, ", ");
- int max = (ext.length > img.length) ? img.length : ext.length;
- for (int ix = 0; ix < max; ix++)
- {
- imageMap.put(ext[ix], img[ix]);
- }
- }
-
- public CMSTreeLoader createTreeLoader(ContentModelService cms)
- {
- return new CMSTreeLoader(cms, this);
- }
-
- public Comparator getComparator(String nodeLevel)
- {
- return CMSTreeLoader.cmsComparator;
- }
-
- public static final String[] stringToArray(String str, String separators)
- {
- StringTokenizer tokenizer;
- String[] array = null;
- int count = 0;
-
- if (str == null)
- return array;
-
- if (separators == null)
- separators = ", ";
-
- tokenizer = new StringTokenizer(str, separators);
- if ((count = tokenizer.countTokens()) <= 0) {
- return array;
- }
-
- array = new String[count];
-
- int ix = 0;
- while (tokenizer.hasMoreTokens())
- {
- array[ix] = tokenizer.nextToken();
- ix++;
- }
-
- return array;
- }
-
- /**
- * @return Returns the anchorImage.
- */
- public String getAnchorImage()
- {
- return anchorImage;
- }
- /**
- * @return Returns the folderImage.
- */
- public String getFolderImage()
- {
- return folderImage;
- }
-
- public String getImageForContentType(String contentType)
- {
- String ct = (String)imageMap.get(contentType);
- if (ct == null)
- return documentImage;
- return ct;
- }
- /**
- * @return Returns the documentImage.
- */
- public String getDocumentImage()
- {
- return documentImage;
- }
- /**
- * @return Returns the rootImage.
- */
- public String getRootImage()
- {
- return rootImage;
- }
- /**
- * @return Returns the rootLabel.
- */
- public String getRootLabel()
- {
- return rootLabel;
- }
-
- public String getFolderTitle(Folder folder)
- {
- return folder.getName();
- }
-
- public String getDocumentTitle(Content content)
- {
- String title = content.getProperty("title");
- if (title == null)
- {
- title = content.getName();
- int pos = title.lastIndexOf(".");
- if (pos != -1)
- {
- title = title.substring(0, pos);
- }
- }
- return title;
- }
-
-}
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+
+import org.apache.portals.bridges.common.GenericServletPortlet;
+import org.apache.portals.graffito.model.core.Content;
+import org.apache.portals.graffito.model.core.Folder;
+import org.apache.portals.graffito.portlets.tree.CMSTreeLoader;
+import org.apache.portals.graffito.portlets.util.ServiceAccessor;
+import org.apache.portals.graffito.services.core.ContentModelService;
+import org.apache.portals.graffito.services.search.ContentSearchService;
+
+
+/**
+ * AbstractGraffitoPortlet
+ *
+ * @author <a href="mailto:dtaylor@itgroundwork.com">David Sean Taylor</a>
+ * @version $Id: $
+ */
+
+public class AbstractTreePortlet extends GenericServletPortlet
+{
+ protected ContentSearchService search = null;
+ protected ContentModelService cms = null;
+ protected CMSTreeLoader loader ;
+ protected String anchorImage;
+ protected Map imageMap = new HashMap();
+ protected String folderImage;
+ protected String documentImage;
+ protected String rootImage;
+ protected String rootLabel;
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ super.init(config);
+
+ search = (ContentSearchService)ServiceAccessor.getSearchService();
+ if (search == null)
+ {
+ throw new PortletException("Failed to load CMS Search service");
+ }
+ cms = ServiceAccessor.getModelService();
+ if (cms == null)
+ {
+ throw new PortletException("Failed to load CMS service");
+ }
+
+ loader = createTreeLoader(cms);
+
+ String extensions = config.getInitParameter("extensions");
+ String images = config.getInitParameter("images");
+ anchorImage = config.getInitParameter("anchorImage");
+ folderImage = config.getInitParameter("folderImage");
+ documentImage = config.getInitParameter("documentImage");
+ rootImage = config.getInitParameter("rootImage");
+ rootLabel = config.getInitParameter("rootLabel");
+
+ if (extensions == null)
+ {
+ extensions = "text/html,text/plain,application/pdf";
+ }
+ if (images == null)
+ {
+ images = "html-document.gif, text-document.gif, pdficon.jpg";
+ }
+ if (anchorImage == null)
+ {
+ anchorImage = "anchorLink.gif";
+ }
+ if (folderImage == null)
+ {
+ folderImage = "folder.gif";
+ }
+ if (documentImage == null)
+ {
+ documentImage = "document.gif";
+ }
+ if (rootImage == null)
+ {
+ rootImage = "bookshelf.gif";
+ }
+ if (rootLabel == null)
+ {
+ rootLabel = "Bookshelf";
+ }
+
+ String[]ext = stringToArray(extensions, ", ");
+ String[]img = stringToArray(images, ", ");
+ int max = (ext.length > img.length) ? img.length : ext.length;
+ for (int ix = 0; ix < max; ix++)
+ {
+ imageMap.put(ext[ix], img[ix]);
+ }
+ }
+
+ public CMSTreeLoader createTreeLoader(ContentModelService cms)
+ {
+ return new CMSTreeLoader(cms, this);
+ }
+
+ public Comparator getComparator(String nodeLevel)
+ {
+ return CMSTreeLoader.cmsComparator;
+ }
+
+ public static final String[] stringToArray(String str, String separators)
+ {
+ StringTokenizer tokenizer;
+ String[] array = null;
+ int count = 0;
+
+ if (str == null)
+ return array;
+
+ if (separators == null)
+ separators = ", ";
+
+ tokenizer = new StringTokenizer(str, separators);
+ if ((count = tokenizer.countTokens()) <= 0) {
+ return array;
+ }
+
+ array = new String[count];
+
+ int ix = 0;
+ while (tokenizer.hasMoreTokens())
+ {
+ array[ix] = tokenizer.nextToken();
+ ix++;
+ }
+
+ return array;
+ }
+
+ /**
+ * @return Returns the anchorImage.
+ */
+ public String getAnchorImage()
+ {
+ return anchorImage;
+ }
+ /**
+ * @return Returns the folderImage.
+ */
+ public String getFolderImage()
+ {
+ return folderImage;
+ }
+
+ public String getImageForContentType(String contentType)
+ {
+ String ct = (String)imageMap.get(contentType);
+ if (ct == null)
+ return documentImage;
+ return ct;
+ }
+ /**
+ * @return Returns the documentImage.
+ */
+ public String getDocumentImage()
+ {
+ return documentImage;
+ }
+ /**
+ * @return Returns the rootImage.
+ */
+ public String getRootImage()
+ {
+ return rootImage;
+ }
+ /**
+ * @return Returns the rootLabel.
+ */
+ public String getRootLabel()
+ {
+ return rootLabel;
+ }
+
+ public String getFolderTitle(Folder folder)
+ {
+ return folder.getName();
+ }
+
+ public String getDocumentTitle(Content content)
+ {
+ String title = content.getProperty("title");
+ if (title == null)
+ {
+ title = content.getName();
+ int pos = title.lastIndexOf(".");
+ if (pos != -1)
+ {
+ title = title.substring(0, pos);
+ }
+ }
+ return title;
+ }
+
+}
Propchange: incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/AbstractTreePortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- 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 Wed Sep 20 12:37:05 2006
@@ -1,281 +1,281 @@
-/*
- * Copyright 2000-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.portals.graffito.portlets;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.portlet.ActionRequest;
-import javax.portlet.ActionResponse;
-import javax.portlet.PortletConfig;
-import javax.portlet.PortletException;
-import javax.portlet.PortletMode;
-import javax.portlet.PortletPreferences;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.WindowState;
-
-import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
-import org.apache.portals.graffito.exception.ContentManagementException;
-import org.apache.portals.graffito.model.dm.Document;
-import org.apache.portals.graffito.portlets.util.ServiceAccessor;
-import org.apache.portals.graffito.services.core.ContentModelService;
-import org.apache.portals.graffito.services.dm.DocumentModelService;
-import org.apache.portals.messaging.PortletMessaging;
-import org.apache.velocity.context.Context;
-
-
-/**
- * CMS Document Displayer
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: CMSDocumentPortlet.java,v 1.5 2005/02/19 22:29:28 david Exp $
- */
-public class DocumentPortlet extends GenericVelocityPortlet
-{
- public final static String CURRENT_ISSUE = "current_issue";
- public final static String CURRENT_FOLDER = "current_folder";
- public final static String CURRENT_PAGE = "current_page";
- public final static String CURRENT_USER = "current_user";
- public final static String REQUEST_NODE = "node";
- /** the selected leaf node in the tree view */
- public final static String REQUEST_SELECT_NODE = "select_node";
-
- public final static String JAVASCRIPT = "<script language='JavaScript'>" +
- "function setAnchor(anchor) { location.hash = anchor; } </script>";
-
- protected DocumentModelService cms;
- protected String stylesheet;
- protected boolean useScrollableDiv = true;
-
- public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
- {
- response.setContentType("text/html");
-
- String currentFile = (String) PortletMessaging.receive(request, "FileDisplayer", "current_file");
-
- String fileName = null;
- PortletPreferences prefs = request.getPreferences();
- String uri = prefs.getValue("document-uri", null);
- if (uri != null && uri.length() > 0)
- {
- currentFile = uri;
- }
- if(currentFile != null)
- {
- try
- {
- Document doc = cms.getDocument(currentFile);
- boolean isText = doc.getContentType().equals("text/plain");
- String title = doc.getProperty("title");
- if (title == null)
- {
- title = doc.getName();
- }
-
- 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>";
- 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='right'>" + linkage + "</td></tr></table>";
- String anchors = "<hr/>"; //createAnchors(doc);
- response.getPortletOutputStream().write(out.getBytes());
- //response.getPortletOutputStream().write(anchors.getBytes());
-
- if (useScrollableDiv)
- response.getPortletOutputStream().write(DIV_START.getBytes());
- if (isText)
- response.getPortletOutputStream().write("<PRE>".getBytes());
- drain(doc.getDocumentStream().getContentStream(), response.getPortletOutputStream());
- if (isText)
- response.getPortletOutputStream().write("</PRE>".getBytes());
- if (useScrollableDiv)
- response.getPortletOutputStream().write(DIV_END.getBytes());
-
- int hash = currentFile.indexOf('#');
- if(hash != -1)
- {
- String anchor = currentFile.substring(hash+1);
- response.getPortletOutputStream().write(JAVASCRIPT.getBytes());
- response.getPortletOutputStream().write("<script>setAnchor('".getBytes());
- response.getPortletOutputStream().write(anchor.getBytes());
- response.getPortletOutputStream().write("');</script>".getBytes());
- }
- }
- else if ((doc.getContentType().indexOf("image/") != -1))
- {
- String currentDocument = ""; //"<b>" + title + "</b>";
- String anchors = "<hr/>"; //createAnchors(doc);
- response.getPortletOutputStream().write(currentDocument.getBytes());
- //response.getPortletOutputStream().write(anchors.getBytes());
- if (useScrollableDiv)
- response.getPortletOutputStream().write(DIV_START.getBytes());
- String gif = "<IMG SRC='" + request.getContextPath() + "/FileServlet?uri=" + doc.getUri() + "'/>";
- response.getPortletOutputStream().write(gif.getBytes());
- if (useScrollableDiv)
- response.getPortletOutputStream().write(DIV_END.getBytes());
- }
- else
- {
- renderBinaryDoc(request, response, currentFile, doc);
- }
- }
- catch (ContentManagementException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- private String createAnchors(Document doc)
- {
- return "<hr/><a href='#'>Top</a> <a href='#010'>Sample Anchor 1</a> <a href='#014'>Sample Anchor 2</a> <a href='#020'>Sample Anchor 3</a><hr/>";
- }
-
- private void renderBinaryDoc(RenderRequest request, RenderResponse response, String currentFile, Document doc)
- throws IOException
- {
- String title = doc.getProperty("title");
- if (title == null)
- title = doc.getName();
-
- String contextPath = request.getContextPath();
-
- String linkage = "<table width='100%'><tr><td align='left' style='font-size:9pt'>"
- + "</td><td align='right'>" + "<a target='_new' href='" +
- contextPath + "/FileServlet?uri=" + currentFile + "'>View in New Window</a>" + "</td></tr></table>";
-
- String currentDocument = /* "<div>Document: <b>" + title + "</b> " + */ linkage;
- response.getPortletOutputStream().write(currentDocument.getBytes());
-
- String iframe = "<iframe src=\"" + contextPath + "/FileServlet?uri=" + currentFile + "\"";
- if (request.getWindowState().equals(WindowState.MAXIMIZED))
- iframe += " height=\"800\" width=\"100%\"";
- else
- iframe += " height=\"700\" width=\"100%\"";
- iframe += "></iframe>";
- response.getPortletOutputStream().write(iframe.getBytes());
- }
-
- public void doEdit(RenderRequest request, RenderResponse response)
- throws PortletException, IOException
- {
- response.setContentType("text/html");
- String currentArticle = (String) PortletMessaging.receive(request, "FileDisplayer", "current_file");
- if (currentArticle == null)
- {
- return;
- }
-
- try
- {
- Document document = cms.getDocument(currentArticle);
- Context context = super.getContext(request);
- context.put("reference", (String)document.getProperty("reference"));
- context.put("title", (String)document.getProperty("title"));
- context.put("displayTitle", (String)document.getProperty("displayTitle"));
- context.put("year", (String)document.getProperty("year"));
- context.put("month", (String)document.getProperty("month"));
- if (document.getContentType().indexOf("pdf") != -1)
- context.put("issue", (String)document.getProperty("articleRefs"));
- else
- context.put("issue", (String)document.getProperty("issue"));
-
- context.put("keywords", "example keywords, feature, not implemented, yet");
- }
- catch (ContentManagementException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- super.doEdit(request, response);
- }
-
- public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
- throws PortletException,
- IOException
- {
- if (actionRequest.getPortletMode() == PortletMode.EDIT)
- {
- String title = (String)actionRequest.getParameter("title");
- // TODO: oops no API to save document
- }
- actionResponse.setPortletMode(PortletMode.VIEW);
- super.processAction(actionRequest, actionResponse);
-
- }
-
- // todo: make the scroll area and width configurable by prefs
- private static final String DIV_START = "<DIV id='itdbscroll' style='OVERFLOW: auto; WIDTH: 100%; HEIGHT: 600px;'>";
- private static final String DIV_END = "</DIV>";
-
- private static final int BLOCK_SIZE = 4096;
-
- public static void drain(InputStream r,OutputStream w) throws IOException
- {
- byte[] bytes=new byte[BLOCK_SIZE];
- try
- {
- int length=r.read(bytes);
- while(length!=-1)
- {
- if(length!=0)
- {
- w.write(bytes,0,length);
- }
- length=r.read(bytes);
- }
- }
- finally
- {
- bytes=null;
- }
-
- }
-
- public void init(PortletConfig config) throws PortletException
- {
- super.init(config);
-
- cms = ServiceAccessor.getDocumentService();
- if (cms == null)
- {
- throw new PortletException("Failed to load CMS service");
- }
- stylesheet = config.getInitParameter("stylesheet");
- String div = config.getInitParameter("scrollableDiv");
- if (div != null)
- {
- if (div.equalsIgnoreCase("false"))
- useScrollableDiv = false;
- }
- }
-
-}
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletPreferences;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.WindowState;
+
+import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
+import org.apache.portals.graffito.exception.ContentManagementException;
+import org.apache.portals.graffito.model.dm.Document;
+import org.apache.portals.graffito.portlets.util.ServiceAccessor;
+import org.apache.portals.graffito.services.core.ContentModelService;
+import org.apache.portals.graffito.services.dm.DocumentModelService;
+import org.apache.portals.messaging.PortletMessaging;
+import org.apache.velocity.context.Context;
+
+
+/**
+ * CMS Document Displayer
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: CMSDocumentPortlet.java,v 1.5 2005/02/19 22:29:28 david Exp $
+ */
+public class DocumentPortlet extends GenericVelocityPortlet
+{
+ public final static String CURRENT_ISSUE = "current_issue";
+ public final static String CURRENT_FOLDER = "current_folder";
+ public final static String CURRENT_PAGE = "current_page";
+ public final static String CURRENT_USER = "current_user";
+ public final static String REQUEST_NODE = "node";
+ /** the selected leaf node in the tree view */
+ public final static String REQUEST_SELECT_NODE = "select_node";
+
+ public final static String JAVASCRIPT = "<script language='JavaScript'>" +
+ "function setAnchor(anchor) { location.hash = anchor; } </script>";
+
+ protected DocumentModelService cms;
+ protected String stylesheet;
+ protected boolean useScrollableDiv = true;
+
+ public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+
+ String currentFile = (String) PortletMessaging.receive(request, "FileDisplayer", "current_file");
+
+ String fileName = null;
+ PortletPreferences prefs = request.getPreferences();
+ String uri = prefs.getValue("document-uri", null);
+ if (uri != null && uri.length() > 0)
+ {
+ currentFile = uri;
+ }
+ if(currentFile != null)
+ {
+ try
+ {
+ Document doc = cms.getDocument(currentFile);
+ boolean isText = doc.getContentType().equals("text/plain");
+ String title = doc.getProperty("title");
+ if (title == null)
+ {
+ title = doc.getName();
+ }
+
+ 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>";
+ 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='right'>" + linkage + "</td></tr></table>";
+ String anchors = "<hr/>"; //createAnchors(doc);
+ response.getPortletOutputStream().write(out.getBytes());
+ //response.getPortletOutputStream().write(anchors.getBytes());
+
+ if (useScrollableDiv)
+ response.getPortletOutputStream().write(DIV_START.getBytes());
+ if (isText)
+ response.getPortletOutputStream().write("<PRE>".getBytes());
+ drain(doc.getDocumentStream().getContentStream(), response.getPortletOutputStream());
+ if (isText)
+ response.getPortletOutputStream().write("</PRE>".getBytes());
+ if (useScrollableDiv)
+ response.getPortletOutputStream().write(DIV_END.getBytes());
+
+ int hash = currentFile.indexOf('#');
+ if(hash != -1)
+ {
+ String anchor = currentFile.substring(hash+1);
+ response.getPortletOutputStream().write(JAVASCRIPT.getBytes());
+ response.getPortletOutputStream().write("<script>setAnchor('".getBytes());
+ response.getPortletOutputStream().write(anchor.getBytes());
+ response.getPortletOutputStream().write("');</script>".getBytes());
+ }
+ }
+ else if ((doc.getContentType().indexOf("image/") != -1))
+ {
+ String currentDocument = ""; //"<b>" + title + "</b>";
+ String anchors = "<hr/>"; //createAnchors(doc);
+ response.getPortletOutputStream().write(currentDocument.getBytes());
+ //response.getPortletOutputStream().write(anchors.getBytes());
+ if (useScrollableDiv)
+ response.getPortletOutputStream().write(DIV_START.getBytes());
+ String gif = "<IMG SRC='" + request.getContextPath() + "/FileServlet?uri=" + doc.getUri() + "'/>";
+ response.getPortletOutputStream().write(gif.getBytes());
+ if (useScrollableDiv)
+ response.getPortletOutputStream().write(DIV_END.getBytes());
+ }
+ else
+ {
+ renderBinaryDoc(request, response, currentFile, doc);
+ }
+ }
+ catch (ContentManagementException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private String createAnchors(Document doc)
+ {
+ return "<hr/><a href='#'>Top</a> <a href='#010'>Sample Anchor 1</a> <a href='#014'>Sample Anchor 2</a> <a href='#020'>Sample Anchor 3</a><hr/>";
+ }
+
+ private void renderBinaryDoc(RenderRequest request, RenderResponse response, String currentFile, Document doc)
+ throws IOException
+ {
+ String title = doc.getProperty("title");
+ if (title == null)
+ title = doc.getName();
+
+ String contextPath = request.getContextPath();
+
+ String linkage = "<table width='100%'><tr><td align='left' style='font-size:9pt'>"
+ + "</td><td align='right'>" + "<a target='_new' href='" +
+ contextPath + "/FileServlet?uri=" + currentFile + "'>View in New Window</a>" + "</td></tr></table>";
+
+ String currentDocument = /* "<div>Document: <b>" + title + "</b> " + */ linkage;
+ response.getPortletOutputStream().write(currentDocument.getBytes());
+
+ String iframe = "<iframe src=\"" + contextPath + "/FileServlet?uri=" + currentFile + "\"";
+ if (request.getWindowState().equals(WindowState.MAXIMIZED))
+ iframe += " height=\"800\" width=\"100%\"";
+ else
+ iframe += " height=\"700\" width=\"100%\"";
+ iframe += "></iframe>";
+ response.getPortletOutputStream().write(iframe.getBytes());
+ }
+
+ public void doEdit(RenderRequest request, RenderResponse response)
+ throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+ String currentArticle = (String) PortletMessaging.receive(request, "FileDisplayer", "current_file");
+ if (currentArticle == null)
+ {
+ return;
+ }
+
+ try
+ {
+ Document document = cms.getDocument(currentArticle);
+ Context context = super.getContext(request);
+ context.put("reference", (String)document.getProperty("reference"));
+ context.put("title", (String)document.getProperty("title"));
+ context.put("displayTitle", (String)document.getProperty("displayTitle"));
+ context.put("year", (String)document.getProperty("year"));
+ context.put("month", (String)document.getProperty("month"));
+ if (document.getContentType().indexOf("pdf") != -1)
+ context.put("issue", (String)document.getProperty("articleRefs"));
+ else
+ context.put("issue", (String)document.getProperty("issue"));
+
+ context.put("keywords", "example keywords, feature, not implemented, yet");
+ }
+ catch (ContentManagementException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ super.doEdit(request, response);
+ }
+
+ public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
+ throws PortletException,
+ IOException
+ {
+ if (actionRequest.getPortletMode() == PortletMode.EDIT)
+ {
+ String title = (String)actionRequest.getParameter("title");
+ // TODO: oops no API to save document
+ }
+ actionResponse.setPortletMode(PortletMode.VIEW);
+ super.processAction(actionRequest, actionResponse);
+
+ }
+
+ // todo: make the scroll area and width configurable by prefs
+ private static final String DIV_START = "<DIV id='itdbscroll' style='OVERFLOW: auto; WIDTH: 100%; HEIGHT: 600px;'>";
+ private static final String DIV_END = "</DIV>";
+
+ private static final int BLOCK_SIZE = 4096;
+
+ public static void drain(InputStream r,OutputStream w) throws IOException
+ {
+ byte[] bytes=new byte[BLOCK_SIZE];
+ try
+ {
+ int length=r.read(bytes);
+ while(length!=-1)
+ {
+ if(length!=0)
+ {
+ w.write(bytes,0,length);
+ }
+ length=r.read(bytes);
+ }
+ }
+ finally
+ {
+ bytes=null;
+ }
+
+ }
+
+ public void init(PortletConfig config) throws PortletException
+ {
+ super.init(config);
+
+ cms = ServiceAccessor.getDocumentService();
+ if (cms == null)
+ {
+ throw new PortletException("Failed to load CMS service");
+ }
+ stylesheet = config.getInitParameter("stylesheet");
+ String div = config.getInitParameter("scrollableDiv");
+ if (div != null)
+ {
+ if (div.equalsIgnoreCase("false"))
+ useScrollableDiv = false;
+ }
+ }
+
+}
Propchange: incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/DocumentPortlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/FilePortlet.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/FilePortlet.java?view=diff&rev=448311&r1=448310&r2=448311
==============================================================================
--- incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/FilePortlet.java (original)
+++ incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/FilePortlet.java Wed Sep 20 12:37:05 2006
@@ -1,96 +1,96 @@
-/*
- * Copyright 2000-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.portals.graffito.portlets;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.portlet.PortletException;
-import javax.portlet.RenderRequest;
-import javax.portlet.RenderResponse;
-import javax.portlet.PortletPreferences;
-
-import org.apache.portals.bridges.common.GenericServletPortlet;
-
-/*
- * Copyright 2000-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * FilePortlet
- *
- * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
- * @version $Id: FilePortlet.java,v 1.2 2005/02/16 22:58:31 david Exp $
- */
-public class FilePortlet extends GenericServletPortlet
-{
-
- public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
- {
- response.setContentType("text/html");
- PortletPreferences prefs = request.getPreferences();
- String fileName = prefs.getValue("file", null);
- if (fileName != null)
- {
- InputStream is = this.getPortletContext().getResourceAsStream(fileName);
- drain(is, response.getPortletOutputStream());
- is.close();
- }
- else
- {
- response.getWriter().println("Could not find file preference ");
- }
- }
-
- static final int BLOCK_SIZE=4096;
-
- public static void drain(InputStream r,OutputStream w) throws IOException
- {
- byte[] bytes=new byte[BLOCK_SIZE];
- try
- {
- int length=r.read(bytes);
- while(length!=-1)
- {
- if(length!=0)
- {
- w.write(bytes,0,length);
- }
- length=r.read(bytes);
- }
- }
- finally
- {
- bytes=null;
- }
-
- }
-
-
-}
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletPreferences;
+
+import org.apache.portals.bridges.common.GenericServletPortlet;
+
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * FilePortlet
+ *
+ * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
+ * @version $Id: FilePortlet.java,v 1.2 2005/02/16 22:58:31 david Exp $
+ */
+public class FilePortlet extends GenericServletPortlet
+{
+
+ public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+ {
+ response.setContentType("text/html");
+ PortletPreferences prefs = request.getPreferences();
+ String fileName = prefs.getValue("file", null);
+ if (fileName != null)
+ {
+ InputStream is = this.getPortletContext().getResourceAsStream(fileName);
+ drain(is, response.getPortletOutputStream());
+ is.close();
+ }
+ else
+ {
+ response.getWriter().println("Could not find file preference ");
+ }
+ }
+
+ static final int BLOCK_SIZE=4096;
+
+ public static void drain(InputStream r,OutputStream w) throws IOException
+ {
+ byte[] bytes=new byte[BLOCK_SIZE];
+ try
+ {
+ int length=r.read(bytes);
+ while(length!=-1)
+ {
+ if(length!=0)
+ {
+ w.write(bytes,0,length);
+ }
+ length=r.read(bytes);
+ }
+ }
+ finally
+ {
+ bytes=null;
+ }
+
+ }
+
+
+}
Propchange: incubator/graffito/trunk/applications/graffito-portlets/src/java/org/apache/portals/graffito/portlets/FilePortlet.java
------------------------------------------------------------------------------
svn:eol-style = native