Revision: 1202
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1202&view=rev
Author:   cimorrison
Date:     2009-09-25 08:46:19 +0000 (Fri, 25 Sep 2009)

Log Message:
-----------
Converted CSV constants into variables, so that they can be redefined in 
config.inc.php

Modified Paths:
--------------
    mrbs/trunk/web/report.php
    mrbs/trunk/web/systemdefaults.inc.php

Modified: mrbs/trunk/web/report.php
===================================================================
--- mrbs/trunk/web/report.php   2009-09-24 17:36:46 UTC (rev 1201)
+++ mrbs/trunk/web/report.php   2009-09-25 08:46:19 UTC (rev 1202)
@@ -109,10 +109,12 @@
 // Return the new row
 function csv_row_add_value($row, $value)
 {
+  global $csv_col_sep;
+  
   // if it's not the first entry add a column separator
   if (!empty($row))
   {
-    $row .= CSV_COL_SEP;
+    $row .= $csv_col_sep;
   }
   $row .= '"';
   $row .= escape($value);
@@ -123,6 +125,8 @@
 // Output the first row (header row) for CSV reports
 function csv_report_header($display)
 {
+  global $csv_row_sep;
+  
   // initialise the row
   $line = "";
   // add values, one by one
@@ -141,7 +145,7 @@
   $line = csv_row_add_value($line, get_vocab("createdby"));
   $line = csv_row_add_value($line, get_vocab("lastupdate"));
   // terminate the row
-  $line .= CSV_ROW_SEP;
+  $line .= $csv_row_sep;
   // output the row
   echo $line;
 }
@@ -154,6 +158,7 @@
   global $typel;
   global $enable_periods;
   global $output_as_csv;
+  global $csv_row_sep;
   
   // Initialise the line for CSV reports
   $line = "";
@@ -308,7 +313,7 @@
   if ($output_as_csv)
   {
     // terminate and output the line
-    $line .= CSV_ROW_SEP;
+    $line .= $csv_row_sep;
     echo $line;
   }
   else
@@ -371,10 +376,11 @@
 function cell($count, $hours)
 {
   global $output_as_csv;
+  global $csv_col_sep;
   
-  echo ($output_as_csv) ? CSV_COL_SEP . '"'  : "<td class=\"count\">(";
+  echo ($output_as_csv) ? $csv_col_sep . '"'  : "<td class=\"count\">(";
   echo $count;
-  echo ($output_as_csv) ? '"' . CSV_COL_SEP . '"' : ")</td><td>";
+  echo ($output_as_csv) ? '"' . $csv_col_sep . '"' : ")</td><td>";
   echo sprintf("%.2f", $hours);
   echo ($output_as_csv) ? '"'   : "</td>\n";
 }
@@ -386,6 +392,7 @@
 {
   global $enable_periods;
   global $output_as_csv;
+  global $csv_row_sep, $csv_col_sep;
         
   // Make a sorted array of area/rooms, and of names, to use for column
   // and row indexes. Use the rooms and names hashes built by accumulate().
@@ -414,7 +421,7 @@
     echo "<thead>\n";
     echo "<tr>\n";
   }
-  echo ($output_as_csv) ? '""' . CSV_COL_SEP : "<th>&nbsp;</th>\n";
+  echo ($output_as_csv) ? '""' . $csv_col_sep : "<th>&nbsp;</th>\n";
 
   for ($c = 0; $c < $n_rooms; $c++)
   {
@@ -422,7 +429,7 @@
     if ($output_as_csv)
     {
       echo $rooms[$c] . ' - ' . get_vocab("entries");
-      echo '"' .CSV_COL_SEP . '"';
+      echo '"' . $csv_col_sep . '"';
       echo $rooms[$c] . ' - ';
       echo ($enable_periods) ? get_vocab("periods") : get_vocab("hours");
     }
@@ -430,7 +437,7 @@
     {
       echo $rooms[$c];
     }
-    echo ($output_as_csv) ? '"' . CSV_COL_SEP : "</th>\n";
+    echo ($output_as_csv) ? '"' . $csv_col_sep : "</th>\n";
     $col_count_total[$c] = 0;
     $col_hours_total[$c] = 0.0;
   }
@@ -438,7 +445,7 @@
   if ($output_as_csv)
   {
     echo get_vocab("total") . ' - ' . get_vocab("entries");
-    echo '"' . CSV_COL_SEP . '"';
+    echo '"' . $csv_col_sep . '"';
     echo get_vocab("total") . ' - ';
     echo ($enable_periods) ? get_vocab("periods") : get_vocab("hours");
   }
@@ -447,7 +454,7 @@
     echo get_vocab("total");
   }
   echo ($output_as_csv) ? '"'  : "</th>\n";
-  echo ($output_as_csv) ? CSV_ROW_SEP : "</tr>\n";
+  echo ($output_as_csv) ? $csv_row_sep : "</tr>\n";
   $grand_count_total = 0;
   $grand_hours_total = 0;
   echo ($output_as_csv) ? ''   : "</thead>\n";
@@ -478,7 +485,7 @@
       {
         if ($output_as_csv)
         {
-          echo CSV_COL_SEP . CSV_COL_SEP;
+          echo $csv_col_sep . $csv_col_sep;
         }
         else
         {
@@ -487,7 +494,7 @@
       }
     }
     cell($row_count_total, $row_hours_total);
-    echo ($output_as_csv) ? CSV_ROW_SEP : "</tr>\n";
+    echo ($output_as_csv) ? $csv_row_sep : "</tr>\n";
     $grand_count_total += $row_count_total;
     $grand_hours_total += $row_hours_total;
   }
@@ -499,7 +506,7 @@
     cell($col_count_total[$c], $col_hours_total[$c]);
   }
   cell($grand_count_total, $grand_hours_total);
-  echo ($output_as_csv) ? CSV_ROW_SEP : "</tr>\n";
+  echo ($output_as_csv) ? $csv_row_sep : "</tr>\n";
   if (!$output_as_csv)
   {
     echo "</tbody></table>\n";
@@ -565,7 +572,7 @@
 // print the page header
 if ($output_as_csv)
 {
-  $filename = ($summarize & REPORT) ? REPORT_FILENAME : SUMMARY_FILENAME;
+  $filename = ($summarize & REPORT) ? $report_filename : $summary_filename;
   header("Content-type: application/octet-stream");
   header("Content-Disposition: attachment; filename=\"$filename\"");
 }

Modified: mrbs/trunk/web/systemdefaults.inc.php
===================================================================
--- mrbs/trunk/web/systemdefaults.inc.php       2009-09-24 17:36:46 UTC (rev 
1201)
+++ mrbs/trunk/web/systemdefaults.inc.php       2009-09-25 08:46:19 UTC (rev 
1202)
@@ -661,12 +661,12 @@
  *************/
  
 // Default CSV file names
-define('REPORT_FILENAME',  "report.csv");
-define('SUMMARY_FILENAME', "summary.csv");
+$report_filename  = "report.csv";
+$summary_filename = "summary.csv";
 
 // CSV format
-define('CSV_ROW_SEP', "\n");  // Separator between rows/records
-define('CSV_COL_SEP', ",");   // Separator between columns/fields
+$csv_row_sep = "\n";  // Separator between rows/records
+$csv_col_sep = ",";   // Separator between columns/fields
 
 
 /*************


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to