diff --git a/airtime_mvc/application/Bootstrap.php b/airtime_mvc/application/Bootstrap.php index 1e0b31cf4..a7910dadf 100644 --- a/airtime_mvc/application/Bootstrap.php +++ b/airtime_mvc/application/Bootstrap.php @@ -17,6 +17,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 (APPLICATION_PATH."/logging/Logging.php"); diff --git a/airtime_mvc/application/forms/GeneralPreferences.php b/airtime_mvc/application/forms/GeneralPreferences.php index 8828c925c..d956b8d1e 100644 --- a/airtime_mvc/application/forms/GeneralPreferences.php +++ b/airtime_mvc/application/forms/GeneralPreferences.php @@ -5,6 +5,7 @@ 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); @@ -14,84 +15,90 @@ 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( + '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(), - 'decorators' => array( - 'ViewHelper' - ) + ), + '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( $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( - $rangeValidator, - $notEmptyValidator, - array('regex', false, array('/^[0-9]+(\.\d+)?$/', 'messages' => _('Please enter a time in seconds (eg. 0.5)'))) - ), - '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); $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 */ @@ -99,7 +106,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 */ @@ -107,7 +113,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/helpers/CustomDecorators.php b/airtime_mvc/application/forms/helpers/CustomDecorators.php new file mode 100644 index 000000000..a4abe2daf --- /dev/null +++ b/airtime_mvc/application/forms/helpers/CustomDecorators.php @@ -0,0 +1,2 @@ + $rows[$i]['id'], "instance_id" => $rows[$i]['instance_id'], - "name" => $rows[$i]['name'], + "name" => $rows[$i]['name'], "description" => $rows[$i]['description'], - "url" => $rows[$i]['url'], + "url" => $rows[$i]['url'], "start_timestamp" => $rows[$i]['start_timestamp'], "end_timestamp" => $rows[$i]['end_timestamp'], "starts" => $rows[$i]['starts'], "ends" => $rows[$i]['ends'], "record" => $rows[$i]['record'], "image_path" => $rows[$i]['image_path'], - "type" => "show"); + "type" => "show"); break; } } diff --git a/airtime_mvc/application/views/scripts/form/preferences_general.phtml b/airtime_mvc/application/views/scripts/form/preferences_general.phtml index a438fb446..de3f6b13d 100644 --- a/airtime_mvc/application/views/scripts/form/preferences_general.phtml +++ b/airtime_mvc/application/views/scripts/form/preferences_general.phtml @@ -1,138 +1,23 @@
-
- -
-
- 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('thirdPartyApi')->getMultiOptions() as $radio) : ?> - - - - element->getElement('thirdPartyApi')->hasErrors()) : ?> -
    - element->getElement('thirdPartyApi')->getMessages() as $error): ?> -
  • - -
- -
-
- -
-
- element->getElement('locale') ?> - element->getElement('locale')->hasErrors()) : ?> -
    - element->getElement('locale')->getMessages() as $error): ?> -
  • - -
- -
+ element->getElement('stationName')->render() ?> -
- -
-
- element->getElement('timezone') ?> - element->getElement('timezone')->hasErrors()) : ?> -
    - element->getElement('timezone')->getMessages() as $error): ?> -
  • - -
- -
+ element->getElement('stationDescription')->render() ?> - -
- -
-
- element->getElement('weekStartDay')->getValue(); - ?> - + element->getElement('locale')->render() ?> + + element->getElement('timezone')->render() ?> + + element->getElement('weekStartDay')->render() ?> + + element->getElement('stationDefaultFadeIn')->render() ?> + + element->getElement('stationDefaultFadeOut')->render() ?> + + element->getElement('stationDefaultCrossfadeDuration')->render() ?> + + element->getElement('thirdPartyApi')->render() ?> - element->getElement('weekStartDay')->hasErrors()) : ?> -
    - element->getElement('weekStartDay')->getMessages() as $error): ?> -
  • - -
- -
diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css index 098f4d55d..a868e5df7 100644 --- a/airtime_mvc/public/css/styles.css +++ b/airtime_mvc/public/css/styles.css @@ -13,7 +13,7 @@ html, body { } #login-page { - background: #1f1f1f url(images/login_page_bg.png) no-repeat center 0;` + background: #1f1f1f url(images/login_page_bg.png) no-repeat center 0; margin: 0; padding: 0; height:100%; @@ -1002,7 +1002,28 @@ input[type="checkbox"] { display:block; } -dt.block-display, dd.block-display { +#pref_form dt, #pref_form dd, +#pref_form textarea { + display:block; + float:none; + margin-left:0; + padding-left:0; + width: 100%; +} +#pref_form textarea { + width: 98.5%; +} +#pref_form select { + width: 100%; +} + +#pref_form p.description { + color: #3b3b3b; + font-size: 12px; + float: left; +} + + dt.block-display, dd.block-display { display:block; float:none; margin-left:0;