Cleanup and comments for the timezone/language popup
This commit is contained in:
parent
2aaba99b9a
commit
eef61a65fc
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
/** This class displays the Language and Timezone setup popup dialog that you see on first run. */
|
||||
|
||||
class SetupController extends Zend_Controller_Action
|
||||
{
|
||||
public function init()
|
||||
|
|
|
@ -56,81 +56,8 @@ 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/ColReorder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$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()) {
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] != 1 && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
session_start(); //open session for writing again
|
||||
// unset referrer
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
} elseif ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$form->Logo->receive();
|
||||
$imagePath = $form->Logo->getFileName();
|
||||
|
||||
Application_Model_Preference::SetStationCountry($values["Country"]);
|
||||
Application_Model_Preference::SetStationCity($values["City"]);
|
||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||
Application_Model_Preference::SetStationLogo($imagePath);
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
session_start(); //open session for writing again
|
||||
// unset referrer
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
} else {
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
}
|
||||
|
||||
//popup if previous page was login
|
||||
if ($refer_sses->referrer == 'login' && Application_Model_Preference::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
*/
|
||||
//Show the timezone and language setup popup, if needed.
|
||||
$this->checkAndShowSetupPopup($request);
|
||||
|
||||
//determine whether to remove/hide/display the library.
|
||||
$showLib = false;
|
||||
|
@ -202,6 +129,26 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
||||
}
|
||||
|
||||
/** Check if we need to show the timezone/language setup popup and display it. (eg. on first run) */
|
||||
public function checkAndShowSetupPopup($request)
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
$setupComplete = Application_Model_Preference::getLangTimezoneSetupComplete();
|
||||
$previousPage = $request->getHeader('Referer');
|
||||
$userService = new Application_Service_UserService();
|
||||
$currentUser = $userService->getCurrentUser();
|
||||
$previousPageWasLoginScreen = strpos(strtolower($previousPage), 'login') !== false;
|
||||
|
||||
// If current user is Super Admin, and they came from the login page,
|
||||
// and they have not seen the setup popup before
|
||||
if ($currentUser->isSuperAdmin() && $previousPageWasLoginScreen /*&& 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');
|
||||
}
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
|
|
@ -18,6 +18,11 @@ class CcSubjs extends BaseCcSubjs {
|
|||
return $this->type === UTYPE_SUPERADMIN || $this->type === UTYPE_ADMIN || $this->type === UTYPE_PROGRAM_MANAGER;
|
||||
}
|
||||
|
||||
public function isSuperAdmin()
|
||||
{
|
||||
return $this->type === UTYPE_SUPERADMIN;
|
||||
}
|
||||
|
||||
public function isHostOfShow($showId)
|
||||
{
|
||||
return CcShowHostsQuery::create()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div id="lang-timezone-popup" class="dialogPopup register-dialog" title="<?php echo _("Setup Station Language and Timezone") ?>" style="display: none;">
|
||||
<div id="lang-timezone-popup" class="dialogPopup register-dialog" title="<?php echo sprintf(_("Welcome to %s!"), SAAS_PRODUCT_BRANDING_NAME); ?>" style="display: none;">
|
||||
<form id="lang-timezone-form" method="post" action="/setup/setup-language-timezone">
|
||||
<fieldset>
|
||||
<dl class="zend_form">
|
||||
|
@ -7,10 +7,9 @@
|
|||
<?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>
|
||||
<p style="margin-bottom: 0px; text-align: center;">You can change these later in your preferences and user settings.</p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -20,9 +20,4 @@
|
|||
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
// TODO: can we remove this???
|
||||
//echo $this->dialog ?>
|
||||
|
||||
<?php echo $this->lang_tz_popup_form; ?>
|
||||
|
|
|
@ -7,11 +7,11 @@ $(document).ready(function() {
|
|||
width: 500,
|
||||
resizable: false,
|
||||
modal: true,
|
||||
position:['center',50],
|
||||
position:['center','center'],
|
||||
buttons: [
|
||||
{
|
||||
id: "setup-later",
|
||||
text: $.i18n._("Set Later"),
|
||||
text: $.i18n._("Not Now"),
|
||||
"class": "btn",
|
||||
click: function() {
|
||||
$(this).dialog("close");
|
||||
|
|
Loading…
Reference in New Issue