feat(legacy): disable public radio page and redirect to login (#2903)
### Description Many people don't need the public page and use libretime purely for playout management. This adds the ability to have libretime publicly available but only present the login page to the user. **I have updated the documentation to reflect these changes**: no, but i will add documentation if this PR is accepted. ### Testing Notes **What I did:** Toggle the new ceckbox on the general settings, log out and back in and check behaviour. note: this may have conflicts with the trim overbooked PR since the toggle sits in the same place. If both are accepted this needs to be formatted nicely :-) --------- Co-authored-by: Thomas Göttgens <tgoettgens@mail.com> Co-authored-by: Jonas L. <jooola@users.noreply.github.com> Co-authored-by: Kyle Robbertze <paddatrapper@users.noreply.github.com> Co-authored-by: jo <ljonas@riseup.net>
This commit is contained in:
parent
199831458f
commit
170d09545e
6 changed files with 49 additions and 5 deletions
|
@ -8,6 +8,12 @@ class IndexController extends Zend_Controller_Action
|
|||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$baseUrl = Config::getBasePath();
|
||||
if (Application_Model_Preference::getRadioPageDisabled()) {
|
||||
$this->_helper->redirector->gotoUrl($baseUrl . 'login');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->view->headTitle(Application_Model_Preference::GetHeadTitle());
|
||||
$this->view->headScript()->appendFile(Assets::url('js/libs/jquery-1.8.3.min.js'), 'text/javascript');
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetDefaultLocale($values['locale']);
|
||||
Application_Model_Preference::SetWeekStartDay($values['weekStartDay']);
|
||||
Application_Model_Preference::setRadioPageDisplayLoginButton($values['radioPageLoginButton']);
|
||||
Application_Model_Preference::setRadioPageDisabled($values['radioPageDisabled']);
|
||||
Application_Model_Preference::SetFeaturePreviewMode($values['featurePreviewMode']);
|
||||
|
||||
$logoUploadElement = $form->getSubForm('preferences_general')->getElement('stationLogo');
|
||||
|
|
|
@ -202,11 +202,24 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
|
|||
if ($displayRadioPageLoginButtonValue == '') {
|
||||
$displayRadioPageLoginButtonValue = true;
|
||||
}
|
||||
$radioPageLoginButton->addDecorator('Label', ['class' => 'enable-tunein']);
|
||||
$radioPageLoginButton->addDecorator('Label');
|
||||
$radioPageLoginButton->setLabel(_('Display login button on your Radio Page?'));
|
||||
$radioPageLoginButton->setValue($displayRadioPageLoginButtonValue);
|
||||
$this->addElement($radioPageLoginButton);
|
||||
|
||||
// add a checkbox for completely disabling the radio page
|
||||
$radioPageDisabled = new Zend_Form_Element_Checkbox('radioPageDisabled');
|
||||
$radioPageDisabled->setDecorators([
|
||||
'ViewHelper',
|
||||
'Errors',
|
||||
'Label',
|
||||
]);
|
||||
$radioPageDisabledValue = Application_Model_Preference::getRadioPageDisabled();
|
||||
$radioPageDisabled->addDecorator('Label');
|
||||
$radioPageDisabled->setLabel(_('Disable the public radio page and redirect to the login page?'));
|
||||
$radioPageDisabled->setValue($radioPageDisabledValue);
|
||||
$this->addElement($radioPageDisabled);
|
||||
|
||||
$feature_preview_mode = new Zend_Form_Element_Radio('featurePreviewMode');
|
||||
$feature_preview_mode->setLabel(_('Feature Previews'));
|
||||
$feature_preview_mode->setMultiOptions([
|
||||
|
|
|
@ -1399,6 +1399,16 @@ class Application_Model_Preference
|
|||
self::setValue('radio_page_display_login_button', $value);
|
||||
}
|
||||
|
||||
public static function getRadioPageDisabled()
|
||||
{
|
||||
return boolval(self::getValue('radio_page_disabled', false));
|
||||
}
|
||||
|
||||
public static function setRadioPageDisabled($value)
|
||||
{
|
||||
self::setValue('radio_page_disabled', $value);
|
||||
}
|
||||
|
||||
public static function getLangTimezoneSetupComplete()
|
||||
{
|
||||
return self::getValue('lang_tz_setup_complete');
|
||||
|
|
|
@ -47,5 +47,8 @@
|
|||
|
||||
<?php echo $this->element->getElement('radioPageLoginButton')->renderViewHelper() ?>
|
||||
<?php echo $this->element->getElement('radioPageLoginButton')->renderLabel() ?>
|
||||
<br />
|
||||
<?php echo $this->element->getElement('radioPageDisabled')->renderViewHelper() ?>
|
||||
<?php echo $this->element->getElement('radioPageDisabled')->renderLabel() ?>
|
||||
</dl>
|
||||
</fieldset>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue