Revision: 1998
http://mrbs.svn.sourceforge.net/mrbs/?rev=1998&view=rev
Author: cimorrison
Date: 2011-09-23 10:43:45 +0000 (Fri, 23 Sep 2011)
Log Message:
-----------
Fixed bug resulting in a JavaScript error on the edit_entry page if some form
inputs are absent (eg if $auth['only_admin_can_book_repeat'] is set)
Modified Paths:
--------------
mrbs/trunk/web/Themes/default/header.inc
Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc 2011-09-22 16:51:18 UTC (rev
1997)
+++ mrbs/trunk/web/Themes/default/header.inc 2011-09-23 10:43:45 UTC (rev
1998)
@@ -352,16 +352,18 @@
'end_seconds', 'end_day', 'end_month', 'end_year',
'rep_type', 'rep_end_day', 'rep_end_month',
'rep_end_year', 'rep_day[]', 'rep_num_weeks');
- // function to check whether the proposed booking would (a) conflict with
any other bookings
- // and (b) conforms to the booking policies. Makes an Ajax call to
edit_entry_handler but does
- // not actually make the booking.
+ // Fills the params object with a value from the form
+ // (Note: params is an object, so passed by reference)
?>
function fillParamFromForm(form, params, value)
{
- // We need to exclude the disabled elements, because otherwise jQuery
- // will pick them all up
- var formInput = form.find('[name="' + value + '"]:not(:disabled)');
- // Scalar parameters (two types - checkboxes and the rest)
+ <?php
+ // We need to exclude the disabled elements, because otherwise jQuery
+ // will pick them all up
+ ?>
+ form.find('[name="' + value + '"]:not(:disabled)').each(function() {
+ <?php // Scalar parameters (two types - checkboxes and the rest) ?>
+ var formInput = $(this);
if (value.indexOf('[]') == -1)
{
if (formInput.filter(':checkbox').length > 0)
@@ -377,7 +379,7 @@
params[value] = formInput.val();
}
}
- // Array parameters (two types - checkboxes and the rest)
+ <?php // Array parameters (two types - checkboxes and the rest) ?>
else
{
params[value] = [];
@@ -394,25 +396,32 @@
{
params[value] = formInput.val();
}
+ <?php
// For some reason I don't understand, posting an empty array will
// give you a PHP array of ('') at the other end. So to avoid
// that problem, delete the property if the array is empty
+ ?>
if (params[value].length == 0)
{
delete params[value];
}
}
+ });
}
+ <?php
+ // function to check whether the proposed booking would (a) conflict with
any other bookings
+ // and (b) conforms to the booking policies. Makes an Ajax call to
edit_entry_handler but does
+ // not actually make the booking.
+ ?>
function checkValidBooking()
{
- var params = {'ajax': 1}; // This is an Ajax request
+ var params = {'ajax': 1}; <?php // This is an Ajax request ?>
var form = $('form#main');
-<?php
-
+ <?php
foreach ($params as $param)
{
- echo " fillParamFromForm(form, params, '$param');\n";
+ echo "fillParamFromForm(form, params, '$param');\n";
}
?>
$.post('edit_entry_handler.php', params, function(result) {
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits