commit f3ed24e15cdaad55377b4be5c6628ebbe0fa7edc Author: rfay Date: Mon Dec 13 13:13:20 2010 -0700 My #11 diff --git a/ajax_example/ajax_example.css b/ajax_example/ajax_example.css index c603d47..7791259 100644 --- a/ajax_example/ajax_example.css +++ b/ajax_example/ajax_example.css @@ -1,11 +1,11 @@ /* $Id$ */ /* - * @file - * CSS for ajax_example + * @file ajax_example.css + * CSS for ajax_example. * * See @link ajax_example_dependent_dropdown_degrades @endlink for - * details on what this file does. It's not used in any other example. + * details on what this file does. It is not used in any other example. */ /* hide the next button when not degrading to non-javascript browser */ diff --git a/ajax_example/ajax_example.js b/ajax_example/ajax_example.js index b282114..80ca557 100644 --- a/ajax_example/ajax_example.js +++ b/ajax_example/ajax_example.js @@ -1,11 +1,11 @@ // $Id$ /* - * @file - * CSS for ajax_example + * @file ajax_example.js + * JavaScript for ajax_example. * * See @link ajax_example_dependent_dropdown_degrades @endlink for - * details on what this file does. It's not used in any other example. + * details on what this file does. It is not used in any other example. * */ diff --git a/ajax_example/ajax_example.module b/ajax_example/ajax_example.module index 9ea219d..908c7b3 100644 --- a/ajax_example/ajax_example.module +++ b/ajax_example/ajax_example.module @@ -24,7 +24,8 @@ * Set up calls to drupal_get_form() for all our example cases. * * Implements hook_menu(). - * See @link menu_example_menu Menu Example @endlink for more details on hook_menu. + * See @link menu_example.module Menu Example @endlink for more details on + * hook_menu(). */ function ajax_example_menu() { $items = array(); @@ -98,7 +99,7 @@ function ajax_example_menu() { 'weight' => 5, ); - // Popluate a form section based on input in another element. + // Populate a form section based on input in another element. $items['examples/ajax_example/dynamic_sections'] = array( 'title' => 'Dynamic Sections (with graceful degradation)', 'page callback' => 'drupal_get_form', @@ -137,7 +138,7 @@ function ajax_example_menu() { 'weight' => 7, ); - // Add more button that creates additional form elements. + // Add-more button that creates additional form elements. // See ajax_example_graceful_degradation.inc. $items['examples/ajax_example/add_more'] = array( 'title' => 'Add-more button (with graceful degradation)', @@ -215,10 +216,10 @@ function ajax_example_simplest($form, &$form_state) { 'three' => 'three', ), '#ajax' => array( - // #ajax has to required keys: callback and wrapper. + // #ajax has two required keys: callback and wrapper. // 'callback' is a function that will be called when this element changes. 'callback' => 'ajax_example_simplest_callback', - // 'wrapper' is the DOM id of the page element that will be replaced. + // 'wrapper' is the HTML id of the page element that will be replaced. 'wrapper' => 'replace_textfield_div', // There are also several optional keys - see ajax_example_autocheckboxes // below for details on 'method', 'effect' and 'speed' and @@ -248,9 +249,9 @@ function ajax_example_simplest($form, &$form_state) { * Callback for ajax_example_simplest. * * On an ajax submit, the form builder function is called again, then the $form - * and $form_state is passed to this callback function so it can select which + * and $form_state are passed to this callback function so it can select which * portion of the form to send on to the client. - * + * * @return renderable array (the textfield element) */ function ajax_example_simplest_callback($form, $form_state) { @@ -319,8 +320,8 @@ function ajax_example_autocheckboxes($form, &$form_state) { * Callback element needs only select the portion of the form to be updated. * Since #ajax['callback'] return can be HTML or a renderable array (or an * array of commands), we can just return a piece of the form. - * See @link ajax_example_advanced @endlink for more details on AJAX framework - * commands. + * See @link ajax_example_advanced.inc AJAX Advanced Commands for more details + * on AJAX framework commands. * * @return renderable array (the checkboxes fieldset) */ @@ -360,7 +361,7 @@ function ajax_example_autotextfields($form, &$form_state) { '#type' => 'fieldset', '#description' => t('This is where we put automatically generated textfields'), ); - + // Since checkboxes return TRUE or FALSE, we have to check that // $form_state has been filled as well as what it contains. if (!empty($form_state['values']['ask_first_name']) && $form_state['values']['ask_first_name']) { @@ -424,11 +425,11 @@ function ajax_example_submit_driven_ajax($form, &$form_state) { /** * Select the 'box' element, change the markup in it, and return it as a * renderable array. - * + * * @return renderable array (the box element) */ function ajax_example_submit_driven_callback($form, $form_state) { - // In most cases, it's recomended that you put this logic in form generation + // In most cases, it is recomended that you put this logic in form generation // rather than the callback. Submit driven forms are an exception, because // you may not want to return the form at all. $element = $form['box']; diff --git a/ajax_example/ajax_example_advanced.inc b/ajax_example/ajax_example_advanced.inc index 8e0ba10..5c10048 100644 --- a/ajax_example/ajax_example_advanced.inc +++ b/ajax_example/ajax_example_advanced.inc @@ -87,7 +87,7 @@ function ajax_example_advanced_commands($form, &$form_state) { // Shows the 'changed' command. $form['changed_command_example_fieldset'] = array( '#type' => 'fieldset', - '#title' => t("Demonstrates the AJAX 'changed' command. If region is 'changed', it's marked with CSS. This example also puts an asterisk by changed content."), + '#title' => t("Demonstrates the AJAX 'changed' command. If region is 'changed', it is marked with CSS. This example also puts an asterisk by changed content."), ); $form['changed_command_example_fieldset']['changed_command_example'] = array( diff --git a/ajax_example/ajax_example_graceful_degradation.inc b/ajax_example/ajax_example_graceful_degradation.inc index dcf6c05..0be5d6c 100644 --- a/ajax_example/ajax_example_graceful_degradation.inc +++ b/ajax_example/ajax_example_graceful_degradation.inc @@ -35,7 +35,7 @@ * if javascript is not enabled. The Javascript snippet is really only used * to enable us to present the form in degraded mode without forcing the user * to turn off Javascript. Both of these are loaded by using the - * #attached FAPI property, so it's a good example of how to use that. + * #attached FAPI property, so it is a good example of how to use that. * * The extra argument $no_js_use is here only to allow presentation of this * form as if Javascript were not enabled. ajax_example_menu() provides two @@ -358,8 +358,8 @@ function ajax_example_wizard($form, &$form_state, $no_js_use = FALSE) { . '', ); - // $form_state['storage'] has no specific drupal meaning, but it's traditional - // to keep variables for multistep forms there. + // $form_state['storage'] has no specific drupal meaning, but it is + // traditional to keep variables for multistep forms there. $step = empty($form_state['storage']['step']) ? 1 : $form_state['storage']['step']; $form_state['storage']['step'] = $step; diff --git a/ajax_example/ajax_example_misc.inc b/ajax_example/ajax_example_misc.inc index 3bd2b00..ad77b36 100644 --- a/ajax_example/ajax_example_misc.inc +++ b/ajax_example/ajax_example_misc.inc @@ -22,7 +22,7 @@ function ajax_example_render_link() { // drupal_add_library is invoked automatically when a form element has the // '#ajax' property, but since we are not rendering a form here, we have to // do it ourselves. - drupal_add_library('misc/ajax.js'); + drupal_add_library('system', 'drupal.ajax'); $explanation = " The link below has the use-ajax class applied to it, so if javascript is enabled, ajax.js will try to submit it via an AJAX call instead @@ -32,7 +32,7 @@ URL whether JS was enabled or not, letting it do different things based on that. $output = "
" . t($explanation); // The use-ajax class is special, so that the link will call without causing // a page reload. Note the /nojs portion of the path - if javascript is - // enabled, this part will be stripped from the path before it's called. + // enabled, this part will be stripped from the path before it is called. $link = l(t('Click here'), 'ajax_link_callback/nojs/', array('attributes' => array('class' => array('use-ajax')))); $output .= "
$link
"; return $output;