SAAS-1064: Publish action for library context menu
This commit is contained in:
parent
50996a081f
commit
ed33714340
|
@ -18,6 +18,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
->addActionContext('get-file-metadata', 'html')
|
->addActionContext('get-file-metadata', 'html')
|
||||||
->addActionContext('set-num-entries', 'json')
|
->addActionContext('set-num-entries', 'json')
|
||||||
->addActionContext('edit-file-md', 'json')
|
->addActionContext('edit-file-md', 'json')
|
||||||
|
->addActionContext('publish-dialog', 'html')
|
||||||
->initContext();
|
->initContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +121,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
|
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
|
||||||
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete");
|
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete");
|
||||||
$menu["edit"] = array("name"=> _("Edit Metadata"), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
|
$menu["edit"] = array("name"=> _("Edit..."), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
|
||||||
$menu["publish"] = array("name"=> _("Publish..."), "icon" => "soundcloud", "url" => $baseUrl."library/publish/id/{$id}");
|
$menu["publish"] = array("name"=> _("Publish..."), "icon" => "soundcloud", "url" => $baseUrl."library/publish/id/{$id}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
|
|
||||||
if ($obj_sess->id !== $id && $screen == "playlist") {
|
if ($obj_sess->id !== $id && $screen == "playlist") {
|
||||||
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
||||||
$menu["edit"] = array("name"=> _("Edit"), "icon" => "edit");
|
$menu["edit"] = array("name"=> _("Edit..."), "icon" => "edit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +205,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) {
|
||||||
if ($screen == "playlist") {
|
if ($screen == "playlist") {
|
||||||
$menu["edit"] = array("name"=> _("Edit"), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
|
$menu["edit"] = array("name"=> _("Edit..."), "icon" => "edit", "url" => $baseUrl."library/edit-file-md/id/{$id}");
|
||||||
}
|
}
|
||||||
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete");
|
$menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."library/delete");
|
||||||
}
|
}
|
||||||
|
@ -451,4 +452,10 @@ class LibraryController extends Zend_Controller_Action
|
||||||
Logging::info($e->getMessage());
|
Logging::info($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function publishDialogAction() {
|
||||||
|
$this->_helper->layout->disableLayout();
|
||||||
|
|
||||||
|
//This just spits out publish-dialog.phtml!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
// MEDIA BUILDER
|
// MEDIA BUILDER
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/podcast.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/podcast.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/publish.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/playlist/smart_blockbuilder.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
|
||||||
|
|
|
@ -1174,13 +1174,7 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
if (oItems.publish !== undefined) {
|
if (oItems.publish !== undefined) {
|
||||||
if (data.ftype === "audioclip") {
|
if (data.ftype === "audioclip") {
|
||||||
callback = function() {
|
callback = function() {
|
||||||
alert("TODO: Publish track with ID " + data.id);
|
AIRTIME.publish.publishTrack(data.id);
|
||||||
|
|
||||||
/*
|
|
||||||
$.get(oItems.publish.url, {format: "json"}, function(json){
|
|
||||||
//AIRTIME.playlist.fileMdEdit(json);
|
|
||||||
alert("derp");
|
|
||||||
});*/
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
oItems.publish.callback = callback;
|
oItems.publish.callback = callback;
|
||||||
|
|
|
@ -1,32 +1,39 @@
|
||||||
var endpoint = 'rest/podcast/';
|
|
||||||
|
|
||||||
var podcastApp = angular.module('podcast', [])
|
|
||||||
.controller('RestController', function($scope, $http, podcast) {
|
|
||||||
$scope.podcast = podcast;
|
|
||||||
AIRTIME.tabs.setActiveTabName($scope.podcast.title);
|
|
||||||
|
|
||||||
$scope.savePodcast = function() {
|
|
||||||
$http.put(endpoint + $scope.podcast.id, { csrf_token: jQuery("#csrf").val(), podcast: $scope.podcast })
|
|
||||||
.success(function() {
|
|
||||||
// TODO
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.discard = function() {
|
|
||||||
AIRTIME.tabs.getActiveTab().close();
|
|
||||||
$scope.podcast = {};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
var AIRTIME = (function (AIRTIME) {
|
var AIRTIME = (function (AIRTIME) {
|
||||||
var mod;
|
var mod;
|
||||||
|
|
||||||
|
|
||||||
if (AIRTIME.podcast === undefined) {
|
if (AIRTIME.podcast === undefined) {
|
||||||
AIRTIME.podcast = {};
|
AIRTIME.podcast = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
mod = AIRTIME.podcast;
|
mod = AIRTIME.podcast;
|
||||||
|
|
||||||
|
var endpoint = 'rest/podcast/';
|
||||||
|
|
||||||
|
//AngularJS app
|
||||||
|
var podcastApp = angular.module('podcast', [])
|
||||||
|
.controller('RestController', function($scope, $http, podcast) {
|
||||||
|
|
||||||
|
//We take a podcast object in as a parameter rather fetching the podcast by ID here because
|
||||||
|
//when you're creating a new podcast, we already have the object from the result of the POST. We're saving
|
||||||
|
//a roundtrip by not fetching it again here.
|
||||||
|
$scope.podcast = podcast;
|
||||||
|
AIRTIME.tabs.setActiveTabName($scope.podcast.title);
|
||||||
|
|
||||||
|
$scope.savePodcast = function() {
|
||||||
|
$http.put(endpoint + $scope.podcast.id, { csrf_token: jQuery("#csrf").val(), podcast: $scope.podcast })
|
||||||
|
.success(function() {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.discard = function() {
|
||||||
|
AIRTIME.tabs.getActiveTab().close();
|
||||||
|
$scope.podcast = {};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
function _bulkAction(method, callback) {
|
function _bulkAction(method, callback) {
|
||||||
var selected = $("#podcast_table").find(".selected"),
|
var selected = $("#podcast_table").find(".selected"),
|
||||||
ids = [];
|
ids = [];
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
|
||||||
|
var AIRTIME = (function (AIRTIME) {
|
||||||
|
var mod;
|
||||||
|
|
||||||
|
if (AIRTIME.publish === undefined) {
|
||||||
|
AIRTIME.publish = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
mod = AIRTIME.publish;
|
||||||
|
|
||||||
|
var endpoint = 'rest/media/';
|
||||||
|
var dialogUrl = 'library/publish-dialog';
|
||||||
|
var PUBLISH_APP_NAME = 'publish';
|
||||||
|
|
||||||
|
|
||||||
|
//AngularJS app
|
||||||
|
var publishApp = angular.module(PUBLISH_APP_NAME, [])
|
||||||
|
.controller('RestController', function($scope, $http, mediaId) {
|
||||||
|
|
||||||
|
$http.get(endpoint + mediaId, { csrf_token: jQuery("#csrf").val() })
|
||||||
|
.success(function(json) {
|
||||||
|
console.log(json);
|
||||||
|
$scope.media = json;
|
||||||
|
AIRTIME.tabs.setActiveTabName($scope.media.track_title);
|
||||||
|
});
|
||||||
|
|
||||||
|
$scope.save = function() {
|
||||||
|
$http.put(endpoint + $scope.media.id, { csrf_token: jQuery("#csrf").val(), media: $scope.media })
|
||||||
|
.success(function() {
|
||||||
|
// TODO
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.discard = function() {
|
||||||
|
AIRTIME.tabs.getActiveTab().close();
|
||||||
|
$scope.media = {};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
var selected = $("#podcast_table").find(".selected"),
|
||||||
|
ids = [];
|
||||||
|
var selectedData = AIRTIME.library.podcastTableWidget.getSelectedRows();
|
||||||
|
selectedData.forEach(function(el) {
|
||||||
|
ids.push(el.id);
|
||||||
|
});*/
|
||||||
|
|
||||||
|
function _bootstrapAngularApp(mediaId) {
|
||||||
|
publishApp.value('mediaId', mediaId);
|
||||||
|
var wrapper = AIRTIME.tabs.getActiveTab().contents.find(".editor_pane_wrapper");
|
||||||
|
wrapper.attr("ng-controller", "RestController");
|
||||||
|
angular.bootstrap(wrapper.get(0), [PUBLISH_APP_NAME]);
|
||||||
|
}
|
||||||
|
|
||||||
|
mod.publishSelectedTracks = function() {
|
||||||
|
/*
|
||||||
|
_bulkAction("GET", function(json) {
|
||||||
|
json.forEach(function(el) {
|
||||||
|
var uid = AIRTIME.library.MediaTypeStringEnum.FILE+"_"+el.id;
|
||||||
|
var mediaId = el.id;
|
||||||
|
|
||||||
|
$http.get(dialogUrl, { csrf_token: jQuery("#csrf").val() })
|
||||||
|
.success(function(json) {
|
||||||
|
|
||||||
|
AIRTIME.tabs.openTab(json, uid, null);
|
||||||
|
_bootstrapAngularApp(mediaId);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});*/
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
mod.publishTrack = function(mediaId) {
|
||||||
|
|
||||||
|
jQuery.get(dialogUrl, { csrf_token: jQuery("#csrf").val() })
|
||||||
|
.success(function(html) {
|
||||||
|
|
||||||
|
var jsonWrapper = {'html' : html}; //Silly wrapper to make the openTab function happy
|
||||||
|
AIRTIME.tabs.openTab(jsonWrapper, mediaId);
|
||||||
|
_bootstrapAngularApp(mediaId);
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
_bulkAction("GET", function(json) {
|
||||||
|
json.forEach(function(el) {
|
||||||
|
var uid = AIRTIME.library.MediaTypeStringEnum.FILE+"_"+el.id;
|
||||||
|
|
||||||
|
$http.get(dialogUrl, { csrf_token: jQuery("#csrf").val() })
|
||||||
|
.success(function(json) {
|
||||||
|
|
||||||
|
AIRTIME.tabs.openTab(json, uid, null);
|
||||||
|
_bootstrapAngularApp(el.media);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});*/
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
return AIRTIME;
|
||||||
|
}(AIRTIME || {}));
|
Loading…
Reference in New Issue