jonathangreen
13 years ago
37 changed files with 2633 additions and 1215 deletions
@ -0,0 +1,272 @@
|
||||
<?php |
||||
|
||||
/** |
||||
* @file ObjectDetails.inc |
||||
* The functions required to define and respond to all the default object |
||||
* details display modes. |
||||
*/ |
||||
|
||||
/** |
||||
* Islandora core object details display modes. These are the default display |
||||
* modes that are always available. |
||||
* @return A list of display modes that can be used to render the object details |
||||
* page. |
||||
*/ |
||||
function fedora_repository_islandora_object_details_display() { |
||||
$profiles = array( |
||||
'hidden' => array( |
||||
"name" => "Hidden", |
||||
"module" => "fedora_repository", |
||||
"file" => "ObjectDetails.inc", |
||||
"function" => "fedora_repository_object_details_hidden", |
||||
"description" => t("No object details page"), |
||||
), |
||||
'xslt' => array( |
||||
"name" => "XSLT", |
||||
"module" => "fedora_repository", |
||||
"file" => "ObjectDetails.inc", |
||||
"function" => "fedora_repository_object_details_xslt", |
||||
"description" => t("Show a datastream with an XSLT"), |
||||
"config" => "admin/settings/fedora_repository/object_details_xslt", |
||||
), |
||||
'table' => array( |
||||
"name" => "Table", |
||||
"module" => "fedora_repository", |
||||
"file" => "ObjectDetails.inc", |
||||
"function" => "fedora_repository_object_details_table", |
||||
"description" => t("Show a datastream with a table"), |
||||
"config" => "admin/settings/fedora_repository/object_details_table", |
||||
) |
||||
); |
||||
return $profiles; |
||||
} |
||||
|
||||
/** |
||||
* The renderer for the "hidden" display mode. In this mode, no data is |
||||
* displayed. This is supplied so you can disable the object details metadata |
||||
* display without disabling the tab entirely. |
||||
* @param item The item with the metadata to display. |
||||
* @return The fully composed object details metadata display. |
||||
*/ |
||||
function fedora_repository_object_details_hidden($item) { |
||||
// do nothing |
||||
return ""; |
||||
} |
||||
|
||||
/** |
||||
* The renderer for the "xslt" display mode. In this mode, an xslt is applied |
||||
* to the selected datastream to produce a user defined look and feel to the |
||||
* output data. |
||||
* @param item The item with the metadata to display. |
||||
* @return The fully composed object details metadata display. |
||||
*/ |
||||
function fedora_repository_object_details_XSLT($item) { |
||||
global $base_url; |
||||
$path = drupal_get_path('module', 'fedora_repository'); |
||||
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); |
||||
|
||||
$dsid = variable_get('islandora_object_details_xslt_datastream', 'DC'); |
||||
// special case for DC+QDC for backward compatibility |
||||
if ($dsid == 'DC' || $dsid == 'QDC') { |
||||
$dsid = array_key_exists('QDC', $item->get_datastreams_list_as_array()) ? 'QDC' : 'DC'; |
||||
} |
||||
$xmlstr = $item->get_datastream_dissemination($dsid); |
||||
|
||||
if (empty($xmlstr)) { |
||||
return t('Error - could not find datastream @dsid on object @pid<br/>Please contact the site administrator.', |
||||
array('@dsid' => $dsid, '@pid' => $item->pid)); |
||||
} |
||||
|
||||
try { |
||||
$proc = new XsltProcessor(); |
||||
} catch (Exception $e) { |
||||
watchdog('fedora_repository', "Error while creating XSLT processor: @e", array('@e' => $e->getMessage()), WATCHDOG_ERROR); |
||||
return; |
||||
} |
||||
|
||||
$proc->setParameter('', 'baseUrl', $base_url); |
||||
$proc->setParameter('', 'path', $path); |
||||
$input = NULL; |
||||
|
||||
$xsl_file = variable_get('islandora_object_details_xslt_sheet', 'sites/all/modules/islandora/object_details_xslts/convertQDC.xsl'); |
||||
// set an error message in case xslt parsing fails |
||||
$output = t("Failed to parse xslt file at @xsltFile", array('@xsltFile' => $xsl_file)); |
||||
if (is_readable($xsl_file)) { |
||||
$xsl = new DomDocument(); |
||||
$input = new DomDocument(); |
||||
try { |
||||
$xsl->load($xsl_file); |
||||
|
||||
$input->loadXML(trim($xmlstr)); |
||||
} catch (Exception $e) { |
||||
watchdog('fedora_repository', "Problem loading XSL file: @e", array('@e' => $e->getMessage()), NULL, WATCHDOG_ERROR); |
||||
} |
||||
$xsl = $proc->importStylesheet($xsl); |
||||
$newdom = $proc->transformToDoc($input); |
||||
$output = $newdom->saveHTML(); |
||||
} |
||||
return $output; |
||||
} |
||||
|
||||
/** |
||||
* The renderer for the "table" display mode. In this mode, the requested |
||||
* datastream is rendered using a simple table with keys(tags) on the left and |
||||
* values on the right. |
||||
* @param item The item with the metadata to display. |
||||
* @return The fully composed object details metadata display. |
||||
*/ |
||||
function fedora_repository_object_details_table($item) { |
||||
global $base_url; |
||||
$path = drupal_get_path('module', 'fedora_repository'); |
||||
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); |
||||
|
||||
$dsid = variable_get('islandora_object_details_table_datastream', 'DC'); |
||||
// special case for DC+QDC for backward compatibility |
||||
if ($dsid == 'DC' || $dsid == 'QDC') { |
||||
$dsid = array_key_exists('QDC', $item->get_datastreams_list_as_array()) ? 'QDC' : 'DC'; |
||||
} |
||||
$xmlstr = $item->get_datastream_dissemination($dsid); |
||||
|
||||
if (empty($xmlstr)) { |
||||
return t('Error - could not find datastream @dsid on object @pid<br/>Please contact the site administrator.', |
||||
array('@dsid' => $dsid, '@pid' => $item->pid)); |
||||
} |
||||
|
||||
$simplexml = new SimpleXMLElement($xmlstr); |
||||
|
||||
$headers = array( |
||||
array( |
||||
'data' => t('Metadata'), |
||||
'colspan' => 2, |
||||
), |
||||
); |
||||
$rows = array(); |
||||
foreach ($simplexml->getNamespaces(TRUE) as $ns) { |
||||
foreach ($simplexml->children($ns) as $child) { |
||||
$rows[] = array( |
||||
array( |
||||
'data' => $child->getName(), |
||||
'class' => 'dc-tag-name', |
||||
), |
||||
array( |
||||
'data' => (string)$child, |
||||
'class' => 'dc-content', |
||||
), |
||||
); |
||||
} |
||||
} |
||||
|
||||
return theme('table', $headers, $rows, array('class' => 'dc-table')); |
||||
} |
||||
|
||||
/** |
||||
* Configuration page for the xslt display mode. |
||||
* |
||||
* This mode requires two parameters: the datastream to render, and the xslt to |
||||
* apply to it. |
||||
* |
||||
* @return |
||||
* The configuration page. |
||||
*/ |
||||
function fedora_repository_object_details_XSLT_config() { |
||||
$form = array(); |
||||
$form['config'] = array( |
||||
'#type' => 'fieldset', |
||||
'#title' => t("XSLT display options"), |
||||
); |
||||
|
||||
$options = module_invoke_all("object_details_get_available_xslts"); |
||||
|
||||
$form['config']['xslt'] = array( |
||||
'#type' => 'select', |
||||
'#title' => t("XSL transform to use"), |
||||
'#default_value' => variable_get('islandora_object_details_xslt_sheet', 'sites/all/modules/islandora/object_details_xslts/convertQDC.xsl'), |
||||
'#options' => $options, |
||||
'#key_type' => 'associative', |
||||
'#required' => TRUE, |
||||
); |
||||
$form['config']['dsid'] = array( |
||||
'#type' => 'textfield', |
||||
'#title' => t("Datastream to transform"), |
||||
'#default_value' => variable_get('islandora_object_details_xslt_datastream', 'DC'), |
||||
'#required' => TRUE, |
||||
); |
||||
$form['submit'] = array( |
||||
'#type' => 'submit', |
||||
'#value' => t("Submit"), |
||||
'#weight' => 1, |
||||
); |
||||
|
||||
return $form; |
||||
} |
||||
/** |
||||
* Custom submit handler for the xslt configuration page. |
||||
* |
||||
* @param $form |
||||
* @param &$form_state |
||||
* The user supplied values for the form. |
||||
*/ |
||||
function fedora_repository_object_details_XSLT_config_submit($form, &$form_state) { |
||||
variable_set('islandora_object_details_xslt_sheet', $form_state['values']['xslt']); |
||||
variable_set('islandora_object_details_xslt_datastream', $form_state['values']['dsid']); |
||||
} |
||||
|
||||
/** |
||||
* Base function to supply the available xslt files. |
||||
* |
||||
* Modules implementing this hook need to return an array describing where the |
||||
* XSLT is. The array key is the path to the XSLT (paths start with sites/) and |
||||
* the value in the array is the display name. In the simplest form you can use |
||||
* file_scan_directory like we do here - this puts the filename as the display |
||||
* name and will automatically detect new files as they are added. |
||||
*/ |
||||
function fedora_repository_object_details_get_available_xslts() { |
||||
$folder = drupal_get_path("module", "fedora_repository") ."/object_details_xslts/"; |
||||
// retrieve the filenames from the system |
||||
$xslts = file_scan_directory($folder, ".xsl"); |
||||
$options = array(); |
||||
foreach ($xslts as $xsl) { |
||||
$options[$xsl->filename] = $xsl->basename; |
||||
} |
||||
return $options; |
||||
} |
||||
|
||||
/** |
||||
* Configuration page for the table display mode. This mode requires only one |
||||
* parameter: the datastream to render. |
||||
* |
||||
* @return |
||||
* The configuration page. |
||||
*/ |
||||
function fedora_repository_object_details_table_config() { |
||||
$form = array(); |
||||
$form['config'] = array( |
||||
'#type' => 'fieldset', |
||||
'#title' => t("Table display options"), |
||||
); |
||||
|
||||
$form['config']['dsid'] = array( |
||||
'#type' => 'textfield', |
||||
'#title' => t("Datastream to transform"), |
||||
'#default_value' => variable_get('islandora_object_details_table_datastream', 'DC'), |
||||
'#required' => TRUE, |
||||
); |
||||
$form['submit'] = array( |
||||
'#type' => 'submit', |
||||
'#value' => t("Submit"), |
||||
'#weight' => 1, |
||||
); |
||||
|
||||
return $form; |
||||
} |
||||
|
||||
/** |
||||
* Custom submit handler for the table configuration page. |
||||
* |
||||
* @param $form |
||||
* @param &$form_state |
||||
* The user supplied values for the form. |
||||
*/ |
||||
function fedora_repository_object_details_table_config_submit($form, &$form_state) { |
||||
variable_set('islandora_object_details_table_datastream', $form_state['values']['dsid']); |
||||
} |
@ -0,0 +1,232 @@
|
||||
<xsl:stylesheet xmlns:mods="http://www.loc.gov/mods/v3" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="mods" version="1.0"> |
||||
<xsl:output indent="yes" method="html"/> |
||||
<xsl:variable name="dictionary" select="document('http://www.loc.gov/standards/mods/modsDictionary.xml')/dictionary"/> |
||||
|
||||
<xsl:template match="/"> |
||||
<html> |
||||
<head> |
||||
<style type="text/css"> |
||||
.modsLabelTop { |
||||
} |
||||
|
||||
.modsLabelLevel2 { |
||||
padding-left: 10px; |
||||
} |
||||
|
||||
.modsLabelLevel3 { |
||||
padding-left: 20px; |
||||
} |
||||
|
||||
.modsLabelLevel4 { |
||||
padding-left: 30px; |
||||
} |
||||
|
||||
.modsValueTop { |
||||
} |
||||
|
||||
.modsValueLevel2 { |
||||
} |
||||
|
||||
.modsValueLevel3 { |
||||
} |
||||
|
||||
</style> |
||||
</head> |
||||
<body> |
||||
<xsl:choose> |
||||
<xsl:when test="mods:modsCollection"> |
||||
<xsl:apply-templates select="mods:modsCollection"/> |
||||
</xsl:when> |
||||
<xsl:when test="mods:mods"> |
||||
<xsl:apply-templates select="mods:mods"/> |
||||
</xsl:when> |
||||
</xsl:choose> |
||||
</body> |
||||
</html> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="mods:modsCollection"> |
||||
<xsl:apply-templates select="mods:mods"/> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="mods:mods"> |
||||
<table class="modsContainer"> |
||||
<xsl:apply-templates/> |
||||
</table> |
||||
<!--hr/--> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="*"> |
||||
<xsl:choose> |
||||
<xsl:when test="child::*"> |
||||
<tr><td colspan="2"> |
||||
<span class="modsLabelTop"> |
||||
<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="local-name()"/>: |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
<xsl:call-template name="attr"/> |
||||
</span> |
||||
</td></tr> |
||||
<xsl:apply-templates mode="level2"/> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<tr><td> |
||||
<span class="modsLabelTop"> |
||||
<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="local-name()"/> |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
<xsl:call-template name="attr"/> |
||||
</span> |
||||
</td><td> |
||||
<span class="modsValueTop"> |
||||
<xsl:call-template name="formatValue"/> |
||||
</span> |
||||
</td></tr> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</xsl:template> |
||||
|
||||
<xsl:template name="formatValue"> |
||||
<xsl:choose> |
||||
<xsl:when test="@type='uri'"> |
||||
<a href="{text()}" class="modsLink"> |
||||
<xsl:value-of select="text()"/> |
||||
</a> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:value-of select="text()"/> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="*" mode="level2"> |
||||
<xsl:choose> |
||||
<xsl:when test="child::*"> |
||||
<tr><td colspan="2"> |
||||
<span class="modsLabelLevel2"> |
||||
<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="local-name()"/> |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
<xsl:call-template name="attr"/> |
||||
</span> |
||||
</td></tr> |
||||
<xsl:apply-templates mode="level3"/> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<tr><td> |
||||
<span class="modsLabelLevel2"> |
||||
<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="local-name()"/> |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
<xsl:call-template name="attr"/> |
||||
</span> |
||||
</td><td> |
||||
<span class="modsValueLevel2"> |
||||
<xsl:call-template name="formatValue"/> |
||||
</span> |
||||
</td></tr> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="*" mode="level3"> |
||||
<xsl:choose> |
||||
<xsl:when test="child::*"> |
||||
<tr><td colspan="2"> |
||||
<span class="modsLabelLevel3"> |
||||
<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="local-name()"/> |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
<xsl:call-template name="attr"/> |
||||
</span> |
||||
</td></tr> |
||||
<xsl:apply-templates mode="level4"/> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<tr><td> |
||||
<span class="modsLabelLevel3"> |
||||
<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="local-name()"/> |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
<xsl:call-template name="attr"/> |
||||
</span> |
||||
</td><td> |
||||
<span class="modsValueLevel3"> |
||||
<xsl:call-template name="formatValue"/> |
||||
</span> |
||||
</td></tr> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="*" mode="level4"> |
||||
<tr><td> |
||||
<span class="modsLabelLevel4"> |
||||
<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="local-name()"/> |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
<xsl:call-template name="attr"/> |
||||
</span> |
||||
</td><td> |
||||
<span class="modsValueLevel4"> |
||||
<xsl:value-of select="text()"/> |
||||
</span> |
||||
</td></tr> |
||||
</xsl:template> |
||||
|
||||
<xsl:template name="longName"> |
||||
<xsl:param name="name"/> |
||||
<xsl:choose> |
||||
<xsl:when test="$dictionary/entry[@key=$name]"> |
||||
<xsl:value-of select="$dictionary/entry[@key=$name]"/> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:value-of select="$name"/> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</xsl:template> |
||||
|
||||
<xsl:template name="attr"> |
||||
<xsl:for-each select="@type|@point">: |
||||
<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="."/> |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
</xsl:for-each> |
||||
<xsl:if test="@authority or @edition"> |
||||
<xsl:for-each select="@authority">(<xsl:call-template name="longName"> |
||||
<xsl:with-param name="name"> |
||||
<xsl:value-of select="."/> |
||||
</xsl:with-param> |
||||
</xsl:call-template> |
||||
</xsl:for-each> |
||||
<xsl:if test="@edition"> |
||||
Edition <xsl:value-of select="@edition"/> |
||||
</xsl:if>) |
||||
</xsl:if> |
||||
<xsl:variable name="attrStr"> |
||||
<xsl:for-each select="@*[local-name()!='edition' and local-name()!='type' and local-name()!='authority' and local-name()!='point']"> |
||||
<xsl:value-of select="local-name()"/>="<xsl:value-of select="."/>", |
||||
</xsl:for-each> |
||||
</xsl:variable> |
||||
<xsl:variable name="nattrStr" select="normalize-space($attrStr)"/> |
||||
<xsl:if test="string-length($nattrStr)"> |
||||
(<xsl:value-of select="substring($nattrStr,1,string-length($nattrStr)-1)"/>) |
||||
</xsl:if> |
||||
</xsl:template> |
||||
</xsl:stylesheet> |
@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<!-- This was how the metadata in the 'Fedora Object Details' tab was rendered. Can be renamed back to 'convertQDC.xsl' (without '.deprecated') to make it be used again. --> |
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
||||
<!-- Old parameter names "$baseUrl" and "$path" are deprecated. Currently just used as defaults. --> |
||||
<xsl:param name="BASEURL" select="$baseUrl"/> |
||||
<xsl:param name="PATH" select="$path"/> |
||||
|
||||
<xsl:template match="/"> |
||||
<div> |
||||
<table cellspacing="3" cellpadding="3"> |
||||
<tbody> |
||||
<tr> |
||||
<th colspan="3"><h3>MetaData</h3></th> |
||||
</tr> |
||||
<xsl:for-each select="/*/*"> |
||||
<xsl:variable name="FULLFIELD" select="name()"/> |
||||
<xsl:variable name="FIELD" select="local-name()"/> |
||||
<xsl:variable name="DATA" select="normalize-space(text())"/> |
||||
<xsl:if test="$DATA"> |
||||
<tr> |
||||
<td><strong><xsl:value-of select="local-name()"/></strong></td> |
||||
<td><xsl:value-of select="$DATA"/> |
||||
<xsl:for-each select="*"> |
||||
<div><xsl:value-of select="concat(local-name(), ' = ', text())"/></div> |
||||
</xsl:for-each> |
||||
</td> |
||||
</tr> |
||||
</xsl:if> |
||||
</xsl:for-each> |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
</xsl:template> |
||||
</xsl:stylesheet> |
@ -1,248 +1,187 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" version="1.0" xmlns:php="http://php.net/xsl" exclude-result-prefixes="php"> |
||||
<xsl:output method="xml" encoding="UTF-8"/> |
||||
<!-- Red and White XSLT --> |
||||
<xsl:variable name="BASEURL"> |
||||
<xsl:value-of select="$baseUrl"/> |
||||
</xsl:variable> |
||||
<xsl:variable name="PATH"> |
||||
<xsl:value-of select="$path"/> |
||||
</xsl:variable> |
||||
<xsl:variable name="thisPid" select="$collectionPid"/> |
||||
<xsl:variable name="size" select="20"/> |
||||
<xsl:variable name="page" select="$hitPage"/> |
||||
<xsl:variable name="start" select="((number($page) - 1) * number($size)) + 1"/> |
||||
<xsl:variable name="end" select="($start - 1) + number($size)"/> |
||||
<xsl:param name="BASEURL" select="$baseUrl"/> |
||||
<xsl:param name="PATH" select="$path"/> |
||||
<xsl:param name="thisPid" select="$collectionPid"/> |
||||
<xsl:param name="page" select="$hitPage"/> |
||||
<xsl:param name="COLLECTION_TITLE" select="$collectionTitle"/> |
||||
<xsl:param name="imagecache_preset">fedora_repository_collection_thumbnail</xsl:param> |
||||
|
||||
<xsl:variable name="size" select="20"/> |
||||
<xsl:variable name="start" select="((number($page) - 1) * number($size)) + 1"/> |
||||
<xsl:variable name="end" select="($start - 1) + number($size)"/> |
||||
<xsl:variable name="cellsPerRow" select="4"/> |
||||
<xsl:variable name="count" select="count(s:sparql/s:results/s:result)"/> |
||||
<xsl:template match="/"> |
||||
<xsl:if test="$count>0"> |
||||
<table cellpadding="3" cellspacing="3" width="90%"> |
||||
<tr><td colspan="{$cellsPerRow}"> |
||||
<!-- <div STYLE="text-align: center;">--> |
||||
<!-- start previous next --> |
||||
<div class="item-list"> |
||||
<ul class="pager"> |
||||
<xsl:choose> |
||||
<xsl:when test="$end >= $count and $start = 1"> |
||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$count"/> |
||||
of <xsl:value-of select="$count"/> <br /> |
||||
</xsl:when> |
||||
<xsl:when test="$end >= $count"> |
||||
<xsl:variable name="count" select="count(s:sparql/s:results/s:result)"/> |
||||
|
||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$count"/> |
||||
of <xsl:value-of select="$count"/> <br /> |
||||
<li class="pager-previous"> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/> |
||||
</xsl:attribute> |
||||
<Prev |
||||
</a></li> |
||||
</xsl:when> |
||||
<xsl:when test="$start = 1"> |
||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$end"/> |
||||
of <xsl:value-of select="$count"/> <br /> |
||||
<li class="pager-next"> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/> |
||||
</xsl:attribute> |
||||
Next> |
||||
</a></li> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$end"/> |
||||
of <xsl:value-of select="$count"/> <br /> |
||||
<li class="pager-previous"> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/> |
||||
</xsl:attribute> |
||||
<Prev |
||||
</a> </li> |
||||
<li class="pager-next"> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/> |
||||
</xsl:attribute> |
||||
Next> |
||||
</a></li> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</ul> |
||||
</div> |
||||
<!-- end previous next--> |
||||
<br clear="all" /> |
||||
</td></tr> |
||||
<xsl:template match="/"> |
||||
<xsl:if test="$count>0"> |
||||
<xsl:call-template name="render_pager"/> |
||||
<table cellpadding="3" cellspacing="3" width="90%"> |
||||
<xsl:apply-templates select="s:sparql/s:results"/> |
||||
</table><br clear="all" /> |
||||
<xsl:call-template name="render_pager"/> |
||||
</xsl:if> |
||||
</xsl:template> |
||||
|
||||
<!--<xsl:for-each select="/sparql/results/result[position()>=$start and position() <=$end]"> |
||||
<xsl:variable name='OBJECTURI' select="object/@uri"/> |
||||
<xsl:variable name='PID' select="substring-after($OBJECTURI,'/')"/> |
||||
<tr> |
||||
<td> |
||||
<img> |
||||
<xsl:attribute name="src"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$PID"/>/TN |
||||
</xsl:attribute> |
||||
</img> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="title"/> |
||||
</xsl:attribute> |
||||
<xsl:value-of select="title"/> |
||||
</a> |
||||
</td> |
||||
</tr> |
||||
</xsl:for-each>- |
||||
--> |
||||
<xsl:apply-templates select="s:sparql/s:results"/> |
||||
</table><br clear="all" /> |
||||
<!-- start previous next --> |
||||
<div class="item-list"> |
||||
<ul class="pager"> |
||||
<xsl:choose> |
||||
<xsl:when test="$end >= $count and $start = 1"> |
||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$count"/> |
||||
of <xsl:value-of select="$count"/> <br /> |
||||
</xsl:when> |
||||
<xsl:when test="$end >= $count"> |
||||
<xsl:template match="s:sparql/s:results"> |
||||
<xsl:for-each select="s:result[position() mod $cellsPerRow = 1 and position()>=$start and position() <=$end]"> |
||||
<tr> |
||||
<xsl:apply-templates select=". | following-sibling::s:result[position() < $cellsPerRow]"/> |
||||
</tr> |
||||
</xsl:for-each> |
||||
</xsl:template> |
||||
|
||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$count"/> |
||||
of <xsl:value-of select="$count"/> <br /> |
||||
<li class="pager-previous"> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/> |
||||
</xsl:attribute> |
||||
<Prev |
||||
</a></li> |
||||
</xsl:when> |
||||
<xsl:when test="$start = 1"> |
||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$end"/> |
||||
of <xsl:value-of select="$count"/> <br /> |
||||
<li class="pager-next"> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/> |
||||
</xsl:attribute> |
||||
Next> |
||||
</a></li> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:value-of select="$start"/>-<xsl:value-of select="$end"/> |
||||
of <xsl:value-of select="$count"/> <br /> |
||||
<li class="pager-previous"> |
||||
<xsl:template name="render_pager"> |
||||
<!-- start previous next --> |
||||
<div class="item-list"> |
||||
<ul class="pager"> |
||||
<xsl:choose> |
||||
<xsl:when test="$end >= $count and $start = 1"> |
||||
<xsl:value-of select="concat($start, '-', $count, ' of ', $count, ' ')"/><br /> |
||||
</xsl:when> |
||||
<xsl:when test="$end >= $count"> |
||||
<xsl:value-of select="concat($start, '-', $count, ' of ', $count, ' ')"/><br /> |
||||
<li class="pager-previous"> |
||||
<a> |
||||
<xsl:attribute name="href"> |
||||
<xsl:value-of select="php:functionString('url', concat('fedora/repository/', $thisPid, '/-/Collection/', $page - 1))"/> |
||||
</xsl:attribute> |
||||
<Prev |
||||
</a> |
||||
</li> |
||||
</xsl:when> |
||||
<xsl:when test="$start = 1"> |
||||
<xsl:value-of select="concat($start, '-', $end, ' of ', $count, ' ')"/><br /> |
||||
<li class="pager-next"> |
||||
<a> |
||||
<xsl:attribute name="href"> |
||||
<xsl:value-of select="php:functionString('url', concat('fedora/repository/', $thisPid, '/-/Collection/', $page + 1))"/> |
||||
</xsl:attribute> |
||||
Next> |
||||
</a> |
||||
</li> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:value-of select="concat($start, '-', $end, ' of ', $count, ' ')"/><br /> |
||||
<li class="pager-previous"> |
||||
<a> |
||||
<xsl:attribute name="href"> |
||||
<xsl:value-of select="php:functionString('url', concat('fedora/repository/', $thisPid, '/-/Collection/', $page - 1))"/> |
||||
</xsl:attribute> |
||||
<Prev |
||||
</a>  |
||||
</li> |
||||
<li class="pager-next"> |
||||
<a> |
||||
<xsl:attribute name="href"> |
||||
<xsl:value-of select="php:functionString('url', concat('fedora/repository/', $thisPid, '/-/Collection/', $page + 1))"/> |
||||
</xsl:attribute> |
||||
Next> |
||||
</a> |
||||
</li> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</ul> |
||||
</div> |
||||
<!-- end previous next--> |
||||
</xsl:template> |
||||
|
||||
<xsl:template match="s:result"> |
||||
<xsl:variable name='OBJECTURI' select="s:object/@uri"/> |
||||
<xsl:variable name='CONTENTURI' select="s:content/@uri"/> |
||||
<xsl:variable name='CONTENTMODEL' select="substring-after($CONTENTURI,'/')"/> |
||||
<xsl:variable name='PID' select="substring-after($OBJECTURI,'/')"/> |
||||
<xsl:variable name="newTitle" > |
||||
<xsl:call-template name="replace-string"> |
||||
<xsl:with-param name="text" select="s:title"/> |
||||
<xsl:with-param name="from" select="'_'"/> |
||||
<xsl:with-param name="to" select="' '"/> |
||||
</xsl:call-template> |
||||
</xsl:variable> |
||||
<xsl:variable name="cleanTitle" select="php:functionString('fedora_repository_urlencode_string', $newTitle)"/> |
||||
|
||||
<xsl:variable name="linkUrl"> |
||||
<xsl:choose> |
||||
<xsl:when test="($CONTENTMODEL='islandora:collectionCModel')"> |
||||
<xsl:value-of select="php:functionString('url', concat('fedora/repository/', $PID, '/-/collection'))"/> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<!--the below is an example of going straight to a datastream instead of the details page. |
||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/OBJ/<xsl:value-of select="s:title"/>--> |
||||
<xsl:value-of select="php:functionString('url', concat('fedora/repository/', $PID))"/> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
<xsl:value-of select="s:content"/> |
||||
</xsl:variable> |
||||
<td valign="top" width="25%"> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page - 1"/> |
||||
<xsl:attribute name="href"> |
||||
<xsl:value-of select="$linkUrl"/> |
||||
</xsl:attribute> |
||||
<Prev |
||||
</a> </li> |
||||
<li class="pager-next"> |
||||
<xsl:copy-of select="php:function('fedora_repository_string_to_domnode', php:functionString('fedora_repository_render_image', $PID, 'TN', $imagecache_preset))"/> |
||||
<!-- <img> |
||||
<xsl:attribute name="src"><xsl:value-of select="concat($BASEURL, '/fedora/repository/', $PID, '/TN')"/></xsl:attribute> |
||||
<xsl:attribute name="alt"><xsl:value-of select="$newTitle" disable-output-escaping="yes"/></xsl:attribute> |
||||
</img> --> |
||||
</a><br clear="all" /> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$thisPid"/>/-/Collection/<xsl:value-of select="$page + 1"/> |
||||
<xsl:attribute name="href"><xsl:value-of select="$linkUrl"/> |
||||
</xsl:attribute> |
||||
Next> |
||||
</a></li> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</ul> |
||||
</div> |
||||
<!-- end previous next--> |
||||
</xsl:if> |
||||
</xsl:template> |
||||
<xsl:template match="s:sparql/s:results"> |
||||
<xsl:for-each select="s:result[position() mod $cellsPerRow = 1 and position()>=$start and position() <=$end]"> |
||||
<tr> |
||||
<xsl:apply-templates select=". | following-sibling::s:result[position() < $cellsPerRow]"/> |
||||
</tr> |
||||
</xsl:for-each> |
||||
</xsl:template> |
||||
<xsl:template match="s:result"> |
||||
<xsl:variable name='OBJECTURI' select="s:object/@uri"/> |
||||
<xsl:variable name='CONTENTURI' select="s:content/@uri"/> |
||||
<xsl:variable name='CONTENTMODEL' select="substring-after($CONTENTURI,'/')"/> |
||||
<xsl:variable name='PID' select="substring-after($OBJECTURI,'/')"/> |
||||
<xsl:variable name="newTitle" > |
||||
<xsl:call-template name="replace-string"> |
||||
<xsl:with-param name="text" select="s:title"/> |
||||
<xsl:with-param name="from" select="'_'"/> |
||||
<xsl:with-param name="to" select="' '"/> |
||||
</xsl:call-template> |
||||
<xsl:value-of select="$newTitle" disable-output-escaping="yes" /> |
||||
</a> |
||||
<!-- example of a url that would drill down to the details page if the url above went directly to a datastream |
||||
<xsl:if test="($CONTENTMODEL!='islandora:collectionCModel')"> |
||||
<br />[[ <a> |
||||
<xsl:attribute name="href"> |
||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="$cleanTitle"/> |
||||
</xsl:attribute> |
||||
DETAILS |
||||
</a> ]] |
||||
</xsl:if>--> |
||||
|
||||
</xsl:variable> |
||||
<xsl:variable name="cleanTitle"> |
||||
<xsl:value-of select="php:functionString('fedora_repository_urlencode_string', $newTitle)"/> |
||||
</xsl:variable> |
||||
<xsl:variable name="linkUrl"> |
||||
<xsl:choose> |
||||
<xsl:when test="($CONTENTMODEL='islandora:collectionCModel')"> |
||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="'collection'"/> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<!--the below is an example of going straight to a datastream instead of the details page. |
||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/OBJ/<xsl:value-of select="s:title"/>--> |
||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
<xsl:value-of select="s:content"/> |
||||
</xsl:variable> |
||||
<td valign="top" width="25%"> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$linkUrl"/> |
||||
</xsl:attribute> |
||||
<img> |
||||
<xsl:attribute name="src"><xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:value-of select="$PID"/>/TN |
||||
</xsl:attribute> |
||||
<xsl:attribute name="alt"><xsl:value-of select="$newTitle" disable-output-escaping="yes"/> |
||||
</xsl:attribute> |
||||
</img> </a> <br clear="all" /> |
||||
<a> |
||||
<xsl:attribute name="href"><xsl:value-of select="$linkUrl"/> |
||||
</xsl:attribute> |
||||
<xsl:value-of select="$newTitle" disable-output-escaping="yes" /> |
||||
</a> |
||||
<!-- example of a url that would drill down to the details page if the url above went directly to a datastream |
||||
<xsl:if test="($CONTENTMODEL!='islandora:collectionCModel')"> |
||||
<br />[[ <a> |
||||
<xsl:attribute name="href"> |
||||
<xsl:value-of select="$BASEURL"/>/fedora/repository/<xsl:copy-of select="$PID"/>/-/<xsl:value-of select="$cleanTitle"/> |
||||
</xsl:attribute> |
||||
DETAILS |
||||
</a> ]] |
||||
</xsl:if>--> |
||||
</td> |
||||
<xsl:if test="(position() = last()) and (position() < $cellsPerRow)"> |
||||
<xsl:call-template name="FillerCells"> |
||||
<xsl:with-param name="cellCount" select="$cellsPerRow - position()"/> |
||||
</xsl:call-template> |
||||
</xsl:if> |
||||
</xsl:template> |
||||
|
||||
</td> |
||||
<xsl:if test="(position() = last()) and (position() < $cellsPerRow)"> |
||||
<xsl:call-template name="FillerCells"> |
||||
<xsl:with-param name="cellCount" select="$cellsPerRow - position()"/> |
||||
</xsl:call-template> |
||||
</xsl:if> |
||||
</xsl:template> |
||||
<xsl:template name="FillerCells"> |
||||
<xsl:param name="cellCount"/> |
||||
<td> </td> |
||||
<xsl:if test="$cellCount > 1"> |
||||
<xsl:call-template name="FillerCells"> |
||||
<xsl:with-param name="cellCount" select="$cellCount - 1"/> |
||||
</xsl:call-template> |
||||
</xsl:if> |
||||
</xsl:template> |
||||
<xsl:template name="replace-string"> |
||||
<xsl:param name="text"/> |
||||
<xsl:param name="from"/> |
||||
<xsl:param name="to"/> |
||||
<xsl:template name="FillerCells"> |
||||
<xsl:param name="cellCount"/> |
||||
<td> </td> |
||||
<xsl:if test="$cellCount > 1"> |
||||
<xsl:call-template name="FillerCells"> |
||||
<xsl:with-param name="cellCount" select="$cellCount - 1"/> |
||||
</xsl:call-template> |
||||
</xsl:if> |
||||
</xsl:template> |
||||
|
||||
<xsl:choose> |
||||
<xsl:when test="contains($text, $from)"> |
||||
<xsl:template name="replace-string"> |
||||
<xsl:param name="text"/> |
||||
<xsl:param name="from"/> |
||||
<xsl:param name="to"/> |
||||
|
||||
<xsl:variable name="before" select="substring-before($text, $from)"/> |
||||
<xsl:variable name="after" select="substring-after($text, $from)"/> |
||||
<xsl:variable name="prefix" select="concat($before, $to)"/> |
||||
<xsl:choose> |
||||
<xsl:when test="contains($text, $from)"> |
||||
|
||||
<xsl:value-of select="$before"/> |
||||
<xsl:value-of select="$to"/> |
||||
<xsl:call-template name="replace-string"> |
||||
<xsl:with-param name="text" select="$after"/> |
||||
<xsl:with-param name="from" select="$from"/> |
||||
<xsl:with-param name="to" select="$to"/> |
||||
</xsl:call-template> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:value-of select="$text"/> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</xsl:template> |
||||
</xsl:stylesheet> |
||||
<xsl:variable name="before" select="substring-before($text, $from)"/> |
||||
<xsl:variable name="after" select="substring-after($text, $from)"/> |
||||
<xsl:variable name="prefix" select="concat($before, $to)"/> |
||||
|
||||
<xsl:value-of select="$before"/> |
||||
<xsl:value-of select="$to"/> |
||||
<xsl:call-template name="replace-string"> |
||||
<xsl:with-param name="text" select="$after"/> |
||||
<xsl:with-param name="from" select="$from"/> |
||||
<xsl:with-param name="to" select="$to"/> |
||||
</xsl:call-template> |
||||
</xsl:when> |
||||
<xsl:otherwise> |
||||
<xsl:value-of select="$text"/> |
||||
</xsl:otherwise> |
||||
</xsl:choose> |
||||
</xsl:template> |
||||
</xsl:stylesheet> |
||||
|
Loading…
Reference in new issue