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(){
|
||||
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.
|
||||
$(":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/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/contextmenu.js.tpl"}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<tr class="background-color: {cycle values='blue1, blue2'}">
|
||||
<td><input type="checkbox" class="checkbox" name="{$i.id}"/></td>
|
||||
<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>
|
||||
{else}
|
||||
{$i.title|truncate:30:"...":true}
|
||||
|
@ -33,15 +33,15 @@
|
|||
</td>
|
||||
<td {include file=$action_handler} style="cursor: pointer">
|
||||
{$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}
|
||||
</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="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">
|
||||
{if $PL->isAvailable($i.id) == false}
|
||||
{if $i.type == 'playlist' && $PL->isAvailable($i.id) == false}
|
||||
<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>
|
||||
{else}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue