Picon

reread grouped collection

Hi,

I have a collection of hop-objects, grouped by a property.
The collection is presented to the user with the possibility to  
change this "group property". If If I change this property of an  
object, the property is updated to the db immediately, but the  
collection isn't reread within this request. So the immediate  
response (for-loop trough collection groupnames) shows stale data.  
How can I avoid this?

Thanks,
Walter
Hannes Wallnoefer | 1 Oct 19:42
Picon
Gravatar

Re: reread grouped collection

Hi Walter,

2005/10/1, VividVisions, Walter Krivanek <walter.krivanek <at> vividvisions.at>:
> Hi,
>
> I have a collection of hop-objects, grouped by a property.
> The collection is presented to the user with the possibility to
> change this "group property". If If I change this property of an
> object, the property is updated to the db immediately, but the
> collection isn't reread within this request. So the immediate
> response (for-loop trough collection groupnames) shows stale data.
> How can I avoid this?

You should be able to avoid this by calling res.commit() after
changing the group property. This commits changes to db and
invalidates changed objects in the cache.

hannes
Johannes Lerch | 3 Oct 22:12
Picon

Add + remove macros at runtime

Hi all, 
i have a request:

is there a function (planned) to add/remove macros at runtime without
using javascripts regexp capabilties ?

an array like DOMs document.links would be really cool where i can
push/pop before i render, and query after name and parameters 
(sth like:
	....
	var story = this.createSkin ( this.getSomethingFromSomeWhere() );
	var macros = story.getMacros ( "image") // gets all <% this.image ... %>
macros
	for(var i = 0; i < macros.length; i ++) {
		if(macros[i].param.name == req.data.fileToDelete)
			story.removeMacro(i);
	}
	....
	this.renderSkin(story);
)

would be really nice to have access to macros (and maybe other stuff in
skins?) as HopObjects, what do you think.

in particular i came accross this idea at following problem: 
 i currently develop a system where users can write stories and attach
files to them, now it would be really nice to automatically add according
macros for files to the story body, which is no problem at all. but it
starts to get painful when removing this macros (when the user removes the
file from the story) because you have to scan the text with regexp and
(Continue reading)

Picon
Favicon
Gravatar

tutorial. case consistency

First of all, i have to mention that the addressbook-tutorial is very 
useful.
However, it seems to be very inconsistent according to the CASE of 
several terms (e.g. person, Person, PERSON).

Up to "Handling User Input" everything was working fine. But when i 
created the HopObject (tutorial "Creating a HopObject"),
the list- and edit-screen didn´t work anymore (the create-screen was 
ok).
When i change "firstname" to "FIRSTNAME" in link.skin, the first name 
shows up in the list. I also have to change "firstname" to "FIRSTNAME" 
in edit.skin - the result is, that /create won´t work anymore 
([property "FIRSTNAME" is not defined for Root).

any ideas? 
Picon

Automatic property/value mapping

Hi,

I wanted to add automatic property/value mapping (like in JSF or  
Tapestry) to one of my Helma apps and came up with very basic macros/ 
functions.

The textfield macro renders an HTML input field with the current  
value of the specified object property (obtained through the eval  
function). It also saves the information which object property has  
been mapped to that textfield in the session cache.

The onRequest function searches for mapped values and assigns them to  
the respective object property.

Regarding performance and the eval function, the Rhino documentation  
says: "Beginning with Rhino 1.4 Release 2, code passed to eval and  
new Function will be interpreted rather than compiled to class files."

Like I said, this is *very* basic but I wanted to share it with the  
list.
Here's the code:

--- Global ---
function textfield_macro (params)  {
     // Obtain current value
     var value = eval(params.value);
     var mappings = getValueMappings();
     // Map the property
     mappings.push(params.value);
     // Write textfield
(Continue reading)

Johannes Lerch | 18 Oct 12:11
Picon

problem with additional tables / filter in collection definition

servus,

i experienced following problem:
i currently write a little system where you have three main groups of
objects: users, tags and messages. these are joined together over two n:m
relationships via connection tables/objects.

somewhat like: Users <-> Tags2Users <-> Tags <-> Tags2Messages <-> Messages

now i wont do define a collection of all messages belonging to a user and
tagged under a certain tag,
therefore i define following collection in Tags2Users:

userMessages = Collection ( Message )
userMessages.filter.additionalTables = msg_tags
userMessages.filter = msg_usr = ${usr_id} AND ${tag_id} = msg_tags.msg_tag
AND msg_tags.msg_id = msg_id
userMessages.order = msg_timestamp DESC

while user_id and tag_id are columns in the tags2users tabled as described
here:
http://helma.org/docs/guide/mapping/collections/

now my problem is, instead of substituting the actual values my sql syntax
looks like:
... WHERE msg_usr = NodeHandle[User[1]] AND NodeHandle[Tag[1]] =
msg_tags.msg_tag AND msg_tags.msg_id = msg_id

which of course throws an sql exception... the actual values/ids in the
breaks are correct but for some strange reason helma puts out this whole
(Continue reading)

Picon
Favicon
Gravatar

jdom

has anyone succesfully installed JDOM with helma on OS X?

on the helma-site it says "put a current release of jdom from 
http://jdom.org/ into the lib/ext/ folder ...".
building JDOM worked fine. but what files do i have to copy to lib/ext/ 
exactly?

patrickk.
_______________________________________________
Helma-user mailing list
Helma-user <at> helma.org
http://helma.org/mailman/listinfo/helma-user
Hannes Wallnoefer | 18 Oct 15:38
Picon
Gravatar

Re: problem with additional tables / filter in collection definition

2005/10/18, Johannes Lerch <Johannes.Lerch <at> reflex.at>:
> servus,

Servus and thanks for the report, the bug should be fixed in CVS.

hannes

> i experienced following problem:
> i currently write a little system where you have three main groups of
> objects: users, tags and messages. these are joined together over two n:m
> relationships via connection tables/objects.
>
> somewhat like: Users <-> Tags2Users <-> Tags <-> Tags2Messages <-> Messages
>
> now i wont do define a collection of all messages belonging to a user and
> tagged under a certain tag,
> therefore i define following collection in Tags2Users:
>
> userMessages = Collection ( Message )
> userMessages.filter.additionalTables = msg_tags
> userMessages.filter = msg_usr = ${usr_id} AND ${tag_id} = msg_tags.msg_tag
> AND msg_tags.msg_id = msg_id
> userMessages.order = msg_timestamp DESC
>
> while user_id and tag_id are columns in the tags2users tabled as described
> here:
> http://helma.org/docs/guide/mapping/collections/
>
> now my problem is, instead of substituting the actual values my sql syntax
> looks like:
(Continue reading)

Hannes Wallnoefer | 18 Oct 15:48
Picon
Gravatar

Re: jdom

Hi Patrick,

2005/10/18, patrick kranzlmüller <patrick <at> vonautomatisch.at>:
> has anyone succesfully installed JDOM with helma on OS X?
>
> on the helma-site it says "put a current release of jdom from
> http://jdom.org/ into the lib/ext/ folder ...".
> building JDOM worked fine. but what files do i have to copy to lib/ext/
> exactly?

The .jar (java archive) files. Generally speaking, all jar files you
place into the lib/ext directory are available for scripting from
Helma as described here:

http://www.mozilla.org/rhino/scriptjava.html

hannes

> patrickk.
>
>
> _______________________________________________
> Helma-user mailing list
> Helma-user <at> helma.org
> http://helma.org/mailman/listinfo/helma-user
>
>
>
patrick k | 18 Oct 20:47
Picon
Favicon
Gravatar

Re: jdom

thanks, seems to work.

however, i don´t understand the link you sent me. there´s no information
about how to use jar-files with javascript (at least in my view).
could you please clarify that?

patrick

> Hi Patrick,
> 
> 2005/10/18, patrick kranzlmüller <patrick <at> vonautomatisch.at>:
>> has anyone succesfully installed JDOM with helma on OS X?
>> 
>> on the helma-site it says "put a current release of jdom from
>> http://jdom.org/ into the lib/ext/ folder ...".
>> building JDOM worked fine. but what files do i have to copy to lib/ext/
>> exactly?
> 
> The .jar (java archive) files. Generally speaking, all jar files you
> place into the lib/ext directory are available for scripting from
> Helma as described here:
> 
> http://www.mozilla.org/rhino/scriptjava.html
> 
> hannes
> 
>> patrickk.
>> 
>> 
>> _______________________________________________
(Continue reading)


Gmane