Index: tables.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tables/tables.module,v retrieving revision 1.10 diff -u -r1.10 tables.module --- tables.module 26 Sep 2006 05:24:21 -0000 1.10 +++ tables.module 5 Mar 2007 21:27:40 -0000 @@ -14,8 +14,6 @@ function tables_help($section) { switch ($section) { - case 'admin/modules#description': - return t('Filter to allow insertion of a table'); case 'admin/help#tables': return t('
This filter module makes it easy and safe insert tables into the text of a node. '. '
A table always starts with "[table". To set a custom class for the table next put in "=class" '. @@ -147,15 +145,12 @@ switch ($op) { case 'list': return (array(0 => t('Tables filter'))); - break; case 'name': return t('tables filter'); - break; case 'description': return t('converts [table ...] macros into HTML tables.'); - break; case 'process': $tables=_tables_prepare($text); //returns an array of $tables[0] = table macro $table[1]= table html @@ -165,12 +160,9 @@ else { return $text; } - break; case 'prepare': return $text; - break; - } } @@ -179,33 +171,45 @@ } function tables_menu($may_cache) { + $items = array(); + if (!$may_cache) { - if ($css = variable_get('tables_css', drupal_get_path('module','tables').'/tables.css')) { - theme('add_style', $css); - } + drupal_add_css(variable_get('tables_css', drupal_get_path('module','tables'). '/tables.css')); + + $items[] = array( + 'path' => 'admin/settings/tables', + 'title' => t('Tables Filter'), + 'description' => t('Filter to allow insertion of a table'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('tables_admin_settings'), + 'access' => user_access('administer site configuration'), + ); } - return array(); + + return $items; } -function tables_settings() { +function tables_admin_settings() { if (!file_check_location(variable_get('tables_css', drupal_get_path('module','tables').'/tables.css'))) { $error['tables_css'] = theme('error', t('File does not exist, or is not readable.')); } - $form["tables_css"] = array('#type' => 'textfield', - '#title' => t('Style Sheet'), - '#default_value' => variable_get('tables_css', drupal_get_path('module','tables').'/tables.css'), - '#size' => 70, - '#maxlength' => 255, - '#description' => t("Specify the relative path to your tables style sheet. The style sheet specified here will be used to style tables you insert. If you prefer to style your tables in your theme, you can leave this field blank. ". $error['tables_css']), - ); - - $form["tables_default_style"] = array('#type' => 'textfield', - '#title' => t('Default style'), - '#default_value' => variable_get('tables_default_style', 'tables-elegant'), - '#size' => 70, - '#maxlength' => 255, - '#description' => t("Set the default style sheet to use if no style sheet is set in the specific table. "), - ); + $form['tables_css'] = array( + '#type' => 'textfield', + '#title' => t('Style Sheet'), + '#default_value' => variable_get('tables_css', drupal_get_path('module','tables').'/tables.css'), + '#size' => 70, + '#maxlength' => 255, + '#description' => t('Specify the relative path to your tables style sheet. The style sheet specified here will be used to style tables you insert. If you prefer to style your tables in your theme, you can leave this field blank.'), + ); + + $form['tables_default_style'] = array( + '#type' => 'textfield', + '#title' => t('Default style'), + '#default_value' => variable_get('tables_default_style', 'tables-elegant'), + '#size' => 70, + '#maxlength' => 255, + '#description' => t('Set the default style sheet to use if no style sheet is set in the specific table.'), + ); - return $form; + return system_settings_form($form); }