(Jump to other KnowledgeBases)
DSpace Resources
DSpace Website
DSpace Documentation
DSpace Wiki
DSpace Demo Site
Contribute to KnowledgBase
In this manual we'll setup and enable jQuery javascript libraries instead of default scriptaculous ones, they both have great effects and functionalities so we can choose the one that best fits our interest, or knowledge.
Using simple on/off switches defined in <dspace:layout> element we'll allow DSpace .jsp pages to load or not this script files. Example:
<dspace:layout titlekey="jsp.search.results.title" navbar="off" locbar="off" scriptaculous="off" jquery="on">
<dspace:layout titlekey="jsp.search.results.title" navbar="off" locbar="off" scriptaculous="on" jquery="off">
<dspace:layout titlekey="jsp.search.results.title" navbar="off" locbar="off" scriptaculous="off" jquery="off">
DSpace JSPUI interface bundles scriptaculous javascript libraries in every page head section. We can check that looking at source code of DSpace home page, we'll see this few lines:
<script type="text/javascript" src="/jspui/static/js/scriptaculous/prototype.js"> </script> <script type="text/javascript" src="/jspui/static/js/scriptaculous/effects.js"> </script> <script type="text/javascript" src="/jspui/static/js/scriptaculous/builder.js"> </script> <script type="text/javascript" src="/jspui/static/js/scriptaculous/controls.js"> </script>
Doing a litle browsing we can check that this libraries (prototype) are used in a library function:
[dspace-source]/dspace-jspui/dspace-jspui-webapp/src/main/webapp/static/js/choice-support.js
This function is called on the following java server pages:
[dspace-source]/dspace-jspui/dspace-jspui-webapp/src/main/webapp/submit/edit-metadata.jsp
[dspace-source]/dspace-jspui/dspace-jspui-webapp/src/main/webapp//tools/edit-item-form.jsp
By now we know which pages use scriptaculous. We'll keep them in mind to later come back and modify them.
DSpace already uses a copy of jQuery, but in a local form. The library function that uses it is:
[dspace-source]/dspace-jspui/dspace-jspui-webapp/src/main/webapp/dspace-admin/js/bitstream-ordering.js
This function is called on the following java server page:
[dspace-source]/dspace-jspui/dspace-jspui-webapp/src/main/webapp/tools/edit-item-form.jsp
And jQuery library file can be located on:
[dspace-source]/dspace-jspui/dspace-jspui-webapp/src/main/webapp/dspace-admin/js/jquery-1.4.2.min.js
Now that every script file and script file caller is located we'll start to code.
First we'll start modifying