--- /dev/null
+from enigma import *
+from Components.Sources.Source import Source
+from Screens.MessageBox import MessageBox
+
+class Message( Source):
+
+ def __init__(self,session):
+ self.cmd = []
+ self.session = session
+ Source.__init__(self)
+
+ def handleCommand(self, cmd):
+ self.cmd = cmd
+
+ def do_func(self):
+ list = []
+
+ if self.cmd['text'] == "" or self.cmd['text'] is None:
+ return [[False,"no text for message"]]
+ else:
+ mtext = self.cmd['text']
+
+ try:
+ typeint = int(self.cmd['type'])
+ except ValueError,e:
+ return [[False,"type %s is not a number"%self.cmd['type']]]
+
+ if typeint == MessageBox.TYPE_YESNO:
+ #dont know how to give the result to the webif back
+ mtype= MessageBox.TYPE_YESNO
+ elif typeint == MessageBox.TYPE_INFO:
+ mtype= MessageBox.TYPE_INFO
+ elif typeint == MessageBox.TYPE_WARNING:
+ mtype= MessageBox.TYPE_WARNING
+ elif typeint == MessageBox.TYPE_ERROR:
+ mtype= MessageBox.TYPE_ERROR
+ else:
+ return [[False,"unsupported type %s"%self.cmd['type']]]
+
+ try:
+ mtimeout = int(self.cmd['timeout'])
+ except ValueError,e:
+ mtimeout = -1
+
+ self.session.open(MessageBox, mtext, type = mtype ,timeout = mtimeout)
+
+ return [[True,"Message send to screen"]]
+
+ list = property(do_func)
+ lut = {"Result": 0
+ ,"ResultText": 1
+ }
+
var tplSignalPanelButton = '<img src="/webdata/gfx/signal.png" title="show SignalInfoPanel" onclick="openSignalDialog();" title="view Signal Info">';
+// Message send
+var tplMessageSendForm = ""
+ tplMessageSendForm += '<table id="MessageSendForm" width="100%" border="0" cellspacing="1" cellpadding="0" border="0">';
+ tplMessageSendForm += '<tr><td>Text</td><td><input type="text" id="MessageSendFormText" value=""></td></tr>\n';
+ tplMessageSendForm += '<tr><td>Timeout</td><td><input type="text" id="MessageSendFormTimeout" value=""></td></tr>\n';
+ tplMessageSendForm += '<tr><td>Typ</td><td><select id="MessageSendFormType">';
+ tplMessageSendForm += '<option value="1">Info</option>';
+ tplMessageSendForm += '<option value="0">YesNo</option>';
+ tplMessageSendForm += '<option value="2">Warning</option>';
+ tplMessageSendForm += '<option value="3">Error</option>';
+ tplMessageSendForm += '</select></td></tr>\n';
+ tplMessageSendForm += '<tr><td colspan="2"><button onclick="sendMessage()">send Message</button></td></tr>\n';
+ tplMessageSendForm += "</table></form>\n";
var url_timeraddbyeventid= "/web/timeraddbyeventid"; // plus serviceref,eventid
var url_timerdelete= "/web/timerdelete"; // plus serviceref,bedin,end
+var url_message = "/web/message"; // plus text,type,timeout
+
var bouqet_tv = '1:7:1:0:0:0:0:0:0:0:(type == 1) || (type == 17) || (type == 195) || (type == 25)FROM BOUQUET "bouquets.tv" ORDER BY bouquet';
var bouqet_radio = '1:7:2:0:0:0:0:0:0:0:(type == 2)FROM BOUQUET "bouquets.radio" ORDER BY bouquet';
var bouqet_provider_tv = '1:7:1:0:0:0:0:0:0:0:(type == 1) || (type == 17) || (type == 195) || (type == 25) FROM PROVIDERS ORDER BY name';
function loadTimerForm() {
debug("timers form");
debug("there is still work to do here");
+}
+
+// send Messages
+function showMessageSendForm(){
+ document.getElementById('BodyContentChannellist').innerHTML = tplMessageSendForm;
+}
+function sendMessage(messagetext,messagetype,messagetimeout){
+ if(!messagetext){
+ messagetext = $('MessageSendFormText').value;
+ }
+ if(!messagetimeout){
+ messagetimeout = $('MessageSendFormTimeout').value;
+ }
+ if(!messagetype){
+ var index = $('MessageSendFormType').selectedIndex;
+ messagetype = $('MessageSendFormType').options[index].value;
+ }
+ doRequest(url_message+'?text='+messagetext+'&type='+messagetype+'&timeout='+messagetimeout, incomingMessageResult);
+}
+function incomingMessageResult(request){
+ if(request.readyState == 4){
+ var b = getXML(request).getElementsByTagName("e2message");
+ var result = b.item(0).getElementsByTagName('e2result').item(0).firstChild.data;
+ var resulttext = b.item(0).getElementsByTagName('e2resulttext').item(0).firstChild.data;
+ if (result=="True"){
+ messageBox('message send','message send successfully! it appears on TV-Screen');
+ }else{
+ messageBox('message send failed',resulttext);
+ }
+ }
+
+
}
\ No newline at end of file
--- /dev/null
+<e2:screen name="TestScreen"><?xml version="1.0" encoding="UTF-8"?>
+<e2message>
+ <e2:element source="Message" id="text,type,timeout"><e2:convert type="web:ListFiller" >
+ <e2result><e2:item name="Result" filter="xml"/></e2result>
+ <e2resulttext><e2:item name="ResultText" filter="xml"/></e2resulttext>
+ </e2:convert><e2:convert type="web:TextToHTML" /></e2:element>
+</e2message>
+</e2:screen>
\ No newline at end of file
from WebComponents.Sources.EPG import EPG
from WebComponents.Sources.Timer import Timer
from WebComponents.Sources.Movie import Movie
+from WebComponents.Sources.Message import Message
from Components.Sources.FrontendStatus import FrontendStatus
from Components.Converter.Converter import Converter
self["TimerDel"] = Timer(session,func = Timer.DEL)
self["MovieList"] = Movie(session)
self["Volume"] = Volume(session)
+ self["Message"] = Message(session)
def browseTo(self, reftobrowse):
self["ServiceListBrowse"].root = reftobrowse