Maybe DSpace-devel is a better place for this kinds of question // discussion.

regards,

Bram

---------- Forwarded message ----------
From: Art Lowel <art@mire.be>
Date: Wed, Jun 18, 2008 at 4:08 PM
Subject: [Dspace-tech] Functional javascript in Manakin
To: dspace-tech@lists.sourceforge.net


I've been recreating some of our custom jsp addons for 1.4 dspaces as aspects in Manakin, and I have some questions concerning javascript. I was unable to find documentation addressing following issues and so far, I have only found examples of dspace installations using javascript as part of a theme.

That's fine for javascript that does something mainly visual e.g. a sliding animation to show/hide the contents of a div, or a script emphasising a menu item when the mouse hovers over it. It's a good thing that these scripts are part of the theme layer because that way they can differ from theme to theme.

However, there are ways of using javascript where can it be considered to be functional rather than visual and thus preferably not part of a theme. Consider the problem of alerting a user of unsaved changes on a settings page. This requires an onblur action for every setting (form field) to trigger a javascript function that verifies whether that setting has changed. If the setting has changed a warning should be shown at the top of the page.

I believe the manner in which that the warning will be shown, and the way it looks should be part of the theme. But the onblur actions, and the verify function should be part of the aspect, as they don't do anything visual whatsoever.

Right now the only way I have found to add a js action to a component is to write a .js file that looks for a component with the proper id when a page loads and adds the action in js. And subsequently adding that file as a parameter to every "IncludePageMeta"-transformer in every theme's sitemap.

I guess another way could be to write a XSL file and use XPath to look for the right component and add the action and then add that XSL-Transformer in every theme's sitemap somewhere after dri2xhtml.xsl.

The problem with both these solutions is that they have to be done at the theme level, and therefore the functionality of the aspect doesn't fit in one neat package, which was the beauty of manakin in the first place.

Would it be possible to have an addAction("onblur/onclick/onfocus/...", "someJsFunction();") method in java for DRI components, or maybe even an addAttribute("anyAttribute", "anyValue") method, or are there fundamental objections to this concept?

Or maybe there already is a way of including javascript in an aspect, and I just haven't found it, in which case I would be obliged to anyone pointing me in the right direction.

Best regards,
Art Lowel

(I apologize if this message got on the mailing list twice, I sent it using an email adress that was not subscribed to this list the first time)


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech




--
@mire NV
Romeinse Straat 18
3001 Heverlee
Belgium
+32 2 888 29 56

http://www.atmire.com - Institutional Repository Solutions
http://www.togather.eu - Before getting together, get Tog@ther