From 8231e0fdd598a0122a63ba384162f89c481e3c56 Mon Sep 17 00:00:00 2001
From: sebastian <sebastian@cfc7b370-4200-0410-a6e3-cb6bdb053afe>
Date: Wed, 17 Feb 2010 21:30:51 +0000
Subject: [PATCH] #2368 Show playlist title in the statusbar

---
 .../htmlUI/var/templates/script/progressbar.js.tpl        | 7 ++++---
 campcaster/src/modules/htmlUI/var/templates/statusbar.tpl | 6 ++++--
 campcaster/src/modules/htmlUI/var/ui_scheduler.class.php  | 4 ++--
 campcaster/src/modules/storageServer/var/GreenBox.php     | 8 ++++++++
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/campcaster/src/modules/htmlUI/var/templates/script/progressbar.js.tpl b/campcaster/src/modules/htmlUI/var/templates/script/progressbar.js.tpl
index f4453bc61..05929e9ba 100644
--- a/campcaster/src/modules/htmlUI/var/templates/script/progressbar.js.tpl
+++ b/campcaster/src/modules/htmlUI/var/templates/script/progressbar.js.tpl
@@ -3,7 +3,7 @@
 {literal}
 // play-progress-bar object
 
-function plPrBar(tit, pltit, eh, ei, es, dh, di, ds, next, ntit, nh, ni, ns){
+function plPrBar(tit, eh, ei, es, dh, di, ds, next, ntit, nh, ni, ns, pltit){
     this.tit        = tit;
     this.pltit      = pltit;
     this.next       = next;
@@ -82,7 +82,8 @@ function plPrBar_create(jscomRes) {
             ppb = new plPrBar(parms[0],
                               parms[1], parms[2], parms[3],
                               parms[4], parms[5], parms[6],
-                              parms[7], parms[8], parms[9], parms[10], parms[11] 
+                              parms[7], parms[8], parms[9], parms[10], parms[11],
+                              parms[12] 
                              );
             ppb.init();
         } else {
@@ -102,7 +103,6 @@ function plPrBar_hide() {
 
 {if (is_array($_nowplaying.duration))} 
     ppb = new plPrBar  ("{$_nowplaying.title|escape:html}",
-                        "{$_nowplaying.pl_title|escape:html}",
                         {$_nowplaying.elapsed.h|string_format:"%d"}, {$_nowplaying.elapsed.m|string_format:"%d"}, {$_nowplaying.elapsed.s|string_format:"%d"},
                         {$_nowplaying.duration.h|string_format:"%d"}, {$_nowplaying.duration.m|string_format:"%d"}, {$_nowplaying.duration.s|string_format:"%d"},
                         {if is_array($_nextplaying)}
@@ -110,6 +110,7 @@ function plPrBar_hide() {
                         {else}
                             0, "", 0, 0, 0
                         {/if}
+                        , "{$_nowplaying.playlist|escape:html}"
                        );
     ppb.init();
 {/if}
diff --git a/campcaster/src/modules/htmlUI/var/templates/statusbar.tpl b/campcaster/src/modules/htmlUI/var/templates/statusbar.tpl
index 8f5ab0958..16e54bc7e 100644
--- a/campcaster/src/modules/htmlUI/var/templates/statusbar.tpl
+++ b/campcaster/src/modules/htmlUI/var/templates/statusbar.tpl
@@ -1,5 +1,5 @@
 {assign var='_nowplaying'  value=$SCHEDULER->getNowNextClip()}
-{assign var='_nextplaying' value=$SCHEDULER->getNowNextClip()}
+{assign var='_nextplaying' value=$SCHEDULER->getNowNextClip(1)}
 
 <div id="masterpalette"> 
 <table border="0" class="masterpalette">
@@ -50,7 +50,9 @@
                 <div  style="height:3px"> </div>
                 <div id="next_clip">
                 {if $_nextplaying}
-                    <span class="next">##Next Clip##:</span> <strong id="next_title"></strong>&nbsp; <strong id="next_duration"></strong></div>
+                    <span class="next">##Next Clip##:</span>
+                    <strong id="next_title"></strong>
+                    &nbsp;<span id="next_duration"></span>
                 {/if}
                 </div>
             </div>  
diff --git a/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php b/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php
index 63096e471..dfa51b29e 100644
--- a/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php
+++ b/campcaster/src/modules/htmlUI/var/ui_scheduler.class.php
@@ -624,14 +624,13 @@ class uiScheduler extends uiCalendar {
         $elapsed = array_map('round', $elapsed);
         $remaining = array_map('round', $remaining);
         $percentage =  $secondsElapsed ? (100 * $secondsElapsed / ($secondsElapsed + $secondsRemaining)) : 100;
-        $pl_title = $this->Base->gb->getMetadataValue(BasicStor::IdFromGunid($pl['playlistId']), UI_MDATA_KEY_TITLE, $this->Base->sessid);
         
         return array('title' => $clip['title'],
                      'duration'  => $duration,
                      'elapsed'   => $elapsed,
                      'remaining' => $remaining,
                      'percentage'=> $percentage,
-                     'pl_title'  => $pl_title
+                     'playlist'  => $clip['playlist']
                );
     } // fn getNowNextClip
 
@@ -655,6 +654,7 @@ class uiScheduler extends uiCalendar {
                     'next.dur.h'    => $next ? $next['duration']['h'] : 0,
                     'next.dur.m'    => $next ? $next['duration']['m'] : 0,
                     'next.dur.s'    => $next ? $next['duration']['s'] : 0,
+                    'playlist'      => $curr['playlist'],
                    );
         } else {
             return FALSE;
diff --git a/campcaster/src/modules/storageServer/var/GreenBox.php b/campcaster/src/modules/storageServer/var/GreenBox.php
index 4f97660cb..3974546e6 100644
--- a/campcaster/src/modules/storageServer/var/GreenBox.php
+++ b/campcaster/src/modules/storageServer/var/GreenBox.php
@@ -887,6 +887,14 @@ class GreenBox extends BasicStor {
         if (!is_null($id)) {
             $res['title'] = $this->bsGetMetadataValue($id, "dc:title");
         }
+        $res['playlist_title'] = NULL;
+        $id = BasicStor::IdFromGunid($plid);
+        if (PEAR::isError($id)) {
+            return $id;
+        }
+        if (!is_null($id)) {
+            $res['playlist'] = $this->bsGetMetadataValue($id, "dc:title");
+        }
         return $res;
     } // fn displayPlaylistClipAtOffset