You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by eg...@apache.org on 2003/09/30 16:22:41 UTC

cvs commit: cocoon-lenya/src/webapp/lenya/content/info delete.xsp archive.xsp

egli        2003/09/30 07:22:40

  Modified:    src/webapp/lenya/content/info delete.xsp archive.xsp
  Log:
  Added the functionality to find references to the current document
  (which can be used to warn a user before deleting or archiving) using
  the DocumentReferencesHelper helper class.
  
  Revision  Changes    Path
  1.6       +28 -8     cocoon-lenya/src/webapp/lenya/content/info/delete.xsp
  
  Index: delete.xsp
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/content/info/delete.xsp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- delete.xsp	5 Sep 2003 14:41:10 -0000	1.5
  +++ delete.xsp	30 Sep 2003 14:22:40 -0000	1.6
  @@ -7,13 +7,33 @@
     xmlns:input="http://apache.org/cocoon/xsp/input/1.0"
     >
   
  -<page>
  -  <info>
  -    <request-uri><xsp-request:get-uri/></request-uri>
  -    <document-id><input:get-attribute module="page-envelope" as="string" name="document-id"/></document-id>
  -    <area><input:get-attribute module="page-envelope" as="string" name="area"/></area>
  -    <task-id>deleteDocument</task-id>
  -  </info>
  -</page>
  +  <xsp:structure>
  +    <xsp:include>org.apache.lenya.cms.publication.Publication</xsp:include>
  +    <xsp:include>org.apache.lenya.cms.publication.xsp.DocumentReferencesHelper</xsp:include>
  +  </xsp:structure>
  +  
  +  <page>
  +    <info>
  +      <request-uri><xsp-request:get-uri/></request-uri>
  +      <document-id><input:get-attribute module="page-envelope" as="string" name="document-id"/></document-id>
  +      <area><input:get-attribute module="page-envelope" as="string" name="area"/></area>
  +      <task-id>deleteDocument</task-id>
  +      <xsp:logic>
  +	DocumentReferencesHelper helper = new DocumentReferencesHelper(objectModel);
  +	String[] references = helper.getReferences(Publication.LIVE_AREA);
  +	if (references.length &gt; 0) {
  +          </xsp:logic><inconsistent-documents><xsp:logic>
  +
  +          for (int i = 0; i &lt; references.length; i++) {
  +	    <inconsistent-document>
  +	      <xsp:attribute name="href"><xsp:expr>helper.getURL(Publication.LIVE_AREA, references[i])</xsp:expr></xsp:attribute>
  +	      <xsp:expr>references[i]</xsp:expr>
  +	    </inconsistent-document>
  +	  }  
  +	</xsp:logic></inconsistent-documents><xsp:logic>
  +	}
  +      </xsp:logic>
  +    </info>
  +  </page>
   
   </xsp:page>
  
  
  
  1.8       +28 -8     cocoon-lenya/src/webapp/lenya/content/info/archive.xsp
  
  Index: archive.xsp
  ===================================================================
  RCS file: /home/cvs/cocoon-lenya/src/webapp/lenya/content/info/archive.xsp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- archive.xsp	5 Sep 2003 14:41:10 -0000	1.7
  +++ archive.xsp	30 Sep 2003 14:22:40 -0000	1.8
  @@ -7,12 +7,32 @@
     xmlns:input="http://apache.org/cocoon/xsp/input/1.0"
     >
   
  -<page>
  -<info>
  -  <request-uri><xsp-request:get-uri/></request-uri>
  -    <document-id><input:get-attribute module="page-envelope" as="string" name="document-id"/></document-id>
  -    <area><input:get-attribute module="page-envelope" as="string" name="area"/></area>
  -  <task-id>archiveDocument</task-id>
  -</info>
  -</page>
  +  <xsp:structure>
  +    <xsp:include>org.apache.lenya.cms.publication.Publication</xsp:include>
  +    <xsp:include>org.apache.lenya.cms.publication.xsp.DocumentReferencesHelper</xsp:include>
  +  </xsp:structure>
  +  
  +  <page>
  +    <info>
  +      <request-uri><xsp-request:get-uri/></request-uri>
  +      <document-id><input:get-attribute module="page-envelope" as="string" name="document-id"/></document-id>
  +      <area><input:get-attribute module="page-envelope" as="string" name="area"/></area>
  +      <task-id>archiveDocument</task-id>
  +      <xsp:logic>
  +	DocumentReferencesHelper helper = new DocumentReferencesHelper(objectModel);
  +	String[] references = helper.getReferences(Publication.LIVE_AREA);
  +	if (references.length &gt; 0) {
  +          </xsp:logic><inconsistent-documents><xsp:logic>
  +
  +          for (int i = 0; i &lt; references.length; i++) {
  +	    <inconsistent-document>
  +	      <xsp:attribute name="href"><xsp:expr>helper.getURL(Publication.LIVE_AREA, references[i])</xsp:expr></xsp:attribute>
  +	      <xsp:expr>references[i]</xsp:expr>
  +	    </inconsistent-document>
  +	  }  
  +	</xsp:logic></inconsistent-documents><xsp:logic>
  +	}
  +      </xsp:logic>
  +    </info>
  +  </page>
   </xsp:page>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org