CC-4886: Warn if track is part of a playlist when deleting from library.
-done
This commit is contained in:
parent
694c54f272
commit
043fbd1dfb
4 changed files with 78 additions and 4 deletions
|
@ -1434,6 +1434,20 @@ SQL;
|
|||
|
||||
return $output;
|
||||
}
|
||||
public static function getAllBlockContent()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$sql = <<<SQL
|
||||
SELECT distinct(file_id)
|
||||
FROM cc_blockcontents
|
||||
SQL;
|
||||
$files = $con->query($sql)->fetchAll();
|
||||
$real_files = array();
|
||||
foreach ($files as $f) {
|
||||
$real_files[] = $f['file_id'];
|
||||
}
|
||||
return $real_files;
|
||||
}
|
||||
// smart block functions end
|
||||
}
|
||||
|
||||
|
|
|
@ -955,6 +955,21 @@ SQL;
|
|||
return $result;
|
||||
}
|
||||
|
||||
public static function getAllPlaylistContent()
|
||||
{
|
||||
$con = Propel::getConnection();
|
||||
$sql = <<<SQL
|
||||
SELECT distinct(file_id)
|
||||
FROM cc_playlistcontents
|
||||
SQL;
|
||||
$files = $con->query($sql)->fetchAll();
|
||||
$real_files = array();
|
||||
foreach ($files as $f) {
|
||||
$real_files[] = $f['file_id'];
|
||||
}
|
||||
return $real_files;
|
||||
}
|
||||
|
||||
} // class Playlist
|
||||
|
||||
class PlaylistNotFoundException extends Exception {}
|
||||
|
|
|
@ -773,7 +773,8 @@ SQL;
|
|||
$results = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
|
||||
|
||||
$futureScheduledFiles = Application_Model_Schedule::getAllFutureScheduledFiles();
|
||||
|
||||
$playlistBlockFiles = array_merge(Application_Model_Playlist::getAllPlaylistContent(),
|
||||
Application_Model_Block::getAllBlockContent());
|
||||
//Used by the audio preview functionality in the library.
|
||||
foreach ($results['aaData'] as &$row) {
|
||||
$row['id'] = intval($row['id']);
|
||||
|
@ -814,8 +815,12 @@ SQL;
|
|||
if ($type == "au") {
|
||||
$row['audioFile'] = $row['id'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
|
||||
$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>';
|
||||
if (in_array($row['id'], $futureScheduledFiles) && in_array($row['id'], $playlistBlockFiles)) {
|
||||
$row['checkbox'] .= '<span class="small-icon show-partial-filled track-sched-pl-bl"></span>';
|
||||
} elseif (in_array($row['id'], $futureScheduledFiles)) {
|
||||
$row['checkbox'] .= '<span class="small-icon show-partial-filled track-scheduled"></span>';
|
||||
} elseif (in_array($row['id'], $playlistBlockFiles)) {
|
||||
$row['checkbox'] .= '<span class="small-icon show-partial-filled track-pl-bl"></span>';
|
||||
}
|
||||
} elseif ($type == "pl") {
|
||||
$row['image'] = '<img title="'._("Playlist preview").'" src="'.$baseUrl.'css/images/icon_playlist.png">';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue