? .DS_Store ? .patch ? dont_drupal_render_forms_0.patch ? drupal.hook-page-alter.patch ? drupal.hook-page-alter_0.patch ? vertical_tabs-323112-24.patch ? vertical_tabs-323112-41.patch ? modules/.DS_Store Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.320 diff -u -p -r1.320 form.inc --- includes/form.inc 3 Feb 2009 18:55:29 -0000 1.320 +++ includes/form.inc 9 Feb 2009 00:09:52 -0000 @@ -877,6 +877,19 @@ function form_builder($form_id, $form, & if (isset($form['#input']) && $form['#input']) { _form_builder_handle_input_element($form_id, $form, $form_state, $complete_form); } + if (!isset($form['#id'])) { + $form['#id'] = form_clean_id('edit-' . implode('-', $form['#parents'])); + } + // Allow for elements to expand to multiple elements, e.g., radios, + // checkboxes and files. + if (isset($form['#process']) && !$form['#processed']) { + foreach ($form['#process'] as $process) { + if (drupal_function_exists($process)) { + $form = $process($form, isset($edit) ? $edit : NULL, $form_state, $complete_form); + } + } + $form['#processed'] = TRUE; + } $form['#defaults_loaded'] = TRUE; // We start off assuming all form elements are in the correct order. @@ -984,9 +997,6 @@ function _form_builder_handle_input_elem } array_unshift($form['#parents'], $name); } - if (!isset($form['#id'])) { - $form['#id'] = form_clean_id('edit-' . implode('-', $form['#parents'])); - } if (!empty($form['#disabled'])) { $form['#attributes']['disabled'] = 'disabled'; @@ -1055,16 +1065,6 @@ function _form_builder_handle_input_elem } } } - // Allow for elements to expand to multiple elements, e.g., radios, - // checkboxes and files. - if (isset($form['#process']) && !$form['#processed']) { - foreach ($form['#process'] as $process) { - if (drupal_function_exists($process)) { - $form = $process($form, isset($edit) ? $edit : NULL, $form_state, $complete_form); - } - } - $form['#processed'] = TRUE; - } form_set_value($form, $form['#value'], $form_state); } @@ -1499,6 +1499,7 @@ function theme_fieldset($element) { $element['#attributes']['class'] .= ' collapsed'; } } + $element['#attributes']['id'] = $element['#id']; return '' . ($element['#title'] ? '' . $element['#title'] . '' : '') . (isset($element['#description']) && $element['#description'] ? '
' . $element['#description'] . '
' : '') . (!empty($element['#children']) ? $element['#children'] : '') . (isset($element['#value']) ? $element['#value'] : '') . "\n"; } @@ -1929,6 +1930,54 @@ function form_process_ahah($element) { } /** + * Add vertical tabs to the page. + */ +function form_process_vertical_tabs(&$element) { + static $js_added = array(); + // If the element has a vertical tab, and it is visible, then add it to the JavaScript. + if (isset($element['#vertical_tab']) && $element['#vertical_tab'] && (isset($element['#access']) ? $element['#access'] : TRUE)) { + // If it's not a full array (with the keys "callback" and "arguments"), find out what it is. + if (!is_array($element['#vertical_tab'])) { + // If it's a string, convert it. + if (is_string($element['#vertical_tab'])) { + $element['#vertical_tab'] = array('callback' => $element['#vertical_tab']); + } + // Otherwise, there's no callback. + else { + $element['#vertical_tab'] = array(); + } + } + // Add the tab to the JavaScript. + $js_added[$element['#id']] = array( + 'name' => (isset($element['#title']) ? $element['#title'] : ''), + 'callback' => (isset($element['#vertical_tab']['callback']) ? $element['#vertical_tab']['callback'] : ''), + 'arguments' => (isset($element['#vertical_tab']['arguments']) ? $element['#vertical_tab']['arguments'] : ''), + ); + // If there's more than one tab, then add the JavaScript and add the previous element. + if (count($js_added) == 2) { + drupal_add_js(array('verticalTabs' => $js_added), 'setting'); + // We do not immediately add the JavaScript because otherwise it would be added before + // the collapse.js was added, but we need collapse.js to do it's magic on fieldsets first. + $element['#post_render'][] = '_form_post_render_vertical_tabs'; + } + // Otherwise, just add the current element. + elseif (count($js_added) > 2) { + drupal_add_js(array('verticalTabs' => array($element['#id'] => $js_added[$element['#id']])), 'setting'); + } + } + return $element; +} + +/** + * Actually add the JavaScript and CSS for vertical tabs. + */ +function _form_post_render_vertical_tabs($element) { + drupal_add_js('misc/vertical-tabs.js'); + drupal_add_css('misc/vertical-tabs.css'); + return $element; +} + +/** * Format a checkbox. * * @param $element Index: misc/drupal.js =================================================================== RCS file: /cvs/drupal/drupal/misc/drupal.js,v retrieving revision 1.49 diff -u -p -r1.49 drupal.js --- misc/drupal.js 6 Jan 2009 13:16:09 -0000 1.49 +++ misc/drupal.js 9 Feb 2009 00:09:52 -0000 @@ -1,6 +1,6 @@ // $Id: drupal.js,v 1.49 2009/01/06 13:16:09 dries Exp $ -var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'locale': {} }; +var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'locale': {}, 'verticalTabs': {} }; /** * Set the variable that indicates if JavaScript behaviors should be applied. Index: modules/book/book.css =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.css,v retrieving revision 1.8 diff -u -p -r1.8 book.css --- modules/book/book.css 19 Dec 2008 15:42:26 -0000 1.8 +++ modules/book/book.css 9 Feb 2009 00:09:52 -0000 @@ -36,7 +36,7 @@ margin-bottom: 0; } #edit-book-bid-wrapper .description { - clear: both; + clear: none; } #book-admin-edit select { margin-right: 24px; Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.485 diff -u -p -r1.485 book.module --- modules/book/book.module 26 Jan 2009 14:08:42 -0000 1.485 +++ modules/book/book.module 9 Feb 2009 00:09:52 -0000 @@ -415,7 +415,7 @@ function _book_parent_select($book_link) function _book_add_form_elements(&$form, $node) { // Need this for AJAX. $form['#cache'] = TRUE; - drupal_add_js("if (Drupal.jsEnabled) { $(document).ready(function() { $('#edit-book-pick-book').css('display', 'none'); }); }", 'inline'); + drupal_add_js(drupal_get_path('module', 'book') .'/book.js'); $form['book'] = array( '#type' => 'fieldset', @@ -425,6 +425,7 @@ function _book_add_form_elements(&$form, '#collapsed' => TRUE, '#tree' => TRUE, '#attributes' => array('class' => 'book-outline-form'), + '#vertical_tab' => 'nodeFormBook', ); foreach (array('menu_name', 'mlid', 'nid', 'router_path', 'has_children', 'options', 'module', 'original_bid', 'parent_depth_limit') as $key) { $form['book'][$key] = array( Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.692 diff -u -p -r1.692 comment.module --- modules/comment/comment.module 7 Feb 2009 20:10:40 -0000 1.692 +++ modules/comment/comment.module 9 Feb 2009 00:09:52 -0000 @@ -574,6 +574,8 @@ function comment_form_node_type_form_alt function comment_form_alter(&$form, $form_state, $form_id) { if (!empty($form['#node_edit_form'])) { $node = $form['#node']; + drupal_add_js(drupal_get_path('module', 'comment') . '/comment-node-form.js'); + drupal_add_js(array('nodeForm' => array('comment' => $node->comment)), 'setting'); $form['comment_settings'] = array( '#type' => 'fieldset', '#access' => user_access('administer comments'), @@ -581,6 +583,7 @@ function comment_form_alter(&$form, $for '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 30, + '#vertical_tab' => 'nodeFormComment', ); $form['comment_settings']['comment'] = array( '#type' => 'radios', Index: modules/menu/menu.module =================================================================== RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v retrieving revision 1.178 diff -u -p -r1.178 menu.module --- modules/menu/menu.module 31 Jan 2009 16:56:00 -0000 1.178 +++ modules/menu/menu.module 9 Feb 2009 00:09:52 -0000 @@ -388,6 +388,7 @@ function _menu_parent_depth_limit($item) */ function menu_form_alter(&$form, $form_state, $form_id) { if (!empty($form['#node_edit_form'])) { + drupal_add_js(drupal_get_path('module', 'menu') . '/menu.js'); // Note - doing this to make sure the delete checkbox stays in the form. $form['#cache'] = TRUE; @@ -398,7 +399,8 @@ function menu_form_alter(&$form, $form_s '#collapsible' => TRUE, '#collapsed' => FALSE, '#tree' => TRUE, - '#weight' => -2, + '#weight' => 5, + '#vertical_tab' => 'nodeFormMenu', '#attributes' => array('class' => 'menu-item-form'), ); $item = $form['#node']->menu; Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.54 diff -u -p -r1.54 node.pages.inc --- modules/node/node.pages.inc 5 Feb 2009 03:42:58 -0000 1.54 +++ modules/node/node.pages.inc 9 Feb 2009 00:09:52 -0000 @@ -96,6 +96,7 @@ function node_object_prepare(&$node) { * Generate the node add/edit form array. */ function node_form(&$form_state, $node) { + drupal_add_js(drupal_get_path('module', 'node') . '/node.js'); global $user; if (isset($form_state['node'])) { @@ -155,6 +156,7 @@ function node_form(&$form_state, $node) // Collapsed by default when "Create new revision" is unchecked '#collapsed' => !$node->revision, '#weight' => 20, + '#vertical_tab' => 'nodeFormRevision', ); $form['revision_information']['revision'] = array( '#access' => user_access('administer nodes'), @@ -178,6 +180,7 @@ function node_form(&$form_state, $node) '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 90, + '#vertical_tab' => 'nodeFormAuthoring', ); $form['author']['name'] = array( '#type' => 'textfield', @@ -207,6 +210,7 @@ function node_form(&$form_state, $node) '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => 95, + '#vertical_tab' => 'nodeFormPublishingOptions', ); $form['options']['status'] = array( '#type' => 'checkbox', @@ -233,8 +237,11 @@ function node_form(&$form_state, $node) } // Add the buttons. - $form['buttons'] = array(); - $form['buttons']['#weight'] = 100; + $form['buttons'] = array( + '#weight' => 100, + '#prefix' => '
', + '#suffix' => '
', + ); $form['buttons']['submit'] = array( '#type' => 'submit', '#access' => !variable_get('node_preview', 0) || (!form_get_errors() && isset($form_state['node_preview'])), Index: modules/path/path.module =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.module,v retrieving revision 1.152 diff -u -p -r1.152 path.module --- modules/path/path.module 9 Dec 2008 11:30:24 -0000 1.152 +++ modules/path/path.module 9 Feb 2009 00:09:52 -0000 @@ -188,6 +188,7 @@ function path_nodeapi_delete($node) { */ function path_form_alter(&$form, $form_state, $form_id) { if (!empty($form['#node_edit_form'])) { + drupal_add_js(drupal_get_path('module', 'path') .'/path.js'); $path = isset($form['#node']->path) ? $form['#node']->path : NULL; $form['path'] = array( '#type' => 'fieldset', @@ -196,6 +197,7 @@ function path_form_alter(&$form, $form_s '#collapsed' => empty($path), '#access' => user_access('create url aliases'), '#weight' => 30, + '#vertical_tab' => 'nodeFormPath', ); $form['path']['path'] = array( '#type' => 'textfield', Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.666 diff -u -p -r1.666 system.module --- modules/system/system.module 3 Feb 2009 18:55:31 -0000 1.666 +++ modules/system/system.module 9 Feb 2009 00:09:52 -0000 @@ -419,7 +419,7 @@ function system_elements() { '#collapsible' => FALSE, '#collapsed' => FALSE, '#value' => NULL, - '#process' => array('form_process_ahah'), + '#process' => array('form_process_ahah', 'form_process_vertical_tabs'), '#theme_wrapper' => 'fieldset', ); Index: modules/upload/upload.module =================================================================== RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v retrieving revision 1.227 diff -u -p -r1.227 upload.module --- modules/upload/upload.module 3 Feb 2009 18:55:32 -0000 1.227 +++ modules/upload/upload.module 9 Feb 2009 00:09:52 -0000 @@ -224,6 +224,8 @@ function upload_form_alter(&$form, $form if (!empty($form['#node_edit_form'])) { $node = $form['#node']; if (variable_get("upload_$node->type", TRUE)) { + drupal_add_js(drupal_get_path('module', 'upload') .'/upload.js'); + // Attachments fieldset $form['attachments'] = array( '#type' => 'fieldset', @@ -235,6 +237,7 @@ function upload_form_alter(&$form, $form '#prefix' => '
', '#suffix' => '
', '#weight' => 30, + '#vertical_tab' => 'nodeFormAttachments', ); // Wrapper for fieldset contents (used by ahah.js).