integrated AutoTime partly. it's not visible for now.
authorJulian Dittrich <jjbig@users.schwerkraft.elitedvb.net>
Fri, 4 Jul 2008 18:45:19 +0000 (18:45 +0000)
committerJulian Dittrich <jjbig@users.schwerkraft.elitedvb.net>
Fri, 4 Jul 2008 18:45:19 +0000 (18:45 +0000)
webinterface/src/WebComponents/Sources/AT.py [new file with mode: 0644]
webinterface/src/web-data/config.js
webinterface/src/web-data/objects.js
webinterface/src/web-data/templates.js
webinterface/src/web-data/timer.js
webinterface/src/web/autotimerlist.xml [new file with mode: 0644]
webinterface/src/webif.py

diff --git a/webinterface/src/WebComponents/Sources/AT.py b/webinterface/src/WebComponents/Sources/AT.py
new file mode 100644 (file)
index 0000000..c825b76
--- /dev/null
@@ -0,0 +1,184 @@
+# Code for the AutoTimerPlugin
+#from enigma import eServiceReference, iServiceInformation, eServiceCenter
+from Components.Sources.Source import Source
+#from ServiceReference import ServiceReference
+#from Components.FileList import FileList
+#from os import path as os_path
+
+class AT( Source ):
+    LIST = 0
+    WRITE = 1
+    
+    def __init__(self, session,func = LIST):
+        print "AutoTimer: init: ", func
+        Source.__init__(self)
+        self.func = func
+        self.session = session
+        error = "unknown command (%s)" % func
+        self.result = [[error,error,error]]
+    
+    def handleCommand(self,cmd):
+        print "AutoTimer: handleCommand: ", cmd    
+        self.cmd = cmd
+        if self.func is self.LIST:
+            self.result = self.timerList(cmd)
+        elif self.func is self.WRITE:
+            self.result = self.writeTimer(cmd)
+        
+    def timerList(self,param):
+        print "timerList:",param
+        
+        returnList = []
+        
+        from Components.PluginComponent import plugins
+        from Plugins.Plugin import PluginDescriptor#, PluginEntryComponent
+        pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
+        autoTimerAvailable = False
+        for plugin in pluginlist:
+            if plugin.name == "AutoTimer":
+                #if PluginEntryComponent(plugin).name == "AutoTimer":
+                autoTimerAvailable = True
+        
+        if autoTimerAvailable:
+            print "AutoTimer vorhanden"
+            from Plugins.Extensions.AutoTimer.plugin import autotimer
+            
+            if autotimer is None:
+                from Plugins.Extensions.AutoTimer.AutoTimer import AutoTimer
+                autotimer = AutoTimer()
+            #timers = autotimer.getTimerList
+            #AutoTimerComponent
+            from Plugins.Extensions.AutoTimer.AutoTimerComponent import AutoTimerComponent
+            for timer in autotimer.getTimerList():
+                print "TIMER: ", timer
+                innerList = []
+                innerList.append(timer.getName())
+                innerList.append(timer.getMatch())
+                
+                if timer.hasAfterEvent():
+                    innerList.append(timer.getAfterEvent()) # 2
+                else:
+                    innerList.append("") # 2
+                                
+                #excludes
+                innerList.append(timer.getExcludedTitle())
+                innerList.append(timer.getExcludedShort())
+                innerList.append(timer.getExcludedDescription())
+                innerList.append(timer.getExcludedDays())
+                
+                #inclides
+                innerList.append(timer.getIncludedTitle())
+                innerList.append(timer.getIncludedShort())
+                innerList.append(timer.getIncludedDescription())
+                innerList.append(timer.getIncludedDays())
+                
+                # filterSET
+                self.excludes = (
+                                 timer.getExcludedTitle(),
+                                 timer.getExcludedShort(),
+                                 timer.getExcludedDescription(),
+                                 timer.getExcludedDays()
+                )
+                self.includes = (
+                                 timer.getIncludedTitle(),
+                                 timer.getIncludedShort(),
+                                 timer.getIncludedDescription(),
+                                 timer.getIncludedDays()
+                )
+                innerList.append(timer.getServices()) # 11
+                innerList.append(timer.getBouquets()) # 12
+                if timer.hasTimespan():
+                    innerList.append(timer.getTimespanBegin()) # 13
+                    innerList.append(timer.getTimespanEnd()) # 14
+                else:
+                    innerList.append("") # 13
+                    innerList.append("") # 14
+                
+                if timer.hasDuration():
+                    innerList.append(timer.getDuration()) # 15
+                else:
+                    innerList.append("") # 15
+                
+                if timer.hasCounter():
+                    innerList.append(timer.getCounter()) # 16
+                    innerList.append(timer.getCounterLeft()) # 17
+                else:
+                    innerList.append(0) # 16
+                    innerList.append(0) # 17
+                
+                innerList.append(timer.getCounterLimit()) # 18
+                
+                if timer.hasDestination():
+                    innerList.append(timer.getDestination()) # 19
+                else:
+                    innerList.append("/hdd/movie/") # 19
+                    
+                if timer.hasCounterFormatString():
+                    innerList.append(timer.getCounterFormatString()) # 20
+                else:
+                    innerList.append("") # 20
+                
+                innerList.append(timer.getLastBegin()) # 21
+                innerList.append(timer.getJustplay()) # 22
+                innerList.append(timer.getAvoidDuplicateDescription()) # 23
+                
+                if timer.hasTags():
+                    innerList.append(timer.getTags()) # 24
+                else:
+                    innerList.append("") # 24
+                
+                print "Enabled", timer.getEnabled()
+                innerList.append(timer.getEnabled())  # 25
+                innerList.append("off")  # 26
+
+                returnList.append(innerList)
+        
+        return returnList
+
+        
+    def writeTimer(self,param):
+        print "writeTimer: ",param
+        # TODO: fix error handling
+
+        return
+        
+    def command(self,param):
+        print "command: ",param
+        return
+
+        param = int(param)
+        
+        # TODO: fix error handling
+    
+    def getList(self):
+        return self.result
+    
+    list = property(getList)
+    lut = {"Name": 0
+           ,"Match": 1
+           ,"AfterEvent": 2
+           ,"ExcludedTitle": 3
+           ,"ExcludedShort": 4
+           ,"ExcludedDescription": 5
+           ,"ExcludedDays": 6
+           ,"IncludedTitle": 7
+           ,"IncludedShort": 8
+           ,"IncludedDescription": 9
+           ,"IncludedDays": 10
+           ,"Services": 11
+           ,"Bouquets": 12
+           ,"TimespanBegin": 13
+           ,"TimespanEnd": 14
+           ,"Duration": 15
+           ,"Counter": 16
+           ,"CounterLeft": 17
+           ,"CounterLimit": 18
+           ,"Destination": 19
+           ,"CounterFormatString": 20
+           ,"LastBegin": 21
+           ,"Justplay": 22
+           ,"AvoidDuplicateDescription": 23
+           ,"Tags": 24
+           ,"Enabled": 25
+           ,"toggleDisabledIMG": 26
+           }
index b11b1bb..0cf6710 100644 (file)
@@ -59,4 +59,9 @@ var bouqet_provider_radio ='1:7:2:0:0:0:0:0:0:0:(type == 2) FROM PROVIDERS ORDER
 
 var windowStyle = 'alphacube';
 
-var url_delfile = "/web/delfile?file="; // plus file
\ No newline at end of file
+var url_delfile = "/web/delfile?file="; // plus file
+
+var url_autotimerlist = "/web/autotimerlist?gl";
+var url_autotimerdelete = "/web/autotimerdelete"; 
+var url_autotimertoggledisable = "/web/autotimertoggledisable"; 
\ No newline at end of file
index 3d33b22..9aa849b 100644 (file)
@@ -213,7 +213,7 @@ function MovieList(xml){
 //END class MovieList
 
 //START class Movie
-function Movie(xml){   
+function Movie(xml){
        // parsing values from xml-element
        //debug('init Movie');
        try{
@@ -769,3 +769,247 @@ function Note(xml){
        }
 }
 //END class NoteList
+
+//START class AutoTimerList
+function AutoTimerList(xml){
+       // parsing values from xml-element
+       debug('init AutoTimerList'+xml);
+       try{
+               this.xmlitems = xml.getElementsByTagName("e2autotmerlist").item(0).getElementsByTagName("e2autotimer");
+       } catch (e) {
+               debug("AutoTimerList parsing Error");
+       }
+       this.getArray = function(){
+               var listxy = new Array();
+               for(var i=0;i<this.xmlitems.length;i++){
+                       //debug("parsing movie "+i+" of "+this.xmlitems.length);
+                       var xv = new AutoTimer(this.xmlitems.item(i));
+                       listxy.push(xv);                        
+               }
+               return listxy;
+       }
+}
+//END class AutoTimerList
+//START class AutoTimer
+function AutoTimer(xml){
+       // parsing values from xml-element
+       //debug('init Movie');
+       try{
+               this.name = xml.getElementsByTagName('e2name').item(0).firstChild.data;
+       } catch (e) {
+               this.name = "N/A";
+       }
+       try{
+               this.match = xml.getElementsByTagName('e2match').item(0).firstChild.data;
+       } catch (e) {
+               this.match = "N/A";
+       }
+       try{
+               this.enabled = xml.getElementsByTagName('e2enabled').item(0).firstChild.data;
+       } catch (e) {
+               this.enabled = "N/A";
+       }
+       try{
+               this.excludetitle = xml.getElementsByTagName('e2excludetitle').item(0).firstChild.data;
+       } catch (e) {
+               this.excludetitle = "N/A";
+       }
+       try{
+               this.excludeshort = xml.getElementsByTagName('e2excludeshort').item(0).firstChild.data;
+       } catch (e) {
+               this.excludeshort = "N/A";
+       }
+       try{
+               this.excludedescription = xml.getElementsByTagName('e2excludedescription').item(0).firstChild.data;
+       } catch (e) {
+               this.excludedescription = "N/A";
+       }
+       try{
+               this.excludedays = xml.getElementsByTagName('e2excludedays').item(0).firstChild.data;
+       } catch (e) {
+               this.excludedays = "n/a";
+       }
+       try{
+               this.includetitle = xml.getElementsByTagName('e2includetitle').item(0).firstChild.data;
+       } catch (e) {
+               this.includetitle = "N/A";
+       }
+       try{
+               this.includeshort = xml.getElementsByTagName('e2includeshort').item(0).firstChild.data;
+       } catch (e) {
+               this.includeshort = "N/A";
+       }
+       try{
+               this.includedescription = xml.getElementsByTagName('e2includedescription').item(0).firstChild.data;
+       } catch (e) {
+               this.includedescription = "N/A";
+       }
+       try{
+               this.includedays = xml.getElementsByTagName('e2includedays').item(0).firstChild.data;
+       } catch (e) {
+               this.includedays = "N/A";
+       }
+       try{
+               this.services = xml.getElementsByTagName('e2services').item(0).firstChild.data;
+       } catch (e) {
+               this.services = "N/A";
+       }
+       try{
+               this.bouquets = xml.getElementsByTagName('e2bouquets').item(0).firstChild.data;
+       } catch (e) {
+               this.bouquets = "N/A";
+       }
+       try{
+               this.timespanbegin = xml.getElementsByTagName('e2timespanbegin').item(0).firstChild.data;
+       } catch (e) {
+               this.timespanbegin = "0";
+       }
+       try{
+               this.timespanend = xml.getElementsByTagName('e2timespanend').item(0).firstChild.data;
+       } catch (e) {
+               this.timespanend = "0";
+       }
+       try{
+               this.duration = xml.getElementsByTagName('e2duration').item(0).firstChild.data;
+       } catch (e) {
+               this.duration = "0";
+       }
+       try{
+               this.counter = xml.getElementsByTagName('e2counter').item(0).firstChild.data;
+       } catch (e) {
+               this.counter = "0";
+       }
+       try{
+               this.counterleft = xml.getElementsByTagName('e2counterleft').item(0).firstChild.data;
+       } catch (e) {
+               this.counterleft = "0";
+       }
+       try{
+               this.counterlimit = xml.getElementsByTagName('e2counterlimit').item(0).firstChild.data;
+       } catch (e) {
+               this.counterlimit = "0";
+       }
+       try{
+               this.counterformatstring = xml.getElementsByTagName('e2counterformatstring').item(0).firstChild.data;
+       } catch (e) {
+               this.counterformatstring = "0";
+       }
+       try{
+               this.destination = xml.getElementsByTagName('e2destination').item(0).firstChild.data;
+       } catch (e) {
+               this.destination = "N/A";
+       }
+       try{
+               this.lastbegin = xml.getElementsByTagName('e2lastbegin').item(0).firstChild.data;
+       } catch (e) {
+               this.lastbegin = "0";
+       }
+       try{
+               this.justplay = xml.getElementsByTagName('e2justplay').item(0).firstChild.data;
+       } catch (e) {
+               this.justplay = "N/A";
+       }
+       try{
+               this.avoidduplicatedescription = xml.getElementsByTagName('e2avoidduplicatedescription').item(0).firstChild.data;
+       } catch (e) {
+               this.avoidduplicatedescription = "N/A";
+       }
+       try{
+               this.afterevent = xml.getElementsByTagName('e2afterevent').item(0).firstChild.data;
+       } catch (e) {
+               this.afterevent = "N/A";
+       }
+       try{
+               this.toggledisabledimg = xml.getElementsByTagName('e2toggledisableimg').item(0).firstChild.data;
+       } catch (e) {
+               this.toggledisabledimg = "N/A";
+       }
+       try{
+               this.tags = xml.getElementsByTagName('e2tags').item(0).firstChild.data;
+       } catch (e) {
+               this.tags = "no&nbsp;tags"; // no whitespaces... tags will be splittet later
+       }
+       
+       this.getName = function(){
+        return this.name;
+    }
+    this.getMatch = function(){
+        return this.match;
+    }
+    this.getEnabled = function(){
+        return this.enabled;
+    }
+    this.getExcludetitle = function(){
+        return this.excludetitle;
+    }
+    this.getExcludeshort = function(){
+        return this.excludeshort;
+    }
+    this.getExcludedescription = function(){
+        return this.excludedescription;
+    }
+    this.getExcludedays = function(){
+        return this.excludedays;
+    }
+    this.getIncludetitle = function(){
+        return this.includetitle;
+    }
+    this.getIncludeshort = function(){
+        return this.includeshort;
+    }
+    this.getIncludedescription = function(){
+        return this.includedescription;
+    }
+    this.getIncludedays = function(){
+        return this.includedays;
+    }
+    this.getServices = function(){
+        return this.services;
+    }
+    this.getBouquets = function(){
+        return this.bouquets;
+    }
+    this.getTimespanbegin = function(){
+        return this.timespanbegin;
+    }
+    this.getTimespanend = function(){
+        return this.timespanend;
+    }
+    this.getDuration = function(){
+        return this.duration;
+    }
+    this.getCounter = function(){
+        return this.counter;
+    }
+    this.getCounterleft = function(){
+        return this.counterleft;
+    }
+    this.getCounterlimit = function(){
+        return this.counterlimit;
+    }
+    this.getCounterformatstring = function(){
+        return this.counterformatstring;
+    }
+    this.getDestination = function(){
+        return this.destination;
+    }
+    this.getLastbegin = function(){
+        return this.lastbegin;
+    }
+    this.getJustplay = function(){
+        return this.justplay;
+    }
+    this.getAvoidduplicatedescription = function(){
+        return this.avoidduplicatedescription;
+    }
+    this.getTags = function(){
+        return this.tags;
+    }
+    this.getAfterevent = function(){
+        return this.afterevent;
+    }
+    this.getToggleDisabledIMG = function(){
+               return this.toggledisabledimg;
+       }
+}      
+//END class AutoTimer
\ No newline at end of file
index fdb51be..9443451 100644 (file)
@@ -131,7 +131,7 @@ var tplTimerListHeader  = '<div class="BodyContentChannellist">\n';
        tplTimerListHeader += '<table border="0" cellpadding="0" cellspacing="0" class="BodyContentChannellist">\n';
        tplTimerListHeader += '<thead class="fixedHeader">\n';
        tplTimerListHeader += '<tr>\n';
-       tplTimerListHeader += '<th colspan="7"><div class="sListHeader">TimerList</div>\n';
+       tplTimerListHeader += '<th colspan="7"><div class="sListHeader">%(page_title)</div>\n';
        tplTimerListHeader += '<div class="sListSearch">';
        tplTimerListHeader += '<form onSubmit="loadEPGBySearchString(document.getElementById(\'searchText\').value); return false;">';
        tplTimerListHeader += '<input type="text" id="searchText" onfocus="this.value=\'\'" value="Search EPG"/>';
@@ -141,15 +141,13 @@ var tplTimerListHeader  = '<div class="BodyContentChannellist">\n';
        tplTimerListHeader += '</thead>\n';
        tplTimerListHeader += '<tbody class="scrollContent" height="100%">\n';
        tplTimerListHeader += '<tr>';
-       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListSName"><b>Channel</b><br/>Name</div></td>';
-/*     tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListTitle"><b>Name</b></div></td>';*/
-/*     tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListDescr"><b>Description</b></div></td>';*/
-       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListRepeat"><b>Repeated</b></div></td>';
-       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListDuration"><b>Time running</b></div></td>';
-       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListBegin"><b>Start time</b></div></td>';
-       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListEnd"><b>End time</b></div></td>';
-       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListAfter"><b>Event</b><br/>After event</div></td>';
-       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListOption"><b>Options</b></div></td></tr>\n';
+       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListSName"><b>%(name1)</b><br/>%(name2)</div></td>';
+       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListRepeat"><b>%(repeated)</b></div></td>';
+       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListDuration"><b>%(duration)</b></div></td>';
+       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListBegin"><b>%(start)</b></div></td>';
+       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListEnd"><b>%(end)</b></div></td>';
+       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListAfter"><b>%(event)</b><br/>%(after_event)</div></td>';
+       tplTimerListHeader += '<td><div style="color: #00BCBC;" class="tListOption"><b>%(options)</b></div></td></tr>\n';
 
 var tplTimerListItem  = '<tr width="99%">\n';
        tplTimerListItem += '<td><div style="color: #%(color);" class="tListSName" title="%(description), %(descriptionextended)"><b>%(servicename)</b> <br/><br/> %(title)</div></td>\n';
@@ -158,9 +156,13 @@ var tplTimerListItem  = '<tr width="99%">\n';
        tplTimerListItem += '<td><div style="color: #%(color);" class="tListBegin">%(beginDate)</div></td>\n';
        tplTimerListItem += '<td><div style="color: #%(color);" class="tListEnd">%(endDate)</div></td>\n';
        tplTimerListItem += '<td><div style="color: #%(color);" class="tListAfter"><b>%(justplayReadable)</b> <br/><br/> %(aftereventReadable)</div></td>\n';
-       tplTimerListItem += '<td><div style="color: #%(color);" class="tListOption"><a target="_blank" ><img src="/webdata/gfx/trash.gif" title="delete timer entry" border="0" onclick="delTimer(\'%(servicereference)\',\'%(begin)\',\'%(end)\',\'%(servicename)\',\'%(title)\',\'%(description)\',incomingTimerDelResult);"></a>\n';
+/*     tplTimerListItem += '<td><div style="color: #%(color);" class="tListOption"><a target="_blank" ><img src="/webdata/gfx/trash.gif" title="delete timer entry" border="0" onclick="delTimer(\'%(servicereference)\',\'%(begin)\',\'%(end)\',\'%(servicename)\',\'%(title)\',\'%(description)\',incomingTimerDelResult);"></a>\n';
        tplTimerListItem += '<a target="_blank" ><img src="/webdata/gfx/%(onOff).png" title="toggle On/Off" border="0" onclick="sendToggleTimerDisable(\'%(justplay)\',\'%(begin)\',\'%(end)\',\'%(repeated)\',\'%(servicereference)\',\'%(title)\',\'%(description)\',\'%(afterevent)\',\'%(disabled)\' );"></a>\n';
-       tplTimerListItem += '<a target="_blank" ><img src="/webdata/gfx/edit.gif" title="edit timer entry" border="0" onclick="loadTimerFormSeconds(\'%(justplay)\',\'%(begin)\',\'%(end)\',\'%(repeated)\',\'%(servicereference)\',\'%(servicename)\',\'%(title)\',\'%(description)\',\'%(afterevent)\',1);"></a></div></td>\n';
+       tplTimerListItem += '<a target="_blank" ><img src="/webdata/gfx/edit.gif" title="edit timer entry" border="0" onclick="loadTimerFormSeconds(\'%(justplay)\',\'%(begin)\',\'%(end)\',\'%(repeated)\',\'%(servicereference)\',\'%(servicename)\',\'%(title)\',\'%(description)\',\'%(afterevent)\',1);"></a></div></td>\n';*/
+       tplTimerListItem += '<td><div style="color: #%(color);" class="tListOption"><a target="_blank" ><img src="/webdata/gfx/trash.gif" title="delete timer entry" border="0" onclick="%(delTimer_FUNCTION);"></a>\n';
+       tplTimerListItem += '<a target="_blank" ><img src="/webdata/gfx/%(onOff).png" title="toggle On/Off" border="0" onclick="%(sendToggleTimerDisable_FUNCTION);"></a>\n';
+       tplTimerListItem += '<a target="_blank" ><img src="/webdata/gfx/edit.gif" title="edit timer entry" border="0" onclick="%(loadTimerFormSeconds_FUNCTION);"></a></div></td>\n';
+       
        tplTimerListItem += '</tr>\n';
 
 var tplTimerListFooter  = '<tr><td colspan="7"><button onclick="writeTimerListNow()">Write To Memory</button></td></tr>\n';
@@ -619,3 +621,28 @@ var tplFileBrowserFooter  = '</tbody></table>\n';
        tplFileBrowserFooter += '<input type="hidden" id="path" value="%(root)" name="path">';
        tplFileBrowserFooter += '<input name="file" type="file">';
        tplFileBrowserFooter += '<input type="image" style="vertical-align:middle" src="/webdata/gfx/save.png" alt="upload">';
+
+var tplAddAutoTimerForm  = '<table border=0 cellpadding=0 cellspacing=10>';
+       tplAddAutoTimerForm += '<tr><td colspan="3">Action:</td>';
+       tplAddAutoTimerForm += '<td colspan="3">';
+       tplAddAutoTimerForm += '<select name="justplay" id="justplay" size="1">';
+       tplAddAutoTimerForm += '%(justplay)';
+       tplAddAutoTimerForm += '</select></td></tr>';
+       tplAddAutoTimerForm += '<tr><td colspan="3">Start:</td>';
+       tplAddAutoTimerForm += '<td colspan="3"><select name="shour" id="shour" size="1" onchange="javascript:addTimerFormChangeTime(\'shour\');">%(shour)</select>';
+       tplAddAutoTimerForm += ':<select name="smin" id="smin" size="1" onchange="javascript:addTimerFormChangeTime(\'smin\');">%(smin)</select></td></tr>';
+       tplAddAutoTimerForm += '<tr><td colspan="3">End:</td>';
+       tplAddAutoTimerForm += '<td colspan="3"><select name="ehour" id="ehour" size="1" onchange="javascript:addTimerFormChangeTime(\'ehour\');">%(ehour)</select>';
+       tplAddAutoTimerForm += ':<select name="emin" id="emin" size="1" onchange="javascript:addTimerFormChangeTime(\'emin\');">%(emin)</select></td></tr>';
+       tplAddAutoTimerForm += '<tr><td colspan="3">Repeat times:</td><td colspan="3"><select name="repeated" id="repeated" size="1">%(repeated)</select>';
+       tplAddAutoTimerForm += '<tr><td colspan="3">Name:</td>';
+       tplAddAutoTimerForm += '<td colspan="3"><input name="name" id="name" type="text" size="100" maxlength="100" style="color: #000000;" value="%(name)"></td></tr>';
+       tplAddAutoTimerForm += '<tr><td colspan="3">Description:</td>';
+       tplAddAutoTimerForm += '<td colspan="3"><input name="descr" id="descr" type="text" size="100" maxlength="100" style="color: #000000;" value="%(description)"></td></tr>';
+       tplAddAutoTimerForm += '<tr><td colspan="3">After event do:</td>';
+       tplAddAutoTimerForm += '<td colspan="3"><select id="after_event" name="after_event" size="1">%(afterEvent)</select></td></tr>';
+       tplAddAutoTimerForm += '<tr>&nbsp;&nbsp;</tr>';
+       tplAddAutoTimerForm += '<tr><td colspan="3">&nbsp;</td><td colspan="3">';
+       tplAddAutoTimerForm += '<input name="deleteOldOnSave" id="deleteOldOnSave" type="hidden" value="%(deleteOldOnSave)">';
+       tplAddAutoTimerForm += '<input name="timers_element" id="timers_element" type="hidden" value="%(timers_element)">';
+       tplAddAutoTimerForm +=  '<button onclick="sendAddAutoTimer();">Add/Save</button></td></tr></table>';
index 4c8c71c..96e2daf 100644 (file)
@@ -42,7 +42,19 @@ function incomingTimerList(request){
        if(request.readyState == 4){
                var timers = new TimerList(getXML(request)).getArray();
                debug("have "+timers.length+" timer");
-               listerHtml      = tplTimerListHeader;
+               var ns_tplTimerListHeader = {
+                       'page_title': 'Timerlist',
+                       'name1': 'Channel',
+                       'name2': 'Name',
+                       'repeated': 'Repeated',
+                       'duration': 'Time running',
+                       'start': 'Start time',
+                       'end': 'End time',
+                       'event': 'Event',
+                       'after_event': 'After event',
+                       'options': 'Options'                    
+               };
+               listerHtml = RND(tplTimerListHeader, ns_tplTimerListHeader);
                var aftereventReadable = new Array ('Nothing', 'Standby', 'Deepstandby/Shutdown');
                var justplayReadable = new Array('record', 'zap');
                for ( var i = 0; i <timers.length; i++){
@@ -69,7 +81,20 @@ function incomingTimerList(request){
                                'aftereventReadable': aftereventReadable[Number(timer.getAfterevent())],
                                'disabled': timer.getDisabled(),
                                'onOff': timer.getToggleDisabledIMG(),
-                               'color': timer.getColor()
+                               'color': timer.getColor(),
+                               'delTimer_FUNCTION': "delTimer(\'"+timer.getServiceReference()+"\',\'"+timer.getTimeBegin()
+                                       +"\',\'"+timer.getTimeEnd()+"\',\'"+quotes2html(timer.getServiceName())
+                                       +"\',\'"+quotes2html(timer.getName())+"\',\'"+quotes2html(timer.getDescription())
+                                       +"\',incomingTimerDelResult)",
+                               'sendToggleTimerDisable_FUNCTION': "sendToggleTimerDisable(\'"+timer.getJustplay()+"\',\'"
+                                       +timer.getTimeBegin()+"\',\'"+timer.getTimeEnd()+"\',\'"+timer.getRepeated()
+                                       +"\',\'"+timer.getServiceReference()+"\',\'"+quotes2html(timer.getName())
+                                       +"\',\'"+quotes2html(timer.getDescription())+"\',\'"+timer.getAfterevent()
+                                       +"\',\'"+timer.getDisabled()+"\')",
+                               'loadTimerFormSeconds_FUNCTION': "loadTimerFormSeconds(\'"+timer.getJustplay()+"\',\'"
+                                       +timer.getTimeBegin()+"\',\'"+timer.getTimeEnd()+"\',\'"+timer.getRepeated()
+                                       +"\',\'"+timer.getServiceReference()+"\',\'"+quotes2html(timer.getName())
+                                       +"\',\'"+quotes2html(timer.getDescription())+"\',\'"+timer.getAfterevent()+"\',1)"
                        };
                        listerHtml += RND(tplTimerListItem, namespace);
                }
@@ -335,12 +360,12 @@ function loadTimerForm(){
        }
        var namespace = {       
                                'justplay': addTimerFormCreateOptionList(Action, addTimerEditFormObject["justplay"]),
-                               'syear': addTimerFormCreateOptions(2007,2010,addTimerEditFormObject["syear"]),
+                               'syear': addTimerFormCreateOptions(2008,2010,addTimerEditFormObject["syear"]),
                                'smonth': addTimerFormCreateOptions(1,12,addTimerEditFormObject["smonth"]),
                                'sday': addTimerFormCreateOptions(1,31,addTimerEditFormObject["sday"]),
                                'shour': addTimerFormCreateOptions(0,23,addTimerEditFormObject["shour"]),
                                'smin': addTimerFormCreateOptions(0,59,addTimerEditFormObject["smin"]),
-                               'eyear': addTimerFormCreateOptions(2007,2010,addTimerEditFormObject["eyear"]),
+                               'eyear': addTimerFormCreateOptions(2008,2010,addTimerEditFormObject["eyear"]),
                                'emonth': addTimerFormCreateOptions(1,12,addTimerEditFormObject["emonth"]),
                                'eday': addTimerFormCreateOptions(1,31,addTimerEditFormObject["eday"]),
                                'ehour': addTimerFormCreateOptions(0,23,addTimerEditFormObject["ehour"]),
@@ -646,4 +671,149 @@ function sendToggleTimerDisable(justplay,begin,end,repeated,channel,name,descrip
         +"&channelOld="+channel
         +"&beginOld="+begin+"&endOld="+end
         +"&deleteOldOnSave=1", incomingTimerAddResult, false);
+}
+
+
+// AUTOTIMER
+function loadAutoTimerList(){
+       debug("loading AutoTimer");
+       doRequest(url_autotimerlist, incomingAutoTimerList, false);
+}
+
+var autotimers = null;
+function incomingAutoTimerList(request){
+       if(request.readyState == 4){
+               autotimers = new AutoTimerList(getXML(request)).getArray();
+               debug("have "+autotimers.length+" timer");
+               var ns_tplTimerListHeader = {
+                       'page_title': 'Auto timerlist',
+                       'name1': 'Name',
+                       'name2': 'Match',
+                       'repeated': 'Repeated',
+                       'duration': 'Time running',
+                       'start': 'Start time',
+                       'end': 'End time',
+                       'event': 'Event',
+                       'after_event': 'After event',
+                       'options': 'Options'                    
+               };
+               listerHtml = RND(tplTimerListHeader, ns_tplTimerListHeader);
+               var aftereventReadable = new Array ('Nothing', 'Standby', 'Deepstandby/Shutdown');
+               var justplayReadable = new Array('record', 'zap');
+               for ( var i = 0; i <autotimers.length; i++){
+                       var timer = autotimers[i];
+//                     var beginDate = new Date(Number(timer.getTimeBegin())*1000);
+//                     var endDate = new Date(Number(timer.getTimeEnd())*1000);
+                       var namespace = {       
+                                'servicereference': timer.getServices()
+                               ,'servicename': quotes2html(timer.getName())
+                               ,'title': quotes2html(timer.getMatch())
+                               ,'description': quotes2html(timer.getMatch())
+                               ,'justplay': timer.getJustplay()
+                               ,'justplayReadable': timer.getJustplay()
+                               ,'repeated': timer.getCounter()
+                               ,'repeatedReadable': timer.getCounter()
+                               ,'afterevent': timer.getAfterevent()
+                               ,'onOff': timer.getToggleDisabledIMG()
+                               ,'begin': timer.getTimespanbegin()
+                               ,'beginDate': timer.getTimespanbegin()
+                               ,'end': timer.getTimespanend()
+                               ,'endDate': timer.getTimespanend()
+                               ,'sendToggleTimerDisable_FUNCTION': "sendToggleAutoTimerDisable("+i+")"
+                               ,'delTimer_FUNCTION': "delAutoTimer("+i+")"
+                               ,'loadTimerFormSeconds_FUNCTION': "loadAutoTimer("+i+")"
+                               ,'color': '000000'
+/*                             'descriptionextended': quotes2html(timer.getDescriptionExtended()),
+                               'state': timer.getState(),
+                               'duration': Math.ceil((timer.getDuration()/60)),
+                               
+                               'aftereventReadable': aftereventReadable[Number(timer.getAfterevent())],
+                               'disabled': timer.getDisabled(),
+                               'onOff': timer.getToggleDisabledIMG(),
+                               'color': timer.getColor()*/
+                       };
+                       listerHtml += RND(tplTimerListItem, namespace);
+               }
+               listerHtml += tplTimerListFooter;
+               $('BodyContent').innerHTML = listerHtml;
+               setBodyMainContent('BodyContent');
+       }
+}
+
+function sendToggleAutoTimerDisable(element) {
+       timers = autotimers[Number(element)];
+       debug("sendToggleAutoTimerDisable["+element+"]: "+timers.getName());
+       
+       doRequest(url_autotimertoggledisable+"?name="+timer.getName()+"&match="+timer.getMatch()
+               , loadAutoTimerList, false);
+}
+
+function delAutoTimer(element) {
+       timers = autotimers[Number(element)];
+       debug("delAutoTimer["+element+"]: "+timers.getName());
+       Dialog.confirm(
+               "Selected timer:<br>"
+               +"Name: "+quotes2html(timer.getName())+"<br>"
+               +"Match: "+quotes2html(timer.getMatch())+"<br>"
+               +"Are you sure that you want to delete the AutoTimer?",
+                {windowParameters: {width:300, className: windowStyle},
+                       okLabel: "delete",
+                       buttonClass: "myButtonClass",
+                       cancel: function(win) {debug("delAutoTimer cancel confirm panel")},
+                       ok: function(win) { 
+                                                           debug("delAutoTimer ok confirm panel"); 
+                                                           doRequest(url_autotimerdelete+"?name="+timer.getName()+"&match="+timer.getMatch(), loadAutoTimerList, false);
+                                                           return true;
+                                                         }
+                       }
+       );
+}
+
+function loadAutoTimer(element) {
+       timer = autotimers[Number(element)];
+       debug("loadAutoTimer["+element+"]: "+timer.getName());
+       
+       var Action = new Object();
+       Action["0"] = "Record";
+       Action["1"] = "Zap";
+       
+       var Repeated = new Object();
+       Repeated["1"] =  "mo";
+       Repeated["2"] = "tu";
+       Repeated["4"] =  "we";
+       Repeated["8"] =  "th";
+       Repeated["16"] = "fr";
+       Repeated["32"] = "sa";
+       Repeated["64"] = "su";
+       Repeated["31"] = "mf";
+       Repeated["127"] ="ms";
+       
+       var AfterEvent = new Object();
+       AfterEvent["0"] = "Nothing";
+       AfterEvent["1"] = "Standby";
+       AfterEvent["2"] = "Deepstandby/Shutdown";
+       
+       var beginDate = timer.getTimespanbegin().split(":");
+       var endDate =   timer.getTimespanend().split(":");
+       
+       
+       var namespace = {       
+                                'justplay': addTimerFormCreateOptionList(Action, timer.getJustplay)
+                               ,'shour': addTimerFormCreateOptions(0,23,beginDate[0])
+                               ,'smin': addTimerFormCreateOptions(0,59,beginDate[1])
+                               ,'ehour': addTimerFormCreateOptions(0,23,endDate[0])
+                               ,'emin': addTimerFormCreateOptions(0,59,endDate[1])
+                               ,'name': timer.getName()
+                               ,'description': timer.getMatch()
+                               ,'repeated': addTimerFormCreateOptions(0,99,timer.getCounter())
+                               ,'deleteOldOnSave': addTimerEditFormObject["deleteOldOnSave"]
+                               ,'afterEvent': addTimerFormCreateOptionList(AfterEvent, timer.getAfterevent())
+                               ,'timers_element': element
+               };
+       var listerHtml = RND(tplAddAutoTimerForm, namespace);
+       $('BodyContent').innerHTML = listerHtml;
+}
+
+function sendAddAutoTimer() {
+       debug("sendAddAutoTimer");
 }
\ No newline at end of file
diff --git a/webinterface/src/web/autotimerlist.xml b/webinterface/src/web/autotimerlist.xml
new file mode 100644 (file)
index 0000000..d028bfe
--- /dev/null
@@ -0,0 +1,35 @@
+<e2:screen name="AutoTimerWebScreen">&lt;?xml version="1.0" encoding="UTF-8"?>
+&lt;e2autotmerlist><e2:element source="AutoTimerList" id="gl"><e2:convert type="web:ListFiller" >
+       &lt;e2autotimer>
+               &lt;e2name><e2:item name="Name"  filter="xml"/>&lt;/e2name>
+               &lt;e2match><e2:item name="Match"  filter="xml"/>&lt;/e2match>
+           &lt;e2enabled><e2:item name="Enabled"  filter="xml"/>&lt;/e2enabled>
+           &lt;e2excludetitle><e2:item name="ExcludedTitle"  filter="xml"/>&lt;/e2excludetitle>
+           &lt;e2excludeshort><e2:item name="ExcludedShort"  filter="xml"/>&lt;/e2excludeshort>
+           &lt;e2excludedescription><e2:item name="ExcludedDescription"  filter="xml"/>&lt;/e2excludedescription>
+           &lt;e2excludedays><e2:item name="ExcludedDays"  filter="xml"/>&lt;/e2excludedays>
+           &lt;e2includetitle><e2:item name="IncludedTitle"  filter="xml"/>&lt;/e2includetitle>
+           &lt;e2includeshort><e2:item name="IncludedShort"  filter="xml"/>&lt;/e2includeshort>
+           &lt;e2includedescription><e2:item name="IncludedDescription"  filter="xml"/>&lt;/e2includedescription>
+           &lt;e2includedays><e2:item name="IncludedDays"  filter="xml"/>&lt;/e2includedays>
+           &lt;e2services><e2:item name="Services"  filter="xml"/>&lt;/e2services>
+           &lt;e2bouquets><e2:item name="Bouquets"  filter="xml"/>&lt;/e2bouquets>
+           &lt;e2timespanbegin><e2:item name="TimespanBegin"  filter="xml"/>&lt;/e2timespanbegin>
+           &lt;e2timespanend><e2:item name="TimespanEnd"  filter="xml"/>&lt;/e2timespanend>
+           &lt;e2duration><e2:item name="Duration"  filter="xml"/>&lt;/e2duration>
+           &lt;e2counter><e2:item name="Counter"  filter="xml"/>&lt;/e2counter>
+           &lt;e2counterleft><e2:item name="CounterLeft"  filter="xml"/>&lt;/e2counterleft>
+           &lt;e2counterlimit><e2:item name="CounterLimit"  filter="xml"/>&lt;/e2counterlimit>
+           &lt;e2destination><e2:item name="Destination"  filter="xml"/>&lt;/e2destination>
+           &lt;e2counterformatstring><e2:item name="CounterFormatString"  filter="xml"/>&lt;/e2counterformatstring>
+           &lt;e2lastbegin><e2:item name="LastBegin"  filter="xml"/>&lt;/e2lastbegin>
+           &lt;e2justplay><e2:item name="Justplay"  filter="xml"/>&lt;/e2justplay>
+           &lt;e2avoidduplicatedescription><e2:item name="AvoidDuplicateDescription"  filter="xml"/>&lt;/e2avoidduplicatedescription>
+           &lt;e2tags><e2:item name="Tags"  filter="xml"/>&lt;/e2tags>
+           &lt;e2afterevent><e2:item name="AfterEvent"  filter="xml"/>&lt;/e2afterevent>
+           &lt;e2toggledisableimg><e2:item name="toggleDisabledIMG"  filter="xml"/>&lt;/e2toggledisableimg>
+       &lt;/e2autotimer>
+       </e2:convert>
+       <e2:convert type="web:TextToHTML" /></e2:element>
+&lt;/e2autotmerlist>
+</e2:screen>
\ No newline at end of file
index 97712e7..8f3b69f 100644 (file)
@@ -37,6 +37,7 @@ from WebComponents.Sources.WAPfunctions import WAPfunctions
 from WebComponents.Sources.MP import MP
 from WebComponents.Sources.Files import Files
 from WebComponents.Sources.ServiceListReload import ServiceListReload
+from WebComponents.Sources.AT import AT
 
 from Components.Sources.FrontendStatus import FrontendStatus
 
@@ -158,6 +159,12 @@ class MediaPlayerWebScreen(WebScreen):
                self["Command"] = MP(session,func = MP.COMMAND)
                self["WritePlaylist"] = MP(session,func = MP.WRITEPLAYLIST)
                
+class AutoTimerWebScreen(WebScreen):
+       def __init__(self, session,request):
+               WebScreen.__init__(self, session,request)
+               self["AutoTimerList"] = AT(session,func = AT.LIST)
+               self["AutoTimerWrite"] = AT(session,func = AT.WRITE)
+
 class FilesWebScreen(WebScreen):
        def __init__(self, session,request):
                WebScreen.__init__(self, session,request)
@@ -423,6 +430,8 @@ class ListFiller(Converter):
                                else:
                                        append(str(item[element]))
                # (this will be done in c++ later!)
+#              print l
+#              print lut
                return ''.join(strlist)
 
        text = property(getText)