forked from openlp/openlp
Fixed up json import.
Started JavaScript framework. Started implementing Service Management.
This commit is contained in:
parent
0b8d8b8832
commit
7c47e24cf0
@ -116,7 +116,7 @@ function new_response(eventname, text){
|
||||
var table = $("<table>");
|
||||
for (row in data)
|
||||
{
|
||||
var trow = $("<tr>").click("send_event('servicemanager_set_item', '" + row + "')");
|
||||
var trow = $("<tr>").click("send_event");
|
||||
if (data[row]['selected'])
|
||||
{
|
||||
trow.attr("style", "font-weight: bold");
|
||||
|
32
openlp/plugins/remotes/html/init.js
Normal file
32
openlp/plugins/remotes/html/init.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*****************************************************************************
|
||||
* OpenLP - Open Source Lyrics Projection *
|
||||
* ------------------------------------------------------------------------- *
|
||||
* Copyright (c) 2008-2010 Raoul Snyman *
|
||||
* Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael *
|
||||
* Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin *
|
||||
* Thompson, Jon Tibble, Carsten Tinggaard *
|
||||
* ------------------------------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; version 2 of the License. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
|
||||
* Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* init.js - In certain browsers (yes, IE, I'm looking at you!), DocumentReady
|
||||
* JavaScript functions can only be run very last on the page. This file is the
|
||||
* last JavaScript file to be included on the page, and provides a work-around
|
||||
* for this bug in certain browsers.
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
OpenLP.Events.init();
|
||||
});
|
123
openlp/plugins/remotes/html/openlp.js
Normal file
123
openlp/plugins/remotes/html/openlp.js
Normal file
@ -0,0 +1,123 @@
|
||||
/*****************************************************************************
|
||||
* OpenLP - Open Source Lyrics Projection *
|
||||
* ------------------------------------------------------------------------- *
|
||||
* Copyright (c) 2008-2010 Raoul Snyman *
|
||||
* Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael *
|
||||
* Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin *
|
||||
* Thompson, Jon Tibble, Carsten Tinggaard *
|
||||
* ------------------------------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; version 2 of the License. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
|
||||
* Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
*****************************************************************************/
|
||||
|
||||
window["OpenLP"] = {
|
||||
Namespace: {
|
||||
/**
|
||||
* Create a Javascript namespace.
|
||||
* Based on: http://code.google.com/p/namespacedotjs/
|
||||
* Idea behind this is to created nested namespaces that are not ugly.
|
||||
*/
|
||||
create: function (name, attributes) {
|
||||
var parts = name.split('.'),
|
||||
ns = window,
|
||||
i = 0;
|
||||
// find the deepest part of the namespace
|
||||
// that is already defined
|
||||
for(; i < parts.length && parts[i] in ns; i++)
|
||||
ns = ns[parts[i]];
|
||||
// initialize any remaining parts of the namespace
|
||||
for(; i < parts.length; i++)
|
||||
ns = ns[parts[i]] = {};
|
||||
// copy the attributes into the namespace
|
||||
for (var attr in attributes)
|
||||
ns[attr] = attributes[attr];
|
||||
},
|
||||
exists: function (namespace) {
|
||||
/**
|
||||
* Determine the namespace of a page
|
||||
*/
|
||||
page_namespace = $ScribeEngine.Namespace.get_page_namespace();
|
||||
return (namespace == page_namespace);
|
||||
},
|
||||
get_page_namespace: function () {
|
||||
return $("#content > h2").attr("id");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Array.prototype.append = function (elem) {
|
||||
this[this.length] = elem;
|
||||
}
|
||||
|
||||
OpenLP.Namespace.create("OpenLP.Events", {
|
||||
// Local variables
|
||||
onload_functions: Array(),
|
||||
// Functions
|
||||
load: function (func) {
|
||||
this.onload_functions.append(func);
|
||||
},
|
||||
click: function (selector, func) {
|
||||
$(selector).bind("click", func);
|
||||
},
|
||||
change: function (selector, func) {
|
||||
$(selector).bind("change", func);
|
||||
},
|
||||
submit: function (selector, func) {
|
||||
$(selector).bind("submit", func);
|
||||
},
|
||||
blur: function (selector, func) {
|
||||
$(selector).bind("blur", func);
|
||||
},
|
||||
paste: function (selector, func) {
|
||||
$(selector).bind("paste", func);
|
||||
},
|
||||
keyup: function (selector, func) {
|
||||
$(selector).bind("keyup", func);
|
||||
},
|
||||
keydown: function (selector, func) {
|
||||
$(selector).bind("keydown", func);
|
||||
},
|
||||
keypress: function (selector, func) {
|
||||
$(selector).bind("keypress", func);
|
||||
},
|
||||
getElement: function(event) {
|
||||
var targ;
|
||||
if (!event) {
|
||||
var event = window.event;
|
||||
}
|
||||
if (event.target) {
|
||||
targ = event.target;
|
||||
}
|
||||
else if (event.srcElement) {
|
||||
targ = event.srcElement;
|
||||
}
|
||||
if (targ.nodeType == 3) {
|
||||
// defeat Safari bug
|
||||
targ = targ.parentNode;
|
||||
}
|
||||
return $(targ);
|
||||
},
|
||||
init: function () {
|
||||
for (idx in this.onload_functions) {
|
||||
func = this.onload_functions[idx];
|
||||
func();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
OpenLP.Namespace.create("OpenLP.Remote", {
|
||||
sendEvent: function (event_name, event_data)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
});
|
44
openlp/plugins/remotes/html/openlp.service.js
Normal file
44
openlp/plugins/remotes/html/openlp.service.js
Normal file
@ -0,0 +1,44 @@
|
||||
/*****************************************************************************
|
||||
* OpenLP - Open Source Lyrics Projection *
|
||||
* ------------------------------------------------------------------------- *
|
||||
* Copyright (c) 2008-2010 Raoul Snyman *
|
||||
* Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael *
|
||||
* Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin *
|
||||
* Thompson, Jon Tibble, Carsten Tinggaard *
|
||||
* ------------------------------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; version 2 of the License. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
|
||||
* Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
*****************************************************************************/
|
||||
|
||||
OpenLP.Namespace.create("OpenLP.Service", {
|
||||
addServiceItem: function (elem, item)
|
||||
{
|
||||
var trow = $("<tr>")
|
||||
.attr("id", "item-" + item.id)
|
||||
.addClass("item")
|
||||
.append($("<td>").text(item.tag))
|
||||
.append($("<td>").text(item.tag.replace(/\n/g, "<br />")));
|
||||
return false;
|
||||
},
|
||||
sendLive: function (e)
|
||||
{
|
||||
var elem = OpenLP.Events.getElement(e);
|
||||
var row = elem.attr("id").substr(5);
|
||||
elem.addStyle("font-weight", "bold");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
OpenLP.Events.load(function (){
|
||||
OpenLP.Events.liveClick(".item", OpenLP.Service.sendLive);
|
||||
});
|
@ -25,9 +25,13 @@
|
||||
|
||||
import logging
|
||||
import os
|
||||
import json
|
||||
import urlparse
|
||||
|
||||
try:
|
||||
import json
|
||||
except ImportError:
|
||||
import simplejson as json
|
||||
|
||||
from PyQt4 import QtCore, QtNetwork
|
||||
|
||||
from openlp.core.lib import Receiver
|
||||
|
Loading…
Reference in New Issue
Block a user