You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yves Vindevogel <yv...@implements.be> on 2003/04/04 17:08:15 UTC

Does this look familiar

Hi all,

I've been using Cocoon since quite some time now, and I'm doing pretty much 
everything with it.  However, I miss one thing.

As a development project leader, coordinating a team, I found it very 
difficult to create large websites (like 500 screens on database with 75 
tables) that are consistent and easy to manage (afterwards).  Changes in 
functional specifications were horrible.

I was therefore looking for a system to "describe" pages, rather than to code 
them.  I've been doing my own development on this, giving me nice results in 
Cocoon.  What I do is this: I describe my page in XML, and then use that 
description as a generator in a pipeline.  I put on some transformations, and 
finally, my page is constructed in html with some xsl stylesheets.

But, before I develop any further, I would like to know if there are similar 
projects on-going.

On XMLForms.  They seem to handle form validation.  I can include that for 
validating forms, but it does not describe a page completely, does it ?  E.g. 
you can't describe a menu in it, like the menu on the left in 
xml.apache.org/cocoon.

On Sunrise.  Sunrise seems to be able to handle authentication on forms, but, 
it does not go into the form itself, where a part of the form may be 
different according to the user that is logged in.  Right ?

So, I don't find a whole concept within Cocoon.
Let me show you some examples below, to clarify what I mean.

Below is the description of a simple menu.
All links are visible to everybody, except the link to the helpdesk, which is 
only accessible when you are logged in as a client (this is kept in the 
session)

<?xml version="1.0" encoding="ISO-8859-1"?>
<xml>
	<layout>
		<title>Clients</title>

		<menu href="users/client/xml.login.html" label="Login"/>
                <menu href="users/client/xml.forgotpass.html" label="Forgot 
Password?"/>
                <space/>
                <menu id="helpdesk" href="helpdesk/tab.index.html" 
label="Helpdesk"/>
	</layout>

        <security>
        	<menu id="helpdesk">
			<usergroup name="client" visible="true"/>
                </menu>
        </security>
</xml>


The example below describes a screen.  A query is executed, and, if results 
are found, a list is shown with two columns in it.  If not, a message is 
shown.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
    			xmlns:xsp="http://apache.org/xsp"
			xmlns:xsp-request="http://apache.org/xsp/request/2.0"
			xmlns:xsp-session="http://apache.org/xsp/session/2.0"
			xmlns:sql="http://apache.org/cocoon/SQL/2.0"
			create-session="true">

        <xml>
                <query>
                        select st.oid, st.subject, st.tickettype
                        	from tblSupportTicket st inner join 
tblSupportTicketEntry te on st.oid = te.ticket
                                	inner join tblSiteUser su on te.login = 
su.oid
                         	where te.parententry is null
                                	and su.login = '<xsp-session:get-attribute 
name="username"/>'
                </query>

		<results>
                	<layout>
                                <list>
                                        <fields>
                                                <field name="subject" 
label="Subject">

                                                </field>

                                                <field name="tickettype" 
label="Ticket Type"/>
                                        </fields>
                                </list>
                 	</layout>
                </results>
                
                <no-results>
                        <message>
                                <p>No active tickets available.</p>
                        </message>
                </no-results>
        </xml>
</xsp:page>



Below a final example.  I receive the results from a form (there's no XMLForm 
validation in it yet).  I use a Postgresql plsql function, that tries to 
insert the data in the database.  The function returns values 0 
(ok,inserted), 1 - 4 (errors, but not against the database itself, logical 
errors), or a real error when you have a duplicate login.  (I know I can 
check on blanks differently, but for now, I used this method)

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java"
    			xmlns:xsp="http://apache.org/xsp"
			xmlns:xsp-request="http://apache.org/xsp/request/2.0"
			xmlns:xsp-session="http://apache.org/xsp/session/2.0"
			xmlns:sql="http://apache.org/cocoon/SQL/2.0"
			create-session="true">

        <xml>
                <query>
                        select fnSiteUserStandardInsert (
                        	'<xsp-request:get-parameter name="login"/>',
                        	'<xsp-request:get-parameter name="email"/>',
                        	'<xsp-request:get-parameter name="password"/>',
                                '<xsp-request:get-parameter name="reenter"/>'
                                )
                </query>
                
                <results>
                        <result>
                                <value>0</value>
                                <title>Thank you</title>
                                <message>
                                	<p>Thank you for registering.</p>
                                        <p>An email has been sent to you to 
confirm your registration. When this mail arrives, click on the link inside.
                                        This will confirm your registration 
immediatly</p>
                                        <p>Thanks again for 
registering<br/>Implements</p>

                                 </message>
                        </result>
                        
                        <result>
                                <value>1</value>
                                <title>Error while registering</title>
                                <message>
                                	<p>The passwords you entered are not 
identical.</p>
                                 </message>
                                 <button value="Back">history.back()</button>
                        </result>
                        
                        <result>
                                <value>2</value>
                                <title>Error while registering</title>
                                <message>
                                	<p>The password cannot be empty or all 
blanks.</p>
                                 </message>
                                 <button value="Back">history.back()</button>
                        </result>
                
                        <result>
                                <value>3</value>
                                <title>Error while registering</title>
                                <message>
                                	<p>The login cannot be empty or all 
blanks.</p>
                                 </message>
                                 <button value="Back">history.back()</button>
                        </result>
                        
                        <result>
                                <value>4</value>
                                <title>Error while registering</title>
                                <message>
                                	<p>The email address cannot be empty or all 
blanks.</p>
                                 </message>
                                 <button value="Back">history.back()</button>
                        </result>
                </results>

                <errors>
                        <error>
                                <value>ERROR:  Cannot insert a duplicate key 
into unique index tblsiteregistereduser_login_key</value>
                                <title>Error while registering</title>
                                <message>
                                	<p>There's already an entry on that email 
address in our database<br/>You seem to be a registered user already.</p>
                                        <p>If you have forgotten your 
password, you can have it resent to you on this <a 
href="xml.forgotpass.html">page</a>.<br/>
                                        	If you want to enter a different 
email addres, click on the "Back" button below."
                                        </p>

                                </message>
                                <button value="Back">history.back()</button>
                        </error>
                </errors>
        </xml>
</xsp:page>

-- 
Met vriendelijke groeten,
Kind regards,
Bien à vous,

Yves Vindevogel

Implements
Kempische Steenweg 206  --  3500 Hasselt  --  Belgium
Phone/Fax: +32 (11) 43.55.76  --  Mobile: +32 (478) 80.82.91
Mail: yves.vindevogel@implements.be  --  www.implements.be

Quote: The winner never says participating is more important than winning.

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