Hi Scott,

What I've been working on is a task for MIT to use the new web services api from Creative Commons. It was my hope that I could approach it in such a way that it could also be contributed to the general dspace community.

A general description of the change to the user interface is that I'm building a license chooser where the user can select a license type from a select element. The selection of the type of license from that select element would trigger a form submission in order to build rest of the license selection user interface (based on the license type selected, e.g. creative commons, sampling....).

I have figured out how to modify the dri2xhtml structural.xsl so that the onchange attribute is matched without having to customize the xsl test based on the id. This picks up the onchange attribute I added to the Select component. If the onchange is not present, it is not output.

<!-- used by select element -->
    <xsl:template match="@onchange">
<xsl:attribute name="onchange"><xsl:value-of select="."/></ xsl:attribute>
    </xsl:template>

Basically my code sets the onchange attribute to "javascript:this.form.submit();", so it requires no customized javascript in the head of the page, although I could see the scenario where an instance may want to call a javascript this way. The javascript could be added to the templates .xsl to include any needed javascript (if, for example, if onchange="someFunctionCall(this);", then someFunctionCall(this) would need to be defined in the head of the page).


..\Wendy


On Dec 22, 2009, at 3:39 PM, Scott Phillips wrote:


I wouldn't recommend adding an onChange parameter into the DRI schema.
It's hard to see how any javascript from the aspect level could be
theme independent as it would expect to know the markup translated to.
Without knowing what you're trying to accomplish this might be a bit
off, but in most cases, i would recommend adding it into the XSL
transformations, if you need to add an onChange to every link or
something else it's easy, if you only want to add it to one particular
link, build a switch statement upon the id of the link.

Scott--


On Dec 21, 2009, at 1:51 PM, Wendy Bossons wrote:
How does one add a parameter to an html element in dspace?

I tried adding an onchange parameter to the Select.java and to
Params.java, as well as to the Structural.xsl templating rule(s), but
do not see the results of this effort in the user interface. I know
I'm missing something or perhaps I am not following the proper
conventions.
Here's a block of code from my Select.java:
public void setOnchange(String change) {
        this.params.setOnchange(change);
     }
Here's a block of code from my Params.java:
/** The name of the change attribute */
     public static final String A_CHANGE = "onchange";
...
    /** The field onchange */
     protected String onchange = "";
...
public void setOnchange(String change)
     {

- Ignored:
         this.onchange = change;
     }
...
  if (!this.onchange.equals(""))
         {
                attributes.put(A_CHANGE, this.onchange);
         }
...


And the structural.xsl:

<xsl:template match="@onchange">
         <xsl:attribute name="onchange"><xsl:value-of select="."/></
xsl:attribute>
</xsl:template>

...


The onchange attribute is not being applied, so I expect that it is
not in the generated xml.   Is this possible -- to add an attribute?
Any help is appreciated. (I would prefer not to hack it in the
structural.xsl . . . )
Wendy Bossons
Web Developer

Contact Information:
[email protected]
617-253-0770






------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast
and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel


Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to