CC-3174 : showbuilder
mostly done with new context menu, need to finish add/delete button actions on lib table for both screens.
This commit is contained in:
parent
da5e1ac302
commit
6c2475bf1f
9 changed files with 305 additions and 424 deletions
|
@ -30,7 +30,7 @@ $pages = array(
|
|||
'resource' => 'library'
|
||||
),
|
||||
array(
|
||||
'label' => 'Show Builder',
|
||||
'label' => 'Airtimeline',
|
||||
'module' => 'default',
|
||||
'controller' => 'Showbuilder',
|
||||
'action' => 'index',
|
||||
|
|
|
@ -49,7 +49,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.TableTools.js','text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/library.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/advancedsearch.js','text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/media_library.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.contextMenu.css');
|
||||
|
@ -74,6 +73,8 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
//playlist||timeline
|
||||
$screen = $this->_getParam('screen');
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
|
@ -87,7 +88,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
$menu["delete"] = array("name"=> "Delete", "icon" => "delete");
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
||||
}
|
||||
|
||||
$url = $file->getRelativeFileUrl($baseUrl).'/download/true';
|
||||
|
@ -120,11 +121,11 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
else if ($type === "playlist") {
|
||||
|
||||
if (!isset($this->pl_sess->id) || $this->pl_sess->id !== $id) {
|
||||
if ($this->pl_sess->id !== $id && $screen == "playlist") {
|
||||
$menu["edit"] = array("name"=> "Edit", "icon" => "edit");
|
||||
}
|
||||
|
||||
$menu["delete"] = array("name"=> "Delete", "icon" => "delete");
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
|
@ -132,40 +133,52 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
public function deleteAction()
|
||||
{
|
||||
$ids = $this->_getParam('ids');
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
//array containing id and type of media to delete.
|
||||
$mediaItems = $this->_getParam('media', null);
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
|
||||
$files = array();
|
||||
$playlists = array();
|
||||
|
||||
$message = null;
|
||||
|
||||
foreach ($mediaItems as $media) {
|
||||
|
||||
if ($media["type"] === "audioclip") {
|
||||
$files[] = intval($media["id"]);
|
||||
}
|
||||
else if ($media["type"] === "playlist") {
|
||||
$playlists[] = intval($media["id"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (count($playlists)) {
|
||||
Application_Model_Playlist::DeletePlaylists($playlists);
|
||||
}
|
||||
|
||||
if (!$user->isAdmin()) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($files as $id) {
|
||||
Logging::log("deleting file {$id}");
|
||||
|
||||
if (!is_null($ids)) {
|
||||
foreach ($ids as $key => $id) {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
|
||||
if (PEAR::isError($file)) {
|
||||
$this->view->message = $file->getMessage();
|
||||
return;
|
||||
}
|
||||
else if(is_null($file)) {
|
||||
$this->view->message = "file doesn't exist";
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($file)) {
|
||||
try {
|
||||
$res = $file->delete();
|
||||
|
||||
if (PEAR::isError($res)) {
|
||||
$this->view->message = $res->getMessage();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$res = settype($res, "integer");
|
||||
$data = array("filepath" => $file->getFilePath(), "delete" => $res);
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
||||
//could throw a scheduled in future exception.
|
||||
catch (Exception $e) {
|
||||
$message = "Could not delete some scheduled files.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->ids = $ids;
|
||||
}
|
||||
if (isset($message)) {
|
||||
$this->view->message = $message;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,13 +265,15 @@ class LibraryController extends Zend_Controller_Action
|
|||
public function getUploadToSoundcloudStatusAction(){
|
||||
$id = $this->_getParam('id');
|
||||
$type = $this->_getParam('type');
|
||||
if($type == "show"){
|
||||
|
||||
if ($type == "show") {
|
||||
$show_instance = new Application_Model_ShowInstance($id);
|
||||
$this->view->sc_id = $show_instance->getSoundCloudFileId();
|
||||
$file = $show_instance->getRecordedFile();
|
||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
$this->view->error_msg = $file->getSoundCloudErrorMsg();
|
||||
}else{
|
||||
}
|
||||
else if ($type == "file") {
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
$this->view->sc_id = $file->getSoundCloudId();
|
||||
$this->view->error_code = $file->getSoundCloudErrorCode();
|
||||
|
|
|
@ -103,17 +103,18 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
public function editAction()
|
||||
{
|
||||
$pl_id = $this->_getParam('id', null);
|
||||
$id = $this->_getParam('id', null);
|
||||
Logging::log("editing playlist {$id}");
|
||||
|
||||
if (!is_null($pl_id)) {
|
||||
$this->changePlaylist($pl_id);
|
||||
if (!is_null($id)) {
|
||||
$this->changePlaylist($id);
|
||||
}
|
||||
|
||||
try {
|
||||
$pl = $this->getPlaylist();
|
||||
}
|
||||
catch (PlaylistNotFoundException $e) {
|
||||
Logging::log("Playlist {$pl_id} not found");
|
||||
Logging::log("Playlist {$id} not found");
|
||||
$this->changePlaylist(null);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
|
|
|
@ -227,30 +227,6 @@ class Application_Model_StoredFile {
|
|||
return $md;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete and insert media file
|
||||
*
|
||||
* @param string $p_localFilePath
|
||||
* local path
|
||||
* @return TRUE|PEAR_Error
|
||||
*/
|
||||
public function replaceFile($p_localFilePath, $p_copyMedia=TRUE)
|
||||
{
|
||||
// Dont do anything if the source and destination files are
|
||||
// the same.
|
||||
if ($this->name == $p_localFilePath) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ($this->exists) {
|
||||
$r = $this->deleteFile();
|
||||
if (PEAR::isError($r)) {
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
return $this->addFile($p_localFilePath, $p_copyMedia);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set state of virtual file
|
||||
*
|
||||
|
@ -301,97 +277,27 @@ class Application_Model_StoredFile {
|
|||
*
|
||||
* @param boolean $p_deleteFile
|
||||
*
|
||||
* @return void|PEAR_Error
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
if ($this->exists()) {
|
||||
if ($this->getFormat() == 'audioclip') {
|
||||
$res = $this->deleteFile();
|
||||
if (PEAR::isError($res)) {
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
// Check if the file is scheduled to be played in the future
|
||||
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) {
|
||||
throw new DeleteScheduledFileException();
|
||||
}
|
||||
|
||||
// don't delete from the playslist. We might want to put a flag
|
||||
//Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
|
||||
$filepath = $this->getFilePath();
|
||||
|
||||
if (file_exists($filepath)) {
|
||||
|
||||
$data = array("filepath" => $filepath, "delete" => 1);
|
||||
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
|
||||
}
|
||||
|
||||
Application_Model_Playlist::DeleteFileFromAllPlaylists($this->getId());
|
||||
|
||||
// set file_exists falg to false
|
||||
$this->_file->setDbFileExists(false);
|
||||
$this->_file->save();
|
||||
//$this->_file->delete();
|
||||
|
||||
if (isset($res)) {
|
||||
return $res;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete media file from filesystem.
|
||||
* You cant delete a file if it is being accessed.
|
||||
* You cant delete a file if it is scheduled to be played in the future.
|
||||
* The file will be removed from all playlists it is a part of.
|
||||
*
|
||||
* @return boolean|PEAR_Error
|
||||
*/
|
||||
public function deleteFile()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
if ($this->isAccessed()) {
|
||||
return PEAR::raiseError('Cannot delete a file that is currently accessed.');
|
||||
}
|
||||
|
||||
// Check if the file is scheduled to be played in the future
|
||||
if (Application_Model_Schedule::IsFileScheduledInTheFuture($this->getId())) {
|
||||
return PEAR::raiseError('Cannot delete a file that is scheduled in the future.');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if media file exists
|
||||
* @return boolean
|
||||
*/
|
||||
public function exists()
|
||||
{
|
||||
if ($this->_file->isDeleted()) {
|
||||
return false;
|
||||
}
|
||||
if ($this->getFormat() == 'audioclip') {
|
||||
return $this->existsFile();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if raw media file exists
|
||||
* @return boolean
|
||||
*/
|
||||
public function existsFile() {
|
||||
|
||||
$filepath = $this->getFilePath();
|
||||
|
||||
if (!isset($filepath) || !file_exists($filepath) || !is_readable($filepath)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if virtual file is currently in use.<br>
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isAccessed()
|
||||
{
|
||||
return ($this->_file->getDbCurrentlyaccessing() > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -824,7 +730,7 @@ class Application_Model_StoredFile {
|
|||
$sql = $selectorRows." FROM ".$fromTable." ORDER BY ".$orderby." OFFSET ".$data["iDisplayStart"]." LIMIT ".$data["iDisplayLength"];
|
||||
}
|
||||
|
||||
Logging::log($sql);
|
||||
//Logging::log($sql);
|
||||
|
||||
$results = $CC_DBC->getAll($sql);
|
||||
|
||||
|
@ -1093,3 +999,4 @@ class Application_Model_StoredFile {
|
|||
}
|
||||
}
|
||||
|
||||
class DeleteScheduledFileException extends Exception {}
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
function addRemove(el) {
|
||||
var id, span;
|
||||
|
||||
id = $(el).attr("id").split("_").pop();
|
||||
|
||||
span = $('<a href="#" id="search_remove_'+id+'" class="ui-button ui-button-icon-only ui-widget ui-state-default"><span class="ui-icon ui-icon-closethick"></span><span class="ui-button-text">Remove</span></a>').click(function(){
|
||||
$(this).parent().parent().remove();
|
||||
});
|
||||
|
||||
$(el).find("dl input").after(span);
|
||||
}
|
||||
|
||||
function ajaxAddRow() {
|
||||
var group_id;
|
||||
|
||||
group_id = $(this).parent().parent().attr("id").split("_").pop();
|
||||
|
||||
var url = '/Search/newfield/format/json';
|
||||
|
||||
$.post(url, {group: group_id}, function(json) {
|
||||
|
||||
var newRow = $(json.html).find("#fieldset-row_"+json.row);
|
||||
addRemove(newRow);
|
||||
|
||||
$("#fieldset-group_"+group_id+" dl:first").append(newRow);
|
||||
});
|
||||
}
|
||||
|
||||
function removeGroup() {
|
||||
$(this).parent().parent().remove();
|
||||
}
|
||||
|
||||
function ajaxAddGroup() {
|
||||
|
||||
var url = '/Search/newgroup/format/json';
|
||||
|
||||
$.post(url, function(json) {
|
||||
|
||||
var group = $(json.html);
|
||||
addRemove(group);
|
||||
group.find('[id$="search_add_row"]').click(ajaxAddRow);
|
||||
group.find('[id$="search_remove_group"]').click(removeGroup);
|
||||
$(".zend_form").append(group);
|
||||
});
|
||||
}
|
||||
|
||||
function advancedSearchSubmit() {
|
||||
var data = $("#advancedSearch form").serializeArray();
|
||||
|
||||
$.post("/Search/index", {format: "json", data: data}, function(json){
|
||||
var x;
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("#search_add_group").click(ajaxAddGroup);
|
||||
$("#search_submit").click(advancedSearchSubmit);
|
||||
|
||||
$('[id$="search_add_row"]').click(ajaxAddRow);
|
||||
$('[id$="search_remove_group"]').click(removeGroup);
|
||||
|
||||
$('[id^="fieldset-row_"]').each(function(i, el){
|
||||
addRemove(el);
|
||||
});
|
||||
});
|
|
@ -1,25 +1,27 @@
|
|||
function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
var AIRTIME = (function(AIRTIME){
|
||||
var mod;
|
||||
|
||||
$(nRow).attr("id", aData["tr_id"]);
|
||||
$(nRow).data("aData", aData);
|
||||
if (AIRTIME.library === undefined) {
|
||||
AIRTIME.library = {}
|
||||
}
|
||||
|
||||
//var oTT = TableTools.fnGetInstance('library_display');
|
||||
//oTT.fnSelect(el);
|
||||
AIRTIME.library.events = {};
|
||||
mod = AIRTIME.library.events;
|
||||
|
||||
/*
|
||||
$(nRow).find('td')
|
||||
.jjmenu("rightClick",
|
||||
[{get:"/Library/context-menu/format/json/id/#id#/type/#type#"}],
|
||||
{id: aData["id"], type: aData["ftype"]},
|
||||
{xposition: "mouse", yposition: "mouse"});
|
||||
*/
|
||||
}
|
||||
mod.fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
var $nRow = $(nRow);
|
||||
|
||||
function fnLibraryTableDrawCallback() {
|
||||
$nRow.attr("id", aData["tr_id"])
|
||||
.data("aData", aData)
|
||||
.data("screen", "playlist");
|
||||
}
|
||||
|
||||
mod.fnDrawCallback = function() {
|
||||
|
||||
$('#library_display tr[id ^= "au"]').draggable({
|
||||
helper: 'clone',
|
||||
/*
|
||||
/* customize the helper on dragging to look like a pl item
|
||||
*
|
||||
helper: function(ev) {
|
||||
var data, li;
|
||||
|
||||
|
@ -34,14 +36,13 @@ function fnLibraryTableDrawCallback() {
|
|||
cursor: 'pointer',
|
||||
connectToSortable: '#spl_sortable'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* @param oTable the datatables instance for the library.
|
||||
*/
|
||||
function setupLibraryToolbar(oLibTable) {
|
||||
mod.setupLibraryToolbar = function( oLibTable ) {
|
||||
var aButtons,
|
||||
oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
fnResetCol;
|
||||
|
||||
fnResetCol = function () {
|
||||
|
@ -58,4 +59,9 @@ function setupLibraryToolbar(oLibTable) {
|
|||
["Add", "library_group_add", true]];
|
||||
|
||||
addToolBarButtonsLibrary(aButtons);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
}(AIRTIME || {}));
|
||||
|
|
|
@ -1,30 +1,35 @@
|
|||
function fnLibraryTableRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
var jRow = $(nRow);
|
||||
var AIRTIME = (function(AIRTIME){
|
||||
var mod;
|
||||
|
||||
jRow.attr("id", aData["tr_id"]);
|
||||
jRow.addClass("lib-sb");
|
||||
if (AIRTIME.library === undefined) {
|
||||
AIRTIME.library = {}
|
||||
}
|
||||
|
||||
//save some info for reordering purposes.
|
||||
jRow.data({"aData": aData});
|
||||
}
|
||||
AIRTIME.library.events = {};
|
||||
mod = AIRTIME.library.events;
|
||||
|
||||
function fnLibraryTableDrawCallback() {
|
||||
mod.fnRowCallback = function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||
var $nRow = $(nRow);
|
||||
|
||||
$nRow.attr("id", aData["tr_id"])
|
||||
.data("aData", aData)
|
||||
.data("screen", "timeline");
|
||||
}
|
||||
|
||||
mod.fnDrawCallback = function() {
|
||||
|
||||
$('#library_display tr:not(:first)').draggable({
|
||||
helper: 'clone',
|
||||
cursor: 'pointer',
|
||||
connectToSortable: '#show_builder_table'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setupLibraryToolbar(oLibTable) {
|
||||
mod.setupLibraryToolbar = function(oLibTable) {
|
||||
var aButtons,
|
||||
fnTest,
|
||||
fnResetCol,
|
||||
fnAddSelectedItems,
|
||||
oSchedTable = $("#show_builder_table").dataTable(),
|
||||
oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
oSchedTT = TableTools.fnGetInstance('show_builder_table');
|
||||
|
||||
fnTest = function() {
|
||||
alert("hi");
|
||||
|
@ -40,7 +45,10 @@ function setupLibraryToolbar(oLibTable) {
|
|||
item,
|
||||
temp,
|
||||
aMediaIds = [],
|
||||
aSchedIds = [];
|
||||
aSchedIds = [],
|
||||
oSchedTable = $("#show_builder_table").dataTable(),
|
||||
oLibTT = TableTools.fnGetInstance('library_display'),
|
||||
oSchedTT = TableTools.fnGetInstance('show_builder_table');;
|
||||
|
||||
//process selected files/playlists.
|
||||
for (item in aData) {
|
||||
|
@ -77,4 +85,8 @@ function setupLibraryToolbar(oLibTable) {
|
|||
["Add", "library_group_add", true, fnAddSelectedItems]];
|
||||
|
||||
addToolBarButtonsLibrary(aButtons);
|
||||
}
|
||||
}
|
||||
|
||||
return AIRTIME;
|
||||
|
||||
}(AIRTIME || {}));
|
|
@ -37,39 +37,6 @@ function disableGroupBtn(btnId) {
|
|||
}
|
||||
}
|
||||
|
||||
function deleteItem(type, id) {
|
||||
var tr_id, tr, dt;
|
||||
|
||||
tr_id = type+"_"+id;
|
||||
tr = $("#"+tr_id);
|
||||
|
||||
dt = $("#library_display").dataTable();
|
||||
dt.fnDeleteRow( tr );
|
||||
}
|
||||
|
||||
function deleteAudioClip(json) {
|
||||
if(json.message) {
|
||||
alert(json.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (json.ids != undefined) {
|
||||
for (var i = json.ids.length - 1; i >= 0; i--) {
|
||||
deleteItem("au", json.ids[i]);
|
||||
}
|
||||
}
|
||||
else if (json.id != undefined) {
|
||||
deleteItem("au", json.id);
|
||||
}
|
||||
location.reload(true);
|
||||
}
|
||||
|
||||
function confirmDeleteGroup() {
|
||||
if(confirm('Are you sure you want to delete the selected items?')){
|
||||
groupDelete();
|
||||
}
|
||||
}
|
||||
|
||||
function checkImportStatus(){
|
||||
$.getJSON('/Preference/is-import-in-progress', function(data){
|
||||
var div = $('#import_status');
|
||||
|
@ -81,40 +48,41 @@ function checkImportStatus(){
|
|||
});
|
||||
}
|
||||
|
||||
function deletePlaylist(json) {
|
||||
if(json.message) {
|
||||
alert(json.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (json.ids != undefined) {
|
||||
for (var i = json.ids.length - 1; i >= 0; i--) {
|
||||
deleteItem("pl", json.ids[i]);
|
||||
}
|
||||
} else if (json.id != undefined) {
|
||||
deleteItem("pl", json.id);
|
||||
}
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
function addProgressIcon(id) {
|
||||
if($("#au_"+id).find("td.library_title").find("span").length > 0){
|
||||
$("#au_"+id).find("td.library_title").find("span").removeClass();
|
||||
$("span[id="+id+"]").addClass("small-icon progress");
|
||||
}else{
|
||||
$("#au_"+id).find("td.library_title").append('<span id="'+id+'" class="small-icon progress"></span>');
|
||||
var tr = $("#au_"+id),
|
||||
span;
|
||||
|
||||
span = tr.find("td.library_title").find("span");
|
||||
|
||||
if (span.length > 0){
|
||||
span.removeClass()
|
||||
.addClass("small-icon progress");
|
||||
}
|
||||
else{
|
||||
tr.find("td.library_title")
|
||||
.append('<span class="small-icon progress"></span>');
|
||||
}
|
||||
}
|
||||
|
||||
function checkSCUploadStatus(){
|
||||
var url = '/Library/get-upload-to-soundcloud-status/format/json';
|
||||
|
||||
var url = '/Library/get-upload-to-soundcloud-status';
|
||||
|
||||
$("span[class*=progress]").each(function(){
|
||||
var id = $(this).attr("id");
|
||||
var span, id;
|
||||
|
||||
span = $(this);
|
||||
id = span.parentsUntil('tr').attr("id").split("_").pop();
|
||||
|
||||
$.post(url, {format: "json", id: id, type:"file"}, function(json){
|
||||
if(json.sc_id > 0){
|
||||
$("span[id="+id+"]").removeClass("progress").addClass("soundcloud");
|
||||
}else if(json.sc_id == "-3"){
|
||||
$("span[id="+id+"]").removeClass("progress").addClass("sc-error");
|
||||
if (json.sc_id > 0) {
|
||||
span.removeClass("progress")
|
||||
.addClass("soundcloud");
|
||||
|
||||
}
|
||||
else if (json.sc_id == "-3") {
|
||||
span.removeClass("progress")
|
||||
.addClass("sc-error");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -280,10 +248,9 @@ function createDataTable(data) {
|
|||
"success": testCallback
|
||||
} );
|
||||
},
|
||||
"fnRowCallback": fnLibraryTableRowCallback,
|
||||
"fnRowCallback": AIRTIME.library.events.fnRowCallback,
|
||||
"fnCreatedRow": fnCreatedRow,
|
||||
"fnCreatedRowCallback": fnCreatedRow,
|
||||
"fnDrawCallback": fnLibraryTableDrawCallback,
|
||||
"fnDrawCallback": AIRTIME.library.events.fnDrawCallback,
|
||||
"fnHeaderCallback": function(nHead) {
|
||||
$(nHead).find("input[type=checkbox]").attr("checked", false);
|
||||
},
|
||||
|
@ -353,7 +320,7 @@ function createDataTable(data) {
|
|||
});
|
||||
oTable.fnSetFilteringDelay(350);
|
||||
|
||||
setupLibraryToolbar(oTable);
|
||||
AIRTIME.library.events.setupLibraryToolbar(oTable);
|
||||
|
||||
$('[name="pl_cb_all"]').click(function(){
|
||||
var oTT = TableTools.fnGetInstance('library_display');
|
||||
|
@ -385,9 +352,11 @@ $(document).ready(function() {
|
|||
ignoreRightClick: true,
|
||||
|
||||
build: function($el, e) {
|
||||
var x, request, data, items, callback;
|
||||
var x, request, data, screen, items, callback, $tr;
|
||||
|
||||
data = $el.parent().data("aData");
|
||||
$tr = $el.parent();
|
||||
data = $tr.data("aData");
|
||||
screen = $tr.data("screen");
|
||||
|
||||
function processMenuItems(oItems) {
|
||||
|
||||
|
@ -400,11 +369,46 @@ $(document).ready(function() {
|
|||
};
|
||||
}
|
||||
else {
|
||||
|
||||
callback = function() {
|
||||
AIRTIME.playlist.fnEdit(data.id);
|
||||
};
|
||||
}
|
||||
oItems.edit.callback = callback;
|
||||
}
|
||||
|
||||
//define a delete callback.
|
||||
if (oItems.del !== undefined) {
|
||||
|
||||
//delete through the playlist controller, will reset
|
||||
//playlist screen if this is the currently edited playlist.
|
||||
if (data.ftype === "playlist" && screen === "playlist") {
|
||||
callback = function() {
|
||||
|
||||
if (confirm('Are you sure you want to delete the selected item?')) {
|
||||
AIRTIME.playlist.fnDelete(data.id);
|
||||
}
|
||||
};
|
||||
}
|
||||
else {
|
||||
callback = function() {
|
||||
var media = [];
|
||||
|
||||
if (confirm('Are you sure you want to delete the selected item?')) {
|
||||
|
||||
media.push({"id": data.id, "type": data.ftype});
|
||||
$.post(oItems.del.url, {format: "json", media: media }, function(json){
|
||||
var oTable, tr;
|
||||
|
||||
oTable = $("#library_display").dataTable();
|
||||
oTable.fnDeleteRow( $tr[0] );
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
oItems.del.callback = callback;
|
||||
}
|
||||
|
||||
//define a download callback.
|
||||
if (oItems.download !== undefined) {
|
||||
|
||||
|
@ -444,7 +448,7 @@ $(document).ready(function() {
|
|||
request = $.ajax({
|
||||
url: "/library/context-menu",
|
||||
type: "GET",
|
||||
data: {id : data.id, type: data.ftype, format: "json"},
|
||||
data: {id : data.id, type: data.ftype, format: "json", "screen": screen},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json){
|
||||
|
@ -452,16 +456,7 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
// this callback is executed every time the menu is to be shown
|
||||
// its results are destroyed every time the menu is hidden
|
||||
// e is the original contextmenu event, containing e.pageX and e.pageY (amongst other data)
|
||||
return {
|
||||
callback: function(key, options) {
|
||||
var m = "clicked: " + key;
|
||||
window.console && console.log(m) || alert(m);
|
||||
},
|
||||
items: items,
|
||||
determinePosition : function($menu, x, y) {
|
||||
$menu.css('display', 'block')
|
||||
|
|
|
@ -538,15 +538,26 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
}
|
||||
|
||||
mod.fnEdit = function() {
|
||||
mod.fnEdit = function(id) {
|
||||
var url;
|
||||
|
||||
stopAudioPreview();
|
||||
|
||||
url = '/Playlist/edit';
|
||||
|
||||
$.post(url,
|
||||
{format: "json", id: id},
|
||||
function(json){
|
||||
openPlaylist(json);
|
||||
//redrawLib();
|
||||
});
|
||||
}
|
||||
|
||||
mod.fnDelete = function() {
|
||||
mod.fnDelete = function(plid) {
|
||||
var url, id, lastMod;
|
||||
|
||||
stopAudioPreview();
|
||||
id = getId();
|
||||
id = (plid === undefined) ? getId() : plid;
|
||||
lastMod = getModified();
|
||||
url = '/Playlist/delete';
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue