Revision: 1994
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1994&view=rev
Author:   cimorrison
Date:     2011-09-22 09:28:37 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Added a timer so that a potential booking on the edit_entry form can be 
periodically rechecked for validity, in case someone else makes or releases a 
booking while the page is open.   Can be disabled and the interval set by means 
of a config variable.  Default enabled, 10 second interval.

Modified Paths:
--------------
    mrbs/trunk/web/Themes/default/header.inc
    mrbs/trunk/web/systemdefaults.inc.php

Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc    2011-09-22 09:04:50 UTC (rev 
1993)
+++ mrbs/trunk/web/Themes/default/header.inc    2011-09-22 09:28:37 UTC (rev 
1994)
@@ -76,6 +76,7 @@
   global $lang_map_windows, $langs, $server_os;
   global $default_duration_all_day;
   global $select_options;
+  global $ajax_refresh_rate;
   
   $page = basename($PHP_SELF, ".php");
   $user = getUserName();
@@ -1082,12 +1083,27 @@
           });
       }  
       <?php
-    }
+    }  // foreach
     ?>
 
     checkValidBooking();
+    
     <?php
-  }
+    // Finally set a timer so that the validity of the booking is periodically
+    // checked, in case someone else books that slot before you press Save
+    // (Note the config variable is in seconds, but the setInterval() function
+    // uses milliseconds)
+    if (!empty($ajax_refresh_rate))
+    {
+      ?>
+      window.setInterval(function() {
+        checkValidBooking();
+      }, <?php echo $ajax_refresh_rate * 1000 ?>);
+      <?php
+    }
+
+
+  } // if (function_exists('json_encode'))
   ?>
 
   <?php

Modified: mrbs/trunk/web/systemdefaults.inc.php
===================================================================
--- mrbs/trunk/web/systemdefaults.inc.php       2011-09-22 09:04:50 UTC (rev 
1993)
+++ mrbs/trunk/web/systemdefaults.inc.php       2011-09-22 09:28:37 UTC (rev 
1994)
@@ -294,6 +294,10 @@
 // Page refresh time (in seconds). Set to 0 to disable
 $refresh_rate = 0;
 
+// Refresh rate (in seconds) for Ajax checking of valid bookings on the 
edit_entry page
+// Set to 0 to disable
+$ajax_refresh_rate = 10;
+
 // Trailer type.   FALSE gives a trailer complete with links to days, weeks 
and months before
 // and after the current date.    TRUE gives a simpler trailer that just has 
links to the
 // current day, week and month.

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


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to