Browse Source

Some updates to collections.

pull/122/merge
jonathangreen 13 years ago
parent
commit
29d02c2d13
  1. 4
      includes/datastream.inc
  2. 8
      islandora_basic_collection/includes/child_collection.inc
  3. 10
      islandora_basic_collection/includes/collection_management.inc
  4. 2
      islandora_basic_collection/islandora_basic_collection.module

4
includes/datastream.inc

@ -15,6 +15,9 @@ define('DS_COMP_STREAM', 'DS-COMPOSITE-MODEL');
*/ */
function islandora_datastream_as_attachment($object_id, $dsid) { function islandora_datastream_as_attachment($object_id, $dsid) {
module_load_include('inc', 'islandora', 'RestConnection'); module_load_include('inc', 'islandora', 'RestConnection');
drupal_add_http_header("Cache-Control", 'public');
drupal_add_http_header("Pragma", FALSE);
global $user; global $user;
try { try {
$restConnection = new RestConnection($user); $restConnection = new RestConnection($user);
@ -29,7 +32,6 @@ function islandora_datastream_as_attachment($object_id, $dsid) {
if($fedora_object[$dsid]->controlGroup == 'M' || $fedora_object[$dsid]->controlGroup == 'X') { if($fedora_object[$dsid]->controlGroup == 'M' || $fedora_object[$dsid]->controlGroup == 'X') {
header('Content-length: ' . $fedora_object[$dsid]->size); header('Content-length: ' . $fedora_object[$dsid]->size);
} }
header("Cache-control: private");
$method = arg(5); $method = arg(5);
if (isset($method) && $method == 'download') { if (isset($method) && $method == 'download') {
header("Content-Disposition: attachment; filename=\"" . $fedora_object[$dsid]->label); header("Content-Disposition: attachment; filename=\"" . $fedora_object[$dsid]->label);

8
islandora_basic_collection/includes/child_collection.inc

@ -69,8 +69,8 @@ function islandora_create_child_collection_form($form, &$form_state, $this_colle
'#title' => "Collection PID", '#title' => "Collection PID",
'#type' => 'textfield', '#type' => 'textfield',
'#size' => 15, '#size' => 15,
'#default_value' => $rest_connection->repository->api->m->getNextPid($collection_namespace), '#default_value' => '',
'#description' => t("Unique PID for this collection. <br />Pids take the general form of namespace:collection (eg. islandora:pamphlets)"), '#description' => t("Unique PID for this collection. Leave blank for default. <br />Pids take the general form of namespace:collection (eg. islandora:pamphlets)"),
); );
if (!$restricted) { if (!$restricted) {
@ -128,6 +128,10 @@ function islandora_create_child_collection_form_submit($form, &$form_state) {
module_load_include('inc', 'islandora', '/includes/islandora.ingest'); module_load_include('inc', 'islandora', '/includes/islandora.ingest');
$thumbnail = $base_url . '/' . drupal_get_path('module', 'islandora_basic_collection') . '/Crystal_Clear_filesystem_folder_grey.png'; $thumbnail = $base_url . '/' . drupal_get_path('module', 'islandora_basic_collection') . '/Crystal_Clear_filesystem_folder_grey.png';
$new_collection_pid = $form_state['values']['new_collection_pid']; $new_collection_pid = $form_state['values']['new_collection_pid'];
$this_collection_pid = $form_state['values']['current'];
if(empty($new_collection_pid)) {
$collection_namespace = substr($this_collection_pid, 0, strpos($this_collection_pid, ":"));
}
$new_collection_label = $form_state['values']['collection_name']; $new_collection_label = $form_state['values']['collection_name'];
$namespace = $form_state['values']['collection_namespace']; $namespace = $form_state['values']['collection_namespace'];
$all_cModels = get_content_models_as_option_array(); $all_cModels = get_content_models_as_option_array();

10
islandora_basic_collection/includes/collection_management.inc

@ -25,11 +25,13 @@ where (\$object <info:fedora/fedora-system:def/relations-external#isMemberOf> <i
$model_pids = $rest_connection->repository->ri->itqlQuery($query, 'unlimited', '0'); $model_pids = $rest_connection->repository->ri->itqlQuery($query, 'unlimited', '0');
$represented_models = array(); $represented_models = array();
foreach ($model_pids as $model_pid) { foreach ($model_pids as $model_pid) {
if ($model_pid['model']['value'] && $model_pid['model']['value'] != 'fedora-system:FedoraObject-3.0') { if ($model_pid['model']['value'] && $model_pid['model']['value'] != 'fedora-system:FedoraObject-3.0') {
$fedora_object = new FedoraObject($model_pid['model']['value'], $rest_connection->repository); try {
$content_model_title = $fedora_object->label; $fedora_object = new FedoraObject($model_pid['model']['value'], $rest_connection->repository);
$represented_models[$model_pid['model']['value']] = $model_pid['model']['value'] . ' ~ ' . $content_model_title; $content_model_title = $fedora_object->label;
$represented_models[$model_pid['model']['value']] = $model_pid['model']['value'] . ' ~ ' . $content_model_title;
}
catch (RepositoryException $e) {}
} }
} }
return $represented_models; return $represented_models;

2
islandora_basic_collection/islandora_basic_collection.module

@ -30,7 +30,7 @@
function islandora_basic_collection_menu() { function islandora_basic_collection_menu() {
$items = array(); $items = array();
$items['islandora/object/%/manage/collection'] = array( $items['islandora/object/%/manage/collection'] = array(
'title' => 'Collection related', 'title' => 'Collection',
'page callback' => 'islandora_basic_collection_manage_object', 'page callback' => 'islandora_basic_collection_manage_object',
'page arguments' => array(2), 'page arguments' => array(2),
'type' => MENU_LOCAL_TASK, 'type' => MENU_LOCAL_TASK,

Loading…
Cancel
Save