commited for debugging with 3c5x9
authorJulian Dittrich <jjbig@users.schwerkraft.elitedvb.net>
Mon, 25 Jun 2007 19:05:09 +0000 (19:05 +0000)
committerJulian Dittrich <jjbig@users.schwerkraft.elitedvb.net>
Mon, 25 Jun 2007 19:05:09 +0000 (19:05 +0000)
webinterface/src/WebComponents/Sources/WAPfunctions.py [new file with mode: 0644]
webinterface/src/web/wap/index.html.xml
webinterface/src/web/wap/timeredit.html.xml [new file with mode: 0644]
webinterface/src/web/wap/timerlist.html.xml
webinterface/src/webif.py

diff --git a/webinterface/src/WebComponents/Sources/WAPfunctions.py b/webinterface/src/WebComponents/Sources/WAPfunctions.py
new file mode 100644 (file)
index 0000000..c3cc391
--- /dev/null
@@ -0,0 +1,121 @@
+Version = '$Header$';
+
+from enigma import *
+from Components.Sources.Source import Source
+
+import time, re#, sys
+#import sys 
+
+#sys.setdefaultencoding('utf8')
+
+class WAPfunctions( Source):
+    FILLOPTIONLIST = 0
+    
+    def __init__(self, session,func = FILLOPTIONLIST):
+        self.func = func
+        Source.__init__(self)        
+        self.session = session
+        self.result = False,"unknown command"
+
+    def handleCommand(self,cmd):
+        print "WAPfunctions: handleCommand"
+        if self.func is self.FILLOPTIONLIST:
+            self.result = self.fillOptionList(cmd)
+        else:
+            self.result = False,"unknown command cmd(%s) self.func(%s)" % (cmd, self.func)
+
+    def fillOptionList(self,param):
+        # is there an easier and better way? :\ 
+        print "fillOptionList",param
+        #del param["sRef"]
+
+        input = 0
+        start = 1
+        end = 1
+        
+        timeNow = time.time()
+        timePlusTwo = timeNow + 7200
+        
+        t = {}
+        t["sday"]=time.strftime("%d", time.localtime(timeNow))
+        t["smonth"]=time.strftime("%m", time.localtime(timeNow))
+        t["syear"]=time.strftime("%Y", time.localtime(timeNow))
+        t["sminute"]=time.strftime("%M", time.localtime(timeNow))
+        t["shour"]=time.strftime("%H", time.localtime(timeNow))
+        
+        t["eday"]=time.strftime("%d", time.localtime(timePlusTwo))
+        t["emonth"]=time.strftime("%m", time.localtime(timePlusTwo))
+        t["eyear"]=time.strftime("%Y", time.localtime(timePlusTwo))
+        t["eminute"]=time.strftime("%M", time.localtime(timePlusTwo))
+        t["ehour"]=time.strftime("%H", time.localtime(timePlusTwo))
+        
+        key = ""
+        for i in param:
+            p = str(i)
+            if p != "sRef":
+                key = p
+
+        print "key: ",key
+        cutKey = re.sub("^[es]", "", key, 1)
+        print "cutKey: ",cutKey
+        
+        if cutKey == "min":
+            start = 0
+            end = 59
+        elif cutKey == "hour":
+            start = 1
+            end = 24
+        elif cutKey == "day":
+            start = 1
+            end = 31
+        elif cutKey == "month":
+            start = 1
+            end = 12
+        else:
+            start = int(t[key])
+            end = int(t[key])+2
+        
+        if(param[key] == "now"):
+            input = int(t[key])
+        else:
+            input = int(param[key]) or 0
+        
+        self.result = self.fillOptionListAny(input,start,end)
+        return self.result
+    
+    def fillOptionListAny(self,input,start,end):
+        returnList = []
+        print input,start,end
+        for i in range(start,end+1,1):
+            returnList1 = []
+            returnList1.append(i)
+            returnList1.append(i)
+            if i==input:
+                returnList1.append("selected")
+            else:
+                returnList1.append("")
+            returnList.append(returnList1)
+        return returnList
+        
+    def getText(self):
+        print self.result
+        (result,text) = self.result
+        return text
+    
+    def getList(self):
+        print self.result
+        return self.result
+    
+    text = property(getText)
+    
+    ## part for listfiller requests
+    def command(self):
+        timerlist = []
+
+        return timerlist
+    
+    list = property(getList)
+    lut = {"Name":0
+          ,"Value":1
+          ,"Selected":2
+          }
index 5a5d4b0..018b9e7 100755 (executable)
@@ -14,7 +14,7 @@
 <br/>
 <div style="text-align: center;">
 <a href="/web/wap/wapremote.html?command=0">Remote Control</a><br/>
-<!--<a href="/web/wap/timerlist.html">Timerlist</a><br/>-->
+<!--<a href="/web/wap/timeredit.html?ehour=1&shour=2&emin=4&smin=5&sday=1&eday=1&smonth=1&emonth=1&syear=1&eyear=1&sRef=1:7:1:0:0:0:0:0:0:0:FROM%20BOUQUET%20%22userbouquet.favourites.tv%22%20ORDER%20BY%20bouquet">Timerlist</a><br/>-->
 <a href="/web/wap/power.html">PowerState</a><br/>
 </div>
 </body>
diff --git a/webinterface/src/web/wap/timeredit.html.xml b/webinterface/src/web/wap/timeredit.html.xml
new file mode 100644 (file)
index 0000000..b0caf65
--- /dev/null
@@ -0,0 +1,132 @@
+<e2:screen name="TestScreen"><html>
+<head>
+       <meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
+       <title>Enigma 2 Webinterface (ALPHA)</title>
+
+       <link href="/webdata/style.css" type="text/css" rel="stylesheet" />
+       <link rel="shortcut icon" type="image/x-icon" href="/webdata/gfx/favicon.ico"/>
+</head>
+<body>
+<form cgi="/wep/wap/timeradd">
+<table>
+<tr>
+       <td colspan="3">Action:</td>
+       <td colspan="3"><select name="justplay" id="justplay" size="1">
+               <option value="0">Record</option>
+               <option value="1">Zap</option>
+       </select>
+       </td>
+</tr><tr>
+       <td colspan="3"></td>
+       <td colspan="3">Note: For recurring events start/end day/month are not required.</td>
+</tr><tr>
+       <td colspan="3">Start:</td><td colspan="3">
+       <select name="syear" size="1">
+               <e2:element source="WAPFillOptionList" id="syear,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+       </select>.
+       <select name="smonth" id="smonth" size="1">
+               <e2:element source="WAPFillOptionList" id="smonth,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+       </select>.
+       <select name="sday" id="sday" size="1">
+               <e2:element source="WAPFillOptionList" id="sday,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+</select>---
+       <select name="shour" id="shour" size="1">
+               <e2:element source="WAPFillOptionList" id="shour,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+</select>:
+       <select name="smin" id="smin" size="1">
+               <e2:element source="WAPFillOptionList" id="smin,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+       </select></td>
+</tr><tr>
+       <td colspan="3">End:</td><td colspan="3"><select name="eyear" id="eyear" size="1">
+               <e2:element source="WAPFillOptionList" id="eyear,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+</select>.
+       <select name="emonth" id="emonth" size="1">
+               <e2:element source="WAPFillOptionList" id="emonth,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+</select>.
+       <select name="eday" id="eday" size="1">
+               <e2:element source="WAPFillOptionList" id="eday,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+</select>---
+       <select name="ehour" id="ehour" size="1">
+               <e2:element source="WAPFillOptionList" id="ehour,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+</select>:
+       <select name="emin" id="emin" size="1">
+               <e2:element source="WAPFillOptionList" id="emin,sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Value"/>&quot; <e2:item name="Selected"/>><e2:item name="Value"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+</select>
+       </td>
+</tr><tr>
+       <td colspan="3"></td><td colspan="3">Note: For one-time events the "days" field doesn't have to be specified.</td>
+</tr><tr>
+       <td colspan="3">Days:</td><td colspan="3">
+               <input type="checkbox" id="mo" name="mo" value="1"/>Mo
+               <input type="checkbox" id="tu" name="tu" value="2"/>Tu
+               <input type="checkbox" id="we" name="we" value="4"/>We
+               <input type="checkbox" id="th" name="th" value="8"/>Th
+               <input type="checkbox" id="fr" name="fr" value="16"/>Fr
+               <input type="checkbox" id="sa" name="sa" value="32"/>Sa
+               <input type="checkbox" id="su" name="su" value="64"/>Su
+               <input type="checkbox" id="mf" name="mf" value="31"/>Mo-Fr
+               <input type="checkbox" id="ms" name="ms" value="127"/>Mo-Su</td>
+</tr><tr>
+       <td colspan="3">Channel:</td>
+       <td><p><input type="radio" id="tvradio" name="tvradio" value="tv"/>TV</p>
+       <p><input type="radio" name="tvradio" value="radio"/>Radio</p></td>
+       <td><p>Channel:</p>
+       <select name="channel" id="channel" size="1">
+       <e2:element source="ServiceList" id="sRef"><e2:convert type="web:ListFiller" >
+               &lt;option value=&quot;<e2:item name="Reference"/>&quot;><e2:item name="Name"/>&lt;/option>
+               </e2:convert>
+       <e2:convert type="web:TextToHTML"/></e2:element>
+       </select>
+       </td>
+</tr><tr>
+       <td colspan="3">Name:</td><td colspan="3">
+       <input name="name" id="name" type="text" size="100" maxlength="100" style="color: #000000;" value=" "/></td>
+</tr><tr>
+       <td colspan="3">Description:</td><td colspan="3">
+       <input name="descr" id="descr" type="text" size="100" maxlength="100" style="color: #000000;" value=" "/></td>
+</tr><tr>
+       <td colspan="3">After event do:</td><td colspan="3"><select id="after_event" name="after_event" size="1">
+               <option value="0">Nothing</option><option value="1">Standby</option>
+               <option value="2">Deepstandby/Shutdown</option></select>
+</td>
+</tr><tr></tr><tr>
+       <td colspan="3"></td>
+       <td colspan="3">
+       <input name="deleteOldOnSave" id="deleteOldOnSave" type="hidden" value="0"/>
+       <input name="eventID" id="eventID" type="hidden" value="0"/>
+       <input type="button" name="save" value="Add/Save"/>
+</td></tr>
+</table></form>
+</body>
+</html>        
+</e2:screen>
\ No newline at end of file
index 994304d..b7eef71 100755 (executable)
@@ -1,5 +1,8 @@
 <e2:screen name="TestScreen">&lt;html>
 &lt;head>
+<!--
+Version = '$Header$';
+-->
        &lt;meta content="text/html; charset=UTF-8" http-equiv="content-type">
        &lt;title>Enigma 2 Webinterface (ALPHA)&lt;/title>
 
 &lt;div style="text-align: center;">
 &lt;table border="1">
                &lt;tr>
-               &lt;td>Channel&lt;/td>
-               &lt;td>Name&lt;/td>
-               &lt;td>Description&lt;/td>
-               &lt;td>Action&lt;/td>
+               &lt;td>&lt;b>Channel&lt;/b>&lt;/td>
+               &lt;td>&lt;b>Name&lt;/b>&lt;/td>
+               &lt;td>&lt;b>Description&lt;/b>&lt;/td>
+               &lt;td>&lt;b>Action&lt;/b>&lt;/td>
                &lt;/tr>
                &lt;tr>
                <e2:element source="TimerList" ><e2:convert type="web:ListFiller" >
index 2e6ba17..9057575 100644 (file)
@@ -1,4 +1,4 @@
-Version = '$Header$';
+
 
 # OK, this is more than a proof of concept
 # things to improve:
@@ -32,6 +32,7 @@ from WebComponents.Sources.ParentControl import ParentControl
 from WebComponents.Sources.About import About
 from WebComponents.Sources.RequestData import RequestData
 from WebComponents.Sources.AudioTracks import AudioTracks
+from WebComponents.Sources.WAPfunctions import WAPfunctions
 
 from Components.Sources.FrontendStatus import FrontendStatus
 
@@ -97,6 +98,7 @@ class TestScreen(InfoBarServiceName, InfoBarEvent,InfoBarTuner, WebScreen):
                self["AudioTracks"] = AudioTracks(session)
                
                self["About"] = About(session)
+               self["WAPFillOptionList"] = WAPfunctions(session,func = WAPfunctions.FILLOPTIONLIST)
                
        def getServiceList(self, sRef):
                self["ServiceList"].root = sRef