Browse Source

Merge branch '6.x' of github.com:Islandora/islandora into 6.x

Conflicts:
	ObjectHelper.inc - changed to drupal_set_header.
pull/135/head
Adam Vessey 13 years ago
parent
commit
ff615b140a
  1. 146
      ObjectDetails.inc
  2. 31
      ObjectHelper.inc
  3. 1
      api/fedora_export.inc
  4. 26
      api/fedora_item.inc
  5. 115
      api/tuque.inc
  6. 41
      formClass.inc
  7. 33
      object_details_xslts/convertQDC.xsl
  8. 37
      object_details_xslts/mods2html.xsl
  9. 3
      plugins/FedoraObjectDetailedContent.inc
  10. 3
      xsl/sparql_to_html.xsl

146
ObjectDetails.inc

@ -1,5 +1,17 @@
<?php <?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() { function fedora_repository_islandora_object_details_display() {
$profiles = array( $profiles = array(
'hidden' => array( 'hidden' => array(
@ -29,11 +41,25 @@ function fedora_repository_islandora_object_details_display() {
return $profiles; 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) { function fedora_repository_object_details_hidden($item) {
// do nothing // do nothing
return ""; 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) { function fedora_repository_object_details_XSLT($item) {
global $base_url; global $base_url;
$path = drupal_get_path('module', 'fedora_repository'); $path = drupal_get_path('module', 'fedora_repository');
@ -47,39 +73,48 @@ function fedora_repository_object_details_XSLT($item) {
$xmlstr = $item->get_datastream_dissemination($dsid); $xmlstr = $item->get_datastream_dissemination($dsid);
if (empty($xmlstr)) { if (empty($xmlstr)) {
return ''; return t('Error - could not find datastream @dsid on object @pid<br/>Please contact the site administrator.',
array('@dsid' => $dsid, '@pid' => $item->pid));
} }
try { try {
$proc = new XsltProcessor(); $proc = new XsltProcessor();
} catch (Exception $e) { } catch (Exception $e) {
drupal_set_message($e->getMessage(), 'error');
watchdog('fedora_repository', "Error while creating XSLT processor: @e", array('@e' => $e->getMessage()), WATCHDOG_ERROR); watchdog('fedora_repository', "Error while creating XSLT processor: @e", array('@e' => $e->getMessage()), WATCHDOG_ERROR);
return; return;
} }
$proc->setParameter('', 'baseUrl', $base_url); $proc->setParameter('', 'baseUrl', $base_url);
$proc->setParameter('', 'path', $base_url . '/' . $path); $proc->setParameter('', 'path', $path);
$input = NULL; $input = NULL;
$xsl_file = './'. $path .'/'. variable_get('islandora_object_details_xslt_sheet', 'xsl/convertQDC.xsl'); $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)) { if (is_readable($xsl_file)) {
$xsl = new DOMDocument(); $xsl = new DomDocument();
$xsl->load($xsl_file); $input = new DomDocument();
$input = new DOMDocument(); try {
$input->loadXML(trim($xmlstr)); $xsl->load($xsl_file);
$xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input); $input->loadXML(trim($xmlstr));
$output = $newdom->saveHTML(); } catch (Exception $e) {
return $output; watchdog('fedora_repository', "Problem loading XSL file: @e", array('@e' => $e->getMessage()), NULL, WATCHDOG_ERROR);
} }
else { $xsl = $proc->importStylesheet($xsl);
watchdog('fedora_repository', 'The XSLT file @xslt_name is not readable.', array( $newdom = $proc->transformToDoc($input);
'@xslt_name' => $xsl_file, $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) { function fedora_repository_object_details_table($item) {
global $base_url; global $base_url;
$path = drupal_get_path('module', 'fedora_repository'); $path = drupal_get_path('module', 'fedora_repository');
@ -93,7 +128,8 @@ function fedora_repository_object_details_table($item) {
$xmlstr = $item->get_datastream_dissemination($dsid); $xmlstr = $item->get_datastream_dissemination($dsid);
if (empty($xmlstr)) { if (empty($xmlstr)) {
return ''; 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); $simplexml = new SimpleXMLElement($xmlstr);
@ -123,7 +159,15 @@ function fedora_repository_object_details_table($item) {
return theme('table', $headers, $rows, array('class' => 'dc-table')); return theme('table', $headers, $rows, array('class' => 'dc-table'));
} }
// configuration pages /**
* 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() { function fedora_repository_object_details_XSLT_config() {
$form = array(); $form = array();
$form['config'] = array( $form['config'] = array(
@ -131,10 +175,14 @@ function fedora_repository_object_details_XSLT_config() {
'#title' => t("XSLT display options"), '#title' => t("XSLT display options"),
); );
$options = module_invoke_all("object_details_get_available_xslts");
$form['config']['xslt'] = array( $form['config']['xslt'] = array(
'#type' => 'textfield', '#type' => 'select',
'#title' => t("XSL transform to use"), '#title' => t("XSL transform to use"),
'#default_value' => variable_get('islandora_object_details_xslt_sheet', 'xsl/convertQDC.xsl'), '#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, '#required' => TRUE,
); );
$form['config']['dsid'] = array( $form['config']['dsid'] = array(
@ -151,7 +199,47 @@ function fedora_repository_object_details_XSLT_config() {
return $form; 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_display_table', 'xslt');
variable_set('islandora_object_details_xslt_sheet', $form_state['values']['xslt']);
variable_set('islandora_object_details_xslt_datastream', $form_state['values']['dsid']);
drupal_set_message('Object Details view has been set to XSLT and your configuration has been saved');
}
/**
* 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() { function fedora_repository_object_details_table_config() {
$form = array(); $form = array();
$form['config'] = array( $form['config'] = array(
@ -174,11 +262,15 @@ function fedora_repository_object_details_table_config() {
return $form; return $form;
} }
function fedora_repository_object_details_XSLT_config_submit($form, &$form_state) { /**
variable_set('islandora_object_details_xslt_sheet', $form_state['values']['xslt']); * Custom submit handler for the table configuration page.
variable_set('islandora_object_details_xslt_datastream', $form_state['values']['dsid']); *
} * @param $form
* @param &$form_state
* The user supplied values for the form.
*/
function fedora_repository_object_details_table_config_submit($form, &$form_state) { function fedora_repository_object_details_table_config_submit($form, &$form_state) {
variable_set('islandora_object_details_display_table', 'table');
variable_set('islandora_object_details_table_datastream', $form_state['values']['dsid']); variable_set('islandora_object_details_table_datastream', $form_state['values']['dsid']);
drupal_set_message('Object Details view has been set to Table and your configuration has been saved');
} }

31
ObjectHelper.inc

@ -233,8 +233,8 @@ class ObjectHelper {
elseif ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { //If not anonymous, soap is force or we're using HTTPS elseif ((isset($user) && $user->uid != 0) || $forceSoap || isset($_SERVER['HTTPS'])) { //If not anonymous, soap is force or we're using HTTPS
//Have the webserver mediate the transfer (download and restream) //Have the webserver mediate the transfer (download and restream)
if (($contentSize = self::getDatastreamSize($pid, $dsID, TRUE)) > 0) { if (($contentSize = self::getDatastreamSize($pid, $dsID, TRUE)) > 0) {
drupal_set_header("Content-Length: $contentSize"); drupal_set_header("Content-Length: $contentSize");
} }
$opts = array( $opts = array(
@ -624,30 +624,9 @@ class ObjectHelper {
* *
*/ */
function getStream($pid, $dsid, $showError = FALSE) { function getStream($pid, $dsid, $showError = FALSE) {
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$soapHelper = new ConnectionHelper(); $item = new fedora_item($pid);
try { return $item->get_datastream_dissemination($dsid);
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl'));
$params = array(
'pid' => "$pid",
'dsID' => "$dsid",
'asOfDateTime' => ""
);
if (!isset($client)) {
drupal_set_message(t('Error connection to Fedora using soap client.'));
return NULL;
}
$object = $client->__soapCall('getDatastreamDissemination', array('parameters' => $params));
} catch (Exception $e) {
if ($showError) {
drupal_set_message(t('Error getting Datastream for %pid and %datastream<br />', array('%pid' => $pid, '%datastream' => $dsid)), 'error');
}
return NULL;
}
$content = $object->dissemination->stream;
$content = trim($content);
return $content;
} }
/** /**

1
api/fedora_export.inc

@ -57,7 +57,6 @@ function export_objects_for_pid($pid, $dir, &$log) {
$file = $dir . '/' . $ds->label . '.' . get_file_extension($ds->MIMEType); $file = $dir . '/' . $ds->label . '.' . get_file_extension($ds->MIMEType);
$paths[$ds->ID] = $file; $paths[$ds->ID] = $file;
//$content = $ob_helper->getDatastreamDissemination($pid, $ds->ID);
if ($content = $ob_helper->getStream($pid, $ds->ID, FALSE)) { if ($content = $ob_helper->getStream($pid, $ds->ID, FALSE)) {
if (!$fp = @fopen($file, 'w')) { if (!$fp = @fopen($file, 'w')) {
$log[] = log_line(t("Failed to open file %file to write datastream %dsid for pid %pid", array('%file' => $file, '%dsid' => $ds->ID, '%pid' => $pid)), 'error'); $log[] = log_line(t("Failed to open file %file to write datastream %dsid for pid %pid", array('%file' => $file, '%dsid' => $ds->ID, '%pid' => $pid)), 'error');

26
api/fedora_item.inc

@ -10,9 +10,9 @@ define("ISLANDORA_PAGE_URI", 'info:islandora/islandora-system:def/pageinfo#');
define("ISLANDORA_RELS_EXT_URI", 'http://islandora.ca/ontology/relsext#'); define("ISLANDORA_RELS_EXT_URI", 'http://islandora.ca/ontology/relsext#');
define("ISLANDORA_RELS_INT_URI", "http://islandora.ca/ontology/relsint#"); define("ISLANDORA_RELS_INT_URI", "http://islandora.ca/ontology/relsint#");
define("RELS_TYPE_URI", 0); define("RELS_TYPE_URI", 0);
define("RELS_TYPE_PLAIN_LITERAL", 1); define("RELS_TYPE_PLAIN_LITERAL", 1);
define("RELS_TYPE_STRING", 2); define("RELS_TYPE_STRING", 2);
define("RELS_TYPE_INT", 3); define("RELS_TYPE_INT", 3);
define("RELS_TYPE_DATETIME", 4); define("RELS_TYPE_DATETIME", 4);
@ -130,6 +130,7 @@ class Fedora_Item {
$datastream_url = drupal_urlencode($datastream_file); $datastream_url = drupal_urlencode($datastream_file);
$url = file_create_url($datastream_url); $url = file_create_url($datastream_url);
// add_datastream_from_url forces a re-sync of the datastream list
$return_value = $this->add_datastream_from_url($url, $datastream_id, $datastream_label, $datastream_mimetype, $controlGroup, $logMessage); $return_value = $this->add_datastream_from_url($url, $datastream_id, $datastream_label, $datastream_mimetype, $controlGroup, $logMessage);
if ($original_path != $datastream_file) { if ($original_path != $datastream_file) {
@ -177,8 +178,10 @@ class Fedora_Item {
'logMessage' => ($logMessage != NULL) ? $logMessage : 'Ingested object ' . $datastream_id 'logMessage' => ($logMessage != NULL) ? $logMessage : 'Ingested object ' . $datastream_id
); );
$soap_result = $this->soap_call('addDataStream', $params);
return $this->soap_call('addDataStream', $params); // make sure to refresh the datastream list after adding so this item stays in sync with the repository
$this->datastreams = $this->get_datastreams_list_as_array();
return $soap_result;
} }
/** /**
@ -197,6 +200,7 @@ class Fedora_Item {
$tmpfile = fopen($tmpfilename, 'w'); $tmpfile = fopen($tmpfilename, 'w');
fwrite($tmpfile, $str, strlen($str)); fwrite($tmpfile, $str, strlen($str));
fclose($tmpfile); fclose($tmpfile);
// add_datastream_from_file forces a re-sync of the datastream list
$returnvalue = $this->add_datastream_from_file($tmpfilename, $datastream_id, $datastream_label, $datastream_mimetype, $controlGroup, $logMessage); $returnvalue = $this->add_datastream_from_file($tmpfilename, $datastream_id, $datastream_label, $datastream_mimetype, $controlGroup, $logMessage);
unlink($tmpfilename); unlink($tmpfilename);
return $returnvalue; return $returnvalue;
@ -513,6 +517,10 @@ RDF;
* @return null * @return null
*/ */
function get_datastream_dissemination($dsid, $as_of_date_time = "", $quiet=TRUE) { function get_datastream_dissemination($dsid, $as_of_date_time = "", $quiet=TRUE) {
if (!array_key_exists($dsid, $this->datastreams)) {
return NULL;
}
$params = array( $params = array(
'pid' => $this->pid, 'pid' => $this->pid,
'dsID' => $dsid, 'dsID' => $dsid,
@ -538,6 +546,9 @@ RDF;
* @return type * @return type
*/ */
function get_datastream($dsid, $as_of_date_time = '', $quiet = TRUE) { function get_datastream($dsid, $as_of_date_time = '', $quiet = TRUE) {
if (!array_key_exists($dsid, $this->datastreams)) {
return NULL;
}
$params = array( $params = array(
'pid' => $this->pid, 'pid' => $this->pid,
'dsID' => $dsid, 'dsID' => $dsid,
@ -859,7 +870,10 @@ RDF;
'logMessage' => $log_message, 'logMessage' => $log_message,
'force' => $force, 'force' => $force,
); );
return $this->soap_call('purgeDatastream', $params); $soap_result = $this->soap_call('purgeDatastream', $params);
// make sure to refresh the datastream list after adding so this item stays in sync with the repository
$this->datastreams = $this->get_datastreams_list_as_array();
return $soap_result;
} }
/** /**

115
api/tuque.inc

@ -0,0 +1,115 @@
<?php
$islandora_module_path = drupal_get_path('module', 'fedora_repository');
//do this until we expost these in a module or library
@include_once 'sites/all/libraries/tuque/Datastream.php';
@include_once 'sites/all/libraries/tuque/FedoraApi.php';
@include_once 'sites/all/libraries/tuque/FedoraApiSerializer.php';
@include_once 'sites/all/libraries/tuque/Object.php';
@include_once 'sites/all/libraries/tuque/RepositoryConnection.php';
@include_once 'sites/all/libraries/tuque/Cache.php';
@include_once 'sites/all/libraries/tuque/RepositoryException.php';
@include_once 'sites/all/libraries/tuque/Repository.php';
@include_once 'sites/all/libraries/tuque/FedoraRelationships.php';
@include_once "$islandora_module_path/libraries/tuque/Datastream.php";
@include_once "$islandora_module_path/libraries/tuque/FedoraApi.php";
@include_once "$islandora_module_path/libraries/tuque/FedoraApiSerializer.php";
@include_once "$islandora_module_path/libraries/tuque/Object.php";
@include_once "$islandora_module_path/libraries/tuque/RepositoryConnection.php";
@include_once "$islandora_module_path/libraries/tuque/Cache.php";
@include_once "$islandora_module_path/libraries/tuque/RepositoryException.php";
@include_once "$islandora_module_path/libraries/tuque/Repository.php";
@include_once "$islandora_module_path/libraries/tuque/FedoraRelationships.php";
class IslandoraTuque {
/**
* Connection to the repository
*
* @var RepositoryConnection
*/
public $connection = NULL;
/**
* The Fedora API we are using
*
* @var FedoraAPI
*/
public $api = NULL;
/**
* The cache we use to connect.
*
* @var SimpleCache
*/
public $cache = NULL;
/**
* The repository object.
*
* @var FedoraRepository
*/
public $repository = NULL;
function __construct($user = NULL, $url = NULL) {
if(!isset($user)) {
global $user;
}
if(!isset($user) || $user->uid == 0){
$user_string = 'anonymous';
$pass_string = 'anonymous';
} else {
$user_string = $user->name;
$pass_string = $user->pass;
}
if (!isset($url)) {
$url = variable_get('islandora_base_url', 'http://localhost:8080/fedora');
}
if(self::exists()) {
$this->connection = new RepositoryConnection($url, $user_string, $pass_string);
$this->connection->reuseConnection = TRUE;
$this->api = new FedoraApi($this->connection);
$this->cache = new SimpleCache();
$this->repository = new FedoraRepository($this->api, $this->cache);
}
}
static function exists() {
return class_exists('RepositoryConnection');
}
static function getError() {
$islandora_doc_link = l(t('Islandora documentation'), 'https://wiki.duraspace.org/display/ISLANDORA/Islandora');
$tuque_link = l(t('Tuque Fedora API'), 'http://github.com/islandora/tuque');
$message = t('Islandora requires the !tuque_url. Please install in /sites/all/libraries/tuque before continuing. See the !islandora_url.', array( '!tuque_url' => $tuque_link, '!islandora_url' => $islandora_doc_link));
drupal_set_message($message, 'error', FALSE);
}
}
function islandora_object_load($object_id) {
static $islandora_tuque = NULL;
if(!$islandora_tuque) {
$islandora_tuque = new IslandoraTuque();
}
if(IslandoraTuque::exists()) {
try {
$fedora_object = $islandora_tuque->repository->getObject($object_id);
} catch (Exception $e) {
return NULL;
}
return $fedora_object;
}
else {
IslandoraTuque::getError();
return NULL;
}
}

41
formClass.inc

@ -317,11 +317,19 @@ class formClass {
$profiles = module_invoke_all("islandora_object_details_display"); $profiles = module_invoke_all("islandora_object_details_display");
$display_options = array(); $display_options = array();
foreach ($profiles as $machine_name => $profile) { // suppress php warnings from empty lists
$display_options[$machine_name] = $profile['name']; if ($profiles) {
$config_path = $profile['config']; foreach ($profiles as $machine_name => $profile) {
if (isset($config_path) && $config_path != ""){ // make sure the name exists (the bare minimum)
$display_options[$machine_name] .= " (". l("config", $config_path, array()) .")"; if (array_key_exists('name', $profile)) {
$display_options[$machine_name] = $profile['name'];
if (array_key_exists('config', $profile)) {
$config_path = $profile['config'];
if (isset($config_path) && $config_path != "") {
$display_options[$machine_name] .= " (". l("config", $config_path, array()) .")";
}
}
}
} }
} }
$form['tabs']['islandora_object_details_display_table'] = array( $form['tabs']['islandora_object_details_display_table'] = array(
@ -362,10 +370,10 @@ class formClass {
'#description' => t('When enabled, restricts access to fedora object datastreams that are not listed in the Islandora Content Model for the object (unless the user is an administrator).'), '#description' => t('When enabled, restricts access to fedora object datastreams that are not listed in the Islandora Content Model for the object (unless the user is an administrator).'),
); );
$form['advanced']['fedora_repository_use_imagecache_external_in_collection_view'] = array( $form['advanced']['fedora_repository_use_imagecache_external_in_collection_view'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Allow imagecache_external use for thumbnails in collection view'), '#title' => t('Allow imagecache_external use for thumbnails in collection view'),
'#default_value' => variable_get('fedora_repository_use_imagecache_external_in_collection_view', FALSE), '#default_value' => variable_get('fedora_repository_use_imagecache_external_in_collection_view', FALSE),
'#description' => t('If enabled, the default collection list view (or ' . '#description' => t('If enabled, the default collection list view (or ' .
'anywhere the function "@function" is used) will try to use ' . 'anywhere the function "@function" is used) will try to use ' .
'imagecache_external, defaulting to the "@preset" preset. XSLTs may ' . 'imagecache_external, defaulting to the "@preset" preset. XSLTs may ' .
@ -374,7 +382,7 @@ class formClass {
'@function' => '_fedora_repository_render_image()', '@function' => '_fedora_repository_render_image()',
'@preset' => 'fedora_repository_collection_thumbnail', '@preset' => 'fedora_repository_collection_thumbnail',
'@xsl' => 'sparql_to_html.xsl', '@xsl' => 'sparql_to_html.xsl',
)), )),
); );
$form['advanced']['fedora_collection_display_list'] = array( $form['advanced']['fedora_collection_display_list'] = array(
@ -809,15 +817,12 @@ class formClass {
* @return string * @return string
*/ */
function createQDCEditForm($pid, $dsid, $client, &$form_state) { function createQDCEditForm($pid, $dsid, $client, &$form_state) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$dsid = empty($dsid) ? 'QDC' : $dsid; $dsid = empty($dsid) ? 'QDC' : $dsid;
try {
$params = array('pid' => "$pid", 'dsID' => "$dsid", 'asOfDateTime' => ""); $item = new fedora_item($pid);
$object = $client->__soapCall('getDatastreamDissemination', array('parameters' => $params)); $content = trim($item->get_datastream_dissemination($dsid));
} catch (Exception $e) {
return array();
}
$content = $object->dissemination->stream;
$content = trim($content);
$doc = new DOMDocument(); $doc = new DOMDocument();
if (!$doc->loadXML($content)) { if (!$doc->loadXML($content)) {
echo "error loading xml"; echo "error loading xml";

33
object_details_xslts/convertQDC.xsl

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:variable name="BASEURL">
<xsl:value-of select="$baseUrl"/>
</xsl:variable>
<xsl:variable name="PATH">
<xsl:value-of select="$path"/>
</xsl:variable>
<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="text()"/>
<xsl:if test="$DATA != ' '">
<tr><td><strong><xsl:value-of select="local-name()"/></strong></td><td><xsl:value-of select="text()"/>
<xsl:for-each select="*">
<div>
<xsl:value-of select="local-name()"/> = <xsl:value-of select="text()"/>
</div>
</xsl:for-each>
</td></tr>
</xsl:if>
</xsl:for-each>
</tbody></table></div>
</xsl:template>
</xsl:stylesheet>

37
xsl/mods2html.xsl → object_details_xslts/mods2html.xsl

@ -3,11 +3,36 @@
<xsl:variable name="dictionary" select="document('http://www.loc.gov/standards/mods/modsDictionary.xml')/dictionary"/> <xsl:variable name="dictionary" select="document('http://www.loc.gov/standards/mods/modsDictionary.xml')/dictionary"/>
<xsl:template match="/"> <xsl:template match="/">
<!--html> <html>
<head> <head>
<style type="text/css">TD {vertical-align:top}</style> <style type="text/css">
.modsLabelTop {
}
.modsLabelLevel2 {
padding-left: 10px;
}
.modsLabelLevel3 {
padding-left: 20px;
}
.modsLabelLevel4 {
padding-left: 30px;
}
.modsValueTop {
}
.modsValueLevel2 {
}
.modsValueLevel3 {
}
</style>
</head> </head>
<body--> <body>
<xsl:choose> <xsl:choose>
<xsl:when test="mods:modsCollection"> <xsl:when test="mods:modsCollection">
<xsl:apply-templates select="mods:modsCollection"/> <xsl:apply-templates select="mods:modsCollection"/>
@ -16,8 +41,8 @@
<xsl:apply-templates select="mods:mods"/> <xsl:apply-templates select="mods:mods"/>
</xsl:when> </xsl:when>
</xsl:choose> </xsl:choose>
<!--/body> </body>
</html--> </html>
</xsl:template> </xsl:template>
<xsl:template match="mods:modsCollection"> <xsl:template match="mods:modsCollection">
@ -38,7 +63,7 @@
<span class="modsLabelTop"> <span class="modsLabelTop">
<xsl:call-template name="longName"> <xsl:call-template name="longName">
<xsl:with-param name="name"> <xsl:with-param name="name">
<xsl:value-of select="local-name()"/> <xsl:value-of select="local-name()"/>:
</xsl:with-param> </xsl:with-param>
</xsl:call-template> </xsl:call-template>
<xsl:call-template name="attr"/> <xsl:call-template name="attr"/>

3
plugins/FedoraObjectDetailedContent.inc

@ -65,7 +65,8 @@ class FedoraObjectDetailedContent {
$dc_html = $details_function($this->item); $dc_html = $details_function($this->item);
} }
else { else {
// problem // problem - display profile not found
watchdog('fedora_repository', "Error - could not find object details display function @function", array('@function' => $details_function), WATCHDOG_WARNING);
} }
} }

3
xsl/sparql_to_html.xsl

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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: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">
<!-- Red and White XSLT --> <xsl:output method="xml" encoding="UTF-8"/>
<!-- Red and White XSLT -->
<xsl:param name="BASEURL" select="$baseUrl"/> <xsl:param name="BASEURL" select="$baseUrl"/>
<xsl:param name="PATH" select="$path"/> <xsl:param name="PATH" select="$path"/>
<xsl:param name="thisPid" select="$collectionPid"/> <xsl:param name="thisPid" select="$collectionPid"/>

Loading…
Cancel
Save