Changeset:
        9449773680a2
        
https://sourceforge.net/p/mrbs/hg-code/ci/9449773680a2f2d8a9bfe4253e47c90c2704a449
Author:
        Campbell Morrison <[email protected]>
Date:
        Sat Nov 05 18:02:42 2016 +0000
Log message:

Changed report form so that for custom checkbox fields you can now select 
checked, unchecked or both.   See SF Support Requests #1087

diffstat:

 web/internalconfig.inc.php |   5 +++++
 web/lang/lang.en           |   2 ++
 web/report.php             |  13 +++++++++----
 3 files changed, 16 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r f9eb27fc309e -r 9449773680a2 web/internalconfig.inc.php
--- a/web/internalconfig.inc.php        Fri Nov 04 14:14:20 2016 +0000
+++ b/web/internalconfig.inc.php        Sat Nov 05 18:02:42 2016 +0000
@@ -233,6 +233,11 @@
 define('APPROVED_YES',  1);
 define('APPROVED_BOTH', 2);  // Can be anything other than 0 or 1
 
+// Constansts for custom checkbox fields
+define('CUSTOM_WITHOUT', 0);
+define('CUSTOM_WITH',    1);
+define('CUSTOM_BOTH',    2);
+
 // Constants for mode
 define('MODE_TIMES',   1);
 define('MODE_PERIODS', 2);
diff -r f9eb27fc309e -r 9449773680a2 web/lang/lang.en
--- a/web/lang/lang.en  Fri Nov 04 14:14:20 2016 +0000
+++ b/web/lang/lang.en  Sat Nov 05 18:02:42 2016 +0000
@@ -312,6 +312,8 @@
 $vocab["sort_room"]             = "Room";
 $vocab["fulldescription_short"] = "Full Description";
 $vocab["both"]                  = "All";
+$vocab["with"]                  = "With";
+$vocab["without"]               = "Without";
 $vocab["privacy_status"]        = "Privacy status";
 $vocab["search_criteria"]       = "Search criteria";
 $vocab["presentation_options"]  = "Output options";
diff -r f9eb27fc309e -r 9449773680a2 web/report.php
--- a/web/report.php    Fri Nov 04 14:14:20 2016 +0000
+++ b/web/report.php    Sat Nov 05 18:02:42 2016 +0000
@@ -238,12 +238,15 @@
                         'name'  => $var,
                         'value' => isset($$var) ? $$var : NULL);
         echo "<div>\n";
-        // Output a checkbox if it's a boolean or integer <= 2 bytes (which we 
will
+        // Output a radio group if it's a boolean or integer <= 2 bytes (which 
we will
         // assume are intended to be booleans)
         if (($field_natures[$key] == 'boolean') || 
             (($field_natures[$key] == 'integer') && 
isset($field_lengths[$key]) && ($field_lengths[$key] <= 2)) )
         {
-          generate_checkbox($params);
+          $options = array(CUSTOM_BOTH => get_vocab("both"), CUSTOM_WITH => 
get_vocab("with"), CUSTOM_WITHOUT => get_vocab("without"));
+          $params['options'] = $options;
+          $params['force_assoc'] = true;
+          generate_radio_group($params);
         }
         // Otherwise output a text input of some kind
         else
@@ -1189,9 +1192,11 @@
   elseif (($field_natures[$column] == 'boolean') || 
           (($field_natures[$column] == 'integer') && 
isset($field_lengths[$column]) && ($field_lengths[$column] <= 2)) )
   {
-    if ($match)
+    if (($match != CUSTOM_BOTH) && ($match !== ''))
     {
-      $sql .= " AND $full_column_name!=0";
+      $sql .= " AND ($full_column_name ";
+      $sql .= ($match == CUSTOM_WITH) ? "IS NOT NULL AND $full_column_name != 
0" : "IS NULL OR $full_column_name = 0";
+      $sql .= ")";
     }
   }
   // (3) Integers

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to