? .DS_Store ? actions_14.patch ? actions_help.patch ? block_sane_help.patch ? book_ahahapi.patch ? comment_notice.patch ? files ? fix_garland_and_menu_theme.patch ? install_profile_notice.patch ? jquery_upgrade.patch ? modules/.DS_Store ? profiles/.DS_Store ? profiles/single_user_blog ? sites/.DS_Store ? sites/views ? sites/all/.DS_Store ? sites/all/modules ? sites/all/themes ? sites/default/settings.php ? themes/garland/.DS_Store Index: modules/book/book.css =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.css,v retrieving revision 1.4 diff -u -p -r1.4 book.css --- modules/book/book.css 27 May 2007 17:57:48 -0000 1.4 +++ modules/book/book.css 10 Oct 2007 01:03:00 -0000 @@ -28,3 +28,6 @@ display: block; float: right; } +#edit-book-bid-wrapper .description { + clear: both; +} \ No newline at end of file Index: modules/book/book.js =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.js,v retrieving revision 1.3 diff -u -p -r1.3 book.js --- modules/book/book.js 12 Sep 2007 18:29:32 -0000 1.3 +++ modules/book/book.js 10 Oct 2007 01:03:00 -0000 @@ -1,35 +1,6 @@ // $Id: book.js,v 1.3 2007/09/12 18:29:32 goba Exp $ Drupal.behaviors.bookSelect = function(context) { - // This behavior attaches by ID, so is only valid once on a page. - if ($('#edit-book-bid.book-select-processed').size()) { - return; - } // Hide the button in the node form, since it's not needed when JS is enabled. - $('#edit-book-pick-book').css('display', 'none'); - - // Binds a function to the keyup and change actions of the book select to - // retrieve parent options. Mark as processed so this binding is only done once. - $('#edit-book-bid') - .keyup(Drupal.bookFillSelect) - .change(Drupal.bookFillSelect) - .addClass('book-select-processed'); -}; - -// This function passes the form information and the book ID to a Drupal callback -// and retrieves a parent select with changed options to replace the one in the form. -Drupal.bookFillSelect = function() { - // Create a progress bar and substitute it for the parent select. - pb = new Drupal.progressBar('book_progress'); - pb.setProgress(-1, Drupal.t('Updating parents...')); - $('#edit-book-plid-wrapper').html(pb.element); - - $.ajax({ - url: Drupal.settings.book.formCallback +'/'+ $('#'+ Drupal.settings.book.formId +' input[name=form_build_id]').val() +'/'+ $('#edit-book-bid').val(), - dataType: 'json', - success: function(data) { - // Insert the new select, and remove the progress bar. - $('#edit-book-plid-wrapper').after(data['book']).remove(); - } - }); + $('#edit-book-pick-book:not(.book-processed)', context).css('display', 'none'); }; Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.442 diff -u -p -r1.442 book.module --- modules/book/book.module 11 Sep 2007 17:35:58 -0000 1.442 +++ modules/book/book.module 10 Oct 2007 01:03:01 -0000 @@ -131,7 +131,7 @@ function book_menu() { 'type' => MENU_CALLBACK, 'file' => 'book.pages.inc', ); - $items['book-form-update/%/%'] = array( + $items['book/js'] = array( 'page callback' => 'book_form_update', 'page arguments' => array(1, 2), 'access arguments' => array('access content'), @@ -366,14 +366,9 @@ function _book_parent_select($book_link) * Build the common elements of the book form for the node and outline forms. */ function _book_add_form_elements(&$form, $node) { - $settings['book']['formCallback'] = url('book-form-update' , array()); - $settings['book']['formId'] = $form['#id']; - drupal_add_js($settings, 'setting'); - drupal_add_js(drupal_get_path('module', 'book') .'/book.js'); - drupal_add_js('misc/progress.js'); - // Need this for AJAX. $form['#cache'] = TRUE; + drupal_add_js(drupal_get_path('module', 'book') .'/book.js'); $form['book'] = array( '#type' => 'fieldset', @@ -433,7 +428,15 @@ function _book_add_form_elements(&$form, '#description' => t('Your page will be a part of the selected book.'), '#weight' => -5, '#attributes' => array('class' => 'book-title-select'), + '#ahah' => array( + 'path' => 'book/js', + 'wrapper' => 'edit-book-plid-wrapper', + 'method' => 'replace', + 'effect' => 'slide', + 'event' => 'change', + ) ); + } /** Index: modules/book/book.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.pages.inc,v retrieving revision 1.1 diff -u -p -r1.1 book.pages.inc --- modules/book/book.pages.inc 11 Sep 2007 17:35:58 -0000 1.1 +++ modules/book/book.pages.inc 10 Oct 2007 01:03:01 -0000 @@ -258,9 +258,9 @@ function book_remove_form_submit($form, * @return * Prints the replacement HTML in JSON format. */ -function book_form_update($build_id, $bid) { - - $cid = 'form_'. $build_id; +function book_form_update() { + $cid = 'form_'. $_POST['form_build_id']; + $bid = $_POST['book']['bid']; $cache = cache_get($cid, 'cache_form'); if ($cache) { $form = $cache->data; @@ -281,8 +281,14 @@ function book_form_update($build_id, $bi $form['#post'] = array(); $form = form_builder($form['form_id']['#value'] , $form, $form_state); $output = drupal_render($form['book']['plid']); - drupal_json(array('book' => $output)); + drupal_json(array('status' => TRUE, 'data' => $output)); + } + else { + drupal_json(array('status' => FALSE, 'data' => '')); } } + else { + drupal_json(array('status' => FALSE, 'data' => '')); + } exit(); }