From a9e838d7eae1e423489d87c6668ed40bc4ec78a5 Mon Sep 17 00:00:00 2001 From: MorganDawe Date: Thu, 8 May 2014 12:30:11 +0000 Subject: [PATCH] Added excludable dsid setting in configuration page. --- includes/admin.form.inc | 12 ++++++++++++ theme/theme.inc | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/includes/admin.form.inc b/includes/admin.form.inc index 9d0f6e7e..148dce9e 100644 --- a/includes/admin.form.inc +++ b/includes/admin.form.inc @@ -83,8 +83,20 @@ function islandora_repository_admin(array $form, array &$form_state) { ), ), ), + 'islandora_ds_replace_exclude' => array( + '#type' => 'fieldset', + '#title' => t('Excluded DSID'), + 'islandora_namespace_restriction_enforced' => array( + '#type' => 'textfield', + '#title' => t('Enforce DSID restrictions'), + '#description' => t("A comma seperated list, allowing administrator to restrict user's access to replace a versionable datastreams latest version"), + '#default_value' => variable_get('islandora_namespace_restriction_enforced', 'RELS-EXT,RELS-INT'), + ), + ), ), ); + $var_string = variable_get('islandora_namespace_restriction_enforced', 'RELS-EXT,RELS-INT'); + dsm($var_string, "hehe"); return system_settings_form($form); } diff --git a/theme/theme.inc b/theme/theme.inc index a47c2062..aee411a4 100644 --- a/theme/theme.inc +++ b/theme/theme.inc @@ -460,7 +460,10 @@ function theme_islandora_datastream_replace_link(array $vars) { // be moved out into configuration somewhere. Hard coded === bad time. if (islandora_datastream_access(ISLANDORA_REPLACE_DATASTREAM, $datastream) && islandora_datastream_access(ISLANDORA_ADD_NEW_DATASTREAM_VERSION, $datastream)) { - if (strcmp('RELS-EXT', $datastream->id) != 0 && strcmp('RELS-INT', $datastream->id) != 0) { + $var_string = variable_get("islandora_namespace_restriction_enforced", "RELS-EXT,RELS-INT"); + $replace_exclude = explode($var_string, ","); + dsm($var_string, "var string"); + if (!in_array($datastream->id, $replace_exclude)) { return l(t('replace'), "islandora/object/{$datastream->parent->id}/datastream/{$datastream->id}/replace"); } }