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('set-num-entries', 'json')
|
||||
->addActionContext('edit-file-md', 'json')
|
||||
->addActionContext('publish-dialog', 'html')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -120,7 +121,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
|
||||
$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}");
|
||||
}
|
||||
|
||||
|
@ -182,7 +183,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
if ($obj_sess->id !== $id && $screen == "playlist") {
|
||||
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 ($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");
|
||||
}
|
||||
|
@ -451,4 +452,10 @@ class LibraryController extends Zend_Controller_Action
|
|||
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
|
||||
$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/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->headLink()->appendStylesheet($baseUrl.'css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
|
|
|
@ -1174,13 +1174,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
if (oItems.publish !== undefined) {
|
||||
if (data.ftype === "audioclip") {
|
||||
callback = function() {
|
||||
alert("TODO: Publish track with ID " + data.id);
|
||||
|
||||
/*
|
||||
$.get(oItems.publish.url, {format: "json"}, function(json){
|
||||
//AIRTIME.playlist.fileMdEdit(json);
|
||||
alert("derp");
|
||||
});*/
|
||||
AIRTIME.publish.publishTrack(data.id);
|
||||
};
|
||||
}
|
||||
oItems.publish.callback = callback;
|
||||
|
|
|
@ -1,7 +1,23 @@
|
|||
|
||||
var AIRTIME = (function (AIRTIME) {
|
||||
var mod;
|
||||
|
||||
|
||||
if (AIRTIME.podcast === undefined) {
|
||||
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);
|
||||
|
||||
|
@ -18,15 +34,6 @@ var podcastApp = angular.module('podcast', [])
|
|||
};
|
||||
});
|
||||
|
||||
var AIRTIME = (function (AIRTIME) {
|
||||
var mod;
|
||||
|
||||
if (AIRTIME.podcast === undefined) {
|
||||
AIRTIME.podcast = {};
|
||||
}
|
||||
|
||||
mod = AIRTIME.podcast;
|
||||
|
||||
function _bulkAction(method, callback) {
|
||||
var selected = $("#podcast_table").find(".selected"),
|
||||
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