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]");
|
||||
ul.html("");
|
||||
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(
|
||||
$("<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"]) {
|
||||
li.attr("data-theme", "e");
|
||||
}
|
||||
|
@ -65,10 +65,15 @@ window.OpenLP = {
|
||||
updateSlide: function() {
|
||||
$("#verseorder span").removeClass("currenttag");
|
||||
$("#tag" + OpenLP.currentSlide).addClass("currenttag");
|
||||
$("#currentslide").html(OpenLP.currentSlides[OpenLP.currentSlide]["text"]);
|
||||
if (OpenLP.currentSlide < OpenLP.currentSlides.length - 1)
|
||||
$("#nextslide").html(OpenLP.currentSlides[OpenLP.currentSlide + 1]["text"]);
|
||||
else
|
||||
var text = OpenLP.currentSlides[OpenLP.currentSlide]["text"];
|
||||
text = text.replace(/\n/g, '<br />');
|
||||
$("#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
|
||||
$("#nextslide").html("Next: " + OpenLP.nextSong);
|
||||
},
|
||||
updateClock: function() {
|
||||
|
@ -115,6 +115,7 @@ import os
|
||||
import urlparse
|
||||
import re
|
||||
from pprint import pformat
|
||||
from lxml import html
|
||||
|
||||
try:
|
||||
import json
|
||||
@ -402,10 +403,13 @@ class HttpConnection(object):
|
||||
item = {}
|
||||
if current_item.is_text():
|
||||
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:
|
||||
item[u'tag'] = unicode(index)
|
||||
item[u'text'] = u''
|
||||
item[u'html'] = u''
|
||||
item[u'selected'] = (self.parent.current_slide == index)
|
||||
data.append(item)
|
||||
json_data = {u'results': {u'slides': data}}
|
||||
|
@ -93,24 +93,23 @@ class RemoteTab(SettingsTab):
|
||||
'Stage view URL:'))
|
||||
|
||||
def setUrls(self):
|
||||
ipAddress = None
|
||||
ipAddress = u'localhost'
|
||||
if self.addressEdit.text() == ZERO_URL:
|
||||
for ip in QtNetwork.QNetworkInterface.allAddresses():
|
||||
if ip.protocol() == 0 and ip != QtNetwork.QHostAddress.LocalHost:
|
||||
ipAddress = ip.toString()
|
||||
break
|
||||
ifaces = QtNetwork.QNetworkInterface.allInterfaces()
|
||||
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()
|
||||
break
|
||||
else:
|
||||
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())
|
||||
self.remoteUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
||||
url = url + u'stage'
|
||||
|
Loading…
Reference in New Issue
Block a user