Merge branch 'saas-dev-publishing' into saas-dev-publishing-episode-view

This commit is contained in:
Duncan Sommerville 2015-11-05 18:16:27 -05:00
commit 901ded1441
5 changed files with 55 additions and 21 deletions

View file

@ -328,6 +328,12 @@ class Application_Service_PodcastService
} }
} }
private static function addEscapedChild($node, $name, $value = null, $namespace = null) {
$child = $node->addChild($name, null, $namespace);
$child->{0} = $value;
return $child;
}
public static function createStationRssFeed() public static function createStationRssFeed()
{ {
$stationPodcastId = Application_Model_Preference::getStationPodcastId(); $stationPodcastId = Application_Model_Preference::getStationPodcastId();
@ -341,24 +347,24 @@ class Application_Service_PodcastService
$xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"/>'); $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"/>');
$channel = $xml->addChild("channel"); $channel = $xml->addChild("channel");
$channel->addChild("title", $podcast->getDbTitle()); self::addEscapedChild($channel, "title", $podcast->getDbTitle());
$channel->addChild("link", $podcast->getDbLink()); self::addEscapedChild($channel, "link", $podcast->getDbLink());
$channel->addChild("description", $podcast->getDbDescription()); self::addEscapedChild($channel, "description", $podcast->getDbDescription());
$channel->addChild("language", $podcast->getDbLanguage()); self::addEscapedChild($channel, "language", $podcast->getDbLanguage());
$channel->addChild("copyright", $podcast->getDbCopyright()); self::addEscapedChild($channel, "copyright", $podcast->getDbCopyright());
$imageUrl = Application_Common_HTTPHelper::getStationUrl()."images/airtime_logo.png"; $imageUrl = Application_Common_HTTPHelper::getStationUrl()."images/airtime_logo.png";
$image = $channel->addChild("image"); $image = $channel->addChild("image");
$image->addChild("title", "image title"); $image->addChild("title", "image title");
$image->addChild("url", $imageUrl); self::addEscapedChild($image, "url", $imageUrl);
$image->addChild("link", Application_Common_HTTPHelper::getStationUrl()); self::addEscapedChild($image, "link", Application_Common_HTTPHelper::getStationUrl());
$xml->addAttribute('xmlns:xmlns:itunes', ITUNES_XML_NAMESPACE_URL); $xml->addAttribute('xmlns:xmlns:itunes', ITUNES_XML_NAMESPACE_URL);
$channel->addChild("xmlns:itunes:author", $podcast->getDbItunesAuthor()); self::addEscapedChild($channel, "xmlns:itunes:author", $podcast->getDbItunesAuthor());
$channel->addChild("xmlns:itunes:keywords", $podcast->getDbItunesKeywords()); self::addEscapedChild($channel, "xmlns:itunes:keywords", $podcast->getDbItunesKeywords());
$channel->addChild("xmlns:itunes:summary", $podcast->getDbItunesSummary()); self::addEscapedChild($channel, "xmlns:itunes:summary", $podcast->getDbItunesSummary());
$channel->addChild("xmlns:itunes:subtitle", $podcast->getDbItunesSubtitle()); self::addEscapedChild($channel, "xmlns:itunes:subtitle", $podcast->getDbItunesSubtitle());
$channel->addChild("xmlns:itunes:explicit", $podcast->getDbItunesExplicit()); self::addEscapedChild($channel, "xmlns:itunes:explicit", $podcast->getDbItunesExplicit());
$itunesImage = $channel->addChild("xmlns:itunes:image"); $itunesImage = $channel->addChild("xmlns:itunes:image");
$itunesImage->addAttribute("href", $imageUrl); $itunesImage->addAttribute("href", $imageUrl);
@ -376,24 +382,24 @@ class Application_Service_PodcastService
$publishedFile = CcFilesQuery::create()->findPk($episode->getDbFileId()); $publishedFile = CcFilesQuery::create()->findPk($episode->getDbFileId());
//title //title
$item->addChild("title", $publishedFile->getDbTrackTitle()); self::addEscapedChild($item, "title", $publishedFile->getDbTrackTitle());
//link - do we need this? //link - do we need this?
//pubDate //pubDate
$item->addChild("pubDate", $episode->getDbPublicationDate()); self::addEscapedChild($item, "pubDate", $episode->getDbPublicationDate());
//category //category
foreach($itunesCategories as $c) { foreach($itunesCategories as $c) {
$item->addChild("category", $c); self::addEscapedChild($item, "category", $c);
} }
//guid //guid
$guid = $item->addChild("guid", $episode->getDbEpisodeGuid()); $guid = self::addEscapedChild($item, "guid", $episode->getDbEpisodeGuid());
$guid->addAttribute("isPermaLink", "false"); $guid->addAttribute("isPermaLink", "false");
//description //description
$item->addChild("description", $publishedFile->getDbDescription()); self::addEscapedChild($item, "description", $publishedFile->getDbDescription());
//encolsure - url, length, type attribs //encolsure - url, length, type attribs
$enclosure = $item->addChild("enclosure"); $enclosure = $item->addChild("enclosure");
@ -402,18 +408,21 @@ class Application_Service_PodcastService
$enclosure->addAttribute("type", $publishedFile->getDbMime()); $enclosure->addAttribute("type", $publishedFile->getDbMime());
//itunes:subtitle //itunes:subtitle
$item->addChild("xmlns:itunes:subtitle", $publishedFile->getDbTrackTitle()); // From http://www.apple.com/ca/itunes/podcasts/specs.html#subtitle :
// 'The contents of the <itunes:subtitle> tag are displayed in the Description column in iTunes.'
// self::addEscapedChild($item, "xmlns:itunes:subtitle", $publishedFile->getDbTrackTitle());
self::addEscapedChild($item, "xmlns:itunes:subtitle", $publishedFile->getDbDescription());
//itunes:summary //itunes:summary
$item->addChild("xmlns:itunes:summary", $publishedFile->getDbDescription()); self::addEscapedChild($item, "xmlns:itunes:summary", $publishedFile->getDbDescription());
//itunes:author //itunes:author
$item->addChild("xmlns:itunes:author", $publishedFile->getDbArtistName()); self::addEscapedChild($item, "xmlns:itunes:author", $publishedFile->getDbArtistName());
//itunes:explicit - skip this? //itunes:explicit - skip this?
//itunes:duration //itunes:duration
$item->addChild("xmlns:itunes:duration", $publishedFile->getDbLength()); self::addEscapedChild($item, "xmlns:itunes:duration", $publishedFile->getDbLength());
} }
return $xml->asXML(); return $xml->asXML();

View file

@ -174,6 +174,13 @@
$(".jp-playlist").find("a.jp-playlist-item").each(function (i, obj) { $(".jp-playlist").find("a.jp-playlist-item").each(function (i, obj) {
$(obj).after(" - <a id='rss-download-link' href='"+playlist[i].download_url+"'>Download</a>"); $(obj).after(" - <a id='rss-download-link' href='"+playlist[i].download_url+"'>Download</a>");
}); });
//turn off player bar when podcast track is played
$("a.jp-playlist-item, .jp-play").click(function() {
if ($("#player_iframe").contents().find('.play').hasClass('pause')) {
$("#player_iframe").contents().find('.play').click();
}
});
} }
} }
); );
@ -190,6 +197,9 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$("#player_iframe").load(function () { $("#player_iframe").load(function () {
<?php <?php
// Is there a better way to do this? // Is there a better way to do this?
@ -213,6 +223,13 @@
$(this).addClass('current'); $(this).addClass('current');
$("#"+tab_id).addClass('current'); $("#"+tab_id).addClass('current');
}); });
//turn off jplayer if it's playing and someone clicks to play the player bar
$("#player_iframe").contents().find('.play').click(function () {
if ($('.jp-play').is(':hidden')) {
$('.jp-pause').click();
}
});
}); });
// schedule widget tabs // schedule widget tabs

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -71,6 +71,14 @@ body {
float: right; float: right;
} }
.bottom_bar .station_rss_btn {
background: url('img/podcast.png') no-repeat center 0px;
}
.bottom_bar .station_rss_btn.current {
background: url('img/podcast.png') no-repeat center -50px;
}
.bottom_bar .schedule_btn { .bottom_bar .schedule_btn {
background: url('img/schedule.png') no-repeat center 0px; background: url('img/schedule.png') no-repeat center 0px;
} }