? .DS_Store ? vertical-tabs-323112-8.patch ? vertical-tabs.patch ? modules/book/book.js ? sites/default/files ? sites/default/settings.php Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.297 diff -u -p -r1.297 form.inc --- includes/form.inc 15 Oct 2008 14:17:26 -0000 1.297 +++ includes/form.inc 25 Oct 2008 17:51:01 -0000 @@ -874,6 +874,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. @@ -970,9 +983,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'])); - } unset($edit); if (!empty($form['#disabled'])) { @@ -1042,16 +1052,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); } @@ -1515,6 +1515,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"; } @@ -1917,6 +1918,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 keys scallback 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 JS 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 form item. * * @param $element Index: misc/drupal.js =================================================================== RCS file: /cvs/drupal/drupal/misc/drupal.js,v retrieving revision 1.46 diff -u -p -r1.46 drupal.js --- misc/drupal.js 12 Oct 2008 00:29:09 -0000 1.46 +++ misc/drupal.js 25 Oct 2008 17:51:01 -0000 @@ -1,6 +1,6 @@ // $Id: drupal.js,v 1.46 2008/10/12 00:29:09 webchick Exp $ -var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} }; +var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {}, 'verticalTabs': {} }; /** * Set the variable that indicates if JavaScript behaviors should be applied. Index: misc/vertical-tabs.css =================================================================== RCS file: misc/vertical-tabs.css diff -N misc/vertical-tabs.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ misc/vertical-tabs.css 25 Oct 2008 17:51:01 -0000 @@ -0,0 +1,97 @@ +/* $Id */ + +.vertical-tabs-list .description { + display: block; +} + +/* Border style of tabs and content */ +div.vertical-tabs-div, +ul.vertical-tabs-list { + border: 1px solid #ccc; +} + +/* Make space for the tabs on the side */ +.vertical-tabs { + margin-left: 180px; +} + +/* Set the background image on the tabs and content */ +.vertical-tabs, +.vertical-tabs ul.vertical-tabs-list { + background: #fff; +} + +/* Position and layout of tabs container */ +.vertical-tabs ul.vertical-tabs-list { + width: 179px; + float: left; + margin: 0 0 0 -180px; + border-right: 0px; + z-index: 1; + border-bottom: 0; +} + + +/* Reset LIs which probably have awkward layout inherited from tabs */ +.vertical-tabs ul.vertical-tabs-list li { + float: none; + margin: 0; + padding: 0; + background-image: none; +} + +/* Layout of each tab */ +.vertical-tabs ul.vertical-tabs-list a { + display: block; + margin: 0; + padding: .4em .3em .1em .6em; + background: #fafafa; + text-align: left; + font-weight: normal; + border-bottom: 1px solid #ccc; +} + +.vertical-tabs ul.vertical-tabs-list a.vertical-tabs-nodescription { + padding-bottom: .4em; +} + +.vertical-tabs ul.vertical-tabs-list .description { + padding: 0; + line-height: normal; + min-height: 0; + white-space: normal; +} + +.vertical-tabs ul.vertical-tabs-list a { + border-right: 1px solid #ccc; +} + +/* Hover state of tabs */ +.vertical-tabs ul.vertical-tabs-list a:hover { + text-decoration: none; + cursor: pointer; +} + +.vertical-tabs ul.vertical-tabs-list a:focus { + outline: none; +} + +/* Selected tab */ +.vertical-tabs ul.vertical-tabs-list li.selected a { + background: transparent none; + color: black; + border-right: 0; +} + +/* Reset some important elements of each panel */ +.vertical-tabs .vertical-tabs-div { + margin: 0; + padding: .5em; + margin-top: -1px; + margin-left: -1px; + background: transparent none; +} + +.buttons { + clear: both; +} Index: misc/vertical-tabs.js =================================================================== RCS file: misc/vertical-tabs.js diff -N misc/vertical-tabs.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ misc/vertical-tabs.js 25 Oct 2008 17:51:01 -0000 @@ -0,0 +1,73 @@ +// $Id$ + +/** + * Main vertical tabs behavior - create the vertical tabs. + */ +Drupal.behaviors.verticalTabs = function() { + // Make sure that the vertical tabs list hasn't already been constructed. + if (!$('.vertical-tabs-list').size()) { + // Create the first
and the