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

This commit is contained in:
Martin Konecny 2013-01-10 14:24:51 -05:00
commit e0b71568b7
17 changed files with 44 additions and 38 deletions

View file

@ -177,6 +177,8 @@ class AudiopreviewController extends Zend_Controller_Action
private function createElementMap($track)
{
$baseUrl = Application_Common_OsPath::getBaseDir();
$elementMap = array( 'element_title' => isset($track['track_title'])?$track['track_title']:"",
'element_artist' => isset($track['artist_name'])?$track['artist_name']:"",
'element_id' => isset($track['id'])?$track['id']:"",

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

@ -270,11 +270,7 @@ class Application_Model_ShowBuilder
$cue_out = Application_Common_DateHelper::calculateLengthInSeconds($p_item['cue_out']);
$cue_in = Application_Common_DateHelper::calculateLengthInSeconds($p_item['cue_in']);
if ($cue_out == 0 && $cue_in == 0) {
$run_time = Application_Common_DateHelper::calculateLengthInSeconds($p_item['file_length']);
} else {
$run_time = $cue_out-$cue_in;
}
$formatter = new LengthFormatter(Application_Common_DateHelper::ConvertMSToHHMMSSmm($run_time*1000));
$row['runtime'] = $formatter->format();

View file

@ -129,9 +129,15 @@ class Application_Model_StoredFile
# Translate metadata attributes from media monitor (MDATA_KEY_*)
# to their counterparts in constants.php (usually the column names)
$track_length = $p_md['MDATA_KEY_DURATION'];
$track_length_in_sec = Application_Common_DateHelper::calculateLengthInSeconds($track_length);
foreach ($p_md as $mdConst => $mdValue) {
if (defined($mdConst)) {
if ($mdConst == "MDATA_KEY_CUE_OUT" && $mdValue == '0.0') {
$mdValue = $track_length_in_sec;
}
$dbMd[constant($mdConst)] = $mdValue;
} else {
Logging::warn("using metadata that is not defined.
[$mdConst] => [$mdValue]");

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

@ -322,7 +322,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');

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

@ -2,3 +2,9 @@ $(window).load(function(){
$("#username").focus();
$("#locale").val($.cookie("airtime_locale"));
});
$(document).ready(function() {
$("#submit").click(function() {
$.cookie("airtime_locale", $("#locale").val(), {path: '/'});
});
});

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;