Work on station podcast editor view

This commit is contained in:
Duncan Sommerville 2015-10-21 19:21:52 -04:00
parent 6580c12ad3
commit 814fc67e90
3 changed files with 11 additions and 3 deletions

View file

@ -176,18 +176,22 @@ class Rest_PodcastController extends Zend_Rest_Controller
$ids = $this->_getParam('ids', []); $ids = $this->_getParam('ids', []);
$method = $this->_getParam('method', 'GET'); $method = $this->_getParam('method', 'GET');
$path = 'podcast/podcast.phtml';
$responseBody = []; $responseBody = [];
switch($method) { switch($method) {
case "DELETE": case "DELETE":
foreach($ids as $id) { foreach($ids as $id) {
Application_Service_PodcastService::deletePodcastById($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; break;
case "GET": case "GET":
foreach($ids as $id) { 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); $podcast = Application_Service_PodcastService::getPodcastById($id);
$responseBody[] = array( $responseBody[] = array(
"podcast"=>json_encode($podcast), "podcast"=>json_encode($podcast),

View file

@ -309,7 +309,9 @@ class Application_Service_PodcastService
self::removePrivateFields($data["podcast"]); self::removePrivateFields($data["podcast"]);
self::validatePodcastMetadata($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->fromArray($data["podcast"], BasePeer::TYPE_FIELDNAME);
$podcast->save(); $podcast->save();

View file

@ -26,6 +26,8 @@ var AIRTIME = (function (AIRTIME) {
$http.put(endpoint + $scope.podcast.id, { csrf_token: jQuery("#csrf").val(), podcast: podcastData }) $http.put(endpoint + $scope.podcast.id, { csrf_token: jQuery("#csrf").val(), podcast: podcastData })
.success(function() { .success(function() {
episodeTable.reload($scope.podcast.id); episodeTable.reload($scope.podcast.id);
AIRTIME.library.podcastDataTable.fnDraw();
tab.setName($scope.podcast.title);
}); });
}; };