';
-
- module_load_include('inc', 'fedora_repository', 'CollectionClass');
- $collectionClass = new CollectionClass();
- module_load_include('inc', 'fedora_repository', 'ContentModel');
- module_load_include('inc', 'fedora_repository', 'plugins/FedoraObjectDetailedContent');
$breadcrumbs = array();
$objectHelper->getBreadcrumbs($pid, $breadcrumbs);
drupal_set_breadcrumb(array_reverse($breadcrumbs));
+
+ drupal_set_title(truncate_utf8($item->objectProfile->objLabel, 56, TRUE, TRUE));
- $offset = $limit * $page_number;
$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',
+
+ //Get the tabs from all modules...
+ $hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid, $page_number);
+
+ $cmodels_tabs = array(
+ '#type' => 'tabset',
);
- foreach ($content_models as $content_model) {
- $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,
- );
- }
- }
+ $cmodels_tabs += $hook_tabs;
-// Add a 'manage object' tab for all objects, where detailed list of content is shown.
- $obj = new FedoraObjectDetailedContent($pid);
+ //Assemble parameters, to pass during alter
+ $params = array(
+ 'content_models' => $content_models,
+ 'pid' => $pid,
+ 'page' => $page_number,
+ );
+
+ //Allow returned tabs to be altered, before return.
+ drupal_alter('islandora_tabs', $cmodels_tabs, $params);
- //can disable showing the object details tab in admin UI
- if (variable_get('fedora_repository_show_object_details_tab', TRUE)) {
- $object_details = $obj->showFieldSets();
- if ($object_details['fedora_object_details']['#selected'] == TRUE) {
- foreach ($cmodels_tabs as &$cmodel_tab) {
- if (is_array($cmodel_tab)) {
- $cmodel_tab['#selected'] = FALSE;
- }
- }
- }
- }
- else {
- $object_details = array();
- }
-
- $hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid);
- $cmodels_tabs = array_merge($cmodels_tabs, $object_details, $hook_tabs);
-
return tabs_render($cmodels_tabs);
}
@@ -1059,7 +1156,6 @@ function fedora_repository_urlencode_string($str) {
* @return type
*/
function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) {
- global $user;
module_load_include('inc', 'fedora_repository', 'ObjectHelper');
if ($pid == NULL || $dsId == NULL) {
@@ -1068,7 +1164,7 @@ function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) {
}
$objectHelper = new ObjectHelper();
- $objectHelper->makeObject($pid, $dsId, 1, $label, FALSE, $version);
+ $objectHelper->makeObject($pid, $dsId, TRUE, $label, FALSE, $version);
}
/**
@@ -2273,9 +2369,6 @@ function theme_fedora_repository_solution_packs_list($solution_packs) {
$header = array();
$rows = array();
-
-
-
drupal_add_css(drupal_get_path('module', 'update') . '/update.css');
return $output;
}
@@ -2294,3 +2387,87 @@ function fedora_repository_forms($form_id) {
}
return $forms;
}
+
+/**
+ * Implementation of hook_imagecache_default_presets().
+ */
+function fedora_repository_imagecache_default_presets() {
+ return array(
+ 'fedora_repository_collection_thumbnail' => array(
+ 'presetname' => 'fedora_repository_collection_thumbnail',
+ 'actions' => array(
+ 0 => array(
+ 'weight' => 0,
+ 'module' => 'imagecache',
+ 'action' => 'imagecache_scale',
+ 'data' => array(
+ 'width' => 200,
+ 'height' => 200,
+ 'upscale' => TRUE,
+ ),
+ ),
+ ),
+ ),
+ );
+}
+
+/**
+ * Actually render an image, given an arbitrary path and preset.
+ *
+ * Note: If imagecache_external is not available, the full-sized image will be
+ * produced... Might want to look into restricting the display size by adding
+ * the width and height attributes to the theme('image') call, based on the
+ * selected preset? (get the presets and figure out the size from its actions?)
+ *
+ * @param $tn_path string
+ * @param $imagecache_preset string
+ * @return
+ * Markup for the image, making use of imagecache_external if it is available.
+ */
+function _fedora_repository_render_image($tn_path, $imagecache_preset = 'fedora_repository_collection_thumbnail') {
+ $thumbnail = NULL;
+ if ($thumbnail === NULL &&
+ module_exists('imagecache_external') &&
+ is_callable('theme_imagecache_external_image') &&
+ variable_get('fedora_repository_use_imagecache_external_in_collection_view', FALSE) &&
+ imagecache_external_can_fetch($tn_path, TRUE)) {
+ $thumbnail = theme('imagecache_external_image', $imagecache_preset, $tn_path, $truncated_title, $title);
+ }
+ if ($thumbnail === NULL) {
+ $thumbnail = theme('image', $tn_path, $truncated_title, $title, array(), FALSE);
+ }
+
+ return $thumbnail;
+}
+
+/**
+ * Render an image, given a PID, DSID and preset.
+ *
+ * Produces a Drupal path for the image, passes to
+ * _fedora_repository_render_image(), and returns the result.
+ *
+ * @see _fedora_repository_render_image()
+ * @param $pid string
+ * A string containing a Fedora PID.
+ * @param $dsid
+ * A string indicating a DSID on the object indicated by $pid.
+ * @param $imagecache_preset
+ * An imagecache preset with which to render the image; defaults to
+ * fedora_repository_collection_thumbnail, which is added in this module's
+ * implementation of hook_imagecache_default_presets().
+ */
+function fedora_repository_render_image($pid, $dsid, $imagecache_preset = 'fedora_repository_collection_thumbnail') {
+ $tn_path = "fedora/repository/$pid/$dsid";
+
+ return _fedora_repository_render_image($tn_path, $imagecache_preset);
+}
+
+/**
+ * Convenience function used in XSLT callback...
+ *
+ * @param $string string
+ * A string containing some markup to convert to a domnode.
+ */
+function fedora_repository_string_to_domnode($string) {
+ return DOMDocument::loadXML($string);
+}
diff --git a/formClass.inc b/formClass.inc
index 713f1fcb..c7d57843 100644
--- a/formClass.inc
+++ b/formClass.inc
@@ -179,6 +179,23 @@ class formClass {
'access arguments' => array('view fedora collection'),
);
+ $items['admin/settings/fedora_repository/object_details_xslt'] = array(
+ 'title' => "",
+ 'type' => MENU_CALLBACK,
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('fedora_repository_object_details_XSLT_config'),
+ 'file' => 'ObjectDetails.inc',
+ 'access arguments' => array('administer site configuration'),
+ );
+ $items['admin/settings/fedora_repository/object_details_table'] = array(
+ 'title' => "",
+ 'type' => MENU_CALLBACK,
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('fedora_repository_object_details_table_config'),
+ 'file' => 'ObjectDetails.inc',
+ 'access arguments' => array('administer site configuration'),
+ );
+
return $items;
}
@@ -233,7 +250,7 @@ class formClass {
theme('image', 'misc/watchdog-ok.png') . t('Successfully connected to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => variable_get('fedora_soap_url', ''))) :
theme('image', 'misc/watchdog-error.png') . t('Unable to connect to Fedora server at @fedora_soap_url', array('@fedora_soap_url' => variable_get('fedora_soap_url', '')))) . '',
);
-
+
$form['fedora_soap_manage_url'] = array(
'#type' => 'textfield',
'#title' => t('Fedora SOAP management URL'),
@@ -241,7 +258,7 @@ class formClass {
'#required' => TRUE,
'#weight' => -10
);
-
+
// will allow admin user to remove namepsace restrictions if not explicitly disallowed in settings.php
if (variable_get('allow_open_namespace', TRUE)) {
$form['fedora_namespace'] = array(
@@ -282,10 +299,11 @@ class formClass {
$form['tabs'] = array(
'#type' => 'fieldset',
'#title' => t('Tabs Configuration'),
- '#description' => t('Configure the tabs avaialble when viewing Fedora objects.'),
+ '#description' => t('Configure the tabs available when viewing Fedora objects.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
+
//when checked show object details tab
$form['tabs']['fedora_repository_show_object_details_tab'] = array(
'#type' => 'checkbox',
@@ -293,7 +311,27 @@ class formClass {
'#default_value' => variable_get('fedora_repository_show_object_details_tab', TRUE),
'#description' => t("When enabled, the 'Object Details' tab will be visible to users with the correct permissions when viewing an object in the repository"),
);
-
+
+ module_load_include('inc', 'fedora_repository', 'ObjectDetails');
+ $primary_display_mode = variable_get('islandora_object_details_display_table', 'xslt');
+ $profiles = module_invoke_all("islandora_object_details_display");
+
+ $display_options = array();
+ foreach ($profiles as $machine_name => $profile) {
+ $display_options[$machine_name] = $profile['name'];
+ $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(
+ '#type' => 'radios',
+ '#title' => t('Show object details as'),
+ '#options' => $display_options,
+ '#default_value' => $primary_display_mode,
+ '#description' => t("Tells Islandora how to display the object details page for each object"),
+ );
+
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced configuration options'),
@@ -323,6 +361,21 @@ class formClass {
'#default_value' => variable_get('fedora_object_restrict_datastreams', FALSE),
'#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(
+ '#type' => 'checkbox',
+ '#title' => t('Allow imagecache_external use for thumbnails in collection view'),
+ '#default_value' => variable_get('fedora_repository_use_imagecache_external_in_collection_view', FALSE),
+ '#description' => t('If enabled, the default collection list view (or ' .
+ 'anywhere the function "@function" is used) will try to use ' .
+ 'imagecache_external, defaulting to the "@preset" preset. XSLTs may ' .
+ 'be updated to use this function.',
+ array(
+ '@function' => '_fedora_repository_render_image()',
+ '@preset' => 'fedora_repository_collection_thumbnail',
+ '@xsl' => 'sparql_to_html.xsl',
+ )),
+ );
$form['advanced']['fedora_collection_display_list'] = array(
'#type' => 'select',
@@ -331,6 +384,13 @@ class formClass {
'#options' => array(ObjectHelper::$DISPLAY_ALWAYS => t('Always'), ObjectHelper::$DISPLAY_NEVER => t('Never'), ObjectHelper::$DISPLAY_NO_MODEL_OUTPUT => t('Only if no Content Model display output.')),
'#description' => t('Determines when to display the list of objects when viewing a collection page.'),
);
+
+ $form['advanced']['fedora_control_group_control_during_ingest'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Allow control groups select in datastream ingest'),
+ '#description' => t('Whether or not we should allow the user to select which control group to ingest a stream as, or to follow the old paradigm--to add stream IDed as XML as inline, and everything else as managed.'),
+ '#default_value' => variable_get('fedora_control_group_control_during_ingest', FALSE),
+ );
//Export functionality
$form['advanced']['module']['export_area'] = array(
@@ -656,17 +716,21 @@ class formClass {
}
}
- $form['add_datastream_label'] = array(
- '#value' => t('
Add Datastream:
'),
- '#weight' => -10,
+ $form['fieldset'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Add datastream'),
);
+ //$form['add_datastream_label'] = array(
+ // '#value' => t('
Add Datastream:
'),
+ // '#weight' => -10,
+ //);
- $form['pid'] = array(
+ $form['fieldset']['pid'] = array(
'#type' => 'hidden',
'#value' => "$pid"
);
- $form['stream_label'] = array(
+ $form['fieldset']['stream_label'] = array(
'#title' => 'Datastream Label',
'#required' => 'TRUE',
'#description' => t('A Human readable label'),
@@ -674,35 +738,41 @@ class formClass {
);
$form['#attributes']['enctype'] = 'multipart/form-data';
- $form['add-stream-file-location'] = array(
+ $form['fieldset']['add-stream-file-location'] = array(
'#type' => 'file',
'#title' => t('Upload Document'),
'#size' => 48,
// '#required'=>'TRUE',
- '#description' => t('The file to upload.')
+ '#description' => t('The file to upload. (Only for Managed and Inline)')
);
+
+ if (variable_get('fedora_control_group_control_during_ingest', FALSE)) {
+ $form['fieldset']['ds_reference'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Datastream reference'),
+ '#size' => 48,
+ '#description' => t('A URL reference to resolve for the contents of the datastream. (Required for External and Redirect, but will still work for Managed and Inline.)'),
+ );
+ }
+
$form['#redirect'] = "fedora/repository/$pid/";
- $form['submit'] = array(
+ $form['fieldset']['submit'] = array(
'#type' => 'submit',
'#value' => t('Add Datastream')
);
if (!empty($unused_dsids)) {
- $dsidsForForm = array();
- foreach ($unused_dsids as $dsid) {
- $dsidsForForm[$dsid] = $dsid;
- }
- $form['stream_id'] = array(
+ $form['fieldset']['stream_id'] = array(
'#type' => 'select',
'#title' => t('Datastream ID'),
'#default_value' => variable_get('feed_item_length', 'teaser'),
- '#weight' => '-1',
+ '#weight' => -1,
'#description' => t('Datastream IDs defined by the content model.'),
+ '#options' => array_combine($unused_dsids, $unused_dsids),
);
- $form['stream_id']['#options'] = array_combine($unused_dsids, $unused_dsids);
}
else {
- $form['stream_id'] = array(
+ $form['fieldset']['stream_id'] = array(
'#title' => 'Datastream ID',
'#required' => 'TRUE',
'#description' => t('An ID for this stream that is unique to this object. Must start with a letter and contain only alphanumeric characters and dashes and underscores.'),
@@ -710,6 +780,21 @@ class formClass {
'#weight' => -1,
);
}
+
+ if (variable_get('fedora_control_group_control_during_ingest', FALSE)) {
+ $form['fieldset']['control_group'] = array(
+ '#type' => 'select',
+ '#title' => t('Control group'),
+ '#options' => array(
+ 'X' => t('Inline XML'),
+ 'M' => t('Managed datastream'),
+ 'E' => t('Externally Referenced/managed datastream'),
+ 'R' => t('Redirect datastream'),
+ ),
+ '#description' => t('The manner in which the datastream will be stored. "Inline XML" must be XML and will be placed directly into the FOXML for the object. "Managed" datastreams are made to live on the filesystem as discrete files in the Fedora data directory. Both "Redirect" and "External" streams are URL references; the difference being the redirect stream instruct clients to perform an HTTP redirect, such that the data does not pass though Fedora (useful for streaming). External streams are mediated (by which I mean loaded and streamed from) the Fedora server.'),
+ '#weight' => 0,
+ );
+ }
return $form;
}
@@ -836,12 +921,33 @@ class formClass {
$form = array();
$form['#attributes']['enctype'] = 'multipart/form-data';
- $form['file'] = array(
- '#type' => 'file',
- '#title' => t('Upload Document'),
- '#description' => t('The file to upload.')
- );
-
+
+ module_load_include('inc', 'fedora_repository', 'api/fedora_item');
+ $item = new Fedora_Item($pid);
+ $info = $item->get_datastream_info($dsId);
+ $control_group = $info->datastream->controlGroup;
+ if (in_array($control_group, array('M', 'X'))) {
+ $form['file'] = array(
+ '#type' => 'file',
+ '#title' => t('Upload Document'),
+ '#description' => t('A file with which to replace the contents of this datastream.'),
+ );
+ }
+ if ($control_group != 'X') {
+ $form['reference'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Reference to object'),
+ '#description' => t('A URL the datastream will be updated to reference.'),
+ );
+ }
+ if ($control_group == 'M') {
+ $form['note'] = array(
+ '#type' => 'item',
+ '#title' => t('NOTE'),
+ '#value' => t('If both a file and a reference are given, the file will be given preference.'),
+ );
+ }
+
$form['pid'] = array(
'#type' => 'value',
'#value' => $pid,
diff --git a/plugins/FedoraObjectDetailedContent.inc b/plugins/FedoraObjectDetailedContent.inc
index 30e222a6..c193c588 100644
--- a/plugins/FedoraObjectDetailedContent.inc
+++ b/plugins/FedoraObjectDetailedContent.inc
@@ -32,7 +32,6 @@ class FedoraObjectDetailedContent {
*/
public function showFieldSets() {
global $user;
- drupal_set_title($this->item->objectProfile->objLabel);
$objectHelper = new ObjectHelper();
$tabset = array();
$show_purge_tab = (!empty($_POST['form_id']) && $_POST['form_id'] == 'fedora_repository_purge_object_form');
@@ -48,8 +47,27 @@ class FedoraObjectDetailedContent {
$tabset['fedora_object_details']['tabset'] = array(
'#type' => 'tabset',
);
-
- $dc_html = $objectHelper->getFormattedDC($this->item);
+
+ module_load_include('inc', 'fedora_repository', 'ObjectDetails');
+ $object_details_profile = variable_get('islandora_object_details_display_table', 'xslt');
+ $profiles = module_invoke_all("islandora_object_details_display");
+ $profile = $profiles[$object_details_profile];
+ if (!isset($profile)) {
+ // default behaviour
+ watchdog('fedora_repository', "Error while reading the default object details display profile: @e", array("@e" => $e->getMessage()), WATCHDOG_WARNING);
+ $dc_html = $objectHelper->getFormattedDC($this->item);
+ }
+ else {
+ // invoke the requested display profile
+ require_once(drupal_get_path('module', $profile['module']) ."/". $profile['file']);
+ $details_function = $profile['function'];
+ if (function_exists($details_function)) {
+ $dc_html = $details_function($this->item);
+ }
+ else {
+ // problem
+ }
+ }
$i = 0;
if (fedora_repository_access(OBJECTHELPER :: $VIEW_DETAILED_CONTENT_LIST, $this->pid, $user)) {
diff --git a/plugins/tagging_form.inc b/plugins/tagging_form.inc
index 718459b2..9b7c4658 100644
--- a/plugins/tagging_form.inc
+++ b/plugins/tagging_form.inc
@@ -61,10 +61,11 @@ function fedora_repository_image_tagging_form($form_state, $pid) {
$tagset = new TagSet($obj);
$tags = array();
foreach ($tagset->tags as $tag) {
- $form_tag = $form['tags-wrapper']['tags'][$tag['name']] = array(
+ $form['tags-wrapper']['tags'][$tag['name']] = array(
'#prefix' => '
',
'#suffix' => '',
);
+ $form_tag =& $form['tags-wrapper']['tags'][$tag['name']];
$tag_title_text = t('Added by @creator.', array(
'@creator' => $tag['creator'],
diff --git a/xsl/convertQDC.xsl b/xsl/convertQDC.xsl
deleted file mode 100644
index 5d881e35..00000000
--- a/xsl/convertQDC.xsl
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-MetaData |
-
-
-
-
-
- |
-
-
- =
-
-
- |
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/xsl/convertQDC.xsl.deprecated b/xsl/convertQDC.xsl.deprecated
new file mode 100644
index 00000000..724f7c70
--- /dev/null
+++ b/xsl/convertQDC.xsl.deprecated
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ MetaData |
+
+
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
+
+
diff --git a/xsl/mods2html.xsl b/xsl/mods2html.xsl
new file mode 100644
index 00000000..194fcec2
--- /dev/null
+++ b/xsl/mods2html.xsl
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ :
+
+
+
+
+
+
+
+ (
+
+
+
+
+
+
+ Edition
+ )
+
+
+
+ ="",
+
+
+
+
+ ()
+
+
+
diff --git a/xsl/sparql_to_html.xsl b/xsl/sparql_to_html.xsl
index c5974403..0c9c5bcc 100644
--- a/xsl/sparql_to_html.xsl
+++ b/xsl/sparql_to_html.xsl
@@ -1,11 +1,14 @@
-
-
-
+
+
+
+
+
+ fedora_repository_collection_thumbnail
+
-
@@ -42,7 +45,7 @@