Browse Source

ISLANDORA-214 Add support for custom collection queries into default collection class.

pull/105/head
Alexander O'Neill 14 years ago
parent
commit
f47a4d7f42
  1. 148
      CollectionClass.inc
  2. 6
      ContentModel.inc
  3. 261
      ObjectHelper.inc
  4. 2
      api/fedora_item.inc
  5. 7
      collection_views/demo_image_collection_dc_record.xml
  6. 66
      collection_views/standard_jpeg_collection_view.xml
  7. 1
      content_models/COLLECTIONCM.xml
  8. 860
      content_models/islandora_collectionCModel.xml
  9. 59
      fedora_repository.module
  10. 40
      formClass.inc
  11. 16
      ilives/book.inc
  12. BIN
      images/48px-Crystal_Clear_app_download_manager.png
  13. BIN
      images/Crystal_Clear_app_download_manager.png
  14. 300
      installer_files/foxml/islandora-collectionCModel.xml
  15. 46
      plugins/ShowStreamsInFieldSets.inc
  16. 50
      plugins/fedoraObject.inc
  17. 23
      plugins/herbarium.inc
  18. 9
      plugins/map_viewer.inc
  19. 24
      plugins/slide_viewer.inc

148
CollectionClass.inc

@ -26,12 +26,13 @@ class CollectionClass {
* @param string $pid The pid of the collection to represent.
* @return CollectionClass
*/
function CollectionClass($pid = NULL) {
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
function __construct($pid = NULL) {
if (!empty($pid)) {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
$this->collectionObject = new ObjectHelper($pid);
$this->pid = $pid;
}
}
/* gets objects related to this object. must include offset and limit
@ -401,5 +402,148 @@ class CollectionClass {
return TRUE;
}
/**
* Queries a collection object for an xslt to format how the
* collection of objects is displayed.
*/
function getXslContent($pid, $path, $canUseDefault = TRUE) {
module_load_include('inc', 'fedora_repository', 'CollectionClass');
$collectionClass = new CollectionClass();
$xslContent = $collectionClass->getCollectionViewStream($pid);
if (!$xslContent && $canUseDefault) { //no xslt so we will use the default sent with the module
$xslContent = file_get_contents($path . '/xsl/sparql_to_html.xsl');
}
return $xslContent;
}
function showFieldSets($page_number) {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
global $base_url;
$tabset = array();
global $user;
$objectHelper = new ObjectHelper();
$item = new Fedora_Item($this->pid);
$query = NULL;
if ($item->exists()) {
$query = $item->get_datastream_dissemination('QUERY');
}
$results = $this->getRelatedItems($this->pid, $query);
$collection_items = $this->renderCollection($results, $this->pid, NULL, NULL, $page_number );
$collection_item = new Fedora_Item($this->pid);
// Check the form post to see if we are in the middle of an ingest operation.
$show_ingest_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_ingest_form');
$add_to_collection = $this->getIngestInterface();
$tabset['view_tab'] = array(
// $collection_fieldset = array (
'#type' => 'tabpage',
'#title' => 'View',
'#content' => $collection_items
);
$tabset['add_tab'] = array(
// #type and #title are the minimum requirements.
'#type' => 'tabpage',
'#title' => t('Add'),
'#selected' => $show_ingest_tab,
// This will be the content of the tab.
'#content' => $add_to_collection,
);
return $tabset;
}
function getIngestInterface() {
global $base_url;
$objectHelper = new ObjectHelper();
module_load_include('inc', 'Fedora_Repository', 'CollectionPolicy');
$collectionPolicyExists = $objectHelper->getMimeType($this->pid, CollectionPolicy::getDefaultDSID());
if (user_access(ObjectHelper :: $INGEST_FEDORA_OBJECTS) && $collectionPolicyExists) {
if (!empty($collectionPolicyExists)) {
$allow=TRUE;
if (module_exists('fedora_fesl')) {
$allow= fedora_fesl_check_roles($this->pid,'write');
}
if ($allow) {
// $ingestObject = '<a title="'. t('Ingest a New object into ') . $collectionName . ' '. $collection_pid . '" href="'. base_path() .
$ingestObject = drupal_get_form('fedora_repository_ingest_form', $this->pid);
}
}
}
else {
$ingestObject = '';
}
return $ingestObject;
}
function renderCollection($content, $pid, $dsId, $collection, $pageNumber = NULL) {
$path = drupal_get_path('module', 'fedora_repository');
global $base_url;
$collection_pid = $pid; //we will be changing the pid later maybe
//module_load_include('php', ''Fedora_Repository'', 'ObjectHelper');
$objectHelper = new ObjectHelper();
$parsedContent = NULL;
$contentModels = $objectHelper->get_content_models_list($pid);
$isCollection = FALSE;
//if this is a collection object store the $pid in the session as it will come in handy
//after a purge or ingest to return to the correct collection.
$fedoraItem = NULL;
$collectionName = $collection;
if (!$pageNumber) {
$pageNumber = 1;
}
if (!isset($collectionName)) {
$collectionName = variable_get('fedora_repository_name', 'Collection');
}
$xslContent = $this->getXslContent($pid, $path);
//get collection list and display using xslt-------------------------------------------
$objectList = '';
if (isset($content) && $content != FALSE) {
$input = new DomDocument();
$input->loadXML(trim($content));
$results = $input->getElementsByTagName('result');
if ($results->length > 0) {
try {
$proc = new XsltProcessor();
$proc->setParameter('', 'collectionPid', $collection_pid);
$proc->setParameter('', 'collectionTitle', $collectionName);
$proc->setParameter('', 'baseUrl', $base_url);
$proc->setParameter('', 'path', $base_url . '/' . $path);
$proc->setParameter('', 'hitPage', $pageNumber);
$proc->registerPHPFunctions();
$xsl = new DomDocument();
$xsl->loadXML($xslContent);
// php xsl does not seem to work with namespaces so removing it below
// I may have just been being stupid here
// $content = str_ireplace('xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result"', '', $content);
$xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input);
$objectList = $newdom->saveXML(); //is the xml transformed to html as defined in the xslt associated with the collection object
if (!$objectList) {
throw new Exception("Invalid XML.");
}
} catch (Exception $e) {
drupal_set_message(t('!e', array('!e' => $e->getMessage())), 'error');
return '';
}
}
} else {
drupal_set_message(t("No Objects in this collection or bad query."));
}
return $objectList;
}
}

6
ContentModel.inc

@ -37,7 +37,7 @@ class ContentModel extends XMLDatastream {
$content_models = $objectHelper->get_content_models_list($pid);
foreach ($content_models as $content_model) {
if ($content_model != 'fedora-system:FedoraObject-3.0') {
$ret = self::loadFromModel($content_model);
$ret = $content_model;
break;
}
}
@ -1437,7 +1437,7 @@ class ContentModel extends XMLDatastream {
* @param string $pid
* @return string $output
*/
public function displayExtraFieldset($pid) {
public function displayExtraFieldset($pid, $page_number) {
$output = '';
if ($this->validate()) {
$datastreams = $this->xml->getElementsByTagName('datastreams');
@ -1467,7 +1467,7 @@ class ContentModel extends XMLDatastream {
self::$errors[] = 'Execute Form Handler: method \''. $className .'->'. $methodName .'\' does not exist.';
}
else {
$output .= $class->$methodName();
$output = $class->$methodName($page_number);
}
}
}

261
ObjectHelper.inc

@ -307,55 +307,22 @@ class ObjectHelper {
}
}
$content .= "<tr><td>$label</td><td>&nbsp;$view</td><td>&nbsp;$downloadVersion</td><td>&nbsp;$mimeType</td><td>&nbsp;$replaceImage&nbsp;$purgeImage</td></tr>\n";
//$content .= "<tr><td><b>Mime Type :</b></td><td>$mimeType</td></tr>\n";
return $content;
}
/**
* Queries fedora for what we call the qualified dublin core. Currently only dc.coverage has
* any qualified fields
* Transforms the returned xml to html
* This is the default metadata view. With icons for searching a dublin core field
* @param $pid String
* @return String
*/
function getQDC($pid) {
function getFormattedDC($item) {
global $base_url;
$path = drupal_get_path('module', 'fedora_repository');
module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
$soapHelper = new ConnectionHelper();
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl'));
$dsid = array_key_exists('QDC', $item->get_datastreams_list_as_array()) ? 'QDC' : 'DC';
$xmlstr = $item->get_datastream_dissemination($dsid);
$dsId = 'QDC';
$params = array(
'pid' => "$pid",
'dsID' => "$dsId",
'asOfDateTime' => ""
);
try {
$object = $client->__soapCall('getDatastreamDissemination', array(
'parameters' => $params
));
} catch (Exception $e) {
try { //probably no QDC so we will try for the DC stream.
$dsId = 'DC';
$params = array(
'pid' => "$pid",
'dsID' => "$dsId",
'asOfDateTime' => ""
);
$object = $client->__soapCAll('getDatastreamDissemination', array(
'parameters' => $params
));
} catch (exception $e2) {
drupal_set_message($e2->getMessage(), 'error');
return;
}
if (empty($xmlstr)) {
return '';
}
$xmlstr = $object->dissemination->stream;
try {
$proc = new XsltProcessor();
} catch (Exception $e) {
@ -377,7 +344,25 @@ class ObjectHelper {
$xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input);
$output = $newdom->saveXML();
$baseUrl = base_path();
return $output;
}
/**
* Queries fedora for what we call the qualified dublin core. Currently only dc.coverage has
* any qualified fields
* Transforms the returned xml to html
* This is the default metadata view. With icons for searching a dublin core field
* @param $pid String
* @return String
*/
function getQDC($pid) {
global $base_url;
$item = new Fedora_Item($pid);
$ds_list = $item->get_datastreams_list_as_array();
$output = $this->getFormattedDC($item);
$dsid = array_key_exists('QDC', $ds_list) ? 'QDC' : 'DC';
//$baseUrl=substr($baseUrl, 0, (strpos($baseUrl, "/")-1));
if (user_access(ObjectHelper :: $EDIT_FEDORA_METADATA)) {
$allow=TRUE;
@ -386,36 +371,13 @@ class ObjectHelper {
}
if ($allow) {
$output .= '<br /><a title = "' . t('Edit Meta Data') . '" href="' . $base_url . '/fedora/repository/' . 'editmetadata/' . $pid . '/' .
$dsId . '"><img src="' . $base_url . '/' . $path . '/images/edit.gif" alt="' . t('Edit Meta Data') . '" /></a>';
$dsid . '"><img src="' . $base_url . '/' . drupal_get_path('module', 'fedora_repository') . '/images/edit.gif" alt="' . t('Edit Meta Data') . '" /></a>';
}
}
return $output;
}
/**
* Gets a list of datastreams from an object using its pid
*
* We make some assumptions here. We have implemented a policy that
* we ingest in our repository will have TN (thumbnail) datastream. Even audio
* will have a picture of a speaker or something. This is not critical
* but makes searches etc. look better if there is a TN stream.
* This diplays all the streams in a collapsed fieldset at the bottom of the object page.
* you can implement a content model if you would like certain streams displayed in certain ways.
* @param $object_pid String
* @return String
*
*/
function get_formatted_datastream_list($object_pid, $contentModels, &$fedoraItem) {
global $fedoraUser, $fedoraPass, $base_url, $user;
module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'ContentModel');
$path = drupal_get_path('module', 'fedora_repository');
$dataStreamBody = '';
$fedoraItem = new Fedora_Item($object_pid);
function getFormattedDatastreamList($object_pid, $contentModels, &$fedoraItem) {
if (user_access(ObjectHelper :: $VIEW_DETAILED_CONTENT_LIST)) {
$availableDataStreamsText = 'Detailed List of Content';
//$metaDataText='Description';
@ -464,14 +426,39 @@ class ObjectHelper {
$dataStreamBody .= drupal_get_form('add_stream_form', $object_pid);
}
}
$fieldset = array(
'#title' => t("!text", array('!text' => $availableDataStreamsText)),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#value' => $dataStreamBody
);
$dataStreamBody = '<div class = "fedora_detailed_list">' . theme('fieldset', $fieldset) . '</div>';
$dataStreamBody = '<div class = "fedora_detailed_list">' . $dataStreamBody . '</div>';
return $dataStreamBody;
}
return '';
}
/**
* Gets a list of datastreams from an object using its pid
*
* We make some assumptions here. We have implemented a policy that
* we ingest in our repository will have TN (thumbnail) datastream. Even audio
* will have a picture of a speaker or something. This is not critical
* but makes searches etc. look better if there is a TN stream.
* This diplays all the streams in a collapsed fieldset at the bottom of the object page.
* you can implement a content model if you would like certain streams displayed in certain ways.
* @param $object_pid String
* @return String
*
*/
function get_formatted_datastream_list($object_pid, $contentModels, &$fedoraItem) {
global $fedoraUser, $fedoraPass, $base_url, $user;
module_load_include('inc', 'fedora_repository', 'ConnectionHelper');
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
module_load_include('inc', 'fedora_repository', 'ContentModel');
$path = drupal_get_path('module', 'fedora_repository');
$dataStreamBody = '';
$fedoraItem = new Fedora_Item($object_pid);
$dataStreamBody = $this->getFormattedDatastreamList($object_pid, $contentModels, $fedoraItem);
$content = '';
if (empty($contentModels)) {
@ -516,19 +503,7 @@ class ObjectHelper {
return '<div class="fedora_datastream_content">' . $content . '</div>';
}
/**
* Queries a collection object for an xslt to format how the
* collection of objects is displayed.
*/
function getXslContent($pid, $path, $canUseDefault = TRUE) {
module_load_include('inc', 'fedora_repository', 'CollectionClass');
$collectionClass = new CollectionClass();
$xslContent = $collectionClass->getCollectionViewStream($pid);
if (!$xslContent && $canUseDefault) { //no xslt so we will use the default sent with the module
$xslContent = file_get_contents($path . '/xsl/sparql_to_html.xsl');
}
return $xslContent;
}
/**
* returns a stream from a fedora object given a pid and dsid
@ -589,15 +564,19 @@ class ObjectHelper {
if (!isset($sxml)) {
return $pids;
}
$cmodels = array();
foreach ($sxml->xpath('//@uri') as $uri) {
if (strpos($uri, 'fedora-system') != FALSE && $include_fedora_system_content_models == FALSE) {
if (strpos($uri, 'fedora-system:fedoraObject-3.0') != FALSE && $include_fedora_system_content_models == FALSE) {
continue;
}
$pids[] = substr(strstr($uri, '/'), 1);
$cmodel_pid = substr(strstr($uri, '/'), 1);
$cm = ContentModel::loadFromModel($cmodel_pid);
if ($cm) {
$cmodels[] = $cm;
}
}
return $pids;
return $cmodels;
}
/*
@ -666,56 +645,6 @@ class ObjectHelper {
$isCollection = TRUE;
}
}
//$label=$content;
$collectionName = $collection;
if (!$pageNumber) {
$pageNumber = 1;
}
if (!isset($collectionName)) {
$collectionName = variable_get('fedora_repository_name', 'Collection');
}
$xslContent = $this->getXslContent($pid, $path);
//get collection list and display using xslt-------------------------------------------
if (isset($content) && $content != FALSE) {
$input = new DomDocument();
$input->loadXML(trim($content));
$results = $input->getElementsByTagName('result');
if ($results->length > 0) {
try {
$proc = new XsltProcessor();
$proc->setParameter('', 'collectionPid', $collection_pid);
$proc->setParameter('', 'collectionTitle', $collectionName);
$proc->setParameter('', 'baseUrl', $base_url);
$proc->setParameter('', 'path', $base_url . '/' . $path);
$proc->setParameter('', 'hitPage', $pageNumber);
$proc->registerPHPFunctions();
$xsl = new DomDocument();
$xsl->loadXML($xslContent);
// php xsl does not seem to work with namespaces so removing it below
// I may have just been being stupid here
// $content = str_ireplace('xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result"', '', $content);
$xsl = $proc->importStylesheet($xsl);
$newdom = $proc->transformToDoc($input);
$objectList = $newdom->saveXML(); //is the xml transformed to html as defined in the xslt associated with the collection object
if (!$objectList) {
throw new Exception("Invalid XML.");
}
} catch (Exception $e) {
drupal_set_message(t('!e', array('!e' => $e->getMessage())), 'error');
return '';
}
}
} else {
drupal_set_message(t("No Objects in this collection or bad query."));
}
//--------------------------------------------------------------------------------
//show the collections datastreams
if ($results->length > 0 || $isCollection == TRUE) {
@ -739,45 +668,10 @@ class ObjectHelper {
else {
$ingestObject = '&nbsp;';
}
$datastreams .= $ingestObject;
$objectListOut = '';
if (isset($objectList)) {
$object_list_fieldset = array(
'#title' => t('Items in this collection'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#value' => (isset($objectList) ? $objectList : ''), //collection list
);
$objectListOut = theme('fieldset', $object_list_fieldset);
}
} else {
//$collectionName='';
$collection_fieldset = array(
'#title' => "",
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#value' => $datastreams,
);
$objectListOut = ''; //no collection objects to show so don't show field set
}
$output = '';
switch (variable_get('fedora_object_display_title', ObjectHelper::$DISPLAY_ALWAYS)) {
case ObjectHelper :: $DISPLAY_NEVER: break;
case ObjectHelper :: $DISPLAY_NO_MODEL_OUTPUT:
if (trim($datastreams) == '') {
$output .= '<strong>' . $collectionName . '</strong><br/>';
}
break;
$datastreams .= $ingestObject;
case ObjectHelper :: $DISPLAY_ALWAYS:
default:
$output .= '<strong>' . $collectionName . '</strong><br/>';
break;
}
$output .= $datastreams;
@ -808,19 +702,6 @@ class ObjectHelper {
$output .= theme('fieldset', $fieldset);
}
switch (variable_get('fedora_collection_display_list', ObjectHelper::$DISPLAY_ALWAYS)) {
case ObjectHelper :: $DISPLAY_NEVER: break;
case ObjectHelper :: $DISPLAY_NO_MODEL_OUTPUT:
if (trim($datastreams) == '') {
$output .= $objectListOut . '<br/>';
}
break;
case ObjectHelper :: $DISPLAY_ALWAYS:
default:
$output .= $objectListOut . '<br/>';
break;
}
return $output;
}
@ -873,7 +754,7 @@ class ObjectHelper {
* gets a list of datastreams and related function that we should use to show datastreams in their own fieldsets
* from the content model associated with the object
*/
function createExtraFieldsets($pid, $contentModel) {
function createExtraFieldsets($pid, $contentModel, $page_number) {
//$models = $collectionHelper->getContentModels($collectionPid, FALSE);
// possible problem in below if the collection policy has multiple content models
//with different pids but same dsid we could get wrong one, low probability and functionality
@ -884,7 +765,7 @@ class ObjectHelper {
$output = '';
module_load_include('inc', 'fedora_repository', 'ContentModel');
if (($cm = ContentModel :: loadFromModel($contentModel)) !== FALSE && $cm->validate()) {
$output .= $cm->displayExtraFieldset($pid);
$output .= $cm->displayExtraFieldset($pid, $page_number);
}
return $output;
}

2
api/fedora_item.inc

@ -299,7 +299,7 @@ class Fedora_Item {
$content = trim($content);
}
else {
$content = "";
$content = NULL;
}
return $content;
}

7
collection_views/demo_image_collection_dc_record.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd">
<dc:title>Demo Image Collection</dc:title>
<dc:identifier>islandora:demo_image_collection</dc:identifier>
<dc:description>Demo image collection</dc:description>
</oai_dc:dc>

66
collection_views/standard_jpeg_collection_view.xml

@ -0,0 +1,66 @@
<xsl:stylesheet version="1.0" xmlns:s="http://www.w3.org/2001/sw/DataAccess/rf1/result" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:variable name="BASEURL">
<xsl:value-of select="$baseUrl"/>
</xsl:variable>
<xsl:variable name="collTitle" select="/s:sparql/s:results/s:result/s:collTitle"/>
<xsl:variable name="collDesc" select="/s:sparql/s:results/s:result/s:collDesc"/>
<center>
<font face="arial,helvetica">
<h2>
<xsl:value-of select="$collTitle"/>
<br/>
<i>
<xsl:value-of select="$collDesc"/>
</i>
</h2>
</font>
</center>
<hr size="1"/>
<center>
<table border="0" cellpadding="5">
<xsl:for-each select="/s:sparql/s:results/s:result">
<xsl:variable name="pid" select="substring-after(s:member/@uri, '/')"/>
<tr>
<td>
<center>
<a>
<xsl:attribute name="href">
<xsl:value-of select="$BASEURL"/>
<xsl:text>/fedora/repository/</xsl:text>
<xsl:value-of select="$pid"/>
<xsl:text>/FULL_SIZE</xsl:text>
</xsl:attribute>
<img height="120" width="160">
<xsl:attribute name="src">
<xsl:value-of select="$BASEURL"/>
<xsl:text>/fedora/repository/</xsl:text>
<xsl:value-of select="$pid"/>
<xsl:text>/MEDIUM_SIZE</xsl:text>
</xsl:attribute>
</img>
<br/>
( Full Size )
</a>
</center>
</td>
<td>
<b>
<a>
<xsl:attribute name="href">
<xsl:value-of select="$BASEURL"/>
<xsl:text>/fedora/repository/</xsl:text>
<xsl:value-of select="$pid"/>/-/<xsl:value-of select="s:memberTitle"/>
</xsl:attribute>
<xsl:value-of select="s:memberTitle"/>
</a>
</b>
<br/>
<xsl:value-of select="s:memberDesc"/>
</td>
</tr>
</xsl:for-each>
</table>
</center>
</xsl:template>
</xsl:stylesheet>

1
content_models/COLLECTIONCM.xml

@ -1,4 +1,3 @@
<content_model xmlns="http://www.islandora.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Collection" version="2" xsi:schemaLocation="http://www.islandora.ca http://localhost/islandoracm.xsd">
<mimetypes>
<type>text/xml</type>

860
content_models/islandora_collectionCModel.xml

File diff suppressed because it is too large Load Diff

59
fedora_repository.module

@ -223,7 +223,6 @@ function fedora_repository_ingest_form_validate($form, &$form_state) {
function fedora_repository_ingest_form(&$form_state, $collection_pid, $collection_label = NULL, $content_model = NULL) {
module_load_include('inc', 'fedora_repository', 'formClass');
//$client = getSoapClient(variable_get('fedora_soap_manage_url', 'http://localhost:8080/fedora/services/management?wsdl'));
// For the sake of easily maintaining the module in different core versions create our own form_values variable.
if (empty($form_state['storage']['step'])) {
$form_state['storage']['step'] = 1;
@ -358,7 +357,7 @@ function add_stream_form_validate($form, &$form_state) {
return FALSE;
}
if (!(preg_match("/^[a-zA-Z]/", $dsid))) {
form_set_error('', t('Data stream ID has to start with a letter.'));
form_set_error('', t("Data stream ID ($dsid) has to start with a letter."));
return FALSE;
}
if (strlen($dsLabel) > 64) {
@ -434,11 +433,14 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) {
if (!empty($form_state['values']['referrer'])) {
$form_state['redirect'] = $form_state['values']['referrer'];
}
elseif (empty($collectionPid) && $_SESSION['fedora_collection'] != $pid) {
elseif (empty($collectionPid) && !empty($_SESSION['fedora_collection']) && $_SESSION['fedora_collection'] != $pid) {
$collectionPid = $_SESSION['fedora_collection'];
$form_state['redirect'] = "fedora/repository/$collectionPid/";
}
else {
$form_state['redirect'] = 'fedora/repository/';
}
}
}
@ -712,7 +714,7 @@ function makeObject($pid, $dsID) {
* if there is no query datastream falls back to the query shipped with the module.
* @return String
*/
function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $pageNumber = NULL, $limit = NULL) {
function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NULL, $page_number = NULL, $limit = NULL) {
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
module_load_include('inc', 'fedora_repository', 'api/fedora_utils');
global $user;
@ -762,19 +764,46 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
// $limit=20;
//}
module_load_include('inc', 'fedora_repository', 'ContentModel');
module_load_include('inc', 'fedora_repository', 'plugins/fedoraObject');
$breadcrumbs = array();
$objectHelper->getBreadcrumbs($pid, $breadcrumbs);
drupal_set_breadcrumb(array_reverse($breadcrumbs));
$offset = $limit * $pageNumber;
$results = $collectionClass->getRelatedObjects($pid, $limit, $offset, NULL); //updated so we can do paging in query not in xslt
$offset = $limit * $page_number;
//$results = $collectionClass->getRelatedObjects($pid, $limit, $offset, NULL); //updated so we can do paging in query not in xslt
//$results = $collectionClass->getRelatedItems($pid, NULL);
$content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber);
$content_models = $objectHelper->get_content_models_list($pid);
// Each content model may return either a tabset array or plain HTML. If it's HTML, stick it in a tab.
$cmodels_tabs = array(
'#type' => 'tabset',
);
foreach ($content_models as $content_model) {
//$content_model_fieldsets = $objectHelper->createExtraFieldsets($pid, $content_model, $pageNumber);
$content_model_fieldset = $content_model->displayExtraFieldset($pid, $page_number);
if (is_array($content_model_fieldset)) {
$cmodels_tabs = array_merge($cmodels_tabs, $content_model_fieldset);
}
else {
$cmodels_tabs[$content_model->pid] = array(
'#type' => 'tabpage',
'#title' => $content_model->name,
'#content' => $content_model_fieldset,
);
}
}
// Add a 'manage object' tab for all objects, where detailed list of content is shown.
$obj = new FedoraObject($pid);
$object_details = $obj->showFieldSets();
$cmodels_tabs = array_merge($cmodels_tabs, $object_details);
//$content .= $objectHelper
//$content .= $objectHelper->parseContent($results, $pid, $dsId, $collection, $pageNumber);
//the below is for islandlives we should be able to do this in the xslt though
//$css=$path.'/stylesheets/container-large.css';
//drupal_add_css($css);
return $content . '</div>';
return tabs_render($cmodels_tabs) . '</div>';
}
function fedora_repository_urlencode_string($str) {
@ -1548,11 +1577,16 @@ function fedora_repository_required_fedora_objects() {
),
array (
'dsid' => 'COLLECTION_VIEW',
'datastream_file' => "$module_path/collection_views/SmileyStuff-COLLECTION_VIEW.xml",
'datastream_file' => "$module_path/collection_views/standard_jpeg_collection_view.xml",
),
array (
'dsid' => 'QUERY',
'datastream_file' => "$module_path/collection_views/standard_jpeg_collection_query.txt",
'mimetype' => 'text/plain',
),
array (
'dsid' => 'DC',
'datastream_file' => "$module_path/collection_views/demo_image_collection_dc_record.xml",
),
),
),
@ -1946,10 +1980,15 @@ function fedora_repository_batch_reingest_object($object, &$context) {
$new_item->add_relationship('isMemberOfCollection', $object['parent']);
}
foreach($datastreams as $ds) {
if ($ds['dsid'] == 'DC') {
$new_item->modify_datastream_by_value(file_get_contents($ds['datastream_file']), $ds['dsid'], $ds['label'], 'text/xml');
}
else {
$new_item->add_datastream_from_file($ds['datastream_file'], $ds['dsid'], !empty($ds['label']) ? $ds['label'] : '', !empty($ds['mimetype']) ? $ds['mimetype'] : 'text/xml');
}
}
}
}
}
/**

40
formClass.inc

@ -615,12 +615,12 @@ class formClass {
if (!empty($content_models)) {
foreach ($content_models as $content_model) {
if (($cm = ContentModel::loadFromModel($content_model)) !== FALSE) {
$newElements = $cm->listDatastreams();
$newElements = $content_model->listDatastreams();
if (!empty($newElements)) {
$available_dsids = array_merge($available_dsids, $newElements);
}
}
}
}
@ -709,7 +709,9 @@ class formClass {
'#weight' => '-1',
'#description' => t('Datastream IDs defined by the content model.'),
);
$form['stream_id']['#options'] = $dsidsForForm;
$form['stream_id']['#options'] = array_combine($unused_dsids, $unused_dsids);
}
else {
$form['stream_id'] = array(
@ -850,35 +852,5 @@ class formClass {
return $form;
}
/*
function createReplaceDataStreamForm($pid, $dsId, &$form_state) {
$form = array();
$form['#attributes']['enctype'] = 'multipart/form-data';
$form['file'] = array(
'#type' => 'file',
'#title' => t('Upload Document'),
'#description' => t('The file to upload.')
);
$form['pid'] = array(
'#type' => 'value',
'#value' => $pid,
);
$form['dsId'] = array(
'#type' => 'value',
'#value' => $dsId,
);
$form['submit']=array(
'#type' => 'submit',
'#value'=>t('Replace Datastream')
);
return $form;
}
*/
}

16
ilives/book.inc

@ -171,10 +171,6 @@ class IslandoraBook {
$tabset = array();
$tabset['my_tabset'] = array(
'#type' => 'tabset',
);
global $user;
$qs = '';
if ($user->uid != 0) {
@ -183,12 +179,12 @@ class IslandoraBook {
$viewer_url = variable_get('fedora_base_url', '') . '/get/'. $this->pid . '/ilives:viewerSdef/getViewer'. $qs;
$html = '<iframe src="'. $viewer_url . '" scrolling="0" frameborder="0" style="width: 100%; height: 800px;">Errors: unable to load viewer</iframe>';
$tabset['my_tabset']['second_tab'] = array(
$tabset['second_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Full-size'),
'#title' => t('Read'),
'#content' => $html
);
$tabset['my_tabset']['first_tab'] = array(
$tabset['first_tab'] = array(
// #type and #title are the minimum requirements.
'#type' => 'tabpage',
'#title' => t('Description'),
@ -196,12 +192,14 @@ class IslandoraBook {
'#content' => fedora_ilives_create_book_view($this->pid),
);
$tabset['my_tabset']['add_pages'] = array(
if (user_access('ingest new fedora objects')) {
$tabset['add_pages'] = array(
'#type' => 'tabpage',
'#title' => t('Add pages'),
'#content' => drupal_get_form('book_add_pages_form', $this->pid),
);
return tabs_render($tabset);
}
return $tabset;
}
}

BIN
images/48px-Crystal_Clear_app_download_manager.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
images/Crystal_Clear_app_download_manager.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

300
installer_files/foxml/islandora-collectionCModel.xml

@ -5,11 +5,11 @@
<foxml:property NAME="info:fedora/fedora-system:def/model#state" VALUE="Active"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#label" VALUE="Islandora Collection Content Model"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#ownerId" VALUE="fedoraAdmin"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2009-02-17T16:49:02.191Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2010-09-15T11:47:31.885Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/model#createdDate" VALUE="2011-01-24T20:34:53.430Z"/>
<foxml:property NAME="info:fedora/fedora-system:def/view#lastModifiedDate" VALUE="2011-01-24T20:34:54.711Z"/>
</foxml:objectProperties>
<foxml:datastream CONTROL_GROUP="X" ID="AUDIT" STATE="A" VERSIONABLE="false">
<foxml:datastreamVersion CREATED="2009-02-17T16:49:02.191Z"
<foxml:datastreamVersion CREATED="2011-01-24T20:34:53.430Z"
FORMAT_URI="info:fedora/fedora-system:format/xml.fedora.audit" ID="AUDIT.0" LABEL="Audit Trail for this object" MIMETYPE="text/xml">
<foxml:xmlContent>
<audit:auditTrail xmlns:audit="info:fedora/fedora-system:def/audit#">
@ -17,174 +17,40 @@
<audit:process type="Fedora API-M"/>
<audit:action>ingest</audit:action>
<audit:componentID/>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2009-02-17T16:49:02.191Z</audit:date>
<audit:justification>Created with Admin GUI "New Object" command</audit:justification>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2011-01-24T20:34:53.430Z</audit:date>
<audit:justification>Fedora Object Ingested</audit:justification>
</audit:record>
<audit:record ID="AUDREC2">
<audit:process type="Fedora API-M"/>
<audit:action>modifyDatastreamByValue</audit:action>
<audit:componentID>DS-COMPOSITE-MODEL</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2009-02-17T16:50:04.876Z</audit:date>
<audit:justification/>
<audit:action>addDatastream</audit:action>
<audit:componentID>RELS-EXT</audit:componentID>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2011-01-24T20:34:54.112Z</audit:date>
<audit:justification>Ingested object RELS-EXT</audit:justification>
</audit:record>
<audit:record ID="AUDREC3">
<audit:process type="Fedora API-M"/>
<audit:action>addDatastream</audit:action>
<audit:componentID>ISLANDORACM</audit:componentID>
<audit:responsibility>ppound</audit:responsibility>
<audit:date>2009-02-26T17:23:07.848Z</audit:date>
<audit:justification>datastream added</audit:justification>
<audit:action>modifyDatastreamByValue</audit:action>
<audit:componentID>RELS-EXT</audit:componentID>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2011-01-24T20:34:54.528Z</audit:date>
<audit:justification>Modified by Islandora API</audit:justification>
</audit:record>
<audit:record ID="AUDREC4">
<audit:process type="Fedora API-M"/>
<audit:action>purgeDatastream</audit:action>
<audit:componentID>ISLANDORACM</audit:componentID>
<audit:responsibility>ppound</audit:responsibility>
<audit:date>2009-02-26T17:24:28.067Z</audit:date>
<audit:justification>Purged . . . Purged datastream (ID=ISLANDORACM), versions ranging from the beginning of time to the end of time. This resulted in the permanent removal of 1 datastream version(s) (2009-02-26T13:23:07.848Z) and all associated audit records.</audit:justification>
</audit:record>
<audit:record ID="AUDREC5">
<audit:process type="Fedora API-M"/>
<audit:action>addDatastream</audit:action>
<audit:componentID>ISLANDORACM</audit:componentID>
<audit:responsibility>ppound</audit:responsibility>
<audit:date>2009-02-26T17:27:10.814Z</audit:date>
<audit:justification>datastream added</audit:justification>
</audit:record>
<audit:record ID="AUDREC6">
<audit:process type="Fedora API-M"/>
<audit:action>purgeDatastream</audit:action>
<audit:componentID>ISLANDORACM</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2009-02-26T17:37:58.880Z</audit:date>
<audit:justification>DatastreamPane generated this logMessage. . . . Purged datastream (ID=ISLANDORACM), versions ranging from 2009-02-26T13:27:10.814Z to 2009-02-26T13:27:10.814Z. This resulted in the permanent removal of 1 datastream version(s) (2009-02-26T13:27:10.814Z) and all associated audit records.</audit:justification>
</audit:record>
<audit:record ID="AUDREC7">
<audit:process type="Fedora API-M"/>
<audit:action>addDatastream</audit:action>
<audit:componentID>test</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2009-02-26T19:02:49.879Z</audit:date>
<audit:justification>DatastreamsPane generated this logMessage.</audit:justification>
</audit:record>
<audit:record ID="AUDREC8">
<audit:process type="Fedora API-M"/>
<audit:action>purgeDatastream</audit:action>
<audit:componentID>test</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2009-02-26T19:03:04.069Z</audit:date>
<audit:justification>DatastreamPane generated this logMessage. . . . Purged datastream (ID=test), versions ranging from 2009-02-26T15:02:49.879Z to 2009-02-26T15:02:49.879Z. This resulted in the permanent removal of 1 datastream version(s) (2009-02-26T15:02:49.879Z) and all associated audit records.</audit:justification>
</audit:record>
<audit:record ID="AUDREC9">
<audit:process type="Fedora API-M"/>
<audit:action>addDatastream</audit:action>
<audit:componentID>ISLANDORACM</audit:componentID>
<audit:responsibility>ppound</audit:responsibility>
<audit:date>2009-02-26T19:03:36.147Z</audit:date>
<audit:justification>datastream added</audit:justification>
</audit:record>
<audit:record ID="AUDREC10">
<audit:process type="Fedora API-M"/>
<audit:action>addDatastream</audit:action>
<audit:componentID>ISLANDORACM</audit:componentID>
<audit:responsibility>plux</audit:responsibility>
<audit:date>2009-03-13T19:11:44.755Z</audit:date>
<audit:justification>datastream added</audit:justification>
</audit:record>
<audit:record ID="AUDREC11">
<audit:process type="Fedora API-M"/>
<audit:action>modifyDatastreamByReference</audit:action>
<audit:componentID>ISLANDORACM</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-01-26T21:10:29.212Z</audit:date>
<audit:justification/>
</audit:record>
<audit:record ID="AUDREC12">
<audit:process type="Fedora API-M"/>
<audit:action>modifyDatastreamByReference</audit:action>
<audit:componentID>ISLANDORACM</audit:componentID>
<audit:responsibility>fedoraAdmin</audit:responsibility>
<audit:date>2010-09-15T11:47:31.885Z</audit:date>
<audit:justification/>
<audit:responsibility>admin</audit:responsibility>
<audit:date>2011-01-24T20:34:54.711Z</audit:date>
<audit:justification>Ingested object ISLANDORACM</audit:justification>
</audit:record>
</audit:auditTrail>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2009-02-17T16:49:02.248Z" FORMAT_URI="info:fedora/fedora-system:FedoraRELSExt-1.0"
ID="RELS-EXT1.0" LABEL="RDF Statements about this object" MIMETYPE="application/rdf+xml" SIZE="370">
<foxml:xmlContent>
<rdf:RDF xmlns:fedora-model="info:fedora/fedora-system:def/model#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:collectionCModel">
<fedora-model:hasModel rdf:resource="info:fedora/fedora-system:ContentModel-3.0"/>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="X" ID="DS-COMPOSITE-MODEL" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2009-02-17T16:49:02.248Z"
FORMAT_URI="info:fedora/fedora-system:FedoraDSCompositeModel-1.0" ID="DS-COMPOSITE-MODEL1.0"
LABEL="Datastream Composite Model" MIMETYPE="text/xml" SIZE="1148">
<foxml:xmlContent>
<dsCompositeModel xmlns="info:fedora/fedora-system:def/dsCompositeModel#">
<comment xmlns="info:fedora/fedora-system:def/comment#">
This DS-COMPOSITE-MODEL datastream is included as a starting point to
assist in the creation of a content model. The DS-COMPOSITE-MODEL
should define the datastreams that are required for any objects
conforming to this content model.
For more information about content models, see:
$FEDORA_HOME/docs/userdocs/digitalobjects/objectModel.html#CMODEL.
For examples of completed content model objects, see the demonstration
objects included with your Fedora distribution, such as:
demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection,
demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC.
For more information about the demonstration objects, see:
$FEDORA_HOME/docs/userdocs/distribution/demos.html
</comment>
<dsTypeModel ID="DSID">
<form MIME="text/xml"/>
</dsTypeModel>
</dsCompositeModel>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion CREATED="2009-02-17T16:50:04.876Z"
FORMAT_URI="info:fedora/fedora-system:FedoraDSCompositeModel-1.0" ID="DS-COMPOSITE-MODEL.1"
LABEL="Datastream Composite Model" MIMETYPE="text/xml" SIZE="1416">
<foxml:xmlContent>
<dsCompositeModel xmlns="info:fedora/fedora-system:def/dsCompositeModel#">
<comment xmlns="info:fedora/fedora-system:def/comment#">
This DS-COMPOSITE-MODEL datastream is included as a starting point to
assist in the creation of a content model. The DS-COMPOSITE-MODEL
should define the datastreams that are required for any objects
conforming to this content model.
For more information about content models, see:
$FEDORA_HOME/docs/userdocs/digitalobjects/objectModel.html#CMODEL.
For examples of completed content model objects, see the demonstration
objects included with your Fedora distribution, such as:
demo:CMImage, demo:UVA_STD_IMAGE, demo:DualResImageCollection,
demo:TEI_TO_PDFDOC, and demo:XML_TO_HTMLDOC.
For more information about the demonstration objects, see:
$FEDORA_HOME/docs/userdocs/distribution/demos.html
</comment>
<dsTypeModel ID="COLLECTION_VIEW">
<form MIME="text/xml"/>
</dsTypeModel>
<dsTypeModel ID="COLLECTION_POLICY" ORDERED="false">
<form MIME="text/xml"/>
</dsTypeModel>
<dsTypeModel ID="CHILD_SECURITY" ORDERED="false">
<form MIME="text/xml"/>
</dsTypeModel>
</dsCompositeModel>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="X" ID="DC" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2009-02-17T16:49:02.191Z" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/"
<foxml:datastreamVersion CREATED="2011-01-24T20:34:53.430Z" FORMAT_URI="http://www.openarchives.org/OAI/2.0/oai_dc/"
ID="DC1.0" LABEL="Dublin Core Record for this object" MIMETYPE="text/xml" SIZE="413">
<foxml:xmlContent>
<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/"
@ -196,21 +62,121 @@
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="M" ID="ISLANDORACM" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2009-03-13T19:11:44.755Z" FORMAT_URI="URL" ID="ISLANDORACM.0"
LABEL="ISLANDORACM.xml" MIMETYPE="text/xml">
<foxml:contentLocation
REF="http://137.149.200.4:8080/fedora/get/islandora:collectionCModel/ISLANDORACM/2009-03-13T19:11:44.755Z" TYPE="INTERNAL_ID"/>
<foxml:datastream CONTROL_GROUP="X" ID="RELS-EXT" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2011-01-24T20:34:54.112Z" ID="RELS-EXT.0"
LABEL="Fedora object-to-object relationship metadata" MIMETYPE="text/xml" SIZE="167">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:collectionCModel"/>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion CREATED="2010-01-26T21:10:29.212Z" FORMAT_URI="URL" ID="ISLANDORACM.1"
LABEL="ISLANDORACM.xml" MIMETYPE="text/xml">
<foxml:contentLocation
REF="http://137.149.200.4:8080/fedora/get/islandora:collectionCModel/ISLANDORACM/2010-01-26T21:10:29.212Z" TYPE="INTERNAL_ID"/>
<foxml:datastreamVersion CREATED="2011-01-24T20:34:54.528Z" ID="RELS-EXT.1"
LABEL="Fedora Object-to-Object Relationship Metadata" MIMETYPE="text/xml" SIZE="299">
<foxml:xmlContent>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description rdf:about="info:fedora/islandora:collectionCModel">
<hasModel rdf:resource="info:fedora/fedora-system:ContentModel-3.0" xmlns="info:fedora/fedora-system:def/model#"/>
</rdf:Description>
</rdf:RDF>
</foxml:xmlContent>
</foxml:datastreamVersion>
<foxml:datastreamVersion CREATED="2010-09-15T11:47:31.885Z" FORMAT_URI="URL" ID="ISLANDORACM.2"
LABEL="ISLANDORACM.xml" MIMETYPE="text/xml">
<foxml:contentLocation
REF="http://137.149.200.4:8080/fedora/get/islandora:collectionCModel/ISLANDORACM/2010-09-15T11:47:31.885Z" TYPE="INTERNAL_ID"/>
</foxml:datastream>
<foxml:datastream CONTROL_GROUP="X" ID="ISLANDORACM" STATE="A" VERSIONABLE="true">
<foxml:datastreamVersion CREATED="2011-01-24T20:34:54.711Z" ID="ISLANDORACM.0" LABEL="Islandora Content Model.xml"
MIMETYPE="application/xml" SIZE="4646">
<foxml:xmlContent>
<content_model name="Collection" xmlns="http://www.islandora.ca"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.islandora.ca http://localhost/islandoracm.xsd">
<mimetypes>
<type>text/xml</type>
<type>text/plain</type>
<type>application/xml</type>
</mimetypes>
<ingest_rules/>
<datastreams>
<datastream dsid="DC">
<display_method class="CollectionClass" file="CollectionClass.inc" method="showFieldSets" module=""/>
</datastream>
<datastream dsid="TN"/>
<datastream dsid="COLLECTION_POLICY"/>
</datastreams>
<ingest_form dsid="QDC" page="2">
<form_builder_method class="CollectionFormBuilder" file="plugins/CollectionFormBuilder.inc"
handler="handleQDCForm" method="buildQDCForm" module=""/>
<form_elements>
<element label="Title/Caption/Object Name" name="dc:title" required="true" type="textfield">
<description>The name given to the resource</description>
</element>
<element label="Creator/Photographer/Author" name="dc:creator" type="textfield">
<description>An entity primarily responsible for making the content of the resource such as a person, organization or service.</description>
</element>
<element label="Subject" name="dc:subject" type="select">
<description>An entity primarily responsible for making the content of the resource such as a person, organization or service.</description>
<authoritative_list>
<item>none</item>
<item>Multi Media</item>
<item>image</item>
<item>meeting</item>
<item>presentation</item>
<item>sound</item>
<item>text</item>
</authoritative_list>
</element>
<element label="Description" name="dc:description" required="true" type="textarea">
<description>Examples include an abstract, table of contents, or free-text account of the content of the resource.</description>
</element>
<element label="Publisher" name="dc:publisher" type="textfield">
<description>An entity, (including persons, organizations, or services), responsible for making the resource available.</description>
</element>
<element label="Contributor" name="dc:contributor" type="textfield">
<description>An entity responsible for contributing to the content of the resource such as a person, organization or service.</description>
</element>
<element label="Date" name="dc:date" type="textfield">
<description>Temporal scope of the content if known. Date format is YYYY-MM-DD (e.g. 1890,1910-10,or 2007-10-23)</description>
</element>
<element label="Resource Type" name="dc:type" type="select">
<description>Genre of the content of the resource. Examples include: home page, novel, poem, working paper, technical report, essay, dictionary.</description>
<authoritative_list>
<item>none</item>
<item>collection</item>
<item>dataset</item>
<item>event</item>
<item>image</item>
<item>interactive resource</item>
<item>model</item>
<item>party</item>
<item>physical object</item>
<item>place</item>
<item>service</item>
<item>software</item>
<item>sound</item>
<item>text</item>
</authoritative_list>
</element>
<element label="Source" name="dc:source" type="textfield">
<description>A reference to a resource from which the present resource is derived.</description>
</element>
<element label="Identifier" name="dc:identifier" type="textfield">
<description>A unique reference to the resource; In this instance, the accession number or collection number.</description>
</element>
<element label="Language" name="dc:language" type="select">
<description>The language of the intellectual content of the resource.</description>
<authoritative_list>
<item field="eng">English</item>
<item field="fre">French</item>
</authoritative_list>
</element>
<element label="Relation" name="dc:relation" type="textfield">
<description>Reference to a related resource.</description>
</element>
<element label="Rights Management" name="dc:rights" type="textarea">
<description>Information about intellectual property rights, copyright, and various property rights.</description>
</element>
</form_elements>
</ingest_form>
</content_model>
</foxml:xmlContent>
</foxml:datastreamVersion>
</foxml:datastream>
</foxml:digitalObject>

46
plugins/ShowStreamsInFieldSets.inc

@ -57,19 +57,48 @@ class ShowStreamsInFieldSets {
*/
function showPDFPreview() {
global $base_url;
global $base_path;
global $user;
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
$tabset = array();
$tabset['my_tabset'] = array(
$tabset['first_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Description'),
);
$tabset['first_tab']['tabs'] = array(
'#type' => 'tabset',
);
$tabset['my_tabset']['first_tab'] = array(
$objectHelper = new ObjectHelper();
$item = new Fedora_Item($this->pid);
if (key_exists('TN', $item->datastreams)) {
$tn_url = $base_url.'/fedora/repository/'.$item->pid.'/TN';
}
else {
$tn_url = $base_path.drupal_get_path('module', 'fedora_repository').'/images/Crystal_Clear_app_download_manager.png';
}
$dc_html = $objectHelper->getFormattedDC($item);
$dl_link = l('<div style="float:left; padding: 10px"><img src="'.$tn_url.'"><br />View Document</div>', '/fedora/repository/'.$this->pid.'/OBJ', array('html' => TRUE));
$tabset['first_tab']['tabs']['view'] = array(
'#type' => 'tabpage',
'#title' => t('Description'),
'#content' => $this->showQdc(),
'#title' => t('View'),
'#content' => $dl_link . $dc_html,
);
$tabset['my_tabset']['second_tab'] = array(
// $collection_fieldset = array (
if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) {
$editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC');
$tabset['first_tab']['tabs']['edit'] = array(
'#type' => 'tabpage',
'#title' => t('Edit'),
'#content' => $editform,
);
}
$tabset['second_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Read Online'),
'#content' => "<iframe src=\"http://docs.google.com/viewer?url=". $base_url . '/fedora/repository/'.
@ -77,10 +106,7 @@ class ShowStreamsInFieldSets {
);
// Render the tabset.
return tabs_render($tabset);
return theme('fieldset', $collection_fieldset);
// . (user_access('add fedora datastreams') ? drupal_get_form('fedora_ilives_image_tagging_form', $this->pid) : '');
return $tabset;
}

50
plugins/fedoraObject.inc

@ -0,0 +1,50 @@
<?php
class FedoraObject {
function __construct($pid = '') {
module_load_include('inc', 'fedora_repository', 'api/fedora_item');
if (!empty($pid)) {
$this->pid = $pid;
$this->item = new Fedora_Item($pid);
}
}
public function showFieldSets() {
global $user;
$objectHelper = new ObjectHelper();
$tabset = array();
$show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_purge_object_form');
$purge_form = drupal_get_form('fedora_repository_purge_object_form', $this->pid, check_plain(substr(request_uri(), strlen(base_path()))));
$tabset['fedora_object_details'] = array(
'#type' => 'tabpage',
'#title' => t('Object Details'),
'#selected' => $show_purge_tab,
);
$tabset['fedora_object_details']['tabset'] = array(
'#type' => 'tabset',
);
$dc_html = $objectHelper->getFormattedDC($this->item);
$ds_list = $objectHelper->getFormattedDatastreamList($this->pid, NULL, $this->item);
$tabset['fedora_object_details']['tabset']['view'] = array(
'#type' => 'tabpage',
'#title' => t('View'),
'#content' => $dc_html . $ds_list . $purge_form,
);
if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) {
$editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DC');
$tabset['fedora_object_details']['tabset']['edit'] = array(
'#type' => 'tabpage',
'#title' => t('Edit'),
'#content' => $editform,
);
}
return $tabset;
}
}

23
plugins/herbarium.inc

@ -107,10 +107,6 @@ class Herbarium {
$tabset = array();
$tabset['my_tabset'] = array(
'#type' => 'tabset',
);
global $user;
$qs = '';
if ($user->uid != 0) {
@ -119,13 +115,13 @@ class Herbarium {
$viewer_url = variable_get('fedora_base_url', '') . '/get/'. $this->pid . '/ilives:viewerSdef/getViewer'. $qs;
$html = '<iframe src="'. $viewer_url . '" scrolling="no" frameborder="0" style="width: 100%; height: 800px;">Errors: unable to load viewer</iframe>';
$tabset['my_tabset']['second_tab'] = array(
$tabset['second_tab'] = array(
// $collection_fieldset = array (
'#type' => 'tabpage',
'#title' => t('Full-size'),
'#content' => $html
);
$tabset['my_tabset']['first_tab'] = array(
$tabset['first_tab'] = array(
// #type and #title are the minimum requirements.
'#type' => 'tabpage',
'#title' => t('View'),
@ -135,15 +131,15 @@ class Herbarium {
);
$dwc = new DarwinCore($this->item);
$tabset['my_tabset']['third_tab'] = array(
$tabset['third_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Description'),
);
$tabset['my_tabset']['third_tab']['tabset'] = array(
$tabset['third_tab']['tabset'] = array(
'#type' => 'tabset',
);
$tabset['my_tabset']['third_tab']['tabset']['view'] = array(
$tabset['third_tab']['tabset']['view'] = array(
'#type' => 'tabpage',
'#title' => t('Darwin Core'),
'#content' => $dwc->asHTML(),
@ -152,17 +148,17 @@ class Herbarium {
$obj = new ObjectHelper();
if (fedora_repository_access(OBJECTHELPER :: $EDIT_FEDORA_METADATA, $this->pid, $user)) {
$editform = drupal_get_form('fedora_repository_edit_qdc_form', $this->pid, 'DARWIN_CORE');
$tabset['my_tabset']['third_tab']['tabset']['edit'] = array(
$tabset['third_tab']['tabset']['edit'] = array(
'#type' => 'tabpage',
'#title' => t('Edit'),
'#content' => $editform,
);
$tabset['my_tabset']['third_tab']['tabset']['source'] = array(
$tabset['third_tab']['tabset']['source'] = array(
'#type' => 'tabpage',
'#title' => t('Vew Source'),
);
$xmlsrc = $dwc->asXML();
$tabset['my_tabset']['third_tab']['tabset']['source']['srctext'] = array(
$tabset['third_tab']['tabset']['source']['srctext'] = array(
'#name' => 'source',
'#type' => 'textarea',
'#value' => $xmlsrc,
@ -170,7 +166,6 @@ class Herbarium {
'#height' => 50,
);
}
return tabs_render($tabset);
return $tabset;
}
}

9
plugins/map_viewer.inc

@ -38,18 +38,17 @@ class ShowMapStreamsInFieldSets {
$tabset['my_tabset']['second_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Full-size'),
'#content' => $html//'<div class="iiv"></div>'
'#content' => $html,
);
$objectHelper = new ObjectHelper();
$item = new Fedora_Item($this->pid);
$tabset['my_tabset']['third_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Description'),
'#content' => $item->get_dissemination('islandora:mods2htmlSdef', 'mods2html'),
'#content' => $item->get_dissemination('islandora:mods2htmlSdef', 'mods2html')
. $objectHelper->getFormattedDatastreamList($this->pid, NULL, $item),
);
// Render the tabset.
return tabs_render($tabset);
return theme('fieldset', $collection_fieldset);
}
}

24
plugins/slide_viewer.inc

@ -14,17 +14,12 @@ class ShowSlideStreamsInFieldSets {
module_load_include('inc', 'fedora_repository', 'plugins/tagging_form');
module_load_include('inc', 'fedora_repository', 'plugins/ShowStreamsInFieldSets');
global $base_url;
global $user;
$tabset = array();
$tabset['my_tabset'] = array(
'#type' => 'tabset',
);
global $user;
$qs = '';
if ($user->uid != 0) {
// $qs = '?uid=' . base64_encode($user->name . ':' . $user->sid);
$qs = '?uid=' . base64_encode($user->name . ':' . $user->pass);
}
@ -33,13 +28,12 @@ class ShowSlideStreamsInFieldSets {
drupal_add_css(path_to_theme() . '/header-viewer.css', 'theme');
$tabset['my_tabset']['second_tab'] = array(
// $collection_fieldset = array (
$tabset['second_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Full-size'),
'#content' => $html);
$tabset['my_tabset']['first_tab'] = array(
$tabset['first_tab'] = array(
// #type and #title are the minimum requirements.
'#type' => 'tabpage',
'#title' => t('View'),
@ -48,16 +42,6 @@ class ShowSlideStreamsInFieldSets {
'/fedora/imageapi/'. $this->pid . '/JPG/JPG.jpg'. '" />'. '<p>'. drupal_get_form('fedora_repository_image_tagging_form', $this->pid) . '</p>',
);
$ssifs = new ShowStreamsInFieldSets($this->pid);
$tabset['my_tabset']['third_tab'] = array(
'#type' => 'tabpage',
'#title' => t('Description'),
'#content' => $ssifs->showQdc(),
);
// Render the tabset.
return tabs_render($tabset);
return theme('fieldset', $collection_fieldset);
// . (user_access('add fedora datastreams') ? drupal_get_form('fedora_ilives_image_tagging_form', $this->pid) : '');
return $tabset;
}
}

Loading…
Cancel
Save