21 March, 2016

Licence ("License") Substitution Variables in DSpace

I had a lot of trouble finding these values, so thought I'd post them here for easy access:
  • %1$s == submitter first name
  • %2$s == submitter last name
  • %3$s == submitter email
  • %4$s == current date
  • %5$s == collection info
  • %6$s == item info
  • %7$s == eperson info
These are the variables that you can use to customise (or customize) the DSpace licence (or license). It took me a while to figure out the right search terms. I'd tried things like:
  • DSpace license fields
  • DSpace licence fields
  • DSpace license variables
  • DSpace licence variables
"Substitution" was the keyword that got me there in the end, though it wasn't in any DSpace documentation that I could find. Hope this is helpful for someone. G

26 June, 2012

Removing Rogue Metadata from Workflows in DSpace

One of our DSpace Coordinators set up an item template, and mistakenly added text data to the date.issued field - at least, I'm giving him the benefit of the doubt ;)
The upshot of this was, when he got to "Accept Task" in the workflow, he was presented with a blank page and couldn't approve the submissions. So he called me. A few times. He COULD work out the workflow ID from the Task Pool page - and that was enough to be able to delete the rogue fields. I strongly suggested that he update the Item Template.
Here is the SQL I used - perhaps not the most elegant, but did the trick:

First, get metadata_field_id from given %ELEMENT% and %QUALIFIER%:

select metadata_field_id from metadatafieldregistry where element = '%ELEMENT%' and qualifier = '%QUALIFIER%' 

Then, given the %WORKFLOW_ID%, delete the relevant metadata field from the metadatavalue table:

delete from metadatavalue where metadata_field_id = %METADATA_FIELD_ID% and item_id = (select item_id from workflowitem where workflow_id = %WORKFLOW_ID%)

27 June, 2011

Changing the Browse Display Table in DSpace

You can find instructions for this in the DSpace documentation and Wiki - but I thought I'd document the process from start to finish, so you can see all the steps in one place. Right. The example I'll give is to add a new column ("Citation") to the browse results table. Note these instructions apply to the JSPUI only.
These changes can be made through the DSpace configuration files, without changing the DSpace source code.

1. Edit [dspace-source]/dspace/config/dspace.cfg
Add:
webui.browse.index.n = citation : metadata : dc.identifier.citation : text
where:
n is the index number (note index numbers must be consecutive and incremented by one)
I have used spaces between sections in the index value to clearly show the syntax with colons.
Add:
webui.itemlist.columns = dc.date.issued(date), dc.title, dc.contributor.*, dc.identifier.citation
You can add any of your browse indexes here, in any order. Note that I don't have a "thumbnail" column as the first column, so I had to set:
webui.browse.thumbnail.show = false
But you may wish to have a thumbnail ("Preview") column, in which case you would set this to true and set "thumbnail" as the first value in webui.itemlist.columns.


2. Edit [dspace-source]/dspace/modules/jspui/src/main/resources/Messages.properties
Add:
browse.type.metadata.citation = Citation
and:
itemlist.dc.identifer.citation = Citation
and:
browse.menu.citation = Citation

Of course, change the relevant values to suit your metadata field and display order preferences.

NOTE: Creating this index also automatically adds a browse button to collection and community pages. If you DO NOT WANT this, you can add code to collection-home.jsp and community-home.jsp files to remove this button.

3. Rebuild and Redeploy DSpace
As the 'dspace' user:
cd [dspace-source]/dspace
mvn clean package
cd target/dspace-x.x.x-build.dir (where x.x.x is your version number)
ant update (ant init_configs will NOT copy Messages.properties across, hence the use of update)

4. Re-index
For the changes to take effect, your data needs to be re-indexed:
[dspace-install-dir]/bin/index-init
This may take some time to run. Note, you may need to also restart Tomcat.

11 November, 2010

XTF Bookbag Emailing Error

When attempting to email a bookbag with XTF, I was getting the following error:
javax.mail.NoSuchProviderException: No provider for smtp
At first I thought perhaps there was some problem with our mail setup - sendmail worked fine AND I could ping the smtp server, so that wasn't the issue. I had read somewhere after a lot of searching about clashes between different mail.jars. In particular, I found the symlink to javamail.jar in $TOMCAT_HOME/common/lib. I simply removed this link and then emailing from XTF worked perfectly.
UPDATE: Al Cornish helpfully added that Tomcat 5 also needed to be restarted for the change to take effect.

29 October, 2010

Finding the DSpace Collection ID

Occasionally I'll need to grab the collection_id (database id for a collection) for some scripting or so forth from DSpace. It's not blatantly obvious how to do that when you only have the collection handle. There are two ways of which I know, and I shall share here.
Using the GUI
Login as administrator => navigate to the collection => use one of the Admin Tools such as Edit Authorizations or Delete (but don't ACTUALLY delete the collection, obviously!) and the database ID for the collection is displayed in the page heading.
Programmatically
If you need to grab the ID in a program, then you can use SQL like:




where COLLECTION_HANDLE is something like 2123/1234 (ie: handle prefix + identifier), because, you see, resource_id in the handle table is actually synonymous with the collection_id in the collection table (and probably community_id and item_id in their respective tables).

22 October, 2010

draggable() is not a function, jQuery is not defined

Sheesh! As a jQuery noob, I'd been battling with this seemingly simple problem: I was getting these two errors in Firebug, though had only paid attention to the first for some time (draggable not a function). I spent ages stuffing around with my code and eventually realised that jQuery, too, was not defined. There are no end of ideas out there about everything from DOCTYPES to incorrect script paths. This wasn't the case.
After sifting through a lot of twaddle, I finally found the (as suspected, very simple) answer on this forum. Simply, the order in which you load your scripts is important ie: jquery-ui depends on jquery, so load jquery first! Thanks to rwhitbeck .

18 October, 2010

Alter MySQL Field to Become Auto-Incremented Primary Key

It's a small thing, but sometimes you've already created the table and if you're anywhere remotely as forgetful as me then ... AH! Forgot to set the primary key! We can use the ALTER TABLE command thusly to achieve this: