Merge remote-tracking branch 'origin/saas-dev-lang-tz-setup' into saas-dev
This commit is contained in:
commit
2aaba99b9a
|
@ -40,7 +40,8 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
|
||||||
->add(new Zend_Acl_Resource('provisioning'))
|
->add(new Zend_Acl_Resource('provisioning'))
|
||||||
->add(new Zend_Acl_Resource('player'))
|
->add(new Zend_Acl_Resource('player'))
|
||||||
->add(new Zend_Acl_Resource('soundcloud'))
|
->add(new Zend_Acl_Resource('soundcloud'))
|
||||||
->add(new Zend_Acl_Resource('embeddablewidgets'));
|
->add(new Zend_Acl_Resource('embeddablewidgets'))
|
||||||
|
->add(new Zend_Acl_Resource('setup'));
|
||||||
|
|
||||||
/** Creating permissions */
|
/** Creating permissions */
|
||||||
$ccAcl->allow('G', 'index')
|
$ccAcl->allow('G', 'index')
|
||||||
|
@ -60,6 +61,7 @@ $ccAcl->allow('G', 'index')
|
||||||
->allow('G', 'downgrade')
|
->allow('G', 'downgrade')
|
||||||
->allow('G', 'rest:show-image', 'get')
|
->allow('G', 'rest:show-image', 'get')
|
||||||
->allow('G', 'rest:media', 'get')
|
->allow('G', 'rest:media', 'get')
|
||||||
|
->allow('G', 'setup')
|
||||||
->allow('H', 'soundcloud')
|
->allow('H', 'soundcloud')
|
||||||
->allow('H', 'rest:show-image')
|
->allow('H', 'rest:show-image')
|
||||||
->allow('H', 'rest:media')
|
->allow('H', 'rest:media')
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class SetupController extends Zend_Controller_Action
|
||||||
|
{
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||||
|
$ajaxContext->addActionContext('setup-language-timezone', 'json');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setupLanguageTimezoneAction()
|
||||||
|
{
|
||||||
|
$this->view->layout()->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$form = new Application_Form_SetupLanguageTimezone();
|
||||||
|
|
||||||
|
if ($request->isPost()) {
|
||||||
|
|
||||||
|
$formData = $request->getPost();
|
||||||
|
if ($form->isValid($formData)) {
|
||||||
|
$userService = new Application_Service_UserService();
|
||||||
|
$currentUser = $userService->getCurrentUser();
|
||||||
|
$currentUserId = $currentUser->getDbId();
|
||||||
|
|
||||||
|
Application_Model_Preference::SetUserTimezone($formData["setup_timezone"], $currentUserId);
|
||||||
|
Application_Model_Preference::SetDefaultTimezone($formData["setup_timezone"]);
|
||||||
|
|
||||||
|
Application_Model_Preference::SetUserLocale($formData["setup_language"], $currentUserId);
|
||||||
|
Application_Model_Preference::SetDefaultLocale($formData["setup_language"]);
|
||||||
|
|
||||||
|
Application_Model_Preference::setLangTimezoneSetupComplete(true);
|
||||||
|
|
||||||
|
$this->_redirect('/Showbuilder');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->_redirect('/Showbuilder');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -45,6 +45,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
//$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
//$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.ColReorder.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.FixedColumns.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/datatables/plugin/dataTables.columnFilter.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'js/js-timezone-detect/jstz-1.0.4.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/blockui/jquery.blockUI.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/buttons/buttons.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
@ -55,8 +56,22 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColVis.css?'.$CC_CONFIG['airtime_version']);
|
||||||
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
$this->view->headLink()->appendStylesheet($baseUrl.'css/datatables/css/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||||
|
|
||||||
$refer_sses = new Zend_Session_Namespace('referrer');
|
$setupComplete = Application_Model_Preference::getLangTimezoneSetupComplete();
|
||||||
|
$previousPage = $request->getHeader('Referer');
|
||||||
|
$userService = new Application_Service_UserService();
|
||||||
|
$currentUser = $userService->getCurrentUser();
|
||||||
|
|
||||||
|
// If current user is Super Admin, and they came from the login page,
|
||||||
|
// and they have not seen the setup popup before
|
||||||
|
if ($currentUser->getDbType() == "S" && strpos(strtolower($previousPage), 'login') !== false
|
||||||
|
&& empty($setupComplete)) {
|
||||||
|
$lang_tz_popup_form = new Application_Form_SetupLanguageTimezone();
|
||||||
|
$this->view->lang_tz_popup_form = $lang_tz_popup_form;
|
||||||
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/lang-timezone-setup.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: is it safe to remove this??
|
||||||
|
/*
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
$form = new Application_Form_RegisterAirtime();
|
$form = new Application_Form_RegisterAirtime();
|
||||||
|
|
||||||
|
@ -115,6 +130,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
||||||
$this->view->dialog = $form;
|
$this->view->dialog = $form;
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
//determine whether to remove/hide/display the library.
|
//determine whether to remove/hide/display the library.
|
||||||
$showLib = false;
|
$showLib = false;
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Application_Form_SetupLanguageTimezone extends Zend_Form_SubForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function init()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->setDecorators(array(
|
||||||
|
array('ViewScript', array('viewScript' => 'form/setup-lang-timezone.phtml'))));
|
||||||
|
|
||||||
|
$csrf_namespace = new Zend_Session_Namespace('csrf_namespace');
|
||||||
|
$csrf_element = new Zend_Form_Element_Hidden('csrf');
|
||||||
|
$csrf_element->setValue($csrf_namespace->authtoken)->setRequired('true')->removeDecorator('HtmlTag')->removeDecorator('Label');
|
||||||
|
$this->addElement($csrf_element);
|
||||||
|
|
||||||
|
$language = new Zend_Form_Element_Select('setup_language');
|
||||||
|
$language->setLabel(_("Station Language"));
|
||||||
|
$language->setMultiOptions(Application_Model_Locale::getLocales());
|
||||||
|
$this->addElement($language);
|
||||||
|
|
||||||
|
$timezone = new Zend_Form_Element_Select('setup_timezone');
|
||||||
|
$timezone->setLabel(_("Station Timezone"));
|
||||||
|
$timezone->setMultiOptions(Application_Common_Timezone::getTimezones());
|
||||||
|
$this->addElement($timezone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1521,4 +1521,14 @@ class Application_Model_Preference
|
||||||
{
|
{
|
||||||
self::setValue("radio_page_display_login_button", $value);
|
self::setValue("radio_page_display_login_button", $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getLangTimezoneSetupComplete()
|
||||||
|
{
|
||||||
|
return self::getValue("lang_tz_setup_complete");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setLangTimezoneSetupComplete($value)
|
||||||
|
{
|
||||||
|
self::setValue("lang_tz_setup_complete", $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<div id="lang-timezone-popup" class="dialogPopup register-dialog" title="<?php echo _("Setup Station Language and Timezone") ?>" style="display: none;">
|
||||||
|
<form id="lang-timezone-form" method="post" action="/setup/setup-language-timezone">
|
||||||
|
<fieldset>
|
||||||
|
<dl class="zend_form">
|
||||||
|
<?php echo $this->element->getElement('csrf') ?>
|
||||||
|
|
||||||
|
<?php echo $this->element->getElement('setup_language')->render(); ?>
|
||||||
|
|
||||||
|
<?php echo $this->element->getElement('setup_timezone')->render(); ?>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
You can set these settings later under Preferences and your user settings.
|
||||||
|
</dl>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
</div>
|
|
@ -21,4 +21,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<?php echo $this->dialog ?>
|
<?php
|
||||||
|
// TODO: can we remove this???
|
||||||
|
//echo $this->dialog ?>
|
||||||
|
|
||||||
|
<?php echo $this->lang_tz_popup_form; ?>
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
var dialog = $("#lang-timezone-popup");
|
||||||
|
|
||||||
|
dialog.dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
width: 500,
|
||||||
|
resizable: false,
|
||||||
|
modal: true,
|
||||||
|
position:['center',50],
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
id: "setup-later",
|
||||||
|
text: $.i18n._("Set Later"),
|
||||||
|
"class": "btn",
|
||||||
|
click: function() {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "help_airtime",
|
||||||
|
text: $.i18n._("OK"),
|
||||||
|
"class": "btn",
|
||||||
|
click: function() {
|
||||||
|
$("#lang-timezone-form").submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
var language = window.navigator.userLanguage || window.navigator.language;
|
||||||
|
if (language === undefined) {
|
||||||
|
language = "en_CA";
|
||||||
|
}
|
||||||
|
language = language.replace("-", "_");
|
||||||
|
$("#setup_language").val(language);
|
||||||
|
|
||||||
|
var timezone = jstz.determine();
|
||||||
|
var timezone_name = timezone.name();
|
||||||
|
if (timezone_name === undefined) {
|
||||||
|
timezone_name = "America/Toronto";
|
||||||
|
}
|
||||||
|
$("#setup_timezone").val(timezone_name);
|
||||||
|
|
||||||
|
dialog.dialog('open');
|
||||||
|
});
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue