diff --git a/src/modules/htmlUI/var/templates/scratchpad/main.tpl b/src/modules/htmlUI/var/templates/scratchpad/main.tpl
index dc3aa0fed..0d14f9815 100644
--- a/src/modules/htmlUI/var/templates/scratchpad/main.tpl
+++ b/src/modules/htmlUI/var/templates/scratchpad/main.tpl
@@ -26,7 +26,7 @@
{if $i.type|lower == "playlist"}
- {if $_PL_activeId == $i.id}
+ {if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
{else}
@@ -40,7 +40,7 @@
{assign var="_duration" value=$i.duration}
{niceTime in=$_duration} |
- {if $_PL_activeId == $i.id}
+ {if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
{else}
diff --git a/src/modules/storageServer/var/BasicStor.php b/src/modules/storageServer/var/BasicStor.php
index 580bc6f40..cb69d9a36 100644
--- a/src/modules/storageServer/var/BasicStor.php
+++ b/src/modules/storageServer/var/BasicStor.php
@@ -1294,10 +1294,12 @@ class BasicStor {
else if ($category === "dcterms:extent") {
$columnName = $pl_cat[$category];
- $sql = "SELECT DISTINCT SUM(cliplength) AS $columnName FROM ".$CC_CONFIG["playListContentsTable"]." GROUP BY playlist_id";
$limitPart = ($limit != 0 ? " LIMIT $limit" : '' ).
($offset != 0 ? " OFFSET $offset" : '' );
- $countRowsSql = "SELECT COUNT(DISTINCT SUM(cliplength)) FROM ".$CC_CONFIG["playListContentsTable"]." GROUP BY playlist_id";
+
+ $sql = "SELECT DISTINCT length AS $columnName FROM ".$CC_CONFIG["playListTimeView"];
+
+ $countRowsSql = "SELECT COUNT(DISTINCT length) FROM ".$CC_CONFIG["playListTimeView"];
$pl_cnt = $CC_DBC->GetOne($countRowsSql);
if (PEAR::isError($cnt)) {
diff --git a/src/modules/storageServer/var/install/install.php b/src/modules/storageServer/var/install/install.php
index 357c3fedc..6b67cc6c7 100644
--- a/src/modules/storageServer/var/install/install.php
+++ b/src/modules/storageServer/var/install/install.php
@@ -310,9 +310,14 @@ if (!camp_db_table_exists($CC_CONFIG['playListContentsTable'])) {
CREATE TRIGGER calculate_position AFTER INSERT OR DELETE ON ".$CC_CONFIG['playListContentsTable']."
FOR EACH ROW EXECUTE PROCEDURE calculate_position();
- CREATE OR REPLACE VIEW cc_playlisttimes AS
- SELECT playlist_id AS id, text(SUM(cliplength)) AS length
- FROM ".$CC_CONFIG['playListContentsTable']." group by playlist_id;
+ CREATE OR REPLACE VIEW cc_playlisttimes AS (
+ SELECT PL.id, COALESCE(T.length, '00:00:00') AS length
+ from ".$CC_CONFIG['playListTable']." AS PL LEFT JOIN
+ (SELECT playlist_id AS id, text(SUM(cliplength)) AS length
+ FROM ".$CC_CONFIG['playListContentsTable']." GROUP BY playlist_id) AS T
+
+ ON PL.id = T.id
+ );
";
| |