You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Grzegorz Kossakowski <gk...@apache.org> on 2007/08/05 15:47:25 UTC
Re: Using Variables/attributes in CForm/Ajax/Jexl
Dev at weitling pisze:
> Hi Grzegorz*,
Hi Florian, sorry for long delay. Yes, I'm busy with GSoC work and my ISP makes everything what's possible to start wondering about another
provider...
>
> I tried it with the code attached below. I hope it's not stripped down
> too much.
>
After looking at the code now I know what you meant. I'll post my comments below.
> Beware when I start speak Klingon ;-) I mean with Jexl everything with
> ${foo} according to the Cocoon docs. In the first run my Jexl expression
> is un as expected, in the second run (caused by the Ajax call) it might
> by called but it's not part of the update.
AFAIR, context object has "request" scope so it's recreated every time browser makes new request. Your results are expected, but there is a
solution (see below).
> Grzegorz, you are still my hero (cutting heads off the Hydra) :-)
> BTW: How's your name pronounced?
Hehe, have a look at http://reflectingonthevicissitudes.wordpress.com/2007/04/22/pal-how-can-i-call-you/ :-)
> Another question: Do you know a way to call a client-side javascript
> when an Ajax call returns?
Unfortunately not. I guess you would have to register some kind of event handler but I'm really not ruling on client side, especially when
it comes to the whole AJAX thing.
> ####### templates/ajax_dummy.xml #######
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <html xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
> xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
> xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
> xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>
> <jx:import
> uri="resource://org/apache/cocoon/forms/generation/jx-macros.xml"/>
> <body>
> <ft:form-template action="ajax_dummy" method="POST" ajax="true">
> <input type="hidden" name="continuation-id"
> value="${continuation.id}"/>
> widget: <ft:widget id="argh"/>
> <br/>
> contxt: ${cocoon.context.getAttribute("haga")}
> <br/>
> bzData: ${bizData.haga}
> <br/>
> parmtr: ${cocoon.parameters.getParameter("haga")}
> <br/>
What about:
form attribute: ${form.getAttribute("fatcat")}
or:
widget attribute: ${widget.getAttribute("fatcat")}
Of course you must set this attribute in flowscript.
> <ft:widget id="doit"/>
> </ft:form-template>
> </body>
> </html>
>
> ######## flow ########
> function doAjax_dummy () {
> var form = new Form("definitions/ajax_dummy.xml");
> cocoon.context.setAttribute("haga","huga");
> var bizData = new Object();
> bizData.haga = new Packages.java.lang.Integer(17);
> form.form.getChild("add-special").addActionListener(function () {
> bizData.haga = new Packages.java.lang.Integer(21);
> });
> form.form.getChild("argh").setValue(new Packages.java.lang.Integer(17));
form.form.setAttribute("fatcat", "That cat is really fat!");
> form.showForm("templates/ajax_dummy.xml",{bizData:bizData});
> cocoon.sendPage("success");
> }
I hope that attributes will work for you. In a fact, I believe there were invented to handle exactly such cases as yours.
--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Jason Johnston <co...@lojjic.net>.
Dev at weitling wrote:
> My personal Hydra looks like this:
>
...
> - My ${}'s in the template are either in the second run (Ajax) not
> evaluated or are filtered and therefore not redisplayed in the browser.
>
> The last point is heavy weight for me. Hm, I could circumvent it by
> doing without Ajax, but it's soooo cool.
I assume you're talking about ${} expressions that are not within an
ft:widget whose widget has been updated. In that case you're correct
the content will be filtered out by the BrowserUpdateTransformer.
You can, however, indicate to the BUTransformer that certain pieces of
content should not be filtered out, by using the same mechanism the
ft:widget macros use: wrap the content in a <bu:replace> element. For
instance:
<bu:replace>
<span id="myContentId">${some.expression}</span>
</bu:replace>
Repeat that pattern for each piece of content you want sent back to the
browser in the AJAX response. You must set a unique id for each content
element; you can optionally set it on the bu:replace element rather than
the child element.
You might not want the content to be sent to the browser for every AJAX
request, such as if it's not changing. In that case you'd need to add
extra logic to only create the bu:replace if the content has changed.
Hope that helps take care of one hydra head. ;-)
--Jason
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Dev at weitling <de...@weitling.net>.
Hi Grek,
> No problem. Sorry for delay on my side, if you want to know the reason
> take a look at the end of this mail...
The revenge came with a huge delay on my side ;-)
>> So my solution approaches (not exhaustive):
>> a) a html table hiding a column (= a language) via Ajax and
>> WidgetState.INVISIBLE for each affected cell. This seems to be the best
>> solution for accessibility but suffers from a bug [1] returning span's
>> instead of td's.
>
> I remember your report. I think we should try to tackle down this
> problem because it's really annoying and limiting.
>
> It would be very helpful if you could come up with really minimal form
> definition and template that shows buggy behaviour and create issue in
> JIRA. This could become a start point for debugging and fixing it.
Now the developers list is flooded with my first JIRA entry (sorry
folks, didn't know this triggers an avalanche), you may have a look at
https://issues.apache.org/jira/browse/COCOON-2126. I've stripped it down
to the very core.
> My GSoC project ends in a few days and even though I'll continue my
> work on expression and object model handling in Cocoon I'll have more
> free time to help others. Of course I don't make any promises, we
> don't know in advance if this issue is serious or not.
I've seen the merits you earned on the dev list - a kudo from me, too!
I'm sorry we cannot meet at the GT.
>> b) a html table where the hiding is done via deleting and adding rows.
>> There's a problem reloading the data when the user wants to see a hidden
>> language again and with preventing deletion of database entries.
>
> You see yourself that it's hacky. Don't even think about such solution
> ;-)
Never thought about this. Not even for a second ;-)
>> d) a table made of div's instead of a classical table. Is a work-around
>> for a) but is bad for screenreaders. And I didn't test if span's are
>> returned or div's.
I found a solution even working for screenreaders: The CSS "display" has
values for table style elements e.g. table, table-row, table-cell
marking a div or another element as table container, row or cell.
But it requires still some CSS tricks...
>> BTW: It seems TeeTransformer has a bug - tags like <br/> are converted
>> in the output to <br> missing the closing element.
>
> What about JIRA issue? It's really going to be lost on mailing list.
I'll prepare the next avalanche :-)
Bye,
Florian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Grzegorz Kossakowski <gk...@apache.org>.
Dev at weitling pisze:
> Yes and no, as written below. Sorry for the delay, but my wife reminds
> me that we are on holiday (Balconia :-)
No problem. Sorry for delay on my side, if you want to know the reason take a look at the end of
this mail...
> Well, make yourself comfortable...
> I want to create an editor component where a question along with a bunch
> of possible answers can be created and/or edited. Each question is
> localized in one or more languages, e.g. german, english, french.
> According to the role of the user or his task he may have complete
> rights (edit questions and answers, add or delete answers), may only
> translate from one language to another or may only view some languages.
> The user may hide some languages for convenience.
Ahh, still the same app :-)
> So my solution approaches (not exhaustive):
> a) a html table hiding a column (= a language) via Ajax and
> WidgetState.INVISIBLE for each affected cell. This seems to be the best
> solution for accessibility but suffers from a bug [1] returning span's
> instead of td's.
I remember your report. I think we should try to tackle down this problem because it's really
annoying and limiting.
It would be very helpful if you could come up with really minimal form definition and template that
shows buggy behaviour and create issue in JIRA. This could become a start point for debugging and
fixing it.
My GSoC project ends in a few days and even though I'll continue my work on expression and object
model handling in Cocoon I'll have more free time to help others. Of course I don't make any
promises, we don't know in advance if this issue is serious or not.
> b) a html table where the hiding is done via deleting and adding rows.
> There's a problem reloading the data when the user wants to see a hidden
> language again and with preventing deletion of database entries.
You see yourself that it's hacky. Don't even think about such solution ;-)
> c) a html table where the hiding is done via client-side javascript and
> manipulating css styles (one class per column). I have repressed the
> problems with this.
Less hacky but I really prefer a) option.
> d) a table made of div's instead of a classical table. Is a work-around
> for a) but is bad for screenreaders. And I didn't test if span's are
> returned or div's.
>
> In the mind's eye I have something like tabs for each language, variable
> in width depending on the number of languages displayed. The optimum
> would be a scrollable area for the answer cells - displaying 10
> languages would result in rather narrow columns otherwise. And with 40
> possible answers the questions should be visible, too, as seen in
> Excel's "fix window" feature.
> Additionally when a language is hidden you may redisplay it by choosing
> it from a drop-down-menu.
> Reordering columns aka languages is also one of my dreams.
I think that everything is possible to do with current CForms as long as you make
WidgetState.INVISIBLE working.
>
> BTW: It seems TeeTransformer has a bug - tags like <br/> are converted
> in the output to <br> missing the closing element.
What about JIRA issue? It's really going to be lost on mailing list.
--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/
*** My Internet Service Provider breaks my internet connection ***
*** incessantly so I'll not be able to respond to e-mails ***
*** regularly and my work will be somehow irregular. ***
*** I'm already trying to switch ISP but it will take handful amount of time. ***
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Dev at weitling <de...@weitling.net>.
>> I bet it's better to have <table> for tables/tabular data where <div> is
>> more for visual arrangement. The latter is not as important for
>> screenreaders/visually impaired as the structure indicated by
>> well-arranged table/thead/tbody/tr/th/td.
>>
> agreed, it's up to you to think of your page as a data representation :)
Please let me my dreams :-)
> I think you will have a hard time keeping the positionning good after
> ajax calls without tables, through Internet Explorer especially.
> This is not Cocoon related, so I wish you the best luck !
Argh! I tried it! Seems I have to be more of a berserk to cut Hydra's
heads than a knight in shining armor...
Any tips are (still) welcome!
Florian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Baptiste Placé <bo...@free.fr>.
Florian
> I bet it's better to have <table> for tables/tabular data where <div> is
> more for visual arrangement. The latter is not as important for
> screenreaders/visually impaired as the structure indicated by
> well-arranged table/thead/tbody/tr/th/td.
>
agreed, it's up to you to think of your page as a data representation :)
> At the moment I use a mix of c) and d) according to
> [http://www.dev-archive.net/articles/table-in-css.html]. Not the holy
> grail I sought after, but working for now. At a later point in time
> we'll perhaps have a real professional for redesigning the page.
>
> Florian
>
>
I think you will have a hard time keeping the positionning good after
ajax calls without tables, through Internet Explorer especially.
This is not Cocoon related, so I wish you the best luck !
Baptiste
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Dev at weitling <de...@weitling.net>.
Hi Baptiste,
> It may be simpler with heavy client side JavaScript as in solution c).
> You may even reorder the table with it .
> It may be a little heavy on the size on the page though.
> What is the problem with solution d) for screenreaders ?
I bet it's better to have <table> for tables/tabular data where <div> is
more for visual arrangement. The latter is not as important for
screenreaders/visually impaired as the structure indicated by
well-arranged table/thead/tbody/tr/th/td.
At the moment I use a mix of c) and d) according to
[http://www.dev-archive.net/articles/table-in-css.html]. Not the holy
grail I sought after, but working for now. At a later point in time
we'll perhaps have a real professional for redesigning the page.
Florian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Baptiste Placé <bo...@free.fr>.
Florian,
It may be simpler with heavy client side JavaScript as in solution c).
You may even reorder the table with it .
It may be a little heavy on the size on the page though.
What is the problem with solution d) for screenreaders ?
Baptiste
>
> Well, make yourself comfortable...
> I want to create an editor component where a question along with a bunch
> of possible answers can be created and/or edited. Each question is
> localized in one or more languages, e.g. german, english, french.
> According to the role of the user or his task he may have complete
> rights (edit questions and answers, add or delete answers), may only
> translate from one language to another or may only view some languages.
> The user may hide some languages for convenience.
> So my solution approaches (not exhaustive):
> a) a html table hiding a column (= a language) via Ajax and
> WidgetState.INVISIBLE for each affected cell. This seems to be the best
> solution for accessibility but suffers from a bug [1] returning span's
> instead of td's.
> b) a html table where the hiding is done via deleting and adding rows.
> There's a problem reloading the data when the user wants to see a hidden
> language again and with preventing deletion of database entries.
> c) a html table where the hiding is done via client-side javascript and
> manipulating css styles (one class per column). I have repressed the
> problems with this.
> d) a table made of div's instead of a classical table. Is a work-around
> for a) but is bad for screenreaders. And I didn't test if span's are
> returned or div's.
>
> In the mind's eye I have something like tabs for each language, variable
> in width depending on the number of languages displayed. The optimum
> would be a scrollable area for the answer cells - displaying 10
> languages would result in rather narrow columns otherwise. And with 40
> possible answers the questions should be visible, too, as seen in
> Excel's "fix window" feature.
> Additionally when a language is hidden you may redisplay it by choosing
> it from a drop-down-menu.
> Reordering columns aka languages is also one of my dreams.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Dev at weitling <de...@weitling.net>.
>> - The "form" variable is available in the flow as well as in the
>> template, but not in the definition. At the latter place I have to go
>> via event.source.form.
> I think it is not that big deal, isn't it?
Nothing making sleepless night ;-)
>> - When I have access to the variable "form", I should also have access
>> to any variable defined in the flow e.g. myCat. So no need to go via
>> set/getAttribute.
>> - My ${}'s in the template are either in the second run (Ajax) not
>> evaluated or are filtered and therefore not redisplayed in the browser.
>>
>> The last point is heavy weight for me. Hm, I could circumvent it by
>> doing without Ajax, but it's soooo cool.
>
> Does suggestion from Jason helps you already or there is still a problem?
Yes and no, as written below. Sorry for the delay, but my wife reminds
me that we are on holiday (Balconia :-)
> I must admit that I lost "big picture" and forgot what exactly you
> want to achieve. Could you remind us?
> It would be much easier to suggest solution.
Well, make yourself comfortable...
I want to create an editor component where a question along with a bunch
of possible answers can be created and/or edited. Each question is
localized in one or more languages, e.g. german, english, french.
According to the role of the user or his task he may have complete
rights (edit questions and answers, add or delete answers), may only
translate from one language to another or may only view some languages.
The user may hide some languages for convenience.
So my solution approaches (not exhaustive):
a) a html table hiding a column (= a language) via Ajax and
WidgetState.INVISIBLE for each affected cell. This seems to be the best
solution for accessibility but suffers from a bug [1] returning span's
instead of td's.
b) a html table where the hiding is done via deleting and adding rows.
There's a problem reloading the data when the user wants to see a hidden
language again and with preventing deletion of database entries.
c) a html table where the hiding is done via client-side javascript and
manipulating css styles (one class per column). I have repressed the
problems with this.
d) a table made of div's instead of a classical table. Is a work-around
for a) but is bad for screenreaders. And I didn't test if span's are
returned or div's.
In the mind's eye I have something like tabs for each language, variable
in width depending on the number of languages displayed. The optimum
would be a scrollable area for the answer cells - displaying 10
languages would result in rather narrow columns otherwise. And with 40
possible answers the questions should be visible, too, as seen in
Excel's "fix window" feature.
Additionally when a language is hidden you may redisplay it by choosing
it from a drop-down-menu.
Reordering columns aka languages is also one of my dreams.
> I would pronounce 'Grszegorsz' differently thant Polish Grzegorz. I
> could write my name as Gżegoż and from pronouncing point of view there
> would be no difference. Actually my name is not that hard, what about
> Grzegorz Brzęczyszczykiewicz or Andrzej Stypiczyński? :-P
> Ok, I believe that there are other languages with strange
> pronunciation, only most English names happen to be quite simple. :-)
:-)
BTW: It seems TeeTransformer has a bug - tags like <br/> are converted
in the output to <br> missing the closing element.
Florian
_____
[1]
http://www.nabble.com/Bug-(-!)-in-Html-table-Ajax-combination-t4112294.html
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Grzegorz Kossakowski <gk...@apache.org>.
Dev at weitling pisze:
>
> My personal Hydra looks like this:
>
> - The "form" variable is available in the flow as well as in the
> template, but not in the definition. At the latter place I have to go
> via event.source.form.
I think it is not that big deal, isn't it?
> - When I have access to the variable "form", I should also have access
> to any variable defined in the flow e.g. myCat. So no need to go via
> set/getAttribute.
> - My ${}'s in the template are either in the second run (Ajax) not
> evaluated or are filtered and therefore not redisplayed in the browser.
>
> The last point is heavy weight for me. Hm, I could circumvent it by
> doing without Ajax, but it's soooo cool.
Does suggestion from Jason helps you already or there is still a problem?
I must admit that I lost "big picture" and forgot what exactly you want to achieve. Could you remind us?
It would be much easier to suggest solution.
> Shouldn't that be Grszegorsz then? :-)
I don't know, being Pole it's quite obvious for me how to pronounce Grzegorz ;-)
I would pronounce 'Grszegorsz' differently thant Polish Grzegorz. I could write my name as Gżegoż and from pronouncing point of view there
would be no difference. Actually my name is not that hard, what about Grzegorz Brzęczyszczykiewicz or Andrzej Stypiczyński? :-P
Ok, I believe that there are other languages with strange pronunciation, only most English names happen to be quite simple. :-)
--
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Using Variables/attributes in CForm/Ajax/Jexl
Posted by Dev at weitling <de...@weitling.net>.
Hi Grek,
>> Beware when I start speak Klingon ;-) I mean with Jexl everything with
>> ${foo} according to the Cocoon docs. In the first run my Jexl expression
>> is un as expected, in the second run (caused by the Ajax call) it might
>> by called but it's not part of the update.
>
> AFAIR, context object has "request" scope so it's recreated every time
> browser makes new request. Your results are expected, but there is a
> solution (see below).
>
>> Grzegorz, you are still my hero (cutting heads off the Hydra) :-)
My personal Hydra looks like this:
- The "form" variable is available in the flow as well as in the
template, but not in the definition. At the latter place I have to go
via event.source.form.
- When I have access to the variable "form", I should also have access
to any variable defined in the flow e.g. myCat. So no need to go via
set/getAttribute.
- My ${}'s in the template are either in the second run (Ajax) not
evaluated or are filtered and therefore not redisplayed in the browser.
The last point is heavy weight for me. Hm, I could circumvent it by
doing without Ajax, but it's soooo cool.
>> BTW: How's your name pronounced?
> Hehe, have a look at
> http://reflectingonthevicissitudes.wordpress.com/2007/04/22/pal-how-can-i-call-you/
> :-)
Shouldn't that be Grszegorsz then? :-)
Bye,
Florian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org