forked from openlp/openlp
Moved Jonathan's JS over to jQuery
This commit is contained in:
parent
4d9f429ae0
commit
2ddde15875
@ -1,10 +1,14 @@
|
|||||||
<html>
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||||
<head>
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<title>OpenLP Controller</title>
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
|
||||||
<script type='text/javascript'>
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
|
<title>OpenLP Remote Controller</title>
|
||||||
|
<script type="text/javascript" src="/files/jquery.js"></script>
|
||||||
|
<script type='text/javascript'>
|
||||||
|
|
||||||
function send_event(eventname, data){
|
function send_event(eventname, data) {
|
||||||
var req = new XMLHttpRequest();
|
/*var req = new XMLHttpRequest();
|
||||||
req.onreadystatechange = function() {
|
req.onreadystatechange = function() {
|
||||||
if(req.readyState==4)
|
if(req.readyState==4)
|
||||||
response(eventname, req);
|
response(eventname, req);
|
||||||
@ -18,7 +22,35 @@ function send_event(eventname, data){
|
|||||||
if(data!=null)
|
if(data!=null)
|
||||||
url += '?q=' + escape(data);
|
url += '?q=' + escape(data);
|
||||||
req.open('GET', url, true);
|
req.open('GET', url, true);
|
||||||
req.send();
|
req.send();*/
|
||||||
|
var url = "";
|
||||||
|
if (eventname.substr(-8) == "_request")
|
||||||
|
{
|
||||||
|
url = "request";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
url = "send";
|
||||||
|
}
|
||||||
|
url += "/" + eventname;
|
||||||
|
var args = {};
|
||||||
|
if (data != null)
|
||||||
|
{
|
||||||
|
args.q = escape(data);
|
||||||
|
}
|
||||||
|
$.get(url, args, function (data, textStatus) {
|
||||||
|
if (textStatus != "success")
|
||||||
|
{
|
||||||
|
if (eventname == "remotes_poll_request")
|
||||||
|
{
|
||||||
|
send_event("remotes_poll_request");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_response(eventname, data);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
function failed_response(eventname, req){
|
function failed_response(eventname, req){
|
||||||
switch(eventname){
|
switch(eventname){
|
||||||
@ -76,6 +108,50 @@ function response(eventname, req){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function new_response(eventname, text){
|
||||||
|
switch (eventname)
|
||||||
|
{
|
||||||
|
case 'servicemanager_list_request':
|
||||||
|
var data = eval('(' + text + ')');
|
||||||
|
var table = $("<table>");
|
||||||
|
for (row in data)
|
||||||
|
{
|
||||||
|
var trow = $("<tr>").click("send_event('servicemanager_set_item', '" + row + "')");
|
||||||
|
if (data[row]['selected'])
|
||||||
|
{
|
||||||
|
trow.attr("style", "font-weight: bold");
|
||||||
|
}
|
||||||
|
trow.append($("<td>").text(parseInt(row)+1));
|
||||||
|
trow.append($("<td>").text(data[row]['title']));
|
||||||
|
trow.append($("<td>").text(data[row]['plugin']));
|
||||||
|
trow.append($("<td>").text(data[row]['notes']));
|
||||||
|
table.append(trow);
|
||||||
|
}
|
||||||
|
$("#service").html(table);
|
||||||
|
break;
|
||||||
|
case 'slidecontroller_live_text_request':
|
||||||
|
var data = eval('(' + text + ')');
|
||||||
|
var html = '<table>';
|
||||||
|
for(row in data){
|
||||||
|
html += '<tr onclick="send_event('
|
||||||
|
html += "'slidecontroller_live_set', " + row + ')"';
|
||||||
|
if(data[row]['selected'])
|
||||||
|
html += ' style="font-weight: bold"';
|
||||||
|
html += '>';
|
||||||
|
html += '<td>' + data[row]['tag'] + '</td>';
|
||||||
|
html += '<td>' + data[row]['text'].replace(/\\n/g, '<br>');
|
||||||
|
html += '</td></tr>';
|
||||||
|
}
|
||||||
|
html += '</table>';
|
||||||
|
document.getElementById('currentitem').innerHTML = html;
|
||||||
|
break;
|
||||||
|
case 'remotes_poll_request':
|
||||||
|
send_event("remotes_poll_request");
|
||||||
|
send_event("servicemanager_list_request");
|
||||||
|
send_event("slidecontroller_live_text_request");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
send_event("servicemanager_list_request");
|
send_event("servicemanager_list_request");
|
||||||
send_event("slidecontroller_live_text_request");
|
send_event("slidecontroller_live_text_request");
|
||||||
send_event("remotes_poll_request");
|
send_event("remotes_poll_request");
|
||||||
|
19
openlp/plugins/remotes/html/jquery.js
vendored
Executable file
19
openlp/plugins/remotes/html/jquery.js
vendored
Executable file
File diff suppressed because one or more lines are too long
@ -187,7 +187,7 @@ class HttpConnection(object):
|
|||||||
if os.path.basename(filename) != filename:
|
if os.path.basename(filename) != filename:
|
||||||
return None
|
return None
|
||||||
(fileroot, ext) = os.path.splitext(filename)
|
(fileroot, ext) = os.path.splitext(filename)
|
||||||
if ext != u'.html':
|
if not ext in [u'.html', u'.js', u'.css', u'.png']:
|
||||||
return None
|
return None
|
||||||
path = os.path.join(self.parent.html_dir, filename)
|
path = os.path.join(self.parent.html_dir, filename)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user