You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2009/08/28 05:40:35 UTC

svn commit: r808744 - in /ofbiz/trunk: applications/accounting/data/helpdata/ applications/accounting/documents/ applications/commonext/ applications/commonext/data/ applications/commonext/documents/ applications/content/data/ applications/content/src/...

Author: hansbak
Date: Fri Aug 28 03:40:33 2009
New Revision: 808744

URL: http://svn.apache.org/viewvc?rev=808744&view=rev
Log:
Added the possibility of processing/displaying xml files in the docbook format in verious other formats like html pdf etc. To view the Example document in HTML format go to content -> content ->  navigate -> documents -> 'apache ofbiz in html format' The HTML version is working however the pdf version does not work yet. If you want to help, have a look in ModelScreenWidget.java where at the moment the complete processing from xml to pdf is concentrated the problem is the empty pdf output document with the wrong mimetype.

Added:
    ofbiz/trunk/applications/accounting/documents/
    ofbiz/trunk/applications/accounting/documents/Accounting.xml   (with props)
    ofbiz/trunk/applications/commonext/data/CommonExtSeedData.xml
      - copied, changed from r805645, ofbiz/trunk/applications/commonext/data/CommonExtHelpData.xml
    ofbiz/trunk/applications/commonext/documents/
    ofbiz/trunk/applications/commonext/documents/ApacheOfbiz.xml   (with props)
    ofbiz/trunk/specialpurpose/myportal/data/helpdata/
    ofbiz/trunk/specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml   (with props)
    ofbiz/trunk/specialpurpose/myportal/documents/
    ofbiz/trunk/specialpurpose/myportal/documents/MyPortal.xml   (with props)
Removed:
    ofbiz/trunk/applications/commonext/data/CommonExtHelpData.xml
Modified:
    ofbiz/trunk/applications/accounting/data/helpdata/HELP_ACCOUNTING.xml
    ofbiz/trunk/applications/commonext/ofbiz-component.xml
    ofbiz/trunk/applications/content/data/ContentTypeData.xml
    ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
    ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
    ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml
    ofbiz/trunk/applications/content/widget/content/ContentForms.xml
    ofbiz/trunk/applications/content/widget/content/ContentScreens.xml
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
    ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml

Modified: ofbiz/trunk/applications/accounting/data/helpdata/HELP_ACCOUNTING.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/helpdata/HELP_ACCOUNTING.xml?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/helpdata/HELP_ACCOUNTING.xml (original)
+++ ofbiz/trunk/applications/accounting/data/helpdata/HELP_ACCOUNTING.xml Fri Aug 28 03:40:33 2009
@@ -17,14 +17,15 @@
     specific language governing permissions and limitations
     under the License.
 -->
-<root>
-    <generalTitle>
-        The Content Manager.
-    </generalTitle>
-    <general>
-        <section>
-            <text>The Content Management System (CMS) is designed to store data once and then allow it to be reused in multiple arrangements.</text>
-        </section>
-    </general>
-</root>
+<section xmlns="http://docbook.org/ns/docbook"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://docbook.org/ns/docbook ../../../content/dtd/docbook.xsd">
+    <title>
+        The Accounting Manager.
+    </title>
+    <para>
+        
+          The accounting manager
+    </para>
+</section>
 

Added: ofbiz/trunk/applications/accounting/documents/Accounting.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/documents/Accounting.xml?rev=808744&view=auto
==============================================================================
--- ofbiz/trunk/applications/accounting/documents/Accounting.xml (added)
+++ ofbiz/trunk/applications/accounting/documents/Accounting.xml Fri Aug 28 03:40:33 2009
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+-->
+<chapter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://docbook.org/ns/docbook ../../content/dtd/docbook.xsd"
+ xmlns="http://docbook.org/ns/docbook">
+    <title>The Accounting Component</title>
+    <section>
+        <title>Introduction</title>
+        <para>
+            and a introduction paragraph in Accounting
+        </para>
+    </section>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 
+        href="../data/helpdata/HELP_ACCOUNTING.xml"/>
+</chapter>

Propchange: ofbiz/trunk/applications/accounting/documents/Accounting.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/accounting/documents/Accounting.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/accounting/documents/Accounting.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: ofbiz/trunk/applications/commonext/data/CommonExtSeedData.xml (from r805645, ofbiz/trunk/applications/commonext/data/CommonExtHelpData.xml)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/data/CommonExtSeedData.xml?p2=ofbiz/trunk/applications/commonext/data/CommonExtSeedData.xml&p1=ofbiz/trunk/applications/commonext/data/CommonExtHelpData.xml&r1=805645&r2=808744&rev=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/data/CommonExtHelpData.xml (original)
+++ ofbiz/trunk/applications/commonext/data/CommonExtSeedData.xml Fri Aug 28 03:40:33 2009
@@ -20,7 +20,7 @@
 <entity-engine-xml>
     <!-- create some keys to be sure all data will load the firs time -->
     <DataResource dataResourceId="HELP_TEMPL"/>
+    <Content contentId="TREE_ROOT"/>
     <Content contentId="HELP_ROOT"/>
     <Content contentId="HELP_MYPORTAL"/>
-    
 </entity-engine-xml>
\ No newline at end of file

Added: ofbiz/trunk/applications/commonext/documents/ApacheOfbiz.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/documents/ApacheOfbiz.xml?rev=808744&view=auto
==============================================================================
--- ofbiz/trunk/applications/commonext/documents/ApacheOfbiz.xml (added)
+++ ofbiz/trunk/applications/commonext/documents/ApacheOfbiz.xml Fri Aug 28 03:40:33 2009
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+-->
+<book xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://docbook.org/ns/docbook ../../content/dtd/docbook.xsd"
+ xmlns="http://docbook.org/ns/docbook">
+    
+    <preface>
+        <para>
+            This Book is in an experimental stage and acts as a proof of concept. It could be the start of moving the ofbiz documentation from the current <ulink type="http"
+                url="http://docs.ofbiz.org">OFBiz documentation site</ulink> to the OFBiz content component. It is currently open for discussion by the OFBiz community. 
+        </para>
+        <para>
+            The advantages of using it within OFBiz are:
+            <orderedlist>
+                <listitem>No external system required for documentation</listitem>
+                <listitem>The content of the internal help files can be used within the documentation</listitem>
+                <listitem>The documentation always has the same version as the system (It is part of it)</listitem>
+                <listitem>The content is stored in a internationally accepted <ulink type="http" url="http://www.docbook.org">'DocBook'</ulink> format</listitem>
+                <listitem>The content can be easily presented in the selected visual schemas (To be implemented)</listitem>
+            </orderedlist>
+        </para>
+    </preface>
+    
+    <bookinfo>
+        <title>Apache OFBiz official documentation</title>
+        <copyright><year>2009</year><holder>Apache Foundation</holder></copyright>
+    </bookinfo>
+    
+    
+    
+    <chapter>
+        <title>Introduction</title>
+        <para>
+            Welcome to Apache OFBiz the ready to use open source ERP system.
+        </para>
+    </chapter>
+    
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 
+        href="../../../applications/accounting/documents/Accounting.xml"/>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 
+        href="../../../specialpurpose/myportal/documents/MyPortal.xml"/>
+    
+</book>
\ No newline at end of file

Propchange: ofbiz/trunk/applications/commonext/documents/ApacheOfbiz.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/commonext/documents/ApacheOfbiz.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/commonext/documents/ApacheOfbiz.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: ofbiz/trunk/applications/commonext/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/commonext/ofbiz-component.xml?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/commonext/ofbiz-component.xml (original)
+++ ofbiz/trunk/applications/commonext/ofbiz-component.xml Fri Aug 28 03:40:33 2009
@@ -25,7 +25,7 @@
     <classpath type="dir" location="config"/>
     
     <entity-resource type="data" reader-name="seed" loader="main" location="data/EntityDiagramGroupData.xml"/>
-    <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonExtHelpData.xml"/>
+    <entity-resource type="data" reader-name="seed" loader="main" location="data/CommonExtSeedData.xml"/>
     <entity-resource type="data" reader-name="seed" loader="main" location="data/SystemInfoPortletData.xml"/>
     
     <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/>

Modified: ofbiz/trunk/applications/content/data/ContentTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/data/ContentTypeData.xml?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/data/ContentTypeData.xml (original)
+++ ofbiz/trunk/applications/content/data/ContentTypeData.xml Fri Aug 28 03:40:33 2009
@@ -62,7 +62,7 @@
 
     <MetaDataPredicate metaDataPredicateId="author-name" description="Name of the author or creator of the subject."/>
     <MetaDataPredicate metaDataPredicateId="author-email" description="eMail address of the author or creator of the subject."/>
-    <MetaDataPredicate metaDataPredicateId="event-date" description="The date and time the subject event took place, preferably in the descending standard format: [yyyy-MM-dd hh:mm:ss]."/>
+    <MetaDataPredicate metaDataPredicateId="event-date" description="The date and time of the event in format [yyyy-MM-dd hh:mm:ss]."/>
     <MetaDataPredicate metaDataPredicateId="event-location" description="The location where subject event took place."/>
     <MetaDataPredicate metaDataPredicateId="event-person-name" description="The name of a person involved in the subject event."/>
 
@@ -261,4 +261,15 @@
 
     <WebSite webSiteId="CONTENT_SITE" siteName="Content Manager" visualThemeSetId="BACKOFFICE"/>
 
+    <DataResource dataResourceId="DOCBOOK_HTML_TEMPL" dataResourceTypeId="OFBIZ_FILE" objectInfo="applications/content/template/docbook/html/docbook.xsl" dataTemplateTypeId="XSLT" statusId="CTNT_IN_PROGRESS" dataResourceName="Help template file" mimeTypeId="text/html" isPublic="Y"/>
+    <DataResource dataResourceId="DOCBOOK_PDF_TEMPL" dataResourceTypeId="OFBIZ_FILE" objectInfo="applications/content/template/docbook/fo/docbook.xsl" dataTemplateTypeId="XSLT" statusId="CTNT_IN_PROGRESS" dataResourceName="Help template file" mimeTypeId="text/html" isPublic="Y"/>
+    <DataResource dataResourceId="APACHE_OFBIZ" localeString="en" dataResourceTypeId="OFBIZ_FILE" objectInfo="applications/commonext/documents/ApacheOfbiz.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Apache OFBiz document" mimeTypeId="text/xml" isPublic="Y" />
+    <Content contentId="APACHE_OFBIZ_HTML" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_HTML_TEMPL" dataResourceId="APACHE_OFBIZ" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The general Apache document in one page HTML" mimeTypeId="text/html"/>
+    <Content contentId="APACHE_OFBIZ_PDF" contentTypeId="DOCUMENT" templateDataResourceId="DOCBOOK_PDF_TEMPL" dataResourceId="APACHE_OFBIZ" localeString="en" statusId="CTNT_IN_PROGRESS" contentName="The general Apache document in PDF format" mimeTypeId="application/pdf"/>
+    <DataResource dataResourceId="HELP_ROOT_NL" localeString="nl" dataResourceTypeId="OFBIZ_FILE" objectInfo="applications/content/data/helpdata/HELP_ROOT_NL.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Help system root" mimeTypeId="text/xml" isPublic="Y" />
+    <Content contentId="DOCUMENTS" contentTypeId="DOCUMENT" contentName="Documents"/>
+    <ContentAssoc contentId="TREE_ROOT" contentIdTo="DOCUMENTS" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01" sequenceNum=""/>
+    <ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_HTML" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/>
+    <ContentAssoc contentId="DOCUMENTS" contentIdTo="APACHE_OFBIZ_PDF" contentAssocTypeId="SUB_CONTENT" fromDate="2006-01-12 01:01:01" sequenceNum=""/>
+    
 </entity-engine-xml>

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/content/ContentWorker.java Fri Aug 28 03:40:33 2009
@@ -183,8 +183,6 @@
             Map<String,Object>templateContext, Locale locale, String mimeTypeId, boolean cache) throws GeneralException, IOException {
         // if the content has a service attached run the service
     	
-    	Debug.log("=====================mimetypeId" + mimeTypeId);
-    	
         String serviceName = content.getString("serviceName");
         if (dispatcher != null && UtilValidate.isNotEmpty(serviceName)) {
             DispatchContext dctx = dispatcher.getDispatchContext();

Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java (original)
+++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataResourceWorker.java Fri Aug 28 03:40:33 2009
@@ -18,6 +18,7 @@
  *******************************************************************************/
 package org.ofbiz.content.data;
 
+import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -40,7 +41,6 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
-import javax.xml.parsers.ParserConfigurationException;
 
 import javolution.util.FastList;
 import javolution.util.FastMap;
@@ -49,6 +49,11 @@
 import org.apache.commons.fileupload.FileUploadException;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.apps.MimeConstants;
 import org.ofbiz.base.location.FlexibleLocation;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.FileUtil;
@@ -60,8 +65,10 @@
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.collections.MapStack;
 import org.ofbiz.base.util.template.FreeMarkerWorker;
+import org.ofbiz.base.util.template.XslTransform;
 import org.ofbiz.common.email.NotificationServices;
 import org.ofbiz.content.content.UploadContentAndImage;
+import org.ofbiz.content.content.ContentMapFacade;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -72,12 +79,28 @@
 import org.ofbiz.widget.screen.ScreenFactory;
 import org.ofbiz.widget.screen.ScreenRenderer;
 import org.ofbiz.widget.screen.ScreenStringRenderer;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
+import org.ofbiz.widget.screen.ScreenFopViewHandler;
+import org.ofbiz.webapp.view.ApacheFopWorker;
+import org.ofbiz.webapp.view.FopRenderer;
 
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
 
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+import com.meterware.httpunit.GetMethodWebRequest;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.parsers.ParserConfigurationException;
+
 /**
  * DataResourceWorker Class
  */
@@ -662,6 +685,18 @@
                     throw new GeneralException("Error rendering FTL template", e);
                 }
 
+            } else if ("XSLT".equals(dataTemplateTypeId)) {
+                    // get the template data for rendering
+                    String templateLocation = DataResourceWorker.getContentFile(dataResource.getString("dataResourceTypeId"), dataResource.getString("objectInfo"), (String) templateContext.get("contextRoot")).toString();
+                    // render the XSLT template and file
+                    String outDoc = null;
+                    try {
+                        outDoc = XslTransform.renderTemplate(templateLocation, (String) templateContext.get("docFile"));
+                    } catch (TransformerException c) {
+                        Debug.logError("XSL TransformerException: " + c.getMessage(), module);
+                    }
+                    out.append(outDoc);
+
             // Screen Widget template
             } else if ("SCREEN_COMBINED".equals(dataTemplateTypeId)) {
                 try {

Modified: ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/content/webapp/content/WEB-INF/controller.xml Fri Aug 28 03:40:33 2009
@@ -1791,7 +1791,15 @@
         <response name="success" type="request-redirect" value="navigateContent"/>
         <response name="error" type="request" value="navigateContent"/>
     </request-map>
-
+    <request-map uri="showContent">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="showContent"/>
+    </request-map>
+    <request-map uri="showContentPdf">
+        <security auth="true" https="true"/>
+        <response name="success" type="view" value="showContentPdf"/>
+    </request-map>
+    
     <!-- View Mappings -->
     <view-map name="main" type="screen" page="component://content/widget/CommonScreens.xml#main"/>
     <view-map name="fonts.fo" type="screenfop" page="component://content/widget/CommonScreens.xml#fonts.fo" content-type="application/pdf" encoding="none"/>
@@ -1957,6 +1965,8 @@
     <view-map name="EditDocumentTree" type="screen" page="component://content/widget/content/ContentScreens.xml#EditDocumentTree"/>
     <view-map name="EditDocument" type="screen" page="component://content/widget/content/ContentScreens.xml#EditDocument"/>
     <view-map name="ListDocument" type="screen" page="component://content/widget/content/ContentScreens.xml#ListDocument"/>
-
+    <view-map name="showContent" type="screen" page="component://content/widget/content/ContentScreens.xml#ShowContent"/>
+    <view-map name="showContentPdf" type="screen" page="component://content/widget/content/ContentScreens.xml#ShowContent"  content-type="application/pdf" encoding="none"/>
+    
         <!-- end of view mappings -->
 </site-conf>

Modified: ofbiz/trunk/applications/content/widget/content/ContentForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentForms.xml?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/content/ContentForms.xml (original)
+++ ofbiz/trunk/applications/content/widget/content/ContentForms.xml Fri Aug 28 03:40:33 2009
@@ -555,19 +555,11 @@
     </form>
     <form name="ListDocument"  target="" type="list"  list-name="contentAssoc" paginate-target="navigateContent"
         odd-row-style="alternate-row" header-row-style="header-row-2" default-table-style="basic-table hover-bar">
-        <row-actions>
-            <entity-one entity-name="Content" value-field="content">
-                <field-map field-name="contentId" from-field="contentIdTo"/>
-            </entity-one>
-            <set field="contentTypeId" from-field="content.contentTypeId"/>
-            <set field="statusId" from-field="content.statusId"/>
-            <entity-one entity-name="DataResource" value-field="dataResource">
-                <field-map field-name="dataResourceId" from-field="content.dataResourceId"/>
-            </entity-one>
-            <set field="mimeTypeId" from-field="dataResource.mimeTypeId"/>
-        </row-actions>
-        <field name="contentId">
-            <hyperlink also-hidden="false" description="${content.contentName} [${content.contentId}]" target="views/ShowDocument?contentId=${content.contentId}"/>
+        <field name="contentId" use-when="&quot;application/pdf&quot;.equals(mimeTypeId)">
+            <hyperlink also-hidden="false" description="${contentName} [${contentId}]" target="showContentPdf?contentId=${contentId}" target-window="_blank"/>
+        </field>
+        <field name="contentId" use-when="&quot;text/html&quot;.equals(mimeTypeId)">
+            <hyperlink also-hidden="false" description="${contentName} [${contentId}]" target="showContent?contentId=${contentId}" target-window="_blank"/>
         </field>
         <field name="contentTypeId">
             <display-entity entity-name="ContentType" key-field-name="contentTypeId" description="${description}"/>
@@ -578,7 +570,7 @@
         <field name="statusId">
             <display-entity entity-name="StatusItem" key-field-name="statusId" description="${description}"/>
         </field>
-        <field name="createdDate"><display description="${content.createdDate}"/></field>
+        <field name="caCreatedDate"><display/></field>
         <field name="delete" title="${uiLabelMap.CommonDelete}">
             <hyperlink target="removeDocumentFromTree" description="${uiLabelMap.CommonDelete}">
                 <parameter param-name="contentId"/>

Modified: ofbiz/trunk/applications/content/widget/content/ContentScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentScreens.xml?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/widget/content/ContentScreens.xml (original)
+++ ofbiz/trunk/applications/content/widget/content/ContentScreens.xml Fri Aug 28 03:40:33 2009
@@ -141,10 +141,8 @@
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
                 <set field="contentIdTo" from-field="parameters.contentIdTo"/>
                 <set field="contentId" from-field="parameters.contentId"/>
-                <entity-condition entity-name="ContentAssoc" list="contentAssoc">
-                    <condition-list  combine="and">
-                        <condition-expr field-name="contentId" from-field="contentId" operator="equals"/>
-                    </condition-list>
+                <entity-condition entity-name="ContentAssocViewTo" list="contentAssoc">
+                    <condition-expr field-name="contentIdStart" from-field="contentId" operator="equals"/>
                 </entity-condition>
             </actions>
             <widgets>
@@ -152,6 +150,26 @@
             </widgets>
         </section>
     </screen>
+    <screen name="ShowContent">
+        <section>
+            <actions>
+                <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
+                <property-map resource="CommonExtUiLabels" map-name="uiLabelMap" global="true"/>
+                <set field="contentId" from-field="parameters.contentId" default-value="${contentId}"/>
+                <property-map resource="general" map-name="generalProperties" global="true"/>
+                <set field="defaultVisualThemeId" from-field="generalProperties.defaultVisualThemeId" default-value="SMOOTH_FEATHER"/>
+                <set field="visualThemeId" from-field="userPreferences.VISUAL_THEME" default-value="${defaultVisualThemeId}" global="true"/>
+                <service service-name="getVisualThemeResources">
+                    <field-map field-name="visualThemeId"/>
+                    <field-map field-name="themeResources" from-field="layoutSettings"/>
+                </service>
+                <set field="layoutSettings" from-field="themeResources" default-value="${layoutSettings}" global="true"/>
+            </actions>
+            <widgets>
+                <content content-id="${contentId}"/>
+            </widgets>
+        </section>
+    </screen>
     <screen name="EditDocumentTree">
         <section>
         <actions>

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/template/XslTransform.java Fri Aug 28 03:40:33 2009
@@ -23,42 +23,83 @@
 import java.net.URL;
 import java.net.URLConnection;
 import java.io.InputStream;
+import java.io.IOException;
+import java.io.StringWriter; 
 
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
 import org.ofbiz.base.util.URLConnector;
 import org.ofbiz.base.util.cache.UtilCache;
 import org.ofbiz.base.location.FlexibleLocation;
+import org.ofbiz.base.util.GeneralException;
+
 import javax.xml.transform.Transformer;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
 import javax.xml.transform.TransformerFactory;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.sax.SAXSource;
 import javax.xml.transform.Templates;
-import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
-import org.ofbiz.base.util.GeneralException;
-import java.io.IOException;
 
 import javax.xml.transform.stream.StreamSource;
+import javax.xml.transform.stream.StreamResult;
 
-/**
- * XslTransform
- *
- * This utility takes an input document and a XSL stylesheet and performs the
- * transform, returning the output document.
- * The input for both the input document and stylesheet can be in one of three forms
- * - a URL to the doc, the doc in string form and the doc in DOM Document form.
- * It keeps its own cache for storing the compiled transforms.
- *
- */
 public final class XslTransform {
 
     public static final String module = XslTransform.class.getName();
     public static UtilCache<String, Templates> xslTemplatesCache = new UtilCache<String, Templates>("XsltTemplates", 0, 0);
 
+    /**
+     * 
+     * @param template the content or url of the xsl template
+     * @param data the content or url of the xml data file
+     * @param outWriter The Writer to render to
+     * @throws TransformerException
+     */
+    public static String renderTemplate(String template, String data) 
+    throws TransformerException {
+		String result = null;
+    	TransformerFactory tfactory = TransformerFactory.newInstance();
+    	if (tfactory.getFeature(SAXSource.FEATURE)) {
+    		// setup for xml data file preprocessing to be able to xinclude
+    		SAXParserFactory pfactory= SAXParserFactory.newInstance();
+    		pfactory.setNamespaceAware(true);
+    		pfactory.setValidating(false);
+    		pfactory.setXIncludeAware(true);
+    		XMLReader reader = null;
+    		try {
+    			reader = pfactory.newSAXParser().getXMLReader();
+            } catch (Exception e) {
+                throw new TransformerException("Error creating SAX parser/reader", e);
+            }
+            // do the actual preprocessing
+    		SAXSource source = new SAXSource(reader, new InputSource(data));
+    		// compile the xsl template
+    		Transformer transformer = tfactory.newTransformer(new StreamSource(template));
+    		// and apply the xsl template to the source document and save in a result string
+   			StringWriter sw = new StringWriter();
+   			StreamResult sr = new StreamResult(sw);
+   			transformer.transform(source, sr);
+   			result = sw.toString();
+    	} else {
+    		Debug.logError("tfactory does not support SAX features!", module);
+    	}
+    	return result;
+   	}
+
+    /*
+     *  it does not look like the rest of this file is working or used..........better set it to depreciated
+     *  @deprecated
+     */
     public static Document transform(Map<String, Object> context, Map<String, Object> params)
         throws GeneralException, IOException, TransformerConfigurationException, TransformerException {
         Document outputDocument = null;
@@ -104,6 +145,10 @@
         return outputDocument;
     }
 
+    /*
+     *  it does not look like the rest of this file is working or used..........better set it to depreciated
+     *  @deprecated
+     */
     private static Source getSource(Document inputDocument, String inputUrl, String inputString) throws GeneralException, IOException {
         Source source = null;
         if (inputDocument != null) {

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Fri Aug 28 03:40:33 2009
@@ -18,8 +18,10 @@
  *******************************************************************************/
 package org.ofbiz.widget.screen;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.Serializable;
+import java.io.StringWriter;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -28,9 +30,21 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
 
 import javolution.util.FastList;
 
+import org.apache.fop.apps.FOUserAgent;
+import org.apache.fop.apps.Fop;
+import org.apache.fop.apps.FopFactory;
+import org.apache.fop.apps.MimeConstants;
 import org.ofbiz.base.util.Debug;
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.StringUtil;
@@ -60,8 +74,13 @@
 import org.ofbiz.widget.tree.TreeFactory;
 import org.ofbiz.widget.tree.TreeStringRenderer;
 import org.ofbiz.widget.xml.XmlFormRenderer;
+import org.ofbiz.webapp.control.RequestHandler;
+import org.ofbiz.webapp.control.RequestHandlerException;
+import org.ofbiz.webapp.view.ApacheFopWorker;
 import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
 
 /**
  * Widget Library - Screen model class
@@ -1090,10 +1109,76 @@
                 if (dataResource != null) {
                     mimeTypeId = dataResource.getString("mimeTypeId");
                 }
+                if (UtilValidate.isNotEmpty(content.get("mimeTypeId"))) {
+                    mimeTypeId = content.getString("mimeTypeId");
+                }
 
                 if (UtilValidate.isNotEmpty(mimeTypeId)
-                        && ((mimeTypeId.indexOf("application") >= 0) || (mimeTypeId.indexOf("image")) >= 0)) {
-                    screenStringRenderer.renderContentFrame(writer, context, this);
+                		&& ((mimeTypeId.indexOf("application") >= 0) || (mimeTypeId.indexOf("image")) >= 0)) {
+                	if (mimeTypeId.equals("application/pdf")) {
+                		TransformerFactory tfactory = TransformerFactory.newInstance();
+                		try{
+/*                			
+                			//
+                			//  this part is not working. If somebody can help to make it work?
+                			//  currently using only real temp files for debugging purposes.
+                			//
+                			//  most of the code should be replaced by functions in xslTransform.java and other files.
+                			//  for debugging here mostly code using the code outside of ofbiz.
+                			//
+                			SAXParserFactory pfactory= SAXParserFactory.newInstance();
+                			pfactory.setNamespaceAware(true);
+                			pfactory.setValidating(true);
+                			pfactory.setXIncludeAware(true);
+                			XMLReader reader = null;
+                			try {
+                				reader = pfactory.newSAXParser().getXMLReader();
+                			} catch (Exception e) {
+                				throw new TransformerException("Error creating SAX parser/reader", e);
+                			}
+
+                			// do the actual preprocessing fr includes
+                			SAXSource source = new SAXSource(reader, new InputSource("/home/hans/ofbiz/svn/applications/commonext/documents/ApacheOfbiz.xml"));
+                			// compile the xsl template
+                			Transformer transformer1 = tfactory.newTransformer(new StreamSource("/home/hans/ofbiz/svn/applications/content/template/docbook/fo/docbook.xsl"));
+                			// and apply the xsl template to the source document and save in a result string
+                			StringWriter sw = new StringWriter();
+                			StreamResult sr = new StreamResult(sw);
+                			transformer1.transform(source, sr);
+                			// store into a file for debugging
+                			java.io.FileWriter fw = new java.io.FileWriter(new java.io.File("/tmp/file1.fo"));
+                			fw.write(sw.toString());
+                			fw.close();
+
+                			
+                			Debug.log("================start fo processor=============================");
+                			ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                			StreamSource src = new StreamSource("/tmp/file1.fo");
+                			FopFactory fopFactory = ApacheFopWorker.getFactoryInstance();
+                			FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
+                			Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, baos);
+                			TransformerFactory factory = TransformerFactory.newInstance();
+                			Transformer transformer = factory.newTransformer();
+                			transformer.transform(src, new SAXResult(fop.getDefaultHandler()));
+                			baos.flush();
+                			baos.close();
+                			// write to browser
+                			writer.append(baos.toString());
+                			// store into a file for debugging
+                			java.io.FileWriter fend = new java.io.FileWriter(new java.io.File("/tmp/file1.pdf"));
+                			fend.write(baos.toString());
+                			fend.close();
+
+*/                		
+                		} catch(Exception e) {
+                			Debug.logError("================================Exception: " + e, module);
+                		}
+
+
+
+                	} else {
+                        screenStringRenderer.renderContentFrame(writer, context, this);
+                	}
                 } else {
                     screenStringRenderer.renderContentBegin(writer, context, this);
                     screenStringRenderer.renderContentBody(writer, context, this);

Modified: ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml?rev=808744&r1=808743&r2=808744&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/myportal/data/MyPortalTypeData.xml Fri Aug 28 03:40:33 2009
@@ -160,25 +160,7 @@
     <WebSite webSiteId="MYPORTAL" siteName="My Portal" visualThemeSetId="BACKOFFICE"/>
     
     <!-- Myportal help pages -->
-    <DataResource dataResourceId="HELP_MYPORTAL" localeString="en" dataResourceTypeId="ELECTRONIC_TEXT" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Calendar help file" mimeTypeId="text/xml" isPublic="Y" />
-    <ElectronicText dataResourceId="HELP_MYPORTAL">
-        <textData><![CDATA[
-            <root>
-                <generalTitle>
-                    The My portal Component introduction.
-                </generalTitle>
-                <general>
-                    <section>
-                        <text>
-                            Within the 'my portal' component it is possible to create a collection of screens for a specific type of user of the system. 
-                            Examples are a general employee, an account manager, a customer, a supplier etc... 
-                            The system makes use of special portlets which can be arranged and selected/hidden by the logged on user.
-                        </text>
-                    </section>
-                </general>
-            </root>
-        ]]></textData>
-    </ElectronicText>
+    <DataResource dataResourceId="HELP_MYPORTAL" localeString="en" dataResourceTypeId="OFBIZ_FILE" objectInfo="specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml" dataTemplateTypeId="NONE" statusId="CTNT_IN_PROGRESS" dataResourceName="Calendar help file" mimeTypeId="text/xml" isPublic="Y" />
     <Content contentId="HELP_MYPORTAL" contentTypeId="DOCUMENT" templateDataResourceId="HELP_TEMPL" dataResourceId="HELP_MYPORTAL" statusId="CTNT_IN_PROGRESS" contentName="My Portal help" mimeTypeId="text/html"/>
     <ContentAssoc contentId="HELP_ROOT" contentIdTo="HELP_MYPORTAL" contentAssocTypeId="TREE_CHILD" fromDate="2006-01-12 01:01:01"/>
 

Added: ofbiz/trunk/specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml?rev=808744&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml (added)
+++ ofbiz/trunk/specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml Fri Aug 28 03:40:33 2009
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+-->
+<section xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://docbook.org/ns/docbook ../../../../applications/content/dtd/docbook.xsd"
+ xmlns="http://docbook.org/ns/docbook">
+    
+    <title>The My portal Component introduction.</title>
+    <para>                
+        Within the 'my portal' component it is possible to create a collection of screens for a specific type of user of the system. 
+        Examples are a general employee, an account manager, a customer, a supplier etc... 
+        The system makes use of special portlets which can be arranged and selected/hidden by the logged on user.
+    </para>
+</section>

Propchange: ofbiz/trunk/specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/myportal/data/helpdata/HELP_MYPORTAL.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: ofbiz/trunk/specialpurpose/myportal/documents/MyPortal.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/myportal/documents/MyPortal.xml?rev=808744&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/myportal/documents/MyPortal.xml (added)
+++ ofbiz/trunk/specialpurpose/myportal/documents/MyPortal.xml Fri Aug 28 03:40:33 2009
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you 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.
+-->
+<chapter xmlns="http://docbook.org/ns/docbook"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://docbook.org/ns/docbook ../../../applications/content/dtd/docbook.xsd">
+    <title>The myportal Component</title>
+    <section>
+        <title>Introduction</title>
+        <para>
+            and a introduction paragraph in myportal
+        </para>
+    </section>
+    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" 
+        href="../data/helpdata/HELP_MYPORTAL.xml"/>
+</chapter>

Propchange: ofbiz/trunk/specialpurpose/myportal/documents/MyPortal.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/myportal/documents/MyPortal.xml
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/specialpurpose/myportal/documents/MyPortal.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml