diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index ce12e0ce1..4d22bd95d 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -18,6 +18,7 @@ require_once "Database.php"; require_once "Timezone.php"; require_once "Auth.php"; require_once __DIR__.'/forms/helpers/ValidationTypes.php'; +require_once __DIR__.'/forms/helpers/CustomDecorators.php'; require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php'; require_once __DIR__.'/controllers/plugins/Maintenance.php'; require_once __DIR__.'/modules/rest/controllers/ShowController.php'; diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index ecee11b6d..0a6b2335c 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -5,6 +5,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm public function init() { + $maxLens = Application_Model_Show::getMaxLengths(); + $notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator(); $rangeValidator = Application_Form_Helper_ValidationTypes::overrideBetweenValidator(0, 59.9); $this->setDecorators(array( @@ -13,104 +15,100 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $defaultFadeIn = Application_Model_Preference::GetDefaultFadeIn(); $defaultFadeOut = Application_Model_Preference::GetDefaultFadeOut(); - + //Station name $this->addElement('text', 'stationName', array( - 'class' => 'input_text', - 'label' => _('Station Name'), - 'required' => false, - 'filters' => array('StringTrim'), + 'class' => 'input_text', + 'label' => _('Station Name'), + 'required' => false, + 'filters' => array('StringTrim'), 'value' => Application_Model_Preference::GetStationName(), - 'decorators' => array( - 'ViewHelper' - ) )); - - //Default station fade in + + // Station description + $stationDescription = new Zend_Form_Element_Textarea("stationDescription"); + $stationDescription->setLabel(_('Station Description')); + $stationDescription->setValue(Application_Model_Preference::GetStationDescription()); + $stationDescription->setRequired(false); + $stationDescription->setValidators(array(array('StringLength', false, array(0, $maxLens['description'])))); + $stationDescription->setAttrib('rows', 4); + $this->addElement($stationDescription); + + //Default station crossfade duration $this->addElement('text', 'stationDefaultCrossfadeDuration', array( - 'class' => 'input_text', - 'label' => _('Default Crossfade Duration (s):'), - 'required' => true, - 'filters' => array('StringTrim'), - 'validators' => array( - array( - $rangeValidator, - $notEmptyValidator, - 'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')) - ) - ), - 'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(), - 'decorators' => array( - 'ViewHelper' - ) + 'class' => 'input_text', + 'label' => _('Default Crossfade Duration (s):'), + 'required' => true, + 'filters' => array('StringTrim'), + 'validators' => array( + $rangeValidator, + $notEmptyValidator, + array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)'))) + ), + 'value' => Application_Model_Preference::GetDefaultCrossfadeDuration(), )); //Default station fade in $this->addElement('text', 'stationDefaultFadeIn', array( - 'class' => 'input_text', - 'label' => _('Default Fade In (s):'), - 'required' => true, - 'filters' => array('StringTrim'), + 'class' => 'input_text', + 'label' => _('Default Fade In (s):'), + 'required' => true, + 'filters' => array('StringTrim'), 'validators' => array( - array( - $rangeValidator, - $notEmptyValidator, - 'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')) - ) + $rangeValidator, + $notEmptyValidator, + array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)'))) ), 'value' => $defaultFadeIn, - 'decorators' => array( - 'ViewHelper' - ) )); - + //Default station fade out $this->addElement('text', 'stationDefaultFadeOut', array( - 'class' => 'input_text', - 'label' => _('Default Fade Out (s):'), - 'required' => true, - 'filters' => array('StringTrim'), - 'validators' => array( - array( - $rangeValidator, - $notEmptyValidator, - 'regex', false, array('/^[0-9]{1,2}(\.\d{1})?$/', 'messages' => _('enter a time in seconds 0{.0}')) - ) - ), - 'value' => $defaultFadeOut, - 'decorators' => array( - 'ViewHelper' - ) + 'class' => 'input_text', + 'label' => _('Default Fade Out (s):'), + 'required' => true, + 'filters' => array('StringTrim'), + 'validators' => array( + $rangeValidator, + $notEmptyValidator, + array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)'))) + ), + 'value' => $defaultFadeOut, )); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); - $third_party_api->setLabel( - sprintf(_('Allow Remote Websites To Access "Schedule" Info?%s (Enable this to make front-end widgets work.)'), '
')); - $third_party_api->setMultiOptions(array(_("Disabled"), - _("Enabled"))); + $third_party_api->setLabel(_('Public Airtime API')); + $third_party_api->setDescription(_('Required for embeddable schedule widget.')); + $third_party_api->setMultiOptions(array( + _("Disabled"), + _("Enabled"), + )); $third_party_api->setValue(Application_Model_Preference::GetAllow3rdPartyApi()); - $third_party_api->setDecorators(array('ViewHelper')); + $third_party_api->setDescription(_('Enabling this feature will allow Airtime to provide schedule data + to external widgets that can be embedded in your website. Enable this + feature to reveal the embeddable code.')); + $third_party_api->setSeparator(' '); //No
between radio buttons + //$third_party_api->addDecorator(new Zend_Form_Decorator_Label(array('tag' => 'dd', 'class' => 'radio-inline-list'))); + $third_party_api->addDecorator('HtmlTag', array('tag' => 'dd', + 'id'=>"thirdPartyApi-element", + 'class' => 'radio-inline-list', + )); $this->addElement($third_party_api); - // - // Add the description element - $this->addElement('textarea', 'widgetCode', array( - 'label' => _('HTML Code:'), - 'required' => false, - 'readonly' => true, - 'style' => 'font-family: Consolas, "Liberation Mono", Courier, - monospace;', - 'class' => 'input_text_area', - 'value' => self::getWidgetCode(), //$_SERVER["SERVER_NAME"], - 'decorators' => array( - 'ViewHelper' - ) - )); + // Add the description element + $this->addElement('textarea', 'widgetCode', array( + 'label' => 'Javascript Code:', + 'required' => false, + 'readonly' => true, + 'style' => 'font-family: Consolas, "Liberation Mono", Courier, + monospace;', + 'value' => self::getWidgetCode(), + )); + $this->getElement('widgetCode')->addDecorator(new Airtime_Decorator_SuperAdmin_Only()); $locale = new Zend_Form_Element_Select("locale"); - $locale->setLabel(_("Default Interface Language")); + $locale->setLabel(_("Default Language")); $locale->setMultiOptions(Application_Model_Locale::getLocales()); $locale->setValue(Application_Model_Preference::GetDefaultLocale()); - $locale->setDecorators(array('ViewHelper')); $this->addElement($locale); /* Form Element for setting the Timezone */ @@ -118,7 +116,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $timezone->setLabel(_("Station Timezone")); $timezone->setMultiOptions(Application_Common_Timezone::getTimezones()); $timezone->setValue(Application_Model_Preference::GetDefaultTimezone()); - $timezone->setDecorators(array('ViewHelper')); $this->addElement($timezone); /* Form Element for setting which day is the start of the week */ @@ -126,7 +123,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm $week_start_day->setLabel(_("Week Starts On")); $week_start_day->setMultiOptions($this->getWeekStartDays()); $week_start_day->setValue(Application_Model_Preference::GetWeekStartDay()); - $week_start_day->setDecorators(array('ViewHelper')); $this->addElement($week_start_day); } diff --git a/airtime_mvc/application/forms/LiveStreamingPreferences.php b/airtime_mvc/application/forms/LiveStreamingPreferences.php index 6dd14c40e..eae785bf3 100644 --- a/airtime_mvc/application/forms/LiveStreamingPreferences.php +++ b/airtime_mvc/application/forms/LiveStreamingPreferences.php @@ -10,9 +10,6 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm $isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true"; $defaultFade = Application_Model_Preference::GetDefaultTransitionFade(); - if ($defaultFade == "") { - $defaultFade = '00.000000'; - } // automatic trasition on source disconnection $auto_transition = new Zend_Form_Element_Checkbox("auto_transition"); @@ -32,8 +29,8 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm $transition_fade = new Zend_Form_Element_Text("transition_fade"); $transition_fade->setLabel(_("Switch Transition Fade (s)")) ->setFilters(array('StringTrim')) - ->addValidator('regex', false, array('/^[0-9]{1,2}(\.\d{1,6})?$/', - 'messages' => _('enter a time in seconds 00{.000000}'))) + ->addValidator('regex', false, array('/^[0-9]{1,2}(\.\d{1,3})?$/', + 'messages' => _('enter a time in seconds 0{.000}'))) ->setValue($defaultFade) ->setDecorators(array('ViewHelper')); $this->addElement($transition_fade); diff --git a/airtime_mvc/application/forms/helpers/CustomDecorators.php b/airtime_mvc/application/forms/helpers/CustomDecorators.php new file mode 100644 index 000000000..316774b89 --- /dev/null +++ b/airtime_mvc/application/forms/helpers/CustomDecorators.php @@ -0,0 +1,14 @@ +isSuperAdmin()) { + return $content; + } else { + return ""; + } + } +} \ No newline at end of file diff --git a/airtime_mvc/application/layouts/scripts/login.phtml b/airtime_mvc/application/layouts/scripts/login.phtml index 6a9879673..b12f00d34 100644 --- a/airtime_mvc/application/layouts/scripts/login.phtml +++ b/airtime_mvc/application/layouts/scripts/login.phtml @@ -21,9 +21,9 @@ $companySiteAnchor = "" . $company . ""; - echo sprintf(_('%1$s copyright © %2$s All rights reserved.%3$s' - . 'Maintained and distributed under the %4$s by %5$s'), - PRODUCT_NAME, $company, "
", + echo sprintf(_('%1$s copyright © %2$s All rights reserved.
' + . 'Maintained and distributed under the %3$s by %4$s'), + PRODUCT_NAME, $company, $licenseSiteAnchor, $companySiteAnchor); ?> diff --git a/airtime_mvc/application/models/Preference.php b/airtime_mvc/application/models/Preference.php index f3175f155..1ca0a7442 100644 --- a/airtime_mvc/application/models/Preference.php +++ b/airtime_mvc/application/models/Preference.php @@ -263,7 +263,7 @@ class Application_Model_Preference if ($fade === "") { // the default value of the fade is 00.5 - return "00.5"; + return "0.5"; } return $fade; @@ -279,8 +279,8 @@ class Application_Model_Preference $fade = self::getValue("default_fade_out"); if ($fade === "") { - // the default value of the fade is 00.5 - return "00.5"; + // the default value of the fade is 0.5 + return "0.5"; } return $fade; @@ -291,33 +291,6 @@ class Application_Model_Preference self::setValue("default_fade", $fade); } - public static function GetDefaultFade() - { - $fade = self::getValue("default_fade"); - - if ($fade === "") { - // the default value of the fade is 00.5 - return "00.5"; - } - - // we need this function to work with 2.0 version on default_fade value in cc_pref - // it has 00:00:00.000000 format where in 2.1 we have 00.000000 format - if (preg_match("/([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{6})/", $fade, $matches) == 1 && count($matches) == 5) { - $out = 0; - $out += intval($matches[1] * 3600); - $out += intval($matches[2] * 60); - $out += intval($matches[3]); - $out .= ".$matches[4]"; - $fade = $out; - } - - $fade = number_format($fade, 1, '.', ''); - //fades need 2 leading zeros for DateTime conversion - $fade = str_pad($fade, 4, "0", STR_PAD_LEFT); - - return $fade; - } - public static function SetDefaultTransitionFade($fade) { self::setValue("default_transition_fade", $fade); @@ -330,7 +303,7 @@ class Application_Model_Preference public static function GetDefaultTransitionFade() { $transition_fade = self::getValue("default_transition_fade"); - return ($transition_fade == "") ? "00.000000" : $transition_fade; + return ($transition_fade == "") ? "0.000" : $transition_fade; } public static function SetStreamLabelFormat($type) diff --git a/airtime_mvc/application/views/scripts/form/preferences.phtml b/airtime_mvc/application/views/scripts/form/preferences.phtml index f32167ea7..475f86928 100644 --- a/airtime_mvc/application/views/scripts/form/preferences.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences.phtml @@ -1,10 +1,5 @@
element->getElement('csrf') ?> element->getSubform('preferences_general') ?> - -

-
- element->getSubform('preferences_soundcloud') ?> -
- +
diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index c8ab6bdb8..2cbe40c78 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -1,156 +1,25 @@
-
- -
-
- element->getElement('stationName') ?> - element->getElement('stationName')->hasErrors()) : ?> -
    - element->getElement('stationName')->getMessages() as $error): ?> -
  • - -
- -
-
- -
-
- element->getElement('stationDefaultFadeIn') ?> - element->getElement('stationDefaultFadeIn')->hasErrors()) : ?> -
    - element->getElement('stationDefaultFadeIn')->getMessages() as $error): ?> -
  • - -
- -
-
- -
-
- element->getElement('stationDefaultFadeOut') ?> - element->getElement('stationDefaultFadeOut')->hasErrors()) : ?> -
    - element->getElement('stationDefaultFadeOut')->getMessages() as $error): ?> -
  • - -
- -
-
- -
-
- element->getElement('stationDefaultCrossfadeDuration') ?> - element->getElement('stationDefaultCrossfadeDuration')->hasErrors()) : ?> -
    - element->getElement('stationDefaultCrossfadeDuration')->getMessages() as $error): ?> -
  • - -
- -
-
- - -
-
- element->getElement('thirdPartyApi')->getValue(); - ?> + element->getElement('stationName')->render() ?> - element->getElement('thirdPartyApi')->getMultiOptions() as $radio) : ?> - - - - element->getElement('thirdPartyApi')->hasErrors()) : ?> -
    - element->getElement('thirdPartyApi')->getMessages() as $error): ?> -
  • - -
- -
+ element->getElement('stationDescription')->render() ?> - - -
- -
-
- element->getElement('locale') ?> - element->getElement('locale')->hasErrors()) : ?> -
    - element->getElement('locale')->getMessages() as $error): ?> -
  • - -
- -
+ element->getElement('locale')->render() ?> -
- -
-
- element->getElement('timezone') ?> - element->getElement('timezone')->hasErrors()) : ?> -
    - element->getElement('timezone')->getMessages() as $error): ?> -
  • - -
- -
+ element->getElement('timezone')->render() ?> - -
- -
-
- element->getElement('weekStartDay')->getValue(); - ?> - + element->getElement('weekStartDay')->render() ?> + + element->getElement('stationDefaultFadeIn')->render() ?> + + element->getElement('stationDefaultFadeOut')->render() ?> + + element->getElement('stationDefaultCrossfadeDuration')->render() ?> + + element->getElement('thirdPartyApi')->render() ?> + + element->getElement('widgetCode')->render() ?> - element->getElement('weekStartDay')->hasErrors()) : ?> -
    - element->getElement('weekStartDay')->getMessages() as $error): ?> -
  • - -
- -
diff --git a/airtime_mvc/application/views/scripts/form/register-dialog.phtml b/airtime_mvc/application/views/scripts/form/register-dialog.phtml index 999eb045d..358cc692a 100644 --- a/airtime_mvc/application/views/scripts/form/register-dialog.phtml +++ b/airtime_mvc/application/views/scripts/form/register-dialog.phtml @@ -3,10 +3,10 @@
-
") ?> + " + ."Click the box below and we'll make sure the features you use are constantly improving."), + PRODUCT_NAME)?>