Browse Source

Fixed formatting

pull/108/merge
rwincewicz 13 years ago
parent
commit
c6e40ce7b8
  1. 192
      islandora.module

192
islandora.module

@ -427,111 +427,111 @@ function islandora_islandora_view_object($object) {
if (empty($combined_list)) { if (empty($combined_list)) {
$output = theme('islandora_default', array('islandora_object' => $object)); $output = theme('islandora_default', array('islandora_object' => $object));
return array('Default Output' => $output); return array('Default Output' => $output);
foreach ($object->models as $model) { foreach ($object->models as $model) {
if (isset($supported_models[$model][ISLANDORA_VIEW_HOOK]) && $supported_models[$model][ISLANDORA_VIEW_HOOK] == TRUE) {//another module is handling the view if (isset($supported_models[$model][ISLANDORA_VIEW_HOOK]) && $supported_models[$model][ISLANDORA_VIEW_HOOK] == TRUE) {//another module is handling the view
return; return;
}
} }
} }
}
/**
* Theme registry function
* @return array
*/
function islandora_theme() {
return array(
'islandora_default' => array(
'template' => 'islandora-object',
'variables' => array('islandora_object' => NULL),
),
'islandora_default_edit' => array(
'template' => 'islandora-object-edit',
'variables' => array('islandora_object' => NULL),
),
);
}
/** /**
* drupal hook_permissions function * Theme registry function
* @return array * @return array
*/ */
function islandora_permission() { function islandora_theme() {
return array( return array(
FEDORA_VIEW => array( 'islandora_default' => array(
'title' => t('View Fedora Repository objects and datastreams'), 'template' => 'islandora-object',
'description' => t('Users with this permission will be allowed to view Fedora objects and datastreams. Unless Fedora XACML security policies limits this functionality to certain objects.') 'variables' => array('islandora_object' => NULL),
), ),
FEDORA_ADD_DS => array( 'islandora_default_edit' => array(
'title' => t('Add Fedora streams to Fedora objects'), 'template' => 'islandora-object-edit',
'description' => t('Users with this permission will be allowed to add datastreams to Fedora objects. Unless Fedora XACML security policies limits this functionality to certain objects.') 'variables' => array('islandora_object' => NULL),
), ),
FEDORA_METADATA_EDIT => array( );
'title' => t('Edit Fedora Metadata'),
'description' => t('Users with this permission will be allowed to edit Fedora Metadata streams')
),
FEDORA_INGEST => array(
'title' => t('Create new Fedora objects'),
'description' => t('Users with this permission will be allowed to create new objects in the Fedora repository')
),
FEDORA_PURGE => array(
'title' => t('Permanently remove objects from the Fedora repository'),
'description' => t('Users with this permission will be allowed to Permantly remove objects from the Fedora repository.')
),
FEDORA_MODIFY_STATE => array(
'title' => t('Change a Fedora objects state'),
'description' => t('Users with this permission will be allowed to change a Fedora objects state.')
),
);
}
/**
*
* @param string $object_id
* @return type
*/
function islandora_add_datastream($object_id) {
if (!isset($object_id)) {
drupal_set_message(t('Cannot add datastream to object, object id not set'));
return;
} }
//send message to synapse
$object = new IslandoraObject($object_id);
if (!isset($object)) { /**
drupal_set_message(t('Could not remove object, object not found')); * drupal hook_permissions function
return; * @return array
*/
function islandora_permission() {
return array(
FEDORA_VIEW => array(
'title' => t('View Fedora Repository objects and datastreams'),
'description' => t('Users with this permission will be allowed to view Fedora objects and datastreams. Unless Fedora XACML security policies limits this functionality to certain objects.')
),
FEDORA_ADD_DS => array(
'title' => t('Add Fedora streams to Fedora objects'),
'description' => t('Users with this permission will be allowed to add datastreams to Fedora objects. Unless Fedora XACML security policies limits this functionality to certain objects.')
),
FEDORA_METADATA_EDIT => array(
'title' => t('Edit Fedora Metadata'),
'description' => t('Users with this permission will be allowed to edit Fedora Metadata streams')
),
FEDORA_INGEST => array(
'title' => t('Create new Fedora objects'),
'description' => t('Users with this permission will be allowed to create new objects in the Fedora repository')
),
FEDORA_PURGE => array(
'title' => t('Permanently remove objects from the Fedora repository'),
'description' => t('Users with this permission will be allowed to Permantly remove objects from the Fedora repository.')
),
FEDORA_MODIFY_STATE => array(
'title' => t('Change a Fedora objects state'),
'description' => t('Users with this permission will be allowed to change a Fedora objects state.')
),
);
} }
module_invoke_all('islandora_add_datastream', $object); //allow submodules to handle add datastream based on object type
}
function islandora_preprocess_islandora_default(&$variables) { /**
$islandora_object = $variables['islandora_object']; *
module_load_include('inc', 'islandora', 'utils/islandora_dublin_core'); * @param string $object_id
try { * @return type
$dc = $islandora_object['DC']->content; */
//$dc_xml = simplexml_load_string($dc); function islandora_add_datastream($object_id) {
$dc_object = Dublin_Core::import_from_xml_string($dc); if (!isset($object_id)) {
} catch (Exception $e) { drupal_set_message(t('Cannot add datastream to object, object id not set'));
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error'); return;
}
//send message to synapse
$object = new IslandoraObject($object_id);
if (!isset($object)) {
drupal_set_message(t('Could not remove object, object not found'));
return;
}
module_invoke_all('islandora_add_datastream', $object); //allow submodules to handle add datastream based on object type
} }
$variables['islandora_dublin_core'] = $dc_object;
$variables['islandora_object_label'] = $islandora_object->label; function islandora_preprocess_islandora_default(&$variables) {
global $base_url; $islandora_object = $variables['islandora_object'];
if (isset($islandora_object['TN'])) { module_load_include('inc', 'islandora', 'utils/islandora_dublin_core');
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view'; try {
$dc = $islandora_object['DC']->content;
//$dc_xml = simplexml_load_string($dc);
$dc_object = Dublin_Core::import_from_xml_string($dc);
} catch (Exception $e) {
drupal_set_message(t('Error retrieving object %s %t', array('%s' => $islandora_object->id, '%t' => $e->getMessage())), 'error');
}
$variables['islandora_dublin_core'] = $dc_object;
$variables['islandora_object_label'] = $islandora_object->label;
global $base_url;
if (isset($islandora_object['TN'])) {
$variables['islandora_thumbnail_url'] = $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/TN/view';
}
} }
}
function islandora_preprocess_islandora_default_edit(&$variables) { function islandora_preprocess_islandora_default_edit(&$variables) {
$islandora_object = $variables['islandora_object']; $islandora_object = $variables['islandora_object'];
global $base_url; global $base_url;
$datastreams = array(); $datastreams = array();
foreach ($islandora_object as $ds) { foreach ($islandora_object as $ds) {
$datastreams['download_url'] = $base_url . '/islandora/object/' . $islandora_object->id . 'datastream/' . $ds->id .'/download'; $datastreams['download_url'] = $base_url . '/islandora/object/' . $islandora_object->id . 'datastream/' . $ds->id . '/download';
$datastreams['view_url'] = $base_url . '/islandora/object/' . $islandora_object->id . 'datastream/' . $ds->id .'/view'; $datastreams['view_url'] = $base_url . '/islandora/object/' . $islandora_object->id . 'datastream/' . $ds->id . '/view';
$datastreams['delete_url'] = $base_url . '/islandora/object/' . $islandora_object->id . 'datastream/' . $ds->id .'/delete'; $datastreams['delete_url'] = $base_url . '/islandora/object/' . $islandora_object->id . 'datastream/' . $ds->id . '/delete';
$variables['islandora_datastreams'][$ds->id] = $datastreams; $variables['islandora_datastreams'][$ds->id] = $datastreams;
}
} }
}
} }
Loading…
Cancel
Save