Revision: 2530
          https://sourceforge.net/p/mrbs/code/2530/
Author:   cimorrison
Date:     2012-10-26 12:52:28 +0000 (Fri, 26 Oct 2012)
Log Message:
-----------
Added a config variable to allow the order of the fields in the Presentation 
Options section of the Report form to be changed.

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

Modified: mrbs/trunk/web/report.php
===================================================================
--- mrbs/trunk/web/report.php   2012-10-26 08:18:29 UTC (rev 2529)
+++ mrbs/trunk/web/report.php   2012-10-26 12:52:28 UTC (rev 2530)
@@ -201,56 +201,79 @@
 
 function generate_presentation_options(&$vars)
 {
-  global $times_somewhere;
+  global $times_somewhere, $report_presentation_field_order;
   
   echo "<fieldset>\n";
   echo "<legend>" . get_vocab("presentation_options") . "</legend>\n";
+
+  foreach ($report_presentation_field_order as $key)
+  {
+    switch ($key)
+    {
+      case 'output':
+        echo "<div id=\"div_output\">\n";
+        $buttons = array(REPORT  => "report",
+                         SUMMARY => "summary");
+        $params = array('label'   => get_vocab('output') . ":",
+                        'name'    => 'output',
+                        'value'   => $vars['output'],
+                        'options' => $buttons);
+        generate_radio_group($params);                  
+        echo "</div>\n";
+        break;
         
-  echo "<div id=\"div_output\">\n";
-  $buttons = array(REPORT  => "report",
-                   SUMMARY => "summary");
-  $params = array('label'   => get_vocab('output') . ":",
-                  'name'    => 'output',
-                  'value'   => $vars['output'],
-                  'options' => $buttons);
-  generate_radio_group($params);                  
-  echo "</div>\n";
         
-  echo "<div id=\"div_format\">\n";
-  $buttons = array(OUTPUT_HTML => "html",
-                   OUTPUT_CSV  => "csv");
-  // The iCal output button
-  if ($times_somewhere) // We can't do iCalendars for periods yet
-  {
-    $buttons[OUTPUT_ICAL] = "ical";
-  }
-  $params = array('label'   => get_vocab('format') . ":",
-                  'name'    => 'output_format',
-                  'value'   => $vars['output_format'],
-                  'options' => $buttons);
-  generate_radio_group($params);
-  echo "</div>\n";
+      case 'output_format':
+        echo "<div id=\"div_format\">\n";
+        $buttons = array(OUTPUT_HTML => "html",
+                         OUTPUT_CSV  => "csv");
+        // The iCal output button
+        if ($times_somewhere) // We can't do iCalendars for periods yet
+        {
+          $buttons[OUTPUT_ICAL] = "ical";
+        }
+        $params = array('label'   => get_vocab('format') . ":",
+                        'name'    => 'output_format',
+                        'value'   => $vars['output_format'],
+                        'options' => $buttons);
+        generate_radio_group($params);
+        echo "</div>\n";
+        break;
+        
 
-  echo "<div id=\"div_sortby\">\n";
-  $options = array('r' => get_vocab("room"),
-                   's' => get_vocab("sort_rep_time"));
-  $params = array('label'   => get_vocab("sort_rep") . ':',
-                  'name'    => 'sortby',
-                  'options' => $options,
-                  'value'   => $vars['sortby']);
-  generate_radio_group($params);
-  echo "</div>\n";
+      case 'sortby':
+        echo "<div id=\"div_sortby\">\n";
+        $options = array('r' => get_vocab("room"),
+                         's' => get_vocab("sort_rep_time"));
+        $params = array('label'   => get_vocab("sort_rep") . ':',
+                        'name'    => 'sortby',
+                        'options' => $options,
+                        'value'   => $vars['sortby']);
+        generate_radio_group($params);
+        echo "</div>\n";
+        break;
 
-  echo "<div id=\"div_sumby\">\n";
-  $options = array('d' => get_vocab("sum_by_descrip"),
-                   'c' => get_vocab("sum_by_creator"),
-                   't' => get_vocab("sum_by_type"));
-  $params = array('label'   => get_vocab("summarize_by") . ':',
-                  'name'    => 'sumby',
-                  'options' => $options,
-                  'value'   => $vars['sumby']);
-  generate_radio_group($params);
-  echo "</div>\n";
+        
+      case 'sumby':
+        echo "<div id=\"div_sumby\">\n";
+        $options = array('d' => get_vocab("sum_by_descrip"),
+                         'c' => get_vocab("sum_by_creator"),
+                         't' => get_vocab("sum_by_type"));
+        $params = array('label'   => get_vocab("summarize_by") . ':',
+                        'name'    => 'sumby',
+                        'options' => $options,
+                        'value'   => $vars['sumby']);
+        generate_radio_group($params);
+        echo "</div>\n";
+        break;
+        
+      
+      default:
+        break;  
+      
+    }  // switch
+   
+  }  // foreach   
   
   echo "</fieldset>\n";
 }
@@ -1037,7 +1060,19 @@
 $times_somewhere = (sql_query1("SELECT COUNT(*) FROM $tbl_area WHERE 
enable_periods=0") > 0);
 $periods_somewhere = (sql_query1("SELECT COUNT(*) FROM $tbl_area WHERE 
enable_periods!=0") > 0);
 
+
 // Build the report search field order
+$report_presentation_fields = array('output', 'output_format', 'sortby', 
'sumby');
+
+foreach ($report_presentation_fields as $field)
+{
+  if (!in_array($field, $report_presentation_field_order))
+  {
+    $report_presentation_field_order[] = $field;
+  }
+}
+
+// Build the report search field order
 $report_search_fields = array('report_start', 'report_end',
                               'areamatch', 'roommatch',
                               'typematch', 'namematch', 'descrmatch', 
'creatormatch',

Modified: mrbs/trunk/web/systemdefaults.inc.php
===================================================================
--- mrbs/trunk/web/systemdefaults.inc.php       2012-10-26 08:18:29 UTC (rev 
2529)
+++ mrbs/trunk/web/systemdefaults.inc.php       2012-10-26 12:52:28 UTC (rev 
2530)
@@ -555,6 +555,11 @@
 // 'match_confirmed', 'match_approved', plus any custom fields you may have 
defined.
 $report_search_field_order = array();
 
+// And the same for the fields in the Presentation Options section of the 
report form.
+// Valid entries in this array are 'output', 'output_format', 'sortby' and 
'sumby'.
+$report_presentation_field_order = array();
+
+
 /***********************************************
  * Authentication settings - read AUTHENTICATION
  ***********************************************/
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to