diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 9a9e8f4da..d63938c5d 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -15,6 +15,7 @@ class PreferenceController extends Zend_Controller_Action ->addActionContext('change-stream-setting', 'json') ->addActionContext('get-liquidsoap-status', 'json') ->addActionContext('set-source-connection-url', 'json') + ->addActionContext('get-admin-password-status', 'json') ->initContext(); } @@ -218,6 +219,16 @@ class PreferenceController extends Zend_Controller_Action Application_Model_StreamSetting::setStreamSetting($values); + /* If the admin password values are empty then we should not + * set the pseudo password ('xxxxxx') on the front-end + */ + $s1_set_admin_pass = true; + $s2_set_admin_pass = true; + $s3_set_admin_pass = true; + if (empty($values["s1_data"]["admin_pass"])) $s1_set_admin_pass = false; + if (empty($values["s2_data"]["admin_pass"])) $s2_set_admin_pass = false; + if (empty($values["s3_data"]["admin_pass"])) $s3_set_admin_pass = false; + // this goes into cc_pref table Application_Model_Preference::SetStreamLabelFormat($values['streamFormat']); Application_Model_Preference::SetLiveStreamMasterUsername($values["master_username"]); @@ -255,7 +266,13 @@ class PreferenceController extends Zend_Controller_Action $this->view->form = $form; $this->view->num_stream = $num_of_stream; $this->view->statusMsg = "
"._("Stream Setting Updated.")."
"; - die(json_encode(array("valid"=>"true", "html"=>$this->view->render('preference/stream-setting.phtml')))); + die(json_encode(array( + "valid"=>"true", + "html"=>$this->view->render('preference/stream-setting.phtml'), + "s1_set_admin_pass"=>$s1_set_admin_pass, + "s2_set_admin_pass"=>$s2_set_admin_pass, + "s3_set_admin_pass"=>$s3_set_admin_pass, + ))); } else { $live_stream_subform->updateVariables(); $this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf(); @@ -402,4 +419,17 @@ class PreferenceController extends Zend_Controller_Action die(); } + + public function getAdminPasswordStatusAction() + { + $out = array(); + for ($i=1; $i<=3; $i++) { + if (Application_Model_StreamSetting::getAdminPass('s'.$i)=='') { + $out["s".$i] = false; + } else { + $out["s".$i] = true; + } + } + die(json_encode($out)); + } } diff --git a/airtime_mvc/application/forms/StreamSettingSubForm.php b/airtime_mvc/application/forms/StreamSettingSubForm.php index eea40d8a7..874f38dc5 100644 --- a/airtime_mvc/application/forms/StreamSettingSubForm.php +++ b/airtime_mvc/application/forms/StreamSettingSubForm.php @@ -203,7 +203,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm $adminUser->setAttrib('alt', 'regular_text'); $this->addElement($adminUser); - $adminPass = new Zend_Form_Element_Text('admin_pass'); + $adminPass = new Zend_Form_Element_Password('admin_pass'); $adminPass->setLabel(_("Admin Password")) ->setValue(Application_Model_StreamSetting::getAdminPass($prefix)) ->setValidators(array( diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index 981e7dc47..bfd39855e 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -220,7 +220,7 @@ class Application_Model_Preference $fade = $out; } - $fade = number_format($fade, 1); + $fade = number_format($fade, 1, '.', ''); //fades need 2 leading zeros for DateTime conversion $fade = str_pad($fade, 4, "0", STR_PAD_LEFT); @@ -457,7 +457,12 @@ class Application_Model_Preference public static function GetUserTimezone($id) { - return self::getValue("user_timezone", true); + $timezone = self::getValue("user_timezone", true); + if (!$timezone) { + return self::GetDefaultTimezone(); + } else { + return $timezone; + } } public static function GetTimezone() @@ -484,7 +489,12 @@ class Application_Model_Preference public static function GetUserLocale($id) { - return self::getValue("user_locale", true); + $locale = self::getValue("user_locale", true); + if (!$locale) { + return self::GetDefaultLocale(); + } else { + return $locale; + } } public static function SetUserLocale($userId, $locale = null) diff --git a/airtime_mvc/application/models/StreamSetting.php b/airtime_mvc/application/models/StreamSetting.php index 6bac3f02b..58c8fb496 100644 --- a/airtime_mvc/application/models/StreamSetting.php +++ b/airtime_mvc/application/models/StreamSetting.php @@ -242,7 +242,14 @@ class Application_Model_StreamSetting $v = $d['enable'] == 1 ? 'true' : 'false'; } $v = trim($v); - self::saveStreamSetting($keyname, $v); + if ($k != 'admin_pass') { + self::saveStreamSetting($keyname, $v); + /* We use 'xxxxxx' as the admin password placeholder so we + * only want to save it when it is a different string + */ + } elseif ($v != 'xxxxxx') { + self::saveStreamSetting($keyname, $v); + } } } } diff --git a/airtime_mvc/build/sql/defaultdata.sql b/airtime_mvc/build/sql/defaultdata.sql index b9d65f626..541645053 100644 --- a/airtime_mvc/build/sql/defaultdata.sql +++ b/airtime_mvc/build/sql/defaultdata.sql @@ -326,7 +326,6 @@ INSERT INTO cc_pref("keystr", "valstr") VALUES('locale', 'en_CA'); INSERT INTO cc_pref("subjid", "keystr", "valstr") VALUES(1, 'user_locale', 'en_CA'); INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('en_CA', 'English'); -INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('en_US', 'English - US'); INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('fr_FR', 'Français'); INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('de_DE', 'Deutsch'); INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('it_IT', 'Italiano'); diff --git a/airtime_mvc/locale/en_CA/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/en_CA/LC_MESSAGES/airtime.mo index b91bc503e..da0de47ec 100644 Binary files a/airtime_mvc/locale/en_CA/LC_MESSAGES/airtime.mo and b/airtime_mvc/locale/en_CA/LC_MESSAGES/airtime.mo differ diff --git a/airtime_mvc/locale/en_CA/LC_MESSAGES/airtime.po b/airtime_mvc/locale/en_CA/LC_MESSAGES/airtime.po index ef5a35226..c73f6bd02 100644 --- a/airtime_mvc/locale/en_CA/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/en_CA/LC_MESSAGES/airtime.po @@ -2660,7 +2660,7 @@ msgstr "show does not exist" #: airtime_mvc/application/controllers/ListenerstatController.php:56 msgid "Please make sure admin user/password is correct on System->Streams page." -msgstr "" +msgstr "Please make sure Admin User and Admin Password for the streaming server are present and correct under Stream -> Additional Options on the System -> Streams page." #: airtime_mvc/application/controllers/ApiController.php:57 #: airtime_mvc/application/controllers/ApiController.php:84 diff --git a/airtime_mvc/locale/zh_CN/LC_MESSAGES/airtime.mo b/airtime_mvc/locale/zh_CN/LC_MESSAGES/airtime.mo index a8a431476..d6df86424 100644 Binary files a/airtime_mvc/locale/zh_CN/LC_MESSAGES/airtime.mo and b/airtime_mvc/locale/zh_CN/LC_MESSAGES/airtime.mo differ diff --git a/airtime_mvc/locale/zh_CN/LC_MESSAGES/airtime.po b/airtime_mvc/locale/zh_CN/LC_MESSAGES/airtime.po index 4752e8d48..40ed989fd 100644 --- a/airtime_mvc/locale/zh_CN/LC_MESSAGES/airtime.po +++ b/airtime_mvc/locale/zh_CN/LC_MESSAGES/airtime.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Airtime 2.3\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2013-01-15 10:36-0500\n" -"PO-Revision-Date: 2013-01-15 14:37-0500\n" +"PO-Revision-Date: 2013-01-16 16:32-0500\n" "Last-Translator: Cliff Wang \n" "Language-Team: Chinese Localization \n" "Language: \n" @@ -434,7 +434,7 @@ msgstr "编曲" #: airtime_mvc/application/controllers/LocaleController.php:77 #: airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml:10 msgid "Genre" -msgstr "类型" +msgstr "风格" #: airtime_mvc/application/models/Block.php:1219 #: airtime_mvc/application/forms/SmartBlockCriteria.php:51 @@ -1951,7 +1951,7 @@ msgstr "文件的状态不可知。这可能是由于文件位于远程存储位 #: airtime_mvc/application/controllers/LocaleController.php:125 #, php-format msgid "Listener Count on %s: %s" -msgstr "听众计数%s:%s" +msgstr "听众统计%s:%s" #: airtime_mvc/application/controllers/LocaleController.php:127 msgid "Remind me in 1 week" @@ -2845,7 +2845,7 @@ msgstr "无效的表格内容。" #: airtime_mvc/application/views/scripts/listenerstat/index.phtml:2 msgid "Listener Count Over Time" -msgstr "听众收听时间" +msgstr "听众统计报告" #: airtime_mvc/application/views/scripts/partialviews/header.phtml:3 msgid "Previous:" diff --git a/airtime_mvc/public/js/airtime/preferences/streamsetting.js b/airtime_mvc/public/js/airtime/preferences/streamsetting.js index a1da4b30e..54bb986ca 100644 --- a/airtime_mvc/public/js/airtime/preferences/streamsetting.js +++ b/airtime_mvc/public/js/airtime/preferences/streamsetting.js @@ -412,9 +412,28 @@ function setSliderForReplayGain(){ $( "#replayGainModifier" ).val( $( "#slider-range-max" ).slider( "value" ) ); } +function setPseudoAdminPassword(s1, s2, s3) { + if (s1) { + $('#s1_data-admin_pass').val('xxxxxx'); + } + if (s2) { + $('#s2_data-admin_pass').val('xxxxxx'); + } + if (s3) { + $('#s3_data-admin_pass').val('xxxxxx'); + } +} + +function getAdminPasswordStatus() { + $.ajax({ url: baseUrl+'Preference/get-admin-password-status/format/json', dataType:"json", success:function(data){ + setPseudoAdminPassword(data.s1, data.s2, data.s3); + }}); +} + $(document).ready(function() { setupEventListeners(); setSliderForReplayGain(); + 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."); @@ -427,6 +446,7 @@ $(document).ready(function() { $('#content').empty().append(json.html); setupEventListeners(); setSliderForReplayGain(); + setPseudoAdminPassword(json.s1_set_admin_pass, json.s2_set_admin_pass, json.s3_set_admin_pass); }); } }); diff --git a/install_minimal/include/airtime-initialize.sh b/install_minimal/include/airtime-initialize.sh index 623daa9de..66e99a983 100755 --- a/install_minimal/include/airtime-initialize.sh +++ b/install_minimal/include/airtime-initialize.sh @@ -11,7 +11,7 @@ dist=`lsb_release -is` echo "Generating locales" for i in `ls /usr/share/airtime/locale | grep ".._.."`; do if [ "$dist" = "Debian" ]; then - grep -q "$i" /etc/locale.gen + grep -qi "^$i" /etc/locale.gen if [ $? -ne 0 ]; then echo "$i.UTF-8 UTF-8" >> /etc/locale.gen fi