lenya/src/webapp/lenya/pubs/default/content/authoring create.xsp,1.2,1.3

Christian Egli <[email protected]> Wed, 14 May 2003 11:59:18 +0200
Newsgroups gmane.comp.cms.wyona.cvs
Message-ID <[email protected]>
Update of /repository/lenya/src/webapp/lenya/pubs/default/content/authoring
In directory erbium:/tmp/cvs-serv21180/src/webapp/lenya/pubs/default/content/authoring

Modified Files:
	create.xsp 
Log Message:
Simplified by using request and session logicsheets.


Index: create.xsp
===================================================================
RCS file: /repository/lenya/src/webapp/lenya/pubs/default/content/authoring/create.xsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** create.xsp	8 May 2003 14:06:06 -0000	1.2
--- create.xsp	14 May 2003 09:59:15 -0000	1.3
***************
*** 5,8 ****
--- 5,10 ----
    xmlns:xsp="http://apache.org/xsp"  
    xmlns:xsp-lenya="http://www.lenya.org/xsp/lenya/1.0"
+   xmlns:xsp-request="http://apache.org/xsp/request/2.0"
+   xmlns:xsp-session="http://apache.org/xsp/session/2.0" create-session="true"
    >
    
***************
*** 18,48 ****
      
      <xsp:logic>
!       String referer = request.getRequestURI();
!       Session session = request.getSession(true);
!       String status = request.getParameter("status");
        if (status == null) {
!         session.setAttribute("org.apache.lenya.cms.cocoon.acting.ParentChildCreatorAction.parent_uri",referer);
!         <xsp:content>
! 	  <referer><xsp:expr>referer</xsp:expr></referer>
!         </xsp:content>
        } else {
!         <xsp:content>
! 	  <referer><xsp:expr>session.getAttribute("org.apache.lenya.cms.cocoon.acting.ParentChildCreatorAction.parent_uri")</xsp:expr></referer>
!         </xsp:content>
!         if (status.equals("failed")) {
!         <xsp:content><exception/></xsp:content>
!         }
        }
!       if (request.getParameter("parent-uri") != null) {
!         <xsp:content>
! 	  <parentid><xsp:expr>request.getParameter("parent-uri")</xsp:expr></parentid>
!         </xsp:content>
!       } else {
!         <xsp:content>
! 	  <parentid><xsp-lenya:document-id/></parentid>
!         </xsp:content>
        }
        <xsp:content>
! 	<doctype><xsp:expr>request.getParameter("doctype")</xsp:expr></doctype>
        </xsp:content>
      </xsp:logic>
--- 20,56 ----
      
      <xsp:logic>
!       String SESSION_PARENT_ID_NAME = 
!           "org.apache.lenya.cms.cocoon.acting.ParentChildCreatorAction.parent_uri";
!       // fetch the referer
!       String referer = <xsp-request:get-uri/>;
!       String status = <xsp-request:get-parameter name="status"/>;
        if (status == null) {
!         session.setAttribute(SESSION_PARENT_ID_NAME, referer);
        } else {
!         referer = (String)session.getAttribute(SESSION_PARENT_ID_NAME);
        }
! 
!       // get the parentId
!       String parentId = <xsp-request:get-parameter name="parent-uri"/>;
!       if (parentId == null) {
!         parentId = <xsp-lenya:document-id/>;
!         // for creation purposes the parentid "/index" (the home page) is special.
!         if (parentId.equals("/index")) {
!           parentId = "/";
! 	}
        }
+ 
        <xsp:content>
! 	<referer><xsp:expr>referer</xsp:expr></referer>
!       </xsp:content>
! 
!       if ((status != null) &amp;&amp; (status.equals("failed"))) {
!         <xsp:content><exception/></xsp:content>
!       }
!       <xsp:content>
! 	<parentid><xsp:expr>parentId</xsp:expr></parentid>
!       </xsp:content>
!       <xsp:content>
! 	<doctype><xsp:expr><xsp-request:get-parameter name="doctype"/></xsp:expr></doctype>
        </xsp:content>
      </xsp:logic>