CC-4887: Show whether track is scheduled in the future on Library page

This commit is contained in:
drigato 2013-01-30 08:57:59 -05:00
parent 1e57309e66
commit c45440482a
3 changed files with 39 additions and 0 deletions

View file

@ -20,6 +20,21 @@ SQL;
return (is_numeric($count) && ($count != '0')); return (is_numeric($count) && ($count != '0'));
} }
public static function getAllFutureScheduledFiles()
{
$con = Propel::getConnection();
$sql = <<<SQL
SELECT distinct(file_id)
FROM cc_schedule
WHERE ends > now() AT TIME ZONE 'UTC'
SQL;
$files = $con->query($sql)->fetchAll();
$real_files = array();
foreach ($files as $f) {
$real_files[] = $f['file_id'];
}
return $real_files;
}
/** /**
* Returns data related to the scheduled items. * Returns data related to the scheduled items.
* *

View file

@ -772,6 +772,8 @@ SQL;
$results = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables); $results = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
$futureScheduledFiles = Application_Model_Schedule::getAllFutureScheduledFiles();
//Used by the audio preview functionality in the library. //Used by the audio preview functionality in the library.
foreach ($results['aaData'] as &$row) { foreach ($results['aaData'] as &$row) {
$row['id'] = intval($row['id']); $row['id'] = intval($row['id']);
@ -812,6 +814,9 @@ SQL;
if ($type == "au") { if ($type == "au") {
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); $row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<img title="'._("Track preview").'" src="'.$baseUrl.'css/images/icon_audioclip.png">'; $row['image'] = '<img title="'._("Track preview").'" src="'.$baseUrl.'css/images/icon_audioclip.png">';
if (in_array($row['id'], $futureScheduledFiles)) {
$row['checkbox'] .= '<span class="small-icon show-partial-filled track-future"></span>';
}
} elseif ($type == "pl") { } elseif ($type == "pl") {
$row['image'] = '<img title="'._("Playlist preview").'" src="'.$baseUrl.'css/images/icon_playlist.png">'; $row['image'] = '<img title="'._("Playlist preview").'" src="'.$baseUrl.'css/images/icon_playlist.png">';
} elseif ($type == "st") { } elseif ($type == "st") {

View file

@ -606,6 +606,25 @@ var AIRTIME = (function(AIRTIME) {
return false; return false;
}); });
$(nRow).find(".track-future").qtip({
content: {
text: $.i18n._("Track is scheduled in the future")
},
position:{
adjust: {
resize: true,
method: "flip flip"
},
at: "right center",
my: "left top",
viewport: $(window)
},
style: {
classes: "ui-tooltip-dark"
},
show: 'mousedown'
});
// add a tool tip to appear when the user clicks on the type // add a tool tip to appear when the user clicks on the type
// icon. // icon.
$(nRow).find("td:not(.library_checkbox, .library_type)").qtip({ $(nRow).find("td:not(.library_checkbox, .library_type)").qtip({