|
|
|
@ -27,7 +27,7 @@ function fedora_repository_menu() {
|
|
|
|
|
* |
|
|
|
|
* @param type $path |
|
|
|
|
* @param type $arg |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_help($path, $arg) { |
|
|
|
|
switch ($path) { |
|
|
|
@ -42,7 +42,7 @@ function fedora_repository_help($path, $arg) {
|
|
|
|
|
* fedora repository purge object |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $name |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_purge_object($pid = NULL, $name = NULL) { |
|
|
|
|
if (!user_access('purge objects and datastreams')) { |
|
|
|
@ -67,7 +67,7 @@ function fedora_repository_purge_object($pid = NULL, $name = NULL) {
|
|
|
|
|
* @param type $collection_pid |
|
|
|
|
* @param type $collection_label |
|
|
|
|
* @param type $content_model |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_ingest_object($collection_pid=NULL, $collection_label = NULL, $content_model = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); |
|
|
|
@ -106,7 +106,7 @@ function fedora_repository_ingest_object($collection_pid=NULL, $collection_label
|
|
|
|
|
* @global type $base_url |
|
|
|
|
* @global type $user |
|
|
|
|
* @param array $form |
|
|
|
|
* @param array $form_state |
|
|
|
|
* @param array $form_state |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_ingest_form_submit(array $form, array &$form_state) { |
|
|
|
|
//only validate the form if the submit button was pressed (other buttons may be used for AHAH |
|
|
|
@ -163,7 +163,7 @@ function fedora_repository_ingest_form_submit(array $form, array &$form_state) {
|
|
|
|
|
* fedora repository ingest form validate |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_ingest_form_validate($form, &$form_state) { |
|
|
|
|
//only validate the form if the submit button was pressed (other buttons may be used for AHAH |
|
|
|
@ -220,7 +220,7 @@ function fedora_repository_ingest_form_validate($form, &$form_state) {
|
|
|
|
|
|
|
|
|
|
if (!empty($file)) { |
|
|
|
|
if (!in_array($dformat, $allowedMimeTypes)) { |
|
|
|
|
form_set_error($ifl, |
|
|
|
|
form_set_error($ifl, |
|
|
|
|
t('The uploaded file\'s mimetype (@mime) is not associated with this Content Model. The allowed types are: @allowed', array( |
|
|
|
|
'@mime' => $dformat, |
|
|
|
|
'@allowed' => implode(', ', $allowedMimeTypes), |
|
|
|
@ -249,7 +249,7 @@ function fedora_repository_ingest_form_validate($form, &$form_state) {
|
|
|
|
|
* @param type $collection_pid |
|
|
|
|
* @param type $collection_label |
|
|
|
|
* @param type $content_model |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_ingest_form(&$form_state, $collection_pid, $collection_label = NULL, $content_model = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'formClass'); |
|
|
|
@ -270,7 +270,7 @@ function fedora_repository_ingest_form(&$form_state, $collection_pid, $collectio
|
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $referrer |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NULL) { |
|
|
|
|
global $base_url; |
|
|
|
@ -319,7 +319,7 @@ function fedora_repository_purge_object_form(&$form_state, $pid, $referrer = NUL
|
|
|
|
|
* add stream |
|
|
|
|
* @param type $collection_pid |
|
|
|
|
* @param type $collectionName |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function add_stream($collection_pid=NULL, $collectionName=NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); |
|
|
|
@ -345,7 +345,7 @@ function add_stream($collection_pid=NULL, $collectionName=NULL) {
|
|
|
|
|
* @global type $base_url |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function add_stream_form_submit($form, &$form_state) { |
|
|
|
|
global $base_url; |
|
|
|
@ -353,7 +353,7 @@ function add_stream_form_submit($form, &$form_state) {
|
|
|
|
|
$form_state['rebuild'] = TRUE; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
|
$pathToModule = drupal_get_path('module', 'fedora_repository'); |
|
|
|
@ -384,7 +384,7 @@ function add_stream_form_submit($form, &$form_state) {
|
|
|
|
|
* add stream form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $pid |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function add_stream_form(&$form_state, $pid) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'formClass'); |
|
|
|
@ -396,7 +396,7 @@ function add_stream_form(&$form_state, $pid) {
|
|
|
|
|
* add stream form validate |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function add_stream_form_validate($form, &$form_state) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'MimeClass'); |
|
|
|
@ -427,14 +427,14 @@ function add_stream_form_validate($form, &$form_state) {
|
|
|
|
|
// 'file_validate_image_resolution' => array('85x85'), |
|
|
|
|
// 'file_validate_size' => array(30 * 1024), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$controlGroup = $form_state['storage']['control_group'] = $form_state['values']['control_group']; |
|
|
|
|
if ((($controlGroup && in_array($controlGroup, array('X', 'M'))) || !$controlGroup) && (($fileObject = file_save_upload('add-stream-file-location', $validators)))) { |
|
|
|
|
// Move the uploaded file to Drupal's files directory. |
|
|
|
|
$file_path = $fileObject->filepath; |
|
|
|
|
file_move($file_path, 0, FILE_EXISTS_RENAME); |
|
|
|
|
$form_state['values']['add-stream-file-location'] = $file_path; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form_state['storage']['stream_url'] = file_create_url($file_path); |
|
|
|
|
} |
|
|
|
|
elseif ($controlGroup && in_array($controlGroup, array('M', 'R', 'E')) && ($ref = $form_state['values']['ds_reference'])) { |
|
|
|
@ -443,10 +443,10 @@ function add_stream_form_validate($form, &$form_state) {
|
|
|
|
|
else { |
|
|
|
|
form_set_error('', t('No file given when "X" or "M", or no reference given when "M", "R" or "E".')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$mimeClass = new MimeClass(); |
|
|
|
|
$mimetype = $form_state['storage']['ds_mimetype'] = $mimeClass->getType($form_state['storage']['stream_url']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$controlGroup) { |
|
|
|
|
if ($mimetype == 'text/xml') { |
|
|
|
|
$form_state['storage']['control_group'] = 'X'; |
|
|
|
@ -455,7 +455,7 @@ function add_stream_form_validate($form, &$form_state) {
|
|
|
|
|
$form_state['storage']['control_group'] = 'M'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Add error checking here. |
|
|
|
|
$form_state['rebuild'] = FALSE; |
|
|
|
|
} |
|
|
|
@ -466,7 +466,7 @@ function add_stream_form_validate($form, &$form_state) {
|
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $dsId |
|
|
|
|
* @param type $name |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_purge_stream($pid = NULL, $dsId = NULL, $name = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
@ -508,7 +508,7 @@ function fedora_repository_purge_object_form_validate($form, &$form_state) {
|
|
|
|
|
* fedora repository purge object form submit |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_purge_object_form_submit($form, &$form_state) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ConnectionHelper'); |
|
|
|
@ -557,7 +557,7 @@ function fedora_repository_purge_object_form_submit($form, &$form_state) {
|
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $dsId |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_purge_stream_form(&$form_state, $pid, $dsId) { |
|
|
|
|
$form['pid'] = array( |
|
|
|
@ -580,7 +580,7 @@ function fedora_repository_purge_stream_form(&$form_state, $pid, $dsId) {
|
|
|
|
|
* fedora repository purge stream form submit |
|
|
|
|
* @global type $base_url |
|
|
|
|
* @param type $form |
|
|
|
|
* @param array $form_state |
|
|
|
|
* @param array $form_state |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_purge_stream_form_submit($form, &$form_state) { |
|
|
|
|
global $base_url; |
|
|
|
@ -605,7 +605,7 @@ function fedora_repository_download_datastream_form(&$form_state, $pid, $dsid, $
|
|
|
|
|
'#value' => t('Download'), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (user_access(ObjectHelper::$EDIT_FEDORA_METADATA)) { |
|
|
|
|
$item = new Fedora_Item($pid); |
|
|
|
|
$versions = $item->get_datastream_history($dsid); |
|
|
|
@ -618,7 +618,7 @@ function fedora_repository_download_datastream_form(&$form_state, $pid, $dsid, $
|
|
|
|
|
else { |
|
|
|
|
$version_array[] = $versions->createDate; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (count($version_array) > 1) { |
|
|
|
|
$form['#attributes'] = array( |
|
|
|
|
'onsubmit' => 'this.action="' . $form['#action'] . '/" + this.version.value;' |
|
|
|
@ -629,7 +629,7 @@ function fedora_repository_download_datastream_form(&$form_state, $pid, $dsid, $
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $form; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -639,7 +639,7 @@ function fedora_repository_download_datastream_form(&$form_state, $pid, $dsid, $
|
|
|
|
|
* @param type $dsId |
|
|
|
|
* @param type $dsLabel |
|
|
|
|
* @param type $collectionName |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_replace_stream($pid, $dsId, $dsLabel = '', $collectionName = NULL) { |
|
|
|
|
if ($pid == NULL || $dsId == NULL) { |
|
|
|
@ -657,7 +657,7 @@ function fedora_repository_replace_stream($pid, $dsId, $dsLabel = '', $collectio
|
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $dsId |
|
|
|
|
* @param type $dsLabel |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLabel) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'formClass'); |
|
|
|
@ -669,7 +669,7 @@ function fedora_repository_replace_stream_form(&$form_state, $pid, $dsId, $dsLab
|
|
|
|
|
* fedora repository replace stream form validate |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_replace_stream_form_validate($form, &$form_state) { |
|
|
|
|
// If a file was uploaded, process it. |
|
|
|
@ -683,7 +683,7 @@ function fedora_repository_replace_stream_form_validate($form, &$form_state) {
|
|
|
|
|
form_set_error('file', 'Error uploading file.'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------- |
|
|
|
|
* TODO: need a better way to get mimetypes |
|
|
|
|
*/ |
|
|
|
@ -691,7 +691,7 @@ function fedora_repository_replace_stream_form_validate($form, &$form_state) {
|
|
|
|
|
module_load_include('inc', 'fedora_repository', 'MimeClass'); |
|
|
|
|
$mime = new MimeClass(); |
|
|
|
|
$mimetype = $form_state['storage']['mime_type'] = $mime->getType($file->filepath); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($mimetype == 'text/xml' && !DOMDocument::load($file->filepath)) { |
|
|
|
|
form_set_error('file', 'Invalid XML format. (XML could not be parsed)'); |
|
|
|
|
return; |
|
|
|
@ -709,7 +709,7 @@ function fedora_repository_replace_stream_form_validate($form, &$form_state) {
|
|
|
|
|
* fedora repository replace stream form submit |
|
|
|
|
* @global type $base_url |
|
|
|
|
* @param type $form |
|
|
|
|
* @param array $form_state |
|
|
|
|
* @param array $form_state |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_replace_stream_form_submit($form, &$form_state) { |
|
|
|
|
$file = $form_state['values']['file']; |
|
|
|
@ -717,11 +717,11 @@ function fedora_repository_replace_stream_form_submit($form, &$form_state) {
|
|
|
|
|
$pid = $form_state['values']['pid']; |
|
|
|
|
$dsid = $form_state['values']['dsId']; |
|
|
|
|
$dsLabel = $form_state['values']['dsLabel']; |
|
|
|
|
|
|
|
|
|
$streamUrl = ($file !== NULL) ? |
|
|
|
|
|
|
|
|
|
$streamUrl = ($file !== NULL) ? |
|
|
|
|
file_create_url($file->filepath): |
|
|
|
|
url($form_state['values']['reference'], array('absolute' => TRUE)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove the original file extension from the label and add the new one |
|
|
|
|
// use strrpos to get the last dot |
|
|
|
|
if (($indexOfDot = strrpos($dsLabel, '.')) !== FALSE) { |
|
|
|
@ -744,7 +744,7 @@ function fedora_repository_replace_stream_form_submit($form, &$form_state) {
|
|
|
|
|
* @global type $user |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $dsId |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
@ -763,12 +763,12 @@ function fedora_repository_edit_qdc_page($pid = NULL, $dsId = NULL) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository edit qdc form |
|
|
|
|
* fedora repository edit qdc form |
|
|
|
|
* @global type $user |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $dsId |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ContentModel'); |
|
|
|
@ -786,7 +786,7 @@ function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) {
|
|
|
|
|
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')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check if there is a custom edit metadata function defined in the content model. |
|
|
|
|
$output = ''; |
|
|
|
|
if (($cm = ContentModel::loadFromObject($pid)) !== FALSE) { |
|
|
|
@ -799,14 +799,14 @@ function fedora_repository_edit_qdc_form(&$form_state, $pid, $dsId = NULL) {
|
|
|
|
|
//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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $output; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository edit qdc form validate |
|
|
|
|
* @param type $form |
|
|
|
|
* @param boolean $form_state |
|
|
|
|
* @param boolean $form_state |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_edit_qdc_form_validate($form, &$form_state) { |
|
|
|
|
if ($form_state['storage']['xml']) { |
|
|
|
@ -886,7 +886,7 @@ function fedora_repository_perm() {
|
|
|
|
|
* @param type $op |
|
|
|
|
* @param type $node |
|
|
|
|
* @param type $account |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_access($op, $node = NULL, $account = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
@ -935,7 +935,7 @@ function makeObject($pid, $dsID) {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implementation of hook_islandora_tabs(). |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param $content_models array |
|
|
|
|
* An array of ContentModel objects to which the current Fedora Object |
|
|
|
|
* subscribes. |
|
|
|
@ -949,10 +949,10 @@ function makeObject($pid, $dsID) {
|
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_islandora_tabs($content_models, $pid, $page_number) { |
|
|
|
|
$cmodels_tabs = array(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($content_models as $content_model) { |
|
|
|
|
$content_model_fieldset = $content_model->displayExtraFieldset($pid, $page_number); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Each content model may return either a tabpage array or plain HTML. If |
|
|
|
|
// it is HTML, stick it in a tabpage. |
|
|
|
|
if (is_array($content_model_fieldset)) { |
|
|
|
@ -966,24 +966,24 @@ function fedora_repository_islandora_tabs($content_models, $pid, $page_number) {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//can disable showing the object details tab in admin UI |
|
|
|
|
if (variable_get('fedora_repository_show_object_details_tab', TRUE)) { |
|
|
|
|
// Add a 'manage object' tab for all objects, where detailed list of content is shown. |
|
|
|
|
// XXX: Perhaps this should be extracted into its own object? |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'plugins/FedoraObjectDetailedContent'); |
|
|
|
|
$obj = new FedoraObjectDetailedContent($pid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$object_details = $obj->showFieldSets(); |
|
|
|
|
$cmodels_tabs = array_merge($cmodels_tabs, $object_details); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $cmodels_tabs; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Implementation of hook_islandora_tabs_alter(). |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param &$tabs array |
|
|
|
|
* The array of tabs/tabset to alter. |
|
|
|
|
* @param $params array |
|
|
|
@ -1006,7 +1006,7 @@ function fedora_repository_islandora_tabs_alter(&$tabs, $params) {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Menu callback for "fedora/repository". |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* If user is allow, and we are given a PID and a sensical DSID, return the |
|
|
|
|
* datastream via the makeObject() function; otherwise, call out to the PIDs' |
|
|
|
|
* ContentModels and all Drupal modules for Islandora tabs. |
|
|
|
@ -1088,29 +1088,29 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
|
|
|
|
|
$breadcrumbs = array(); |
|
|
|
|
$objectHelper->getBreadcrumbs($pid, $breadcrumbs); |
|
|
|
|
drupal_set_breadcrumb(array_reverse($breadcrumbs)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
drupal_set_title(truncate_utf8($item->objectProfile->objLabel, 56, TRUE, TRUE)); |
|
|
|
|
|
|
|
|
|
$content_models = $objectHelper->get_content_models_list($pid); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Get the tabs from all modules... |
|
|
|
|
$hook_tabs = module_invoke_all('islandora_tabs', $content_models, $pid, $page_number); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$cmodels_tabs = array( |
|
|
|
|
'#type' => 'tabset', |
|
|
|
|
); |
|
|
|
|
$cmodels_tabs += $hook_tabs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assemble parameters, to pass during alter |
|
|
|
|
$params = array( |
|
|
|
|
$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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return tabs_render($cmodels_tabs); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1118,7 +1118,7 @@ function fedora_repository_get_items($pid = NULL, $dsId = NULL, $collection = NU
|
|
|
|
|
* fedora repository urlencode string |
|
|
|
|
* FIXME: URL-encoding is not the same as HTML/XML encoding... |
|
|
|
|
* @param type $str |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_urlencode_string($str) { |
|
|
|
|
return htmlentities($str); |
|
|
|
@ -1133,7 +1133,7 @@ function fedora_repository_urlencode_string($str) {
|
|
|
|
|
* @param type $dsId |
|
|
|
|
* @param type $label |
|
|
|
|
* @param type $version |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
@ -1156,7 +1156,7 @@ function fedora_object_as_attachment($pid, $dsId, $label=NULL, $version=NULL) {
|
|
|
|
|
* @param type $dsId |
|
|
|
|
* @param type $collection |
|
|
|
|
* @param type $pageNumber |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function repository_page($pid = NULL, $dsId = NULL, $collection = NULL, $pageNumber = NULL) { |
|
|
|
|
//do security check at fedora_repository_get_items function as it has to be called there in case |
|
|
|
@ -1170,7 +1170,7 @@ function repository_page($pid = NULL, $dsId = NULL, $collection = NULL, $pageNum
|
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $servicePid |
|
|
|
|
* @param type $serviceMethod |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
@ -1216,7 +1216,7 @@ function repository_service($pid = NULL, $servicePid = NULL, $serviceMethod = NU
|
|
|
|
|
* |
|
|
|
|
* @param type $op |
|
|
|
|
* @param type $keys |
|
|
|
|
* @return array |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_search($op = 'search', $keys = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
@ -1299,7 +1299,7 @@ function fedora_repository_search($op = 'search', $keys = NULL) {
|
|
|
|
|
* Display the search results |
|
|
|
|
* |
|
|
|
|
* @param type $resultData |
|
|
|
|
* @return array |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_search_page($resultData) { |
|
|
|
|
$path = drupal_get_path('module', 'fedora_repository'); |
|
|
|
@ -1377,7 +1377,7 @@ function fedora_repository_search_page($resultData) {
|
|
|
|
|
* |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $form_id |
|
|
|
|
* @param type $form_id |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_form_alter(&$form, &$form_state, $form_id) { |
|
|
|
|
// Advanced node search form |
|
|
|
@ -1433,7 +1433,7 @@ function fedora_repository_form_alter(&$form, &$form_state, $form_id) {
|
|
|
|
|
* Implementation of hook_search_validate() |
|
|
|
|
* |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $form_state |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_search_validate($form, &$form_state) { |
|
|
|
|
// Initialise using any existing basic search keywords. |
|
|
|
@ -1453,7 +1453,7 @@ function fedora_repository_search_validate($form, &$form_state) {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository theme |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_theme() { |
|
|
|
|
return array( |
|
|
|
@ -1481,7 +1481,7 @@ function fedora_repository_theme() {
|
|
|
|
|
* @param type $field |
|
|
|
|
* @param type $startTerm |
|
|
|
|
* @param type $displayName |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_list_terms($field, $startTerm = NULL, $displayName = NULL) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'SearchClass'); |
|
|
|
@ -1491,7 +1491,7 @@ function fedora_repository_list_terms($field, $startTerm = NULL, $displayName =
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository mnpl advanced search form |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_mnpl_advanced_search_form() { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'SearchClass'); |
|
|
|
@ -1500,9 +1500,9 @@ function fedora_repository_mnpl_advanced_search_form() {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* theme fedora repository mnpl advanced search form |
|
|
|
|
* theme fedora repository mnpl advanced search form |
|
|
|
|
* @param type $form |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function theme_fedora_repository_mnpl_advanced_search_form($form) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'SearchClass'); |
|
|
|
@ -1514,7 +1514,7 @@ function theme_fedora_repository_mnpl_advanced_search_form($form) {
|
|
|
|
|
* fedora repository mnpl advanced search |
|
|
|
|
* @param type $query |
|
|
|
|
* @param type $startPage |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_mnpl_advanced_search($query, $startPage = 1) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'SearchClass'); |
|
|
|
@ -1526,7 +1526,7 @@ function fedora_repository_mnpl_advanced_search($query, $startPage = 1) {
|
|
|
|
|
/** |
|
|
|
|
* fedora repository mnpl_advanced search form submit |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $form_state |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_mnpl_advanced_search_form_submit($form, &$form_state) { |
|
|
|
|
$type_id = $form_state['values']['type']; |
|
|
|
@ -1548,7 +1548,7 @@ function fedora_repository_mnpl_advanced_search_form_submit($form, &$form_state)
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository install demo page |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_install_demos_page() { |
|
|
|
|
$output = drupal_get_form('fedora_repository_demo_objects_form'); |
|
|
|
@ -1557,7 +1557,7 @@ function fedora_repository_install_demos_page() {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository demo objects form |
|
|
|
|
* @return string |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_demo_objects_form() { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'ObjectHelper'); |
|
|
|
@ -1590,7 +1590,7 @@ function fedora_repository_demo_objects_form() {
|
|
|
|
|
try { |
|
|
|
|
$demo_objects[$available_demo] = new Fedora_Item($available_demo); |
|
|
|
|
} catch (exception $e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (empty($demo_objects[$available_demo]->objectProfile)) { |
|
|
|
@ -1650,7 +1650,7 @@ function fedora_repository_demo_objects_form() {
|
|
|
|
|
* fedora repository demo objects form submit |
|
|
|
|
* @global type $base_url |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $form_state |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_demo_objects_form_submit($form, &$form_state) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
@ -1727,7 +1727,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
|
|
|
|
|
$tn = $new_item->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/images/Crystal_Clear_mimetype_pdf.png', 'TN', 'Thumbnail.png', 'image/png', 'M'); |
|
|
|
|
drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/islandora:demos\">islandora:demos</a>.", array('@base_url' => check_plain($base_url))), 'message'); |
|
|
|
|
} catch (exception $e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1742,14 +1742,14 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
|
|
|
|
|
try { |
|
|
|
|
$cmstream = $cm->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/STANDARD JPG.xml', 'ISLANDORACM', 'Content Model.xml', 'application/xml', 'X'); |
|
|
|
|
} catch (exception $e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
$dual_res_image_collection_cmodel = new Fedora_Item('demo:DualResImageCollection'); |
|
|
|
|
try { |
|
|
|
|
$cmstream = $dual_res_image_collection_cmodel->add_datastream_from_file(drupal_get_path('module', 'fedora_repository') . '/content_models/COLLECTIONCM.xml', 'ISLANDORACM', 'Islandora Content Model.xml', 'application/xml', 'X'); |
|
|
|
|
drupal_set_message(t("Successfully installed <a href=\"@base_url/fedora/repository/demo:SmileyStuff\">demo:SmileyStuff</a> collection view.", array('@base_url' => check_plain($base_url))), 'message'); |
|
|
|
|
} catch (exception $e) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1780,7 +1780,7 @@ function fedora_repository_demo_objects_form_submit($form, &$form_state) {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository required fedora objects |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_required_fedora_objects() { |
|
|
|
|
// array( 'path-to-foxml-file', 'pid', 'dsid', 'path-to-datastream-file', int dsversion, boolean required) |
|
|
|
@ -1834,7 +1834,7 @@ function fedora_repository_elements() {
|
|
|
|
|
/** |
|
|
|
|
* fedora repository expand time |
|
|
|
|
* @param type $element |
|
|
|
|
* @return string |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_expand_time($element) { |
|
|
|
|
// Default to current time, check default_value but set value so that if |
|
|
|
@ -1877,7 +1877,7 @@ function fedora_repository_expand_time($element) {
|
|
|
|
|
/** |
|
|
|
|
* fedora repository time |
|
|
|
|
* @param type $element |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_time($element) { |
|
|
|
|
$output = '<div class="container-inline">' . $element['#children'] . '</div>'; |
|
|
|
@ -1887,7 +1887,7 @@ function fedora_repository_time($element) {
|
|
|
|
|
/** |
|
|
|
|
* theme fedora repository time |
|
|
|
|
* @param type $element |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function theme_fedora_repository_time($element) { |
|
|
|
|
$output = '<div class="container-inline">' . $element['#children'] . '</div>'; |
|
|
|
@ -1898,7 +1898,7 @@ function theme_fedora_repository_time($element) {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository remove item from basket |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $pid |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_remove_item_from_basket($pid) { |
|
|
|
|
|
|
|
|
@ -1923,7 +1923,7 @@ function fedora_repository_remove_item_from_basket($pid) {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository basket |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_basket() { |
|
|
|
|
$pids = _fedora_repository_get_basket_pids(); |
|
|
|
@ -1984,7 +1984,7 @@ function fedora_repository_basket_form($form_state, $pids) {
|
|
|
|
|
/** |
|
|
|
|
* theme fedora repository basket form |
|
|
|
|
* @param type $form |
|
|
|
|
* @return string |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
function theme_fedora_repository_basket_form($form) { |
|
|
|
|
$header = array( |
|
|
|
@ -2019,7 +2019,7 @@ function theme_fedora_repository_basket_form($form) {
|
|
|
|
|
/** |
|
|
|
|
* fedora repository basket form validate |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @param type $form_state |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_basket_form_validate($form, &$form_state) { |
|
|
|
|
|
|
|
|
@ -2030,7 +2030,7 @@ function fedora_repository_basket_form_validate($form, &$form_state) {
|
|
|
|
|
* @global type $user |
|
|
|
|
* @param type $form |
|
|
|
|
* @param type $form_state |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_basket_form_submit($form, &$form_state) { |
|
|
|
|
if ($form_state['values']['op'] == $form_state['values']['remove_submit']) { |
|
|
|
@ -2099,9 +2099,9 @@ function fedora_repository_basket_form_submit($form, &$form_state) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get all pids saved to the basket. |
|
|
|
|
* Get all pids saved to the basket. |
|
|
|
|
* |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function _fedora_repository_get_basket_pids() { |
|
|
|
|
|
|
|
|
@ -2141,7 +2141,7 @@ function _fedora_repository_empty_basket() {
|
|
|
|
|
* fedora repository add to basket |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $warn |
|
|
|
|
* @param type $searchResultsFlag |
|
|
|
|
* @param type $searchResultsFlag |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFlag = FALSE) { |
|
|
|
|
if ($warn && _is_added_to_basket($pid)) { |
|
|
|
@ -2164,7 +2164,7 @@ function fedora_repository_add_to_basket($pid, $warn = TRUE, $searchResultsFlag
|
|
|
|
|
/** |
|
|
|
|
* fedora repository remove from basket |
|
|
|
|
* @param type $pid |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_remove_from_basket($pid) { |
|
|
|
|
if (isset($_SESSION['basket']['unprocessed'][$pid])) { |
|
|
|
@ -2181,7 +2181,7 @@ function fedora_repository_remove_from_basket($pid) {
|
|
|
|
|
* theme add to basket link |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $type |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function theme_add_to_basket_link($pid, $type = 'object') { |
|
|
|
|
$object = t($type); |
|
|
|
@ -2208,7 +2208,7 @@ function theme_add_to_basket_link($pid, $type = 'object') {
|
|
|
|
|
* is added to basket |
|
|
|
|
* @param type $pid |
|
|
|
|
* @param type $account |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function _is_added_to_basket($pid, $account = NULL) { |
|
|
|
|
return isset($_SESSION['basket']['unprocessed'][$pid]) || isset($_SESSION['basket']['processed'][$pid]); |
|
|
|
@ -2218,7 +2218,7 @@ function _is_added_to_basket($pid, $account = NULL) {
|
|
|
|
|
/** |
|
|
|
|
* fedora repository display schema |
|
|
|
|
* @param type $file |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_display_schema($file) { |
|
|
|
|
$path = drupal_get_path('module', 'fedora_repository'); |
|
|
|
@ -2233,12 +2233,14 @@ function fedora_repository_display_schema($file) {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* fedora repository batch reingest object |
|
|
|
|
* @param type $object |
|
|
|
|
* |
|
|
|
|
* @param array $object |
|
|
|
|
* An array defining an object to ingest. |
|
|
|
|
* @param type $context |
|
|
|
|
* @return type |
|
|
|
|
* @return type |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_batch_reingest_object($object, &$context) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_utils'); |
|
|
|
|
|
|
|
|
@ -2247,29 +2249,28 @@ function fedora_repository_batch_reingest_object($object, &$context) {
|
|
|
|
|
if (!valid_pid($pid)) { |
|
|
|
|
return NULL; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Does the object exist? If so, purge it. |
|
|
|
|
//dd("About to test existence of PID: $pid"); |
|
|
|
|
$item = new Fedora_Item($pid); |
|
|
|
|
if ($item->exists()) { |
|
|
|
|
//dd(' Found'); |
|
|
|
|
$item->purge(t('Remove during re-install batch job')); |
|
|
|
|
//dd(' Purged'); |
|
|
|
|
} |
|
|
|
|
// Need to have this a couple places... |
|
|
|
|
// (After trying from FOXML and later for individual DSs) |
|
|
|
|
$new_item = NULL; |
|
|
|
|
// Seems like this might be getting messed up due to scope?. |
|
|
|
|
$datastreams = array(); |
|
|
|
|
|
|
|
|
|
$new_item = NULL; //Need to have this a couple places... (After trying from FOXML and later for individual DSs) |
|
|
|
|
$datastreams = array(); //Seems like this might be getting messed up due to scope? |
|
|
|
|
|
|
|
|
|
// Ingest the object from the source file. |
|
|
|
|
// Ingest the object from the source file. |
|
|
|
|
if (!empty($object['foxml_file'])) { |
|
|
|
|
$foxml_file = $object['foxml_file']; |
|
|
|
|
$new_item = Fedora_Item::ingest_from_FOXML_file($foxml_file); |
|
|
|
|
if ($new_item->exists()) { |
|
|
|
|
// Batch operation was successful; can still add additional DSs, though |
|
|
|
|
// Batch operation was successful; can still add additional DSs, though. |
|
|
|
|
$context['message'][] = t('%pid installed.', array('%pid' => $new_item->pid)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($object['dsid']) && !empty($object['datastream_file'])) { |
|
|
|
|
$datastreams[] = array( |
|
|
|
|
'dsid' => $object['dsid'], |
|
|
|
@ -2282,9 +2283,7 @@ function fedora_repository_batch_reingest_object($object, &$context) {
|
|
|
|
|
|
|
|
|
|
$label = !empty($object['label']) ? $object['label'] : ''; |
|
|
|
|
if (!isset($new_item)) { |
|
|
|
|
//dd(' Not found, creating'); |
|
|
|
|
$new_item = Fedora_Item::ingest_new_item($pid, 'A', $label); |
|
|
|
|
//dd(' Created'); |
|
|
|
|
} |
|
|
|
|
elseif (!empty($label)) { |
|
|
|
|
$new_item->modify_object($label); |
|
|
|
@ -2292,17 +2291,12 @@ function fedora_repository_batch_reingest_object($object, &$context) {
|
|
|
|
|
|
|
|
|
|
if (isset($new_item)) { |
|
|
|
|
if (!empty($object['cmodel'])) { |
|
|
|
|
//dd(' relating to cmodel'); |
|
|
|
|
$new_item->add_relationship('hasModel', $object['cmodel'], FEDORA_MODEL_URI); |
|
|
|
|
//dd(' related to cmodel'); |
|
|
|
|
} |
|
|
|
|
if (!empty($object['parent'])) { |
|
|
|
|
//dd(' adding parent'); |
|
|
|
|
$new_item->add_relationship('isMemberOfCollection', $object['parent']); |
|
|
|
|
//dd(' parent added'); |
|
|
|
|
} |
|
|
|
|
foreach ((array)$datastreams as $ds) { |
|
|
|
|
//dd("trying to add ds: {$ds['dsid']}"); |
|
|
|
|
foreach ((array) $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'); |
|
|
|
|
} |
|
|
|
@ -2315,14 +2309,28 @@ function fedora_repository_batch_reingest_object($object, &$context) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Content model, collection view and collection policy datastreams may now optionally define a version |
|
|
|
|
* This function will send the postprocess solution pack hook. |
|
|
|
|
* It is referenced by the solution pack form's batch finished entry. |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_solutionpack_send_postprocess($success, $results, $operations) { |
|
|
|
|
// Hook to let solution pack objects be modified. |
|
|
|
|
// Not using module_invoke so solution packs can be expanded by other modules. |
|
|
|
|
if($success) { |
|
|
|
|
module_invoke_all('postprocess_solution_pack', $_SESSION['solution_pack_module_name']); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Content model, collection view and collection policy datastreams may |
|
|
|
|
* now optionally define a version |
|
|
|
|
* number in their top-level XML element as an attribute, as in: |
|
|
|
|
* <content_model name="Collection" version="2" ... |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param Fedora_Item $item |
|
|
|
|
* @param string $dsid |
|
|
|
|
* @param string $datastream_file |
|
|
|
|
* @return int, or NULL if no version attribute was found. |
|
|
|
|
* @return int, or NULL if no version attribute was found. |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_get_islandora_datastream_version($item = NULL, $dsid = NULL, $datastream_file = NULL) { |
|
|
|
|
$return = NULL; |
|
|
|
@ -2332,18 +2340,18 @@ function fedora_repository_get_islandora_datastream_version($item = NULL, $dsid
|
|
|
|
|
elseif (!empty($datastream_file)) { |
|
|
|
|
$doc = simplexml_load_file($datastream_file); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($doc) && $version = (int)$doc->attributes()->version) { |
|
|
|
|
$return = $version; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* theme fedora repository solution pack list |
|
|
|
|
* @param type $solution_packs |
|
|
|
|
* @return string |
|
|
|
|
* @return string |
|
|
|
|
*/ |
|
|
|
|
function theme_fedora_repository_solution_packs_list($solution_packs) { |
|
|
|
|
module_load_include('inc', 'fedora_repository', 'api/fedora_item'); |
|
|
|
@ -2359,7 +2367,7 @@ function theme_fedora_repository_solution_packs_list($solution_packs) {
|
|
|
|
|
/** |
|
|
|
|
* Implementation of hook_forms() |
|
|
|
|
* @param string $form_id |
|
|
|
|
* @return array |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
function fedora_repository_forms($form_id) { |
|
|
|
|
$forms = array(); |
|
|
|
@ -2396,12 +2404,12 @@ function fedora_repository_imagecache_default_presets() {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 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 |
|
|
|
@ -2425,10 +2433,10 @@ function _fedora_repository_render_image($tn_path, $imagecache_preset = 'fedora_
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 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. |
|
|
|
@ -2447,7 +2455,7 @@ function fedora_repository_render_image($pid, $dsid, $imagecache_preset = 'fedor
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Convenience function used in XSLT callback... |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* @param $string string |
|
|
|
|
* A string containing some markup to convert to a domnode. |
|
|
|
|
*/ |
|
|
|
|