Merge branch 'saas-dev-publishing' of https://github.com/sourcefabric/Airtime into saas-dev-publishing

This commit is contained in:
drigato 2015-09-21 07:08:55 -04:00
commit 3db20bd3b5
7 changed files with 50 additions and 9 deletions

View File

@ -169,6 +169,12 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
// we need to check the CSRF token // we need to check the CSRF token
if ($_SERVER['REQUEST_METHOD'] != "GET" && $request->getModuleName() == "rest") { if ($_SERVER['REQUEST_METHOD'] != "GET" && $request->getModuleName() == "rest") {
$token = $request->getParam("csrf_token"); $token = $request->getParam("csrf_token");
// PUT requests don't parameterize the data in the body, so we can't
// fetch it with getParam or getPost; instead we have to parse the body and
// check for the token in the JSON. (Hopefully we can find a better way to do this) -- Duncan
if (empty($token)) {
$token = json_decode($this->getRequest()->getRawBody(), true)["csrf_token"];
}
$tokenValid = $this->verifyCSRFToken($token); $tokenValid = $this->verifyCSRFToken($token);
if (!$tokenValid) { if (!$tokenValid) {

View File

@ -1,4 +1,4 @@
<div id="podcast-wrapper" ng-controller="RestController"> <div class="podcast-wrapper" ng-controller="RestController">
<div class="inner_editor_title"> <div class="inner_editor_title">
<h2> <h2>
<?php echo _("Editing ") ?>"<span ng-bind="podcast.title" class="title_obj_name"></span>" <?php echo _("Editing ") ?>"<span ng-bind="podcast.title" class="title_obj_name"></span>"
@ -29,6 +29,6 @@
<?php echo _("Save") ?> <?php echo _("Save") ?>
</button> </button>
</div> </div>
<div id='sp-success' class='success' style='display:none'></span></div> <div class='success' style='display:none'></span></div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
<div id="podcast_url_dialog"> <div id="podcast_url_dialog">
<form> <form name="podcast_url_form">
<?php echo $this->csrf ?> <?php echo $this->csrf ?>
<label> <label>
Podcast URL Podcast URL

View File

@ -463,7 +463,7 @@ li.ui-state-default {
font-size: 14px; font-size: 14px;
} }
.editor_pane_wrapper { .editor_pane_wrapper, .podcast-wrapper {
display: -webkit-box; display: -webkit-box;
display: -moz-box; display: -moz-box;
display: -ms-flexbox; display: -ms-flexbox;

View File

@ -3914,5 +3914,16 @@ li .ui-state-hover {
float: left; float: left;
} }
/* Podcasts */
.podcast-wrapper > .dataTables_wrapper {
position: relative;
height: 100%;
float: left;
flex: 1 100%;
margin: 4px 0;
min-height: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

View File

@ -7,9 +7,8 @@ var podcastApp = angular.module('podcast', [])
AIRTIME.tabs.setActiveTabName($scope.podcast.title); AIRTIME.tabs.setActiveTabName($scope.podcast.title);
$scope.put = function() { $scope.put = function() {
$http.put(endpoint + $scope.podcast.id, { csrf_token: $("#csrf").val(), podcast: $scope.podcast }) $http.put(endpoint + $scope.podcast.id, { csrf_token: jQuery("#csrf").val(), podcast: $scope.podcast })
.success(function() { .success(function() {
AIRTIME.tabs.setActiveTabName($scope.podcast.title);
// TODO // TODO
}); });
}; };
@ -43,7 +42,7 @@ var AIRTIME = (function (AIRTIME) {
function _bootstrapAngularApp(podcast) { function _bootstrapAngularApp(podcast) {
podcastApp.value('podcast', JSON.parse(podcast)); podcastApp.value('podcast', JSON.parse(podcast));
angular.bootstrap(document.getElementById("podcast-wrapper"), ["podcast"]); angular.bootstrap(AIRTIME.tabs.getActiveTab().find(".podcast-wrapper").get(0), ["podcast"]);
} }
mod.createUrlDialog = function() { mod.createUrlDialog = function() {
@ -64,6 +63,7 @@ var AIRTIME = (function (AIRTIME) {
AIRTIME.tabs.openTab(json, AIRTIME.podcast.init); AIRTIME.tabs.openTab(json, AIRTIME.podcast.init);
_bootstrapAngularApp(json.podcast); _bootstrapAngularApp(json.podcast);
$("#podcast_url_dialog").dialog("close"); $("#podcast_url_dialog").dialog("close");
mod.initPodcastEpisodeDatatable(JSON.parse(el.podcast).episodes);
}); });
}; };
@ -72,6 +72,7 @@ var AIRTIME = (function (AIRTIME) {
json.forEach(function(el) { json.forEach(function(el) {
AIRTIME.tabs.openTab(el, AIRTIME.podcast.init); AIRTIME.tabs.openTab(el, AIRTIME.podcast.init);
_bootstrapAngularApp(el.podcast); _bootstrapAngularApp(el.podcast);
mod.initPodcastEpisodeDatatable(JSON.parse(el.podcast).episodes);
}); });
}); });
}; };
@ -110,5 +111,27 @@ var AIRTIME = (function (AIRTIME) {
}); });
}; };
mod.initPodcastEpisodeDatatable = function(episodes) {
var aoColumns = [
/* Title */ { "sTitle" : $.i18n._("Title") , "mDataProp" : "title" , "sClass" : "library_title" , "sWidth" : "170px" },
];
var podcastToolbarButtons = AIRTIME.widgets.Table.getStandardToolbarButtons();
// Set up the div with id "podcast_table" as a datatable.
mod.podcastEpisodesTableWidget = new AIRTIME.widgets.Table(
AIRTIME.tabs.getActiveTab().find('.podcast_episodes'), // DOM node to create the table inside.
true, // Enable item selection
podcastToolbarButtons, // Toolbar buttons
{ // Datatables overrides.
'aoColumns' : aoColumns,
'bServerSide': false,
'sAjaxSource' : null,
'aaData' : episodes
});
mod.podcastEpisodesDatatable = mod.podcastEpisodesTableWidget.getDatatable();
};
return AIRTIME; return AIRTIME;
}(AIRTIME || {})); }(AIRTIME || {}));

View File

@ -257,7 +257,8 @@ var AIRTIME = (function(AIRTIME) {
console.log("clicked row not detected as already selected"); console.log("clicked row not detected as already selected");
} }
if (foundAtIdx >= 0 && self._selectedRows.length > 1) { //If the clicked row is already selected, deselect it.
if (foundAtIdx >= 0 && self._selectedRows.length >= 1) {
self._selectedRows.splice(foundAtIdx, 1); self._selectedRows.splice(foundAtIdx, 1);
$nRow.removeClass('selected'); $nRow.removeClass('selected');
$nRow.find('input.airtime_table_checkbox').attr('checked', false); $nRow.find('input.airtime_table_checkbox').attr('checked', false);