Revision: 1608
http://mrbs.svn.sourceforge.net/mrbs/?rev=1608&view=rev
Author: cimorrison
Date: 2010-11-17 17:59:26 +0000 (Wed, 17 Nov 2010)
Log Message:
-----------
Removed the "go to" button from the date selector in the header when JavaScript
is enabled. Now when the datepicker is closed MRBS automatically goes to the
new date. Following a usability suggestion from Matthew Hilling on the
mailing list.
Modified Paths:
--------------
mrbs/trunk/web/Themes/default/header.inc
mrbs/trunk/web/functions.inc
mrbs/trunk/web/mrbs.css.php
Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc 2010-11-16 22:33:01 UTC (rev
1607)
+++ mrbs/trunk/web/Themes/default/header.inc 2010-11-17 17:59:26 UTC (rev
1608)
@@ -179,8 +179,10 @@
//
// Then go and adjust the start and end time/period select options, because
// they are dependent on the start and end dates
+//
+// Finally, if formId is defined, submit the form
?>
-function datepicker_close(dateText, inst)
+function datepicker_close(dateText, inst, formId)
{
var alt_id = inst.id + '_alt';
var date = document.getElementById(alt_id).value.split('-');
@@ -196,6 +198,11 @@
<?php
}
?>
+ if (formId)
+ {
+ var form = document.getElementById(formId);
+ form.submit();
+ }
}
@@ -898,7 +905,9 @@
<form action="day.php" method="get" id="Form1">
<div>
<?php
- genDateSelector("", $day, $month, $year);
+ // Give the form id as the optional fifth parameter because we want
+ // the form to be automatically submitted when the datepicker is
closed
+ genDateSelector("", $day, $month, $year, "Form1");
if (!empty($area))
{
echo "<input type=\"hidden\" name=\"area\" value=\"$area\">\n";
@@ -907,10 +916,12 @@
{
echo "<input type=\"hidden\" name=\"room\" value=\"$room\">\n";
}
-
+ // We set class = "js_none" because if JavaScript is enabled we
want the
+ // submit button to disappear because the form will be
automatically submitted
+ // when the datepicker closes
+ echo "<input class=\"js_none\" type=\"submit\" value=\"" .
get_vocab("goto") . "\">\n";
?>
- <input type="submit" value="<?php echo get_vocab("goto") ?>">
- </div>
+ </div>
</form>
<?php
// Provide a link to the list of bookings awaiting approval
Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc 2010-11-16 22:33:01 UTC (rev 1607)
+++ mrbs/trunk/web/functions.inc 2010-11-17 17:59:26 UTC (rev 1608)
@@ -370,13 +370,16 @@
// then it will generate a calendar picker using jQuery UI datepicker. If
not,
// it will generate three separate select boxes, one each for day, month and
year.
//
+// $form_id is an optional fifth parameter. If set it specifies the id of
+// a form to submit when the datepicker is closed.
+//
// Whether or not JavaScript is enabled the date is passed back in three
separate
// variables: ${prefix}day, ${prefix}month and ${prefix}year
//
// The function passes back three separate variables, rather than a single
date
// variable, partly for compatibility with previous implementations of
genDateSelector()
// and partly because it's easier to do this for the non-JavaScript version.
-function genDateSelector($prefix, $day, $month, $year)
+function genDateSelector($prefix, $day, $month, $year, $form_id='')
{
// Make sure we've got a date
if (empty($day) or empty($month) or empty($year))
@@ -437,6 +440,12 @@
$(function() {
$("#<?php echo $datepicker_baseid ?>").datepicker({yearRange:
<?php echo "'$min:$max'" ?>,
altField:
'#<?php echo $datepicker_baseid ?>_alt'
+ <?php
+ if
(!empty($form_id))
+ {
+ echo ",
onClose: function(dateText, inst) {datepicker_close(dateText, inst,
'$form_id');}";
+ }
+ ?>
});
<?php
// Populate the input fields with the initial values
Modified: mrbs/trunk/web/mrbs.css.php
===================================================================
--- mrbs/trunk/web/mrbs.css.php 2010-11-16 22:33:01 UTC (rev 1607)
+++ mrbs/trunk/web/mrbs.css.php 2010-11-17 17:59:26 UTC (rev 1608)
@@ -676,7 +676,7 @@
#banner a:link {color: <?php echo $anchor_link_color_banner ?>;
text-decoration: none; font-weight: normal}
#banner a:visited {color: <?php echo $anchor_visited_color_banner ?>;
text-decoration: none; font-weight: normal}
#banner a:hover {color: <?php echo $anchor_hover_color_banner ?>;
text-decoration:underline; font-weight: normal}
-#banner input.date {width: 6.5em}
+#banner input.date {width: 6.5em; text-align: center}
table#colour_key {clear: both; border-spacing: 0; border-collapse: collapse}
#colour_key td {width: 7.0em; padding: 2px; font-weight: bold;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits