CC-2203: Search results: "Delete" should be at the bottom of the list and should have a confirmation

-Fixed
This commit is contained in:
martin 2011-04-18 12:43:04 -04:00
parent d7bb00dc20
commit fab68dfad1
3 changed files with 106 additions and 80 deletions

View File

@ -54,13 +54,13 @@ class LibraryController extends Zend_Controller_Action
$params = '/format/json/id/#id#/type/#type#';
$paramsPop = str_replace('#id#', $id, $params);
$paramsPop = str_replace('#type#', $type, $paramsPop);
$pl_sess = $this->pl_sess;
if($type === "au") {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Library/delete'.$params, 'callback' => 'window["deleteAudioClip"]'),
'title' => 'Delete');
if(isset($pl_sess->id)) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/add-item'.$params, 'callback' => 'window["setSPLContent"]'),
'title' => 'Add to Playlist');
@ -69,6 +69,9 @@ class LibraryController extends Zend_Controller_Action
$menu[] = array('action' => array('type' => 'gourl', 'url' => '/Library/edit-file-md/id/#id#'),
'title' => 'Edit Metadata');
$menu[] = array('action' => array('type' => 'fn',
'callback' => "window['confirmDeleteAudioClip']('$paramsPop')"),
'title' => 'Delete');
}
else if($type === "pl") {
@ -90,7 +93,11 @@ class LibraryController extends Zend_Controller_Action
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/metadata/format/json/id/#id#', 'callback' => 'window["createPlaylistMetaForm"]'),
'title' => 'Edit Metadata');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/delete'.$params, 'callback' => 'window["deletePlaylist"]'),
//$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/delete'.$params, 'callback' => 'window["deletePlaylist"]'),
// 'title' => 'Delete');
$menu[] = array('action' => array('type' => 'fn',
'callback' => "window['confirmDeletePlaylist']('$paramsPop')"),
'title' => 'Delete');
}

View File

@ -248,8 +248,6 @@ class ScheduleController extends Zend_Controller_Action
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/edit-show/format/json/id/'.$id,
'callback' => 'window["beginEditShow"]'), 'title' => 'Edit Show');
//$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/cancel-show'.$params,
// 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Edit This Instance and All Following');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params,
'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance');
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/cancel-show'.$params,

View File

@ -24,7 +24,6 @@ function deleteItem(type, id) {
dt.fnDeleteRow( tr );
}
//callbacks called by jjmenu
function deleteAudioClip(json) {
if(json.message) {
alert(json.message);
@ -34,6 +33,28 @@ function deleteAudioClip(json) {
deleteItem("au", json.id);
}
//callbacks called by jjmenu
function confirmDeleteAudioClip(params){
if(confirm('Are you sure you want to delete?')){
var url = '/Library/delete' + params;
$.ajax({
url: url,
success: deleteAudioClip
});
}
}
//callbacks called by jjmenu
function confirmDeletePlaylist(params){
if(confirm('Are you sure you want to delete?')){
var url = '/Playlist/delete' + params;
$.ajax({
url: url,
success: deletePlaylist
});
}
}
function deletePlaylist(json) {
if(json.message) {
alert(json.message);