CC-1689 Playlists show up in browse/search.
This commit is contained in:
parent
373a5df4e9
commit
f01e780831
|
@ -195,7 +195,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
function addTextInput(){
|
function addTextInput(){
|
||||||
var time = $(this).text().trim();
|
var time = $(this).text().trim();
|
||||||
var input = $("<input type='text' value="+time+" size='10' maxlength='15'/>");
|
var input = $("<input type='text' value="+time+" size='13' maxlength='15'/>");
|
||||||
|
|
||||||
//Firefox seems to have problems losing focus otherwise, Chrome is fine.
|
//Firefox seems to have problems losing focus otherwise, Chrome is fine.
|
||||||
$(":input").blur();
|
$(":input").blur();
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
<script type="text/javascript" src="assets/plupload/plupload.full.min.js"></script>
|
<script type="text/javascript" src="assets/plupload/plupload.full.min.js"></script>
|
||||||
<script type="text/javascript" src="assets/plupload/jquery.plupload.queue.min.js"></script>
|
<script type="text/javascript" src="assets/plupload/jquery.plupload.queue.min.js"></script>
|
||||||
<script type="text/javascript" src="assets/qtip/jquery.qtip.min.js"></script>
|
|
||||||
|
|
||||||
{include file="script/basics.js.tpl"}
|
{include file="script/basics.js.tpl"}
|
||||||
{include file="script/contextmenu.js.tpl"}
|
{include file="script/contextmenu.js.tpl"}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<tr class="background-color: {cycle values='blue1, blue2'}">
|
<tr class="background-color: {cycle values='blue1, blue2'}">
|
||||||
<td><input type="checkbox" class="checkbox" name="{$i.id}"/></td>
|
<td><input type="checkbox" class="checkbox" name="{$i.id}"/></td>
|
||||||
<td {include file=$action_handler} style="cursor: pointer">
|
<td {include file=$action_handler} style="cursor: pointer">
|
||||||
{if $PLAYLIST.id == $i.id}
|
{if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
|
||||||
<b>{$i.title|truncate:30:"...":true}</b>
|
<b>{$i.title|truncate:30:"...":true}</b>
|
||||||
{else}
|
{else}
|
||||||
{$i.title|truncate:30:"...":true}
|
{$i.title|truncate:30:"...":true}
|
||||||
|
@ -33,15 +33,15 @@
|
||||||
</td>
|
</td>
|
||||||
<td {include file=$action_handler} style="cursor: pointer">
|
<td {include file=$action_handler} style="cursor: pointer">
|
||||||
{$i.creator}
|
{$i.creator}
|
||||||
{if $PL->isAvailable($i.id) == false}
|
{if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
|
||||||
(editing: {$PL->isUsedBy($i.id)})
|
(editing: {$PL->isUsedBy($i.id)})
|
||||||
{/if}
|
{/if}
|
||||||
</td>
|
</td>
|
||||||
<td {include file=$action_handler} style="cursor: pointer">{$i.source}</td>
|
<td {include file=$action_handler} style="cursor: pointer">{$i.source}</td>
|
||||||
<td {include file=$action_handler} style="cursor: pointer" align="center">{$i.track_num}</td>
|
<td {include file=$action_handler} style="cursor: pointer" align="center">{$i.track_num}</td>
|
||||||
<td {include file=$action_handler} style="text-align: right; cursor: pointer">{assign var="_duration" value=$i.duration}{niceTime in=$_duration}</td>
|
<td {include file=$action_handler} style="text-align: right; cursor: pointer">{assign var="_duration" value=$i.duration}{niceTime in=$_duration}</td>
|
||||||
<td {include file=$action_handler} style="border: 0; text-align: center; cursor: pointer">
|
<td {include file=$action_handler} style="border: 0; text-align: center; cursor: pointer">
|
||||||
{if $PL->isAvailable($i.id) == false}
|
{if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
|
||||||
<div align="left"><img src="img/ico_lock.png">
|
<div align="left"><img src="img/ico_lock.png">
|
||||||
<img src="img/{$i.type|lower}.png" border="0" alt="{$i.type|lower|capitalize}" {* include file="sub/alttext.tpl" *} /></div>
|
<img src="img/{$i.type|lower}.png" border="0" alt="{$i.type|lower|capitalize}" {* include file="sub/alttext.tpl" *} /></div>
|
||||||
{else}
|
{else}
|
||||||
|
|
|
@ -440,9 +440,6 @@ class uiPlaylist
|
||||||
|
|
||||||
public function isAvailable($id)
|
public function isAvailable($id)
|
||||||
{
|
{
|
||||||
if (Greenbox::getFileType($id) !== UI_FILETYPE_PLAYLIST) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
if ($this->Base->gb->playlistIsAvailable($id, $this->Base->sessid) === TRUE) {
|
if ($this->Base->gb->playlistIsAvailable($id, $this->Base->sessid) === TRUE) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -452,9 +449,6 @@ class uiPlaylist
|
||||||
|
|
||||||
function isUsedBy($id)
|
function isUsedBy($id)
|
||||||
{
|
{
|
||||||
if (Greenbox::getFileType($id) !== UI_FILETYPE_PLAYLIST) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (($userid = $this->Base->gb->playlistIsAvailable($id, $this->Base->sessid)) !== TRUE) {
|
if (($userid = $this->Base->gb->playlistIsAvailable($id, $this->Base->sessid)) !== TRUE) {
|
||||||
return Subjects::GetSubjName($userid);
|
return Subjects::GetSubjName($userid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1092,9 +1092,12 @@ class BasicStor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build WHERE clause
|
// Build WHERE clause
|
||||||
$whereClause = " WHERE (state='ready' OR state='edited')";
|
$whereClause = "";
|
||||||
if (!is_null($filetype)) {
|
if (!is_null($filetype)) {
|
||||||
$whereClause .= " AND (ftype='$filetype')";
|
$whereClause .= "WHERE (ftype='$filetype')";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$whereClause .= "WHERE (ftype is NOT NULL)";
|
||||||
}
|
}
|
||||||
if (count($whereArr) != 0) {
|
if (count($whereArr) != 0) {
|
||||||
if ($operator == 'and') {
|
if ($operator == 'and') {
|
||||||
|
@ -1105,51 +1108,53 @@ class BasicStor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Final query
|
// Final query
|
||||||
$sql = "SELECT * "
|
|
||||||
. " FROM ".$CC_CONFIG["filesTable"]
|
$sql = "SELECT * FROM ((SELECT creator AS artist_name, NULL AS album_title,
|
||||||
. $whereClause;
|
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) {
|
if ($orderby) {
|
||||||
$sql .= " ORDER BY ".join(",", $orderBySql);
|
$sql .= " ORDER BY ".join(",", $orderBySql);
|
||||||
}
|
}
|
||||||
|
|
||||||
//$_SESSION["debug"] = $sql;
|
$_SESSION["br"] = $sql;
|
||||||
|
|
||||||
$countRowsSql = "SELECT COUNT(*) "
|
$res = $CC_DBC->getAll($sql);
|
||||||
. " 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);
|
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
if (!is_array($res)) {
|
if (!is_array($res)) {
|
||||||
$res = array();
|
$res = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$count = count($res);
|
||||||
|
|
||||||
|
$res = array_slice($res, $offset != 0 ? $offset : 0, $limit != 0 ? $limit : 10);
|
||||||
|
|
||||||
$eres = array();
|
$eres = array();
|
||||||
foreach ($res as $it) {
|
foreach ($res as $it) {
|
||||||
$gunid = StoredFile::NormalizeGunid($it['gunid']);
|
|
||||||
$eres[] = array(
|
$eres[] = array(
|
||||||
'id' => $it['id'],
|
'id' => $it['id'],
|
||||||
'gunid' => $gunid,
|
|
||||||
'type' => strtolower($it['ftype']),
|
'type' => strtolower($it['ftype']),
|
||||||
'title' => $it['track_title'],
|
'title' => $it['track_title'],
|
||||||
'creator' => $it['artist_name'],
|
'creator' => $it['artist_name'],
|
||||||
'duration' => $it['length'],
|
'duration' => $it['length'],
|
||||||
'length' => $it['length'],
|
|
||||||
'source' => $it['album_title'],
|
'source' => $it['album_title'],
|
||||||
'track_num' => $it['track_number'],
|
'track_num' => $it['track_number'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return array('results'=>$eres, 'cnt'=>$cnt);
|
return array('results'=>$eres, 'cnt'=>$count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue