Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
James 2013-01-10 14:52:45 -05:00
commit 55fa8b8dc1
15 changed files with 30 additions and 34 deletions

View File

@ -117,6 +117,7 @@ class LocaleController extends Zend_Controller_Action
"Dynamic block is not previewable" => _("Dynamic block is not previewable"),
"Limit to: " => _("Limit to: "),
"Playlist saved" => _("Playlist saved"),
"Playlist shuffled" => _("Playlist shuffled"),
"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."
=> _("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."),
//listenerstat/listenerstat.js

View File

@ -13,7 +13,7 @@ class LoginController extends Zend_Controller_Action
$request = $this->getRequest();
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale'));
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', 'en_CA'));
if (Zend_Auth::getInstance()->hasIdentity())
{

View File

@ -129,12 +129,7 @@ class UserController extends Zend_Controller_Action
$request = $this->getRequest();
$form = new Application_Form_EditUser();
if ($request->isPost()) {
$params = $request->getPost();
$postData = explode('&', $params['data']);
foreach($postData as $k=>$v) {
$v = explode('=', $v);
$formData[$v[0]] = urldecode($v[1]);
}
$formData = $request->getPost();
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1
&& $formData['cu_login'] == 'admin') {
@ -157,12 +152,19 @@ class UserController extends Zend_Controller_Action
$user->setSkype($formData['cu_skype']);
$user->setJabber($formData['cu_jabber']);
$user->save();
Application_Model_Preference::SetUserLocale($user->getId(), $formData['cu_locale']);
Application_Model_Preference::SetUserTimezone($user->getId(), $formData['cu_timezone']);
$this->view->successMessage = "<div class='success'>"._("User updated successfully!")."</div>";
//configure localization with new locale setting
Application_Model_Locale::configureLocalization($formData['cu_locale']);
//reinitialize form so language gets translated
$form = new Application_Form_EditUser();
$this->view->successMessage = "<div class='success'>"._("Settings updated successfully!")."</div>";
}
$this->view->form = $form;
die(json_encode(array("locale"=>$formData['cu_locale'], "html"=>$this->view->render('user/edit-user.phtml'))));
$this->view->html = $this->view->render('user/edit-user.phtml');
}
$this->view->form = $form;
$this->view->html = $this->view->render('user/edit-user.phtml');

View File

@ -18,7 +18,7 @@ class Application_Form_EditUser extends Zend_Form
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/edit-user.phtml'))));
array('ViewScript', array('viewScript' => 'form/edit-user.phtml', "currentUser" => $currentUser->getLogin()))));
$this->setAttrib('id', 'current-user-form');
$hidden = new Zend_Form_Element_Hidden('cu_user_id');

View File

@ -7,7 +7,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
public function init()
{
$this->setAction('/Showbuilder');
$this->setAction(Application_Common_OsPath::getBaseDir().'/Showbuilder');
$this->setMethod('post');
$country_list = Application_Model_Preference::GetCountryList();

View File

@ -452,12 +452,12 @@ class Application_Model_Preference
if (is_null($timezone)) {
$timezone = self::GetDefaultTimezone();
}
self::setValue("user_".$userId."_timezone", $timezone, true, $userId);
self::setValue("user_timezone", $timezone, true, $userId);
}
public static function GetUserTimezone($id)
{
return self::getValue("user_".$id."_timezone", true);
return self::getValue("user_timezone", true);
}
public static function GetTimezone()
@ -484,7 +484,7 @@ class Application_Model_Preference
public static function GetUserLocale($id)
{
return self::getValue("user_".$id."_locale", true);
return self::getValue("user_locale", true);
}
public static function SetUserLocale($userId, $locale = null)
@ -494,7 +494,7 @@ class Application_Model_Preference
if (is_null($locale)) {
$locale = self::GetDefaultLocale();
}
self::setValue("user_".$userId."_locale", $locale, true, $userId);
self::setValue("user_locale", $locale, true, $userId);
}
public static function GetLocale()

View File

@ -1,5 +1,6 @@
<h2><? echo sprintf(_("%s's Settings"), $this->currentUser) ?></h2>
<div id="current-user-container">
<form id="current-user-form" class="edit-user-global" enctype="application/x-www-form-urlencoded">
<form id="current-user-form" class="edit-user-global" method="post" enctype="application/x-www-form-urlencoded">
<dl class="zend_form">
<?php echo $this->element->getElement('cu_user_id') ?>
<dt id="cu-username-label">
@ -142,7 +143,7 @@
</ul>
<?php endif; ?>
</dd>
<button id="cu_save_user" type="button" class="btn btn-small right-floated">Save</button>
<button type="submit" id="cu_save_user" class="btn btn-small right-floated">Save</button>
</dl>
</form>
</div>

View File

@ -1,5 +1,4 @@
<div class="ui-widget ui-widget-content block-shadow clearfix padded-strong edit-current-user">
<h2><? echo _("Edit User") ?></h2>
<?php echo $this->successMessage ?>
<?php echo $this->form?>
</div>

View File

@ -323,7 +323,7 @@ INSERT INTO cc_stream_setting (keyname, value, type) VALUES ('s3_channels', 'ste
-- added in 2.3
INSERT INTO cc_pref("keystr", "valstr") VALUES('locale', 'en_CA');
INSERT INTO cc_pref("subjid", "keystr", "valstr") VALUES(1, 'user_1_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 ('zh_CN', 'Chinese');
INSERT INTO cc_locale (locale_code, locale_lang) VALUES ('en_CA', 'English');

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

View File

@ -2000,7 +2000,7 @@ span.errors.sp-errors{
background:url(images/icon_alert_cal_alt.png) no-repeat 0 0;
}
.small-icon.show-partial-filled {
background:url(images/icon_alert_cal_alt.png) no-repeat 0 0;
background:url(images/icon_alert_cal_alt2.png) no-repeat 0 0;
}
.medium-icon {
display:block;

View File

@ -462,14 +462,7 @@ $(document).ready(function() {
});
$('#cu_save_user').live('click', function() {
var data = $('#current-user-form').serialize();
$.post(baseUrl+'/user/edit-user', {format: 'json', data: data}, function(data) {
var json = $.parseJSON(data);
$('.edit-current-user').parent().empty().append(json.html);
$.cookie("airtime_locale", json.locale, {path: '/'});
setCurrentUserPseudoPassword();
setTimeout(removeSuccessMsg, 5000);
});
$.cookie("airtime_locale", $('#cu_locale').val(), {path: '/'});
});
// When the 'Listen' button is clicked we set the width

View File

@ -641,7 +641,7 @@ var AIRTIME = (function(AIRTIME){
$pl.on("click", 'button[id="playlist_shuffle_button"]', function(){
obj_id = $('input[id="obj_id"]').val();
url = "/Playlist/shuffle";
url = baseUrl+"/Playlist/shuffle";
enableLoadingIcon();
$.post(url, {format: "json", obj_id: obj_id}, function(data){
var json = $.parseJSON(data)
@ -651,7 +651,7 @@ var AIRTIME = (function(AIRTIME){
}
AIRTIME.playlist.fnOpenPlaylist(json);
if (json.result == "0") {
$pl.find('.success').text('Playlist shuffled');
$pl.find('.success').text($.i18n._('Playlist shuffled'));
$pl.find('.success').show();
}
disableLoadingIcon();

View File

@ -171,7 +171,7 @@ AIRTIME = (function(AIRTIME) {
schedTable.fnDraw();
$.ajax( {
url : "/usersettings/set-now-playing-screen-settings",
url : baseUrl+"/usersettings/set-now-playing-screen-settings",
type : "POST",
data : {
settings : {
@ -197,7 +197,7 @@ AIRTIME = (function(AIRTIME) {
schedTable.fnDraw();
$.ajax( {
url : "/usersettings/set-now-playing-screen-settings",
url : baseUrl+"/usersettings/set-now-playing-screen-settings",
type : "POST",
data : {
settings : {
@ -271,7 +271,7 @@ AIRTIME = (function(AIRTIME) {
$.ajax( {
"dataType" : "json",
"type" : "GET",
"url" : "/showbuilder/check-builder-feed",
"url" : baseUrl+"/showbuilder/check-builder-feed",
"data" : data,
"success" : function(json) {
if (json.update === true) {

View File

@ -340,7 +340,7 @@ class AirtimeInstall
if ($result < 1) {
return false;
}
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr) VALUES (1, 'user_1_timezone', '$defaultTimezone')";
$sql = "INSERT INTO cc_pref (subjid, keystr, valstr) VALUES (1, 'user_timezone', '$defaultTimezone')";
$result = $con->exec($sql);
if ($result < 1) {
return false;