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;
|
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
|
// smart block functions end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -955,6 +955,21 @@ SQL;
|
||||||
return $result;
|
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 Playlist
|
||||||
|
|
||||||
class PlaylistNotFoundException extends Exception {}
|
class PlaylistNotFoundException extends Exception {}
|
||||||
|
|
|
@ -773,7 +773,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();
|
$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.
|
//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']);
|
||||||
|
@ -814,8 +815,12 @@ 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)) {
|
if (in_array($row['id'], $futureScheduledFiles) && in_array($row['id'], $playlistBlockFiles)) {
|
||||||
$row['checkbox'] .= '<span class="small-icon show-partial-filled track-future"></span>';
|
$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") {
|
} 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">';
|
||||||
|
|
|
@ -606,7 +606,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(nRow).find(".track-future").qtip({
|
$(nRow).find(".track-scheduled").qtip({
|
||||||
content: {
|
content: {
|
||||||
text: $.i18n._("This track is scheduled in the future")
|
text: $.i18n._("This track is scheduled in the future")
|
||||||
},
|
},
|
||||||
|
@ -626,6 +626,46 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
at: "right center"
|
at: "right center"
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
$(nRow).find(".track-sched-pl-bl").qtip({
|
||||||
|
content: {
|
||||||
|
text: $.i18n._("This track is scheduled in the future and belongs to a playlist or smart block")
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
delay: 500,
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
border: {
|
||||||
|
width: 0,
|
||||||
|
radius: 4
|
||||||
|
},
|
||||||
|
classes: "ui-tooltip-dark ui-tooltip-rounded"
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
my: "left bottom",
|
||||||
|
at: "right center"
|
||||||
|
},
|
||||||
|
});
|
||||||
|
$(nRow).find(".track-pl-bl").qtip({
|
||||||
|
content: {
|
||||||
|
text: $.i18n._("This track belongs to a playlist or smart block")
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
delay: 500,
|
||||||
|
fixed: true
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
border: {
|
||||||
|
width: 0,
|
||||||
|
radius: 4
|
||||||
|
},
|
||||||
|
classes: "ui-tooltip-dark ui-tooltip-rounded"
|
||||||
|
},
|
||||||
|
position: {
|
||||||
|
my: "left bottom",
|
||||||
|
at: "right center"
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
// 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.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue