* Wrap station podcast feed contents on radio page in displayRssTab check

* Test fix for automatic ingest bug
* Move disable layout code in feeds controller to avoid error case
This commit is contained in:
Duncan Sommerville 2015-10-28 10:58:22 -04:00
parent 09efacf4d5
commit cc9f1ea6d0
4 changed files with 12 additions and 5 deletions

View file

@ -51,12 +51,11 @@ class PodcastManager {
$episodeList = $podcastArray["episodes"]; $episodeList = $podcastArray["episodes"];
$episodes = array(); $episodes = array();
// Sort the episodes by publication date to get the most recent // Sort the episodes by publication date to get the most recent
usort($episodeList, array(static::class, "_sortByEpisodePubDate")); // usort($episodeList, array(static::class, "_sortByEpisodePubDate"));
for ($i = 0; $i < sizeof($episodeList); $i++) { for ($i = 0; $i < sizeof($episodeList); $i++) {
$episodeData = $episodeList[$i]; $episodeData = $episodeList[$i];
// If the publication date of this episode is before the ingest timestamp, we don't need to ingest it // If the publication date of this episode is before the ingest timestamp, we don't need to ingest it
// Since we're sorting by publication date, we can break if (strtotime($episodeData["pub_date"]) < strtotime($podcast->getDbAutoIngestTimestamp())) continue;
if (strtotime($episodeData["pub_date"]) < strtotime($podcast->getDbAutoIngestTimestamp())) break;
$episode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episodeData["guid"]); $episode = PodcastEpisodesQuery::create()->findOneByDbEpisodeGuid($episodeData["guid"]);
// Make sure there's no existing episode placeholder or import, and that the data is non-empty // Make sure there's no existing episode placeholder or import, and that the data is non-empty
if (empty($episode) && !empty($episodeData)) { if (empty($episode) && !empty($episodeData)) {

View file

@ -4,14 +4,15 @@ class FeedsController extends Zend_Controller_Action
{ {
public function stationRssAction() public function stationRssAction()
{ {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if (Application_Model_Preference::getStationPodcastPrivacy() if (Application_Model_Preference::getStationPodcastPrivacy()
&& $this->getRequest()->getParam("sharing_token") != Application_Model_Preference::getStationPodcastDownloadKey()) { && $this->getRequest()->getParam("sharing_token") != Application_Model_Preference::getStationPodcastDownloadKey()) {
$this->getResponse() $this->getResponse()
->setHttpResponseCode(401); ->setHttpResponseCode(401);
return; return;
} }
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
header('Content-Type: text/xml'); header('Content-Type: text/xml');

View file

@ -46,6 +46,7 @@ class IndexController extends Zend_Controller_Action
$episodes = $podcastEpisodesService->getPodcastEpisodes($stationPodcastId); $episodes = $podcastEpisodesService->getPodcastEpisodes($stationPodcastId);
$this->view->episodes = json_encode($episodes); $this->view->episodes = json_encode($episodes);
$this->view->displayRssTab = (!Application_Model_Preference::getStationPodcastPrivacy());
} }
public function mainAction() public function mainAction()

View file

@ -52,6 +52,8 @@ document.getElementById(id).width= (newwidth) + "px";
</form> </form>
</div> </div>
<?php
if ($this->displayRssTab) {?>
<div id="tab-4" class="station_rss tab_content"> <div id="tab-4" class="station_rss tab_content">
<script type="text/javascript"> <script type="text/javascript">
$.each(<?php echo $this->episodes ?>, function(index, value){ $.each(<?php echo $this->episodes ?>, function(index, value){
@ -70,6 +72,9 @@ document.getElementById(id).width= (newwidth) + "px";
}); });
</script> </script>
</div> </div>
<?php
}
?>
<iframe id="player_iframe" frameborder="0" width="100%" style="bottom:0px; left:0px; position:fixed; right:0px;" src=<?php echo $this->stationUrl."embed/player?stream=auto&style=premium";?>></iframe> <iframe id="player_iframe" frameborder="0" width="100%" style="bottom:0px; left:0px; position:fixed; right:0px;" src=<?php echo $this->stationUrl."embed/player?stream=auto&style=premium";?>></iframe>
@ -79,6 +84,7 @@ document.getElementById(id).width= (newwidth) + "px";
$(document).ready(function(){ $(document).ready(function(){
$("#player_iframe").load(function () { $("#player_iframe").load(function () {
// FIXME: Should we hide this somehow when the station is set to private?
$("#player_iframe").contents().find('.bottom_bar').append("<div class='station_rss_btn button' data-tab='tab-4'></div>"); $("#player_iframe").contents().find('.bottom_bar').append("<div class='station_rss_btn button' data-tab='tab-4'></div>");
$("#player_iframe").contents().find('.bottom_bar').append("<div class='about_us_btn button' data-tab='tab-2'></div>"); $("#player_iframe").contents().find('.bottom_bar').append("<div class='about_us_btn button' data-tab='tab-2'></div>");
$("#player_iframe").contents().find('.bottom_bar').append("<div class='schedule_btn button current' data-tab='tab-1'></div>"); $("#player_iframe").contents().find('.bottom_bar').append("<div class='schedule_btn button current' data-tab='tab-1'></div>");