From 6454d5f33001d36e570274c587a48bd503bed34d Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Mon, 12 Dec 2011 08:09:51 -0400 Subject: [PATCH 1/4] disabled css initilaization - caused side effects in other modules --- islandora_book.module | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/islandora_book.module b/islandora_book.module index 4e17b89..c5c9edf 100644 --- a/islandora_book.module +++ b/islandora_book.module @@ -64,6 +64,8 @@ function islandora_book_islandora_tabs($content_models, $pid) { module_load_include('inc', 'islandora_book', 'book_object_manager'); module_load_include('inc', 'fedora_repository', 'plugins/FedoraObjectDetailedContent'); if (!variable_get('islandora_add_collection_tabs', TRUE)) { + drupal_add_css(drupal_get_path('module', 'islandora_book') . '/css/islandora_book.css'); + return; } @@ -97,9 +99,10 @@ function islandora_book_islandora_tabs($content_models, $pid) { /** * Implementation of hook_init + * (currenlty disabled) */ -function islandora_book_init() { +function disabled_islandora_book_init() { drupal_add_css(drupal_get_path('module', 'islandora_book') . '/css/islandora_book.css'); From 260e87113ceba358da1746d62aab4e9b9f4bba19 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Tue, 13 Dec 2011 11:37:16 -0400 Subject: [PATCH 2/4] Removed redundant display elements, improved collection management --- book.inc | 6 +--- book_object_manager.inc | 68 ++++++++++++++++++++++++++--------------- 2 files changed, 44 insertions(+), 30 deletions(-) diff --git a/book.inc b/book.inc index 9a13d74..0c245df 100644 --- a/book.inc +++ b/book.inc @@ -31,9 +31,9 @@ class IslandoraBook { public function showFieldSets() { module_load_include('inc', 'islandora_book', 'book_pack_utils'); module_load_include('inc', 'islandora_book', 'add_pages'); - drupal_set_title($this->item->objectProfile->objLabel); module_load_include('module', 'islandora_book'); module_load_include('inc', 'fedora_repository', 'CollectionClass'); + drupal_add_css(drupal_get_path('module', 'islandora_book') . '/css/islandora_book.css'); global $base_url; $show_purge_tab = (!empty($_POST['form_id']) && ($_POST['form_id'] == 'islandora_book_purge_pages_form')); $page_number = 1; @@ -107,7 +107,3 @@ class IslandoraBook { } - - - - diff --git a/book_object_manager.inc b/book_object_manager.inc index 4a74c5b..b8139d1 100644 --- a/book_object_manager.inc +++ b/book_object_manager.inc @@ -1,12 +1,10 @@ 'tabpage', @@ -35,8 +31,6 @@ function get_book_model_management_content($pid) { * @param string pid * @return array */ - - function book_management_form(&$form_state, $pid) { module_load_include('inc', 'islandora_book', 'book_pack_utils'); @@ -49,7 +43,7 @@ function book_management_form(&$form_state, $pid) { $purge_form = drupal_get_form('fedora_repository_purge_object_form', $content_helper->pid, check_plain(substr(request_uri(), strlen(base_path())))); $potential_collections = get_collections_as_option_array(); $current_collections = get_collection_relationships($pid); - $editform = drupal_get_form('fedora_repository_edit_qdc_form', $pid, 'DC'); + $values = array_values($current_collections); $collection_value = $values[0]; $keys = array_keys($current_collections); @@ -74,26 +68,47 @@ function book_management_form(&$form_state, $pid) { '#title' => t('Collection Membership'), ); - - $form['collections']['current'] = array( - '#title' => 'Currently Member of', - '#type' => 'item', - '#value' => $collection_value, + $form['collections']['collection_add'] = array( + '#type' => 'fieldset', + '#collapsed' => true, + '#collapsible' => true, + '#title' => t('Add Book to Collection'), ); - - $form['collections']['new_collection'] = array( + $form['collections']['collection_add']['new_collection'] = array( '#title' => 'New Collection', - '#description' => t("Move book object to new collection"), + '#description' => t("Add book to new collection"), '#type' => 'select', '#options' => $potential_collections, ); - $form['collections']['submit'] = array( + $form['collections']['collection_add']['submit'] = array( '#type' => 'submit', - '#id' => 'update_collection', - '#value' => t('Move Book to New Collection'), + '#id' => 'add_collection', + '#value' => t('Add Book to New Collection'), ); + if (count($current_collections) > 1) { + $form['collections']['collection_remove'] = array( + '#type' => 'fieldset', + '#collapsed' => true, + '#collapsible' => true, + '#title' => t('Remove Book from Collection'), + ); + + $form['collections']['collection_remove']['current'] = array( + '#title' => 'Currently Member of', + '#type' => 'select', + '#options' => $current_collections, + ); + + $form['collections']['collection_remove']['submit'] = array( + '#type' => 'submit', + '#id' => 'remove_collection', + '#value' => t('Remove Book from This Collection'), + ); + } + + $form['view_dc'] = array( '#type' => 'fieldset', @@ -185,20 +200,24 @@ function book_management_form(&$form_state, $pid) { * @param array $form * @param array $form_state */ - - - function book_management_form_submit($form, &$form_state) { global $user; $book_pid = $form_state['values']['pid']; $collection_pids = get_collection_from_pid($book_pid); $item = new Fedora_Item($book_pid); - if ($form_state['clicked_button']['#id'] == 'update_collection') { + + if ($form_state['clicked_button']['#id'] == 'add_collection') { $new_collection = $form_state['values']['new_collection']; $item->add_relationship('isMemberOfCollection', $new_collection, RELS_EXT_URI); drupal_goto("fedora/repository/$new_collection"); } + if ($form_state['clicked_button']['#id'] == 'remove_collection') { + $current = $form_state['values']['current']; + $item->purge_relationship('isMemberOfCollection', $current); + drupal_goto("fedora/repository/$book_pid"); + } + if ($form_state['clicked_button']['#id'] == 'refresh_datastreams') { if ($form_state['values']['do_ocr']) { $do_ocr = TRUE; @@ -223,7 +242,6 @@ function book_management_form_submit($form, &$form_state) { drupal_goto('fedora/repository/' . $collection_pids[0]); } - function book_batch_update_pages($book_pid, $do_ocr, $refresh_images, $make_pdf) { $page_pids = get_page_pids($book_pid); $count = count($page_pids); @@ -275,7 +293,6 @@ function replace_cover_thumbnail($book_pid, $page_pid) { file_delete($file); } - function recreate_pdf($book_pid) { module_load_include('inc', 'fedora_repository', 'api/fedora_item'); module_load_include('inc', 'islandora_book', 'book_pack_utils'); @@ -300,4 +317,5 @@ function recreate_pdf($book_pid) { $book_item->add_datastream_from_file($outputFile, 'PDF', "PDF of Book", 'application/pdf', 'M'); } islandora_recursive_directory_delete($file_dir); -} \ No newline at end of file +} + From 71ffa315fc3243c3c69d097b697d3dbd15718608 Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Tue, 13 Dec 2011 11:52:03 -0400 Subject: [PATCH 3/4] Changed labeling --- book_object_manager.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book_object_manager.inc b/book_object_manager.inc index b8139d1..61ccd5f 100644 --- a/book_object_manager.inc +++ b/book_object_manager.inc @@ -96,7 +96,7 @@ function book_management_form(&$form_state, $pid) { ); $form['collections']['collection_remove']['current'] = array( - '#title' => 'Currently Member of', + '#title' => 'Currentl Memberships', '#type' => 'select', '#options' => $current_collections, ); From 55887fcd417c46b05b97673be87a512938f1189e Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Tue, 13 Dec 2011 11:54:08 -0400 Subject: [PATCH 4/4] Added additional dependency to .info file --- islandora_book.info | 1 + 1 file changed, 1 insertion(+) diff --git a/islandora_book.info b/islandora_book.info index db7515f..10a2919 100644 --- a/islandora_book.info +++ b/islandora_book.info @@ -4,5 +4,6 @@ package = Islandora Solution Pack dependencies[] = fedora_repository dependencies[] = xml_forms dependencies[] = islandora_content_model_forms +dependencies[] = islandora_collection_manager version = 11.3beta2 core = 6.x