Merge branch '2.5.x' into cc-5709-airtime-analyzer

Conflicts:
	CREDITS
This commit is contained in:
Albert Santoni 2015-01-22 11:29:38 -05:00
commit 230cdcccb4
46 changed files with 690 additions and 512 deletions

View file

@ -209,8 +209,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$interval = 'P21D';
} elseif ($formData["add_show_repeat_type"] == 5) {
$interval = 'P28D';
} elseif ($formData["add_show_repeat_type"] == 2) {
} elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 2) {
$interval = 'P1M';
} elseif ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) {
list($weekNumberOfMonth, $dayOfWeek) =
Application_Service_ShowService::getMonthlyWeeklyRepeatInterval(
new DateTime($start_time, $showTimezone));
}
/* Check first show
@ -287,12 +291,26 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
break 1;
} else {
$repeatShowStart->setTimezone($showTimezone);
$repeatShowEnd->setTimezone($showTimezone);
$repeatShowStart->add(new DateInterval($interval));
$repeatShowEnd->add(new DateInterval($interval));
$repeatShowStart->setTimezone($utc);
$repeatShowEnd->setTimezone($utc);
if ($formData["add_show_repeat_type"] == 2 && $formData["add_show_monthly_repeat_type"] == 3) {
$monthlyWeeklyStart = new DateTime($repeatShowStart->format("Y-m"),
new DateTimeZone("UTC"));
$monthlyWeeklyStart->add(new DateInterval("P1M"));
$repeatShowStart = clone Application_Service_ShowService::getNextMonthlyWeeklyRepeatDate(
$monthlyWeeklyStart,
$formData["add_show_timezone"],
$formData['add_show_start_time'],
$weekNumberOfMonth,
$dayOfWeek);
$repeatShowEnd = clone $repeatShowStart;
$repeatShowEnd->add(new DateInterval("PT".$hours."H".$minutes."M"));
} else {
$repeatShowStart->setTimezone($showTimezone);
$repeatShowEnd->setTimezone($showTimezone);
$repeatShowStart->add(new DateInterval($interval));
$repeatShowEnd->add(new DateInterval($interval));
$repeatShowStart->setTimezone($utc);
$repeatShowEnd->setTimezone($utc);
}
}
}
}

View file

@ -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,90 +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(
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.)'), '<br>'));
$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 <br> 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 */
@ -105,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 */
@ -113,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);
}

View file

@ -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);

View file

@ -4,6 +4,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
private $criteriaOptions;
private $stringCriteriaOptions;
private $numericCriteriaOptions;
private $sortOptions;
private $limitOptions;
/* We need to know if the criteria value will be a string
@ -122,6 +123,17 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
return $this->limitOptions;
}
private function getSortOptions()
{
if (!isset($this->sortOptions)) {
$this->sortOptions = array(
"random" => _("random"),
"newest" => _("newest"),
"oldest" => _("oldest")
);
}
return $this->sortOptions;
}
public function init()
@ -288,6 +300,15 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
$this->addElement($repeatTracks);
$sort = new Zend_Form_Element_Select('sp_sort_options');
$sort->setAttrib('class', 'sp_input_select')
->setDecorators(array('viewHelper'))
->setMultiOptions($this->getSortOptions());
if (isset($storedCrit["sort"])) {
$sort->setValue($storedCrit["sort"]["value"]);
}
$this->addElement($sort);
$limit = new Zend_Form_Element_Select('sp_limit_options');
$limit->setAttrib('class', 'sp_input_select')
->setDecorators(array('viewHelper'))
@ -344,7 +365,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
public function preValidation($params)
{
$data = Application_Model_Block::organizeSmartPlyalistCriteria($params['data']);
$data = Application_Model_Block::organizeSmartPlaylistCriteria($params['data']);
// add elelments that needs to be added
// set multioption for modifier according to criteria_field
$modRowMap = array();

View file

@ -0,0 +1,2 @@
<?php