Skip to content

Commit

Permalink
preservce visibility of now/next items when updating a servicelist's …
Browse files Browse the repository at this point in the history
…epg information
  • Loading branch information
sreichholf committed Jan 19, 2012
1 parent ae437e6 commit 3e59432
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
33 changes: 19 additions & 14 deletions webinterface/src/web-data/handler.js
Expand Up @@ -290,7 +290,7 @@ var ServiceListEpgHandler = Class.create(AbstractContentHandler, {
show: function(list){
var len = list.items.length;
for(var i = 0; i < len; i++){
this.showItem(list.items[i]);
this.updateEpg(list.items[i]);
}
this.finished();
},
Expand All @@ -302,25 +302,30 @@ var ServiceListEpgHandler = Class.create(AbstractContentHandler, {
* @item - The EPGEvent object
*/
//TODO: move showItem outta here
showItem: function(item, type){
updateEpg: function(item){
if(item.now.eventid != ''){
var progress = $(this.PROGRESS + item.now.servicereference)
if(progress)
var progress = $(this.PROGRESS + item.now.servicereference);
if(progress){
progress.down('.sListSProgress').title = item.now.progress + "%";
progress.down('.sListSProgressBar').style.width = item.now.progress + "%";

var id = this.EPG_NOW + item.now.servicereference;
templateEngine.process('tplServiceListEPGItem', {'item' : item.now}, id, true);
var element = $(id).up('.sListEPGNow');
if(element){
element.show();
}
}
this.showItem(this.EPG_NOW, item.now,'.sListEPGNow');
this.showItem(this.EPG_NEXT, item.next,'.sListEPGNext');
},

showItem: function(type, epgItem, parent){
var id = type + epgItem.servicereference;
var epgElement = $(id);
if(epgElement){ //Markers don't have any EPG
var isVisible = false;
var target = epgElement.down('.sListExtEpgLong');
if(target){
isVisible = target.visible();
}

if(item.next.eventid != ''){
var id = this.EPG_NEXT + item.now.servicereference;
templateEngine.process('tplServiceListEPGItem', {'item' : item.next}, id, true);
var element = $(id).up('.sListEPGNext');
templateEngine.process('tplServiceListEPGItem', {'item' : epgItem, 'isVisible' : isVisible}, id, true);
var element = $(id).up(parent);
if(element){
element.show();
}
Expand Down
11 changes: 6 additions & 5 deletions webinterface/src/web-data/tpl/default/tplServiceListEPGItem.htm
Expand Up @@ -5,17 +5,18 @@
<table cellspacing="0">
<tr>
<td class="epgStart">${item.starttime}</td>
<td class="epgTitle"><img class="sListBulletToggle" src="/web-data/img/toggle_expand_small.png" alt="+">&nbsp;${item.title}</td>
<td class="epgTitle">
<img
class="sListBulletToggle"
{if isVisible}src="/web-data/img/toggle_collapse_small.png" alt="-"
{else}src="/web-data/img/toggle_expand_small.png" alt="+"{/if}>&nbsp;${item.title}</td>
{if item.duration != item.remaining}
<td class="epgLength">+${item.remaining} of ${item.duration}</td>
{else}
<td class="epgLength">${item.duration}</td>
{/if}
</tr>
<tr class="sListExtEpgLong" style="display:none">
<td colspan="4" class="epgLong">${item.extdescription}</td>
</tr>
<tr class="sListExtEpgLong" style="display:none">
<tr class="sListExtEpgLong" {if !isVisible}style="display:none"{/if}>
<td colspan="4" class="epgListItem epgLong"
data-servicereference="${item.servicereference}"
data-servicename="${item.servicename}"
Expand Down

0 comments on commit 3e59432

Please sign in to comment.