Switch hour and minute in the editor to dropdowns

Fix passing extra parameters to emit_hour_selector
Allow emit_minute_selector to work with different minute intervals
This commit is contained in:
james 2010-06-11 20:04:51 +00:00
parent 4edd9baad3
commit badea469f6
2 changed files with 11 additions and 7 deletions

View File

@ -263,9 +263,9 @@
<? echo i18n("Schedule date"); ?>
<input id="date" class="date" type="text" name="date" value="<?=$editdate?>" size="15" onchange="changeDate()">
<? echo i18n("Start hour")." ";
emit_hour_selector("starthour",7,"onchange=\"changeDate()\"");
emit_hour_selector("starthour",7,"id=\"starthour\" onchange=\"changeDate()\"");
echo i18n("End hour")." ";
emit_hour_selector("endhour",17,"onchange=\"changeDate()\"");
emit_hour_selector("endhour",17,"id=\"endhour\" onchange=\"changeDate()\"");
?>
</form>
<hr />

View File

@ -851,10 +851,10 @@ function emit_date_selector($name,$selected="")
echo "</table>";
}
function emit_hour_selector($name,$selected="",$extra)
function emit_hour_selector($name,$selected="",$extra="")
{
if($selected!="") $selected=(int)$selected;
echo "<select name=\"$name\" id=\"$name\" $extra>\n";
echo "<select name=\"$name\" $extra>\n";
echo "<option value=\"\">HH</option>\n";
@ -871,14 +871,18 @@ function emit_hour_selector($name,$selected="",$extra)
}
function emit_minute_selector($name,$selected="")
function emit_minute_selector($name,$selected="",$extra="",$interval=5)
{
$mins=array("00","05","10","15","20","25","30","35","40","45","50","55");
$mins=array();
for($x=0;$x<60;$x+=$interval) {
$mins[]=$x;
}
// $mins=array("00","05","10","15","20","25","30","35","40","45","50","55");
echo "<select name=\"$name\">\n";
echo "<option value=\"\">MM</option>\n";
for($x=0;$x<count($mins);$x++)
echo "<option value=\"".$mins[$x]."\" ".($selected==$mins[$x]?"selected":"").">$mins[$x]</option>\n";
echo "<option value=\"".$mins[$x]."\" ".($selected==$mins[$x]?"selected":"").">".sprintf("%02d",$mins[$x])."</option>\n";
echo "</select>\n";