Index: autotimezone.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/autotimezone/autotimezone.module,v retrieving revision 1.9 diff -u -F^f -r1.9 autotimezone.module --- autotimezone.module 3 Dec 2006 17:35:11 -0000 1.9 +++ autotimezone.module 26 Dec 2006 05:42:35 -0000 @@ -9,25 +9,20 @@ */ /** - * Implementation of hook_help(). - */ -function autotimezone_help($section) { - switch ($section) { - case 'admin/modules#description': - return t('Automatically updates users timezone using javascript.'); - } -} - -/** * Implementation of hook_menu(). */ function autotimezone_menu($may_cache) { $items = array(); if ($may_cache) { - $items[] = array('path' => 'autotimezone', 'title' => t('Title'), - 'callback' => 'autotimezone_page', + $items[] = array( + 'path' => 'admin/settings/autotimezone', + 'title' => t('Autotimezone'), + 'description' => t('Automatically updates users timezone using javascript.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => 'autotimezone_admin_settings', 'access' => TRUE, - 'type' => MENU_CALLBACK); + 'type' => MENU_NORMAL_ITEM, + ); } else { //This codeblock adds javascript to the page header. @@ -44,12 +39,11 @@ function autotimezone_menu($may_cache) { else { //If user is not guest. $timezone = $user->timezone / -60; //Convert offset to minutes. } - $javascript = '\n"; - drupal_set_html_head($javascript); + drupal_add_js($javascript, 'inline'); } } } @@ -57,12 +51,12 @@ function autotimezone_menu($may_cache) { } /** - * Settings Hook + * Menu callback * * @return * array of form content. */ -function autotimezone_settings() { +function autotimezone_admin_settings() { $form['guest'] = array('#type' => 'fieldset', '#title' => t('Guest user options'), '#description' => t('If you do not know why you might need this feature keep it turned off.')); $form['guest']['autotimezone_update_guest'] = array( '#type' => 'radios', @@ -70,7 +64,7 @@ function autotimezone_settings() { '#default_value' => variable_get('autotimezone_update_guest', 0), '#options' => array('1' => t('On'), '0' => t('Off')), '#description' => t('This module can set a session variable named $_SESSION[\'timezone\'] for anonymous users, which is in the form of seconds from GMT. This feature is of no use unless extra code has been added to your site to take advantage of it.')); - return $form; + return system_settings_form($form); } /**