* SAAS-1184 - more polish for publishing/podcasting

* Fix some issues with the station podcast feed
* Various small fixes
This commit is contained in:
Duncan Sommerville 2015-11-11 16:47:07 -05:00
parent 5264bebe57
commit 74f7c454b5
13 changed files with 257 additions and 50 deletions

View File

@ -5,3 +5,160 @@
function _pro($str) {
return dgettext("pro", $str);
}
class Application_Common_LocaleHelper {
/**
* Return an array of all ISO 639-1 language codes and their corresponding translated language names
*
* @return array the array of language codes to names
*/
public static function getISO6391LanguageCodes() {
/**
* From: http://www.binarytides.com/php-array-of-iso-639-1-language-codes-and-names/
*
* ISO 639-1 Language Codes
* References :
* 1. http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
* 2. http://blog.xoundboy.com/?p=235
*/
return array(
'en' => _('English'),
'aa' => _('Afar'),
'ab' => _('Abkhazian'),
'af' => _('Afrikaans'),
'am' => _('Amharic'),
'ar' => _('Arabic'),
'as' => _('Assamese'),
'ay' => _('Aymara'),
'az' => _('Azerbaijani'),
'ba' => _('Bashkir'),
'be' => _('Belarusian'),
'bg' => _('Bulgarian'),
'bh' => _('Bihari'),
'bi' => _('Bislama'),
'bn' => _('Bengali/Bangla'),
'bo' => _('Tibetan'),
'br' => _('Breton'),
'ca' => _('Catalan'),
'co' => _('Corsican'),
'cs' => _('Czech'),
'cy' => _('Welsh'),
'da' => _('Danish'),
'de' => _('German'),
'dz' => _('Bhutani'),
'el' => _('Greek'),
'eo' => _('Esperanto'),
'es' => _('Spanish'),
'et' => _('Estonian'),
'eu' => _('Basque'),
'fa' => _('Persian'),
'fi' => _('Finnish'),
'fj' => _('Fiji'),
'fo' => _('Faeroese'),
'fr' => _('French'),
'fy' => _('Frisian'),
'ga' => _('Irish'),
'gd' => _('Scots/Gaelic'),
'gl' => _('Galician'),
'gn' => _('Guarani'),
'gu' => _('Gujarati'),
'ha' => _('Hausa'),
'hi' => _('Hindi'),
'hr' => _('Croatian'),
'hu' => _('Hungarian'),
'hy' => _('Armenian'),
'ia' => _('Interlingua'),
'ie' => _('Interlingue'),
'ik' => _('Inupiak'),
'in' => _('Indonesian'),
'is' => _('Icelandic'),
'it' => _('Italian'),
'iw' => _('Hebrew'),
'ja' => _('Japanese'),
'ji' => _('Yiddish'),
'jw' => _('Javanese'),
'ka' => _('Georgian'),
'kk' => _('Kazakh'),
'kl' => _('Greenlandic'),
'km' => _('Cambodian'),
'kn' => _('Kannada'),
'ko' => _('Korean'),
'ks' => _('Kashmiri'),
'ku' => _('Kurdish'),
'ky' => _('Kirghiz'),
'la' => _('Latin'),
'ln' => _('Lingala'),
'lo' => _('Laothian'),
'lt' => _('Lithuanian'),
'lv' => _('Latvian/Lettish'),
'mg' => _('Malagasy'),
'mi' => _('Maori'),
'mk' => _('Macedonian'),
'ml' => _('Malayalam'),
'mn' => _('Mongolian'),
'mo' => _('Moldavian'),
'mr' => _('Marathi'),
'ms' => _('Malay'),
'mt' => _('Maltese'),
'my' => _('Burmese'),
'na' => _('Nauru'),
'ne' => _('Nepali'),
'nl' => _('Dutch'),
'no' => _('Norwegian'),
'oc' => _('Occitan'),
'om' => _('(Afan)/Oromoor/Oriya'),
'pa' => _('Punjabi'),
'pl' => _('Polish'),
'ps' => _('Pashto/Pushto'),
'pt' => _('Portuguese'),
'qu' => _('Quechua'),
'rm' => _('Rhaeto-Romance'),
'rn' => _('Kirundi'),
'ro' => _('Romanian'),
'ru' => _('Russian'),
'rw' => _('Kinyarwanda'),
'sa' => _('Sanskrit'),
'sd' => _('Sindhi'),
'sg' => _('Sangro'),
'sh' => _('Serbo-Croatian'),
'si' => _('Singhalese'),
'sk' => _('Slovak'),
'sl' => _('Slovenian'),
'sm' => _('Samoan'),
'sn' => _('Shona'),
'so' => _('Somali'),
'sq' => _('Albanian'),
'sr' => _('Serbian'),
'ss' => _('Siswati'),
'st' => _('Sesotho'),
'su' => _('Sundanese'),
'sv' => _('Swedish'),
'sw' => _('Swahili'),
'ta' => _('Tamil'),
'te' => _('Tegulu'),
'tg' => _('Tajik'),
'th' => _('Thai'),
'ti' => _('Tigrinya'),
'tk' => _('Turkmen'),
'tl' => _('Tagalog'),
'tn' => _('Setswana'),
'to' => _('Tonga'),
'tr' => _('Turkish'),
'ts' => _('Tsonga'),
'tt' => _('Tatar'),
'tw' => _('Twi'),
'uk' => _('Ukrainian'),
'ur' => _('Urdu'),
'uz' => _('Uzbek'),
'vi' => _('Vietnamese'),
'vo' => _('Volapuk'),
'wo' => _('Wolof'),
'xh' => _('Xhosa'),
'yo' => _('Yoruba'),
'zh' => _('Chinese'),
'zu' => _('Zulu'),
);
}
}

View File

@ -58,6 +58,7 @@ class LocaleController extends Zend_Controller_Action
"You haven't added any webstreams" => _("You haven't added any webstreams"),
"Learn about tracks" => _("Learn about tracks"),
"Learn about playlists" => _("Learn about playlists"),
"Learn about podcasts" => _("Learn about podcasts"),
"Learn about smart blocks" => _("Learn about smart blocks"),
"Learn about webstreams" => _("Learn about webstreams"),
"Click 'New' to create one." => _("Click 'New' to create one."),

View File

@ -92,13 +92,16 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
<?php echo $this->navigation()->menu(); ?>
</div>
<script>
<?php
$partitions = Application_Model_Systemstatus::GetDiskInfo();
$status = new StdClass;
$disk = $partitions[0];
$used = $disk->totalSpace-$disk->totalFreeSpace;
$total = $disk->totalSpace;
echo "var remainingDiskSpace = ".$disk->totalFreeSpace;
?>
</script>
<div id="disk_usage" style="height: 13px; position:fixed; bottom: 5px; left: 10px;">
<!--<div style="padding-bottom: 2px;">Disk Usage</div>-->
<div class="disk_usage_progress_bar"></div>

View File

@ -341,6 +341,9 @@ class Application_Service_PodcastService
}
private static function addEscapedChild($node, $name, $value = null, $namespace = null) {
if (empty($value)) {
return null;
}
$child = $node->addChild($name, null, $namespace);
$child->{0} = $value;
return $child;
@ -399,7 +402,7 @@ class Application_Service_PodcastService
//link - do we need this?
//pubDate
self::addEscapedChild($item, "pubDate", $episode->getDbPublicationDate());
self::addEscapedChild($item, "pubDate", gmdate(DATE_RFC2822, strtotime($episode->getDbPublicationDate())));
//category
foreach($itunesCategories as $c) {
@ -416,7 +419,7 @@ class Application_Service_PodcastService
//encolsure - url, length, type attribs
$enclosure = $item->addChild("enclosure");
$enclosure->addAttribute("url", $episode->getDbDownloadUrl());
$enclosure->addAttribute("length", Application_Common_DateHelper::calculateLengthInSeconds($publishedFile->getDbLength()));
$enclosure->addAttribute("length", $publishedFile->getDbFilesize());
$enclosure->addAttribute("type", $publishedFile->getDbMime());
//itunes:subtitle

View File

@ -39,7 +39,13 @@
<div>
<label><?php echo _("Language") ?></label>
<input name="podcast_language" ng-model="podcast.language" type="text"/>
<select name="podcast_language" ng-model="podcast.language">
<?php
foreach(Application_Common_LocaleHelper::getISO6391LanguageCodes() as $code=>$lang) {
echo "<option value='$code'>$lang</option>";
}
?>
</select>
</div>
<div>
@ -49,7 +55,7 @@
<div>
<label><?php echo _("Link") ?></label>
<input name="podcast_link" ng-model="podcast.link" type="text"/>
<input name="podcast_link" ng-model="podcast.link" type="url"/>
</div>
<fieldset>

View File

@ -28,8 +28,6 @@
}
#schedule-add-show dl {
padding: 8px;
margin-bottom: 8px;
margin: 0;
padding: 0;
width: 100%;
@ -51,7 +49,6 @@
text-align: left;
min-width: 103px;
padding-top: 4px;
clear: left;
}
#schedule-add-show dt.big {
@ -124,7 +121,14 @@ label.wrapp-label input[type="checkbox"] {
}
#add_show_hosts-element > label {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-align-items: flex-end;
-moz-align-items: flex-end;
-ms-align-items: flex-end;
align-items: flex-end;
}

View File

@ -160,7 +160,7 @@ div.btn > span {
border: 1px solid #5b5b5b;
}
#library_empty_image {
.empty_placeholder_image {
opacity: .3;
width: 16px;
@ -171,7 +171,7 @@ div.btn > span {
padding-right: 2px; /* For the webstream icon */
}
#library_empty {
.empty_placeholder {
display: none;
font-size: 16px;
position: absolute;
@ -181,14 +181,14 @@ div.btn > span {
color: #efefef;
}
#library_empty a {
.empty_placeholder a {
font-size: 0.9em;
line-height: 37px;
text-decoration: none;
color: #FF5D1A;
}
#library_empty a:visited {
.empty_placeholder a:visited {
color: #CE3C01;
}

View File

@ -4019,11 +4019,13 @@ li .ui-state-hover {
}
.podcast-metadata label,
.podcast-metadata input,
.podcast-metadata input:not([type="checkbox"]),
.podcast-metadata select,
.podcast-metadata textarea,
.media-metadata label,
.media-metadata input,
.media-metadata textarea{
.media-metadata input:not([type="checkbox"]),
.media-metadata select,
.media-metadata textarea {
margin: 4px 0;
}
@ -4038,9 +4040,11 @@ li .ui-state-hover {
float: left;
}
.podcast-metadata input[type="text"],
.podcast-metadata input:not([type="checkbox"]),
.podcast-metadata select,
.podcast-metadata textarea,
.media-metadata input[type="text"],
.media-metadata input:not([type="checkbox"]),
.media-metadata select,
.media-metadata textarea {
width: 60%;
float: left;

View File

@ -69,30 +69,27 @@ var AIRTIME = (function(AIRTIME) {
"timeline");
};
mod.fnDrawCallback = function fnLibDrawCallback() {
/**
*
* @param {jQuery} table
*/
mod.drawEmptyPlaceholder = function (table) {
var emptyRow = table.find('tr:has(td.dataTables_empty)'),
wrapper = table.closest(".dataTables_wrapper");
mod.redrawChosen();
mod.checkToolBarIcons();
var cb = $('th.library_checkbox'),
emptyRow = $('#library_display').find('tr:has(td.dataTables_empty)');
if (cb.find("input").length == 0) {
cb.append("<input id='super-checkbox' type='checkbox'>");
}
var libEmpty = $('#library_empty');
var libEmpty = wrapper.find('.empty_placeholder');
if (emptyRow.length > 0) {
emptyRow.hide();
var mediaType = parseInt($('.media_type_selector.selected').data('selection-id')),
img = $('#library_empty_image');
img = wrapper.find('.empty_placeholder_image');
// Remove all classes for when we change between empty media types
img.removeClass(function() {
return $( this ).attr( "class" );
return $(this).attr("class");
});
var opts = AIRTIME.library.placeholder(mediaType);
img.addClass("icon-white " + opts.icon);
$('#library_empty_text').html(
img.addClass("empty_placeholder_image icon-white " + opts.icon);
wrapper.find('.empty_placeholder_text').html(
$.i18n._("You haven't added any " + opts.media + ".")
+ "<br/>" + $.i18n._(opts.subtext)
+ "<br/><a target='_blank' href='" + opts.href + "'>" + $.i18n._("Learn about " + opts.media) + "</a>"
@ -102,6 +99,19 @@ var AIRTIME = (function(AIRTIME) {
} else {
libEmpty.hide();
}
};
mod.fnDrawCallback = function fnLibDrawCallback() {
var table = $('#library_display'),
cb = table.find('th[class*="checkbox"]');
if (cb.find("input").length == 0) {
cb.append("<input id='super-checkbox' type='checkbox'>");
}
mod.redrawChosen();
mod.checkToolBarIcons();
mod.drawEmptyPlaceholder(table);
var sortable;

View File

@ -89,7 +89,6 @@ var AIRTIME = (function(AIRTIME) {
});
mod.DataTableTypeEnum = Object.freeze({
//FILE: "au",
LIBRARY : "library",
PODCAST : "podcast",
PODCAST_EPISODES: "podcastEpisodes"
@ -661,8 +660,6 @@ var AIRTIME = (function(AIRTIME) {
type = (type === undefined) ? AIRTIME.library.MediaTypeIntegerEnum.DEFAULT : type;
aoData.push({name: "type", value: type});
//getUsabilityHint();
$.ajax({
"dataType": 'json',
"type": "POST",
@ -678,7 +675,7 @@ var AIRTIME = (function(AIRTIME) {
+ $.i18n._(" of ") + data.iTotalRecords
+ $.i18n._(" records")
);
$('#library_empty').hide();
$('.empty_placeholder').hide();
$libTable.find('tr:has(td.dataTables_empty)').show();
} else {
filterMessage.text("");
@ -736,7 +733,7 @@ var AIRTIME = (function(AIRTIME) {
"oLanguage": getLibraryDatatableStrings(),
// z = ColResize, R = ColReorder, C = ColVis
"sDom": 'Rf<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t<"#library_empty"<"#library_empty_image"><"#library_empty_text">>><"F"lip>>',
"sDom": 'Rf<"dt-process-rel"r><"H"<"library_toolbar"C>><"dataTables_scrolling"t<".empty_placeholder"<".empty_placeholder_image"><".empty_placeholder_text">>><"F"lip>>',
"oColVis": {
"sAlign": "right",
@ -870,9 +867,9 @@ var AIRTIME = (function(AIRTIME) {
if (r.status === 403) {
// Hide the processing div
$("#library_display_wrapper").find(".dt-process-rel").hide();
$('#library_empty_text').text($.i18n._("You don't have permission to view the library."));
$('.empty_placeholder_text').text($.i18n._("You don't have permission to view the library."));
$('#library_empty').show();
$('.empty_placeholder').show();
}
}
@ -883,7 +880,8 @@ var AIRTIME = (function(AIRTIME) {
table = mod.DataTableTypeEnum.LIBRARY;
}
AIRTIME.library.setCurrentTable(table);
AIRTIME.library.setCurrentTable(table, false);
oTable = $datatables[table];
setColumnFilter(oTable);
oTable.fnSetFilteringDelay(350);
@ -1252,18 +1250,24 @@ var AIRTIME = (function(AIRTIME) {
/**
* Show the given table in the left-hand pane of the dashboard and give it internal focus
*
* @param table the table to show
* @param {string} table the string name of the table to show
* @param {boolean} [redraw] whether or not to redraw the table
*/
mod.setCurrentTable = function (table) {
if (oTable && oTable === $datatables[mod.DataTableTypeEnum.PODCAST_EPISODES]) {
oTable.fnClearTable();
mod.setCurrentTable = function (table, redraw) {
if (typeof redraw === 'undefined') {
redraw = true;
}
var dt = $datatables[table],
wrapper = $(dt).closest(".dataTables_wrapper");
$("#library_content").find(".dataTables_wrapper").hide();
wrapper.show();
if (oTable && typeof oTable.fnClearTable === 'function') {
oTable.fnClearTable();
}
// Don't redraw if we're switching to another hash for the library table
$.when(redraw && oTable != dt ? dt.fnDraw() : function () {}).done(function () {
$("#library_content").find(".dataTables_wrapper").hide();
wrapper.show();
});
oTable = dt;
oTable.fnDraw();
};
mod.getCurrentTable = function () {
@ -1371,6 +1375,9 @@ var AIRTIME = (function(AIRTIME) {
sAjaxSource : ajaxSourceURL,
oColReorder: {
iFixedColumns: 1 // Checkbox
},
fnDrawCallback: function () {
AIRTIME.library.drawEmptyPlaceholder($(this));
}
});

View File

@ -592,6 +592,10 @@ var AIRTIME = (function (AIRTIME) {
*/
mod.importSelectedEpisodes = function (episodes, dt) {
$.each(episodes, function () {
if (this.enclosure.length > remainingDiskSpace) {
alert("You don't have enough disk space to import " + this.title);
return false;
}
if (this.file && Object.keys(this.file).length > 0) return false;
var podcastId = this.podcast_id;
$.post(endpoint + podcastId + '/episodes', JSON.stringify({
@ -600,6 +604,8 @@ var AIRTIME = (function (AIRTIME) {
}), function () {
dt.reload(podcastId);
});
remainingDiskSpace -= this.enclosure.length;
});
};
@ -631,6 +637,7 @@ var AIRTIME = (function (AIRTIME) {
}
params = $.extend(true, params,
{
bDeferRender: true,
oColVis: {
aiExclude: [0, 1],
oColReorder: {

View File

@ -196,7 +196,7 @@ var AIRTIME = (function(AIRTIME){
// In case we're adding a tab that wraps to the next row
// It's better to call this here so we don't have to call it in multiple places
mod.onResize();
AIRTIME.library.fnRedraw();
// AIRTIME.library.fnRedraw();
};
/**

View File

@ -61,6 +61,8 @@ var AIRTIME = (function(AIRTIME) {
"bJQueryUI": true,
"bAutoWidth": false,
"aaSorting": [],
"iDisplayLength": 25,
"aLengthMenu": [25, 50, 100],
"oLanguage" : getDatatablesStrings({
"sEmptyTable": $.i18n._(""),
"sZeroRecords": $.i18n._("No matching results found.")
@ -72,8 +74,11 @@ var AIRTIME = (function(AIRTIME) {
"iOverlayFade": 0
},
// z = ColResize, R = ColReorder, C = ColVis
"sDom": 'Rf<"dt-process-rel"r><"H"<"table_toolbar"C>><"dataTables_scrolling"t<"#library_empty"<"#library_empty_image"><"#library_empty_text">>><"F"lip>>',
"sDom": 'Rf<"dt-process-rel"r><"H"<"table_toolbar"C>><"dataTables_scrolling"t<".empty_placeholder"<".empty_placeholder_image"><".empty_placeholder_text">>><"F"lip>>',
"fnPreDrawCallback": function () {
$("#draggingContainer").remove();
},
"fnServerData": self._fetchData
//"fnInitComplete" : function() { self._setupEventHandlers(bItemSelection) }
//"fnDrawCallback" : self._tableDrawCallback
@ -371,10 +376,10 @@ var AIRTIME = (function(AIRTIME) {
/*
$("#library_display_wrapper").find(".dt-process-rel").hide();
$.getJSON( "ajax/library_placeholders.json", function( data ) {
$('#library_empty_text').text($.i18n._(data.unauthorized));
$('.empty_placeholder_text').text($.i18n._(data.unauthorized));
}) ;
$('#library_empty').show();
$('.empty_placeholder').show();
*/
}
};