You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Sylvain Wallez <sy...@apache.org> on 2005/09/23 12:31:13 UTC

[cforms] compact notation for

Hi all,

I'd like to introduce a compact notation on form template elements for 
stylings that require only attributes (the vast majority of them).

For example, we currently have to write:
  <ft:widget id="text">
    <fi:styling type="textarea" rows="10" cols="30"/>
  </ft:widget>

The compact notation would allow to write:
  <ft:widget id="text" type="textarea" rows="10" cols="30"/>

The more verbose form will still be allowed, and both forms will produce 
the same results, as foreign attributes on "ft:widget" will lead to 
generating a <fi:styling> with these attributes.

Another thing I'd like to change also is the need for 
submit-on-change="true", making it implicit on widgets that have some 
attached change listeners.

That will make form templates less verbose and closer to the traditional 
html syntax.

Any objections?

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Re: [cforms] compact notation for

Posted by Carsten Ziegeler <cz...@apache.org>.
Sylvain Wallez wrote:
> 
> Aren't you tried of:
> - unclosing a ft:widget with no styling,
> - type fi:styling
> - type styling attributes
> - close ft:widget
> - and finally indent everything?
> 
No, actually not :) - my editor is indenting for me (at least sometimes)
and I'm using copy/paste anyway...

> This proposal is about turning this to just "type styling attributes" :-)
Ok.

Carsten


-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Re: Ant: [cforms] compact notation for

Posted by Mark Lundquist <ml...@wrinkledog.com>.
On Sep 24, 2005, at 3:08 AM, Bertrand Delacretaz wrote:

> Le 24 sept. 05, à 10:14, Reinhard Poetz a écrit :
>> ...Yes and a check that the style is either set by @fi:* or 
>> <fi:styling> and throw a meaningful exception in the case that a user 
>> tries to go both ways there shouldn't be any problems...
>
> Agreed, the compact notation is more readable, I'm +1 on making it the 
> recommended way for cases where the element-based syntax is not 
> required.

+1


Re: Ant: [cforms] compact notation for

Posted by Bertrand Delacretaz <bd...@apache.org>.
Le 24 sept. 05, à 10:14, Reinhard Poetz a écrit :
> ...Yes and a check that the style is either set by @fi:* or 
> <fi:styling> and throw a meaningful exception in the case that a user 
> tries to go both ways there shouldn't be any problems...

Agreed, the compact notation is more readable, I'm +1 on making it the 
recommended way for cases where the element-based syntax is not 
required.

-Bertrand

Re: Ant: [cforms] compact notation for

Posted by Reinhard Poetz <re...@apache.org>.
Sylvain Wallez wrote:
> Christoph Hermann wrote:
> 
>> _Imho_ this is not really needed.
>>  
>>
> 
> Sure we don't _need_ it. But I'm really surprised to see people not 
> being interested by an evolution that makes templates much more readable 
> and faster to type and update...

I'm interested :-)

> 
> Digging in all cforms stylesheets, I've seen only 2 stylings that 
> optionally use elements in their configuration: double-listbox (for the 
> list headers) and htmlarea (for a custom init script). All other 
> stylings use only attributes.
> 
>> And it raises the problem with the "buggy" template, if the same 
>> attribute name is used in widget and styling.
>>  
>>
> 
> The buggy template is what can happen if we don't do anything against 
> it. It rather easy to enforce the use of either fi: attributes or 
> <fi:styling>.

Yes and a check that the style is either set by @fi:* or <fi:styling> and throw 
a meaningful exception in the case that a user tries to go both ways there 
shouldn't be any problems.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

Re: Ant: [cforms] compact notation for

Posted by Sylvain Wallez <sy...@apache.org>.
Christoph Hermann wrote:

>_Imho_ this is not really needed.
>  
>

Sure we don't _need_ it. But I'm really surprised to see people not 
being interested by an evolution that makes templates much more readable 
and faster to type and update...

Digging in all cforms stylesheets, I've seen only 2 stylings that 
optionally use elements in their configuration: double-listbox (for the 
list headers) and htmlarea (for a custom init script). All other 
stylings use only attributes.

>And it raises the problem with the "buggy" template, if the same attribute name is used in widget and styling.
>  
>

The buggy template is what can happen if we don't do anything against 
it. It rather easy to enforce the use of either fi: attributes or 
<fi:styling>.

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Re: Ant: [cforms] compact notation for

Posted by Christoph Hermann <ch...@guschtel.de>.
Sylvain Wallez schrieb:

Hello,

>> So, if the majority thinks that it's useful, I'm ok with it - but I
>> remain sceptical.

> Aren't you tried of:
> - unclosing a ft:widget with no styling,

<ft:widget ... />

> - type fi:styling
> - type styling attributes
> - close ft:widget

Get an XML Editor ;) I only type "</" the rest is autocompleted (i.e.
jEdit & xml-plugin(s)).

> - and finally indent everything?

Either this is done automatically, or i can do it with two mouse-clicks
or a key combination.

> This proposal is about turning this to just "type styling attributes" :-)

_Imho_ this is not really needed.
And it raises the problem with the "buggy" template, if the same
attribute name is used in widget and styling.

Christoph

Re: Ant: [cforms] compact notation for

Posted by Sylvain Wallez <sy...@apache.org>.
Carsten Ziegeler wrote:

>Reinhard Poetz wrote:
>  
>
>>>Hi all,
>>>
>>>I'd like to introduce a compact notation on form
>>>template elements for 
>>>stylings that require only attributes (the vast
>>>majority of them).
>>>
>>>For example, we currently have to write:
>>> <ft:widget id="text">
>>>   <fi:styling type="textarea" rows="10"
>>>cols="30"/>
>>> </ft:widget>
>>>
>>>The compact notation would allow to write:
>>> <ft:widget id="text" type="textarea" rows="10"
>>>cols="30"/>
>>>
>>>The more verbose form will still be allowed, and
>>>both forms will produce 
>>>the same results, as foreign attributes on
>>>"ft:widget" will lead to 
>>>generating a <fi:styling> with these attributes.
>>>
>>>Another thing I'd like to change also is the need
>>>for 
>>>submit-on-change="true", making it implicit on
>>>widgets that have some 
>>>attached change listeners.
>>>
>>>That will make form templates less verbose and
>>>closer to the traditional 
>>>html syntax.
>>>
>>>Any objections?
>>>      
>>>
>>generally not. While reading your proposal I had the
>>idea of using prefixed attributes to make it very
>>clear that they contain styling information:
>>
>><ft:widget id="text" fi:type="textarea" fi:rows="10"
>>fi:cols="30"/>
>>
>>This should also help with validation.
>>
>>    
>>
>I agree with Reinhard here, we should use the namespace for the styling
>attributes to clearly indicate that these attributes are for styling.
>  
>

Ok. You're right that this clearly indicates their purpose, even if it's 
3 more keystrokes per attribute :-)

>Apart from that I'm not against your suggestion, but I don't see a real
>benefit.
>

Well, saving keystokes and enhancing readability ! So the benefit is to 
make the template writer's life easier.

>Imho it gets more complicated as now two different notations
>are possible and users will worry about when to use what, or if there is
>a difference etc.
>

I think once this is done we should recommend the attribute notation, 
except where hierarchical styling configuration is needed (AFAIR, only 
htmlarea allows this currently).

>In addition creating an fi:styling element out of
>attributes from a ft:widget element might be too much magic.
>

Remember that most if not all CForms users never see the expanded 
template. Only people writing styling stylesheets have to care about this.

>What happens if you use both?
>  
>

The stylesheets always use 'fi:styling/@foo' paths. So as long as both 
the <ft:widget> and <fi:styling> do not hold the same attributes, the 
two stylings are merged.

If however the same attribute appears on both, then the concatenation of 
attributes will be used (because of XPath's node-list to string 
conversion) and then the styling will likely malfunction. But that case 
is a buggy template.

>So, if the majority thinks that it's useful, I'm ok with it - but I remain sceptical.
>  
>

Aren't you tried of:
- unclosing a ft:widget with no styling,
- type fi:styling
- type styling attributes
- close ft:widget
- and finally indent everything?

This proposal is about turning this to just "type styling attributes" :-)

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Re: Ant: [cforms] compact notation for

Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
> 
>>Hi all,
>>
>>I'd like to introduce a compact notation on form
>>template elements for 
>>stylings that require only attributes (the vast
>>majority of them).
>>
>>For example, we currently have to write:
>>  <ft:widget id="text">
>>    <fi:styling type="textarea" rows="10"
>>cols="30"/>
>>  </ft:widget>
>>
>>The compact notation would allow to write:
>>  <ft:widget id="text" type="textarea" rows="10"
>>cols="30"/>
>>
>>The more verbose form will still be allowed, and
>>both forms will produce 
>>the same results, as foreign attributes on
>>"ft:widget" will lead to 
>>generating a <fi:styling> with these attributes.
>>
>>Another thing I'd like to change also is the need
>>for 
>>submit-on-change="true", making it implicit on
>>widgets that have some 
>>attached change listeners.
>>
>>That will make form templates less verbose and
>>closer to the traditional 
>>html syntax.
>>
>>Any objections?
> 
> 
> generally not. While reading your proposal I had the
> idea of using prefixed attributes to make it very
> clear that they contain styling information:
> 
> <ft:widget id="text" fi:type="textarea" fi:rows="10"
> fi:cols="30"/>
> 
> This should also help with validation.
> 
I agree with Reinhard here, we should use the namespace for the styling
attributes to clearly indicate that these attributes are for styling.

Apart from that I'm not against your suggestion, but I don't see a real
benefit. Imho it gets more complicated as now two different notations
are possible and users will worry about when to use what, or if there is
a difference etc. In addition creating an fi:styling element out of
attributes from a ft:widget element might be too much magic. What
happens if you use both?

So, if the majority thinks that it's useful, I'm ok with it - but I
remain sceptical.

Carsten
-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Ant: [cforms] compact notation for

Posted by Reinhard Poetz <re...@yahoo.de>.
--- Sylvain Wallez <sy...@apache.org> schrieb:

> Hi all,
> 
> I'd like to introduce a compact notation on form
> template elements for 
> stylings that require only attributes (the vast
> majority of them).
> 
> For example, we currently have to write:
>   <ft:widget id="text">
>     <fi:styling type="textarea" rows="10"
> cols="30"/>
>   </ft:widget>
> 
> The compact notation would allow to write:
>   <ft:widget id="text" type="textarea" rows="10"
> cols="30"/>
> 
> The more verbose form will still be allowed, and
> both forms will produce 
> the same results, as foreign attributes on
> "ft:widget" will lead to 
> generating a <fi:styling> with these attributes.
> 
> Another thing I'd like to change also is the need
> for 
> submit-on-change="true", making it implicit on
> widgets that have some 
> attached change listeners.
> 
> That will make form templates less verbose and
> closer to the traditional 
> html syntax.
> 
> Any objections?

generally not. While reading your proposal I had the
idea of using prefixed attributes to make it very
clear that they contain styling information:

<ft:widget id="text" fi:type="textarea" fi:rows="10"
fi:cols="30"/>

This should also help with validation.

--
Reinhard


	

	
		
___________________________________________________________ 
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de