diff --git a/src/modules/htmlUI/var/html/js/playlist.js b/src/modules/htmlUI/var/html/js/playlist.js
index c0b165382..e06ce00f4 100644
--- a/src/modules/htmlUI/var/html/js/playlist.js
+++ b/src/modules/htmlUI/var/html/js/playlist.js
@@ -195,7 +195,7 @@ $(document).ready(function() {
function addTextInput(){
var time = $(this).text().trim();
- var input = $("");
+ var input = $("");
//Firefox seems to have problems losing focus otherwise, Chrome is fine.
$(":input").blur();
diff --git a/src/modules/htmlUI/var/templates/header.tpl b/src/modules/htmlUI/var/templates/header.tpl
index 4159593a3..e7ec30a32 100644
--- a/src/modules/htmlUI/var/templates/header.tpl
+++ b/src/modules/htmlUI/var/templates/header.tpl
@@ -15,7 +15,6 @@
-
{include file="script/basics.js.tpl"}
{include file="script/contextmenu.js.tpl"}
diff --git a/src/modules/htmlUI/var/templates/library/results.tpl b/src/modules/htmlUI/var/templates/library/results.tpl
index 0c01ba787..5d2b47a9c 100644
--- a/src/modules/htmlUI/var/templates/library/results.tpl
+++ b/src/modules/htmlUI/var/templates/library/results.tpl
@@ -25,7 +25,7 @@
|
- {if $PLAYLIST.id == $i.id}
+ {if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
{$i.title|truncate:30:"...":true}
{else}
{$i.title|truncate:30:"...":true}
@@ -33,15 +33,15 @@
|
{$i.creator}
- {if $PL->isAvailable($i.id) == false}
- (editing: {$PL->isUsedBy($i.id)})
+ {if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
+ (editing: {$PL->isUsedBy($i.id)})
{/if}
|
{$i.source} |
{$i.track_num} |
{assign var="_duration" value=$i.duration}{niceTime in=$_duration} |
- {if $PL->isAvailable($i.id) == false}
+ {if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
{else}
diff --git a/src/modules/htmlUI/var/ui_playlist.class.php b/src/modules/htmlUI/var/ui_playlist.class.php
index 42eee2ede..399e51d8c 100644
--- a/src/modules/htmlUI/var/ui_playlist.class.php
+++ b/src/modules/htmlUI/var/ui_playlist.class.php
@@ -440,9 +440,6 @@ class uiPlaylist
public function isAvailable($id)
{
- if (Greenbox::getFileType($id) !== UI_FILETYPE_PLAYLIST) {
- return TRUE;
- }
if ($this->Base->gb->playlistIsAvailable($id, $this->Base->sessid) === TRUE) {
return TRUE;
}
@@ -452,9 +449,6 @@ class uiPlaylist
function isUsedBy($id)
{
- if (Greenbox::getFileType($id) !== UI_FILETYPE_PLAYLIST) {
- return FALSE;
- }
if (($userid = $this->Base->gb->playlistIsAvailable($id, $this->Base->sessid)) !== TRUE) {
return Subjects::GetSubjName($userid);
}
diff --git a/src/modules/storageServer/var/BasicStor.php b/src/modules/storageServer/var/BasicStor.php
index 8c6365cc5..d69321f3e 100644
--- a/src/modules/storageServer/var/BasicStor.php
+++ b/src/modules/storageServer/var/BasicStor.php
@@ -1092,9 +1092,12 @@ class BasicStor {
}
// Build WHERE clause
- $whereClause = " WHERE (state='ready' OR state='edited')";
+ $whereClause = "";
if (!is_null($filetype)) {
- $whereClause .= " AND (ftype='$filetype')";
+ $whereClause .= "WHERE (ftype='$filetype')";
+ }
+ else {
+ $whereClause .= "WHERE (ftype is NOT NULL)";
}
if (count($whereArr) != 0) {
if ($operator == 'and') {
@@ -1105,51 +1108,53 @@ class BasicStor {
}
// Final query
- $sql = "SELECT * "
- . " FROM ".$CC_CONFIG["filesTable"]
- . $whereClause;
+
+ $sql = "SELECT * FROM ((SELECT creator AS artist_name, NULL AS album_title,
+ name AS track_title, length, NULL AS track_number,
+ PL.id, 'playlist' AS ftype
+ FROM ".$CC_CONFIG["playListTable"]." AS PL,
+ (SELECT playlist_id AS id, text(SUM(cliplength)) AS length
+ FROM ".$CC_CONFIG["playListContentsTable"]." group by playlist_id) AS T
+ WHERE PL.id = T.id)
+
+ UNION
+
+ SELECT artist_name, album_title, track_title, text(length) AS length,
+ track_number, id, ftype FROM " .$CC_CONFIG["filesTable"].") AS Content ";
+
+ $sql .= $whereClause;
+
if ($orderby) {
$sql .= " ORDER BY ".join(",", $orderBySql);
}
- //$_SESSION["debug"] = $sql;
-
- $countRowsSql = "SELECT COUNT(*) "
- . " FROM ".$CC_CONFIG["filesTable"]
- . $whereClause;
- $cnt = $CC_DBC->GetOne($countRowsSql);
-
- // Get the number of results
- if (PEAR::isError($cnt)) {
- return $cnt;
- }
-
- // Get actual results
- $limitPart = ($limit != 0 ? " LIMIT $limit" : '' ).
- ($offset != 0 ? " OFFSET $offset" : '' );
- $res = $CC_DBC->getAll($sql.$limitPart);
+ $_SESSION["br"] = $sql;
+
+ $res = $CC_DBC->getAll($sql);
if (PEAR::isError($res)) {
return $res;
}
if (!is_array($res)) {
$res = array();
}
+
+ $count = count($res);
+
+ $res = array_slice($res, $offset != 0 ? $offset : 0, $limit != 0 ? $limit : 10);
+
$eres = array();
foreach ($res as $it) {
- $gunid = StoredFile::NormalizeGunid($it['gunid']);
$eres[] = array(
'id' => $it['id'],
- 'gunid' => $gunid,
'type' => strtolower($it['ftype']),
'title' => $it['track_title'],
'creator' => $it['artist_name'],
'duration' => $it['length'],
- 'length' => $it['length'],
'source' => $it['album_title'],
'track_num' => $it['track_number'],
);
}
- return array('results'=>$eres, 'cnt'=>$cnt);
+ return array('results'=>$eres, 'cnt'=>$count);
}
|