diff options
-rwxr-xr-x | includes/inc_edittimer.php | 54 | ||||
-rwxr-xr-x | javascript/functions.js | 34 |
2 files changed, 83 insertions, 5 deletions
diff --git a/includes/inc_edittimer.php b/includes/inc_edittimer.php index e362c94..8babf0c 100755 --- a/includes/inc_edittimer.php +++ b/includes/inc_edittimer.php @@ -17,7 +17,7 @@ else list($type, $channame, $date, $stime, $etime, $desc) = vdrgettimerinfo($timer); // Timer name -print "<form name=\"timer\" id=\"timer\" method=\"post\" action=\"index.php\">\r\n"; +print "<form name=\"timer\" id=\"timer\" method=\"post\" action=\"index.php\" onsubmit='return checkform()'>\r\n"; print " <ul class=\"pageitem\">\r\n"; if ($type & 0x1) print " <li class=\"checkbox\"><span class=\"name\">Active</span><input name=\"timer_active\" type=\"checkbox\" checked/></li>\r\n"; @@ -27,7 +27,15 @@ print " </ul>\r\n"; print " <ul class=\"pageitem\">\r\n"; print " <li class=\"textbox\"><span class=\"header\">Recording name</span></li>\r\n"; print " <li class=\"bigfield\">\r\n"; + +if ($timer==-1) +{ +print " <input type=\"text\" placeholder=\"Enter recording name\" name=\"timer_name\" value=\"\" />\r\n"; +} +else +{ print " <input type=\"text\" placeholder=\"Enter recording name\" name=\"timer_name\" value=\"{$desc}\" />\r\n"; +} print " </li>\r\n"; print " </ul>\r\n"; print " <ul class=\"pageitem\">\r\n"; @@ -51,7 +59,17 @@ print " <li class=\"textbox\"><span class=\"header\">Date</span></li>\r\n"; $datearray = explode("-", $date); print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:openSelectDate({$datearray[0]},{$datearray[1]},{$datearray[2]})\">\r\n"; + +if ($timer == -1) +{ +print " <span class=\"name\" id=\"layer_date\">Select date</span><span class=\"arrow\"></span></a>"; +} +else +{ print " <span class=\"name\" id=\"layer_date\">{$date}</span><span class=\"arrow\"></span></a>"; + +} + print " </li>\r\n"; print " </ul>\r\n"; @@ -64,7 +82,15 @@ $ssec = substr($stime, 2); print " <li class=\"menu\">"; print " <a class=\"noeffect\" href=\"javascript:openSelectTime('layer_starttime',{$smin}, {$ssec})\">\r\n"; + +if ($timer == -1) +{ +print " <span class=\"name\" id=\"layer_starttime\">Select start time</span>"; +} +else +{ print " <span class=\"name\" id=\"layer_starttime\">{$smin}h{$ssec}</span>"; +} print " <span class=\"arrow\"></span>"; print " </a>"; print " </li>\r\n"; @@ -76,21 +102,41 @@ $emin = substr($etime, 0, 2); $esec = substr($etime, 2); print " <li class=\"menu\"><a class=\"noeffect\" href=\"javascript:openSelectTime('layer_endtime',{$emin},{$esec})\">\r\n"; +if ($timer == -1) +{ +print " <span class=\"name\" id=\"layer_endtime\">Select end time</span><span class=\"arrow\"></span></a></li>\r\n"; +} +else +{ print " <span class=\"name\" id=\"layer_endtime\">{$emin}h{$esec}</span><span class=\"arrow\"></span></a></li>\r\n"; +} print " </ul>\r\n"; - print "<input name=\"action\" type=\"hidden\" id=\"action\" value=\"addtimer\"/>\r\n"; + +if ($timer == -1) +{ +print "<input name=\"timer_date\" type=\"hidden\" id=\"timer_date\" value=\"\" />\r\n"; +print "<input name=\"timer_starttime\" type=\"hidden\" id=\"timer_starttime\" value=\"\" />\r\n"; +print "<input name=\"timer_endtime\" type=\"hidden\" id=\"timer_endtime\" value=\"\" />\r\n"; +} +else +{ print "<input name=\"timer_date\" type=\"hidden\" id=\"timer_date\" value=\"{$date}\" />\r\n"; print "<input name=\"timer_starttime\" type=\"hidden\" id=\"timer_starttime\" value=\"{$smin}{$ssec}\" />\r\n"; print "<input name=\"timer_endtime\" type=\"hidden\" id=\"timer_endtime\" value=\"{$emin}{$esec}\" />\r\n"; +} + print "<input name=\"prevtimer\" type=\"hidden\" id=\"prevtimer\" value=\"{$timer}\" />\r\n"; print "<ul class=\"pageitem\">\r\n"; print "<li class=\"button\">\r\n"; -if ($timer == -1) - print " <input name=\"Submit\" type=\"submit\" value=\"Submit\" /></li>\r\n"; +if ($timer == -1){ + print " <input name=\"Update\" type=\"Submit\" value=\"Create\" /></li>\r\n"; +} else +{ print " <input name=\"Update\" type=\"Submit\" value=\"Update\" /></li>\r\n"; +} print "</ul>\r\n"; print "</form>\r\n"; diff --git a/javascript/functions.js b/javascript/functions.js index bf32859..a708963 100755 --- a/javascript/functions.js +++ b/javascript/functions.js @@ -157,4 +157,36 @@ function str_pad (input, pad_length, pad_string, pad_type) { }
return input;
-}
+}
+
+function checkform()
+{
+
+ if ( document.timer.timer_name.value=="" )
+ {
+ alert('Recording name is missing');
+ return false;
+ }
+ else if ( document.timer.timer_chan.value=="" )
+ {
+ alert('Select a channel to record');
+ return false;
+ }
+ else if ( document.timer.timer_date.value=="" )
+ {
+ alert('Select recording date');
+ return false;
+ }
+ else if ( document.timer.timer_starttime.value=="" )
+ {
+ alert('Select recording start time');
+ return false;
+ }
+ else if ( document.timer.timer_endtime.value=="" )
+ {
+ alert('Select recording end time');
+ return false;
+ }
+
+ return true;
+}
|