From 29d02c2d1359f40a455c23a918a33a84aec4ed90 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Thu, 31 May 2012 18:22:19 -0300 Subject: [PATCH] Some updates to collections. --- includes/datastream.inc | 4 +++- .../includes/child_collection.inc | 8 ++++++-- .../includes/collection_management.inc | 10 ++++++---- .../islandora_basic_collection.module | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/includes/datastream.inc b/includes/datastream.inc index 24eeb6a2..6cc906b7 100644 --- a/includes/datastream.inc +++ b/includes/datastream.inc @@ -15,6 +15,9 @@ define('DS_COMP_STREAM', 'DS-COMPOSITE-MODEL'); */ function islandora_datastream_as_attachment($object_id, $dsid) { module_load_include('inc', 'islandora', 'RestConnection'); + drupal_add_http_header("Cache-Control", 'public'); + drupal_add_http_header("Pragma", FALSE); + global $user; try { $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') { header('Content-length: ' . $fedora_object[$dsid]->size); } - header("Cache-control: private"); $method = arg(5); if (isset($method) && $method == 'download') { header("Content-Disposition: attachment; filename=\"" . $fedora_object[$dsid]->label); diff --git a/islandora_basic_collection/includes/child_collection.inc b/islandora_basic_collection/includes/child_collection.inc index 59a8a3dd..f9847c0d 100644 --- a/islandora_basic_collection/includes/child_collection.inc +++ b/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", '#type' => 'textfield', '#size' => 15, - '#default_value' => $rest_connection->repository->api->m->getNextPid($collection_namespace), - '#description' => t("Unique PID for this collection.
Pids take the general form of namespace:collection (eg. islandora:pamphlets)"), + '#default_value' => '', + '#description' => t("Unique PID for this collection. Leave blank for default.
Pids take the general form of namespace:collection (eg. islandora:pamphlets)"), ); if (!$restricted) { @@ -128,6 +128,10 @@ function islandora_create_child_collection_form_submit($form, &$form_state) { module_load_include('inc', 'islandora', '/includes/islandora.ingest'); $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']; + $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']; $namespace = $form_state['values']['collection_namespace']; $all_cModels = get_content_models_as_option_array(); diff --git a/islandora_basic_collection/includes/collection_management.inc b/islandora_basic_collection/includes/collection_management.inc index e2d42170..9252aefc 100644 --- a/islandora_basic_collection/includes/collection_management.inc +++ b/islandora_basic_collection/includes/collection_management.inc @@ -25,11 +25,13 @@ where (\$object repository->ri->itqlQuery($query, 'unlimited', '0'); $represented_models = array(); foreach ($model_pids as $model_pid) { - 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); - $content_model_title = $fedora_object->label; - $represented_models[$model_pid['model']['value']] = $model_pid['model']['value'] . ' ~ ' . $content_model_title; + try { + $fedora_object = new FedoraObject($model_pid['model']['value'], $rest_connection->repository); + $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; diff --git a/islandora_basic_collection/islandora_basic_collection.module b/islandora_basic_collection/islandora_basic_collection.module index f524a298..bf138ecb 100644 --- a/islandora_basic_collection/islandora_basic_collection.module +++ b/islandora_basic_collection/islandora_basic_collection.module @@ -30,7 +30,7 @@ function islandora_basic_collection_menu() { $items = array(); $items['islandora/object/%/manage/collection'] = array( - 'title' => 'Collection related', + 'title' => 'Collection', 'page callback' => 'islandora_basic_collection_manage_object', 'page arguments' => array(2), 'type' => MENU_LOCAL_TASK,