forked from openlp/openlp
Remote hostname fix. Remove tags from remote text
bzr-revno: 1532
This commit is contained in:
commit
c5656fbfd9
@ -63,8 +63,10 @@ window.OpenLP = {
|
|||||||
var ul = $("#slide-controller > div[data-role=content] > ul[data-role=listview]");
|
var ul = $("#slide-controller > div[data-role=content] > ul[data-role=listview]");
|
||||||
ul.html("");
|
ul.html("");
|
||||||
for (idx in data.results.slides) {
|
for (idx in data.results.slides) {
|
||||||
|
var text = data.results.slides[idx]["text"];
|
||||||
|
text = text.replace(/\n/g, '<br />');
|
||||||
var li = $("<li data-icon=\"false\">").append(
|
var li = $("<li data-icon=\"false\">").append(
|
||||||
$("<a href=\"#\">").attr("value", parseInt(idx, 10)).html(data.results.slides[idx]["text"]));
|
$("<a href=\"#\">").attr("value", parseInt(idx, 10)).html(text));
|
||||||
if (data.results.slides[idx]["selected"]) {
|
if (data.results.slides[idx]["selected"]) {
|
||||||
li.attr("data-theme", "e");
|
li.attr("data-theme", "e");
|
||||||
}
|
}
|
||||||
|
@ -65,9 +65,14 @@ window.OpenLP = {
|
|||||||
updateSlide: function() {
|
updateSlide: function() {
|
||||||
$("#verseorder span").removeClass("currenttag");
|
$("#verseorder span").removeClass("currenttag");
|
||||||
$("#tag" + OpenLP.currentSlide).addClass("currenttag");
|
$("#tag" + OpenLP.currentSlide).addClass("currenttag");
|
||||||
$("#currentslide").html(OpenLP.currentSlides[OpenLP.currentSlide]["text"]);
|
var text = OpenLP.currentSlides[OpenLP.currentSlide]["text"];
|
||||||
if (OpenLP.currentSlide < OpenLP.currentSlides.length - 1)
|
text = text.replace(/\n/g, '<br />');
|
||||||
$("#nextslide").html(OpenLP.currentSlides[OpenLP.currentSlide + 1]["text"]);
|
$("#currentslide").html(text);
|
||||||
|
if (OpenLP.currentSlide < OpenLP.currentSlides.length - 1) {
|
||||||
|
text = OpenLP.currentSlides[OpenLP.currentSlide + 1]["text"];
|
||||||
|
text = text.replace(/\n/g, '<br />');
|
||||||
|
$("#nextslide").html(text);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$("#nextslide").html("Next: " + OpenLP.nextSong);
|
$("#nextslide").html("Next: " + OpenLP.nextSong);
|
||||||
},
|
},
|
||||||
|
@ -115,6 +115,7 @@ import os
|
|||||||
import urlparse
|
import urlparse
|
||||||
import re
|
import re
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
|
from lxml import html
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import json
|
import json
|
||||||
@ -402,10 +403,13 @@ class HttpConnection(object):
|
|||||||
item = {}
|
item = {}
|
||||||
if current_item.is_text():
|
if current_item.is_text():
|
||||||
item[u'tag'] = unicode(frame[u'verseTag'])
|
item[u'tag'] = unicode(frame[u'verseTag'])
|
||||||
item[u'text'] = unicode(frame[u'html'])
|
text = unicode(frame[u'html'].replace('<br>', '\n'))
|
||||||
|
item[u'text'] = html.fromstring(text).text_content()
|
||||||
|
item[u'html'] = unicode(frame[u'html'])
|
||||||
else:
|
else:
|
||||||
item[u'tag'] = unicode(index)
|
item[u'tag'] = unicode(index)
|
||||||
item[u'text'] = u''
|
item[u'text'] = u''
|
||||||
|
item[u'html'] = u''
|
||||||
item[u'selected'] = (self.parent.current_slide == index)
|
item[u'selected'] = (self.parent.current_slide == index)
|
||||||
data.append(item)
|
data.append(item)
|
||||||
json_data = {u'results': {u'slides': data}}
|
json_data = {u'results': {u'slides': data}}
|
||||||
|
@ -93,24 +93,23 @@ class RemoteTab(SettingsTab):
|
|||||||
'Stage view URL:'))
|
'Stage view URL:'))
|
||||||
|
|
||||||
def setUrls(self):
|
def setUrls(self):
|
||||||
ipAddress = None
|
ipAddress = u'localhost'
|
||||||
if self.addressEdit.text() == ZERO_URL:
|
if self.addressEdit.text() == ZERO_URL:
|
||||||
for ip in QtNetwork.QNetworkInterface.allAddresses():
|
ifaces = QtNetwork.QNetworkInterface.allInterfaces()
|
||||||
if ip.protocol() == 0 and ip != QtNetwork.QHostAddress.LocalHost:
|
for iface in ifaces:
|
||||||
|
if not iface.isValid():
|
||||||
|
continue
|
||||||
|
if not (iface.flags() & (QtNetwork.QNetworkInterface.IsUp |
|
||||||
|
QtNetwork.QNetworkInterface.IsRunning)):
|
||||||
|
continue
|
||||||
|
for addr in iface.addressEntries():
|
||||||
|
ip = addr.ip()
|
||||||
|
if ip.protocol() == 0 and \
|
||||||
|
ip != QtNetwork.QHostAddress.LocalHost:
|
||||||
ipAddress = ip.toString()
|
ipAddress = ip.toString()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
ipAddress = self.addressEdit.text()
|
ipAddress = self.addressEdit.text()
|
||||||
if not ipAddress:
|
|
||||||
self.remoteUrlLabel.setVisible(False)
|
|
||||||
self.remoteUrl.setVisible(False)
|
|
||||||
self.stageUrlLabel.setVisible(False)
|
|
||||||
self.stageUrl.setVisible(False)
|
|
||||||
return
|
|
||||||
self.remoteUrlLabel.setVisible(True)
|
|
||||||
self.remoteUrl.setVisible(True)
|
|
||||||
self.stageUrlLabel.setVisible(True)
|
|
||||||
self.stageUrl.setVisible(True)
|
|
||||||
url = u'http://%s:%s/' % (ipAddress, self.portSpinBox.value())
|
url = u'http://%s:%s/' % (ipAddress, self.portSpinBox.value())
|
||||||
self.remoteUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
self.remoteUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
||||||
url = url + u'stage'
|
url = url + u'stage'
|
||||||
|
Loading…
Reference in New Issue
Block a user