Commit 95e2e68c authored by nextime's avatar nextime

Minor dmblack theme fix + a notify broadcasting fix

parent e16621c6
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -103,6 +103,7 @@
color:#888;
}
.drawers {
background-color: #2e2e2e;
color: #2e2e2e;
......@@ -273,6 +274,11 @@ input::-webkit-input-speech-button {
.notifybutton:hover {
background-color: #fff;
}
.notify-item-theme-dmblack .list-group-item-heading,
.notify-item-theme-dmblack .list-group-item-text {
color: #888 !important;
}
.speechbutton {
background-image: url(/resources/img/microphone-little.png);
background-repeat: no-repeat;
......@@ -376,7 +382,7 @@ input::-webkit-input-speech-button {
.notifypanel {
position:absolute;
right: 5px;
bottom: 30px;
bottom: 50px;
box-shadow: -6px -6px 8px #999;
width: 300px;
height: 500px;
......
......@@ -109,9 +109,9 @@ function addRight($file, $sobstitute=false)
$GLOBALS['PAGE_BUFFER']['right_drawer']="";
}
function notifyListItem()
function notifyListItem($addclass='')
{
$ret='<a class="list-group-item notify-swipe-deletable" id="notifyid-[NID]" href="#">';
$ret='<a class="list-group-item notify-swipe-deletable '.$addclass.'" id="notifyid-[NID]" href="#">';
$ret.=' <h4 class="list-group-item-heading">From: [NSOURCE]<i class="glyphicon glyphicon-remove pull-right notify-deletable"></i></h4>';
$ret.=' <p class="list-group-item-text">[NDATE]</p>';
$ret.=' <p class="list-group-item-text">[TXT]</p>';
......
......@@ -96,6 +96,10 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
var slideEnabled=<?=$_DOMOTIKA['slide']?>;
var speechEnabled='<?=$_DOMOTIKA["webspeech"]?>';
var notifyColor='#fff';
if('<?=$_DOMOTIKA["gui_theme"]?>'=='dmblack')
notifyColor='#000';
//var scroller = new AppScroll({
// toolbar: $('#topbar')[0],
// scroller: $('#content')[0]
......@@ -218,6 +222,7 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
container: el,
trigger: "manual"});
console.debug(el.popover);
el.addClass('text-on-white-theme-<?=$_DOMOTIKA["gui_theme"]?>');
el.popover("show");
el.find(".popover-content").html(cont);
setTimeout(function(){el.popover("destroy")}, timeout);
......@@ -416,7 +421,7 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
{
var nd = new Date(parseInt(ndate*1000));
var ndate=nd.toLocaleString();
var nli='<?=notifyListItem();?>';
var nli='<?=notifyListItem("notify-item-theme-".$_DOMOTIKA["gui_theme"]);?>';
nli=nli.replace('[TXT]', text);
nli=nli.replace('[NDATE]', ndate);
nli=nli.replace('[NSOURCE]', source);
......@@ -588,7 +593,7 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
{
$("#notifications").prepend(notifylistitem(nt.msg, nt.source, nt.nid, ts));
$("#notifyid-"+nt.nid).animate({backgroundColor: "#0080ff"},200);
$("#notifyid-"+nt.nid).animate({backgroundColor: "#fff"},3500);
$("#notifyid-"+nt.nid).animate({backgroundColor: notifyColor},3500);
}
playTTS("nuova notifica,"+nt.msg);
......
......@@ -11,6 +11,10 @@
var slideEnabled=<?=$_DOMOTIKA['slide']?>;
var speechEnabled='<?=$_DOMOTIKA["webspeech"]?>';
var notifyColor='#fff';
if('<?=$_DOMOTIKA["gui_theme"]?>'=='dmblack')
notifyColor='#000';
//var scroller = new AppScroll({
// toolbar: $('#topbar')[0],
// scroller: $('#content')[0]
......@@ -133,6 +137,7 @@
container: el,
trigger: "manual"});
console.debug(el.popover);
el.addClass('text-on-white-theme-<?=$_DOMOTIKA["gui_theme"]?>');
el.popover("show");
el.find(".popover-content").html(cont);
setTimeout(function(){el.popover("destroy")}, timeout);
......@@ -331,7 +336,7 @@
{
var nd = new Date(parseInt(ndate*1000));
var ndate=nd.toLocaleString();
var nli='<?=notifyListItem();?>';
var nli='<?=notifyListItem("notify-item-theme-".$_DOMOTIKA["gui_theme"]);?>';
nli=nli.replace('[TXT]', text);
nli=nli.replace('[NDATE]', ndate);
nli=nli.replace('[NSOURCE]', source);
......@@ -503,7 +508,7 @@
{
$("#notifications").prepend(notifylistitem(nt.msg, nt.source, nt.nid, ts));
$("#notifyid-"+nt.nid).animate({backgroundColor: "#0080ff"},200);
$("#notifyid-"+nt.nid).animate({backgroundColor: "#fff"},3500);
$("#notifyid-"+nt.nid).animate({backgroundColor: notifyColor},3500);
}
playTTS("nuova notifica,"+nt.msg);
......
......@@ -1214,17 +1214,23 @@ class domotikaService(service.Service):
for c in self.clients.getAll():
try:
if c['session'].mind.perms.username==username:
self.clientSend('notify',{'msg':msg,'nid':res.id,'source':res.source})
self.clientSend('notify',{'msg':msg,'nid':res.id,'source':res.source}, c['session'])
except:
pass
dmdb.insertNotify(nsource, username, msg, expiretime).addCallback(_inserted)
def clientSend(self, event, data):
for c in self.clients.getAll():
def clientSend(self, event, data, session=False):
if not session:
for c in self.clients.getAll():
try:
#if not 'ts' in data.keys():
# data['ts'] = float(time.time())
c['session'].sse.sendJSON(event=event, data=data)
except:
pass
else:
try:
#if not 'ts' in data.keys():
# data['ts'] = float(time.time())
c['session'].sse.sendJSON(event=event, data=data)
session.sse.sendJSON(event=event, data=data)
except:
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment