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..61ccd5f 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' => 'Currentl Memberships', + '#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 +} + diff --git a/islandora_book.info b/islandora_book.info index 9561746..a74b19f 100644 --- a/islandora_book.info +++ b/islandora_book.info @@ -4,5 +4,7 @@ package = Islandora Solution Pack dependencies[] = fedora_repository dependencies[] = xml_forms dependencies[] = islandora_content_model_forms +dependencies[] = islandora_collection_manager version = 11.3beta3 + core = 6.x 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');