? LICENSE.txt
? tables.info
Index: tables.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tables/tables.css,v
retrieving revision 1.1
diff -u -p -r1.1 tables.css
--- tables.css	10 Aug 2005 07:27:24 -0000	1.1
+++ tables.css	29 Mar 2009 23:06:01 -0000
@@ -1,195 +1,233 @@
-/*Here are a number of predefined table styles for your use.
-* Some of these could probably be optimized a bit.
-*/
-
-/*Black & White styles */
-
-table.tables-grid {
-  border-collapse: collapse;
-}
-
-table.tables-grid td {
-  border: black solid 1px;
-}
-
-table.tables-elegant {
-  border-collapse: collapse;
-  border: black double 3px;
-}
-
-table.tables-elegant td {
-  border: black solid 1px;
-}
-
-table.tables-elegant tr.firstrow td {
-  border-bottom: black solid 2px;
-}
-
-table.tables-professional {
-  border-collapse: collapse;
-  border: black solid 2px;
-}
-
-table.tables-professional td {
-  border: black solid 1px;
-}
-
-table.tables-professional tr.firstrow td {
-  font-weight: bold;
-  background: black;
-  color: white;
-
-}
-
-/* 3D styles.  These use '#ddd' for the background, '#eee' for highlight and '#888' for shadow */
-
-table.tables-3d-effects-1 {
-  background: #ddd;
-  border-collapse: collapse;
-}
-
-table.tables-3d-effects-1 tr.firstrow td {
-  border-bottom: #888 solid 1px;
-}
-
-table.tables-3d-effects-1 td.firstcol {
-  border-right: #888 solid 1px;
-}
-
-table.tables-3d-effects-1 tr.firstrow td.firstcol {
-  border: none;
-}
-
-table.tables-3d-effects-2 {
-  background: #ddd;
-  border-collapse: collapse;
-}
-
-table.tables-3d-effects-2 tr.firstrow td,
-table.tables-3d-effects-2 tr.oddrow td {
-  border-bottom: #888 solid 1px;
-}
-
-table.tables-3d-effects-2 td.firstcol {
-  border-right: #888 solid 1px;
-}
-
-table.tables-3d-effects-2 tr.evenrow td {
-  border-bottom: #eee solid 1px;
-}
-
-
-table.tables-3d-effects-3 {
-  background: #ddd;
-  border-collapse: collapse;
-}
-
-
-table.tables-3d-effects-3 tr.evenrow td {
-  border-bottom: #eee solid 1px;
-}
-
-table.tables-3d-effects-3 tr.oddrow td,
-table.tables-3d-effects-3 tr.firstrow td {
-  border-bottom: #888 solid 1px;
-}
-
-table.tables-3d-effects-3 tr.firstrow td.evencol,
-table.tables-3d-effects-3 tr.oddrow td.evencol {
-  background: #bbb;
-}
-
-table.tables-3d-effects-3 tr.evenrow td.evencol {
-  border-bottom: #eee solid 1px;
-  background: #bbb;
-}
-
-table.tables-3d-effects-3 tr.evenrow td.firstcol,
-table.tables-3d-effects-3 tr.oddrow td.firstcol,
-table.tables-3d-effects-3 tr.firstrow td.firstcol {
-  background: white;
-  border: none;
-  border-right: #888 solid 1px;
-}
-
-
-
-
-/* simple splashes of colour styles.  For no particular reason these use green as the highlight colour
-* you can change the highlight to match your site
-*/
-
-table.tables-simple {
-  border-top: green solid 3px;
-  border-bottom: green solid 3px;
-  border-collapse: collapse;
-}
-
-table.tables-simple tr.firstrow td {
-  border-bottom: green solid 1px;
-}
-
-
-/*colour styles.
-* Again these colours are coordinated for green.
-* These use xxx as a light green xxx as a mid green and xxx as a dark green.
-*/
-
-table.tables-colorful {
-  background: #cec;
-  border-collapse: collapse;
-  border-bottom: solid black 2px;
-}
-
-table.tables-colorful tr.firstrow td{
-  background: #484;
-  border-bottom: solid black 2px;
-  color: white;
-  font-weight: bold;
-}
-
-table.tables-colorful-columns {
-  background: #cec;
-  border-collapse: collapse;
-  border-bottom: solid black 2px;
-}
-
-table.tables-colorful-columns tr.firstrow td{
-  background: #484;
-  border-bottom: solid black 2px;
-  color: white;
-  font-weight: bold;
-}
-
-table.tables-colorful-columns tr.firstrow td.firstcol,
-table.tables-colorful-columns tr.firstrow td.oddcol{
-  background: #8B8;
-  border-bottom: solid black 2px;
-  color: white;
-  font-weight: bold;
-}
-
-
-table.tables-colorful-columns tr.evenrow td.evencol,
-table.tables-colorful-columns tr.oddrow td.evencol{
-  background: #8B8;
-}
-
-table.tables-colorful-list {
-  background: #cec;
-  border-collapse: collapse;
-  border-bottom: solid black 2px;
-}
-
-table.tables-colorful-list tr.firstrow td{
-  background: #484;
-  border-bottom: solid black 2px;
-  color: white;
-  font-weight: bold;
-}
-
-
-table.tables-colorful-list tr.oddrow td{
-  background: #8B8;
-}
-
+/*Here are a number of predefined table styles for your use.
+* Some of these could probably be optimized a bit.
+*/
+
+/*Black & White styles */
+
+table.tables-grid {
+  border-collapse: collapse;
+}
+
+table.tables-grid td {
+  border: black solid 1px;
+  padding-left: 2px;
+  padding-right: 2px;
+}
+
+table.tables-elegant {
+  border-collapse: collapse;
+  border: black double 3px;
+}
+
+table.tables-elegant td {
+  border: black solid 1px;
+  padding-left: 2px;
+  padding-right: 2px;
+}
+
+table.tables-elegant tr.firstrow td {
+  border-bottom: black solid 2px;
+}
+
+table.tables-professional {
+  border-collapse: collapse;
+  border: black solid 2px;
+}
+
+table.tables-professional td {
+  border: black solid 1px;
+  padding-left: 2px;
+  padding-right: 2px;
+}
+
+table.tables-professional tr.firstrow td {
+  font-weight: bold;
+  background: black;
+  color: white;
+
+}
+
+/* 3D styles.  These use '#ddd' for the background, '#eee' for highlight and '#888' for shadow */
+
+table.tables-3d-effects-1 {
+  background: #ddd;
+  border-collapse: collapse;
+}
+
+table.tables-3d-effects-1 td{
+  padding-left: 2px;
+  padding-right: 2px;
+}
+
+table.tables-3d-effects-1 tr.firstrow td {
+  border-bottom: #888 solid 1px;
+}
+
+table.tables-3d-effects-1 td.firstcol {
+  border-right: #888 solid 1px;
+}
+
+table.tables-3d-effects-1 tr.firstrow td.firstcol {
+  border: none;
+}
+
+table.tables-3d-effects-2 {
+  background: #ddd;
+  border-collapse: collapse;
+}
+
+table.tables-3d-effects-2 td{
+  padding-left: 2px;
+  padding-right: 2px;
+}
+
+table.tables-3d-effects-2 tr.firstrow td,
+table.tables-3d-effects-2 tr.oddrow td {
+  border-bottom: #888 solid 1px;
+}
+
+table.tables-3d-effects-2 td.firstcol {
+  border-right: #888 solid 1px;
+}
+
+table.tables-3d-effects-2 tr.evenrow td {
+  border-bottom: #eee solid 1px;
+}
+
+
+table.tables-3d-effects-3 {
+  background: #ddd;
+  border-collapse: collapse;
+}
+
+table.tables-3d-effects-3 td{
+  padding-left: 3px;
+  padding-right: 3px;
+}
+
+table.tables-3d-effects-3 tr.evenrow td {
+  border-bottom: #eee solid 1px;
+}
+
+table.tables-3d-effects-3 tr.oddrow td,
+table.tables-3d-effects-3 tr.firstrow td {
+  border-bottom: #888 solid 1px;
+}
+
+table.tables-3d-effects-3 tr.firstrow td.evencol,
+table.tables-3d-effects-3 tr.oddrow td.evencol {
+  background: #bbb;
+}
+
+table.tables-3d-effects-3 tr.evenrow td.evencol {
+  border-bottom: #eee solid 1px;
+  background: #bbb;
+}
+
+table.tables-3d-effects-3 tr.evenrow td.firstcol,
+table.tables-3d-effects-3 tr.oddrow td.firstcol,
+table.tables-3d-effects-3 tr.firstrow td.firstcol {
+  background: white;
+  border: none;
+  border-right: #888 solid 1px;
+}
+
+/* simple splashes of colour styles.  For no particular reason these use green as the highlight colour
+* you can change the highlight to match your site
+*/
+
+table.tables-simple {
+  border-top: #3366CC solid 3px;
+  border-bottom: #3366CC solid 3px;
+  border-collapse: collapse;
+}
+
+table.tables-simple td{
+  padding-left: 2px;
+  padding-right: 2px;
+}
+
+table.tables-simple tr.firstrow td {
+  border-bottom: #3366CC solid 1px;
+}
+
+
+/*colour styles.
+* Again these colours are coordinated for green.
+* These use xxx as a light green xxx as a mid green and xxx as a dark green.
+*/
+
+table.tables-colorful {
+  background: #DFEEFF;
+  border-collapse: collapse;
+  border-bottom: solid black 2px;
+}
+
+table.tables-colorful td{
+  padding-left: 2px;
+  padding-right: 2px;
+}
+
+table.tables-colorful tr.firstrow td{
+  background: #3366CC;
+  border-bottom: solid black 2px;
+  color: white;
+  font-weight: bold;
+}
+
+table.tables-colorful-columns {
+  background: #DFEEFF;
+  border-collapse: collapse;
+  border-bottom: solid black 2px;
+}
+
+table.tables-colorful-columns td{
+  padding-left: 2px;
+  padding-right: 2px;
+}
+
+table.tables-colorful-columns tr.firstrow td{
+  background: #3366CC;
+  border-bottom: solid black 2px;
+  color: white;
+  font-weight: bold;
+}
+
+table.tables-colorful-columns tr.firstrow td.firstcol,
+table.tables-colorful-columns tr.firstrow td.oddcol{
+  background: #AFD4FF;
+  border-bottom: solid black 2px;
+  color: white;
+  font-weight: bold;
+}
+
+
+table.tables-colorful-columns tr.evenrow td.evencol,
+table.tables-colorful-columns tr.oddrow td.evencol{
+  background: #AFD4FF;
+}
+
+table.tables-colorful-list {
+  background: #DFEEFF;
+  border-collapse: collapse;
+  border-bottom: solid black 2px;
+}
+
+table.tables-colorful-list td{
+  padding-left: 5px;
+  padding-right: 5px;
+}
+
+table.tables-colorful-list tr.firstrow td{
+  background: #3366CC;
+  border-bottom: solid black 2px;
+  color: white;
+  font-weight: bold;
+}
+
+
+table.tables-colorful-list tr.oddrow td{
+  background: #AFD4FF;
+}
+
+
Index: tables.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/tables/tables.module,v
retrieving revision 1.10
diff -u -p -r1.10 tables.module
--- tables.module	26 Sep 2006 05:24:21 -0000	1.10
+++ tables.module	29 Mar 2009 23:06:02 -0000
@@ -1,5 +1,5 @@
 <?php
-/* $Id: tables.module,v 1.10 2006/09/26 05:24:21 webgeer Exp $ */
+// $Id: tables.module,v 1.10 2006/09/26 05:24:21 webgeer Exp $
 
 /**
  * @file
@@ -11,11 +11,16 @@
  *
  */
 
+/**
+ * Implementation of hook_init().
+ */
+function tables_init() {
+    drupal_add_css(drupal_get_path('module', 'tables') .'/tables.css', 'module');
+}
+
 
-function tables_help($section) {
-  switch ($section) {
-    case 'admin/modules#description':
-      return t('Filter to allow insertion of a table');
+function tables_help($path, $arg) {
+  switch ($path) {
     case 'admin/help#tables':
       return t('<p>This filter module makes it easy and safe insert tables into the text of a node. '.
                '<p>A table always starts with "[table".  To set a custom class for the table next put in "=class" '.
@@ -24,7 +29,7 @@ function tables_help($section) {
                'Next you separate the cells by a "|" and separate the rows by a new line.  Cells can span multiple '.
                'columns or rows simply by inserting a "&" to merge the cell with the cell to the left and a "^" to '.
                'merge with the cell above. Currently, the only way to insert a literal "]" into the table is to use "'.
-               htmlentities('&#93;').'". If a "!" is the first charecter for a cell, the cell is set to be a header cell.');
+                htmlentities('&#93;') .'". If a "!" is the first charecter for a cell, the cell is set to be a header cell.');
       break;
   }
 }
@@ -53,12 +58,11 @@ function _tables_prepare($intext) {
     $tablein = $matches[1][$i];
     $rowspan=$colspan=array();
 
-    
     if ($tablein[0] == '=') {  //class is set
-      preg_match('/^=([a-zA-Z0-9-]*)/',$tablein, $cmatches);
-      $classlen = strlen($cmatches[0]);
+      preg_match('/^=([a-zA-Z0-9-]*)/', $tablein, $cmatches);
+      $classlen = drupal_strlen($cmatches[0]);
       $class=$cmatches[1];
-      $tablein=trim(substr($tablein,$classlen));
+      $tablein=trim(drupal_substr($tablein, $classlen));
     }
     else {
       $class=variable_get('tables_default_style', 'tables-elegant');
@@ -79,7 +83,7 @@ function _tables_prepare($intext) {
     }
     for ($j=$num_rows-1; $j>=0; $j--) {   // find any cols rows that span  row=j, col=k
       for ($k=$num_cols-1; $k>=0; $k--) {
-        if ($cells[$j][$k]=='&') {
+        if ($cells[$j][$k]=='&amp;') {
           if (isset($colspan[$j][$k]) && $k>0) {
             $colspan[$j][$k-1] = $colspan[$j][$k]+1;
           }
@@ -97,38 +101,38 @@ function _tables_prepare($intext) {
         }
       }
     }
-    if (isset($class) && strtolower($class)=='theme') {
+    if (isset($class) && drupal_strtolower($class)=='theme') {
       //create a table themed using Drupal Themed table function
-       $outtext=theme_table(array_shift($cells), $cells);
+      $outtext=theme_table(array_shift($cells), $cells);
     }
     else {
-      if (isset($class) && strlen($class)>0) {
-        $outtext= '<table class="'.$class.'">'."\n";
+      if (isset($class) && drupal_strlen($class)>0) {
+        $outtext= '<table class="'. $class .'">'."\n";
       }
       else {
         $outtext= '<table>'."\n";
       }
       for ($j=0; $j<$num_rows; $j++) {   // create the output
         if ($j==0) $outtext .= '<tr class="firstrow">';
-        elseif ($j % 2 == 0) $outtext.= '<tr class="oddrow">';
-        else $outtext.= '<tr class="evenrow">';
+        elseif ($j % 2 == 0) $outtext .= '<tr class="oddrow">';
+        else $outtext .= '<tr class="evenrow">';
         for ($k=0; $k<$num_cols; $k++) {
           if ($cells[$j][$k][0]=='!') {
             $cell_type='th';
-            $cells[$j][$k]=substr($cells[$j][$k],1);
+            $cells[$j][$k]=substr($cells[$j][$k], 1);
           }
           else {
             $cell_type='td';
           }
 
-          if ($cells[$j][$k]!='^' && $cells[$j][$k]!='&') {
-            $outtext.="<$cell_type";
-            if (isset($rowspan[$j][$k])) $outtext .= ' ROWSPAN='.$rowspan[$j][$k];
-            if (isset($colspan[$j][$k])) $outtext .= ' COLSPAN='.$colspan[$j][$k];
+          if ($cells[$j][$k]!='^' && $cells[$j][$k]!='&amp;') {
+            $outtext .="<$cell_type";
+            if (isset($rowspan[$j][$k])) $outtext .= ' ROWSPAN='. $rowspan[$j][$k];
+            if (isset($colspan[$j][$k])) $outtext .= ' COLSPAN='. $colspan[$j][$k];
             if ($k==0) $outtext .= ' class="firstcol">';
-            elseif ($k % 2 == 0) $outtext.= ' class="oddcol">';
-            else $outtext.= ' class="evencol">';
-            if (strlen($cells[$j][$k])>0) $outtext .=$cells[$j][$k]."</$cell_type>";
+            elseif ($k % 2 == 0) $outtext .= ' class="oddcol">';
+            else $outtext .= ' class="evencol">';
+            if (drupal_strlen($cells[$j][$k])>0) $outtext .=$cells[$j][$k] ."</$cell_type>";
             else $outtext .= "&nbsp;</$cell_type>";
           }
         }
@@ -147,16 +151,13 @@ function tables_filter($op, $delta = 0, 
   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
       if ($tables) {                    // there are table macros in this node
@@ -165,47 +166,48 @@ function tables_filter($op, $delta = 0, 
       else {
         return $text;
       }
-      break;
 
     case 'prepare':
       return $text;
-      break;
-
   }
 }
 
-function tables_filter_tips($delta, $format, $long = false) {
+function tables_filter_tips($delta, $format, $long = FALSE) {
   return t('Insert an html table from [table | cell 2 ...]. Use "|" between cells and a new line between rows.');
 }
 
-function tables_menu($may_cache) {
-  if (!$may_cache) {
-    if ($css = variable_get('tables_css', drupal_get_path('module','tables').'/tables.css')) {
-      theme('add_style', $css);
-    }
-  }
-  return array();
+function tables_menu() {
+  $items['admin/settings/tables'] = array(
+    'title' => 'Tables Filter',
+    'description' => 'Filter to allow insertion of a table',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('tables_admin_settings'),
+    'access arguments' => array('administer site configuration'),
+  );
+  return $items;
 }
 
-function tables_settings() {
-  if (!file_check_location(variable_get('tables_css', drupal_get_path('module','tables').'/tables.css'))) {
+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);
 }
