Just a small note to tell you about some small (but nice) enhancements for which I have spent two days rewriting parts related to html DOM ids.
We can now use <r:link/> to update any <r:block/> on the page. This can be interesting to preview a node without leaving the page’s context. Just use update='dom_id' in the link tag where dom_id is the id of the block to update (see block for an example).
Another way to update a node is to use drag and drop: drop a node on a special drop block and voilà (see drop example).
It can be interesting to log changes on nodes. To do so, simply add ‘m_title’ and ‘m_text’ hidden input fields in the form. These attributes are write-only.
Sometimes, it is interesting to create a new node by copying (parts) of another node. Simply use the copy pseudo attribute and insert attributes in brackets in the (hidden) input fields:
<r:form>
<r:input type='hidden' name='v_text' value='[v_text] copy'/>
<r:input type='hidden' name='copy_id' value='45'/>
</r:form>
This can also be used in the new, enhanced drop element:
<r:drop v_title='[v_title] copy' id='[id]'>...</r:drop>
All attributes in “drop” are translated into field values set on the dropped element. These values can be relation ids, dynamic attributes, parent_id, comment pseudo attributes, anything. If you feel you would prefer to change the receiver simply say so with change='receiver'.
Gaspard Bucher
The past days have been hectic. I was really fed up with the small bugs related to ajax edit/update/remove/etc.
The beasts were:

This bug prevented from adding comments to multiple items on a single page. There were also problems with opening many ‘edit’ forms.

Because of this one, you could not produce a list of drop boxes by using ‘each’ (<r:tags do='each' do='drop' set='tagged'/>). This was a pity.

If an object appears inside many contexts (tag boxes for example), unlink was removing the wrong element (duplicate dom_id).
And as a bonus for clearing all this, we can now unlink by clicking on an image/div/text instead of the default delete (
).
Example involving most of the bug fixes above:
<ul do='images in site'><li do='each' draggable='true' do='img' mode='mini'/></ul>
<ul do='tags in site'>
<li do='each' do='drop' set='tagged'>
<ul do='tagged'>
<li do='each' do='unlink' do='img' mode='pv'/>
</ul>
</li>
</ul>
I am happy.
Gaspard Bucher
I worked hard to make comments work (again). Comments had been working fine until I implemented all the multi-site features. I also wanted to avoid spam so I was not going to rush into an implementation without any clue on how to make it work without a login.
First thing to say is that I didn’t implement nofollow because I agree with the critics of Michael Hampton. Nofollow is like saying “All the comments in this blog are spam. Avoid them.”. What we want to avoid is not hard work for google, it’s spam.
I chose the greate reCaptcha api and thanks to the guys at loonsoft, I could use their plugin to ease the implementation in zena.
If you want to avoid the captcha thing or replace it with something else, have a look at the “zena_captcha” plugin to see how it integrates with zena.
To test comments… post one on this entry !
And for the ones that like code, you can have a look at the code to display all the comments and let user add new comments in the comments.zafu template.
Gaspard Bucher
Added simple expression evaluation support as well as variable definition.
You can do this now:
<!-- set variable "hourly_rate" to dyn attribute 'hourly_rate'
or set it to the default "100.0" -->
<r:set var='hourly_rate'><r:show attr='[d_hourly_rate]'/> 100.0</r:set>
<r:data>
<r:set var='hours' do='stat' find='sum'/>
total price: <r:show var='hours'/> * <r:show var='hourly_rate' format='%.2f'/> = <b do='show' eval='hours * hourly_rate' format='%.2f $'/>
</r:data>
Have a look at set for details.
Gaspard Bucher
Just a note to say how proud I am that complex finders start to work:
assigned_courses from pages in project from assigned_jobsGaspard Bucher