Revision: 1412
http://mrbs.svn.sourceforge.net/mrbs/?rev=1412&view=rev
Author: cimorrison
Date: 2010-08-13 18:02:45 +0000 (Fri, 13 Aug 2010)
Log Message:
-----------
Tied labels to the datepicker input fields so that clicking on the label brings
up the datepicker.
Modified Paths:
--------------
mrbs/branches/datepicker/web/edit_entry.php
mrbs/branches/datepicker/web/edit_entry_handler.php
mrbs/branches/datepicker/web/functions.inc
mrbs/branches/datepicker/web/report.php
mrbs/branches/datepicker/web/search.php
Modified: mrbs/branches/datepicker/web/edit_entry.php
===================================================================
--- mrbs/branches/datepicker/web/edit_entry.php 2010-08-13 17:29:01 UTC (rev
1411)
+++ mrbs/branches/datepicker/web/edit_entry.php 2010-08-13 18:02:45 UTC (rev
1412)
@@ -552,8 +552,10 @@
</div>
<div id="div_date">
- <label><?php echo get_vocab("date")?>:</label>
- <?php gendateselector("", $start_day, $start_month, $start_year) ?>
+ <?php
+ echo "<label for=\"start_datepicker\">" . get_vocab("date") .
":</label>\n";
+ gendateselector("start_", $start_day, $start_month, $start_year);
+ ?>
</div>
<?php
@@ -906,8 +908,10 @@
</div>
<div id="rep_end_date">
- <label><?php echo get_vocab("rep_end_date")?>:</label>
- <?php genDateSelector("rep_end_", $rep_end_day, $rep_end_month,
$rep_end_year) ?>
+ <?php
+ echo "<label for=\"rep_end_datepicker\">" . get_vocab("rep_end_date")
. ":</label>\n";
+ genDateSelector("rep_end_", $rep_end_day, $rep_end_month,
$rep_end_year);
+ ?>
</div>
<div id="rep_day">
Modified: mrbs/branches/datepicker/web/edit_entry_handler.php
===================================================================
--- mrbs/branches/datepicker/web/edit_entry_handler.php 2010-08-13 17:29:01 UTC
(rev 1411)
+++ mrbs/branches/datepicker/web/edit_entry_handler.php 2010-08-13 18:02:45 UTC
(rev 1412)
@@ -29,6 +29,10 @@
$rep_day = get_form_var('rep_day', 'array'); // array of bools
$rep_num_weeks = get_form_var('rep_num_weeks', 'int');
$private = get_form_var('private', 'string'); // bool, actually
+// Get the start day/month/year and make them the current day/month/year
+$day = get_form_var('start_day', 'int');
+$month = get_form_var('start_month', 'int');
+$year = get_form_var('start_year', 'int');
// Get the information about the fields in the entry table
$fields = sql_field_info($tbl_entry);
@@ -103,14 +107,6 @@
}
}
-// If we dont know the right date then make it up
-if (!isset($day) or !isset($month) or !isset($year))
-{
- $day = date("d");
- $month = date("m");
- $year = date("Y");
-}
-
// Set up the return URL. As the user has tried to book a particular room
and a particular
// day, we must consider these to be the new "sticky room" and "sticky day",
so modify the
// return URL accordingly.
@@ -142,6 +138,13 @@
$returl = $returl_base[0];
}
+// If we haven't been given a sensible date then get out of here and don't
trey and make a booking
+if (!isset($day) || !isset($month) || !isset($year) || !checkdate($month,
$day, $year))
+{
+ header("Location: $returl");
+ exit;
+}
+
// Now construct the new query string
$returl .= "?year=$year&month=$month&day=$day";
Modified: mrbs/branches/datepicker/web/functions.inc
===================================================================
--- mrbs/branches/datepicker/web/functions.inc 2010-08-13 17:29:01 UTC (rev
1411)
+++ mrbs/branches/datepicker/web/functions.inc 2010-08-13 18:02:45 UTC (rev
1412)
@@ -322,16 +322,13 @@
$min = min($year, date("Y")) - 5;
$max = max($year, date("Y")) + 5;
- // Generate a unique suffix so that we'll be able to distinguish between
- // multiple date selectors on the same page
- $suffix = "_" . uniqid();
- $datepicker_baseid = "datepicker" . $suffix;
+ $datepicker_baseid = "${prefix}datepicker";
// We'll put the date selector in a span. First of all we'll generate
// day, month and year selectors. These will be used if JavaScript is
// disabled. If JavaScript is enabled it will overwrite these with a
// datepicker calendar.
- echo "<span id=\"dateselector$suffix\">\n";
+ echo "<span id=\"${prefix}dateselector\">\n";
// the day selector
echo "<select name=\"${prefix}day\">\n";
for ($i = 1; $i <= 31; $i++)
@@ -377,7 +374,7 @@
});
- var dateselector = document.getElementById(<?php echo
"'dateselector$suffix'" ?>);
+ var dateselector = document.getElementById(<?php echo
"'${prefix}dateselector'" ?>);
var datepicker_html = '<input class="date" type="text" id="<?php echo
$datepicker_baseid ?>">\n';
<?php
// The next input is disabled because we don't need to pass the value
through to
Modified: mrbs/branches/datepicker/web/report.php
===================================================================
--- mrbs/branches/datepicker/web/report.php 2010-08-13 17:29:01 UTC (rev
1411)
+++ mrbs/branches/datepicker/web/report.php 2010-08-13 18:02:45 UTC (rev
1412)
@@ -707,20 +707,18 @@
<legend><?php echo get_vocab("report_on");?></legend>
<div id="div_report_start">
- <label><?php echo get_vocab("report_start");?>:</label>
- <?php genDateSelector("From_",
- $From_day,
- $From_month,
- $From_year); ?>
+ <?php
+ echo "<label for=\"From_datepicker\">" . get_vocab("report_start") .
":</label>\n";
+ genDateSelector("From_", $From_day, $From_month, $From_year);
+ ?>
</div>
<div id="div_report_end">
- <label><?php echo get_vocab("report_end");?>:</label>
- <?php genDateSelector("To_",
- $To_day,
- $To_month,
- $To_year); ?>
+ <?php
+ echo "<label for=\"To_datepicker\">" . get_vocab("report_end") .
":</label>\n";
+ genDateSelector("To_", $To_day, $To_month, $To_year);
+ ?>
</div>
<div id="div_areamatch">
Modified: mrbs/branches/datepicker/web/search.php
===================================================================
--- mrbs/branches/datepicker/web/search.php 2010-08-13 17:29:01 UTC (rev
1411)
+++ mrbs/branches/datepicker/web/search.php 2010-08-13 18:02:45 UTC (rev
1412)
@@ -8,6 +8,17 @@
$search_pos = get_form_var('search_pos', 'int');
$total = get_form_var('total', 'int');
$advanced = get_form_var('advanced', 'int');
+// Get the start day/month/year and make them the current day/month/year
+$day = get_form_var('from_day', 'int');
+$month = get_form_var('from_month', 'int');
+$year = get_form_var('from_year', 'int');
+// If we haven't been given a sensible date then use today's
+if (!isset($day) || !isset($month) || !isset($year) || !checkdate($month,
$day, $year))
+{
+ $day = date("d");
+ $month = date("m");
+ $year = date("Y");
+}
// Check the user is authorised for this page
checkAuthorised();
@@ -36,8 +47,10 @@
<input type="text" id="search_str" name="search_str">
</div>
<div id="div_search_from">
- <label><?php echo get_vocab("from") ?>:</label>
- <?php genDateSelector ("", $day, $month, $year) ?>
+ <?php
+ echo "<label for=\"from_datepicker\">" . get_vocab("from") .
":</label>\n";
+ genDateSelector ("from_", $day, $month, $year);
+ ?>
</div>
<div id="search_submit">
<input class="submit" type="submit" value="<?php echo
get_vocab("search_button") ?>">
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits