GDFR - Global Digital Format Registry
Welcome About GDFR GDFR Network Documentation Wiki Download Links

Mash-Ups Explained

There are various types of mash-ups in the GDFR user interface. There are record-view mash-ups, inline-add mash-ups and cross-Collection searches.

Record UI Mash-Ups

The basis of the record UI mashups is a table with each td element having an id attribute set. There is a specific javascript file for each UI mash-up. Inside the javascript, for every relation shown on the page, and XSL is invoked against some XML record and the results are inserted into the respective division. There are two types of relationships. Forward relationships, where the reference is contained in the current record and points to another and backward relationships, where the reference in another record and points to the current record.

Forward References. The XML sent to the XSLT translation should be the content of the current record, which is obtained using the content webservice, /webservices/registry/content/COLLECTION/RECORD_ID. A special XSL needs to be created to parse the referenced recrord's identifier out and then retreive the adminData using the adminData service, /webservices/registry/adminData/COLLECTION/RECORD_ID. The result of this XSLT translation should go inside the respective division.

Backward References. The XML sent to the XSLT translation should be an SRU response, which is obtained by creating a query and sending it to the search URL, /webservices/registry/search/COLLECTION. There are examples of this throughout the existing UI javascript files. To parse the adminData out of the search response, you can use an already existing stylesheet, /registry/xsl/getBriefInfoFromSearch.xsl (that is the URL, not the location on disk). The result of this XSLT translation should go inside the respective division.

Note. If the collection has never been used in a mashUp before, you will need to move the XSL template found in ui.xsl and create a special stylesheet called nameView.xsl where name is the Collection name. This file needs to go in the /webapps/webservices/xsl/mashUps directory under Tomcat. Then simply import this stylesheet in the ui and make the template call as normal.

Inline Record Adds

This explains how to have records from a Collection added on another record's add/edit page. First, take the XSL template that is used to display the HTML form used for editing in a separate file called nameEdit.xsl, where name is the Collection name. This file needs to go in the /webapps/webservices/xsl/mashUps directory under Tomcat. In addition to this XSL template, some other things need to be in that XSL file. The actual HTML form element needs to be created and it must have a specific id attribute. See FormatsEdit.xsl for an example. You also need to update the edit.xsl stylesheet for the Collection. See Formats/edit.xsl for an example.

Next the edit.xsl for the other collection needs to be updated. This is hard to explain, so look in gdfrbase/edit.xsl, in the template called gdfrBaseEdit and find where the Verified By section is.

Cross-Collection Searches

Cross-Collection searches need to be implemented in a file called displayCollection.xsl. This file must go under /webapps/webservices/xsl/Collections/COLLECTION_NAME under Tomcat.

Adding to an Existing Search. Open displayCollection.xsl for editing. Near the bottom you will see a div inside a template called listCollections. Each cross-collection search is created by making a call to the XSL template called createCollectionLink. The two parameters are collectionName, which is the name of the Collection to search against and alias, which is what is actually displayed on the page. Next, open the javascript file that's used to control that search page. The convention is nameSearch.js, where name is the Collection Name (in lowercase).

Depending on how the Collections are related, the code might be different. Basically the idea is that you search against the selected collection with the provided query, and then, depending on the relationship, find the current Collection's records that are related to the search results using an XSL stylesheet. Then use this set of identifiers and mash them all together in a dc.identifier exact search separated by ors.