small bugfix (removed html-code from tools.js) and some other improvements.
authorJulian Dittrich <jjbig@users.schwerkraft.elitedvb.net>
Mon, 5 Feb 2007 19:11:40 +0000 (19:11 +0000)
committerJulian Dittrich <jjbig@users.schwerkraft.elitedvb.net>
Mon, 5 Feb 2007 19:11:40 +0000 (19:11 +0000)
webinterface/src/web-data/templates.js
webinterface/src/web-data/tools.js

index 4bf5321..76d8db9 100644 (file)
@@ -225,17 +225,17 @@ var tplAddTimerForm = '';
        tplAddTimerForm += '<tr><td colspan="3">&nbsp;</td>';
        tplAddTimerForm += '<td colspan="3">Note: For recurring events start/end day/month are not required.</td></tr>';
        tplAddTimerForm += '<tr><td colspan="3">Start:</td>';
-       tplAddTimerForm += '<td colspan="3"><select name="syear" size="1" id="syear" onchange="javascript:addTimerFormChangeTime(\'s\');">%(syear)</select>.';
-       tplAddTimerForm += '<select name="smonth" id="smonth" size="1" onchange="javascript:addTimerFormChangeTime(\'s\');">%(smonth)</select>.';
-       tplAddTimerForm += '<select name="sday" id="sday" size="1" onchange="javascript:addTimerFormChangeTime(\'s\');">%(sday)</select>';
-       tplAddTimerForm += '&nbsp;-&nbsp;<select name="shour" id="shour" size="1" onchange="javascript:addTimerFormChangeTime(\'s\');">%(shour)</select>';
-       tplAddTimerForm += ':<select name="smin" id="smin" size="1" onchange="javascript:addTimerFormChangeTime(\'s\');">%(smin)</select></td></tr>';
+       tplAddTimerForm += '<td colspan="3"><select name="syear" size="1" id="syear" onchange="javascript:addTimerFormChangeTime(\'syear\');">%(syear)</select>.';
+       tplAddTimerForm += '<select name="smonth" id="smonth" size="1" onchange="javascript:addTimerFormChangeTime(\'smonth\');">%(smonth)</select>.';
+       tplAddTimerForm += '<select name="sday" id="sday" size="1" onchange="javascript:addTimerFormChangeTime(\'sday\');">%(sday)</select>';
+       tplAddTimerForm += '&nbsp;-&nbsp;<select name="shour" id="shour" size="1" onchange="javascript:addTimerFormChangeTime(\'shour\');">%(shour)</select>';
+       tplAddTimerForm += ':<select name="smin" id="smin" size="1" onchange="javascript:addTimerFormChangeTime(\'smin\');">%(smin)</select></td></tr>';
        tplAddTimerForm += '<tr><td colspan="3">End:</td>';
-       tplAddTimerForm += '<td colspan="3"><select name="eyear" id="eyear" size="1" onchange="javascript:addTimerFormChangeTime(\'e\');">%(eyear)</select>.';
-       tplAddTimerForm += '<select name="emonth" id="emonth" size="1" onchange="javascript:addTimerFormChangeTime(\'e\');">%(emonth)</select>.';
-       tplAddTimerForm += '<select name="eday" id="eday" size="1" onchange="javascript:addTimerFormChangeTime(\'e\');">%(eday)</select>';
-       tplAddTimerForm += '&nbsp;-&nbsp;<select name="ehour" id="ehour" size="1" onchange="javascript:addTimerFormChangeTime(\'e\');">%(ehour)</select>';
-       tplAddTimerForm += ':<select name="emin" id="emin" size="1" onchange="javascript:addTimerFormChangeTime(\'e\');">%(emin)</select></td></tr>';
+       tplAddTimerForm += '<td colspan="3"><select name="eyear" id="eyear" size="1" onchange="javascript:addTimerFormChangeTime(\'eyear\');">%(eyear)</select>.';
+       tplAddTimerForm += '<select name="emonth" id="emonth" size="1" onchange="javascript:addTimerFormChangeTime(\'emonth\');">%(emonth)</select>.';
+       tplAddTimerForm += '<select name="eday" id="eday" size="1" onchange="javascript:addTimerFormChangeTime(\'eday\');">%(eday)</select>';
+       tplAddTimerForm += '&nbsp;-&nbsp;<select name="ehour" id="ehour" size="1" onchange="javascript:addTimerFormChangeTime(\'ehour\');">%(ehour)</select>';
+       tplAddTimerForm += ':<select name="emin" id="emin" size="1" onchange="javascript:addTimerFormChangeTime(\'emin\');">%(emin)</select></td></tr>';
        tplAddTimerForm += '<tr><td colspan="3">&nbsp;</td><td colspan="3">Note: For one-time events the "days" field doesn\'t have to be specified.</td></tr>';
        tplAddTimerForm += '<tr><td colspan="3">Days:</td><td colspan="3">%(repeated)';
        tplAddTimerForm += '<tr><td colspan="3">Channel:</td><td>';
@@ -256,3 +256,6 @@ var tplAddTimerForm = '';
        tplAddTimerForm += '<input name="beginOld" id="beginOld" type="hidden" value="%(beginOld)">';
        tplAddTimerForm += '<input name="endOld" id="endOld" type="hidden" value="%(endOld)">';
        tplAddTimerForm +=      '<button onclick="sendAddTimer()">Add/Save</button></td></tr></table>';
+
+var tplAddTimerFormOptions = '';
+       tplAddTimerFormOptions += '<option value="%(value)" %(selected)>%(txt)</option>';
\ No newline at end of file
index 66f3b82..7466b18 100644 (file)
@@ -723,7 +723,6 @@ function loadTimerFormSeconds(action,begin,end,repeated,channel,name,description
        addTimerEditFormObject["ehour"] = stopp.getHours();
        addTimerEditFormObject["emin"] = stopp.getMinutes();
        
-       debug(action+"|"+begin+"|"+end+"|"+repeated+"|"+channel+"|"+name+"|"+description+"|"+afterEvent);
        addTimerEditFormObject["record"] = String(action);
        addTimerEditFormObject["channel"] = decodeURIComponent(String(channel));
        addTimerEditFormObject["channelSort"] = "";
@@ -731,6 +730,8 @@ function loadTimerFormSeconds(action,begin,end,repeated,channel,name,description
        addTimerEditFormObject["description"] = String(description);
        addTimerEditFormObject["repeated"] = Number(repeated);
        addTimerEditFormObject["afterEvent"] = Number(afterEvent);
+       
+       debug(action+"|"+begin+"|"+end+"|"+repeated+"|"+channel+"|"+name+"|"+description+"|"+afterEvent);
 
        addTimerEditFormObject["deleteOldOnSave"] = Number(deleteOldOnSave);
        addTimerEditFormObject["beginOld"] = Number(begin);
@@ -883,11 +884,12 @@ function addTimerFormCreateOptions(start,end,number) {
        var html = '';
        for(i = start; i <= end; i++) {
                var txt = (String(i).length == 1) ? "0" + String(i) : String(i);
-               if (i == Number(number)) {
-                       html += '<option value="'+ i +'" selected>'+ txt + '</option>';
-               } else {
-                       html += '<option value="'+ i +'">'+ txt + '</option>';
-               }
+               var selected =  (i == Number(number)) ? "selected" : "";
+               var namespace = {
+                       'value': i,
+                       'txt': txt,
+                       'selected': selected };
+               html += RND(tplAddTimerFormOptions, namespace);
        }
        return html;
 }
@@ -895,34 +897,24 @@ function addTimerFormCreateOptionList(object,selected) {
        html = '';
        for(var element in object) {
                var txt = String(object[element]);
-               if(element == selected) {
-                       html += '<option value="'+ element +'" selected>'+ txt + '</option>';
-               } else if(element == "extend") {
-               // do nothing.
-               }else {
-                       html += '<option value="'+ element +'">'+ txt + '</option>';
+               var sel = (element == selected) ? "selected" : "";
+               var namespace = {
+                       'value': element,
+                       'txt': txt,
+                       'selected': sel };
+               if(element != "extend") {
+                       html += RND(tplAddTimerFormOptions, namespace);
                }
        }
        return html;
 }
 
-function addTimerFormChangeTime(type) {
+function addTimerFormChangeTime(which) {
        var start = new Date( $('syear').value, $('smonth').value, $('sday').value, $('shour').value, $('smin').value, 0);
        var end = new Date($('eyear').value, $('emonth').value, $('eday').value, $('ehour').value, $('emin').value, 0);
        if(start.getTime() > end.getTime()) {
-               if(type == 's') {
-                       $('eyear').value = $('syear').value;
-                       $('emonth').value = $('smonth').value;
-                       $('eday').value = $('sday').value;
-                       $('ehour').value = $('shour').value;
-                       $('emin').value = $('smin').value;
-               } else {
-                       $('syear').value = $('eyear').value;
-                       $('smonth').value = $('emonth').value;
-                       $('sday').value = $('eday').value;
-                       $('shour').value = $('ehour').value;
-                       $('smin').value = $('emin').value;
-               }
+               opponent = (which.substr(0,1) == 's') ? 'e' +  which.substr(1, which.length -1) : 's' +  which.substr(1, which.length -1) ;
+               $(opponent).value = $(which).value;
        }
 }
 function addTimerFormChangeType() {