From 031525b0e65ce084afccc039315f300a22e46e48 Mon Sep 17 00:00:00 2001 From: Jonathan Corwin Date: Sat, 21 May 2011 18:43:37 +0100 Subject: [PATCH] Lose the [None] and fix jquery issue --- openlp/core/lib/mediamanageritem.py | 18 +++++++++--------- openlp/plugins/remotes/html/openlp.js | 7 +++++-- openlp/plugins/remotes/lib/httpserver.py | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index a16754452..ff05fd5a7 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -506,18 +506,18 @@ class MediaManagerItem(QtGui.QWidget): # multiple service items? if self.singleServiceItem or self.remoteTriggered: log.debug(u'%s Add requested', self.plugin.name) - self.addToService([None], self.remoteTriggered) + self.addToService(replace=self.remoteTriggered) else: items = self.listView.selectedIndexes() - self.addToService(items) + for item in items: + self.addToService(item) - def addToService(self, items, replace=None): - for item in items: - serviceItem = self.buildServiceItem(item, True) - if serviceItem: - serviceItem.from_plugin = False - self.parent.serviceManager.addServiceItem(serviceItem, - replace=replace) + def addToService(self, item=None, replace=None): + serviceItem = self.buildServiceItem(item, True) + if serviceItem: + serviceItem.from_plugin = False + self.parent.serviceManager.addServiceItem(serviceItem, + replace=replace) def onAddEditClick(self): """ diff --git a/openlp/plugins/remotes/html/openlp.js b/openlp/plugins/remotes/html/openlp.js index 37ee73d9f..09312876c 100644 --- a/openlp/plugins/remotes/html/openlp.js +++ b/openlp/plugins/remotes/html/openlp.js @@ -247,8 +247,11 @@ window.OpenLP = { var text = JSON.stringify({"request": {"id": id}}); $.getJSON( "/api/" + $("#search-plugin").val() + "/add", - {"data": text}) - history.back(); + {"data": text}, + function () { + history.back(); + } + ); return false; } } diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index d17f924c8..3436a153c 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -499,7 +499,7 @@ class HttpConnection(object): plugin = self.parent.parent.pluginManager.get_plugin_by_name(type) if plugin.status == PluginStatus.Active and plugin.mediaItem: item_id = plugin.mediaItem.createItemFromId(id) - plugin.mediaItem.addToService([item_id]) + plugin.mediaItem.addToService(item_id) def send_response(self, response): http = u'HTTP/1.1 %s\r\n' % response.code