[OFBiz] SVN: r6958 - in trunk/applications/content: script/org/ofbiz/content/compdoc servicedef src/org/ofbiz/content/openoffice webapp/content/WEB-INF widget/compdoc
byersa@svn.ofbiz.org
byersa at svn.ofbiz.org
Thu Mar 9 04:57:23 CST 2006
Author: byersa
Date: 2006-03-09 04:57:10 -0600 (Thu, 09 Mar 2006)
New Revision: 6958
Modified:
trunk/applications/content/script/org/ofbiz/content/compdoc/CompDocServices.xml
trunk/applications/content/servicedef/services.xml
trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java
trunk/applications/content/webapp/content/WEB-INF/controller.xml
trunk/applications/content/widget/compdoc/CompDocForms.xml
trunk/applications/content/widget/compdoc/CompDocMenus.xml
trunk/applications/content/widget/compdoc/CompDocScreens.xml
Log:
Added some UI fixes to not show certain actions if not at the latest revision.
Have not done a complete scan for those cases.
Changed ContentApproval "bump" process so that only template compdocs have their CAs
bumped on each revision.
The instances have a link button at the root level to "Prepare for Approval".
Broke cloneContentApprovals into two services for handling template and instance cases.
Modified prepForApproval to prepare the instance CAs.
Modified the ListContentApproval form so that updates can be done in-line.
Modified: trunk/applications/content/script/org/ofbiz/content/compdoc/CompDocServices.xml
===================================================================
--- trunk/applications/content/script/org/ofbiz/content/compdoc/CompDocServices.xml 2006-03-09 10:51:10 UTC (rev 6957)
+++ trunk/applications/content/script/org/ofbiz/content/compdoc/CompDocServices.xml 2006-03-09 10:57:10 UTC (rev 6958)
@@ -104,8 +104,10 @@
<set from-field="revisionMap.contentId" field="cloneMap.contentId"/>
<set from-field="contentRevisionSeqId" field="cloneMap.contentRevisionSeqId"/>
<set from-field="parameters.userLogin" field="cloneMap.userLogin"/>
+ <!-- Not for INSTANCE CompDocs. They will be generated on demand.
<call-service service-name="cloneContentApprovals" in-map-name="cloneMap">
</call-service>
+ -->
</simple-method>
<simple-method method-name="genInstanceChildCompDocs" short-description="Create CompDoc">
@@ -149,18 +151,6 @@
<simple-method method-name="persistCompDoc" short-description="Create CompDoc">
- <!--
- <if-not-empty field-name="parameters.contentId">
- <entity-one entity-name="Content" value-name="content"/>
- <if-not-empty field-name="content">
- <add-error>
- <fail-message message="Compdoc Content for ${parameters.contentId} already exists"/>
- </add-error>
- <check-errors/>
- </if-not-empty>
- </if-not-empty>
- -->
-
<!-- create the compdoc Content entity -->
<set-service-fields service-name="persistContentAndAssoc" map-name="parameters" to-map-name="persistMap"/>
<if-not-empty field-name="parameters.mimeTypeId">
@@ -227,7 +217,7 @@
</condition>
<then>
<!-- if no rootTemplateContentId exists, this must be a root op, so set contentId = itemContentId -->
- <set from-field="parameters.rootTemplateContentId" default-value="${pResults.contentId}" field="revisionMap.contentId"/>
+ <set from-field="pResults.contentId" field="revisionMap.contentId"/>
</then>
</if>
<if>
@@ -239,7 +229,7 @@
</condition>
<then>
<!-- if no rootTemplateContentId exists, this must be a root op, so set contentId = itemContentId -->
- <set from-field="parameters.rootInstanceContentId" default-value="${pResults.contentId}" field="revisionMap.contentId"/>
+ <set from-field="pResults.contentId" field="revisionMap.contentId"/>
</then>
</if>
<set field="revisionMap.contentId" from-field="parameters.rootContentId" default-value="${pResults.caContentIdTo}"/>
@@ -252,11 +242,20 @@
<result-to-field result-name="contentRevisionSeqId"/>
</call-service>
- <set field="cloneMap.contentId" from-field="revisionMap.contentId"/>
- <set field="cloneMap.contentRevisionSeqId" from-field="contentRevisionSeqId"/>
- <set field="cloneMap.userLogin" from-field="parameters.userLogin"/>
- <call-service service-name="cloneContentApprovals" in-map-name="cloneMap">
- </call-service>
+ <if>
+ <condition>
+ <or>
+ <if-compare field-name="persistMap.contentTypeId" operator="equals" value="COMPDOC_TEMPLATE"/>
+ <if-compare field-name="persistMap.contentTypeId" operator="equals" value="TEMPLATE"/>
+ </or>
+ </condition>
+ <then>
+ <set field="cloneMap.contentId" from-field="revisionMap.contentId"/>
+ <set field="cloneMap.contentRevisionSeqId" from-field="contentRevisionSeqId"/>
+ <set field="cloneMap.userLogin" from-field="parameters.userLogin"/>
+ <call-service service-name="cloneTemplateContentApprovals" in-map-name="cloneMap"/>
+ </then>
+ </if>
</simple-method>
<simple-method method-name="persistCompDocContent" short-description="Persist a CompDoc DataResource and data">
@@ -476,12 +475,15 @@
<log level="info" message="ContentRevision(1): ${newEntity}"/>
<create-value value-name="newEntity"/>
- <make-value entity-name="ContentRevisionItem" value-name="newEntity"/>
- <set-pk-fields map-name="parameters" value-name="newEntity"/>
- <set field="newEntity.contentRevisionSeqId" from-field="paddedSeqId"/>
- <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
- <create-value value-name="newEntity"/>
- <log level="info" message="ContentRevisionItem(1): ${newEntity}"/>
+ <if-not-empty field-name="parameters.itemContentId">
+ <make-value entity-name="ContentRevisionItem" value-name="newEntity"/>
+ <set-pk-fields map-name="parameters" value-name="newEntity"/>
+ <set field="newEntity.contentRevisionSeqId" from-field="paddedSeqId"/>
+ <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
+ <create-value value-name="newEntity"/>
+ <log level="info" message="ContentRevisionItem(1): ${newEntity}"/>
+ </if-not-empty>
+
<field-to-result field-name="paddedSeqId" result-name="contentRevisionSeqId"/>
<log level="info" message="paddedSeqId: ${paddedSeqId}"/>
</simple-method>
@@ -579,7 +581,42 @@
<field-to-result field-name="contentApprovalList"/>
</simple-method>
- <simple-method method-name="cloneContentApprovals" short-description="Bump the previous ContentApproval approvals up to current CDT or CDI">
+ <simple-method method-name="cloneTemplateContentApprovals" short-description="Bump the previous ContentApproval approvals up to current CDI">
+ <log level="info" message="cloneTemplateContentApprovals-parameters: ${parameters}"/>
+ <entity-condition entity-name="MaxContentApprovalView" list-name="maxContentApprovalList">
+ <condition-list combine="and">
+ <condition-expr field-name="contentId" operator="equals" env-name="parameters.contentId" />
+ </condition-list>
+ <select-field field-name="maxContentRevisionSeqId"/>
+ <select-field field-name="contentId"/>
+ <select-field field-name="partyId"/>
+ <select-field field-name="roleTypeId"/>
+
+ <order-by field-name="-maxContentRevisionSeqId"/>
+ </entity-condition>
+ <set from-field="maxContentApprovalList[0].maxContentRevisionSeqId" field="latestContentRevisionSeqId"/>
+ <log level="info" message="latestContentRevisionSeqId 0aa: ${latestContentRevisionSeqId}"/>
+
+ <entity-and entity-name="ContentApproval" list-name="templateContentApprovalList">
+ <field-map field-name="contentId" env-name="parameters.contentId"/>
+ <field-map field-name="contentRevisionSeqId" env-name="latestContentRevisionSeqId"/>
+ </entity-and>
+ <log level="info" message="templateContentApprovalList 0aa: ${templateContentApprovalList}"/>
+ <iterate list-name="templateContentApprovalList" entry-name="templateContentApproval">
+ <clone-value value-name="templateContentApproval" new-value-name="contentApproval"/>
+ <log level="info" message="contentApproval 0b: ${contentApproval}"/>
+ <set from-field="parameters.contentRevisionSeqId" field="contentApproval.contentRevisionSeqId" />
+ <set from-field="parameters.contentId" field="contentApproval.contentId" />
+ <clear-field field-name="contentApproval.contentApprovalId" />
+ <log level="info" message="contentApproval 1b: ${contentApproval}"/>
+ <make-next-seq-id seq-field-name="contentApprovalId" value-name="contentApproval"/>
+ <clear-field field-name="contentApproval.approvalStatusId" />
+ <log level="info" message="contentApproval 2b: ${contentApproval}"/>
+ <create-value value-name="contentApproval"/>
+ </iterate>
+ </simple-method>
+
+ <simple-method method-name="cloneInstanceContentApprovals" short-description="Bump the previous ContentApproval approvals up to current CDI">
<entity-one entity-name="Content" value-name="content">
<field-map field-name="contentId" env-name="parameters.contentId"/>
@@ -603,178 +640,157 @@
<order-by field-name="-maxContentRevisionSeqId"/>
</entity-condition>
- <log level="info" message="cloneContentApprovals(2a)- maxContentApprovalList : ${maxContentApprovalList} "/>
- <iterate list-name="maxContentApprovalList" entry-name="maxContentApproval">
- <!-- look for this entity in newly created entities -->
- <entity-condition entity-name="ContentApproval" list-name="newContentApprovalList">
- <condition-list combine="and">
- <condition-expr field-name="contentId" operator="equals" env-name="maxContentApproval.contentId"/>
- <condition-expr field-name="contentRevisionSeqId" operator="equals" env-name="maxContentApproval.maxContentRevisionSeqId"/>
- <condition-expr field-name="partyId" operator="equals" env-name="maxContentApproval.partyId" ignore-if-empty="true"/>
- <condition-expr field-name="roleTypeId" operator="equals" env-name="maxContentApproval.roleTypeId" ignore-if-empty="true"/>
- </condition-list>
- </entity-condition>
- <set field="contentApprovalList[]" from-field="newContentApprovalList[0]"/>
- </iterate>
-
- <log level="info" message="cloneContentApprovals(2b)- contentApprovalList : ${contentApprovalList} "/>
-
- <!-- determine status of previous approvals -->
- <!-- primaryApprovalStatusId is the applicable status from previous approvals -->
- <set value="CNTAP_IN_PROCESS" field="primaryApprovalStatusId"/>
- <iterate list-name="contentApprovalList" entry-name="existingContentApproval">
- <set from-field="existingContentApproval.approvalStatusId" field="approvalStatusId"/>
- <if>
- <condition>
- <or>
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_REJECTED"/>
- </or>
- </condition>
- <then>
- <!-- do nothing -->
- </then>
- <else-if>
- <condition>
- <or>
- <if-compare field-name="approvalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <if-compare field-name="approvalStatusId" operator="equals" value="CNTAP_REJECTED"/>
- </or>
- </condition>
- <then>
- <set from-field="approvalStatusId" field="primaryApprovalStatusId"/>
- </then>
- </else-if>
- <else-if>
- <condition>
- <and>
- <if-compare field-name="approvalStatusId" operator="equals" value="CNTAP_APPROVED"/>
- <not>
- <or>
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_REJECTED"/>
- </or>
- </not>
- </and>
- </condition>
- <then>
- <set from-field="approvalStatusId" field="primaryApprovalStatusId"/>
- </then>
- </else-if>
- </if>
- </iterate>
- <log level="info" message="cloneContentApprovals(2)- primaryApprovalStatusId : ${primaryApprovalStatusId} "/>
-
- <!-- conditionally set the contentApprovalId status of each entity -->
- <iterate list-name="contentApprovalList" entry-name="existingContentApproval">
- <clone-value value-name="existingContentApproval" new-value-name="contentApproval"/>
- <log level="info" message="contentApproval 0: ${contentApproval}"/>
- <set from-field="thisContentRevisionSeqId" field="contentApproval.contentRevisionSeqId" />
- <clear-field field-name="contentApproval.contentApprovalId" />
- <log level="info" message="contentApproval 1: ${contentApproval}"/>
- <make-next-seq-id seq-field-name="contentApprovalId" value-name="contentApproval"/>
- <log level="info" message="contentApproval 2: ${contentApproval}"/>
-
- <if-compare field-name="content.contentTypeId" operator="equals" value="COMPDOC_INSTANCE">
- <if>
- <!-- not rejected, soft rejected or approved, reset to ready -->
- <condition>
- <not>
- <or>
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_REJECTED"/>
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_APPROVED"/>
- </or>
- </not>
- </condition>
- <then>
- <set value="CNTAP_READY" field="contentApproval.approvalStatusId" />
- </then>
- <else-if>
- <!-- soft rejected, reset rejected (shouldn't be any) and soft rejected entities to ready -->
- <condition>
- <and>
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <or>
- <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_REJECTED"/>
- </or>
- </and>
- </condition>
- <then>
- <set value="CNTAP_READY" field="contentApproval.approvalStatusId" />
- </then>
- </else-if>
- <else-if>
- <condition>
- <and>
- <!-- soft rejected and current record is not soft/rejected, keep currentstatus -->
- <if-compare field-name="primaryApprovalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <not>
- <or>
- <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_REJECTED"/>
- </or>
- </not>
- </and>
- </condition>
- <then>
- <set from-field="existingContentApproval.approvalStatusId" field="contentApproval.approvalStatusId" />
- </then>
- </else-if>
- </if>
- <else>
- <!-- if a COMPDOC_TEMPLATE -->
- <set value="CNTAP_READY" field="contentApproval.approvalStatusId" />
- </else>
- </if-compare>
-
- <create-value value-name="contentApproval"/>
- </iterate>
-
- <!-- if an instance track, check to see if there any new or deleted records on the template -->
- <if-compare field-name="content.contentTypeId" operator="equals" value="COMPDOC_INSTANCE">
- <set from-field="content.instanceOfContentId" field="rootTemplateContentId" />
- <log level="info" message="rootTemplateContentId 0aa: ${rootTemplateContentId}"/>
- <entity-condition entity-name="ContentRevision" list-name="templateContentRevisionList" use-cache="true">
- <condition-list>
- <condition-expr field-name="contentId" env-name="rootTemplateContentId" operator="equals"/>
- </condition-list>
- <order-by field-name="-contentRevisionSeqId"/>
- </entity-condition>
- <set from-field="templateContentRevisionList[0].contentRevisionSeqId" field="latestContentRevisionSeqId" />
- <log level="info" message="latestContentRevisionSeqId 0aa: ${latestContentRevisionSeqId}"/>
- <entity-and entity-name="ContentApproval" list-name="templateContentApprovalList">
- <field-map field-name="contentId" env-name="rootTemplateContentId"/>
- <field-map field-name="contentRevisionSeqId" env-name="latestContentRevisionSeqId"/>
- </entity-and>
- <log level="info" message="templateContentApprovalList 0aa: ${templateContentApprovalList}"/>
- <iterate list-name="templateContentApprovalList" entry-name="templateContentApproval">
- <!-- look for this entity in newly created entities -->
- <entity-condition entity-name="ContentApproval" list-name="newContentApprovalList">
- <condition-list combine="and">
- <condition-expr field-name="contentId" operator="equals" env-name="thisContentId"/>
- <condition-expr field-name="contentRevisionSeqId" operator="equals" env-name="thisContentRevisionSeqId"/>
- <condition-expr field-name="partyId" operator="equals" env-name="templateContentApproval.partyId" ignore-if-empty="true"/>
- <condition-expr field-name="roleTypeId" operator="equals" env-name="templateContentApproval.roleTypeId" ignore-if-empty="true"/>
- </condition-list>
- </entity-condition>
- <if-empty field-name="newContentApprovalList">
- <clone-value value-name="templateContentApproval" new-value-name="contentApproval"/>
- <log level="info" message="contentApproval 0b: ${contentApproval}"/>
- <set from-field="thisContentRevisionSeqId" field="contentApproval.contentRevisionSeqId" />
- <set from-field="thisContentId" field="contentApproval.contentId" />
- <clear-field field-name="contentApproval.contentApprovalId" />
- <log level="info" message="contentApproval 1b: ${contentApproval}"/>
- <make-next-seq-id seq-field-name="contentApprovalId" value-name="contentApproval"/>
- <set value="CNTAP_READY" field="contentApproval.approvalStatusId" />
- <log level="info" message="contentApproval 2b: ${contentApproval}"/>
- <create-value value-name="contentApproval"/>
- </if-empty>
- </iterate>
-
- <!-- TODO: remove instance approvals that have been deleted from the template set -->
- </if-compare>
+ <set from-field="maxContentApprovalList[0].maxContentRevisionSeqId" field="maxContentRevisionSeqId"/>
+
+ <if>
+ <condition>
+ <if-empty field-name="maxContentRevisionSeqId"/>
+ </condition>
+ <then>
+ <!-- if an instance track, check to see if there any new or deleted records on the template -->
+ <set from-field="content.instanceOfContentId" field="rootTemplateContentId" />
+ <log level="info" message="rootTemplateContentId 0aa: ${rootTemplateContentId}"/>
+ <entity-condition entity-name="ContentRevision" list-name="templateContentRevisionList" use-cache="true">
+ <condition-list>
+ <condition-expr field-name="contentId" env-name="rootTemplateContentId" operator="equals"/>
+ </condition-list>
+ <order-by field-name="-contentRevisionSeqId"/>
+ </entity-condition>
+ <set from-field="templateContentRevisionList[0].contentRevisionSeqId" field="latestContentRevisionSeqId" />
+ <log level="info" message="latestContentRevisionSeqId 0aa: ${latestContentRevisionSeqId}"/>
+ <entity-and entity-name="ContentApproval" list-name="templateContentApprovalList">
+ <field-map field-name="contentId" env-name="rootTemplateContentId"/>
+ <field-map field-name="contentRevisionSeqId" env-name="latestContentRevisionSeqId"/>
+ </entity-and>
+ <log level="info" message="templateContentApprovalList 0aa: ${templateContentApprovalList}"/>
+ <iterate list-name="templateContentApprovalList" entry-name="templateContentApproval">
+ <clone-value value-name="templateContentApproval" new-value-name="contentApproval"/>
+ <log level="info" message="contentApproval 0b: ${contentApproval}"/>
+ <set from-field="thisContentRevisionSeqId" field="contentApproval.contentRevisionSeqId" />
+ <set from-field="thisContentId" field="contentApproval.contentId" />
+ <clear-field field-name="contentApproval.contentApprovalId" />
+ <log level="info" message="contentApproval 1b: ${contentApproval}"/>
+ <make-next-seq-id seq-field-name="contentApprovalId" value-name="contentApproval"/>
+ <set value="CNTAP_READY" field="contentApproval.approvalStatusId" />
+ <set from-field="nowTimestamp" field="contentApproval.approvalDate"/>
+ <log level="info" message="contentApproval 2b: ${contentApproval}"/>
+ <create-value value-name="contentApproval"/>
+ </iterate>
+ </then>
+
+ <else>
+ <set from-field="thisContentId" field="map.contentId" />
+ <set from-field="thisContentRevisionSeqId" field="map.contentRevisionSeqId" />
+ <call-service service-name="getFinalApprovalStatus" in-map-name="map">
+ <result-to-field field-name="finalApprovalStatusId" result-name="approvalStatusId" />
+ <result-to-field field-name="contentApprovalList" result-name="contentApprovalList" />
+ </call-service>
+
+ <!-- determine status of previous approvals -->
+ <!-- finalApprovalStatusId is the applicable status from previous approvals -->
+ <log level="info" message="cloneContentApprovals(2)- finalApprovalStatusId : ${finalApprovalStatusId} "/>
+ <log level="info" message="cloneContentApprovals(2b)- contentApprovalList : ${contentApprovalList} "/>
+
+ <!-- conditionally set the contentApprovalId status of each entity -->
+ <iterate list-name="contentApprovalList" entry-name="existingContentApproval">
+ <clone-value value-name="existingContentApproval" new-value-name="contentApproval"/>
+ <set from-field="thisContentRevisionSeqId" field="contentApproval.contentRevisionSeqId" />
+ <clear-field field-name="contentApproval.contentApprovalId" />
+ <make-next-seq-id seq-field-name="contentApprovalId" value-name="contentApproval"/>
+ <set from-field="nowTimestamp" field="contentApproval.approvalDate"/>
+
+ <if-compare field-name="content.contentTypeId" operator="equals" value="COMPDOC_INSTANCE">
+ <if>
+ <!-- not rejected, soft rejected or approved, reset to ready -->
+ <condition>
+ <or>
+ <if-compare field-name="finalApprovalStatusId" operator="equals" value="CNTAP_REJECTED"/>
+ <if-compare field-name="finalApprovalStatusId" operator="equals" value="CNTAP_APPROVED"/>
+ </or>
+ </condition>
+ <then>
+ <clear-field field-name="contentApproval.approvalStatusId"/>
+ </then>
+ <else-if>
+ <!-- soft rejected, reset rejected (shouldn't be any) and soft rejected entities to ready -->
+ <condition>
+ <and>
+ <if-compare field-name="finalApprovalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
+ <or>
+ <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
+ <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_REJECTED"/>
+ </or>
+ </and>
+ </condition>
+ <then>
+ <set value="CNTAP_READY" field="contentApproval.approvalStatusId" />
+ </then>
+ </else-if>
+ <else-if>
+ <condition>
+ <and>
+ <!-- soft rejected and current record is not soft/rejected, keep currentstatus -->
+ <if-compare field-name="finalApprovalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
+ <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_APPROVED"/>
+ </and>
+ </condition>
+ <then>
+ <set value="CNTAP_APPROVED" field="contentApproval.approvalStatusId" />
+ </then>
+ </else-if>
+ </if>
+ <else>
+ <set value="CNTAP_READY" field="contentApproval.approvalStatusId" />
+ </else>
+ </if-compare>
+ <log level="info" message="contentApproval 2: ${contentApproval}"/>
+
+ <create-value value-name="contentApproval"/>
+ </iterate>
+
+ <!-- if an instance track, check to see if there any new or deleted records on the template -->
+ <set from-field="content.instanceOfContentId" field="rootTemplateContentId" />
+ <log level="info" message="rootTemplateContentId 0aa: ${rootTemplateContentId}"/>
+ <entity-condition entity-name="ContentRevision" list-name="templateContentRevisionList" use-cache="true">
+ <condition-list>
+ <condition-expr field-name="contentId" env-name="rootTemplateContentId" operator="equals"/>
+ </condition-list>
+ <order-by field-name="-contentRevisionSeqId"/>
+ </entity-condition>
+ <set from-field="templateContentRevisionList[0].contentRevisionSeqId" field="latestContentRevisionSeqId" />
+ <log level="info" message="latestContentRevisionSeqId 0aa: ${latestContentRevisionSeqId}"/>
+ <entity-and entity-name="ContentApproval" list-name="templateContentApprovalList">
+ <field-map field-name="contentId" env-name="rootTemplateContentId"/>
+ <field-map field-name="contentRevisionSeqId" env-name="latestContentRevisionSeqId"/>
+ </entity-and>
+ <log level="info" message="templateContentApprovalList 0aa: ${templateContentApprovalList}"/>
+ <iterate list-name="templateContentApprovalList" entry-name="templateContentApproval">
+ <!-- look for this entity in newly created entities -->
+ <entity-condition entity-name="ContentApproval" list-name="newContentApprovalList">
+ <condition-list combine="and">
+ <condition-expr field-name="contentId" operator="equals" env-name="thisContentId"/>
+ <condition-expr field-name="contentRevisionSeqId" operator="equals" env-name="thisContentRevisionSeqId"/>
+ <condition-expr field-name="partyId" operator="equals" env-name="templateContentApproval.partyId" ignore-if-empty="true"/>
+ <condition-expr field-name="roleTypeId" operator="equals" env-name="templateContentApproval.roleTypeId" ignore-if-empty="true"/>
+ </condition-list>
+ </entity-condition>
+ <if-empty field-name="newContentApprovalList">
+ <clone-value value-name="templateContentApproval" new-value-name="contentApproval"/>
+ <log level="info" message="contentApproval 0b: ${contentApproval}"/>
+ <set from-field="thisContentRevisionSeqId" field="contentApproval.contentRevisionSeqId" />
+ <set from-field="thisContentId" field="contentApproval.contentId" />
+ <clear-field field-name="contentApproval.contentApprovalId" />
+ <log level="info" message="contentApproval 1b: ${contentApproval}"/>
+ <make-next-seq-id seq-field-name="contentApprovalId" value-name="contentApproval"/>
+ <set value="CNTAP_READY" field="contentApproval.approvalStatusId" />
+ <log level="info" message="contentApproval 2b: ${contentApproval}"/>
+ <create-value value-name="contentApproval"/>
+ </if-empty>
+ </iterate>
+
+ <!-- TODO: remove instance approvals that have been deleted from the template set -->
+ </else>
+ </if>
</simple-method>
<simple-method method-name="hasApprovalPermission" short-description="Determine ContentApproval permission from passed value">
@@ -814,126 +830,90 @@
</simple-method>
<simple-method method-name="prepForApproval" short-description="Set ContentApprovals for approval process">
- <log level="info" message="got into prepForApproval"></log>
- <set field="rootTemplateContentId" from-field="parameters.rootTemplateContentId" />
+ <log level="info" message="got into prepForApproval- parameters: ${parameters}"></log>
+ <set field="rootContentId" from-field="parameters.rootContentId" />
<check-permission action="_CREATE" permission="CONTENTMGR">
<fail-message message="Security Error: to run prepForApproval you must have the CONTENTMGR_CREATE or CONTENTMGR_ADMIN permission"/>
</check-permission>
<check-errors/>
- <set field="context.rootTemplateContentId" from-field="parameters.rootTemplateContentId" />
- <!-- check for open approvals -->
- <call-service service-name="checkForOpenApprovals" in-map-name="context">
- </call-service>
-
- <!-- bump CDT/I up one for new approval -->
- <!--
- <set field="context2.contentId" from-field="parameters.rootTemplateContentId" />
- <set field="context2.itemContentId" from-field="parameters.rootTemplateContentId" />
+ <!-- bump CDI up one for new approval -->
+ <set field="context2.contentId" from-field="parameters.rootContentId" />
<call-service service-name="persistContentRevisionAndItem" in-map-name="context2">
- <result-to-field result-name="contentRevisionSeqId" field-name="templateContentRevisionSeqId"/>
- <result-to-result result-name="contentRevisionSeqId" service-result-name="templateContentRevisionSeqId"/>
+ <result-to-field result-name="contentRevisionSeqId" field-name="contentRevisionSeqId"/>
+ <result-to-result result-name="contentRevisionSeqId" service-result-name="rootContentRevisionSeqId"/>
</call-service>
+ <log level="info" message="got into prepForApproval- contentRevisionSeqId: ${contentRevisionSeqId}"></log>
- <entity-condition entity-name="Content" list-name="contentList">
- <condition-expr field-name="instanceOfContentId" operator="equals" env-name="parameters.rootTemplateContentId"/>
- </entity-condition>
- <if-not-empty field-name="contentList">
- <set field="newEntity" from-field="contentList[0]" />
- <set field="context3.contentId" from-field="newEntity.contentId"/>
- <set field="rootInstanceContentId" from-field="newEntity.contentId"/>
- <else>
- <add-error>
- <fail-message message="No ContentRevision entity for CDI related to CDT with contentId: ${parameters.rootTemplateContentId}"/>
- </add-error>
- <check-errors/>
- </else>
- </if-not-empty>
- -->
-
- <call-service service-name="persistContentRevisionAndItem" in-map-name="context3">
- <result-to-field result-name="contentRevisionSeqId" field-name="instanceContentRevisionSeqId"/>
- <result-to-result result-name="contentRevisionSeqId" service-result-name="instanceContentRevisionSeqId"/>
- </call-service>
-
+
<!-- create instance approval records for current CDI -->
- <entity-condition entity-name="ContentApproval" list-name="contentApprovalList">
- <condition-expr field-name="contentId" operator="equals" env-name="parameters.rootTemplateContentId"/>
- <order-by field-name="sequenceNum DESC"/>
- </entity-condition>
- <if-not-empty field-name="contentApprovalList">
- <field-to-result field-name="contentApprovalList" result-name="templateApprovalList"/>
- <iterate list-name="contentApprovalList" entry-name="templateContentApproval">
- <make-value entity-name="ContentApproval" value-name="contentApproval"/>
- <make-next-seq-id seq-field-name="contentApprovalId" value-name="contentApproval"/>
- <set field="contentApproval.contentId" from-field="rootInstanceContentId"/>
- <set field="contentApproval.contentRevisionSeqId" from-field="instanceContentRevisionSeqId"/>
- <set field="contentApproval.approvalStatusId" value="CNTAP_READY"/>
- <set field="contentApproval.partyId" from-field="templateContentApproval.partyId" />
- <set field="contentApproval.roleTypeId" from-field="templateContentApproval.roleTypeId" />
- <create-value value-name="contentApproval"/>
- <set field="instanceApprovalList[]" from-field="contentApproval"/>
- </iterate>
- <field-to-result field-name="instanceApprovalList" result-name="instanceApprovalList"/>
- <else>
- <add-error>
- <fail-message message="No ContentApproval entities for CDI related to CDT with contentId: ${parameters.rootTemplateContentId}"/>
- </add-error>
- <check-errors/>
- </else>
- </if-not-empty>
+ <set from-field="rootContentId" field="context3.contentId"/>
+ <set from-field="contentRevisionSeqId" field="context3.contentRevisionSeqId"/>
+ <log level="info" message="got into prepForApproval(3)- context3: ${context3}"></log>
+ <call-service service-name="cloneInstanceContentApprovals" in-map-name="context3">
+ </call-service>
</simple-method>
- <simple-method method-name="checkForOpenApprovals" short-description="Check to see if any open approval conditions exist">
- <!-- Find CDI tied to root CDT -->
- <set field="rootTemplateContentId" from-field="parameters.rootTemplateContentId" />
- <entity-condition entity-name="Content" list-name="contentList">
- <condition-expr field-name="instanceOfContentId" operator="equals" env-name="parameters.rootTemplateContentId"/>
- </entity-condition>
- <if-not-empty field-name="contentList">
- <set field="rootInstanceContentId" from-field="contentList[0].contentId"/>
- <else>
- <add-error>
- <fail-message message="No ContentRevision entity for CDI related to CDT with contentId: ${parameters.rootTemplateContentId}"/>
- </add-error>
- <check-errors/>
- </else>
- </if-not-empty>
-
- <!-- Look for most recent ContentApproval tied to CDI -->
- <entity-condition entity-name="ContentApproval" list-name="contentApprovalList">
- <condition-expr field-name="contentId" operator="equals" env-name="rootInstanceContentId"/>
- <order-by field-name="contentRevisionSeqId DESC"/>
- <order-by field-name="sequenceNum DESC"/>
- </entity-condition>
- <if-not-empty field-name="contentApprovalList">
- <string-to-field string="true" field-name="openApprovalExists"/>
- <field-to-result field-name="openApprovalExists" result-name="openApprovalExists"/>
- <set field="targetContentRevisionSeqId" from-field="contentApprovalList[0].contentRevisionSeqId"/>
- <iterate list-name="contentApprovalList" entry-name="contentApproval">
- <if-compare field-name="contentApproval.contentRevisionSeqId" operator="equals" value="${targetContentRevisionSeqId}">
- <if>
- <condition>
- <or>
- <if-compare field-name="contentApproval.approvalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
- <if-compare field-name="contentApproval.approvalStatusId" operator="equals" value="CNTAP_REJECTED"/>
- </or>
- </condition>
- <then>
- <string-to-field string="false" field-name="openApprovalExists"/>
- <field-to-result field-name="openApprovalExists" result-name="openApprovalExists"/>
- </then>
- </if>
- </if-compare>
- </iterate>
- <else>
- <add-error>
- <fail-message message="No ContentApprovals entities for contentId: ${rootInstanceContentId}"/>
- </add-error>
- <check-errors/>
- </else>
- </if-not-empty>
+ <simple-method method-name="getFinalApprovalStatus" short-description="Check to see if any open approval conditions exist">
+ <!-- iterate thru most recent ContentApproval list and determine its ending status -->
+ <entity-and entity-name="ContentApproval" list-name="contentApprovalList">
+ <field-map field-name="contentId" env-name="parameters.contentId"/>
+ <field-map field-name="contentRevisionSeqId" env-name="parameters.contentRevisionSeqId"/>
+ <order-by field-name="sequenceNum"/>
+ </entity-and>
+
+ <if>
+ <condition>
+ <not>
+ <if-empty field-name="contentApprovalList"/>
+ </not>
+ </condition>
+ <then>
+ <set value="CNTAP_READY" field="finalApprovalStatusId"/>
+ <iterate list-name="contentApprovalList" entry-name="existingContentApproval">
+ <if>
+ <condition>
+ <or>
+ <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_SOFT_REJ"/>
+ <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_REJECTED"/>
+ </or>
+ </condition>
+ <then>
+ <set from-field="existingContentApproval.approvalStatusId" field="finalApprovalStatusId"/>
+ </then>
+ <else-if>
+ <condition>
+ <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_APPROVED"/>
+ </condition>
+ <then>
+ <set value="CNTAP_APPROVED" field="finalApprovalStatusId"/>
+ </then>
+
+ </else-if>
+ <else-if>
+ <condition>
+ <and>
+ <if-compare field-name="existingContentApproval.approvalStatusId" operator="equals" value="CNTAP_READY"/>
+ <if-compare field-name="finalApprovalStatusId" operator="equals" value="CNTAP_APPROVED"/>
+ </and>
+ </condition>
+ <then>
+ <set value="IN_PROCESS" field="finalApprovalStatusId"/>
+ </then>
+
+ </else-if>
+ </if>
+ </iterate>
+ <field-to-result field-name="finalApprovalStatusId" result-name="approvalStatusId"/>
+ <field-to-result field-name="contentApprovalList" result-name="contentApprovalList"/>
+ </then>
+ <else>
+ <set value="CNTAP_NOT_READY" field="finalApprovalStatusId"/>
+ <field-to-result field-name="finalApprovalStatusId" result-name="approvalStatusId"/>
+ </else>
+
+ </if>
</simple-method>
<simple-method method-name="checkForWaitingApprovals" short-description="Check to see if any approval conditions exist for the passed in user">
@@ -997,4 +977,20 @@
<field-to-result field-name="contentApprovalList" result-name="contentApprovalList"/>
</simple-method>
+
+ <simple-method method-name="getMostRecentRevision" short-description="Look for most recent revision for contentId">
+ <entity-condition entity-name="ContentRevision" list-name="contentRevisions" use-cache="true">
+ <condition-list combine="and">
+ <condition-expr field-name="contentId" env-name="parameters.contentId" operator="equals"/>
+ </condition-list>
+ <order-by field-name="-contentRevisionSeqId"/>
+ </entity-condition>
+ <log level="info" message="contentRevisions: ${contentRevisions}"/>
+ <if-not-empty field-name="contentRevisions">
+ <set from-field="contentRevisions[0].contentRevisionSeqId" field="mostRecentRevisionSeqId"/>
+ </if-not-empty>
+ <field-to-result field-name="mostRecentRevisionSeqId" result-name="mostRecentRevisionSeqId"/>
+ </simple-method>
+
+
</simple-methods>
Modified: trunk/applications/content/servicedef/services.xml
===================================================================
--- trunk/applications/content/servicedef/services.xml 2006-03-09 10:51:10 UTC (rev 6957)
+++ trunk/applications/content/servicedef/services.xml 2006-03-09 10:57:10 UTC (rev 6958)
@@ -1309,19 +1309,18 @@
location="org/ofbiz/content/compdoc/CompDocServices.xml"
invoke="prepForApproval" auth="true">
<description>Set ContentApprovals for approval process</description>
- <attribute name="rootTemplateContentId" type="String" mode="IN" optional="false"/>
- <attribute name="templateContentRevisionSeqId" type="String" mode="OUT" optional="false"/>
- <attribute name="instanceContentRevisionSeqId" type="String" mode="OUT" optional="false"/>
- <attribute name="templateApprovalList" type="List" mode="OUT" optional="true"/>
- <attribute name="instanceApprovalList" type="List" mode="OUT" optional="true"/>
+ <attribute name="rootContentId" type="String" mode="IN" optional="false"/>
+ <attribute name="rootContentRevisionSeqId" type="String" mode="OUT" optional="false"/>
</service>
- <service name="checkForOpenApprovals" engine="simple"
+ <service name="getFinalApprovalStatus" engine="simple"
location="org/ofbiz/content/compdoc/CompDocServices.xml"
- invoke="prepForApproval" auth="true">
+ invoke="getFinalApprovalStatus" auth="true">
<description>Set ContentApprovals for approval process</description>
- <attribute name="rootTemplateContentId" type="String" mode="IN" optional="false"/>
- <attribute name="openApprovalExists" type="Boolean" mode="OUT" optional="false"/>
+ <attribute name="contentId" type="String" mode="IN" optional="false"/>
+ <attribute name="contentRevisionSeqId" type="String" mode="INOUT" optional="true"/>
+ <attribute name="approvalStatusId" type="String" mode="OUT" optional="true"/>
+ <attribute name="contentApprovalList" type="List" mode="OUT" optional="true"/>
</service>
<service name="getApprovalsWithPermissions" engine="simple"
@@ -1364,14 +1363,22 @@
<attribute name="rootContentId" type="String" mode="IN" optional="true"/>
</service>
- <service name="cloneContentApprovals" engine="simple"
+ <service name="cloneTemplateContentApprovals" engine="simple"
location="org/ofbiz/content/compdoc/CompDocServices.xml"
- invoke="cloneContentApprovals" auth="true">
- <description>Bump the previous ContentApproval approvals up to current CDT or CDI</description>
+ invoke="cloneTemplateContentApprovals" auth="true">
+ <description>Bump the previous ContentApproval approvals up to current CDT</description>
<attribute name="contentRevisionSeqId" type="String" mode="IN" optional="false"/>
<attribute name="contentId" type="String" mode="IN" optional="false"/>
</service>
+ <service name="cloneInstanceContentApprovals" engine="simple"
+ location="org/ofbiz/content/compdoc/CompDocServices.xml"
+ invoke="cloneInstanceContentApprovals" auth="true">
+ <description>Bump the previous ContentApproval approvals up to current CDI</description>
+ <attribute name="contentRevisionSeqId" type="String" mode="IN" optional="true"/>
+ <attribute name="contentId" type="String" mode="IN" optional="false"/>
+ </service>
+
<service name="checkForWaitingApprovals" engine="simple"
location="org/ofbiz/content/compdoc/CompDocServices.xml"
invoke="checkForWaitingApprovals" auth="true">
@@ -1405,4 +1412,11 @@
<attribute name="locale" type="java.util.Locale" mode="IN" optional="true"/>
<attribute name="outByteWrapper" type="org.ofbiz.entity.util.ByteWrapper" mode="OUT" optional="false"/>
</service>
+ <service name="getMostRecentRevision" engine="simple"
+ location="org/ofbiz/content/compdoc/CompDocServices.xml"
+ invoke="getMostRecentRevision" auth="true">
+ <description>Look for most recent revision for contentId</description>
+ <attribute name="contentId" type="String" mode="IN" optional="false"/>
+ <attribute name="mostRecentRevisionSeqId" type="String" mode="OUT" optional="true"/>
+ </service>
</services>
Modified: trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java
===================================================================
--- trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java 2006-03-09 10:51:10 UTC (rev 6957)
+++ trunk/applications/content/src/org/ofbiz/content/openoffice/OpenOfficeServices.java 2006-03-09 10:57:10 UTC (rev 6958)
@@ -365,7 +365,6 @@
LocalDispatcher dispatcher = dctx.getDispatcher();
Map results = ServiceUtil.returnSuccess();
- String dataResourceId = null;
ByteWrapper byteWrapper = null;
Locale locale = (Locale)context.get("locale");
@@ -383,8 +382,14 @@
String oooPort = (String)context.get("oooPort");
if (UtilValidate.isEmpty(oooPort)) oooPort = "8100";
+ try {
+ xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
+ } catch (IOException ioe) {
+ // just leave it null for cases where OO cannot be reached
+ } catch( Exception e2 ) {
+ // just leave it null for cases where OO cannot be reached
+ }
try {
- xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
List exprList = new ArrayList();
EntityExpr entityExpr = null;
@@ -479,13 +484,17 @@
}
}
} else {
- byteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, thisDataResourceId, https, webSiteId, locale, rootDir);
- OpenOfficeByteArrayInputStream oobais = new OpenOfficeByteArrayInputStream(byteWrapper.getBytes());
- OpenOfficeByteArrayOutputStream oobaos = OpenOfficeWorker.convertOODocByteStreamToByteStream(xmulticomponentfactory, oobais, inputMimeType, "application/pdf");
- inputByteArray = oobaos.toByteArray();
- oobais.close();
- oobaos.close();
- reader = new PdfReader(inputByteArray);
+ if (xmulticomponentfactory != null) {
+ byteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, thisDataResourceId, https, webSiteId, locale, rootDir);
+ OpenOfficeByteArrayInputStream oobais = new OpenOfficeByteArrayInputStream(byteWrapper.getBytes());
+ OpenOfficeByteArrayOutputStream oobaos = OpenOfficeWorker.convertOODocByteStreamToByteStream(xmulticomponentfactory, oobais, inputMimeType, "application/pdf");
+ inputByteArray = oobaos.toByteArray();
+ oobais.close();
+ oobaos.close();
+ reader = new PdfReader(inputByteArray);
+ } else {
+ //TODO: Write a PDF that says that OO is not available?
+ }
}
int n = reader.getNumberOfPages();
for (int i=0; i < n; i++) {
@@ -538,7 +547,6 @@
if (UtilValidate.isEmpty(oooPort)) oooPort = "8100";
try {
- xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
Document document = new Document();
@@ -619,6 +627,7 @@
}
} else {
byteWrapper = DataResourceWorker.getContentAsByteWrapper(delegator, dataResourceId, https, webSiteId, locale, rootDir);
+ xmulticomponentfactory = OpenOfficeWorker.getRemoteServer(oooHost, oooPort);
OpenOfficeByteArrayInputStream oobais = new OpenOfficeByteArrayInputStream(byteWrapper.getBytes());
OpenOfficeByteArrayOutputStream oobaos = OpenOfficeWorker.convertOODocByteStreamToByteStream(xmulticomponentfactory, oobais, inputMimeType, "application/pdf");
inputByteArray = oobaos.toByteArray();
Modified: trunk/applications/content/webapp/content/WEB-INF/controller.xml
===================================================================
--- trunk/applications/content/webapp/content/WEB-INF/controller.xml 2006-03-09 10:51:10 UTC (rev 6957)
+++ trunk/applications/content/webapp/content/WEB-INF/controller.xml 2006-03-09 10:57:10 UTC (rev 6958)
@@ -956,6 +956,13 @@
<response name="error" type="view" value="EditContentApproval"/>
</request-map>
+ <request-map uri="prepForApproval">
+ <security auth="true" https="true"/>
+ <event invoke="prepForApproval" path="" type="service"/>
+ <response name="success" type="view" value="ViewCompDocInstanceTree"/>
+ <response name="error" type="view" value="ViewCompDocInstanceTree"/>
+ </request-map>
+
<!-- ================ ContentRevision Requests ================= -->
<request-map uri="ListContentRevisions"><security auth="true" https="true"/><response name="success" type="view" value="ListContentRevisions"/></request-map>
<request-map uri="EditContentRevision"><security auth="true" https="true"/><response name="success" type="view" value="EditContentRevision"/></request-map>
Modified: trunk/applications/content/widget/compdoc/CompDocForms.xml
===================================================================
--- trunk/applications/content/widget/compdoc/CompDocForms.xml 2006-03-09 10:51:10 UTC (rev 6957)
+++ trunk/applications/content/widget/compdoc/CompDocForms.xml 2006-03-09 10:57:10 UTC (rev 6958)
@@ -185,15 +185,14 @@
</field>
<field name="approvalStatusId" use-when="contentTypeId.equals("COMPDOC_INSTANCE")">
<drop-down allow-empty="true">
- <entity-options description="${description}" entity-name="StatusItem" key-field-name="statusId">
- <entity-constraint name="statusTypeId" value="CNTNTAPPR_STATUS"/>
- <entity-order-by field-name="sequenceId"/>
- </entity-options>
+ <option key="SOFT_REJ" description="Soft Rejected"/>
+ <option key="REJECTED" description="Rejected"/>
+ <option key="APPROVED" description="Approved"/>
</drop-down>
</field>
<field name="approvalDate" title="" widget-style="inputBox"><date-time/></field>
<field name="sequenceNum" title="" widget-style="inputBox"><text/></field>
- <field name="comments" title="" widget-style="inputBox"><text size="40"/></field>
+ <field name="comments" title="" widget-style="inputBox"><textarea cols="30" rows="3"/></field>
<field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="smallSubmit"><submit/></field>
</form>
@@ -228,24 +227,27 @@
<field name="contentId"><hidden/></field>
<field name="rootContentId" map-name="empty"><hidden/></field>
<field name="contentRevisionSeqId"><display/></field>
- <field name="partyId"><display/></field>
+ <field name="partyId" title="" widget-style="inputBox">
+ <lookup target-form-name="LookupPartyName"/>
+ </field>
<field name="roleTypeId">
- <display-entity entity-name="RoleType" key-field-name="roleTypeId" description="${description}"/>
- </field>
- <field name="approvalStatusId" use-when=""COMPDOC_INSTANCE".equals(contentTypeId)">
<drop-down allow-empty="true">
- <entity-options description="${description}" entity-name="StatusItem" key-field-name="statusId">
- <entity-constraint name="statusTypeId" value="CNTNTAPPR_STATUS"/>
- <entity-order-by field-name="sequenceId"/>
+ <entity-options description="${description}" entity-name="RoleType" key-field-name="roleTypeId">
+ <!-- <entity-constraint name="parentTypeId" value=""/> -->
+ <entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
- <field name="approvalDate"><display/></field>
- <field name="sequenceNum"><display/></field>
- <field name="comments"><display/></field>
- <field name="Edit" title=" " widget-style="buttontext">
- <hyperlink also-hidden="false" description="[Edit]" target="EditContentApproval?contentApprovalId=${contentApprovalId}&rootContentId=${contentId}&rootContentRevisionSeqId=${contentRevisionSeqId}"/>
+ <field name="approvalStatusId" use-when="contentTypeId.equals("COMPDOC_INSTANCE")">
+ <drop-down allow-empty="true">
+ <option key="SOFT_REJ" description="Soft Rejected"/>
+ <option key="REJECTED" description="Rejected"/>
+ <option key="APPROVED" description="Approved"/>
+ </drop-down>
</field>
+ <field name="approvalDate" title="" widget-style="inputBox"><date-time/></field>
+ <field name="sequenceNum" title="" widget-style="inputBox"><text/></field>
+ <field name="comments" title="" widget-style="inputBox"><textarea cols="30" rows="3"/></field>
<field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit" use-when=""COMPDOC_INSTANCE".equals(contentTypeId)"><submit/></field>
</form>
@@ -254,26 +256,30 @@
list-name="contentApprovalList" default-widget-style="tabletext" title="" type="list">
<field name="contentApprovalId" widget-style="tabletext"><display/></field>
<field name="contentId"><hidden/></field>
+ <field name="rootContentId" map-name="empty"><hidden/></field>
<field name="contentRevisionSeqId"><display/></field>
- <field name="partyId"><display/></field>
+ <field name="partyId" title="" widget-style="inputBox">
+ <lookup target-form-name="LookupPartyName"/>
+ </field>
<field name="roleTypeId">
- <display-entity entity-name="RoleType" key-field-name="roleTypeId" description="${description}"/>
- </field>
- <field name="approvalStatusId">
<drop-down allow-empty="true">
- <entity-options description="${description}" entity-name="StatusItem" key-field-name="statusId">
- <entity-constraint name="statusTypeId" value="CNTNTAPPR_STATUS"/>
- <entity-order-by field-name="sequenceId"/>
+ <entity-options description="${description}" entity-name="RoleType" key-field-name="roleTypeId">
+ <!-- <entity-constraint name="parentTypeId" value=""/> -->
+ <entity-order-by field-name="description"/>
</entity-options>
</drop-down>
</field>
- <field name="approvalDate"><display/></field>
- <field name="sequenceNum"><display/></field>
- <field name="comments"><display/></field>
- <field name="Edit" title=" " widget-style="buttontext">
- <hyperlink also-hidden="false" description="[Edit]" target="EditContentApproval?contentApprovalId=${contentApprovalId}"/>
+ <field name="approvalStatusId" use-when="contentTypeId.equals("COMPDOC_INSTANCE")">
+ <drop-down allow-empty="true">
+ <option key="SOFT_REJ" description="Soft Rejected"/>
+ <option key="REJECTED" description="Rejected"/>
+ <option key="APPROVED" description="Approved"/>
+ </drop-down>
</field>
- <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit" ><submit/></field>
+ <field name="approvalDate" title="" widget-style="inputBox"><date-time/></field>
+ <field name="sequenceNum" title="" widget-style="inputBox"><text/></field>
+ <field name="comments" title="" widget-style="inputBox"><text size="40"/></field>
+ <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit" use-when=""COMPDOC_INSTANCE".equals(contentTypeId)"><submit/></field>
</form>
@@ -410,7 +416,7 @@
<sub-hyperlink target="EditSurvey?surveyId=${dataResource.relatedDetailId}" description="Edit Survey" link-style="buttontext" use-when="dataResource.get("relatedDetailId")!=null"/>
</lookup>
</field>
- <field name="relatedDetailId" map-name="dataResource" title="Survey Response ID" use-when="dataResource!=null&&"SURVEY_RESPONSE".equals(dataResource.getString("dataResourceTypeId"))">
+ <field name="relatedDetailId" map-name="dataResource" title="Survey Response ID" use-when="dataResource!=null&&"SURVEY_RESPONSE".equals(dataResource.getString("dataResourceTypeId"))&&dataResource.get("relatedDetailId")!=null">
<lookup target-form-name="LookupSurveyResponse">
<sub-hyperlink target="EditSurveyResponse?surveyResponseId=${dataResource.relatedDetailId}" description="Edit Survey Response" link-style="buttontext" use-when="dataResource.get("relatedDetailId")!=null"/>
</lookup>
@@ -418,6 +424,31 @@
<field name="submitButton" title="Submit" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
+ <form name="ViewChildCompDoc" default-map-name="contentAssoc" title="" type="single" target=""
+
+ default-title-style="tableheadtext" default-tooltip-style="tabletext" default-widget-style="inputBox">
+
+ <field name="contentId" widget-style="tabletext"><display/></field>
+ <field name="contentName" map-name="itemContent"><display/></field>
+ <field name="contentTypeId" map-name="itemContent"><hidden/></field>
+ <field name="instanceOfContentId" map-name="itemContent" use-when="contentTypeId.equals("DOCUMENT")" title="Instance of Content" widget-style="tabletext"><display-entity entity-name="Content" key-field-name="contentId" description="${contentName} [${contentId}]"/></field>
+ <field name="contentIdTo" widget-style="tabletext" title="Parent Content ID"><display-entity entity-name="Content" key-field-name="contentId" description="${contentName} [${contentId}]"/></field>
+ <field name="contentAssocTypeId" widget-style="tabletext"><display-entity entity-name="ContentAssocType" also-hidden="false"/></field>
+ <field name="fromDate" title="From Date" widget-style="tabletext"><display/></field>
+ <field name="thruDate" title="Thru Date"><display/></field>
+ <field name="sequenceNum" title="Sequence Num"><display/></field>
+
+ <field name="mimeTypeId" map-name="dataResource" title="Document Type" widget-style="tabletext">
+ <display-entity entity-name="MimeType" key-field-name="mimeTypeId" description="${description}"/>
+ </field>
+ <field name="relatedDetailId" map-name="dataResource" title="Survey ID" use-when="dataResource!=null&&"SURVEY".equals(dataResource.getString("dataResourceTypeId"))">
+ <display/>
+ </field>
+ <field name="relatedDetailId" map-name="dataResource" title="Survey Response ID" use-when="dataResource!=null&&"SURVEY_RESPONSE".equals(dataResource.getString("dataResourceTypeId"))&&dataResource.get("relatedDetailId")!=null">
+ <display/>
+ </field>
+ </form>
+
<!-- ================ CompDoc Revision ================= -->
<form name="EditContentRevisionAndItem" target="updateContentRevisionAndItem" title="" type="single"
Modified: trunk/applications/content/widget/compdoc/CompDocMenus.xml
===================================================================
--- trunk/applications/content/widget/compdoc/CompDocMenus.xml 2006-03-09 10:51:10 UTC (rev 6957)
+++ trunk/applications/content/widget/compdoc/CompDocMenus.xml 2006-03-09 10:57:10 UTC (rev 6958)
@@ -118,32 +118,7 @@
<link target="EditChildCompDoc?contentId=${itemContentId}&itemContentRevisionSeqId=${itemContentRevisionSeqId}&caContentIdTo=${contentId}&contentRevisionSeqId=${contentRevisionSeqId}&fromDate=${fromDate}"/>
</menu-item>
</menu>
-
- <menu name="treeline" default-title-style="tabButton"
- default-selected-style="tabButtonSelected"
- default-menu-item-name="content"
- orientation="horizontal"
- menu-width="100%"
- default-tooltip-style="tabletext" default-widget-style="tabButton"
- selected-menuitem-context-field-name="currentMenuItemName"
- title="" type="simple">
- <menu-item name="edit-inplace" title="${contentName}[${contentId}]" >
- <link target="EditRootCompDoc?contentId=${contentId}&contentRevisionSeqId=${contentRevisionSeqId}"/>
- </menu-item>
- <menu-item name="edit-link" title="Edit" >
- <link target="EditRootCompDoc?contentId=${contentId}&caContentIdTo=${contentIdTo}&caContentAssocTypeId=${contentAssocTypeId}&caSequenceNum=${seqNumBefore}&caFromDate=${fromDate}"/>
- </menu-item>
- <menu-item name="child" title="+Child" >
- <link target="EditCompDoc?caContentIdTo=${contentId}&caSequenceNum=9999"/>
- </menu-item>
- <menu-item name="bef" title="+Bef" >
- <link target="EditCompDoc?caContentIdTo=${contentIdTo}&caContentAssocTypeId=${contentAssocTypeId}&caSequenceNum=${seqNumBefore}&caFromDate=${fromDate}"/>
- </menu-item>
- <menu-item name="aft" title="+Aft" >
- <link target="EditCompDoc?caContentIdTo=${contentIdTo}&caContentAssocTypeId=${contentAssocTypeId}&caSequenceNum=${seqNumAfter}&caFromDate=${fromDate}"/>
- </menu-item>
- </menu>
-
+
<menu name="rootTemplateLine" default-title-style="tabButton"
default-selected-style="tabButtonSelected"
default-menu-item-name="content"
@@ -159,8 +134,17 @@
<link target="EditRootCompDoc?rootContentId=${rootContentId}&contentRevisionSeqId=${rootContentRevisionSeqId}"/>
</menu-item>
<menu-item name="child" title="+Child" >
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="equals" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
<link target="AddChildCompDocTemplate?caContentIdTo=${contentId}&sequenceNum=9999"/> <!-- rootContentRevisionSeqId=${rootContentRevisionSeqId}& -->
</menu-item>
+ <menu-item name="latest" title="Current Template CompDoc" >
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="greater" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
+ <link target="ViewCompDocTemplateTree?rootContentId=${contentId}"/> <!-- rootContentRevisionSeqId=${rootContentRevisionSeqId}& -->
+ </menu-item>
<!-- on page
<menu-item name="viewinst" title="View Instances" >
<link target="ViewInstances?rootContentId=${rootContentId}&contentRevisionSeqId=${rootContentRevisionSeqId}"/>
@@ -180,10 +164,10 @@
selected-menuitem-context-field-name="currentMenuItemName"
title="" type="simple">
<menu-item name="edit-inplace" title="${contentName}[${contentId}]" >
- <link target="EditChildCompDoc?itemContentId=${contentId}&contentId=${contentIdTo}&caFromDate=${fromDate}&contentRevisionSeqId=${contentRevisionSeqId}&rootContentId=${rootContentId}"/>
+ <link target="EditChildCompDoc?itemContentId=${contentId}&contentId=${contentIdTo}&caFromDate=${fromDate}&contentRevisionSeqId=${maxRevisionSeqId}&rootContentId=${rootContentId}"/>
</menu-item>
<menu-item name="edit-link" title="Edit" >
- <link target="EditChildCompDoc?contentId=${contentId}&caContentIdTo=${contentIdTo}&caFromDate=${fromDate}&contentRevisionSeqId=${contentRevisionSeqId}&rootContentId=${rootContentId}"/>
+ <link target="EditChildCompDoc?contentId=${contentId}&caContentIdTo=${contentIdTo}&caFromDate=${fromDate}&contentRevisionSeqId=${maxRevisionSeqId}&rootContentId=${rootContentId}"/>
</menu-item>
<!-- only one level for now
<menu-item name="child" title="+Child" >
@@ -191,15 +175,27 @@
</menu-item>
-->
<menu-item name="bef" title="+Bef" >
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="equals" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
<link target="AddChildCompDocTemplate?contentId=${contentId}&caContentIdTo=${contentIdTo}&caContentAssocTypeId=${contentAssocTypeId}&caSequenceNum=${seqNumBefore}&caFromDate=${fromDate}"/> <!-- &contentRevisionSeqId=${contentRevisionSeqId} -->
</menu-item>
<menu-item name="aft" title="+Aft" >
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="equals" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
<link target="AddChildCompDocTemplate?contentId=${contentId}&caContentIdTo=${contentIdTo}&caContentAssocTypeId=${contentAssocTypeId}&caSequenceNum=${seqNumAfter}&caFromDate=${fromDate}"/> <!-- &contentRevisionSeqId=${contentRevisionSeqId} -->
</menu-item>
<menu-item name="up" title="^Up" >
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="equals" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
<link target="resequenceCompDocPart?contentId=${contentId}&dir=up&contentAssocTypeId=COMPDOC_PART&contentIdTo=${contentIdTo}&caContentAssocTypeId=${contentAssocTypeId}&caSequenceNum=${seqNumBefore}&caFromDate=${fromDate}&rootContentId=${rootContentId}&rootContentRevisionSeqId=${rootContentRevisionSeqId}"/>
</menu-item>
<menu-item name="down" title="vDn" >
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="equals" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
<link target="resequenceCompDocPart?contentId=${contentId}&dir=down&contentAssocTypeId=COMPDOC_PART&contentIdTo=${contentIdTo}&caContentAssocTypeId=${contentAssocTypeId}&caSequenceNum=${seqNumBefore}&caFromDate=${fromDate}&rootContentId=${rootContentId}&rootContentRevisionSeqId=${rootContentRevisionSeqId}"/>
</menu-item>
</menu>
@@ -233,7 +229,10 @@
</menu-item>
<menu-item name="edit-link-add" title="Add" >
<condition>
- <if-empty field-name="assocRevisionItemView"/>
+ <and>
+ <if-empty field-name="assocRevisionItemView"/>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="equals" to-field-name="rootContentRevisionSeqId"/>
+ </and>
</condition>
<link target="AddChildCompDocInstance?caContentIdTo=${rootContentId}&instanceOfContentId=${contentId}&caSequenceNum=${maxRevisionSeqId}"/>
</menu-item>
@@ -263,6 +262,12 @@
<menu-item name="viewtree" title="View Template Tree">
<link target="ViewCompDocTemplateTree?rootContentRevisionSeqId=${templateContentRevisionSeqId}&rootContentId=${templateContentId}"/>
</menu-item>
+ <menu-item name="latest" title="Current Instance CompDoc" >
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="greater" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
+ <link target="ViewCompDocInstanceTree?rootContentId=${rootContentId}"/> <!-- rootContentRevisionSeqId=${rootContentRevisionSeqId}& -->
+ </menu-item>
</menu>
Modified: trunk/applications/content/widget/compdoc/CompDocScreens.xml
===================================================================
--- trunk/applications/content/widget/compdoc/CompDocScreens.xml 2006-03-09 10:51:10 UTC (rev 6957)
+++ trunk/applications/content/widget/compdoc/CompDocScreens.xml 2006-03-09 10:57:10 UTC (rev 6958)
@@ -418,10 +418,28 @@
<actions>
<set field="menuName" value="subtree"/>
<set field="currentMenuItemName" value="edit"/>
+ <!--
+ There is a confusing naming convention here.
+ rootContentId, as always, refers to the root of the CompDoc tree.
+ Incoming parameters.contentId is switched to itemContentId because that is what ContentRevisionItem calls it.
+ If parameters.caContentIdTo exists (coming back from a persist operation) is set to contentId, again
+ because ContentRevisionItem calls it that. If caContentIdTo does not exist, contentId is set from rootContentId.
+ Currently, rootContentId and contentId will be the same, but in anticipation of CompDocs inside of CompDocs
+ this distinction is made.
+ rootContentId is set from parameters.rootContentId, but if it does not exist, it is set from caContentIdTo
+ (probably an unnecessary and confusing exercise)
+ -->
<set from-field="parameters.contentId" field="itemContentId"/>
<set from-field="parameters.caContentIdTo" default-value="${parameters.rootContentId}" field="contentId"/>
<set from-field="parameters.rootContentId" default-value="${parameters.caContentIdTo}" field="rootContentId"/>
<set from-field="parameters.rootContentRevisionSeqId" default-value="${parameters.contentRevisionSeqId}" field="rootContentRevisionSeqId"/>
+ <!-- need to get the latest rootContentRevisionSeqId -->
+ <service service-name="getMostRecentRevision" result-map-name="result">
+ <field-map field-name="contentId" env-name="rootContentId"/>
+ </service>
+ <set from-field="result.mostRecentRevisionSeqId" field="mostRecentRevisionSeqId"/>
+ <set from-field="rootContentRevisionSeqId" default-value="${mostRecentRevisionSeqId}" field="rootContentRevisionSeqId" />
+
<entity-one entity-name="Content" value-name="itemContent" use-cache="false">
<field-map field-name="contentId" env-name="itemContentId"/>
</entity-one>
@@ -431,6 +449,12 @@
<field-map field-name="fromDate" env-name="parameters.caFromDate"/>
<field-map field-name="contentAssocTypeId" value="COMPDOC_PART"/>
</entity-one>
+
+ <!-- If parameters.itemContentRevisionSeqId does not exist, it is necessary to the contentRevisionSeqId
+ from the ContentRevisionItem that is most recent, but not greater than the rootContentRevisionSeqId.
+ This operation effectively gets the current ContentRevisionItem entity, in any case, and
+ that is needed to get the dataResourceId for this revision, which may not be the latest.
+ -->
<entity-condition entity-name="ContentRevisionItem" list-name="contentRevisionItems" use-cache="true">
<condition-list combine="and">
<condition-expr field-name="contentId" env-name="rootContentId" operator="equals"/>
@@ -446,16 +470,6 @@
</entity-one>
<set from-field="dataResource.mimeTypeId" field="mimeTypeId"/>
- <!-- need to get the latest rootContentRevisionSeqId -->
- <entity-condition entity-name="ContentRevision" list-name="contentRevisions" use-cache="true">
- <condition-list combine="and">
- <condition-expr field-name="contentId" env-name="rootContentId" operator="equals"/>
- <condition-expr field-name="contentRevisionSeqId" env-name="itemContentRevisionSeqId" operator="less-equals" ignore-if-empty="true"/>
- </condition-list>
- <order-by field-name="-contentRevisionSeqId"/>
- </entity-condition>
- <set from-field="rootContentRevisionSeqId" default-value="${contentRevisions[0].contentRevisionSeqId}" field="rootContentRevisionSeqId" />
-
</actions>
<widgets>
<section>
@@ -470,24 +484,25 @@
<widgets>
<decorator-screen name="commonCompDocDecorator" location="component://content/widget/CommonScreens.xml">
<decorator-section name="body">
- <include-form name="EditChildCompDoc" location="component://content/widget/compdoc/CompDocForms.xml"/>
- <section>
- <!-- For upload-able DataResourceTypes -->
- <!--
- <condition>
- <and>
- <not><if-empty field-name="dataResource.dataResourceTypeId"/></not>
- <if-compare field-name="dataResource.dataResourceTypeId" operator="not-equals" value="SURVEY"/>
- </and>
- </condition>
- -->
- <actions>
- </actions>
- <widgets>
- <include-screen name="ContentViewLink"/>
- <include-screen name="UploadCompDocContent"/>
- </widgets>
- </section>
+ <section>
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="equals" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
+ <widgets>
+ <include-form name="EditChildCompDoc" location="component://content/widget/compdoc/CompDocForms.xml"/>
+ <include-screen name="ContentViewLink"/>
+ <include-screen name="UploadCompDocContent"/>
+ </widgets>
+ </section>
+ <section>
+ <condition>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="greater" to-field-name="rootContentRevisionSeqId"/>
+ </condition>
+ <widgets>
+ <include-form name="ViewChildCompDoc" location="component://content/widget/compdoc/CompDocForms.xml"/>
+ <include-screen name="ContentViewLink"/>
+ </widgets>
+ </section>
</decorator-section>
</decorator-screen>
</widgets>
@@ -515,16 +530,12 @@
</entity-condition>
<set from-field="rootRevList[0].maxRevisionSeqId" field="rootInstanceRevSeqId"/>
-->
- <!--
<entity-one entity-name="Content" value-name="templateContent" use-cache="false">
- <field-map field-name="contentId" env-name="content.instanceOfContentId"/>
+ <field-map field-name="contentId" env-name="itemContent.instanceOfContentId"/>
</entity-one>
<entity-one entity-name="DataResource" value-name="templateDataResource" use-cache="false">
<field-map field-name="dataResourceId" env-name="templateContent.dataResourceId"/>
</entity-one>
- <set from-field="templateDataResource.mimeTypeId" field="dataResource.mimeTypeId"/>
- <set from-field="templateDataResource.mimeTypeId" field="mimeTypeId"/>
- -->
</actions>
<widgets>
<decorator-screen name="commonCompDocDecorator" location="component://content/widget/CommonScreens.xml">
@@ -594,23 +605,30 @@
</section>
<section>
<condition>
- <or>
- <if-compare field-name="dataResource.mimeTypeId" operator="equals" value="application/vnd.ofbiz.survey.response"/>
<if-compare field-name="dataResource.mimeTypeId" operator="equals" value="application/vnd.ofbiz.survey"/>
- <!--
- <if-compare field-name="dataResource.dataResourceTypeId" operator="equals" value="SURVEY"/>
- <if-compare field-name="dataResource.dataResourceTypeId" operator="equals" value="SURVEY_RESPONSE"/>
- -->
- </or>
</condition>
<actions>
</actions>
<widgets>
- <container><link target="ViewCompDocContentSurvey?contentId=${itemContentId}&contentRevisionSeqId=${itemContentRevisionSeqId}&rootContentId=${rootContentId}" text="View CompDoc Content" style="buttontext"/></container>
+ <!-- link on form
+ <container><link target="EditSurvey?surveyId=${dataResource.relatedDetailId}&rootContentId=${rootContentId}" text="View CompDoc Content" style="buttontext"/></container>
+ -->
</widgets>
</section>
<section>
<condition>
+ <if-compare field-name="dataResource.mimeTypeId" operator="equals" value="application/vnd.ofbiz.survey.response"/>
+ </condition>
+ <actions>
+ </actions>
+ <widgets>
+ <!-- link on form
+ <container><link target="EditSurveyResponse?surveyResponseId=${dataResource.relatedDetailId}&rootContentId=${rootContentId}" text="View CompDoc Content" style="buttontext"/></container>
+ -->
+ </widgets>
+ </section>
+ <section>
+ <condition>
<not>
<or>
<if-compare field-name="dataResource.mimeTypeId" operator="equals" value="application/msword"/>
@@ -888,15 +906,13 @@
<set from-field="parameters.rootContentId" field="rootContentId" />
<set from-field="parameters.rootContentRevisionSeqId" field="rootContentRevisionSeqId" />
<set value="COMPDOC_TEMPLATE" field="contentTypeId" />
- <entity-condition entity-name="ContentRevision" list-name="contentRevisions" use-cache="true">
- <condition-list combine="and">
- <condition-expr field-name="contentId" env-name="rootContentId" operator="equals"/>
- </condition-list>
- <order-by field-name="-contentRevisionSeqId"/>
- </entity-condition>
- <set from-field="parameters.rootContentRevisionSeqId" default-value="${contentRevisions[0].contentRevisionSeqId}" field="rootContentRevisionSeqId" />
-
- <set field="menuName" value="tree"/>
+ <service service-name="getMostRecentRevision" result-map-name="result">
+ <field-map field-name="contentId" env-name="rootContentId"/>
+ </service>
+ <set from-field="result.mostRecentRevisionSeqId" field="mostRecentRevisionSeqId"/>
+ <set from-field="parameters.rootContentRevisionSeqId" default-value="${mostRecentRevisionSeqId}" field="rootContentRevisionSeqId" />
+
+ <set field="menuName" value="tree"/>
<set field="title" value="Root Template ${rootContentId}, rev. ${rootContentRevisionSeqId}"/>
<set field="currentMenuItemName" value="viewtree"/>
@@ -926,14 +942,13 @@
<set from-field="parameters.rootContentId" field="rootContentId" />
<set from-field="parameters.rootContentRevisionSeqId" field="rootContentRevisionSeqId" />
<set value="COMPDOC_INSTANCE" field="contentTypeId" />
- <entity-condition entity-name="ContentRevision" list-name="contentRevisions" use-cache="true">
- <condition-list combine="and">
- <condition-expr field-name="contentId" env-name="rootContentId" operator="equals"/>
- </condition-list>
- <order-by field-name="-contentRevisionSeqId"/>
- </entity-condition>
- <set from-field="parameters.rootContentRevisionSeqId" default-value="${contentRevisions[0].contentRevisionSeqId}" field="rootContentRevisionSeqId" />
+ <service service-name="getMostRecentRevision" result-map-name="result">
+ <field-map field-name="contentId" env-name="parameters.rootContentId"/>
+ </service>
+ <set from-field="result.mostRecentRevisionSeqId" field="mostRecentRevisionSeqId"/>
+ <set from-field="parameters.rootContentRevisionSeqId" default-value="${mostRecentRevisionSeqId}" field="rootContentRevisionSeqId" />
+
<entity-one entity-name="Content" value-name="instanceContent">
<field-map field-name="contentId" env-name="rootContentId"/>
</entity-one>
@@ -968,8 +983,29 @@
<screen name="rootInstanceLine">
<section>
+ <actions>
+ <service service-name="getFinalApprovalStatus" result-map-name="results">
+ <field-map field-name="contentId" env-name="rootContentId"/>
+ <field-map field-name="contentRevisionSeqId" env-name="rootContentRevisionSeqId"/>
+ </service>
+ <entity-one entity-name="StatusItem" value-name="statusItem">
+ <field-map field-name="statusId" env-name="results.approvalStatusId"/>
+ </entity-one>
+ </actions>
<widgets>
<include-menu name="rootInstanceLine" location="component://content/widget/compdoc/CompDocMenus.xml"/>
+ <label text="Approval Status: ${statusItem.description}" style="head2"/>
+ <section>
+ <condition>
+ <and>
+ <if-compare-field field-name="mostRecentRevisionSeqId" operator="equals" to-field-name="rootContentRevisionSeqId"/>
+ <if-compare value="CNTAP_NOT_READY" field-name="results.approvalStatusId" operator="equals"/>
+ </and>
+ </condition>
+ <widgets>
+ <link text="Start Approval Process" target="prepForApproval?rootContentId=${rootContentId}&rootContentRevisionSeqId=${rootContentRevisionSeqId}" style="buttontext"/>
+ </widgets>
+ </section>
</widgets>
</section>
</screen>
More information about the Svn
mailing list