From 180e0ce4dcbc15cf171565a8f44ef3d4614812e0 Mon Sep 17 00:00:00 2001 From: Zachary Howarth Date: Fri, 26 Nov 2010 16:49:00 -0400 Subject: [PATCH 1/7] Added some additional audio/video formats to MimeClass, including the non-standard but widely-used .m4a extension. Also removed some commented-out test cases. --- MimeClass.inc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/MimeClass.inc b/MimeClass.inc index 55228740..652f3cc3 100644 --- a/MimeClass.inc +++ b/MimeClass.inc @@ -163,6 +163,9 @@ class MimeClass { "mpeg" => "video/mpeg", "mpe" => "video/mpeg", "mpg" => "video/mpeg", + "m4v" => "video/mp4", + "mp4" => "video/mp4", + "ogv" => "video/ogg", "qt" => "video/quicktime", "mov" => "video/quicktime", "mxu" => "video/vnd.mpegurl", @@ -170,12 +173,20 @@ class MimeClass { "movie" => "video/x-sgi-movie", "flv" => "video/x-flv", "swf" => "application/x-shockwave-flash", + // audio: + "mp3" => "audio/mpeg", + "mp4a" => "audio/mp4", + "m4a" => "audio/mp4", + "oga" => "audio/ogg", + "ogg" => "audio/ogg", + "flac" => "audio/x-flac", + "wav" => "audio/vnd.wave", // compressed formats: (note: http://svn.cleancode.org/svn/email/trunk/mime.types) "tgz" => "application/x-gzip", "gz" => "application/x-gzip", "tar" => "application/x-tar", "gtar" => "application/x-gtar", - "zip" => "application/x-zip", + "zip" => "application/x-zip", // others: 'bin' => 'application/octet-stream', ); @@ -323,14 +334,3 @@ class MimeClass { } -/* -$helper = new MimeClass(); -print "get_extension('application/x-gzip'): \n"; -echo print_r( $helper->get_extension('application/x-gzip', true), true ) . "\n"; -print "get_extension('text/plain'): \n"; -echo print_r( $helper->get_extension('text/plain', true), true ) . "\n"; -print "get_mimetype('fucker/asdf.tar.gz'): \n"; -echo print_r( $helper->get_mimetype('fucker/asdf.tar.gz', true), true ) . "\n"; -print "get_mimetype('blah.tsp'): \n"; -echo print_r( $helper->get_mimetype('blah.tsp', true), true ) . "\n"; -/* */ From 7941b435d552d43158803b2d0a76261875a66680 Mon Sep 17 00:00:00 2001 From: Zachary Howarth Date: Wed, 1 Dec 2010 16:27:11 -0400 Subject: [PATCH 2/7] Don't render PID field unless a pid is present, as it displays the default collection object. --- plugins/pidfield/pidfield.module | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/pidfield/pidfield.module b/plugins/pidfield/pidfield.module index 902d6690..53e176a2 100644 --- a/plugins/pidfield/pidfield.module +++ b/plugins/pidfield/pidfield.module @@ -276,11 +276,14 @@ function theme_pidfield_formatter_default($element) { //return $element['#item']['safe']; $pid = $element['#item']['safe']; - module_load_include('inc', 'fedora_repository', 'api/fedora_item'); - $item = new Fedora_Item($pid); + if(!empty($pid)) { + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); + $item = new Fedora_Item($pid); - return fedora_repository_get_items($pid); - //return $item->objectProfile->objLabel; + return fedora_repository_get_items($pid); + //return $item->objectProfile->objLabel; + } + return null; } /** From e697cf4f15b05573874908548adecb69bfbab43a Mon Sep 17 00:00:00 2001 From: jesterhazy Date: Sat, 4 Dec 2010 11:16:57 -0600 Subject: [PATCH 3/7] removed content model checks in makeObject(...) --- ObjectHelper.inc | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 9341a6c6..0cb66eff 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -59,20 +59,6 @@ class ObjectHelper { drupal_access_denied(); return ' '; } - - if (($cm = ContentModel::loadFromObject($pid)) == FALSE) { - drupal_set_message(t("You do not have access to objects without an Islandora Content Model."), 'error'); - drupal_access_denied(); - return ' '; - } - - $cmDatastreams = $cm->listDatastreams(); - - if ( !((isset($user) && in_array('administrator',$user->roles)) || in_array($dsID,$cmDatastreams))) { - drupal_set_message(t("You do not have access to the specified datastream."), 'error'); - drupal_access_denied(); - return ' '; - } module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($pid); From 500f3ebd0039e8d929f5cae6dcdd272dab457400 Mon Sep 17 00:00:00 2001 From: Zachary Howarth Date: Thu, 9 Dec 2010 15:51:01 -0400 Subject: [PATCH 4/7] Restore menu title on Digital Repository (fedora/repository). --- formClass.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/formClass.inc b/formClass.inc index 8505f402..6e0161fd 100644 --- a/formClass.inc +++ b/formClass.inc @@ -78,7 +78,7 @@ class formClass { // 'access' => TRUE ); $items['fedora/repository'] = array( -// 'title' => t('Digital repository'), + 'title' => t('Digital repository'), 'page callback' => 'repository_page', 'type' => MENU_NORMAL_ITEM, // 'page arguments'=>array(1), From 69a06d695f3df15c18e1d3b8c388ed322d41273a Mon Sep 17 00:00:00 2001 From: Alexander O'Neill Date: Fri, 10 Dec 2010 13:38:12 -0400 Subject: [PATCH 5/7] Updated schema of large images collection. --- content_models/islandora_largeimages.xml | 654 +++++++++++++---------- 1 file changed, 357 insertions(+), 297 deletions(-) diff --git a/content_models/islandora_largeimages.xml b/content_models/islandora_largeimages.xml index 6a152ad4..a0bbfe9b 100644 --- a/content_models/islandora_largeimages.xml +++ b/content_models/islandora_largeimages.xml @@ -1,298 +1,358 @@ - - - - - - - - - - - - - - -ingest - -fedoraAdmin -2010-01-26T21:29:20.416Z -Created with Admin GUI "New Object" command - - - -addDatastream -COLLECTION_POLICY -fedoraAdmin -2010-01-26T21:30:55.607Z -DatastreamsPane generated this logMessage. - - - -addDatastream -RELS-EXT -fedoraAdmin -2010-01-26T21:33:14.125Z - - - - -modifyDatastreamByValue -COLLECTION_POLICY -fedoraAdmin -2010-03-04T12:50:05.983Z - - - - -modifyDatastreamByValue -COLLECTION_POLICY -fedoraAdmin -2010-03-11T21:01:44.921Z - - - - - - - - - - - Large Image Collection - islandora:largeimages - - - - - - - - - - - islandora:slide - islandora:slideCModel - ISLANDORACM - - - - isMemberOfCollection - - dc.description - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.relation - dc.relation - - - dcterms.temporal - dcterms.temporal - - - dcterms.spatial - dcterms.spatial - - - fgs.DS.first.text - Full Text - - - - - - - - - - - islandora:slide - islandora:slideCModel - ISLANDORACM - - - islandora:herb - islandora:herbCModel - ISLANDORACM - - - isMemberOfCollection - - dc.description - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.relation - dc.relation - - - dcterms.temporal - dcterms.temporal - - - dcterms.spatial - dcterms.spatial - - - fgs.DS.first.text - Full Text - - - - - - - - - - - islandora:slide - islandora:slideCModel - ISLANDORACM - - - isMemberOfCollection - - dc.description - - dc.title - dc.title - - - dc.creator - dc.creator - - - dc.description - dc.description - - - dc.date - dc.date - - - dc.identifier - dc.identifier - - - dc.language - dc.language - - - dc.publisher - dc.publisher - - - dc.rights - dc.rights - - - dc.subject - dc.subject - - - dc.relation - dc.relation - - - dcterms.temporal - dcterms.temporal - - - dcterms.spatial - dcterms.spatial - - - fgs.DS.first.text - Full Text - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + ingest + + fedoraAdmin + 2010-01-26T21:29:20.416Z + Created with Admin GUI "New Object" command + + + + addDatastream + COLLECTION_POLICY + fedoraAdmin + 2010-01-26T21:30:55.607Z + DatastreamsPane generated this logMessage. + + + + addDatastream + RELS-EXT + fedoraAdmin + 2010-01-26T21:33:14.125Z + + + + + modifyDatastreamByValue + COLLECTION_POLICY + fedoraAdmin + 2010-03-04T12:50:05.983Z + + + + + modifyDatastreamByValue + COLLECTION_POLICY + fedoraAdmin + 2010-03-11T21:01:44.921Z + + + + + ingest + + admin + 2010-12-10T17:29:47.073Z + Fedora Object Ingested + + + + addDatastream + TN + admin + 2010-12-10T17:29:47.200Z + Ingested object TN + + + + modifyDatastreamByValue + COLLECTION_POLICY + fedoraAdmin + 2010-12-10T17:32:17.345Z + + + + + + + + + + + Large Image Collection + islandora:largeimages + + + + + + + + + + + islandora:slide + islandora:slideCModel + ISLANDORACM + + + isMemberOfCollection + + dc.description + + dc.title + dc.title + + + dc.creator + dc.creator + + + dc.description + dc.description + + + dc.date + dc.date + + + dc.identifier + dc.identifier + + + dc.language + dc.language + + + dc.publisher + dc.publisher + + + dc.rights + dc.rights + + + dc.subject + dc.subject + + + dc.relation + dc.relation + + + dcterms.temporal + dcterms.temporal + + + dcterms.spatial + dcterms.spatial + + + fgs.DS.first.text + Full Text + + + + + + + + + + + islandora:slide + islandora:slideCModel + ISLANDORACM + + + islandora:herb + islandora:herbCModel + ISLANDORACM + + + isMemberOfCollection + + dc.description + + dc.title + dc.title + + + dc.creator + dc.creator + + + dc.description + dc.description + + + dc.date + dc.date + + + dc.identifier + dc.identifier + + + dc.language + dc.language + + + dc.publisher + dc.publisher + + + dc.rights + dc.rights + + + dc.subject + dc.subject + + + dc.relation + dc.relation + + + dcterms.temporal + dcterms.temporal + + + dcterms.spatial + dcterms.spatial + + + fgs.DS.first.text + Full Text + + + + + + + + + + + islandora:slide + islandora:slideCModel + ISLANDORACM + + + isMemberOfCollection + + dc.description + + dc.title + dc.title + + + dc.creator + dc.creator + + + dc.description + dc.description + + + dc.date + dc.date + + + dc.identifier + dc.identifier + + + dc.language + dc.language + + + dc.publisher + dc.publisher + + + dc.rights + dc.rights + + + dc.subject + dc.subject + + + dc.relation + dc.relation + + + dcterms.temporal + dcterms.temporal + + + dcterms.spatial + dcterms.spatial + + + fgs.DS.first.text + Full Text + + + + + + + + + + + + + dc.title + dc.creator + dc.description + dc.date + dc.identifier + dc.language + dc.publisher + dc.rights + dc.subject + dc.relation + dcterms.temporal + dcterms.spatial + Full Text + + isMemberOfCollection + + + + + + + + + + + + + + + + + + + + + + From 861ef05951f0f4465b9d8ec43ed49d191868dddf Mon Sep 17 00:00:00 2001 From: mroy Date: Tue, 14 Dec 2010 13:57:22 -0600 Subject: [PATCH 6/7] Added content model checks in makeObject(...) Added new restriction option to the fedora collection list settings page that allows you to enable/disable restrcitions. Defaults to restrict for security. --- ObjectHelper.inc | 17 ++++++++++++++++- formClass.inc | 21 ++++++++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ObjectHelper.inc b/ObjectHelper.inc index 7520907c..ab4cb617 100644 --- a/ObjectHelper.inc +++ b/ObjectHelper.inc @@ -54,13 +54,28 @@ class ObjectHelper { return ' '; } - if (!fedora_repository_access(OBJECTHELPER :: $OBJECT_HELPER_VIEW_FEDORA, $pid, $user)) { drupal_set_message(t("You do not have access Fedora objects within the attempted namespace."), 'error'); drupal_access_denied(); return ' '; } + + if (variable_get('fedora_object_restrict_datastreams', TRUE) == TRUE ) { + if (($cm = ContentModel::loadFromObject($pid)) == FALSE) { + drupal_set_message(t("You do not have access to objects without an Islandora Content Model."), 'error'); + drupal_access_denied(); + return ' '; + } + + $cmDatastreams = $cm->listDatastreams(); + if ( !((isset($user) && in_array('administrator',$user->roles)) || in_array($dsID,$cmDatastreams))) { + drupal_set_message(t("You do not have access to the specified datastream."), 'error'); + drupal_access_denied(); + return ' '; + } + } + module_load_include('inc', 'fedora_repository', 'api/fedora_item'); $item = new Fedora_Item($pid); diff --git a/formClass.inc b/formClass.inc index 6e0161fd..e9995a90 100644 --- a/formClass.inc +++ b/formClass.inc @@ -361,13 +361,13 @@ class formClass { ); */ - $form['fedora_object_display_title'] = array( - '#type' => 'select', - '#title' => t('Display Object Title Behaviour'), - '#default_value'=> variable_get('fedora_object_display_title', ObjectHelper::$DISPLAY_ALWAYS), - '#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 object (or collection) title when viewing an object/collection page.'), - ); + $form['fedora_object_display_title'] = array( + '#type' => 'select', + '#title' => t('Display Object Title Behaviour'), + '#default_value'=> variable_get('fedora_object_display_title', ObjectHelper::$DISPLAY_ALWAYS), + '#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 object (or collection) title when viewing an object/collection page.'), + ); $form['fedora_object_display_description'] = array( @@ -377,6 +377,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 default object (or collection) description fieldset when viewing an object/collection page.'), ); + + $form['fedora_object_restrict_datastreams'] = array( + '#type' => 'checkbox', + '#title' => t('Restrict Access to Fedora Object Datastreams'), + '#default_value'=> variable_get('fedora_object_restrict_datastreams', TRUE), + '#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['fedora_collection_display_list'] = array( '#type' => 'select', From 39acc688d368edaaa256e33986d7886deb3a2ae5 Mon Sep 17 00:00:00 2001 From: mroy Date: Tue, 14 Dec 2010 16:24:52 -0600 Subject: [PATCH 7/7] Updated to make the /fedora/repository page title a variable configurable in the fedora collection list configuration. --- formClass.inc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/formClass.inc b/formClass.inc index e9995a90..20840ba7 100644 --- a/formClass.inc +++ b/formClass.inc @@ -77,8 +77,14 @@ class formClass { 'access arguments' => array('view fedora collection'), // 'access' => TRUE ); + $repository_title = variable_get('fedora_repository_title','Digital repository'); + if (trim($repository_title)!= '') { + $respository_title=t($repository_title); + } else { + $repository_title= NULL; + } $items['fedora/repository'] = array( - 'title' => t('Digital repository'), + 'title' => $repository_title, 'page callback' => 'repository_page', 'type' => MENU_NORMAL_ITEM, // 'page arguments'=>array(1), @@ -361,6 +367,14 @@ class formClass { ); */ + $form['fedora_repository_title'] = array( + '#type' => 'textfield', + '#title' => t('Fedora Repository Title'), + '#default_value'=> variable_get('fedora_repository_title', 'Digital Repository'), + '#description' => t('The title displayed when viewing collections and objects in /fedora/repository. Leave blank to display no title. Note that the menus must be rebuilt after changing this variable.'), + ); + + $form['fedora_object_display_title'] = array( '#type' => 'select', '#title' => t('Display Object Title Behaviour'), @@ -370,6 +384,7 @@ class formClass { ); + $form['fedora_object_display_description'] = array( '#type' => 'select', '#title' => t('Display Object Description Behaviour'),