From 62a915f109270ff3a08c0e12993fedb18a4bae22 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 6 Nov 2014 11:57:05 -0500 Subject: [PATCH 1/6] Added global define for application name --- airtime_mvc/application/configs/constants.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index 34f8cab41..f6cc6840c 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -1,5 +1,7 @@ Date: Thu, 6 Nov 2014 18:24:29 -0500 Subject: [PATCH 2/6] Made several reoccurring strings into application constants and altered any static strings containing them to use these constants in string format calls. --- .../application/controllers/ApiController.php | 6 ++-- .../application/forms/AddShowLiveStream.php | 2 +- .../application/forms/RegisterAirtime.php | 9 ++++-- .../application/forms/SupportSettings.php | 9 ++++-- .../application/layouts/scripts/login.phtml | 27 ++++++++++++------ airtime_mvc/application/models/Auth.php | 3 +- .../views/scripts/dashboard/about.phtml | 28 +++++++++++-------- .../views/scripts/dashboard/help.phtml | 14 ++++++---- .../form/preferences_watched_dirs.phtml | 3 +- .../views/scripts/form/register-dialog.phtml | 20 +++++++------ .../views/scripts/form/support-setting.phtml | 17 +++++++---- .../views/scripts/login/index.phtml | 2 +- .../views/scripts/partialviews/trialBox.phtml | 2 +- .../views/scripts/systemstatus/index.phtml | 26 ++++++++--------- 14 files changed, 101 insertions(+), 67 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 4001f7d50..6448342ae 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -768,7 +768,7 @@ class ApiController extends Zend_Controller_Action //File is not in database anymore. if (is_null($file)) { - $return_hash['error'] = _("File does not exist in Airtime."); + $return_hash['error'] = sprintf(_("File does not exist in %s"), PRODUCT_NAME); } //Updating a metadata change. else { @@ -788,7 +788,7 @@ class ApiController extends Zend_Controller_Action $md['MDATA_KEY_ORIGINAL_PATH'], $con); if (is_null($file)) { - $return_hash['error'] = _('File does not exist in Airtime'); + $return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME); } else { $filepath = $md['MDATA_KEY_FILEPATH']; //$filepath = str_replace("\\", "", $filepath); @@ -800,7 +800,7 @@ class ApiController extends Zend_Controller_Action $file = Application_Model_StoredFile::RecallByFilepath($filepath, $con); if (is_null($file)) { - $return_hash['error'] = _("File doesn't exist in Airtime."); + $return_hash['error'] = sprintf(_('File does not exist in %s'), PRODUCT_NAME); Logging::warn("Attempt to delete file that doesn't exist. Path: '$filepath'"); } else { diff --git a/airtime_mvc/application/forms/AddShowLiveStream.php b/airtime_mvc/application/forms/AddShowLiveStream.php index 65e2a19d3..923c6993d 100644 --- a/airtime_mvc/application/forms/AddShowLiveStream.php +++ b/airtime_mvc/application/forms/AddShowLiveStream.php @@ -7,7 +7,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm public function init() { $cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth"); - $cb_airtime_auth->setLabel(_("Use Airtime Authentication:")) + $cb_airtime_auth->setLabel(sprintf(_("Use %s Authentication:"), PRODUCT_NAME)) ->setRequired(false) ->setDecorators(array('ViewHelper')); $this->addElement($cb_airtime_auth); diff --git a/airtime_mvc/application/forms/RegisterAirtime.php b/airtime_mvc/application/forms/RegisterAirtime.php index 2da7083c8..1fcafc840 100644 --- a/airtime_mvc/application/forms/RegisterAirtime.php +++ b/airtime_mvc/application/forms/RegisterAirtime.php @@ -123,7 +123,7 @@ class Application_Form_RegisterAirtime extends Zend_Form // checkbox for publicise $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); - $checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org')) + $checkboxPublicise->setLabel(sprintf(_('Promote my station on %s'), COMPANY_SITE)) ->setRequired(false) ->setDecorators(array('ViewHelper')) ->setValue(Application_Model_Preference::GetPublicise()); @@ -143,11 +143,14 @@ class Application_Form_RegisterAirtime extends Zend_Form ) )); + $privacyPolicyAnchorOpen = ""; // checkbox for privacy policy $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); $checkboxPrivacy->setLabel( - sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."), - "", + sprintf(_('By checking this box, I agree to %s\'s %sprivacy policy%s.'), + COMPANY_NAME, + $privacyPolicyAnchorOpen, "")) ->setDecorators(array('ViewHelper')); $this->addElement($checkboxPrivacy); diff --git a/airtime_mvc/application/forms/SupportSettings.php b/airtime_mvc/application/forms/SupportSettings.php index 7ce63bcf0..87e5588de 100644 --- a/airtime_mvc/application/forms/SupportSettings.php +++ b/airtime_mvc/application/forms/SupportSettings.php @@ -119,7 +119,7 @@ class Application_Form_SupportSettings extends Zend_Form // checkbox for publicise $checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise"); - $checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org')) + $checkboxPublicise->setLabel(sprintf(_('Promote my station on %s'), COMPANY_SITE)) ->setRequired(false) ->setDecorators(array('ViewHelper')) ->setValue(Application_Model_Preference::GetPublicise()); @@ -142,11 +142,14 @@ class Application_Form_SupportSettings extends Zend_Form ) )); + $privacyPolicyAnchorOpen = ""; // checkbox for privacy policy $checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy"); $checkboxPrivacy->setLabel( - sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."), - "", + sprintf(_('By checking this box, I agree to %s\'s %sprivacy policy%s.'), + COMPANY_NAME, + $privacyPolicyAnchorOpen, "")) ->setDecorators(array('ViewHelper')); $this->addElement($checkboxPrivacy); diff --git a/airtime_mvc/application/layouts/scripts/login.phtml b/airtime_mvc/application/layouts/scripts/login.phtml index aa4030390..6a9879673 100644 --- a/airtime_mvc/application/layouts/scripts/login.phtml +++ b/airtime_mvc/application/layouts/scripts/login.phtml @@ -1,11 +1,11 @@ doctype() ?> - - headTitle() ?> - headLink() ?> - headScript() ?> - google_analytics)?$this->google_analytics:"" ?> + + headTitle() ?> + headLink() ?> + headScript() ?> + google_analytics)?$this->google_analytics:"" ?> @@ -13,9 +13,20 @@ layout()->content ?> diff --git a/airtime_mvc/application/models/Auth.php b/airtime_mvc/application/models/Auth.php index fd39e0407..34e36bbe4 100644 --- a/airtime_mvc/application/models/Auth.php +++ b/airtime_mvc/application/models/Auth.php @@ -33,7 +33,8 @@ class Application_Model_Auth $message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin()); $message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}"; - $success = Application_Model_Email::send(_('Airtime Password Reset'), $message, $user->getDbEmail()); + $str = sprintf(_('%s Password Reset'), PRODUCT_NAME); + $success = Application_Model_Email::send($str, $message, $user->getDbEmail()); return $success; } diff --git a/airtime_mvc/application/views/scripts/dashboard/about.phtml b/airtime_mvc/application/views/scripts/dashboard/about.phtml index f2ccfa02d..98e93e724 100644 --- a/airtime_mvc/application/views/scripts/dashboard/about.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/about.phtml @@ -2,19 +2,25 @@

", - "", - $this->airtime_version, - "
") + +$productSiteAnchor = "" + . PRODUCT_NAME + . ""; +echo sprintf(_('%1$s %2$s, the open radio software for scheduling and remote station management.'), + $productSiteAnchor, + $this->airtime_version) ?> -
© 2013 +
+
© 2013 ", - "", - "", - "") +$companySiteAnchor = "" + . COMPANY_NAME . " " . COMPANY_SUFFIX + . ""; +$licenseAnchor = "" + . LICENSE_VERSION + . ""; +echo sprintf(_('%1$s %2$s is distributed under the %3$s'), + $companySiteAnchor, PRODUCT_NAME, $licenseAnchor) ?>

diff --git a/airtime_mvc/application/views/scripts/dashboard/help.phtml b/airtime_mvc/application/views/scripts/dashboard/help.phtml index 66857c7cd..7b4b9f5c8 100644 --- a/airtime_mvc/application/views/scripts/dashboard/help.phtml +++ b/airtime_mvc/application/views/scripts/dashboard/help.phtml @@ -1,7 +1,7 @@
-

-

+

+

  1. @@ -10,8 +10,12 @@


-", - "") ?>

+"; +echo sprintf(_("For more detailed help, read the %suser manual%s."), + $userManualAnchorOpen, "") + +?> +

diff --git a/airtime_mvc/application/views/scripts/form/preferences_watched_dirs.phtml b/airtime_mvc/application/views/scripts/form/preferences_watched_dirs.phtml index c44dcae4c..37dba574d 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_watched_dirs.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_watched_dirs.phtml @@ -40,9 +40,8 @@
getExistsFlag())?"":""?>getDirectory());?> - " class="ui-icon ui-icon-refresh"> + " class="ui-icon ui-icon-refresh"> " class="ui-icon ui-icon-close"> -
diff --git a/airtime_mvc/application/views/scripts/form/register-dialog.phtml b/airtime_mvc/application/views/scripts/form/register-dialog.phtml index 6f00586e6..999eb045d 100644 --- a/airtime_mvc/application/views/scripts/form/register-dialog.phtml +++ b/airtime_mvc/application/views/scripts/form/register-dialog.phtml @@ -3,10 +3,10 @@
-
") ?> +
") ?>
- ", - "")?> + " + . COMPANY_SITE + . ""; + echo sprintf(_("Click the box below to promote your station on %s."), $whosUsingAnchor) + ?>
- + diff --git a/airtime_mvc/application/views/scripts/form/support-setting.phtml b/airtime_mvc/application/views/scripts/form/support-setting.phtml index 4932cf3f9..b23925d70 100644 --- a/airtime_mvc/application/views/scripts/form/support-setting.phtml +++ b/airtime_mvc/application/views/scripts/form/support-setting.phtml @@ -2,9 +2,10 @@
- ")?> + ."Click the 'Send support feedback' box and we'll make sure the features you use are constantly improving."), + PRODUCT_NAME, COMPANY_NAME, "
")?>
- ", - "")?> + " + . COMPANY_SITE + . ""; + echo sprintf(_("Click the box below to promote your station on %s."), $whosUsingAnchor) + ?>
diff --git a/airtime_mvc/application/views/scripts/login/index.phtml b/airtime_mvc/application/views/scripts/login/index.phtml index 178aca493..0ba4d7e0a 100644 --- a/airtime_mvc/application/views/scripts/login/index.phtml +++ b/airtime_mvc/application/views/scripts/login/index.phtml @@ -4,7 +4,7 @@
demo) && $this->demo == 1){?>

- +

message; ?>

diff --git a/airtime_mvc/application/views/scripts/partialviews/trialBox.phtml b/airtime_mvc/application/views/scripts/partialviews/trialBox.phtml index 691d2983a..cbb04396a 100644 --- a/airtime_mvc/application/views/scripts/partialviews/trialBox.phtml +++ b/airtime_mvc/application/views/scripts/partialviews/trialBox.phtml @@ -6,7 +6,7 @@
- href="https://account.sourcefabric.com/clientarea.php" target="_blank"> + href="https://account.sourcefabric.com/clientarea.php" target="_blank">
diff --git a/airtime_mvc/application/views/scripts/systemstatus/index.phtml b/airtime_mvc/application/views/scripts/systemstatus/index.phtml index f859f2eab..2a31ac78e 100644 --- a/airtime_mvc/application/views/scripts/systemstatus/index.phtml +++ b/airtime_mvc/application/views/scripts/systemstatus/index.phtml @@ -1,19 +1,19 @@ - - - - - - - + + + + + + + @@ -26,8 +26,8 @@ - - + +
From efd05c4b7733396ccba6f3e6eb9b09edad21fdf1 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 6 Nov 2014 18:26:09 -0500 Subject: [PATCH 3/6] Added the _initTranslationGlobals function to bind PHP globals to javascript vars for dynamic translation purposes --- airtime_mvc/application/Bootstrap.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index fddd5911e..7ae9e7388 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -17,7 +17,6 @@ require_once "Timezone.php"; require_once "Auth.php"; require_once __DIR__.'/forms/helpers/ValidationTypes.php'; require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php'; - require_once (APPLICATION_PATH."/logging/Logging.php"); Logging::setLogPath('/var/log/airtime/zendphp.log'); @@ -51,8 +50,9 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $view = $this->getResource('view'); $baseUrl = Application_Common_OsPath::getBaseDir(); - $view->headScript()->appendScript("var baseUrl = '$baseUrl'"); - + $view->headScript()->appendScript("var baseUrl = '$baseUrl';"); + $this->_initTranslationGlobals($view); + $user = Application_Model_User::GetCurrentUser(); if (!is_null($user)){ $userType = $user->getType(); @@ -60,7 +60,17 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap $userType = ""; } $view->headScript()->appendScript("var userType = '$userType';"); - + } + + /** + * Ideally, globals should be written to a single js file once + * from a php init function. This will save us from having to + * reinitialize them every request + */ + private function _initTranslationGlobals($view) { + $view->headScript()->appendScript("var PRODUCT_NAME = '" . PRODUCT_NAME . "';"); + $view->headScript()->appendScript("var USER_MANUAL_URL = '" . USER_MANUAL_URL . "';"); + $view->headScript()->appendScript("var COMPANY_NAME = '" . COMPANY_NAME . "';"); } protected function _initHeadLink() From 8fc7178d82a80c4f1b593fb909cd3e529109b101 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 6 Nov 2014 18:28:14 -0500 Subject: [PATCH 4/6] Added several global constants for reoccurring strings in Airtime to aid dynamic translations --- airtime_mvc/application/configs/constants.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index f6cc6840c..7b27bc891 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -1,6 +1,20 @@ Date: Thu, 6 Nov 2014 18:35:13 -0500 Subject: [PATCH 5/6] Replaced reoccurring strings with string formatting to aid dynamic translations --- airtime_mvc/public/js/airtime/library/spl.js | 1846 ++++++++--------- .../public/js/airtime/nowplaying/register.js | 82 +- .../js/airtime/playlist/smart_blockbuilder.js | 2 +- .../js/airtime/preferences/musicdirs.js | 2 +- .../js/airtime/preferences/streamsetting.js | 8 +- 5 files changed, 971 insertions(+), 969 deletions(-) diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index b33a16942..ff0902dc8 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -3,65 +3,65 @@ //-------------------------------------------------------------------------------------------------------------------------------- var AIRTIME = (function(AIRTIME){ - - if (AIRTIME.playlist === undefined) { - AIRTIME.playlist = {}; + + if (AIRTIME.playlist === undefined) { + AIRTIME.playlist = {}; } - - var mod = AIRTIME.playlist, - viewport, - $lib, - $pl, - $togglePl = $(""), - widgetHeight, - resizeTimeout, - width; - - function isTimeValid(time) { - //var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$"); - var regExpr = new RegExp("^\\d{2}[:]([0-5]){1}([0-9]){1}[:]([0-5]){1}([0-9]){1}([.]\\d{1})?$"); - - return regExpr.test(time); - } - - function isFadeValid(fade) { + + var mod = AIRTIME.playlist, + viewport, + $lib, + $pl, + $togglePl = $(""), + widgetHeight, + resizeTimeout, + width; + + function isTimeValid(time) { + //var regExpr = new RegExp("^\\d{2}[:]\\d{2}[:]\\d{2}([.]\\d{1,6})?$"); + var regExpr = new RegExp("^\\d{2}[:]([0-5]){1}([0-9]){1}[:]([0-5]){1}([0-9]){1}([.]\\d{1})?$"); + + return regExpr.test(time); + } + + function isFadeValid(fade) { var regExpr = new RegExp("^\\d{1}(\\d{1})?([.]\\d{1})?$"); return regExpr.test(fade); - } - - function playlistError(json) { - alert(json.error); - openPlaylist(json); - } - - function stopAudioPreview() { - // stop any preview playing - $('#jquery_jplayer_1').jPlayer('stop'); - } - - function highlightActive(el) { + } + + function playlistError(json) { + alert(json.error); + openPlaylist(json); + } + + function stopAudioPreview() { + // stop any preview playing + $('#jquery_jplayer_1').jPlayer('stop'); + } + + function highlightActive(el) { - $(el).addClass("ui-state-active"); - } + $(el).addClass("ui-state-active"); + } - function unHighlightActive(el) { + function unHighlightActive(el) { - $(el).removeClass("ui-state-active"); - } + $(el).removeClass("ui-state-active"); + } - function showError(el, error) { - $(el).parent().next() - .empty() - .append(error) - .show(); - } + function showError(el, error) { + $(el).parent().next() + .empty() + .append(error) + .show(); + } - function hideError(el) { - $(el).parent().next() - .empty() - .hide(); - } + function hideError(el) { + $(el).parent().next() + .empty() + .hide(); + } function changeCueIn(event) { event.stopPropagation(); @@ -84,7 +84,7 @@ var AIRTIME = (function(AIRTIME){ if (json.error !== undefined){ playlistError(json); - return; + return; } if (json.cue_error !== undefined) { showError(span, json.cue_error); @@ -152,49 +152,49 @@ var AIRTIME = (function(AIRTIME){ return; } else { - $el.find('.cue-in-error').hide(); + $el.find('.cue-in-error').hide(); } if (!isTimeValid(cueOut)){ - $el.find('.cue-out-error').val($.i18n._("please put in a time '00:00:00 (.0)'")).show(); + $el.find('.cue-out-error').val($.i18n._("please put in a time '00:00:00 (.0)'")).show(); return; } else { - $el.find('.cue-out-error').hide(); + $el.find('.cue-out-error').hide(); } $.post(url, {format: "json", cueIn: cueIn, cueOut: cueOut, id: id, modified: lastMod, type: type}, function(json){ - - $el.dialog('destroy'); - $el.remove(); + + $el.dialog('destroy'); + $el.remove(); if (json.error !== undefined){ playlistError(json); - return; + return; } if (json.cue_error !== undefined) { - - li = $('#side_playlist li[unqid='+id+']'); - - if (json.code === 0) { - - span = $('#spl_cue_in_'+id).find('span'); - showError(span, json.cue_error); - span = $('#spl_cue_out_'+id).find('span'); - showError(span, json.cue_error); - } - else if (json.code === 1) { - - span = $('#spl_cue_in_'+id).find('span'); - showError(span, json.cue_error); - } - else if (json.code === 2) { - - span = $('#spl_cue_out_'+id).find('span'); - showError(span, json.cue_error); - } + + li = $('#side_playlist li[unqid='+id+']'); + + if (json.code === 0) { + + span = $('#spl_cue_in_'+id).find('span'); + showError(span, json.cue_error); + span = $('#spl_cue_out_'+id).find('span'); + showError(span, json.cue_error); + } + else if (json.code === 1) { + + span = $('#spl_cue_in_'+id).find('span'); + showError(span, json.cue_error); + } + else if (json.code === 2) { + + span = $('#spl_cue_out_'+id).find('span'); + showError(span, json.cue_error); + } return; } @@ -218,13 +218,13 @@ var AIRTIME = (function(AIRTIME){ $.post(url, {format: "json", fadeIn: fadeIn, fadeOut: fadeOut, id1: id1, id2: id2, offset: offset, modified: lastMod, type: type}, function(json){ - - $el.dialog('destroy'); - $el.remove(); + + $el.dialog('destroy'); + $el.remove(); if (json.error !== undefined){ playlistError(json); - return; + return; } setPlaylistContent(json); @@ -273,195 +273,195 @@ var AIRTIME = (function(AIRTIME){ }); } - function changeFadeOut(event) { - event.stopPropagation(); + function changeFadeOut(event) { + event.stopPropagation(); - var span = $(this), - id = span.parent().attr("id").split("_").pop(), - url = baseUrl+"Playlist/set-fade", - fadeOut = $.trim(span.text()), - li = span.parents("li"), - unqid = li.attr("unqid"), - lastMod = getModified(), + var span = $(this), + id = span.parent().attr("id").split("_").pop(), + url = baseUrl+"Playlist/set-fade", + fadeOut = $.trim(span.text()), + li = span.parents("li"), + unqid = li.attr("unqid"), + lastMod = getModified(), type = $('#obj_type').val(); - if (!isFadeValid(fadeOut)){ - showError(span, $.i18n._("please put in a time in seconds '00 (.0)'")); - return; - } + if (!isFadeValid(fadeOut)){ + showError(span, $.i18n._("please put in a time in seconds '00 (.0)'")); + return; + } - $.post(url, - {format: "json", fadeOut: fadeOut, id: id, modified: lastMod, type: type}, - function(json){ - - if (json.error !== undefined){ - playlistError(json); - return; + $.post(url, + {format: "json", fadeOut: fadeOut, id: id, modified: lastMod, type: type}, + function(json){ + + if (json.error !== undefined){ + playlistError(json); + return; + } + if (json.fade_error !== undefined) { + showError(span, json.fade_error); + return; } - if (json.fade_error !== undefined) { - showError(span, json.fade_error); - return; - } - - setPlaylistContent(json); - - li = $('#side_playlist li[unqid='+unqid+']'); - li.find('.crossfade').toggle(); - highlightActive(li.find('.spl_fade_control')); - }); - } - - function submitOnEnter(event) { - //enter was pressed - if(event.keyCode === 13) { - event.preventDefault(); - $(this).blur(); - } - } - - function openFadeEditor(event) { - var li; - - event.stopPropagation(); - - li = $(this).parents("li"); - li.find(".crossfade").toggle(); - - if ($(this).hasClass("ui-state-active")) { - unHighlightActive(this); - } - else { - highlightActive(this); - } - } - - function openCueEditor(event) { - var li, icon; - - event.stopPropagation(); - - icon = $(this); - li = $(this).parents("li"); - li.find(".cue-edit").toggle(); - - if (li.hasClass("ui-state-active")) { - unHighlightActive(li); - unHighlightActive(icon); - } - else { - highlightActive(li); - highlightActive(icon); - } - } - function editName() { - var nameElement = $(this), - lastMod = getModified(), - type = $('#obj_type').val(); + setPlaylistContent(json); + + li = $('#side_playlist li[unqid='+unqid+']'); + li.find('.crossfade').toggle(); + highlightActive(li.find('.spl_fade_control')); + }); + } + + function submitOnEnter(event) { + //enter was pressed + if(event.keyCode === 13) { + event.preventDefault(); + $(this).blur(); + } + } + + function openFadeEditor(event) { + var li; + + event.stopPropagation(); + + li = $(this).parents("li"); + li.find(".crossfade").toggle(); + + if ($(this).hasClass("ui-state-active")) { + unHighlightActive(this); + } + else { + highlightActive(this); + } + } + + function openCueEditor(event) { + var li, icon; + + event.stopPropagation(); + + icon = $(this); + li = $(this).parents("li"); + li.find(".cue-edit").toggle(); + + if (li.hasClass("ui-state-active")) { + unHighlightActive(li); + unHighlightActive(icon); + } + else { + highlightActive(li); + highlightActive(icon); + } + } + + function editName() { + var nameElement = $(this), + lastMod = getModified(), + type = $('#obj_type').val(); //remove any newlines if user somehow snuck them in (easy to do if dragging/dropping text) nameElement.text(nameElement.text().replace("\n", "")); - + /* --until we decide whether Playlist name should autosave or not - url = baseUrl+'Playlist/set-playlist-name'; + url = baseUrl+'Playlist/set-playlist-name'; - $.post(url, - {format: "json", name: nameElement.text(), modified: lastMod, type: type}, - function(json){ - - if (json.error !== undefined) { - playlistError(json); - } - else { - setModified(json.modified); - nameElement.text(json.playlistName); - redrawLib(); - } - }); + $.post(url, + {format: "json", name: nameElement.text(), modified: lastMod, type: type}, + function(json){ + + if (json.error !== undefined) { + playlistError(json); + } + else { + setModified(json.modified); + nameElement.text(json.playlistName); + redrawLib(); + } + }); */ - } - - function redrawLib() { - var dt = $lib.find("#library_display").dataTable(); - - dt.fnStandingRedraw(); - AIRTIME.library.redrawChosen(); - } - - function setPlaylistContent(json) { - var $html = $(json.html); - - $('#spl_name > a') - .empty() - .append(json.name); - $('#obj_length') - .empty() - .append(json.length); - $('#fieldset-metadate_change textarea') - .empty() - .val(json.description); - - $('#spl_sortable').off('focusout keydown'); - $('#spl_sortable') + } + + function redrawLib() { + var dt = $lib.find("#library_display").dataTable(); + + dt.fnStandingRedraw(); + AIRTIME.library.redrawChosen(); + } + + function setPlaylistContent(json) { + var $html = $(json.html); + + $('#spl_name > a') + .empty() + .append(json.name); + $('#obj_length') + .empty() + .append(json.length); + $('#fieldset-metadate_change textarea') + .empty() + .val(json.description); + + $('#spl_sortable').off('focusout keydown'); + $('#spl_sortable') .empty() .append($html); - setCueEvents(); - setFadeEvents(); - setModified(json.modified); - AIRTIME.playlist.validatePlaylistElements(); - redrawLib(); - } - - function setFadeIcon(){ - var contents = $("#spl_sortable"); + setCueEvents(); + setFadeEvents(); + setModified(json.modified); + AIRTIME.playlist.validatePlaylistElements(); + redrawLib(); + } + + function setFadeIcon(){ + var contents = $("#spl_sortable"); var show = contents.is(":visible"); - var empty = $(".spl_empty"); - - if (!show || empty.length > 0) { - $("#spl_crossfade").hide(); - } else { - //get list of playlist contents - var list = contents.children(); - - //if first and last items are blocks, hide the fade icon - var first = list.first(); - var last = list.last(); - if (first.find(':first-child').children().attr('blockid') !== undefined && - last.find(':first-child').children().attr('blockid') !== undefined) { - $("#spl_crossfade").hide(); - } else { - $("#spl_crossfade").show(); - } - } - } - - function getId() { - return parseInt($("#obj_id").val(), 10); - } - - function getModified() { - return parseInt($("#obj_lastMod").val(), 10); - } - - function setModified(modified) { - $("#obj_lastMod").val(modified); - } - - function openPlaylist(json) { - $("#side_playlist") - .empty() - .append(json.html); - - setUpPlaylist(); - setCueEvents(); - setFadeEvents(); - + var empty = $(".spl_empty"); + + if (!show || empty.length > 0) { + $("#spl_crossfade").hide(); + } else { + //get list of playlist contents + var list = contents.children(); + + //if first and last items are blocks, hide the fade icon + var first = list.first(); + var last = list.last(); + if (first.find(':first-child').children().attr('blockid') !== undefined && + last.find(':first-child').children().attr('blockid') !== undefined) { + $("#spl_crossfade").hide(); + } else { + $("#spl_crossfade").show(); + } + } + } + + function getId() { + return parseInt($("#obj_id").val(), 10); + } + + function getModified() { + return parseInt($("#obj_lastMod").val(), 10); + } + + function setModified(modified) { + $("#obj_lastMod").val(modified); + } + + function openPlaylist(json) { + $("#side_playlist") + .empty() + .append(json.html); + + setUpPlaylist(); + setCueEvents(); + setFadeEvents(); + // functions in smart_blockbuilder.js setupUI(); appendAddButton(); appendModAddButton(); removeButtonCheck(); - } + } function openPlaylistPanel() { var screenWidth = Math.floor(viewport.width - 40); @@ -537,28 +537,28 @@ var AIRTIME = (function(AIRTIME){ } }); } - - //sets events dynamically for playlist entries (each row in the playlist) - function setPlaylistEntryEvents() { - - $pl.delegate("#spl_sortable .ui-icon-closethick", - {"click": function(ev){ - var id; - id = parseInt($(this).attr("id").split("_").pop(), 10); - AIRTIME.playlist.fnDeleteItems([id]); - }}); + + //sets events dynamically for playlist entries (each row in the playlist) + function setPlaylistEntryEvents() { + + $pl.delegate("#spl_sortable .ui-icon-closethick", + {"click": function(ev){ + var id; + id = parseInt($(this).attr("id").split("_").pop(), 10); + AIRTIME.playlist.fnDeleteItems([id]); + }}); - $pl.delegate(".spl_fade_control", - {"click": openFadeEditor}); - - $pl.delegate(".spl_cue", - {"click": openCueEditor}); - - $pl.delegate(".spl_block_expand", - {"click": function(ev){ - var id = parseInt($(this).attr("id").split("_").pop(), 10); - var blockId = parseInt($(this).attr("blockId"), 10); - if ($(this).hasClass('close')) { + $pl.delegate(".spl_fade_control", + {"click": openFadeEditor}); + + $pl.delegate(".spl_cue", + {"click": openCueEditor}); + + $pl.delegate(".spl_block_expand", + {"click": function(ev){ + var id = parseInt($(this).attr("id").split("_").pop(), 10); + var blockId = parseInt($(this).attr("blockId"), 10); + if ($(this).hasClass('close')) { var sUrl = baseUrl+"playlist/get-block-info"; mod.disableUI(); $.post(sUrl, {format:"json", id:blockId}, function(data){ @@ -599,33 +599,33 @@ var AIRTIME = (function(AIRTIME){ mod.enableUI(); }); $(this).removeClass('close'); - } else { - $pl.find("#block_"+id+"_info").html("").hide(); - $(this).addClass('close'); - } + } else { + $pl.find("#block_"+id+"_info").html("").hide(); + $(this).addClass('close'); + } }}); - } - - //sets events dynamically for the cue editor. - function setCueEvents() { - var temp = $('#spl_sortable'); - temp.on("focusout", ".spl_cue_in span", changeCueIn); - temp.on("keydown", ".spl_cue_in span", submitOnEnter); - - temp.on("focusout", ".spl_cue_out span", changeCueOut); - temp.on("keydown", ".spl_cue_out span", submitOnEnter); - - //remove show waveform buttons since web audio api is not supported. - if (!(window.AudioContext || window.webkitAudioContext)) { - temp.find('.pl-waveform-cues-btn') - .parent() - .html($.i18n._("Waveform features are available in a browser supporting the Web Audio API")); - } - } - - //sets events dynamically for the fade editor. - function setFadeEvents() { - var temp = $('#spl_sortable'); + } + + //sets events dynamically for the cue editor. + function setCueEvents() { + var temp = $('#spl_sortable'); + temp.on("focusout", ".spl_cue_in span", changeCueIn); + temp.on("keydown", ".spl_cue_in span", submitOnEnter); + + temp.on("focusout", ".spl_cue_out span", changeCueOut); + temp.on("keydown", ".spl_cue_out span", submitOnEnter); + + //remove show waveform buttons since web audio api is not supported. + if (!(window.AudioContext || window.webkitAudioContext)) { + temp.find('.pl-waveform-cues-btn') + .parent() + .html($.i18n._("Waveform features are available in a browser supporting the Web Audio API")); + } + } + + //sets events dynamically for the fade editor. + function setFadeEvents() { + var temp = $('#spl_sortable'); temp.on("focusout", ".spl_fade_in span", changeFadeIn); temp.on("keydown", ".spl_fade_in span", submitOnEnter); @@ -633,47 +633,47 @@ var AIRTIME = (function(AIRTIME){ temp.on("keydown", ".spl_fade_out span", submitOnEnter); //remove show waveform buttons since web audio api is not supported. - if (!(window.AudioContext || window.webkitAudioContext)) { - temp.find('.pl-waveform-fades-btn') - .parent() - .html($.i18n._("Waveform features are available in a browser supporting the Web Audio API")); - } - } - - function initialEvents() { - var cachedDescription; - - //main playlist fades events - $pl.on("click", "#spl_crossfade", function() { - var lastMod = getModified(), - type = $('#obj_type').val(); + if (!(window.AudioContext || window.webkitAudioContext)) { + temp.find('.pl-waveform-fades-btn') + .parent() + .html($.i18n._("Waveform features are available in a browser supporting the Web Audio API")); + } + } + + function initialEvents() { + var cachedDescription; + + //main playlist fades events + $pl.on("click", "#spl_crossfade", function() { + var lastMod = getModified(), + type = $('#obj_type').val(); - if ($(this).hasClass("ui-state-active")) { - $(this).removeClass("ui-state-active"); - $pl.find("#crossfade_main").hide(); - } - else { - $(this).addClass("ui-state-active"); + if ($(this).hasClass("ui-state-active")) { + $(this).removeClass("ui-state-active"); + $pl.find("#crossfade_main").hide(); + } + else { + $(this).addClass("ui-state-active"); - var url = baseUrl+'Playlist/get-playlist-fades'; - $.post(url, - {format: "json", modified: lastMod, type: type}, - function(json){ - if (json.error !== undefined){ - playlistError(json); - } - else { - var fadeIn = $pl.find("span.spl_main_fade_in"); - var fadeOut = $pl.find("span.spl_main_fade_out"); - if (json.fadeIn == null) { - fadeIn.parent().prev().hide(); - fadeIn.hide(); - } else { - fadeIn.parent().prev().show(); + var url = baseUrl+'Playlist/get-playlist-fades'; + $.post(url, + {format: "json", modified: lastMod, type: type}, + function(json){ + if (json.error !== undefined){ + playlistError(json); + } + else { + var fadeIn = $pl.find("span.spl_main_fade_in"); + var fadeOut = $pl.find("span.spl_main_fade_out"); + if (json.fadeIn == null) { + fadeIn.parent().prev().hide(); + fadeIn.hide(); + } else { + fadeIn.parent().prev().show(); fadeIn.show(); - fadeIn.empty().append(json.fadeIn); - } - if (json.fadeOut == null) { + fadeIn.empty().append(json.fadeIn); + } + if (json.fadeOut == null) { fadeOut.parent().prev().hide(); fadeOut.hide(); } else { @@ -681,108 +681,108 @@ var AIRTIME = (function(AIRTIME){ fadeOut.show(); fadeOut.empty().append(json.fadeOut); } - if (json.fadeIn != null || json.fadeOut != null) { - $pl.find("#crossfade_main").show(); - } - } - }); - } - }); - - $pl.on("blur", "span.spl_main_fade_in", function(event){ - event.stopPropagation(); + if (json.fadeIn != null || json.fadeOut != null) { + $pl.find("#crossfade_main").show(); + } + } + }); + } + }); + + $pl.on("blur", "span.spl_main_fade_in", function(event){ + event.stopPropagation(); - var url = baseUrl+"Playlist/set-playlist-fades", - span = $(this), - fadeIn = $.trim(span.text()), - lastMod = getModified(), - type = $('#obj_type').val(); - - if (!isFadeValid(fadeIn)){ - showError(span, $.i18n._("please put in a time in seconds '00 (.0)'")); - return; - } + var url = baseUrl+"Playlist/set-playlist-fades", + span = $(this), + fadeIn = $.trim(span.text()), + lastMod = getModified(), + type = $('#obj_type').val(); + + if (!isFadeValid(fadeIn)){ + showError(span, $.i18n._("please put in a time in seconds '00 (.0)'")); + return; + } - $.post(url, - {format: "json", fadeIn: fadeIn, modified: lastMod, type: type}, - function(json){ - hideError(span); - if (json.modified !== undefined) { - setModified(json.modified); - } - }); - }); + $.post(url, + {format: "json", fadeIn: fadeIn, modified: lastMod, type: type}, + function(json){ + hideError(span); + if (json.modified !== undefined) { + setModified(json.modified); + } + }); + }); - $pl.on("blur", "span.spl_main_fade_out", function(event){ - event.stopPropagation(); + $pl.on("blur", "span.spl_main_fade_out", function(event){ + event.stopPropagation(); - var url = baseUrl+"Playlist/set-playlist-fades", - span = $(this), - fadeOut = $.trim(span.text()), - lastMod = getModified(), - type = $('#obj_type').val(); + var url = baseUrl+"Playlist/set-playlist-fades", + span = $(this), + fadeOut = $.trim(span.text()), + lastMod = getModified(), + type = $('#obj_type').val(); - if (!isFadeValid(fadeOut)){ - showError(span, $.i18n._("please put in a time in seconds '00 (.0)'")); - return; - } + if (!isFadeValid(fadeOut)){ + showError(span, $.i18n._("please put in a time in seconds '00 (.0)'")); + return; + } - $.post(url, - {format: "json", fadeOut: fadeOut, modified: lastMod, type: type}, - function(json){ - hideError(span); - if (json.modified !== undefined) { - setModified(json.modified); - } - }); - }); + $.post(url, + {format: "json", fadeOut: fadeOut, modified: lastMod, type: type}, + function(json){ + hideError(span); + if (json.modified !== undefined) { + setModified(json.modified); + } + }); + }); - $pl.on("keydown", "span.spl_main_fade_in, span.spl_main_fade_out", submitOnEnter); + $pl.on("keydown", "span.spl_main_fade_in, span.spl_main_fade_out", submitOnEnter); - $pl.on("click", "#crossfade_main > .ui-icon-closethick", function(){ - $pl.find("#spl_crossfade").removeClass("ui-state-active"); - $pl.find("#crossfade_main").hide(); - }); - //end main playlist fades. + $pl.on("click", "#crossfade_main > .ui-icon-closethick", function(){ + $pl.find("#spl_crossfade").removeClass("ui-state-active"); + $pl.find("#crossfade_main").hide(); + }); + //end main playlist fades. - //edit playlist name event - $pl.on("keydown", "#playlist_name_display", submitOnEnter); - $pl.on("blur", "#playlist_name_display", editName); - - //edit playlist description events - $pl.on("click", "legend", function(){ - var $fs = $(this).parents("fieldset"); + //edit playlist name event + $pl.on("keydown", "#playlist_name_display", submitOnEnter); + $pl.on("blur", "#playlist_name_display", editName); + + //edit playlist description events + $pl.on("click", "legend", function(){ + var $fs = $(this).parents("fieldset"); - if ($fs.hasClass("closed")) { - cachedDescription = $fs.find("textarea").val(); - $fs.removeClass("closed"); - } - else { - $fs.addClass("closed"); - } - }); - + if ($fs.hasClass("closed")) { + cachedDescription = $fs.find("textarea").val(); + $fs.removeClass("closed"); + } + else { + $fs.addClass("closed"); + } + }); + - $pl.on("click", 'button[id="playlist_shuffle_button"]', function(){ - obj_id = $('input[id="obj_id"]').val(); - url = baseUrl+"Playlist/shuffle"; - enableLoadingIcon(); - $.post(url, {format: "json", obj_id: obj_id}, function(json){ + $pl.on("click", 'button[id="playlist_shuffle_button"]', function(){ + obj_id = $('input[id="obj_id"]').val(); + url = baseUrl+"Playlist/shuffle"; + enableLoadingIcon(); + $.post(url, {format: "json", obj_id: obj_id}, function(json){ - if (json.error !== undefined) { - alert(json.error); - } - AIRTIME.playlist.fnOpenPlaylist(json); - if (json.result == "0") { - $pl.find('.success').text($.i18n._('Playlist shuffled')); - $pl.find('.success').show(); - } - disableLoadingIcon(); - setTimeout(removeSuccessMsg, 5000); - }); - }) + if (json.error !== undefined) { + alert(json.error); + } + AIRTIME.playlist.fnOpenPlaylist(json); + if (json.result == "0") { + $pl.find('.success').text($.i18n._('Playlist shuffled')); + $pl.find('.success').show(); + } + disableLoadingIcon(); + setTimeout(removeSuccessMsg, 5000); + }); + }) - $pl.on("click", "#webstream_save", function(){ + $pl.on("click", "#webstream_save", function(){ //get all fields and POST to server //description //stream url @@ -892,12 +892,12 @@ var AIRTIME = (function(AIRTIME){ } setModified(json.modified); if (obj_type == "block") { - callback(json, "save"); + callback(json, "save"); } else { $('.success').text($.i18n._('Playlist saved')); $('.success').show(); setTimeout(removeSuccessMsg, 5000); - dt.fnStandingRedraw(); + dt.fnStandingRedraw(); } setFadeIcon(); disableLoadingIcon(); @@ -910,128 +910,128 @@ var AIRTIME = (function(AIRTIME){ oData = {}; playlistRequest(sUrl, oData); }); - } - - function setUpPlaylist() { - var sortableConf; - - sortableConf = (function(){ - var aReceiveItems, - html, - fnReceive, - fnUpdate; - - fnReceive = function(event, ui) { - var aItems = [], - aSelected, - i, - length; - - AIRTIME.library.addToChosen(ui.item); - - //filter out anything that isn't an audiofile. - aSelected = AIRTIME.library.getSelectedData(); - - for (i = 0, length = aSelected.length; i < length; i++) { - aItems.push(new Array(aSelected[i].id, aSelected[i].ftype)); - } - - aReceiveItems = aItems; - html = ui.helper.html(); - - AIRTIME.library.removeFromChosen(ui.item); - }; - - fnUpdate = function(event, ui) { - var prev, - aItems = [], - iAfter, - sAddType; - - prev = ui.item.prev(); - if (prev.hasClass("spl_empty") || prev.length === 0) { - iAfter = undefined; - sAddType = 'before'; - } - else { - iAfter = parseInt(prev.attr("id").split("_").pop(), 10); - sAddType = 'after'; - } - - //item was dragged in from library datatable - if (aReceiveItems !== undefined) { - - $pl.find("tr.ui-draggable") - .after(html) - .empty(); - - aItems = aReceiveItems; - aReceiveItems = undefined; - - AIRTIME.playlist.fnAddItems(aItems, iAfter, sAddType); - } - //item was reordered. - else { - aItems.push(parseInt(ui.item.attr("id").split("_").pop(), 10)); - AIRTIME.playlist.fnMoveItems(aItems, iAfter); - } - }; - - return { - items: 'li', - //hack taken from - //http://stackoverflow.com/questions/2150002/jquery-ui-sortable-how-can-i-change-the-appearance-of-the-placeholder-object - placeholder: { - element: function(currentItem) { - - return $('
  • ')[0]; - }, - update: function(container, p) { - return; - } - }, - forcePlaceholderSize: true, - handle: 'div.list-item-container', - start: function(event, ui) { - ui.placeholder.height(56); - }, - receive: fnReceive, - update: fnUpdate - }; - }()); - - $pl.find("#spl_sortable").sortable(sortableConf); - AIRTIME.playlist.validatePlaylistElements(); - } - - mod.fnNew = function() { - var url = baseUrl+'Playlist/new'; - - stopAudioPreview(); - - $.post(url, - {format: "json", type: 'playlist'}, - function(json){ - openPlaylist(json); - redrawLib(); - }); - }; + } - mod.fnWsNew = function() { - var url = baseUrl+'Webstream/new'; + function setUpPlaylist() { + var sortableConf; + + sortableConf = (function(){ + var aReceiveItems, + html, + fnReceive, + fnUpdate; + + fnReceive = function(event, ui) { + var aItems = [], + aSelected, + i, + length; + + AIRTIME.library.addToChosen(ui.item); + + //filter out anything that isn't an audiofile. + aSelected = AIRTIME.library.getSelectedData(); + + for (i = 0, length = aSelected.length; i < length; i++) { + aItems.push(new Array(aSelected[i].id, aSelected[i].ftype)); + } + + aReceiveItems = aItems; + html = ui.helper.html(); + + AIRTIME.library.removeFromChosen(ui.item); + }; + + fnUpdate = function(event, ui) { + var prev, + aItems = [], + iAfter, + sAddType; + + prev = ui.item.prev(); + if (prev.hasClass("spl_empty") || prev.length === 0) { + iAfter = undefined; + sAddType = 'before'; + } + else { + iAfter = parseInt(prev.attr("id").split("_").pop(), 10); + sAddType = 'after'; + } + + //item was dragged in from library datatable + if (aReceiveItems !== undefined) { + + $pl.find("tr.ui-draggable") + .after(html) + .empty(); + + aItems = aReceiveItems; + aReceiveItems = undefined; + + AIRTIME.playlist.fnAddItems(aItems, iAfter, sAddType); + } + //item was reordered. + else { + aItems.push(parseInt(ui.item.attr("id").split("_").pop(), 10)); + AIRTIME.playlist.fnMoveItems(aItems, iAfter); + } + }; + + return { + items: 'li', + //hack taken from + //http://stackoverflow.com/questions/2150002/jquery-ui-sortable-how-can-i-change-the-appearance-of-the-placeholder-object + placeholder: { + element: function(currentItem) { + + return $('
  • ')[0]; + }, + update: function(container, p) { + return; + } + }, + forcePlaceholderSize: true, + handle: 'div.list-item-container', + start: function(event, ui) { + ui.placeholder.height(56); + }, + receive: fnReceive, + update: fnUpdate + }; + }()); - stopAudioPreview(); - - $.post(url, - {format: "json"}, - function(json){ - openPlaylist(json); - redrawLib(); - }); - }; - + $pl.find("#spl_sortable").sortable(sortableConf); + AIRTIME.playlist.validatePlaylistElements(); + } + + mod.fnNew = function() { + var url = baseUrl+'Playlist/new'; - mod.fnNewBlock = function() { + stopAudioPreview(); + + $.post(url, + {format: "json", type: 'playlist'}, + function(json){ + openPlaylist(json); + redrawLib(); + }); + }; + + mod.fnWsNew = function() { + var url = baseUrl+'Webstream/new'; + + stopAudioPreview(); + + $.post(url, + {format: "json"}, + function(json){ + openPlaylist(json); + redrawLib(); + }); + }; + + + mod.fnNewBlock = function() { var url = baseUrl+'Playlist/new'; stopAudioPreview(); @@ -1043,64 +1043,64 @@ var AIRTIME = (function(AIRTIME){ redrawLib(); }); }; - - mod.fnEdit = function(id, type, url) { - if ($pl.is(":hidden")) { - openPlaylistPanel(); - } - stopAudioPreview(); - - $.post(url, - {format: "json", id: id, type: type}, - function(json){ - openPlaylist(json); - }); - }; - - - mod.fnDelete = function(plid) { - var url, id, lastMod; - - stopAudioPreview(); - id = (plid === undefined) ? getId() : plid; - lastMod = getModified(); - type = $('#obj_type').val(); - url = baseUrl+'Playlist/delete'; - - $.post(url, - {format: "json", ids: id, modified: lastMod, type: type}, - function(json){ - openPlaylist(json); - redrawLib(); - }); - }; - mod.fnWsDelete = function(wsid) { - var url, id, lastMod; - - stopAudioPreview(); - id = (wsid === undefined) ? getId() : wsid; - lastMod = getModified(); - type = $('#obj_type').val(); - url = baseUrl+'Webstream/delete'; + mod.fnEdit = function(id, type, url) { + if ($pl.is(":hidden")) { + openPlaylistPanel(); + } + stopAudioPreview(); - $.post(url, - {format: "json", ids: id, modified: lastMod, type: type}, - function(json){ - openPlaylist(json); - redrawLib(); - }); - }; - - mod.disableUI = function() { - - $lib.block({ + $.post(url, + {format: "json", id: id, type: type}, + function(json){ + openPlaylist(json); + }); + }; + + + mod.fnDelete = function(plid) { + var url, id, lastMod; + + stopAudioPreview(); + id = (plid === undefined) ? getId() : plid; + lastMod = getModified(); + type = $('#obj_type').val(); + url = baseUrl+'Playlist/delete'; + + $.post(url, + {format: "json", ids: id, modified: lastMod, type: type}, + function(json){ + openPlaylist(json); + redrawLib(); + }); + }; + + mod.fnWsDelete = function(wsid) { + var url, id, lastMod; + + stopAudioPreview(); + id = (wsid === undefined) ? getId() : wsid; + lastMod = getModified(); + type = $('#obj_type').val(); + url = baseUrl+'Webstream/delete'; + + $.post(url, + {format: "json", ids: id, modified: lastMod, type: type}, + function(json){ + openPlaylist(json); + redrawLib(); + }); + }; + + mod.disableUI = function() { + + $lib.block({ message: "", theme: true, applyPlatformOpacityRules: false }); - - $pl.block({ + + $pl.block({ message: "", theme: true, applyPlatformOpacityRules: false @@ -1112,136 +1112,136 @@ var AIRTIME = (function(AIRTIME){ }; mod.enableUI = function() { - - $lib.unblock(); - $pl.unblock(); - - //Block UI changes the postion to relative to display the messages. - $lib.css("position", "static"); - $pl.css("position", "static"); - setupUI(); + + $lib.unblock(); + $pl.unblock(); + + //Block UI changes the postion to relative to display the messages. + $lib.css("position", "static"); + $pl.css("position", "static"); + setupUI(); }; - function playlistResponse(json){ - - if (json.error !== undefined) { - playlistError(json); - } - else { - setPlaylistContent(json); - setFadeIcon(); - } - - mod.enableUI(); - } - - function playlistRequest(sUrl, oData) { - var lastMod, - obj_type = $('#obj_type').val(); - - mod.disableUI(); - - lastMod = getModified(); - - oData["modified"] = lastMod; - oData["obj_type"] = obj_type; - oData["format"] = "json"; - - $.post( - sUrl, - oData, - playlistResponse - ); - } - - mod.fnAddItems = function(aItems, iAfter, sAddType) { - var sUrl = baseUrl+"playlist/add-items"; - oData = {"aItems": aItems, "afterItem": iAfter, "type": sAddType}; - playlistRequest(sUrl, oData); - }; - - mod.fnMoveItems = function(aIds, iAfter) { - var sUrl = baseUrl+"playlist/move-items", - oData = {"ids": aIds, "afterItem": iAfter}; - - playlistRequest(sUrl, oData); - }; - - mod.fnDeleteItems = function(aItems) { - var sUrl = baseUrl+"playlist/delete-items", - oData = {"ids": aItems}; - - playlistRequest(sUrl, oData); - }; - - mod.showFadesWaveform = function(e) { - var $el = $(e.target), - $parent = $el.parents("dl"), - $li = $el.parents("li"), - $fadeOut = $parent.find(".spl_fade_out"), - $fadeIn = $parent.find(".spl_fade_in"), - $html = $($("#tmpl-pl-fades").html()), - tracks = [], - dim = AIRTIME.utilities.findViewportDimensions(), - playlistEditor, - id1, id2, - id = $li.attr("unqid"); - - - function removeDialog() { - playlistEditor.stop(); - - $html.dialog("destroy"); - $html.remove(); + function playlistResponse(json){ + + if (json.error !== undefined) { + playlistError(json); + } + else { + setPlaylistContent(json); + setFadeIcon(); + } + + mod.enableUI(); + } + + function playlistRequest(sUrl, oData) { + var lastMod, + obj_type = $('#obj_type').val(); + + mod.disableUI(); + + lastMod = getModified(); + + oData["modified"] = lastMod; + oData["obj_type"] = obj_type; + oData["format"] = "json"; + + $.post( + sUrl, + oData, + playlistResponse + ); + } + + mod.fnAddItems = function(aItems, iAfter, sAddType) { + var sUrl = baseUrl+"playlist/add-items"; + oData = {"aItems": aItems, "afterItem": iAfter, "type": sAddType}; + playlistRequest(sUrl, oData); + }; + + mod.fnMoveItems = function(aIds, iAfter) { + var sUrl = baseUrl+"playlist/move-items", + oData = {"ids": aIds, "afterItem": iAfter}; + + playlistRequest(sUrl, oData); + }; + + mod.fnDeleteItems = function(aItems) { + var sUrl = baseUrl+"playlist/delete-items", + oData = {"ids": aItems}; + + playlistRequest(sUrl, oData); + }; + + mod.showFadesWaveform = function(e) { + var $el = $(e.target), + $parent = $el.parents("dl"), + $li = $el.parents("li"), + $fadeOut = $parent.find(".spl_fade_out"), + $fadeIn = $parent.find(".spl_fade_in"), + $html = $($("#tmpl-pl-fades").html()), + tracks = [], + dim = AIRTIME.utilities.findViewportDimensions(), + playlistEditor, + id1, id2, + id = $li.attr("unqid"); + + + function removeDialog() { + playlistEditor.stop(); + + $html.dialog("destroy"); + $html.remove(); + } + + if ($fadeOut.length > 0) { + + tracks.push({ + src: $fadeOut.data("fadeout"), + cuein: $fadeOut.data("cuein"), + cueout: $fadeOut.data("cueout"), + fades: [{ + shape: $fadeOut.data("type"), + type: "FadeOut", + end: $fadeOut.data("cueout") - $fadeOut.data("cuein"), + start: $fadeOut.data("cueout") - $fadeOut.data("cuein") - $fadeOut.data("length") + }], + states: { + 'fadein': false, + 'shift': false + } + }); + + id1 = $fadeOut.data("item"); } - - if ($fadeOut.length > 0) { - - tracks.push({ - src: $fadeOut.data("fadeout"), - cuein: $fadeOut.data("cuein"), - cueout: $fadeOut.data("cueout"), - fades: [{ - shape: $fadeOut.data("type"), - type: "FadeOut", - end: $fadeOut.data("cueout") - $fadeOut.data("cuein"), - start: $fadeOut.data("cueout") - $fadeOut.data("cuein") - $fadeOut.data("length") - }], - states: { - 'fadein': false, - 'shift': false - } - }); - - id1 = $fadeOut.data("item"); - } - if ($fadeIn.length > 0) { - - tracks.push({ - src: $fadeIn.data("fadein"), - start: $fadeIn.data("offset"), - cuein: $fadeIn.data("cuein"), - cueout: $fadeIn.data("cueout"), - fades: [{ - shape: $fadeIn.data("type"), - type: "FadeIn", - end: $fadeIn.data("length"), - start: 0 - }], - states: { - 'fadeout': false, - 'shift': false - } - }); - - id2 = $fadeIn.data("item"); - } - - //set the first track to not be moveable (might only be one track depending on what follows) - //tracks[0].states["shift"] = false; - - $html.dialog({ + if ($fadeIn.length > 0) { + + tracks.push({ + src: $fadeIn.data("fadein"), + start: $fadeIn.data("offset"), + cuein: $fadeIn.data("cuein"), + cueout: $fadeIn.data("cueout"), + fades: [{ + shape: $fadeIn.data("type"), + type: "FadeIn", + end: $fadeIn.data("length"), + start: 0 + }], + states: { + 'fadeout': false, + 'shift': false + } + }); + + id2 = $fadeIn.data("item"); + } + + //set the first track to not be moveable (might only be one track depending on what follows) + //tracks[0].states["shift"] = false; + + $html.dialog({ modal: true, title: $.i18n._("Fade Editor"), show: 'clip', @@ -1251,116 +1251,116 @@ var AIRTIME = (function(AIRTIME){ buttons: [ {text: $.i18n._("Cancel"), class: "btn btn-small", click: removeDialog}, {text: $.i18n._("Save"), class: "btn btn-small btn-inverse", click: function() { - var json = playlistEditor.getJson(), - offset, - fadeIn, fadeOut, - fade; - - playlistEditor.stop(); - - if (json.length === 0) - { - id1 = undefined; - id2 = undefined; - } - else if (json.length === 1) { - - fade = json[0]["fades"][0]; - - if (fade["type"] === "FadeOut") { - fadeOut = fade["end"] - fade["start"]; - id2 = undefined; //incase of track decode error. - } - else { - fadeIn = fade["end"] - fade["start"]; - id1 = undefined; //incase of track decode error. - } - } - else { - - offset = json[0]["end"] - json[1]["start"]; - - fade = json[0]["fades"][0]; - fadeOut = fade["end"] - fade["start"]; - - fade = json[1]["fades"][0]; - fadeIn = fade["end"] - fade["start"]; - } - - fadeIn = (fadeIn === undefined) ? undefined : fadeIn.toFixed(1); - fadeOut = (fadeOut === undefined) ? undefined : fadeOut.toFixed(1); - - changeCrossfade($html, id1, id2, fadeIn, fadeOut, offset, id); + var json = playlistEditor.getJson(), + offset, + fadeIn, fadeOut, + fade; + + playlistEditor.stop(); + + if (json.length === 0) + { + id1 = undefined; + id2 = undefined; + } + else if (json.length === 1) { + + fade = json[0]["fades"][0]; + + if (fade["type"] === "FadeOut") { + fadeOut = fade["end"] - fade["start"]; + id2 = undefined; //incase of track decode error. + } + else { + fadeIn = fade["end"] - fade["start"]; + id1 = undefined; //incase of track decode error. + } + } + else { + + offset = json[0]["end"] - json[1]["start"]; + + fade = json[0]["fades"][0]; + fadeOut = fade["end"] - fade["start"]; + + fade = json[1]["fades"][0]; + fadeIn = fade["end"] - fade["start"]; + } + + fadeIn = (fadeIn === undefined) ? undefined : fadeIn.toFixed(1); + fadeOut = (fadeOut === undefined) ? undefined : fadeOut.toFixed(1); + + changeCrossfade($html, id1, id2, fadeIn, fadeOut, offset, id); }} ], open: function (event, ui) { - - var config = new Config({ - resolution: 15000, - state: "cursor", - mono: true, - timescale: true, - waveHeight: 80, - container: $html[0], - UITheme: "jQueryUI", - timeFormat: 'hh:mm:ss.u' - }); - - playlistEditor = new PlaylistEditor(); - playlistEditor.setConfig(config); - playlistEditor.init(tracks); + + var config = new Config({ + resolution: 15000, + state: "cursor", + mono: true, + timescale: true, + waveHeight: 80, + container: $html[0], + UITheme: "jQueryUI", + timeFormat: 'hh:mm:ss.u' + }); + + playlistEditor = new PlaylistEditor(); + playlistEditor.setConfig(config); + playlistEditor.init(tracks); }, - close: removeDialog, - resizeStop: function(event, ui) { - playlistEditor.resize(); + close: removeDialog, + resizeStop: function(event, ui) { + playlistEditor.resize(); } - }); - }; - - mod.showCuesWaveform = function(e) { - var $el = $(e.target), - $li = $el.parents("li"), - id = $li.attr("unqid"), - $parent = $el.parent(), - uri = $parent.data("uri"), - $html = $($("#tmpl-pl-cues").html()), - cueIn = $li.find('.spl_cue_in').data("cueIn"), - cueOut = $li.find('.spl_cue_out').data("cueOut"), - cueInSec = $li.find('.spl_cue_in').data("cueSec"), - cueOutSec = $li.find('.spl_cue_out').data("cueSec"), - tracks = [{ - src: uri, - selected: { - start: cueInSec, - end: cueOutSec - } - }], - dim = AIRTIME.utilities.findViewportDimensions(), - playlistEditor; - - function removeDialog() { - playlistEditor.stop(); - - $html.dialog("destroy"); - $html.remove(); + }); + }; + + mod.showCuesWaveform = function(e) { + var $el = $(e.target), + $li = $el.parents("li"), + id = $li.attr("unqid"), + $parent = $el.parent(), + uri = $parent.data("uri"), + $html = $($("#tmpl-pl-cues").html()), + cueIn = $li.find('.spl_cue_in').data("cueIn"), + cueOut = $li.find('.spl_cue_out').data("cueOut"), + cueInSec = $li.find('.spl_cue_in').data("cueSec"), + cueOutSec = $li.find('.spl_cue_out').data("cueSec"), + tracks = [{ + src: uri, + selected: { + start: cueInSec, + end: cueOutSec + } + }], + dim = AIRTIME.utilities.findViewportDimensions(), + playlistEditor; + + function removeDialog() { + playlistEditor.stop(); + + $html.dialog("destroy"); + $html.remove(); } - - $html.find('.editor-cue-in').html(cueIn); - $html.find('.editor-cue-out').html(cueOut); - - $html.on("click", ".set-cue-in", function(e) { - var cueIn = $html.find('.audio_start').val(); - - $html.find('.editor-cue-in').html(cueIn); - }); - - $html.on("click", ".set-cue-out", function(e) { - var cueOut = $html.find('.audio_end').val(); - - $html.find('.editor-cue-out').html(cueOut); - }); - - $html.dialog({ + + $html.find('.editor-cue-in').html(cueIn); + $html.find('.editor-cue-out').html(cueOut); + + $html.on("click", ".set-cue-in", function(e) { + var cueIn = $html.find('.audio_start').val(); + + $html.find('.editor-cue-in').html(cueIn); + }); + + $html.on("click", ".set-cue-out", function(e) { + var cueOut = $html.find('.audio_end').val(); + + $html.find('.editor-cue-out').html(cueOut); + }); + + $html.dialog({ modal: true, title: $.i18n._("Cue Editor"), show: 'clip', @@ -1370,40 +1370,40 @@ var AIRTIME = (function(AIRTIME){ buttons: [ {text: $.i18n._("Cancel"), class: "btn btn-small", click: removeDialog}, {text: $.i18n._("Save"), class: "btn btn-small btn-inverse", click: function() { - var cueIn = $html.find('.editor-cue-in').html(), - cueOut = $html.find('.editor-cue-out').html(); - - playlistEditor.stop(); - - changeCues($html, id, cueIn, cueOut); + var cueIn = $html.find('.editor-cue-in').html(), + cueOut = $html.find('.editor-cue-out').html(); + + playlistEditor.stop(); + + changeCues($html, id, cueIn, cueOut); }} ], open: function (event, ui) { - - var config = new Config({ - resolution: 15000, - mono: true, - timescale: true, - waveHeight: 80, - container: $html[0], - UITheme: "jQueryUI", - timeFormat: 'hh:mm:ss.u' - }); - - playlistEditor = new PlaylistEditor(); - playlistEditor.setConfig(config); - playlistEditor.init(tracks); + + var config = new Config({ + resolution: 15000, + mono: true, + timescale: true, + waveHeight: 80, + container: $html[0], + UITheme: "jQueryUI", + timeFormat: 'hh:mm:ss.u' + }); + + playlistEditor = new PlaylistEditor(); + playlistEditor.setConfig(config); + playlistEditor.init(tracks); }, close: removeDialog, resizeStop: function(event, ui) { - playlistEditor.resize(); + playlistEditor.resize(); } - }); - }; - - mod.init = function() { - /* - $.contextMenu({ + }); + }; + + mod.init = function() { + /* + $.contextMenu({ selector: '#spl_new, #ws_new', trigger: "left", ignoreRightClick: true, @@ -1414,39 +1414,39 @@ var AIRTIME = (function(AIRTIME){ } }); */ - $('#lib-new-pl').live('click', function(){AIRTIME.playlist.fnNew();}); + $('#lib-new-pl').live('click', function(){AIRTIME.playlist.fnNew();}); $('#lib-new-bl').live('click', function(){AIRTIME.playlist.fnNewBlock();}); $('#lib-new-ws').live('click', function(){AIRTIME.playlist.fnWsNew();}); - /* - $pl.delegate("#spl_new", - {"click": AIRTIME.playlist.fnNew});*/ + /* + $pl.delegate("#spl_new", + {"click": AIRTIME.playlist.fnNew});*/ - $pl.delegate("#spl_delete", {"click": function(ev){ - AIRTIME.playlist.fnDelete(); - }}); + $pl.delegate("#spl_delete", {"click": function(ev){ + AIRTIME.playlist.fnDelete(); + }}); - $pl.delegate("#ws_delete", {"click": function(ev){ + $pl.delegate("#ws_delete", {"click": function(ev){ AIRTIME.playlist.fnWsDelete(); - }}); - - $pl.delegate(".pl-waveform-cues-btn", {"click": function(ev){ + }}); + + $pl.delegate(".pl-waveform-cues-btn", {"click": function(ev){ AIRTIME.playlist.showCuesWaveform(ev); - }}); - - $pl.delegate(".pl-waveform-fades-btn", {"click": function(ev){ + }}); + + $pl.delegate(".pl-waveform-fades-btn", {"click": function(ev){ AIRTIME.playlist.showFadesWaveform(ev); - }}); - - setPlaylistEntryEvents(); - setCueEvents(); - setFadeEvents(); - setFadeIcon(); - - initialEvents(); - setUpPlaylist(); - }; - - function setWidgetSize() { + }}); + + setPlaylistEntryEvents(); + setCueEvents(); + setFadeEvents(); + setFadeIcon(); + + initialEvents(); + setUpPlaylist(); + }; + + function setWidgetSize() { viewport = AIRTIME.utilities.findViewportDimensions(); widgetHeight = viewport.height - 185; width = Math.floor(viewport.width - 80); @@ -1456,8 +1456,8 @@ var AIRTIME = (function(AIRTIME){ if (!$pl.is(':hidden')) { $lib.height(widgetHeight) .find(".dataTables_scrolling") - .css("max-height", libTableHeight) - .end() + .css("max-height", libTableHeight) + .end() .width(Math.floor(width * 0.55)); $pl.height(widgetHeight) @@ -1465,54 +1465,54 @@ var AIRTIME = (function(AIRTIME){ } else { $lib.height(widgetHeight) .find(".dataTables_scrolling") - .css("max-height", libTableHeight) - .end() + .css("max-height", libTableHeight) + .end() .width(width + 40); } - } - - mod.onReady = function() { - $lib = $("#library_content"); - $pl = $("#side_playlist"); + } + + mod.onReady = function() { + $lib = $("#library_content"); + $pl = $("#side_playlist"); - setWidgetSize(); - - AIRTIME.library.libraryInit(); - AIRTIME.playlist.init(); + setWidgetSize(); + + AIRTIME.library.libraryInit(); + AIRTIME.playlist.init(); if ($pl.is(':hidden')) { $lib.find("#library_display_length").append($togglePl.show()); } - $pl.find(".ui-icon-alert").qtip({ - content: { - text: $.i18n._("Airtime is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore.") - }, - position:{ - adjust: { - resize: true, - method: "flip flip" - }, - at: "right center", - my: "left top", - viewport: $(window) - }, - style: { - classes: "ui-tooltip-dark" - }, - show: 'mouseover', - hide: 'mouseout' - }); - }; - - mod.onResize = function() { - - clearTimeout(resizeTimeout); - resizeTimeout = setTimeout(setWidgetSize, 100); - }; - - return AIRTIME; - + $pl.find(".ui-icon-alert").qtip({ + content: { + text: sprintf($.i18n._("%s is unsure about the status of this file. This can happen when the file is on a remote drive that is unaccessible or the file is in a directory that isn't 'watched' anymore."), PRODUCT_NAME) + }, + position:{ + adjust: { + resize: true, + method: "flip flip" + }, + at: "right center", + my: "left top", + viewport: $(window) + }, + style: { + classes: "ui-tooltip-dark" + }, + show: 'mouseover', + hide: 'mouseout' + }); + }; + + mod.onResize = function() { + + clearTimeout(resizeTimeout); + resizeTimeout = setTimeout(setWidgetSize, 100); + }; + + return AIRTIME; + }(AIRTIME || {})); diff --git a/airtime_mvc/public/js/airtime/nowplaying/register.js b/airtime_mvc/public/js/airtime/nowplaying/register.js index 58a5b1f21..25316e52d 100644 --- a/airtime_mvc/public/js/airtime/nowplaying/register.js +++ b/airtime_mvc/public/js/airtime/nowplaying/register.js @@ -25,7 +25,7 @@ $(document).ready(function(){ data: {format:"json"} }); $(this).dialog("close"); - } + } }, { id: "remind_never", @@ -41,12 +41,12 @@ $(document).ready(function(){ } }, { - id: "help_airtime", - text: $.i18n._("Yes, help Airtime"), - "class": "btn", - click: function() { - $("#register-form").submit(); - } + id: "help_airtime", + text: sprintf($.i18n._("Yes, help %s"), PRODUCT_NAME), + "class": "btn", + click: function() { + $("#register-form").submit(); + } } ] }); @@ -97,12 +97,12 @@ $(document).ready(function(){ } $("#Privacy").live('click', function(){ - var support = $("#SupportFeedback"); - var button = $("#help_airtime"); + var support = $("#SupportFeedback"); + var button = $("#help_airtime"); if($(this).is(':checked') && support.is(':checked')){ - button.removeAttr('disabled').removeClass('ui-state-disabled'); + button.removeAttr('disabled').removeClass('ui-state-disabled'); }else{ - button.attr('disabled', 'disabled' ).addClass('ui-state-disabled'); + button.attr('disabled', 'disabled' ).addClass('ui-state-disabled'); } }); @@ -118,36 +118,36 @@ $(document).ready(function(){ }); $("#Logo").live('change', function(ev){ - var content, res, logoEl; - - content = $(this).val(); - res = content.match(/(jpg|jpeg|png|gif)$/gi); - logoEl = $("#Logo-element"); - - //not an accepted image extension. - if (!res) { - var ul, li; - - ul = logoEl.find('.errors'); - li = $("
  • ").append($.i18n._("Image must be one of jpg, jpeg, png, or gif")); - - //errors ul has already been created. - if (ul.length > 0) { - ul.empty() - .append(li); - } - else { - logoEl - .append('
      ') - .find(".errors") - .append(li); - } - - $(this).val(""); - } - else { - logoEl.find(".errors").remove(); - } + var content, res, logoEl; + + content = $(this).val(); + res = content.match(/(jpg|jpeg|png|gif)$/gi); + logoEl = $("#Logo-element"); + + //not an accepted image extension. + if (!res) { + var ul, li; + + ul = logoEl.find('.errors'); + li = $("
    • ").append($.i18n._("Image must be one of jpg, jpeg, png, or gif")); + + //errors ul has already been created. + if (ul.length > 0) { + ul.empty() + .append(li); + } + else { + logoEl + .append('
        ') + .find(".errors") + .append(li); + } + + $(this).val(""); + } + else { + logoEl.find(".errors").remove(); + } }); }); diff --git a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js index f47a7b8ed..6dc4d2e66 100644 --- a/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js +++ b/airtime_mvc/public/js/airtime/playlist/smart_blockbuilder.js @@ -400,7 +400,7 @@ function setupUI() { $(".repeat_tracks_help_icon").qtip({ content: { - text: $.i18n._("The desired block length will not be reached if Airtime cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block.") + text: sprintf($.i18n._("The desired block length will not be reached if %s cannot find enough unique tracks to match your criteria. Enable this option if you wish to allow tracks to be added multiple times to the smart block."), PRODUCT_NAME) }, hide: { delay: 500, diff --git a/airtime_mvc/public/js/airtime/preferences/musicdirs.js b/airtime_mvc/public/js/airtime/preferences/musicdirs.js index da404363a..3de496037 100644 --- a/airtime_mvc/public/js/airtime/preferences/musicdirs.js +++ b/airtime_mvc/public/js/airtime/preferences/musicdirs.js @@ -43,7 +43,7 @@ function setWatchedDirEvents() { $('#storageFolder-ok').click(function(){ var url, chosen; - if(confirm($.i18n._("Are you sure you want to change the storage folder?\nThis will remove the files from your Airtime library!"))){ + if(confirm(sprintf($.i18n._("Are you sure you want to change the storage folder?\nThis will remove the files from your %s library!"), PRODUCT_NAME))){ url = baseUrl+"Preference/change-stor-directory"; chosen = $('#storageFolder').val(); diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index 894f54461..7529783a0 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -250,12 +250,14 @@ function setupEventListeners() { showErrorSections(); checkLiquidsoapStatus(); + var userManualAnchorOpen = ""; + // qtip for help text $(".override_help_icon").qtip({ content: { - text: $.i18n._("If Airtime is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151.")+" "+ + text: sprintf($.i18n._("If %s is behind a router or firewall, you may need to configure port forwarding and this field information will be incorrect. In this case you will need to manually update this field so it shows the correct host/port/mount that your DJ's need to connect to. The allowed range is between 1024 and 49151."), PRODUCT_NAME)+" "+ sprintf($.i18n._( - "For more details, please read the %sAirtime Manual%s"), "", "") + "For more details, please read the %s%s Manual%s"), userManualAnchorOpen, PRODUCT_NAME, "") }, hide: { delay: 500, @@ -465,7 +467,7 @@ $(document).ready(function() { getAdminPasswordStatus(); $('#stream_save').live('click', function(){ - var confirm_pypo_restart_text = $.i18n._("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted."); + var confirm_pypo_restart_text = sprintf($.i18n._("If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If %s is recording, and if the change causes a playout engine restart, the recording will be interrupted."), PRODUCT_NAME); if (confirm(confirm_pypo_restart_text)) { var data = $('#stream_form').serialize(); var url = baseUrl+'Preference/stream-setting'; From f6bf2f8cc595c5917aa18f222baf4b64614e6a21 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Fri, 7 Nov 2014 12:05:29 -0500 Subject: [PATCH 6/6] Changed tabs to spaces --- .../controllers/PlaylistController.php | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index 1826bde3b..4f511f4b5 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -38,7 +38,7 @@ class PlaylistController extends Zend_Controller_Action $obj = null; $objInfo = Application_Model_Library::getObjInfo($p_type); - $obj_sess = new Zend_Session_Namespace( UI_PLAYLISTCONTROLLER_OBJ_SESSNAME); + $obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME); if (isset($obj_sess->id)) { $obj = new $objInfo['className']($obj_sess->id); @@ -422,29 +422,29 @@ class PlaylistController extends Zend_Controller_Action public function setCrossfadeAction() { - $id1 = $this->_getParam('id1', null); - $id2 = $this->_getParam('id2', null); - $type = $this->_getParam('type'); - $fadeIn = $this->_getParam('fadeIn', 0); - $fadeOut = $this->_getParam('fadeOut', 0); - $offset = $this->_getParam('offset', 0); + $id1 = $this->_getParam('id1', null); + $id2 = $this->_getParam('id2', null); + $type = $this->_getParam('type'); + $fadeIn = $this->_getParam('fadeIn', 0); + $fadeOut = $this->_getParam('fadeOut', 0); + $offset = $this->_getParam('offset', 0); - try { - $obj = $this->getPlaylist($type); - $response = $obj->createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset); + try { + $obj = $this->getPlaylist($type); + $response = $obj->createCrossfade($id1, $fadeOut, $id2, $fadeIn, $offset); - if (!isset($response["error"])) { - $this->createUpdateResponse($obj); - } else { - $this->view->error = $response["error"]; - } - } catch (PlaylistOutDatedException $e) { - $this->playlistOutdated($e); - } catch (PlaylistNotFoundException $e) { - $this->playlistNotFound($type); - } catch (Exception $e) { - $this->playlistUnknownError($e); - } + if (!isset($response["error"])) { + $this->createUpdateResponse($obj); + } else { + $this->view->error = $response["error"]; + } + } catch (PlaylistOutDatedException $e) { + $this->playlistOutdated($e); + } catch (PlaylistNotFoundException $e) { + $this->playlistNotFound($type); + } catch (Exception $e) { + $this->playlistUnknownError($e); + } } public function getPlaylistFadesAction()