From 814fc67e9016dbbc9eeb1cadf0a0e327f0a85e6f Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Wed, 21 Oct 2015 19:21:52 -0400 Subject: [PATCH] Work on station podcast editor view --- .../modules/rest/controllers/PodcastController.php | 8 ++++++-- airtime_mvc/application/services/PodcastService.php | 4 +++- airtime_mvc/public/js/airtime/library/podcast.js | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/modules/rest/controllers/PodcastController.php b/airtime_mvc/application/modules/rest/controllers/PodcastController.php index 96b362c48..ccdd139a2 100644 --- a/airtime_mvc/application/modules/rest/controllers/PodcastController.php +++ b/airtime_mvc/application/modules/rest/controllers/PodcastController.php @@ -176,18 +176,22 @@ class Rest_PodcastController extends Zend_Rest_Controller $ids = $this->_getParam('ids', []); $method = $this->_getParam('method', 'GET'); - $path = 'podcast/podcast.phtml'; $responseBody = []; switch($method) { case "DELETE": foreach($ids as $id) { Application_Service_PodcastService::deletePodcastById($id); - $responseBody = "Success"; // TODO: make this more descriptive } + // XXX: do we need this to be more descriptive? + $responseBody = "Successfully deleted podcasts"; break; case "GET": foreach($ids as $id) { + // Check the StationPodcast table rather than checking + // the station podcast ID key in preferences for extensibility + $podcast = StationPodcastQuery::create()->findOneByDbPodcastId($id); + $path = $podcast ? 'podcast/station_podcast.phtml' : 'podcast/podcast.phtml'; $podcast = Application_Service_PodcastService::getPodcastById($id); $responseBody[] = array( "podcast"=>json_encode($podcast), diff --git a/airtime_mvc/application/services/PodcastService.php b/airtime_mvc/application/services/PodcastService.php index 8991d8dcf..2ba264ff8 100644 --- a/airtime_mvc/application/services/PodcastService.php +++ b/airtime_mvc/application/services/PodcastService.php @@ -309,7 +309,9 @@ class Application_Service_PodcastService self::removePrivateFields($data["podcast"]); self::validatePodcastMetadata($data["podcast"]); - self::_updateAutoIngestTimestamp($podcast, $data); + if (array_key_exists("auto_ingest", $data["podcast"])) { + self::_updateAutoIngestTimestamp($podcast, $data); + } $podcast->fromArray($data["podcast"], BasePeer::TYPE_FIELDNAME); $podcast->save(); diff --git a/airtime_mvc/public/js/airtime/library/podcast.js b/airtime_mvc/public/js/airtime/library/podcast.js index 0c49185cc..5dcee4af1 100644 --- a/airtime_mvc/public/js/airtime/library/podcast.js +++ b/airtime_mvc/public/js/airtime/library/podcast.js @@ -26,6 +26,8 @@ var AIRTIME = (function (AIRTIME) { $http.put(endpoint + $scope.podcast.id, { csrf_token: jQuery("#csrf").val(), podcast: podcastData }) .success(function() { episodeTable.reload($scope.podcast.id); + AIRTIME.library.podcastDataTable.fnDraw(); + tab.setName($scope.podcast.title); }); };