Browse Source

Updated collections.

pull/122/merge
jonathangreen 13 years ago
parent
commit
0b5babab56
  1. 15
      includes/datastream.inc
  2. 2
      islandora.module
  3. 17
      islandora_basic_collection/admin/islandora_basic_collection.admin.inc
  4. 8
      islandora_basic_collection/islandora_basic_collection.module
  5. 6
      islandora_basic_collection/theme/islandora_basic_collection.theme.inc

15
includes/datastream.inc

@ -428,6 +428,21 @@ function islandora_datastream_get_url($ds, $type = 'download') {
} }
} }
function islandora_datastream_get_delete_link($ds) {
$datastreams = module_invoke_all('islandora_undeletable_datastreams', $ds->parent->models);
if(in_array($ds->id, $datastreams)) {
return '';
}
else {
return l(t('delete'), 'islandora/object/' . $ds->parent->id . '/datastream/' . $ds->id . '/delete');
}
}
function islandora_islandora_undeletable_datastreams($models) {
return array('DC');
}
function islandora_datastream_edit_get_link($object, $ds_id) { function islandora_datastream_edit_get_link($object, $ds_id) {
$edit_registry = module_invoke_all('islandora_edit_datastream_registry', $object, $ds_id); $edit_registry = module_invoke_all('islandora_edit_datastream_registry', $object, $ds_id);
if (count($edit_registry) > 0 && user_access(FEDORA_METADATA_EDIT)) { if (count($edit_registry) > 0 && user_access(FEDORA_METADATA_EDIT)) {

2
islandora.module

@ -742,7 +742,7 @@ function islandora_preprocess_islandora_default_edit(&$variables) {
array('class' => 'datastream-size', 'data' => islandora_datastream_get_human_readable_size($ds)), array('class' => 'datastream-size', 'data' => islandora_datastream_get_human_readable_size($ds)),
array('class' => 'datastream-download', 'data' => l(t('download'), islandora_datastream_get_url($ds, 'download'))), array('class' => 'datastream-download', 'data' => l(t('download'), islandora_datastream_get_url($ds, 'download'))),
array('class' => 'datstream-edit', 'data' => islandora_datastream_edit_get_link($islandora_object, $ds->id)), array('class' => 'datstream-edit', 'data' => islandora_datastream_edit_get_link($islandora_object, $ds->id)),
array('class' => 'datastream-delete', 'data' => l(t('delete'), $base_url . '/islandora/object/' . $islandora_object->id . '/datastream/' . $ds->id . '/delete')), array('class' => 'datastream-delete', 'data' => islandora_datastream_get_delete_link($ds)),
); );
} }
$caption = $islandora_object->label . ' - ' . $islandora_object->id; $caption = $islandora_object->label . ' - ' . $islandora_object->id;

17
islandora_basic_collection/admin/islandora_basic_collection.admin.inc

@ -26,6 +26,23 @@ function islandora_basic_collection_admin() {
'#description' => t('The default number of object to show in a collection view.'), '#description' => t('The default number of object to show in a collection view.'),
'#weight' => -10 '#weight' => -10
); );
$form['islandora_basic_collection_disable_collection_policy_delete'] = array(
'#type' => 'checkbox',
'#title' => t('Disable deleting the collection policy'),
'#default_value' => variable_get('islandora_basic_collection_disable_collection_policy_delete', TRUE),
'#description' => t('This will disable the delete link for the COLLECTION_POLICY in the manage tab.'),
'#weight' => -10
);
$form['islandora_basic_collection_default_view'] = array(
'#type' => 'select',
'#title' => t('Select the default collection view style.'),
'#default_value' => variable_get('islandora_basic_collection_default_view', 'grid'),
'#options' => array(
'list' => t('List'),
'grid' => t('Grid'),
),
'#weight' => -10
);
return system_settings_form($form); return system_settings_form($form);
} }

8
islandora_basic_collection/islandora_basic_collection.module

@ -327,4 +327,12 @@ function islandora_basic_collection_islandora_ingest_get_information($models, $o
drupal_set_message(t('Islandora Error getting collection info for %s', array('%s' => $object->id)), 'error'); drupal_set_message(t('Islandora Error getting collection info for %s', array('%s' => $object->id)), 'error');
} }
} }
}
function islandora_basic_collection_islandora_undeletable_datastreams($models) {
if(in_array('islandora:collectionCModel', $models)) {
if(variable_get('islandora_basic_collection_disable_collection_policy_delete', TRUE)) {
return array('COLLECTION_POLICY');
}
}
} }

6
islandora_basic_collection/theme/islandora_basic_collection.theme.inc

@ -17,19 +17,19 @@ function islandora_basic_collection_preprocess_islandora_basic_collection_wrappe
$total_count = count($results); $total_count = count($results);
pager_default_initialize($total_count, $page_size); pager_default_initialize($total_count, $page_size);
$variables['collection_pager'] = theme('pager', array('quantity' => 10)); $variables['collection_pager'] = theme('pager', array('quantity' => 10));
$display = (empty($_GET['display'])) ? 'list' : $_GET['display']; $display = (empty($_GET['display'])) ? variable_get('islandora_basic_collection_default_view', 'grid') : $_GET['display'];
$link_text = (empty($_GET['display'])) ? 'grid' : $_GET['display']; $link_text = (empty($_GET['display'])) ? 'grid' : $_GET['display'];
$query_params = drupal_get_query_parameters($_GET); $query_params = drupal_get_query_parameters($_GET);
if ($display == 'grid') { if ($display == 'grid') {
$query_params['display'] = 'list'; $query_params['display'] = 'list';
$link_text = 'list view'; $link_text = 'List View';
$link_class = 'islandora-view-default'; $link_class = 'islandora-view-default';
$collection_content = theme('islandora_basic_collection_grid', array('islandora_object' => $islandora_object, 'collection_results' => $results)); $collection_content = theme('islandora_basic_collection_grid', array('islandora_object' => $islandora_object, 'collection_results' => $results));
} }
else { else {
$query_params['display'] = 'grid'; $query_params['display'] = 'grid';
$link_text = 'grid view'; $link_text = 'Grid View';
$link_class = 'islandora-view-grid'; $link_class = 'islandora-view-grid';
$collection_content = theme('islandora_basic_collection', array('islandora_object' => $islandora_object, 'collection_results' => $results)); $collection_content = theme('islandora_basic_collection', array('islandora_object' => $islandora_object, 'collection_results' => $results));
} }

Loading…
Cancel
Save