SAAS-1208, SAAS-1209 - fix preferences and my podcast settings pages
This commit is contained in:
parent
28d378abfa
commit
38d08a5661
|
@ -51,20 +51,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
|
||||
Application_Model_Preference::setRadioPageDisplayLoginButton($values["radioPageLoginButton"]);
|
||||
|
||||
if (!Application_Model_Preference::getStationPodcastPrivacy() && $values["stationPodcastPrivacy"] == 1) {
|
||||
// Refresh the download key when enabling privacy
|
||||
Application_Model_Preference::setStationPodcastDownloadKey();
|
||||
}
|
||||
|
||||
// Append sharing token (download key) to Station podcast URL
|
||||
$stationPodcast = PodcastQuery::create()->findOneByDbId(Application_Model_Preference::getStationPodcastId());
|
||||
$key = Application_Model_Preference::getStationPodcastDownloadKey();
|
||||
$url = Application_Common_HTTPHelper::getStationUrl() .
|
||||
(((int) $values["stationPodcastPrivacy"]) ? "feeds/station-rss?sharing_token=$key" : "feeds/station-rss");
|
||||
$stationPodcast->setDbUrl($url)->save();
|
||||
Application_Model_Preference::setStationPodcastPrivacy($values["stationPodcastPrivacy"]);
|
||||
|
||||
|
||||
$logoUploadElement = $form->getSubForm('preferences_general')->getElement('stationLogo');
|
||||
$logoUploadElement->receive();
|
||||
$imagePath = $logoUploadElement->getFileName();
|
||||
|
@ -97,6 +83,28 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
public function stationPodcastSettingsAction() {
|
||||
$this->view->layout()->disableLayout();
|
||||
$this->_helper->viewRenderer->setNoRender(true);
|
||||
|
||||
$values = json_decode($this->getRequest()->getRawBody());
|
||||
|
||||
if (!Application_Model_Preference::getStationPodcastPrivacy() && $values->stationPodcastPrivacy == 1) {
|
||||
// Refresh the download key when enabling privacy
|
||||
Application_Model_Preference::setStationPodcastDownloadKey();
|
||||
}
|
||||
|
||||
// Append sharing token (download key) to Station podcast URL
|
||||
$stationPodcast = PodcastQuery::create()->findOneByDbId(Application_Model_Preference::getStationPodcastId());
|
||||
$key = Application_Model_Preference::getStationPodcastDownloadKey();
|
||||
$url = Application_Common_HTTPHelper::getStationUrl() .
|
||||
(((int) $values->stationPodcastPrivacy) ? "feeds/station-rss?sharing_token=$key" : "feeds/station-rss");
|
||||
$stationPodcast->setDbUrl($url)->save();
|
||||
Application_Model_Preference::setStationPodcastPrivacy($values->stationPodcastPrivacy);
|
||||
|
||||
$this->_helper->json->sendJson(array("url" => $url));
|
||||
}
|
||||
|
||||
public function supportSettingAction()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
|
|
@ -5,9 +5,13 @@
|
|||
<h2>
|
||||
<span class="title_obj_name"><?php echo _("My Podcast") ?></span>
|
||||
</h2>
|
||||
<button ng-click="savePodcast()" class="btn" title='<?php echo _("Save station podcast") ?>' type="button">
|
||||
<?php echo _("Save") ?>
|
||||
</button>
|
||||
<a href="{{podcast.url}}" target="_blank">
|
||||
<button class="btn"><?php echo _("View Feed") ?></button>
|
||||
</a>
|
||||
<div class='success' style='display:none'></div>
|
||||
</div>
|
||||
<form class="podcast-metadata">
|
||||
<?php echo $this->form->getElement('csrf') ?>
|
||||
|
@ -87,7 +91,7 @@
|
|||
<?php echo _("Save") ?>
|
||||
</button>
|
||||
</div>
|
||||
<div class='success' style='display:none'></span></div>
|
||||
<div class='success' style='display:none'></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -4001,6 +4001,10 @@ li .ui-state-hover {
|
|||
flex: 1 100%;
|
||||
}
|
||||
|
||||
.station_podcast_wrapper {
|
||||
min-width: 50%;
|
||||
}
|
||||
|
||||
.angular_wrapper legend {
|
||||
background-color: #242424;
|
||||
color: #efefef;
|
||||
|
|
|
@ -34,14 +34,18 @@ var AIRTIME = (function (AIRTIME) {
|
|||
$scope.csrf = jQuery("#csrf").val();
|
||||
view.find("table").attr("id", "podcast_episodes_" + podcast.id);
|
||||
|
||||
self.onSaveCallback = function () {
|
||||
AIRTIME.library.podcastDataTable.fnDraw();
|
||||
tab.close();
|
||||
};
|
||||
|
||||
/**
|
||||
* Save and update the podcast object.
|
||||
*/
|
||||
$scope.savePodcast = function () {
|
||||
$http.put(endpoint + $scope.podcast.id, {csrf_token: $scope.csrf, podcast: $scope.podcast})
|
||||
.success(function () {
|
||||
AIRTIME.library.podcastDataTable.fnDraw();
|
||||
!tab || tab.close();
|
||||
self.onSaveCallback();
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -96,7 +100,20 @@ var AIRTIME = (function (AIRTIME) {
|
|||
function StationPodcastController($scope, $http, podcast, tab) {
|
||||
// Super call to parent controller
|
||||
PodcastController.call(this, $scope, $http, podcast, tab);
|
||||
|
||||
this.onSaveCallback = function () {
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: '/preference/station-podcast-settings',
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||
data: { stationPodcastPrivacy: $("#podcast-settings").find("input:checked").val() }
|
||||
}).success(function (data) {
|
||||
$("#preferences_podcast-stationPodcastFeedUrl").val(data.url);
|
||||
$(".success").text($.i18n._("Podcast settings saved")).slideDown("fast");
|
||||
setTimeout(function () {
|
||||
$(".success").slideUp("fast");
|
||||
}, 2000);
|
||||
});
|
||||
};
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue