Revision: 1918
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1918&view=rev
Author:   cimorrison
Date:     2011-09-01 08:42:16 +0000 (Thu, 01 Sep 2011)
Log Message:
-----------
Merged in latest changes from trunk

Modified Paths:
--------------
    mrbs/branches/datatables/web/edit_entry.php
    mrbs/branches/datatables/web/edit_entry_handler.php

Property Changed:
----------------
    mrbs/branches/datatables/
    mrbs/branches/datatables/web/upgrade/5/pgsql.sql


Property changes on: mrbs/branches/datatables
___________________________________________________________________
Modified: svn:mergeinfo
   - /mrbs/branches/custom_entry_fields:1374-1396
/mrbs/branches/datepicker:1409-1416
/mrbs/branches/disabled_rooms:1601-1634
/mrbs/branches/from_to_bookings:1491-1587
/mrbs/branches/ics_attachments:1652-1741
/mrbs/branches/improve_css_2008_06:804-872
/mrbs/branches/only_unicode:1747-1749
/mrbs/branches/provisional_bookings:1242-1280
/mrbs/branches/provisional_bookings_new_style:1407-1570
/mrbs/trunk:1863-1912
   + /mrbs/branches/custom_entry_fields:1374-1396
/mrbs/branches/datepicker:1409-1416
/mrbs/branches/disabled_rooms:1601-1634
/mrbs/branches/from_to_bookings:1491-1587
/mrbs/branches/ics_attachments:1652-1741
/mrbs/branches/improve_css_2008_06:804-872
/mrbs/branches/only_unicode:1747-1749
/mrbs/branches/provisional_bookings:1242-1280
/mrbs/branches/provisional_bookings_new_style:1407-1570
/mrbs/trunk:1863-1917

Modified: mrbs/branches/datatables/web/edit_entry.php
===================================================================
--- mrbs/branches/datatables/web/edit_entry.php 2011-09-01 07:35:12 UTC (rev 
1917)
+++ mrbs/branches/datatables/web/edit_entry.php 2011-09-01 08:42:16 UTC (rev 
1918)
@@ -325,18 +325,18 @@
       // the input is disabled
       $rep_end_date = utf8_strftime('%A %d %B %Y',$row['end_date']);
 
+      $rep_day = array();
       switch ($rep_type)
       {
-        case 2:
-        case 6:
-          
-          $rep_day[0] = $row['rep_opt'][0] != "0";
-          $rep_day[1] = $row['rep_opt'][1] != "0";
-          $rep_day[2] = $row['rep_opt'][2] != "0";
-          $rep_day[3] = $row['rep_opt'][3] != "0";
-          $rep_day[4] = $row['rep_opt'][4] != "0";
-          $rep_day[5] = $row['rep_opt'][5] != "0";
-          $rep_day[6] = $row['rep_opt'][6] != "0";
+        case REP_WEEKLY:
+        case REP_N_WEEKLY:
+          for ($i=0; $i<7; $i++)
+          {
+            if ($row['rep_opt'][$i])
+            {
+              $rep_day[] = $i;
+            }
+          }
           // Get the repeat days as an array for use
           // when the input is disabled
           $rep_opt = $row['rep_opt'];
@@ -349,7 +349,7 @@
           break;
 
         default:
-          $rep_day = array(0, 0, 0, 0, 0, 0, 0);
+          break;
       }
     }
   }
@@ -368,7 +368,7 @@
   $rep_end_day   = $day;
   $rep_end_month = $month;
   $rep_end_year  = $year;
-  $rep_day       = array(0, 0, 0, 0, 0, 0, 0);
+  $rep_day       = array();
   $private       = $private_default;
   $confirmed     = $confirmed_default;
   
@@ -1123,8 +1123,8 @@
           for ($i = 0; $i < 7; $i++)
           {
             $wday = ($i + $weekstarts) % 7;
-            echo "      <label><input class=\"checkbox\" 
name=\"rep_day[$wday]\" type=\"checkbox\"";
-            if ($rep_day[$wday])
+            echo "      <label><input class=\"checkbox\" name=\"rep_day[]\" 
value=\"$wday\" type=\"checkbox\"";
+            if (in_array($wday, $rep_day))
             {
               echo " checked=\"checked\"";
             }

Modified: mrbs/branches/datatables/web/edit_entry_handler.php
===================================================================
--- mrbs/branches/datatables/web/edit_entry_handler.php 2011-09-01 07:35:12 UTC 
(rev 1917)
+++ mrbs/branches/datatables/web/edit_entry_handler.php 2011-09-01 08:42:16 UTC 
(rev 1918)
@@ -5,6 +5,19 @@
 require_once "mrbs_sql.inc";
 require_once "functions_ical.inc";
 
+// NOTE:  the code on this page assumes that array form variables are passed
+// as an array of values, rather than an array indexed by value.   This is
+// particularly important for checkbox arrays whicgh should be formed like 
this:
+//
+//    <input type="checkbox" name="foo[]" value="n">
+//    <input type="checkbox" name="foo[]" value="m">
+//
+// and not like this:
+//
+//    <input type="checkbox" name="foo[n]" value="1">
+//    <input type="checkbox" name="foo[m]" value="1">
+
+
 // Get non-standard form variables
 $formvars = array('create_by'         => 'string',
                   'name'              => 'string',
@@ -43,7 +56,6 @@
 {
   $$var = get_form_var($var, $var_type);
 }
-              
 
 // Get custom form variables
 $custom_fields = array();
@@ -385,14 +397,13 @@
   // as the day of the week of the start of the period
   if (count($rep_day) == 0)
   {
-    $start_day = date('w', $starttime);
-    $rep_day[$start_day] = TRUE;
+    $rep_day[] = date('w', $starttime);
   }
   
   // Build string of weekdays to repeat on:
   for ($i = 0; $i < 7; $i++)
   {
-    $rep_opt .= empty($rep_day[$i]) ? "0" : "1";  // $rep_opt is a string
+    $rep_opt .= in_array($i, $rep_day) ? "1" : "0";  // $rep_opt is a string
   }
   
   // Make sure that the starttime and endtime coincide with a repeat day.  In
@@ -767,6 +778,7 @@
   {
     if ($var_type == 'array')
     {
+      // See the comment at the top of the page about array formats
       foreach ($$var as $value)
       {
         echo "<input type=\"hidden\" name=\"${var}[]\" value=\"" . 
htmlspecialchars($value) . "\">\n";


Property changes on: mrbs/branches/datatables/web/upgrade/5/pgsql.sql
___________________________________________________________________
Modified: svn:mergeinfo
   - /mrbs/branches/custom_entry_fields/web/upgrade/5/pgsql.sql:1374-1396
/mrbs/branches/datepicker/web/upgrade/5/pgsql.sql:1409-1416
/mrbs/branches/disabled_rooms/web/upgrade/5/pgsql.sql:1601-1634
/mrbs/branches/from_to_bookings/web/upgrade/5/pgsql.sql:1491-1587
/mrbs/branches/ics_attachments/web/upgrade/5/pgsql.sql:1652-1741
/mrbs/branches/only_unicode/web/upgrade/5/pgsql.sql:1747-1749
/mrbs/branches/provisional_bookings/web/upgrade/5/pgsql.sql:1242-1280
/mrbs/branches/provisional_bookings_new_style/web/upgrade/5/pgsql.sql:1407-1570
/mrbs/trunk/web/upgrade/5/pgsql.sql:1863-1912
   + /mrbs/branches/custom_entry_fields/web/upgrade/5/pgsql.sql:1374-1396
/mrbs/branches/datepicker/web/upgrade/5/pgsql.sql:1409-1416
/mrbs/branches/disabled_rooms/web/upgrade/5/pgsql.sql:1601-1634
/mrbs/branches/from_to_bookings/web/upgrade/5/pgsql.sql:1491-1587
/mrbs/branches/ics_attachments/web/upgrade/5/pgsql.sql:1652-1741
/mrbs/branches/only_unicode/web/upgrade/5/pgsql.sql:1747-1749
/mrbs/branches/provisional_bookings/web/upgrade/5/pgsql.sql:1242-1280
/mrbs/branches/provisional_bookings_new_style/web/upgrade/5/pgsql.sql:1407-1570
/mrbs/trunk/web/upgrade/5/pgsql.sql:1863-1917

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


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to