Revision: 2141
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2141&view=rev
Author:   cimorrison
Date:     2011-10-23 17:24:18 +0000 (Sun, 23 Oct 2011)
Log Message:
-----------
Fixed bug causing the all day checkbox to be checked if an existing booking was 
being edited in area where the default duration is all day.

Modified Paths:
--------------
    mrbs/branches/draggable_bookings/web/Themes/default/header.inc
    mrbs/branches/draggable_bookings/web/edit_entry.php

Modified: mrbs/branches/draggable_bookings/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-23 15:41:19 UTC (rev 2140)
+++ mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-23 17:24:18 UTC (rev 2141)
@@ -2426,19 +2426,24 @@
   // Check the All Day box if that's the default and then call the function
   // that handles changes.  (Note - the call to OnAllDayClick() comes inside
   // an each() in case there isn't an all_day checkbox, which there won't be
-  // if we're logging in)
-  // However don't check it if $drag is set, because that means we've
-  // come from a drag select and don't want the defaults
+  // if we're logging in).   However don't check it if (a) $drag is set, 
because
+  // that means we've come from a drag select and don't want the defaults or 
+  // (b) the checkbox has been given a class of "no_default", probably because
+  // it's an existing booking that we are editing or copying.
   global $drag;
   if ($default_duration_all_day && !isset($drag))
   {
     ?>
-    $('#all_day').attr('checked', true).each(function() {
-        OnAllDayClick(true);
+    $('#all_day').each(function() {
+        if (!$(this).hasClass('no_default'))
+        {
+          $(this).attr('checked', true);
+          OnAllDayClick(true);
+        }
       });
     <?php
   }
-  
+
   // Set up handlers if anything like a submit button is pressed.   If it's 
the Save
   // button we need to validate the form first.  In addition, for all the 
buttons, if
   // we are going to submit something we set some data in the form.   This 
allows

Modified: mrbs/branches/draggable_bookings/web/edit_entry.php
===================================================================
--- mrbs/branches/draggable_bookings/web/edit_entry.php 2011-10-23 15:41:19 UTC 
(rev 2140)
+++ mrbs/branches/draggable_bookings/web/edit_entry.php 2011-10-23 17:24:18 UTC 
(rev 2141)
@@ -847,15 +847,19 @@
       genSlotSelector($a, "start_", $first, $start_last, $start_time, 
$display_none);
     }
 
-    ?>
-    <div class="group">
-      <div id="ad">
-        <input id="all_day" class="checkbox" name="all_day" type="checkbox" 
value="yes" onclick="OnAllDayClick(this)">
-        <label for="all_day"><?php echo get_vocab("all_day"); ?></label>
-      </div>
-    </div>
-    <?php
+    echo "<div class=\"group\">\n";
+    echo "<div id=\"ad\">\n";
+    echo "<input id=\"all_day\" class=\"checkbox" .
+         // If this is an existing booking that we are editing or copying, 
then we do
+         // not want the JavaScript to apply the default setting to the all 
day checkbox,
+         // so add a class that will tell the JavaScript that
+         ((isset($id)) ? " no_default" : "") .
+         "\" name=\"all_day\" type=\"checkbox\" value=\"yes\" 
onclick=\"OnAllDayClick(this)\">\n";
+    echo "<label for=\"all_day\">" . get_vocab("all_day") . "</label>\n";
     echo "</div>\n";
+    echo "</div>\n";
+
+    echo "</div>\n";
     
     echo "<div id=\"div_end_date\">\n";
     echo "<label>" . get_vocab("end") . ":</label>\n";

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


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to