SAAS-1208, SAAS-1209 - fix preferences and my podcast settings pages

This commit is contained in:
Duncan Sommerville 2015-11-16 14:23:08 -05:00
parent 28d378abfa
commit 38d08a5661
4 changed files with 51 additions and 18 deletions

View file

@ -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();