|
|
@ -814,9 +814,11 @@ function fedora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* fedora repository edit qdc form |
|
|
|
* fedora repository edit qdc form |
|
|
|
* @global type $user |
|
|
|
* @global type $user |
|
|
|
|
|
|
|
* |
|
|
|
* @param type $form_state |
|
|
|
* @param type $form_state |
|
|
|
* @param type $pid |
|
|
|
* @param type $pid |
|
|
|
* @param type $dsId |
|
|
|
* @param type $dsId |
|
|
|
|
|
|
|
* |
|
|
|
* @return type |
|
|
|
* @return type |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { |
|
|
|
function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { |
|
|
@ -836,24 +838,25 @@ function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { |
|
|
|
$soapHelper = new ConnectionHelper(); |
|
|
|
$soapHelper = new ConnectionHelper(); |
|
|
|
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); |
|
|
|
$client = $soapHelper->getSoapClient(variable_get('fedora_soap_url', 'http://localhost:8080/fedora/services/access?wsdl')); |
|
|
|
|
|
|
|
|
|
|
|
// Check if there is a custom edit metadata function defined in the content model. |
|
|
|
// Check if there's a custom edit metadata function in the content model. |
|
|
|
$output = ''; |
|
|
|
$output = ''; |
|
|
|
if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) { |
|
|
|
if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) { |
|
|
|
$output = $cm->buildEditMetadataForm($pid, $dsId); |
|
|
|
$output = $cm->buildEditMetadataForm($pid, $dsId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (empty($output)) { |
|
|
|
if (empty($output)) { |
|
|
|
// There is no custom function, so just load the standard QDC form. |
|
|
|
// There is no custom function, so just load the standard QDC form. |
|
|
|
$metaDataForm = new formClass(); |
|
|
|
$metaDataForm = new formClass(); |
|
|
|
//currently we only edit the dc metadata. If you defined a custom form with a custom handler you are sol for now. |
|
|
|
// Currently we only edit the dc metadata. |
|
|
|
|
|
|
|
// If you defined a custom form with a custom handler you are sol for now. |
|
|
|
$output = $metaDataForm->createMetaDataForm($pid, $dsId, $client, $form_state); |
|
|
|
$output = $metaDataForm->createMetaDataForm($pid, $dsId, $client, $form_state); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return $output; |
|
|
|
return $output; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* fedora repository edit qdc form validate |
|
|
|
* fedora repository edit qdc form validate |
|
|
|
|
|
|
|
* |
|
|
|
* @param type $form |
|
|
|
* @param type $form |
|
|
|
* @param boolean $form_state |
|
|
|
* @param boolean $form_state |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -1128,7 +1131,7 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU |
|
|
|
|
|
|
|
|
|
|
|
$content_models = $objectHelper->get_content_models_list($pid); |
|
|
|
$content_models = $objectHelper->get_content_models_list($pid); |
|
|
|
|
|
|
|
|
|
|
|
//Get the tabs from all modules... |
|
|
|
// Get the tabs from all modules... |
|
|
|
$hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid, $page_number); |
|
|
|
$hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid, $page_number); |
|
|
|
|
|
|
|
|
|
|
|
$cmodels_tabs = array( |
|
|
|
$cmodels_tabs = array( |
|
|
@ -1136,14 +1139,14 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU |
|
|
|
); |
|
|
|
); |
|
|
|
$cmodels_tabs += $hook_tabs; |
|
|
|
$cmodels_tabs += $hook_tabs; |
|
|
|
|
|
|
|
|
|
|
|
//Assemble parameters, to pass during alter |
|
|
|
// Assemble parameters, to pass during alter. |
|
|
|
$params = array( |
|
|
|
$params = array( |
|
|
|
'content_models' => $content_models, |
|
|
|
'content_models' => $content_models, |
|
|
|
'pid' => $pid, |
|
|
|
'pid' => $pid, |
|
|
|
'page' => $page_number, |
|
|
|
'page' => $page_number, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
//Allow returned tabs to be altered, before return. |
|
|
|
// Allow returned tabs to be altered, before return. |
|
|
|
drupal_alter('islandora_tabs', $cmodels_tabs, $params); |
|
|
|
drupal_alter('islandora_tabs', $cmodels_tabs, $params); |
|
|
|
|
|
|
|
|
|
|
|
return tabs_render($cmodels_tabs); |
|
|
|
return tabs_render($cmodels_tabs); |
|
|
@ -1637,7 +1640,7 @@ function fedora_repository_render_image($pid, $dsid, $imagecache_preset = 'fedor |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Convenience function used in XSLT callback... |
|
|
|
* Convenience function used in XSLT callback... |
|
|
|
* |
|
|
|
* |
|
|
|
* @param $string string |
|
|
|
* @param string $string |
|
|
|
* A string containing some markup to convert to a domnode. |
|
|
|
* A string containing some markup to convert to a domnode. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function fedora_repository_string_to_domnode($string) { |
|
|
|
function fedora_repository_string_to_domnode($string) { |
|
|
@ -1662,6 +1665,7 @@ function fedora_repository_access() { |
|
|
|
* |
|
|
|
* |
|
|
|
* @global $user |
|
|
|
* @global $user |
|
|
|
* @see hook_fedora_repository_check_perm() |
|
|
|
* @see hook_fedora_repository_check_perm() |
|
|
|
|
|
|
|
* |
|
|
|
* @param string $op |
|
|
|
* @param string $op |
|
|
|
* The operation to be performed. |
|
|
|
* The operation to be performed. |
|
|
|
* @param string|null $pid |
|
|
|
* @param string|null $pid |
|
|
@ -1674,15 +1678,15 @@ function fedora_repository_access() { |
|
|
|
* @return boolean |
|
|
|
* @return boolean |
|
|
|
* A boolean indicating if the operation should be permitted (TRUE) or denied |
|
|
|
* A boolean indicating if the operation should be permitted (TRUE) or denied |
|
|
|
* (FALSE). |
|
|
|
* (FALSE). |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function fedora_repository_check_perm($op, $pid = NULL, $as_user = NULL, $reset_cache = FALSE) { |
|
|
|
function fedora_repository_check_perm($op, $pid = NULL, $as_user = NULL, $reset_cache = FALSE) { |
|
|
|
static $cache = array(); |
|
|
|
static $cache = array(); |
|
|
|
|
|
|
|
|
|
|
|
if ($reset_cache) { |
|
|
|
if ($reset_cache) { |
|
|
|
$cache = array(); |
|
|
|
$cache = array(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// The PID can be empty for the root object. |
|
|
|
if ($pid === NULL) { |
|
|
|
if (empty($pid)) { |
|
|
|
$pid = variable_get('fedora_repository_pid', 'islandora:root'); |
|
|
|
$pid = variable_get('fedora_repository_pid', 'islandora:root'); |
|
|
|
} |
|
|
|
} |
|
|
|
if ($as_user === NULL) { |
|
|
|
if ($as_user === NULL) { |
|
|
@ -1693,7 +1697,6 @@ function fedora_repository_check_perm($op, $pid = NULL, $as_user = NULL, $reset_ |
|
|
|
// Populate the cache on a miss. |
|
|
|
// Populate the cache on a miss. |
|
|
|
if (!isset($cache[$op][$pid][$as_user->uid])) { |
|
|
|
if (!isset($cache[$op][$pid][$as_user->uid])) { |
|
|
|
$results = module_invoke_all('fedora_repository_check_perm', $op, $pid, $as_user); |
|
|
|
$results = module_invoke_all('fedora_repository_check_perm', $op, $pid, $as_user); |
|
|
|
|
|
|
|
|
|
|
|
// Nothing returned FALSE, and something returned TRUE. |
|
|
|
// Nothing returned FALSE, and something returned TRUE. |
|
|
|
$cache[$op][$pid][$as_user->uid] = (!in_array(FALSE, $results, TRUE) && in_array(TRUE, $results, TRUE)); |
|
|
|
$cache[$op][$pid][$as_user->uid] = (!in_array(FALSE, $results, TRUE) && in_array(TRUE, $results, TRUE)); |
|
|
|
} |
|
|
|
} |
|
|
@ -1710,13 +1713,13 @@ function fedora_repository_check_perm($op, $pid = NULL, $as_user = NULL, $reset_ |
|
|
|
function fedora_repository_fedora_repository_check_perm($op, $pid, $user) { |
|
|
|
function fedora_repository_fedora_repository_check_perm($op, $pid, $user) { |
|
|
|
$to_return = TRUE; |
|
|
|
$to_return = TRUE; |
|
|
|
if (variable_get('fedora_namespace_restriction_enforced', TRUE)) { |
|
|
|
if (variable_get('fedora_namespace_restriction_enforced', TRUE)) { |
|
|
|
//Get the namespace (with colon) |
|
|
|
// Get the namespace (with colon) |
|
|
|
$pid_namespace = substr($pid, 0, strpos($pid, ':') + 1); |
|
|
|
$pid_namespace = substr($pid, 0, strpos($pid, ':') + 1); |
|
|
|
$allowed_namespaces = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); |
|
|
|
$allowed_namespaces = explode(" ", variable_get('fedora_pids_allowed', 'default: demo: changeme: islandora: ilives: islandora-book: books: newspapers: ')); |
|
|
|
|
|
|
|
|
|
|
|
$to_return = in_array($pid_namespace, $allowed_namespaces); |
|
|
|
$to_return = in_array($pid_namespace, $allowed_namespaces); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($to_return && user_access($op, $user)) { |
|
|
|
if ($to_return && user_access($op, $user)) { |
|
|
|
// Straight Drupal permissions, let's allow it. |
|
|
|
// Straight Drupal permissions, let's allow it. |
|
|
|
return TRUE; |
|
|
|
return TRUE; |
|
|
@ -1730,4 +1733,3 @@ function fedora_repository_fedora_repository_check_perm($op, $pid, $user) { |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|