Merge branch 'devel' into 2.3.x-saas

Conflicts:
	airtime_mvc/application/controllers/PreferenceController.php
	airtime_mvc/application/forms/AddShowWhen.php
	airtime_mvc/application/forms/GeneralPreferences.php
	airtime_mvc/application/forms/LiveStreamingPreferences.php
	airtime_mvc/application/forms/SoundcloudPreferences.php
	airtime_mvc/application/forms/SupportSettings.php
	airtime_mvc/application/views/scripts/form/preferences.phtml
	airtime_mvc/application/views/scripts/form/preferences_email_server.phtml
	airtime_mvc/application/views/scripts/form/preferences_general.phtml
	airtime_mvc/application/views/scripts/form/preferences_livestream.phtml
	airtime_mvc/application/views/scripts/form/support-setting.phtml
	airtime_mvc/application/views/scripts/schedule/add-
show-form.phtml
	airtime_mvc/public/js/airtime/preferences/preferences.js
	python_apps/api_clients/api_client.py
	python_apps/pypo/listenerstat.py
This commit is contained in:
Martin Konecny 2013-01-15 13:44:44 -05:00
commit 8cd6bd9aa4
346 changed files with 48955 additions and 11856 deletions

View file

@ -23,7 +23,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
$text->setAttrib('class', 'input_text');
$text->addFilter('StringTrim');
$text->addValidator('date', false, array('HH:mm'));
$text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'));
$text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')));
$text->setRequired(false);
$text->setDecorators(array('ViewHelper'));
$this->addElement($text);
@ -55,12 +55,12 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
}
if (trim($day) == "") {
$this->getElement('add_show_rebroadcast_date_absolute_'.$i)->setErrors(array("Day must be specified"));
$this->getElement('add_show_rebroadcast_date_absolute_'.$i)->setErrors(array(_("Day must be specified")));
$valid = false;
}
if (trim($time) == "") {
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Time must be specified"));
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array(_("Time must be specified")));
$valid = false;
}
@ -83,7 +83,7 @@ class Application_Form_AddShowAbsoluteRebroadcastDates extends Zend_Form_SubForm
$rebroad_start = new DateTime($rebroad_start);
if ($rebroad_start < $show_end) {
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
$this->getElement('add_show_rebroadcast_time_absolute_'.$i)->setErrors(array(_("Must wait at least 1 hour to rebroadcast")));
$valid = false;
$noError = false;
}

View file

@ -7,13 +7,13 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
public function init()
{
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
$cb_airtime_auth->setLabel("Use Airtime Authentication:")
$cb_airtime_auth->setLabel(_("Use Airtime Authentication:"))
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_airtime_auth);
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
$cb_custom_auth ->setLabel("Use Custom Authentication:")
$cb_custom_auth ->setLabel(_("Use Custom Authentication:"))
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_custom_auth);
@ -23,7 +23,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
$custom_username->setAttrib('class', 'input_text')
->setAttrib('autocomplete', 'off')
->setAllowEmpty(true)
->setLabel('Custom Username')
->setLabel(_('Custom Username'))
->setFilters(array('StringTrim'))
->setValidators(array(
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
@ -36,7 +36,7 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
->setAttrib('autocomplete', 'off')
->setAttrib('renderPassword','true')
->setAllowEmpty(true)
->setLabel('Custom Password')
->setLabel(_('Custom Password'))
->setFilters(array('StringTrim'))
->setValidators(array(
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
@ -60,12 +60,12 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
if ($data['cb_custom_auth'] == 1) {
if (trim($data['custom_username']) == '') {
$element = $this->getElement("custom_username");
$element->addError("Username field cannot be empty.");
$element->addError(_("Username field cannot be empty."));
$isValid = false;
}
if (trim($data['custom_password']) == '') {
$element = $this->getElement("custom_password");
$element->addError("Password field cannot be empty.");
$element->addError(_("Password field cannot be empty."));
$isValid = false;
}
}

View file

@ -7,13 +7,13 @@ class Application_Form_AddShowRR extends Zend_Form_SubForm
{
// Add record element
$this->addElement('checkbox', 'add_show_record', array(
'label' => 'Record from Line In?',
'label' => _('Record from Line In?'),
'required' => false,
));
// Add record element
$this->addElement('checkbox', 'add_show_rebroadcast', array(
'label' => 'Rebroadcast?',
'label' => _('Rebroadcast?'),
'required' => false,
));
}

View file

@ -12,7 +12,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
$relativeDates = array();
$relativeDates[""] = "";
for ($i=0; $i<=30; $i++) {
$relativeDates["$i days"] = "+$i days";
$relativeDates["$i days"] = "+$i "._("days");
}
for ($i=1; $i<=10; $i++) {
@ -28,7 +28,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
$text->setAttrib('class', 'input_text');
$text->addFilter('StringTrim');
$text->addValidator('date', false, array('HH:mm'));
$text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'));
$text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')));
$text->setRequired(false);
$text->setDecorators(array('ViewHelper'));
$this->addElement($text);
@ -60,12 +60,12 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
}
if (trim($days) == "") {
$this->getElement('add_show_rebroadcast_date_'.$i)->setErrors(array("Day must be specified"));
$this->getElement('add_show_rebroadcast_date_'.$i)->setErrors(array(_("Day must be specified")));
$valid = false;
}
if (trim($time) == "") {
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Time must be specified"));
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array(_("Time must be specified")));
$valid = false;
}
@ -92,7 +92,7 @@ class Application_Form_AddShowRebroadcastDates extends Zend_Form_SubForm
$rebroad_start->add(new DateInterval("P".$day."D"));
if ($rebroad_start < $show_end) {
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array("Must wait at least 1 hour to rebroadcast"));
$this->getElement('add_show_rebroadcast_time_'.$i)->setErrors(array(_("Must wait at least 1 hour to rebroadcast")));
$valid = false;
$noError = false;
}

View file

@ -8,12 +8,12 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
//Add type select
$this->addElement('select', 'add_show_repeat_type', array(
'required' => true,
'label' => 'Repeat Type:',
'label' => _('Repeat Type:'),
'class' => ' input_select',
'multiOptions' => array(
"0" => "weekly",
"1" => "bi-weekly",
"2" => "monthly"
"0" => _("weekly"),
"1" => _("bi-weekly"),
"2" => _("monthly")
),
));
@ -22,22 +22,22 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
'multiCheckbox',
'add_show_day_check',
array(
'label' => 'Select Days:',
'label' => _('Select Days:'),
'required' => false,
'multiOptions' => array(
"0" => "Sun",
"1" => "Mon",
"2" => "Tue",
"3" => "Wed",
"4" => "Thu",
"5" => "Fri",
"6" => "Sat",
"0" => _("Sun"),
"1" => _("Mon"),
"2" => _("Tue"),
"3" => _("Wed"),
"4" => _("Thu"),
"5" => _("Fri"),
"6" => _("Sat"),
),
));
// Add end date element
$this->addElement('text', 'add_show_end_date', array(
'label' => 'Date End:',
'label' => _('Date End:'),
'class' => 'input_text',
'value' => date("Y-m-d"),
'required' => false,
@ -50,7 +50,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
// Add no end element
$this->addElement('checkbox', 'add_show_no_end', array(
'label' => 'No End?',
'label' => _('No End?'),
'required' => false,
'checked' => true,
));
@ -76,7 +76,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
$end_epoch = strtotime($end_timestamp);
if ($end_epoch < $start_epoch) {
$this->getElement('add_show_end_date')->setErrors(array('End date must be after start date'));
$this->getElement('add_show_end_date')->setErrors(array(_('End date must be after start date')));
return false;
}

View file

@ -7,7 +7,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
{
// Add show background-color input
$this->addElement('text', 'add_show_background_color', array(
'label' => 'Background Colour:',
'label' => _('Background Colour:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
@ -19,14 +19,14 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
'class' => 'big'
))));
$stringLengthValidator = Application_Form_Helper_ValidationTypes::overrideStringLengthValidator(6, 6);
$bg->setValidators(array(
'Hex',
array('stringLength', false, array(6, 6))
'Hex', $stringLengthValidator
));
// Add show color input
$this->addElement('text', 'add_show_color', array(
'label' => 'Text Colour:',
'label' => _('Text Colour:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
@ -39,8 +39,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
))));
$c->setValidators(array(
'Hex',
array('stringLength', false, array(6, 6))
'Hex', $stringLengthValidator
));
}

View file

@ -4,6 +4,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
{
public function init()
{
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
// retrieves the length limit for each char field
// and store to assoc array
$maxLens = Application_Model_Show::getMaxLengths();
@ -22,27 +23,26 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
// Add name element
$this->addElement('text', 'add_show_name', array(
'label' => 'Name:',
'label' => _('Name:'),
'class' => 'input_text',
'required' => true,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty'),
'value' => 'Untitled Show',
'validators' => array(array('StringLength', false, array(0, $maxLens['name'])))
'value' => _('Untitled Show'),
'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['name'])))
));
// Add URL element
$this->addElement('text', 'add_show_url', array(
'label' => 'URL:',
'label' => _('URL:'),
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim'),
'validators' => array('NotEmpty', array('StringLength', false, array(0, $maxLens['url'])))
'validators' => array($notEmptyValidator, array('StringLength', false, array(0, $maxLens['url'])))
));
// Add genre element
$this->addElement('text', 'add_show_genre', array(
'label' => 'Genre:',
'label' => _('Genre:'),
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim'),
@ -51,7 +51,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
// Add the description element
$this->addElement('textarea', 'add_show_description', array(
'label' => 'Description:',
'label' => _('Description:'),
'required' => false,
'class' => 'input_text_area',
'validators' => array(array('StringLength', false, array(0, $maxLens['description'])))

View file

@ -9,16 +9,22 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
array('ViewScript', array('viewScript' => 'form/add-show-when.phtml'))
));
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$dateValidator = Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD");
$regexValidator = Application_Form_Helper_ValidationTypes::overrideRegexValidator(
"/^[0-2]?[0-9]:[0-5][0-9]$/",
_("'%value%' does not fit the time format 'HH:mm'"));
// Add start date element
$startDate = new Zend_Form_Element_Text('add_show_start_date');
$startDate->class = 'input_text';
$startDate->setRequired(true)
->setLabel('Date/Time Start:')
->setLabel(_('Date/Time Start:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
'NotEmpty',
array('date', false, array('YYYY-MM-DD'))))
$notEmptyValidator,
$dateValidator))
->setDecorators(array('ViewHelper'));
$startDate->setAttrib('alt', 'date');
$this->addElement($startDate);
@ -30,9 +36,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
->setValue('00:00')
->setFilters(array('StringTrim'))
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Time format should be HH:mm'))
$notEmptyValidator,
$regexValidator
))->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@ -41,12 +46,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$endDate = new Zend_Form_Element_Text('add_show_end_date_no_repeat');
$endDate->class = 'input_text';
$endDate->setRequired(true)
->setLabel('Date/Time End:')
->setLabel(_('Date/Time End:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
'NotEmpty',
array('date', false, array('YYYY-MM-DD'))))
$notEmptyValidator,
$dateValidator))
->setDecorators(array('ViewHelper'));
$endDate->setAttrib('alt', 'date');
$this->addElement($endDate);
@ -58,16 +63,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
->setValue('01:00')
->setFilters(array('StringTrim'))
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Time format should be HH:mm'))))
$notEmptyValidator,
$regexValidator))
->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
// Add duration element
$this->addElement('text', 'add_show_duration', array(
'label' => 'Duration:',
'label' => _('Duration:'),
'class' => 'input_text',
'value' => '01h 00m',
'readonly' => true,
@ -76,7 +80,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// Add repeats element
$this->addElement('checkbox', 'add_show_repeats', array(
'label' => 'Repeats?',
'label' => _('Repeats?'),
'required' => false,
'decorators' => array('ViewHelper')
));
@ -96,7 +100,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$showEndDateTime = new DateTime($end_time);
if ($validateStartDate) {
if ($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
$this->getElement('add_show_start_time')->setErrors(array(_('Cannot create show in the past')));
$valid = false;
}
// if edit action, check if original show start time is in the past. CC-3864
@ -104,7 +108,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
if ($originalStartDate->getTimestamp() < $nowDateTime->getTimestamp()) {
$this->getElement('add_show_start_time')->setValue($originalStartDate->format("H:i"));
$this->getElement('add_show_start_date')->setValue($originalStartDate->format("Y-m-d"));
$this->getElement('add_show_start_time')->setErrors(array('Cannot modify start date/time of the show that is already started'));
$this->getElement('add_show_start_time')->setErrors(array(_('Cannot modify start date/time of the show that is already started')));
$this->disableStartDateAndTime();
$valid = false;
}
@ -113,7 +117,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// if end time is in the past, return error
if ($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
$this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past'));
$this->getElement('add_show_end_time')->setErrors(array(_('End date/time cannot be in the past')));
$valid = false;
}
@ -123,15 +127,15 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$hours = $matches[1];
$minutes = $matches[2];
if ($formData["add_show_duration"] == "00h 00m") {
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration 00h 00m'));
$this->getElement('add_show_duration')->setErrors(array(_('Cannot have duration 00h 00m')));
$valid = false;
} elseif (strpos($formData["add_show_duration"], 'h') !== false && $hours >= 24) {
if ($hours > 24 || ($hours == 24 && $minutes > 0)) {
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration greater than 24h'));
$this->getElement('add_show_duration')->setErrors(array(_('Cannot have duration greater than 24h')));
$valid = false;
}
} elseif ( strstr($formData["add_show_duration"], '-') ) {
$this->getElement('add_show_duration')->setErrors(array('Cannot have duration < 0m'));
$this->getElement('add_show_duration')->setErrors(array(_('Cannot have duration < 0m')));
$valid = false;
}
} else {
@ -234,7 +238,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
if ($overlapping) {
$valid = false;
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
break 1;
} else {
$repeatShowStart->setTimezone($localTimezone);
@ -248,12 +252,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
}
} else {
$valid = false;
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
}
} else {
$overlapping = Application_Model_Schedule::checkOverlappingShows($show_start, $show_end, $update, $instanceId);
if ($overlapping) {
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
$this->getElement('add_show_duration')->setErrors(array(_('Cannot schedule overlapping shows')));
$valid = false;
}
}

View file

@ -7,7 +7,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
{
// Add hosts autocomplete
$this->addElement('text', 'add_show_hosts_autocomplete', array(
'label' => 'Search Users:',
'label' => _('Search Users:'),
'class' => 'input_text ui-autocomplete-input',
'required' => false
));
@ -21,7 +21,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
//Add hosts selection
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
$hosts->setLabel('DJs:')
$hosts->setLabel(_('DJs:'))
->setMultiOptions($options);
$this->addElement($hosts);

View file

@ -10,86 +10,98 @@ class Application_Form_AddUser extends Zend_Form
'../application/validate',
'validate');
* */
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
$this->setAttrib('id', 'user_form');
$hidden = new Zend_Form_Element_Hidden('user_id');
$hidden->setDecorators(array('ViewHelper'));
$this->addElement($hidden);
$login = new Zend_Form_Element_Text('login');
$login->setLabel('Username:');
$login->setLabel(_('Username:'));
$login->setAttrib('class', 'input_text');
$login->setRequired(true);
$login->addValidator($notEmptyValidator);
$login->addFilter('StringTrim');
//$login->addValidator('UserNameValidate');
$this->addElement($login);
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password:');
$password->setLabel(_('Password:'));
$password->setAttrib('class', 'input_text');
$password->setRequired(true);
$password->addFilter('StringTrim');
$password->addValidator('NotEmpty');
$password->addValidator($notEmptyValidator);
$this->addElement($password);
$passwordVerify = new Zend_Form_Element_Password('passwordVerify');
$passwordVerify->setLabel(_('Verify Password:'));
$passwordVerify->setAttrib('class', 'input_text');
$passwordVerify->setRequired(true);
$passwordVerify->addFilter('StringTrim');
$passwordVerify->addValidator($notEmptyValidator);
$this->addElement($passwordVerify);
$firstName = new Zend_Form_Element_Text('first_name');
$firstName->setLabel('Firstname:');
$firstName->setLabel(_('Firstname:'));
$firstName->setAttrib('class', 'input_text');
$firstName->addFilter('StringTrim');
$firstName->addValidator('NotEmpty');
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('last_name');
$lastName->setLabel('Lastname:');
$lastName->setLabel(_('Lastname:'));
$lastName->setAttrib('class', 'input_text');
$lastName->addFilter('StringTrim');
$lastName->addValidator('NotEmpty');
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email:');
$email->setLabel(_('Email:'));
$email->setAttrib('class', 'input_text');
$email->addFilter('StringTrim');
$email->setRequired(true);
$email->addValidator('EmailAddress');
$email->addValidator($notEmptyValidator);
$email->addValidator($emailValidator);
$this->addElement($email);
$cellPhone = new Zend_Form_Element_Text('cell_phone');
$cellPhone->setLabel('Mobile Phone:');
$cellPhone->setLabel(_('Mobile Phone:'));
$cellPhone->setAttrib('class', 'input_text');
$cellPhone->addFilter('StringTrim');
$this->addElement($cellPhone);
$skype = new Zend_Form_Element_Text('skype');
$skype->setLabel('Skype:');
$skype->setLabel(_('Skype:'));
$skype->setAttrib('class', 'input_text');
$skype->addFilter('StringTrim');
$this->addElement($skype);
$jabber = new Zend_Form_Element_Text('jabber');
$jabber->setLabel('Jabber:');
$jabber->setLabel(_('Jabber:'));
$jabber->setAttrib('class', 'input_text');
$jabber->addFilter('StringTrim');
$jabber->addValidator('EmailAddress');
$jabber->addValidator($emailValidator);
$this->addElement($jabber);
$select = new Zend_Form_Element_Select('type');
$select->setLabel('User Type:');
$select->setLabel(_('User Type:'));
$select->setAttrib('class', 'input_select');
$select->setAttrib('style', 'width: 40%');
$select->setMultiOptions(array(
"G" => "Guest",
"H" => "DJ",
"P" => "Program Manager",
"A" => "Admin"
"G" => _("Guest"),
"H" => _("DJ"),
"P" => _("Program Manager"),
"A" => _("Admin")
));
$select->setRequired(true);
$this->addElement($select);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('class', 'ui-button ui-state-default right-floated');
$submit->setIgnore(true);
$submit->setLabel('Save');
$this->addElement($submit);
$saveBtn = new Zend_Form_Element_Button('save_user');
$saveBtn->setAttrib('class', 'btn btn-small right-floated');
$saveBtn->setIgnore(true);
$saveBtn->setLabel(_('Save'));
$this->addElement($saveBtn);
}
public function validateLogin($data)
@ -98,7 +110,7 @@ class Application_Form_AddUser extends Zend_Form
$count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count();
if ($count != 0) {
$this->getElement('login')->setErrors(array("Login name is not unique."));
$this->getElement('login')->setErrors(array(_("Login name is not unique.")));
return false;
}
@ -106,4 +118,13 @@ class Application_Form_AddUser extends Zend_Form
return true;
}
// We need to add the password identical validator here in case
// Zend version is less than 1.10.5
public function isValid($data) {
$passwordIdenticalValidator = Application_Form_Helper_ValidationTypes::overridePasswordIdenticalValidator(
$data['password']);
$this->getElement('passwordVerify')->addValidator($passwordIdenticalValidator);
return parent::isValid($data);
}
}

View file

@ -13,7 +13,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm
$startDate = new Zend_Form_Element_Text('his_date_start');
$startDate->class = 'input_text';
$startDate->setRequired(true)
->setLabel('Date Start:')
->setLabel(_('Date Start:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
@ -32,7 +32,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@ -41,7 +41,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm
$endDate = new Zend_Form_Element_Text('his_date_end');
$endDate->class = 'input_text';
$endDate->setRequired(true)
->setLabel('Date End:')
->setLabel(_('Date End:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
@ -60,7 +60,7 @@ class Application_Form_DateRange extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);

View file

@ -2,82 +2,89 @@
class Application_Form_EditAudioMD extends Zend_Form
{
public function init()
public function init() {}
public function startForm($p_id)
{
$baseUrl = Application_Common_OsPath::getBaseDir();
// Set the method for the display form to POST
$this->setMethod('post');
$this->addElement('hidden', 'file_id', array(
'value' => $p_id
));
// Add title field
$this->addElement('text', 'track_title', array(
'label' => 'Title:',
'label' => _('Title:'),
'class' => 'input_text',
'filters' => array('StringTrim'),
));
// Add artist field
$this->addElement('text', 'artist_name', array(
'label' => 'Creator:',
'label' => _('Creator:'),
'class' => 'input_text',
'filters' => array('StringTrim'),
));
// Add album field
$this->addElement('text', 'album_title', array(
'label' => 'Album:',
'label' => _('Album:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add track number field
$this->addElement('text', 'track_number', array(
'label' => 'Track:',
'label' => _('Track:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add genre field
$this->addElement('text', 'genre', array(
'label' => 'Genre:',
'label' => _('Genre:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add year field
$this->addElement('text', 'year', array(
'label' => 'Year:',
'label' => _('Year:'),
'class' => 'input_text',
'filters' => array('StringTrim'),
'validators' => array(
array('date', false, array('YYYY-MM-DD')),
array('date', false, array('YYYY-MM')),
array('date', false, array('YYYY'))
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM-DD"),
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY-MM"),
Application_Form_Helper_ValidationTypes::overrrideDateValidator("YYYY")
)
));
// Add label field
$this->addElement('text', 'label', array(
'label' => 'Label:',
'label' => _('Label:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add composer field
$this->addElement('text', 'composer', array(
'label' => 'Composer:',
'label' => _('Composer:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add conductor field
$this->addElement('text', 'conductor', array(
'label' => 'Conductor:',
'label' => _('Conductor:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add mood field
$this->addElement('text', 'mood', array(
'label' => 'Mood:',
'label' => _('Mood:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
@ -85,7 +92,7 @@ class Application_Form_EditAudioMD extends Zend_Form
// Add bmp field
$bpm = new Zend_Form_Element_Text('bpm');
$bpm->class = 'input_text';
$bpm->setLabel('BPM:')
$bpm->setLabel(_('BPM:'))
->setFilters(array('StringTrim'))
->setValidators(array(
new Zend_Validate_StringLength(array('min'=>0,'max' => 8)),
@ -94,54 +101,53 @@ class Application_Form_EditAudioMD extends Zend_Form
// Add copyright field
$this->addElement('text', 'copyright', array(
'label' => 'Copyright:',
'label' => _('Copyright:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add isrc number field
$this->addElement('text', 'isrc_number', array(
'label' => 'ISRC Number:',
'label' => _('ISRC Number:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add website field
$this->addElement('text', 'info_url', array(
'label' => 'Website:',
'label' => _('Website:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add language field
$this->addElement('text', 'language', array(
'label' => 'Language:',
'label' => _('Language:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));
// Add the submit button
$this->addElement('submit', 'submit', array(
$this->addElement('button', 'editmdsave', array(
'ignore' => true,
'class' => 'btn',
'label' => 'Save',
'label' => _('Save'),
'decorators' => array(
'ViewHelper'
)
));
// Add the submit button
$this->addElement('button', 'cancel', array(
$this->addElement('button', 'editmdcancel', array(
'ignore' => true,
'class' => 'btn md-cancel',
'label' => 'Cancel',
'onclick' => 'javascript:document.location.href = "/Library"',
'label' => _('Cancel'),
'decorators' => array(
'ViewHelper'
)
));
$this->addDisplayGroup(array('submit', 'cancel'), 'submitButtons', array(
$this->addDisplayGroup(array('editmdsave', 'editmdcancel'), 'submitButtons', array(
'decorators' => array(
'FormElements',
'DtDdWrapper'

View file

@ -0,0 +1,147 @@
<?php
class Application_Form_EditUser extends Zend_Form
{
public function init()
{
/*
$this->addElementPrefixPath('Application_Validate',
'../application/validate',
'validate');
* */
$currentUser = Application_Model_User::getCurrentUser();
$currentUserId = $currentUser->getId();
$userData = Application_Model_User::GetUserData($currentUserId);
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/edit-user.phtml', "currentUser" => $currentUser->getLogin()))));
$this->setAttrib('id', 'current-user-form');
$hidden = new Zend_Form_Element_Hidden('cu_user_id');
$hidden->setDecorators(array('ViewHelper'));
$hidden->setValue($userData["id"]);
$this->addElement($hidden);
$login = new Zend_Form_Element_Text('cu_login');
$login->setLabel(_('Username:'));
$login->setValue($userData["login"]);
$login->setAttrib('class', 'input_text');
$login->setAttrib('readonly', 'readonly');
$login->setRequired(true);
$login->addValidator($notEmptyValidator);
$login->addFilter('StringTrim');
$login->setDecorators(array('viewHelper'));
$this->addElement($login);
$password = new Zend_Form_Element_Password('cu_password');
$password->setLabel(_('Password:'));
$password->setAttrib('class', 'input_text');
$password->setRequired(true);
$password->addFilter('StringTrim');
$password->addValidator($notEmptyValidator);
$password->setDecorators(array('viewHelper'));
$this->addElement($password);
$passwordVerify = new Zend_Form_Element_Password('cu_passwordVerify');
$passwordVerify->setLabel(_('Verify Password:'));
$passwordVerify->setAttrib('class', 'input_text');
$passwordVerify->setRequired(true);
$passwordVerify->addFilter('StringTrim');
$passwordVerify->addValidator($notEmptyValidator);
$passwordVerify->setDecorators(array('viewHelper'));
$this->addElement($passwordVerify);
$firstName = new Zend_Form_Element_Text('cu_first_name');
$firstName->setLabel(_('Firstname:'));
$firstName->setValue($userData["first_name"]);
$firstName->setAttrib('class', 'input_text');
$firstName->addFilter('StringTrim');
$firstName->setDecorators(array('viewHelper'));
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('cu_last_name');
$lastName->setLabel(_('Lastname:'));
$lastName->setValue($userData["last_name"]);
$lastName->setAttrib('class', 'input_text');
$lastName->addFilter('StringTrim');
$lastName->setDecorators(array('viewHelper'));
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('cu_email');
$email->setLabel(_('Email:'));
$email->setValue($userData["email"]);
$email->setAttrib('class', 'input_text');
$email->addFilter('StringTrim');
$email->setRequired(true);
$email->addValidator($notEmptyValidator);
$email->addValidator($emailValidator);
$email->setDecorators(array('viewHelper'));
$this->addElement($email);
$cellPhone = new Zend_Form_Element_Text('cu_cell_phone');
$cellPhone->setLabel(_('Mobile Phone:'));
$cellPhone->setValue($userData["cell_phone"]);
$cellPhone->setAttrib('class', 'input_text');
$cellPhone->addFilter('StringTrim');
$cellPhone->setDecorators(array('viewHelper'));
$this->addElement($cellPhone);
$skype = new Zend_Form_Element_Text('cu_skype');
$skype->setLabel(_('Skype:'));
$skype->setValue($userData["skype_contact"]);
$skype->setAttrib('class', 'input_text');
$skype->addFilter('StringTrim');
$skype->setDecorators(array('viewHelper'));
$this->addElement($skype);
$jabber = new Zend_Form_Element_Text('cu_jabber');
$jabber->setLabel(_('Jabber:'));
$jabber->setValue($userData["jabber_contact"]);
$jabber->setAttrib('class', 'input_text');
$jabber->addFilter('StringTrim');
$jabber->addValidator($emailValidator);
$jabber->setDecorators(array('viewHelper'));
$this->addElement($jabber);
$locale = new Zend_Form_Element_Select("cu_locale");
$locale->setLabel(_("Language:"));
$locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setValue(Application_Model_Preference::GetUserLocale($currentUserId));
$locale->setDecorators(array('ViewHelper'));
$this->addElement($locale);
$timezone = new Zend_Form_Element_Select("cu_timezone");
$timezone->setLabel(_("Timezone:"));
$timezone->setMultiOptions(Application_Common_Timezone::getTimezones());
$timezone->setValue(Application_Model_Preference::GetUserTimezone($currentUserId));
$timezone->setDecorators(array('ViewHelper'));
$this->addElement($timezone);
}
public function validateLogin($p_login, $p_userId) {
$count = CcSubjsQuery::create()
->filterByDbLogin($p_login)
->filterByDbId($p_userId, Criteria::NOT_EQUAL)
->count();
if ($count != 0) {
$this->getElement('cu_login')->setErrors(array(_("Login name is not unique.")));
return false;
} else {
return true;
}
}
// We need to add the password identical validator here in case
// Zend version is less than 1.10.5
public function isValid($data) {
$passwordIdenticalValidator = Application_Form_Helper_ValidationTypes::overridePasswordIdenticalValidator(
$data['cu_password']);
$this->getElement('cu_passwordVerify')->addValidator($passwordIdenticalValidator);
return parent::isValid($data);
}
}

View file

@ -13,7 +13,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
// Enable system emails
$this->addElement('checkbox', 'enableSystemEmail', array(
'label' => 'Enable System Emails (Password Reset)',
'label' => _('Enable System Emails (Password Reset)'),
'required' => false,
'value' => Application_Model_Preference::GetEnableSystemEmail(),
'decorators' => array(
@ -23,14 +23,14 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$this->addElement('text', 'systemEmail', array(
'class' => 'input_text',
'label' => 'Reset Password \'From\' Email',
'label' => _("Reset Password 'From' Email"),
'value' => Application_Model_Preference::GetSystemEmail(),
'readonly' => true,
'decorators' => array('viewHelper')
));
$this->addElement('checkbox', 'configureMailServer', array(
'label' => 'Configure Mail Server',
'label' => _('Configure Mail Server'),
'required' => false,
'value' => Application_Model_Preference::GetMailServerConfigured(),
'decorators' => array (
@ -39,7 +39,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
));
$this->addElement('checkbox', 'msRequiresAuth', array(
'label' => 'Requires Authentication',
'label' => _('Requires Authentication'),
'required' => false,
'value' => Application_Model_Preference::GetMailServerRequiresAuth(),
'decorators' => array(
@ -49,7 +49,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$this->addElement('text', 'mailServer', array(
'class' => 'input_text',
'label' => 'Mail Server',
'label' => _('Mail Server'),
'value' => Application_Model_Preference::GetMailServer(),
'readonly' => true,
'decorators' => array('viewHelper'),
@ -63,7 +63,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$this->addElement('text', 'email', array(
'class' => 'input_text',
'label' => 'Email Address',
'label' => _('Email Address'),
'value' => Application_Model_Preference::GetMailServerEmailAddress(),
'readonly' => true,
'decorators' => array('viewHelper'),
@ -78,7 +78,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$this->addElement('password', 'ms_password', array(
'class' => 'input_text',
'label' => 'Password',
'label' => _('Password'),
'value' => Application_Model_Preference::GetMailServerPassword(),
'readonly' => true,
'decorators' => array('viewHelper'),
@ -96,7 +96,7 @@ class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
$port->class = 'input_text';
$port->setRequired(false)
->setValue(Application_Model_Preference::GetMailServerPort())
->setLabel('Port')
->setLabel(_('Port'))
->setAttrib('readonly', true)
->setDecorators(array('viewHelper'));

View file

@ -5,6 +5,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
public function init()
{
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_general.phtml'))
));
@ -17,7 +18,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
//Station name
$this->addElement('text', 'stationName', array(
'class' => 'input_text',
'label' => 'Station Name',
'label' => _('Station Name'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetStationName(),
@ -29,12 +30,12 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
//Default station fade
$this->addElement('text', 'stationDefaultFade', array(
'class' => 'input_text',
'label' => 'Default Fade (s):',
'required' => false,
'label' => _('Default Fade (s):'),
'required' => true,
'filters' => array('StringTrim'),
'validators' => array(array('regex', false,
'validators' => array(array($notEmptyValidator, 'regex', false,
array('/^[0-9]{1,2}(\.\d{1})?$/',
'messages' => 'enter a time in seconds 0{.0}'))),
'messages' => _('enter a time in seconds 0{.0}')))),
'value' => $defaultFade,
'decorators' => array(
'ViewHelper'
@ -42,9 +43,10 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
));
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel('Website Widgets:');
$third_party_api->setMultiOptions(array("Disabled",
"Enabled"));
$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->setValue(Application_Model_Preference::GetAllow3rdPartyApi());
$third_party_api->setDecorators(array('ViewHelper'));
$this->addElement($third_party_api);
@ -63,50 +65,30 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
)
));
$locale = new Zend_Form_Element_Select("locale");
$locale->setLabel(_("Default Interface 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 */
$timezone = new Zend_Form_Element_Select("timezone");
$timezone->setLabel("Timezone");
$timezone->setMultiOptions($this->getTimezones());
$timezone->setValue(Application_Model_Preference::GetTimezone());
$timezone->setLabel(_("Default Interface 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 */
$week_start_day = new Zend_Form_Element_Select("weekStartDay");
$week_start_day->setLabel("Week Starts On");
$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);
}
private function getTimezones()
{
$regions = array(
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Arctic' => DateTimeZone::ARCTIC,
'Asia' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
'Australia' => DateTimeZone::AUSTRALIA,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
);
$tzlist = array();
foreach ($regions as $name => $mask) {
$ids = DateTimeZone::listIdentifiers($mask);
foreach ($ids as $id) {
$tzlist[$id] = str_replace("_", " ", $id);
}
}
return $tzlist;
}
private static function getWidgetCode() {
$host = $_SERVER['SERVER_NAME'];
@ -146,13 +128,13 @@ CODE;
private function getWeekStartDays()
{
$days = array(
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
_('Sunday'),
_('Monday'),
_('Tuesday'),
_('Wednesday'),
_('Thursday'),
_('Friday'),
_('Saturday')
);
return $days;

View file

@ -5,7 +5,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
public function init()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$isStreamConfigable = Application_Model_Preference::GetEnableStreamConf() == "true";
@ -16,24 +16,24 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
// automatic trasition on source disconnection
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
$auto_transition->setLabel("Auto Switch Off")
$auto_transition->setLabel(_("Auto Switch Off"))
->setValue(Application_Model_Preference::GetAutoTransition())
->setDecorators(array('ViewHelper'));
$this->addElement($auto_transition);
// automatic switch on upon source connection
$auto_switch = new Zend_Form_Element_Checkbox("auto_switch");
$auto_switch->setLabel("Auto Switch On")
$auto_switch->setLabel(_("Auto Switch On"))
->setValue(Application_Model_Preference::GetAutoSwitch())
->setDecorators(array('ViewHelper'));
$this->addElement($auto_switch);
// Default transition fade
$transition_fade = new Zend_Form_Element_Text("transition_fade");
$transition_fade->setLabel("Switch Transition Fade (s)")
$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}'))
'messages' => _('enter a time in seconds 00{.000000}')))
->setValue($defaultFade)
->setDecorators(array('ViewHelper'));
$this->addElement($transition_fade);
@ -42,7 +42,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$master_username = new Zend_Form_Element_Text('master_username');
$master_username->setAttrib('autocomplete', 'off')
->setAllowEmpty(true)
->setLabel('Master Username')
->setLabel(_('Master Username'))
->setFilters(array('StringTrim'))
->setValue(Application_Model_Preference::GetLiveStreamMasterUsername())
->setDecorators(array('ViewHelper'));
@ -59,7 +59,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
->setAttrib('renderPassword','true')
->setAllowEmpty(true)
->setValue(Application_Model_Preference::GetLiveStreamMasterPassword())
->setLabel('Master Password')
->setLabel(_('Master Password'))
->setFilters(array('StringTrim'))
->setDecorators(array('ViewHelper'));
$this->addElement($master_password);
@ -67,7 +67,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
//Master source connection url
$master_dj_connection_url = new Zend_Form_Element_Text('master_dj_connection_url');
$master_dj_connection_url->setAttrib('readonly', true)
->setLabel('Master Source Connection URL')
->setLabel(_('Master Source Connection URL'))
->setValue(Application_Model_Preference::GetMasterDJSourceConnectionURL())
->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_connection_url);
@ -75,7 +75,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
//Show source connection url
$live_dj_connection_url = new Zend_Form_Element_Text('live_dj_connection_url');
$live_dj_connection_url->setAttrib('readonly', true)
->setLabel('Show Source Connection URL')
->setLabel(_('Show Source Connection URL'))
->setValue(Application_Model_Preference::GetLiveDJSourceConnectionURL())
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_connection_url);
@ -93,7 +93,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
public function updateVariables()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
$isDemo = isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1;
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();

View file

@ -5,7 +5,7 @@ class Application_Form_Login extends Zend_Form
public function init()
{
global $CC_CONFIG;
$CC_CONFIG = Config::getConfig();
// Set the method for the display form to POST
$this->setMethod('post');
@ -16,7 +16,7 @@ class Application_Form_Login extends Zend_Form
// Add username element
$this->addElement('text', 'username', array(
'label' => 'Username:',
'label' => _('Username:'),
'class' => 'input_text',
'required' => true,
'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'',
@ -31,7 +31,7 @@ class Application_Form_Login extends Zend_Form
// Add password element
$this->addElement('password', 'password', array(
'label' => 'Password:',
'label' => _('Password:'),
'class' => 'input_text',
'required' => true,
'value' => (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1)?'admin':'',
@ -43,6 +43,12 @@ class Application_Form_Login extends Zend_Form
'ViewHelper'
)
));
$locale = new Zend_Form_Element_Select("locale");
$locale->setLabel(_("Language:"));
$locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setDecorators(array('ViewHelper'));
$this->addElement($locale);
$recaptchaNeeded = false;
if (Application_Model_LoginAttempts::getAttempts($_SERVER['REMOTE_ADDR']) >= 3) {
@ -56,7 +62,7 @@ class Application_Form_Login extends Zend_Form
// Add the submit button
$this->addElement('submit', 'submit', array(
'ignore' => true,
'label' => 'Login',
'label' => _('Login'),
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
'decorators' => array(
'ViewHelper'
@ -74,7 +80,7 @@ class Application_Form_Login extends Zend_Form
$captcha = new Zend_Form_Element_Captcha('captcha',
array(
'label' => 'Type the characters you see in the picture below.',
'label' => _('Type the characters you see in the picture below.'),
'captcha' => 'ReCaptcha',
'captchaOptions' => array(
'captcha' => 'ReCaptcha',

View file

@ -9,21 +9,23 @@ class Application_Form_PasswordChange extends Zend_Form
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/password-change.phtml'))
));
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$stringLengthValidator = Application_Form_Helper_ValidationTypes::overrideStringLengthValidator(6, 80);
$this->addElement('password', 'password', array(
'label' => 'Password',
'label' => _('Password'),
'required' => true,
'filters' => array('stringTrim'),
'validators' => array(
array('stringLength', false, array(6, 80)),
),
'validators' => array($notEmptyValidator,
$stringLengthValidator),
'decorators' => array(
'ViewHelper'
)
));
$this->addElement('password', 'password_confirm', array(
'label' => 'Confirm new password',
'label' => _('Confirm new password'),
'required' => true,
'filters' => array('stringTrim'),
'validators' => array(
@ -31,14 +33,14 @@ class Application_Form_PasswordChange extends Zend_Form
return $value == $context['password'];
}),
),
'errorMessages' => array("Password confirmation does not match your password."),
'errorMessages' => array(_("Password confirmation does not match your password.")),
'decorators' => array(
'ViewHelper'
)
));
$this->addElement('submit', 'submit', array(
'label' => 'Get new password',
'label' => _('Get new password'),
'ignore' => true,
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
'decorators' => array(

View file

@ -11,7 +11,7 @@ class Application_Form_PasswordRestore extends Zend_Form
));
$this->addElement('text', 'email', array(
'label' => 'E-mail',
'label' => _('E-mail'),
'required' => true,
'filters' => array(
'stringTrim',
@ -22,7 +22,7 @@ class Application_Form_PasswordRestore extends Zend_Form
));
$this->addElement('text', 'username', array(
'label' => 'Username',
'label' => _('Username'),
'required' => false,
'filters' => array(
'stringTrim',
@ -33,7 +33,7 @@ class Application_Form_PasswordRestore extends Zend_Form
));
$this->addElement('submit', 'submit', array(
'label' => 'Restore password',
'label' => _('Restore password'),
'ignore' => true,
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
'decorators' => array(
@ -43,7 +43,7 @@ class Application_Form_PasswordRestore extends Zend_Form
$cancel = new Zend_Form_Element_Button("cancel");
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
$cancel->setLabel("Cancel")
$cancel->setLabel(_("Cancel"))
->setIgnore(True)
->setAttrib('onclick', 'redirectToLogin();')
->setDecorators(array('ViewHelper'));

View file

@ -4,7 +4,8 @@ class Application_Form_Preferences extends Zend_Form
{
public function init()
{
$this->setAction('/Preference');
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->setMethod('post');
$this->setDecorators(array(
@ -17,13 +18,5 @@ class Application_Form_Preferences extends Zend_Form
$soundcloud_pref = new Application_Form_SoundcloudPreferences();
$this->addSubForm($soundcloud_pref, 'preferences_soundcloud');
$this->addElement('submit', 'submit', array(
'class' => 'ui-button ui-state-default right-floated',
'ignore' => true,
'label' => 'Save',
'decorators' => array(
'ViewHelper'
)
));
}
}

View file

@ -7,7 +7,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
public function init()
{
$this->setAction('/Showbuilder');
$this->setAction(Application_Common_OsPath::getBaseDir().'/Showbuilder');
$this->setMethod('post');
$country_list = Application_Model_Preference::GetCountryList();
@ -27,7 +27,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station Name
$stnName = new Zend_Form_Element_Text("stnName");
$stnName->setLabel("Station Name")
$stnName->setLabel(_("Station Name"))
->setRequired(true)
->setValue(Application_Model_Preference::GetStationName())
->setDecorators(array('ViewHelper'));
@ -36,7 +36,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Phone number
$this->addElement('text', 'Phone', array(
'class' => 'input_text',
'label' => 'Phone:',
'label' => _('Phone:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetPhone(),
@ -48,7 +48,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
//Email
$this->addElement('text', 'Email', array(
'class' => 'input_text',
'label' => 'Email:',
'label' => _('Email:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetEmail(),
@ -59,7 +59,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station Web Site
$this->addElement('text', 'StationWebSite', array(
'label' => 'Station Web Site:',
'label' => _('Station Web Site:'),
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationWebSite(),
@ -70,7 +70,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// county list dropdown
$this->addElement('select', 'Country', array(
'label' => 'Country:',
'label' => _('Country:'),
'required' => false,
'value' => Application_Model_Preference::GetStationCountry(),
'multiOptions' => $country_list,
@ -81,7 +81,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station city
$this->addElement('text', 'City', array(
'label' => 'City:',
'label' => _('City:'),
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationCity(),
@ -93,7 +93,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station Description
$description = new Zend_Form_Element_Textarea('Description');
$description->class = 'input_text_area';
$description->setLabel('Station Description:')
$description->setLabel(_('Station Description:'))
->setRequired(false)
->setValue(Application_Model_Preference::GetStationDescription())
->setDecorators(array('ViewHelper'))
@ -103,7 +103,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// Station Logo
$upload = new Zend_Form_Element_File('Logo');
$upload->setLabel('Station Logo:')
$upload->setLabel(_('Station Logo:'))
->setRequired(false)
->setDecorators(array('File'))
->addValidator('Count', false, 1)
@ -113,7 +113,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
'label' => 'Send support feedback',
'label' => _('Send support feedback'),
'required' => false,
'value' => 1,
'decorators' => array(
@ -123,7 +123,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
$checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org'))
->setRequired(false)
->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise());
@ -145,7 +145,10 @@ class Application_Form_RegisterAirtime extends Zend_Form
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
$checkboxPrivacy->setLabel(
sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."),
"<a id='link_to_privacy' href='http://www.sourcefabric.org/en/about/policy/' onclick='window.open(this.href); return false;'>",
"</a>"))
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
}
@ -160,7 +163,7 @@ class Application_Form_RegisterAirtime extends Zend_Form
if (isset($data["Privacy"])) {
$checkPrivacy = $this->getElement('Privacy');
if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {
$checkPrivacy->addError("You have to agree to privacy policy.");
$checkPrivacy->addError(_("You have to agree to privacy policy."));
$isValid = false;
}
}

View file

@ -15,7 +15,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
$startDate = new Zend_Form_Element_Text('sb_date_start');
$startDate->class = 'input_text';
$startDate->setRequired(true)
->setLabel('Date Start:')
->setLabel(_('Date Start:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
@ -34,7 +34,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@ -43,7 +43,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
$endDate = new Zend_Form_Element_Text('sb_date_end');
$endDate->class = 'input_text';
$endDate->setRequired(true)
->setLabel('Date End:')
->setLabel(_('Date End:'))
->setValue(date("Y-m-d"))
->setFilters(array('StringTrim'))
->setValidators(array(
@ -62,14 +62,14 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
array('date', false, array('HH:mm')),
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$endTime->setAttrib('alt', 'time');
$this->addElement($endTime);
// add a select to choose a show.
$showSelect = new Zend_Form_Element_Select("sb_show_filter");
$showSelect->setLabel("Show:");
$showSelect->setLabel(_("Show:"));
$showSelect->setMultiOptions($this->getShowNames());
$showSelect->setValue(null);
$showSelect->setDecorators(array('ViewHelper'));
@ -77,7 +77,7 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
if ($user->getType() === 'H') {
$myShows = new Zend_Form_Element_Checkbox('sb_my_shows');
$myShows->setLabel('All My Shows:')
$myShows->setLabel(_('All My Shows:'))
->setDecorators(array('ViewHelper'));
$this->addElement($myShows);
}

View file

@ -1,88 +1,119 @@
<?php
class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
{
private $criteriaOptions = array(
0 => "Select criteria",
"album_title" => "Album",
"bit_rate" => "Bit Rate (Kbps)",
"bpm" => "BPM",
"composer" => "Composer",
"conductor" => "Conductor",
"copyright" => "Copyright",
"artist_name" => "Creator",
"encoded_by" => "Encoded By",
"genre" => "Genre",
"isrc_number" => "ISRC",
"label" => "Label",
"language" => "Language",
"mtime" => "Last Modified",
"lptime" => "Last Played",
"length" => "Length",
"mime" => "Mime",
"mood" => "Mood",
"owner_id" => "Owner",
"replay_gain" => "Replay Gain",
"sample_rate" => "Sample Rate (kHz)",
"track_title" => "Title",
"track_number" => "Track Number",
"utime" => "Uploaded",
"info_url" => "Website",
"year" => "Year"
);
private $criteriaOptions;
private $stringCriteriaOptions;
private $numericCriteriaOptions;
private $limitOptions;
private $criteriaTypes = array(
0 => "",
"album_title" => "s",
"bit_rate" => "n",
"bpm" => "n",
"composer" => "s",
"conductor" => "s",
"copyright" => "s",
"artist_name" => "s",
"encoded_by" => "s",
"utime" => "n",
"mtime" => "n",
"lptime" => "n",
"genre" => "s",
"isrc_number" => "s",
"label" => "s",
"language" => "s",
"length" => "n",
"mime" => "s",
"mood" => "s",
"owner_id" => "s",
"replay_gain" => "n",
"sample_rate" => "n",
"track_title" => "s",
"track_number" => "n",
"info_url" => "s",
"year" => "n"
0 => "",
"album_title" => "s",
"bit_rate" => "n",
"bpm" => "n",
"composer" => "s",
"conductor" => "s",
"copyright" => "s",
"artist_name" => "s",
"encoded_by" => "s",
"utime" => "n",
"mtime" => "n",
"lptime" => "n",
"genre" => "s",
"isrc_number" => "s",
"label" => "s",
"language" => "s",
"length" => "n",
"mime" => "s",
"mood" => "s",
"owner_id" => "s",
"replay_gain" => "n",
"sample_rate" => "n",
"track_title" => "s",
"track_number" => "n",
"info_url" => "s",
"year" => "n"
);
private function getCriteriaOptions($option = null)
{
if (!isset($this->criteriaOptions)) {
$this->criteriaOptions = array(
0 => _("Select criteria"),
"album_title" => _("Album"),
"bit_rate" => _("Bit Rate (Kbps)"),
"bpm" => _("BPM"),
"composer" => _("Composer"),
"conductor" => _("Conductor"),
"copyright" => _("Copyright"),
"artist_name" => _("Creator"),
"encoded_by" => _("Encoded By"),
"genre" => _("Genre"),
"isrc_number" => _("ISRC"),
"label" => _("Label"),
"language" => _("Language"),
"mtime" => _("Last Modified"),
"lptime" => _("Last Played"),
"length" => _("Length"),
"mime" => _("Mime"),
"mood" => _("Mood"),
"owner_id" => _("Owner"),
"replay_gain" => _("Replay Gain"),
"sample_rate" => _("Sample Rate (kHz)"),
"track_title" => _("Title"),
"track_number" => _("Track Number"),
"utime" => _("Uploaded"),
"info_url" => _("Website"),
"year" => _("Year")
);
}
if (is_null($option)) return $this->criteriaOptions;
else return $this->criteriaOptions[$option];
}
private $stringCriteriaOptions = array(
"0" => "Select modifier",
"contains" => "contains",
"does not contain" => "does not contain",
"is" => "is",
"is not" => "is not",
"starts with" => "starts with",
"ends with" => "ends with"
);
private function getStringCriteriaOptions()
{
if (!isset($this->stringCriteriaOptions)) {
$this->stringCriteriaOptions = array(
"0" => _("Select modifier"),
"contains" => _("contains"),
"does not contain" => _("does not contain"),
"is" => _("is"),
"is not" => _("is not"),
"starts with" => _("starts with"),
"ends with" => _("ends with")
);
}
return $this->stringCriteriaOptions;
}
private $numericCriteriaOptions = array(
"0" => "Select modifier",
"is" => "is",
"is not" => "is not",
"is greater than" => "is greater than",
"is less than" => "is less than",
"is in the range" => "is in the range"
);
private function getNumericCriteriaOptions()
{
if (!isset($this->numericCriteriaOptions)) {
$this->numericCriteriaOptions = array(
"0" => _("Select modifier"),
"is" => _("is"),
"is not" => _("is not"),
"is greater than" => _("is greater than"),
"is less than" => _("is less than"),
"is in the range" => _("is in the range")
);
}
return $this->numericCriteriaOptions;
}
private $limitOptions = array(
"hours" => "hours",
"minutes" => "minutes",
"items" => "items"
);
private function getLimitOptions()
{
if (!isset($this->limitOptions)) {
$this->limitOptions = array(
"hours" => _("hours"),
"minutes" => _("minutes"),
"items" => _("items")
);
}
return $this->limitOptions;
}
public function init()
{
@ -99,11 +130,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
$spType = new Zend_Form_Element_Radio('sp_type');
$spType->setLabel('Set smart block type:')
$spType->setLabel(_('Set smart block type:'))
->setDecorators(array('viewHelper'))
->setMultiOptions(array(
'static' => 'Static',
'dynamic' => 'Dynamic'
'static' => _('Static'),
'dynamic' => _('Dynamic')
))
->setValue($blockType);
$this->addElement($spType);
@ -126,7 +157,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if (isset($storedCrit["crit"])) {
$criteriaKeys = array_keys($storedCrit["crit"]);
}
$numElements = count($this->criteriaOptions);
$numElements = count($this->getCriteriaOptions());
for ($i = 0; $i < $numElements; $i++) {
$criteriaType = "";
@ -153,7 +184,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$criteria->setAttrib('class', 'input_select sp_input_select'.$invisible)
->setValue('Select criteria')
->setDecorators(array('viewHelper'))
->setMultiOptions($this->criteriaOptions);
->setMultiOptions($this->getCriteriaOptions());
if ($i != 0 && !isset($criteriaKeys[$i])) {
$criteria->setAttrib('disabled', 'disabled');
}
@ -174,13 +205,13 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
}
if (isset($criteriaKeys[$i])) {
if ($criteriaType == "s") {
$criteriaModifers->setMultiOptions($this->stringCriteriaOptions);
$criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
} else {
$criteriaModifers->setMultiOptions($this->numericCriteriaOptions);
$criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
}
$criteriaModifers->setValue($storedCrit["crit"][$criteriaKeys[$i]][$j]["modifier"]);
} else {
$criteriaModifers->setMultiOptions(array('0' => 'Select modifier'));
$criteriaModifers->setMultiOptions(array('0' => _('Select modifier')));
}
$this->addElement($criteriaModifers);
@ -214,7 +245,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$repeatTracks = new Zend_Form_Element_Checkbox('sp_repeat_tracks');
$repeatTracks->setDecorators(array('viewHelper'))
->setLabel('Allow Repeat Tracks:');
->setLabel(_('Allow Repeat Tracks:'));
if (isset($storedCrit["repeat_tracks"])) {
$repeatTracks->setChecked($storedCrit["repeat_tracks"]["value"] == 1?true:false);
}
@ -223,7 +254,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$limit = new Zend_Form_Element_Select('sp_limit_options');
$limit->setAttrib('class', 'sp_input_select')
->setDecorators(array('viewHelper'))
->setMultiOptions($this->limitOptions);
->setMultiOptions($this->getLimitOptions());
if (isset($storedCrit["limit"])) {
$limit->setValue($storedCrit["limit"]["modifier"]);
}
@ -231,7 +262,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$limitValue = new Zend_Form_Element_Text('sp_limit_value');
$limitValue->setAttrib('class', 'sp_input_text_limit')
->setLabel('Limit to')
->setLabel(_('Limit to'))
->setDecorators(array('viewHelper'));
$this->addElement($limitValue);
if (isset($storedCrit["limit"])) {
@ -253,23 +284,23 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$generate = new Zend_Form_Element_Button('generate_button');
$generate->setAttrib('class', 'btn btn-small');
$generate->setAttrib('title', 'Generate playlist content and save criteria');
$generate->setAttrib('title', _('Generate playlist content and save criteria'));
$generate->setIgnore(true);
$generate->setLabel('Generate');
$generate->setLabel(_('Generate'));
$generate->setDecorators(array('viewHelper'));
$this->addElement($generate);
$shuffle = new Zend_Form_Element_Button('shuffle_button');
$shuffle->setAttrib('class', 'btn btn-small');
$shuffle->setAttrib('title', 'Shuffle playlist content');
$shuffle->setAttrib('title', _('Shuffle playlist content'));
$shuffle->setIgnore(true);
$shuffle->setLabel('Shuffle');
$shuffle->setLabel(_('Shuffle'));
$shuffle->setDecorators(array('viewHelper'));
$this->addElement($shuffle);
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/smart-block-criteria.phtml', "openOption"=> $openSmartBlockOption,
'criteriasLength' => count($this->criteriaOptions), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap,
'criteriasLength' => count($this->getCriteriaOptions()), 'poolCount' => $files['count'], 'modRowMap' => $modRowMap,
'showPoolCount' => $showPoolCount))
));
}
@ -278,24 +309,24 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
{
$data = Application_Model_Block::organizeSmartPlyalistCriteria($params['data']);
// add elelments that needs to be added
// set multioption for modifier according to creiteria_field
// set multioption for modifier according to criteria_field
$modRowMap = array();
foreach ($data['criteria'] as $critKey=>$d) {
$count = 1;
foreach ($d as $modKey=>$modInfo) {
if ($modKey == 0) {
$eleCrit = $this->getElement("sp_criteria_field_".$critKey."_".$modKey);
$eleCrit->setValue($this->criteriaOptions[$modInfo['sp_criteria_field']]);
$eleCrit->setValue($this->getCriteriaOptions($modInfo['sp_criteria_field']));
$eleCrit->setAttrib("disabled", null);
$eleMod = $this->getElement("sp_criteria_modifier_".$critKey."_".$modKey);
$criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']];
if ($criteriaType == "s") {
$eleMod->setMultiOptions($this->stringCriteriaOptions);
$eleMod->setMultiOptions($this->getStringCriteriaOptions());
} elseif ($criteriaType == "n") {
$eleMod->setMultiOptions($this->numericCriteriaOptions);
$eleMod->setMultiOptions($this->getNumericCriteriaOptions());
} else {
$eleMod->setMultiOptions(array('0' => 'Select modifier'));
$eleMod->setMultiOptions(array('0' => _('Select modifier')));
}
$eleMod->setValue($modInfo['sp_criteria_modifier']);
$eleMod->setAttrib("disabled", null);
@ -316,10 +347,10 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$criteria->setAttrib('class', 'input_select sp_input_select sp-invisible')
->setValue('Select criteria')
->setDecorators(array('viewHelper'))
->setMultiOptions($this->criteriaOptions);
->setMultiOptions($this->getCriteriaOptions());
$criteriaType = $this->criteriaTypes[$modInfo['sp_criteria_field']];
$criteria->setValue($this->criteriaOptions[$modInfo['sp_criteria_field']]);
$criteria->setValue($this->getCriteriaOptions($modInfo['sp_criteria_field']));
$this->addElement($criteria);
/****************** MODIFIER ***********/
@ -329,11 +360,11 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
->setDecorators(array('viewHelper'));
if ($criteriaType == "s") {
$criteriaModifers->setMultiOptions($this->stringCriteriaOptions);
$criteriaModifers->setMultiOptions($this->getStringCriteriaOptions());
} elseif ($criteriaType == "n") {
$criteriaModifers->setMultiOptions($this->numericCriteriaOptions);
$criteriaModifers->setMultiOptions($this->getNumericCriteriaOptions());
} else {
$criteriaModifers->setMultiOptions(array('0' => 'Select modifier'));
$criteriaModifers->setMultiOptions(array('0' => _('Select modifier')));
}
$criteriaModifers->setValue($modInfo['sp_criteria_modifier']);
$this->addElement($criteriaModifers);
@ -427,25 +458,25 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if ($data['etc']['sp_limit_options'] == 'hours' || $data['etc']['sp_limit_options'] == 'mins') {
$element = $this->getElement("sp_limit_value");
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
$element->addError("Limit cannot be empty or smaller than 0");
$element->addError(_("Limit cannot be empty or smaller than 0"));
$isValid = false;
} else {
$mins = floatval($data['etc']['sp_limit_value']) * $multiplier;
if ($mins > 1440) {
$element->addError("Limit cannot be more than 24 hrs");
$element->addError(_("Limit cannot be more than 24 hrs"));
$isValid = false;
}
}
} else {
$element = $this->getElement("sp_limit_value");
if ($data['etc']['sp_limit_value'] == "" || floatval($data['etc']['sp_limit_value']) <= 0) {
$element->addError("Limit cannot be empty or smaller than 0");
$element->addError(_("Limit cannot be empty or smaller than 0"));
$isValid = false;
} elseif (!ctype_digit($data['etc']['sp_limit_value'])) {
$element->addError("The value should be an integer");
$element->addError(_("The value should be an integer"));
$isValid = false;
} elseif (intval($data['etc']['sp_limit_value']) > 500) {
$element->addError("500 is the max item limit value you can set");
$element->addError(_("500 is the max item limit value you can set"));
$isValid = false;
}
}
@ -456,19 +487,19 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
$element = $this->getElement("sp_criteria_field_".$rowKey."_".$key);
// check for not selected select box
if ($d['sp_criteria_field'] == "0" || $d['sp_criteria_modifier'] == "0") {
$element->addError("You must select Criteria and Modifier");
$element->addError(_("You must select Criteria and Modifier"));
$isValid = false;
} else {
$column = CcFilesPeer::getTableMap()->getColumnByPhpName($criteria2PeerMap[$d['sp_criteria_field']]);
// validation on type of column
if ($d['sp_criteria_field'] == 'length') {
if (!preg_match("/^(\d{2}):(\d{2}):(\d{2})/", $d['sp_criteria_value'])) {
$element->addError("'Length' should be in '00:00:00' format");
$element->addError(_("'Length' should be in '00:00:00' format"));
$isValid = false;
}
} elseif ($column->getType() == PropelColumnTypes::TIMESTAMP) {
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_value'])) {
$element->addError("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00");
$element->addError(_("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00)"));
$isValid = false;
} else {
$result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_value']);
@ -481,7 +512,7 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
if (isset($d['sp_criteria_extra'])) {
if (!preg_match("/(\d{4})-(\d{2})-(\d{2})/", $d['sp_criteria_extra'])) {
$element->addError("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00");
$element->addError(_("The value should be in timestamp format(eg. 0000-00-00 or 00-00-00 00:00:00)"));
$isValid = false;
} else {
$result = Application_Common_DateHelper::checkDateTimeRangeForSQL($d['sp_criteria_extra']);
@ -495,24 +526,24 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
} elseif ($column->getType() == PropelColumnTypes::INTEGER &&
$d['sp_criteria_field'] != 'owner_id') {
if (!is_numeric($d['sp_criteria_value'])) {
$element->addError("The value has to be numeric");
$element->addError(_("The value has to be numeric"));
$isValid = false;
}
// length check
if (intval($d['sp_criteria_value']) >= pow(2,31)) {
$element->addError("The value should be less then 2147483648");
$element->addError(_("The value should be less then 2147483648"));
$isValid = false;
}
} elseif ($column->getType() == PropelColumnTypes::VARCHAR) {
if (strlen($d['sp_criteria_value']) > $column->getSize()) {
$element->addError("The value should be less ".$column->getSize()." characters");
$element->addError(sprintf(_("The value should be less than %s characters"), $column->getSize()));
$isValid = false;
}
}
}
if ($d['sp_criteria_value'] == "") {
$element->addError("Value cannot be empty");
$element->addError(_("Value cannot be empty"));
$isValid = false;
}
}//end foreach

View file

@ -13,7 +13,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//enable soundcloud uploads option
$this->addElement('checkbox', 'UploadToSoundcloudOption', array(
'label' => 'Enable SoundCloud Upload',
'label' => _('Enable SoundCloud Upload'),
'required' => false,
'value' => Application_Model_Preference::GetUploadToSoundcloudOption(),
'decorators' => array(
@ -23,7 +23,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//enable downloadable for soundcloud
$this->addElement('checkbox', 'SoundCloudDownloadbleOption', array(
'label' => 'Automatically Mark Files "Downloadable" on SoundCloud',
'label' => _('Automatically Mark Files "Downloadable" on SoundCloud'),
'required' => false,
'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(),
'decorators' => array(
@ -34,7 +34,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//SoundCloud Username
$this->addElement('text', 'SoundCloudUser', array(
'class' => 'input_text',
'label' => 'SoundCloud Email',
'label' => _('SoundCloud Email'),
'filters' => array('StringTrim'),
'autocomplete' => 'off',
'value' => Application_Model_Preference::GetSoundCloudUser(),
@ -54,7 +54,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//SoundCloud Password
$this->addElement('password', 'SoundCloudPassword', array(
'class' => 'input_text',
'label' => 'SoundCloud Password',
'label' => _('SoundCloud Password'),
'filters' => array('StringTrim'),
'autocomplete' => 'off',
'value' => Application_Model_Preference::GetSoundCloudPassword(),
@ -74,7 +74,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
// Add the description element
$this->addElement('textarea', 'SoundCloudTags', array(
'label' => 'SoundCloud Tags: (separate tags with spaces)',
'label' => _('SoundCloud Tags: (separate tags with spaces)'),
'required' => false,
'class' => 'input_text_area',
'value' => Application_Model_Preference::GetSoundCloudTags(),
@ -86,7 +86,7 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
//SoundCloud default genre
$this->addElement('text', 'SoundCloudGenre', array(
'class' => 'input_text',
'label' => 'Default Genre:',
'label' => _('Default Genre:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetSoundCloudGenre(),
@ -96,23 +96,23 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
));
$select = new Zend_Form_Element_Select('SoundCloudTrackType');
$select->setLabel('Default Track Type:');
$select->setLabel(_('Default Track Type:'));
$select->setAttrib('class', 'input_select');
$select->setMultiOptions(array(
"" => "",
"original" => "Original",
"remix" => "Remix",
"live" => "Live",
"recording" => "Recording",
"spoken" => "Spoken",
"podcast" => "Podcast",
"demo" => "Demo",
"in progress" => "Work in progress",
"stem" => "Stem",
"loop" => "Loop",
"sound effect" => "Sound Effect",
"sample" => "One Shot Sample",
"other" => "Other"
"original" => _("Original"),
"remix" => _("Remix"),
"live" => _("Live"),
"recording" => _("Recording"),
"spoken" => _("Spoken"),
"podcast" => _("Podcast"),
"demo" => _("Demo"),
"in progress" => _("Work in progress"),
"stem" => _("Stem"),
"loop" => _("Loop"),
"sound effect" => _("Sound Effect"),
"sample" => _("One Shot Sample"),
"other" => _("Other")
));
$select->setRequired(false);
$select->setValue(Application_Model_Preference::GetSoundCloudTrackType());
@ -120,18 +120,18 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
$this->addElement($select);
$select = new Zend_Form_Element_Select('SoundCloudLicense');
$select->setLabel('Default License:');
$select->setLabel(_('Default License:'));
$select->setAttrib('class', 'input_select');
$select->setMultiOptions(array(
"" => "",
"no-rights-reserved" => "The work is in the public domain",
"all-rights-reserved" => "All rights are reserved",
"cc-by" => "Creative Commons Attribution",
"cc-by-nc" => "Creative Commons Attribution Noncommercial",
"cc-by-nd" => "Creative Commons Attribution No Derivative Works",
"cc-by-sa" => "Creative Commons Attribution Share Alike",
"cc-by-nc-nd" => "Creative Commons Attribution Noncommercial Non Derivate Works",
"cc-by-nc-sa" => "Creative Commons Attribution Noncommercial Share Alike"
"no-rights-reserved" => _("The work is in the public domain"),
"all-rights-reserved" => _("All rights are reserved"),
"cc-by" => _("Creative Commons Attribution"),
"cc-by-nc" => _("Creative Commons Attribution Noncommercial"),
"cc-by-nd" => _("Creative Commons Attribution No Derivative Works"),
"cc-by-sa" => _("Creative Commons Attribution Share Alike"),
"cc-by-nc-nd" => _("Creative Commons Attribution Noncommercial Non Derivate Works"),
"cc-by-nc-sa" => _("Creative Commons Attribution Noncommercial Share Alike")
));
$select->setRequired(false);
$select->setValue(Application_Model_Preference::GetSoundCloudLicense());

View file

@ -19,7 +19,7 @@ class Application_Form_StreamSetting extends Zend_Form
$setting = $this->setting;
if (Application_Model_Preference::GetPlanLevel() == 'disabled') {
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
$output_sound_device->setLabel('Hardware Audio Output')
$output_sound_device->setLabel(_('Hardware Audio Output'))
->setRequired(false)
->setValue(($setting['output_sound_device'] == "true")?1:0)
->setDecorators(array('ViewHelper'));
@ -30,7 +30,7 @@ class Application_Form_StreamSetting extends Zend_Form
$output_types = array("ALSA"=>"ALSA", "AO"=>"AO", "OSS"=>"OSS", "Portaudio"=>"Portaudio", "Pulseaudio"=>"Pulseaudio");
$output_type = new Zend_Form_Element_Select('output_sound_device_type');
$output_type->setLabel("Output Type")
$output_type->setLabel(_("Output Type"))
->setMultiOptions($output_types)
->setValue($setting['output_sound_device_type'])
->setDecorators(array('ViewHelper'));
@ -41,7 +41,7 @@ class Application_Form_StreamSetting extends Zend_Form
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
$icecast_vorbis_metadata->setLabel(_('Icecast Vorbis Metadata'))
->setRequired(false)
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
->setDecorators(array('ViewHelper'));
@ -51,13 +51,32 @@ class Application_Form_StreamSetting extends Zend_Form
$this->addElement($icecast_vorbis_metadata);
$stream_format = new Zend_Form_Element_Radio('streamFormat');
$stream_format->setLabel('Stream Label:');
$stream_format->setMultiOptions(array("Artist - Title",
"Show - Artist - Title",
"Station name - Show name"));
$stream_format->setLabel(_('Stream Label:'));
$stream_format->setMultiOptions(array(_("Artist - Title"),
_("Show - Artist - Title"),
_("Station name - Show name")));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
$offAirMeta = new Zend_Form_Element_Text('offAirMeta');
$offAirMeta->setLabel(_('Off Air Metadata'))
->setValue(Application_Model_StreamSetting::getOffAirMeta())
->setDecorators(array('ViewHelper'));
$this->addElement($offAirMeta);
$enable_replay_gain = new Zend_Form_Element_Checkbox("enableReplayGain");
$enable_replay_gain->setLabel(_("Enable Replay Gain"))
->setValue(Application_Model_Preference::GetEnableReplayGain())
->setDecorators(array('ViewHelper'));
$this->addElement($enable_replay_gain);
$replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
$replay_gain->setLabel(_("Replay Gain Modifier"))
->setValue(Application_Model_Preference::getReplayGainModifier())
->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))
->setDecorators(array('ViewHelper'));
$this->addElement($replay_gain);
}
public function isValid($data)

View file

@ -45,7 +45,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$disable_all = Application_Model_Preference::GetEnableStreamConf() == "false";
$enable = new Zend_Form_Element_Checkbox('enable');
$enable->setLabel('Enabled:')
$enable->setLabel(_('Enabled:'))
->setValue($setting[$prefix.'_enable'] == 'true' ? 1 : 0)
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@ -54,7 +54,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($enable);
$type = new Zend_Form_Element_Select('type');
$type->setLabel("Stream Type:")
$type->setLabel(_("Stream Type:"))
->setMultiOptions($stream_types)
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
->setDecorators(array('ViewHelper'));
@ -64,7 +64,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($type);
$bitrate = new Zend_Form_Element_Select('bitrate');
$bitrate->setLabel("Bit Rate:")
$bitrate->setLabel(_("Bit Rate:"))
->setMultiOptions($stream_bitrates)
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
->setDecorators(array('ViewHelper'));
@ -74,7 +74,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($bitrate);
$output = new Zend_Form_Element_Select('output');
$output->setLabel("Service Type:")
$output->setLabel(_("Service Type:"))
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"SHOUTcast"))
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
->setDecorators(array('ViewHelper'));
@ -84,8 +84,8 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($output);
$channels = new Zend_Form_Element_Select('channels');
$channels->setLabel("Channels:")
->setMultiOptions(array("mono"=>"1 - Mono", "stereo"=>"2 - Stereo"))
$channels->setLabel(_("Channels:"))
->setMultiOptions(array("mono"=>_("1 - Mono"), "stereo"=>_("2 - Stereo")))
->setValue(isset($setting[$prefix.'_channels']) ? $setting[$prefix.'_channels'] : "stereo")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@ -94,10 +94,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($channels);
$host = new Zend_Form_Element_Text('host');
$host->setLabel("Server")
$host->setLabel(_("Server"))
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
->setValidators(array(
array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$host->setAttrib("disabled", "disabled");
@ -106,10 +106,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($host);
$port = new Zend_Form_Element_Text('port');
$port->setLabel("Port")
$port->setLabel(_("Port"))
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
->setValidators(array(new Zend_Validate_Between(array('min'=>0, 'max'=>99999))))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>'Only numbers are allowed.')))
->addValidator('regex', false, array('pattern'=>'/^[0-9]+$/', 'messages'=>array('regexNotMatch'=>_('Only numbers are allowed.'))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$port->setAttrib("disabled", "disabled");
@ -117,10 +117,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($port);
$pass = new Zend_Form_Element_Text('pass');
$pass->setLabel("Password")
$pass->setLabel(_("Password"))
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$pass->setAttrib("disabled", "disabled");
@ -129,7 +129,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($pass);
$genre = new Zend_Form_Element_Text('genre');
$genre->setLabel("Genre")
$genre->setLabel(_("Genre"))
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@ -138,10 +138,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($genre);
$url = new Zend_Form_Element_Text('url');
$url->setLabel("URL")
$url->setLabel(_("URL"))
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
->setValidators(array(
array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$url->setAttrib("disabled", "disabled");
@ -150,7 +150,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($url);
$name = new Zend_Form_Element_Text('name');
$name->setLabel("Name")
$name->setLabel(_("Name"))
->setValue(isset($setting[$prefix.'_name'])?$setting[$prefix.'_name']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@ -159,7 +159,7 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($name);
$description = new Zend_Form_Element_Text('description');
$description->setLabel("Description")
$description->setLabel(_("Description"))
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
->setDecorators(array('ViewHelper'));
if ($disable_all) {
@ -168,10 +168,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($description);
$mount = new Zend_Form_Element_Text('mount');
$mount->setLabel("Mount Point")
$mount->setLabel(_("Mount Point"))
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$mount->setAttrib("disabled", "disabled");
@ -180,18 +180,42 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
$this->addElement($mount);
$user = new Zend_Form_Element_Text('user');
$user->setLabel("Username")
$user->setLabel(_("Username"))
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$user->setAttrib("disabled", "disabled");
}
$user->setAttrib('alt', 'regular_text');
$this->addElement($user);
$adminUser = new Zend_Form_Element_Text('admin_user');
$adminUser->setLabel(_("Admin User"))
->setValue(Application_Model_StreamSetting::getAdminUser($prefix))
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$adminUser->setAttrib("disabled", "disabled");
}
$adminUser->setAttrib('alt', 'regular_text');
$this->addElement($adminUser);
$adminPass = new Zend_Form_Element_Text('admin_pass');
$adminPass->setLabel(_("Admin Password"))
->setValue(Application_Model_StreamSetting::getAdminPass($prefix))
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$adminPass->setAttrib("disabled", "disabled");
}
$adminPass->setAttrib('alt', 'regular_text');
$this->addElement($adminPass);
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>Getting information from the server...</h3></div>';
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>'._('Getting information from the server...').'</h3></div>';
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number, "enabled"=>$enable->getValue(), "liquidsoap_error_msg"=>$liquidsopa_error_msg))
@ -205,18 +229,18 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
if ($f_data['enable'] == 1) {
if ($f_data['host'] == '') {
$element = $this->getElement("host");
$element->addError("Server cannot be empty.");
$element->addError(_("Server cannot be empty."));
$isValid = false;
}
if ($f_data['port'] == '') {
$element = $this->getElement("port");
$element->addError("Port cannot be empty.");
$element->addError(_("Port cannot be empty."));
$isValid = false;
}
if ($f_data['output'] == 'icecast') {
if ($f_data['mount'] == '') {
$element = $this->getElement("mount");
$element->addError("Mount cannot be empty with Icecast server.");
$element->addError(_("Mount cannot be empty with Icecast server."));
$isValid = false;
}
}

View file

@ -7,6 +7,7 @@ class Application_Form_SupportSettings extends Zend_Form
public function init()
{
$country_list = Application_Model_Preference::GetCountryList();
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/support-setting.phtml')),
@ -16,10 +17,10 @@ class Application_Form_SupportSettings extends Zend_Form
//Station name
$this->addElement('text', 'stationName', array(
'class' => 'input_text',
'label' => 'Station Name',
'label' => _('Station Name'),
'required' => true,
'filters' => array('StringTrim'),
'validator' => array('NotEmpty'),
'validators' => array($notEmptyValidator),
'value' => Application_Model_Preference::GetStationName(),
'decorators' => array(
'ViewHelper'
@ -29,7 +30,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Phone number
$this->addElement('text', 'Phone', array(
'class' => 'input_text',
'label' => 'Phone:',
'label' => _('Phone:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetPhone(),
@ -41,7 +42,7 @@ class Application_Form_SupportSettings extends Zend_Form
//Email
$this->addElement('text', 'Email', array(
'class' => 'input_text',
'label' => 'Email:',
'label' => _('Email:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetEmail(),
@ -52,7 +53,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Station Web Site
$this->addElement('text', 'StationWebSite', array(
'label' => 'Station Web Site:',
'label' => _('Station Web Site:'),
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationWebSite(),
@ -63,7 +64,7 @@ class Application_Form_SupportSettings extends Zend_Form
// county list dropdown
$this->addElement('select', 'Country', array(
'label' => 'Country:',
'label' => _('Country:'),
'required' => false,
'value' => Application_Model_Preference::GetStationCountry(),
'multiOptions' => $country_list,
@ -74,7 +75,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Station city
$this->addElement('text', 'City', array(
'label' => 'City:',
'label' => _('City:'),
'required' => false,
'class' => 'input_text',
'value' => Application_Model_Preference::GetStationCity(),
@ -86,7 +87,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Station Description
$description = new Zend_Form_Element_Textarea('Description');
$description->class = 'input_text_area';
$description->setLabel('Station Description:')
$description->setLabel(_('Station Description:'))
->setRequired(false)
->setValue(Application_Model_Preference::GetStationDescription())
->setDecorators(array('ViewHelper'))
@ -96,7 +97,7 @@ class Application_Form_SupportSettings extends Zend_Form
// Station Logo
$upload = new Zend_Form_Element_File('Logo');
$upload->setLabel('Station Logo:')
$upload->setLabel(_('Station Logo:'))
->setRequired(false)
->setDecorators(array('File'))
->addValidator('Count', false, 1)
@ -107,7 +108,7 @@ class Application_Form_SupportSettings extends Zend_Form
//enable support feedback
$this->addElement('checkbox', 'SupportFeedback', array(
'label' => 'Send support feedback',
'label' => _('Send support feedback'),
'required' => false,
'value' => Application_Model_Preference::GetSupportFeedback(),
'decorators' => array(
@ -117,7 +118,7 @@ class Application_Form_SupportSettings extends Zend_Form
// checkbox for publicise
$checkboxPublicise = new Zend_Form_Element_Checkbox("Publicise");
$checkboxPublicise->setLabel('Promote my station on Sourcefabric.org')
$checkboxPublicise->setLabel(_('Promote my station on Sourcefabric.org'))
->setRequired(false)
->setDecorators(array('ViewHelper'))
->setValue(Application_Model_Preference::GetPublicise());
@ -128,15 +129,18 @@ class Application_Form_SupportSettings extends Zend_Form
// checkbox for privacy policy
$checkboxPrivacy = new Zend_Form_Element_Checkbox("Privacy");
$checkboxPrivacy->setLabel("By checking this box, I agree to Sourcefabric's <a id=\"link_to_privacy\" href=\"http://www.sourcefabric.org/en/about/policy/\" onclick=\"window.open(this.href); return false;\">privacy policy</a>.")
$checkboxPrivacy->setLabel(
sprintf(_("By checking this box, I agree to Sourcefabric's %sprivacy policy%s."),
"<a id='link_to_privacy' href='http://www.sourcefabric.org/en/about/policy/' onclick='window.open(this.href); return false;'>",
"</a>"))
->setDecorators(array('ViewHelper'));
$this->addElement($checkboxPrivacy);
// submit button
$submit = new Zend_Form_Element_Submit("submit");
$submit->class = 'ui-button ui-state-default right-floated';
$submit->class = 'btn right-floated';
$submit->setIgnore(true)
->setLabel("Save")
->setLabel(_("Save"))
->setDecorators(array('ViewHelper'));
$this->addElement($submit);
}
@ -145,13 +149,13 @@ class Application_Form_SupportSettings extends Zend_Form
public function isValid ($data)
{
$isValid = parent::isValid($data);
if (isset($data["Privacy"])) {
$checkPrivacy = $this->getElement('Privacy');
if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {
$checkPrivacy->addError("You have to agree to privacy policy.");
$isValid = false;
}
if (isset($data["Privacy"])) {
$checkPrivacy = $this->getElement('Privacy');
if ($data["SupportFeedback"] == "1" && $data["Privacy"] != "1") {
$checkPrivacy->addError(_("You have to agree to privacy policy."));
$isValid = false;
}
}
return $isValid;
}

View file

@ -11,7 +11,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
$this->addElement('text', 'storageFolder', array(
'class' => 'input_text',
'label' => 'Import Folder:',
'label' => _('Import Folder:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => '',
@ -22,7 +22,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
$this->addElement('text', 'watchedFolder', array(
'class' => 'input_text',
'label' => 'Watched Folders:',
'label' => _('Watched Folders:'),
'required' => false,
'filters' => array('StringTrim'),
'value' => '',
@ -37,7 +37,7 @@ class Application_Form_WatchedDirPreferences extends Zend_Form_SubForm
$element = $this->getElement($p_form_element_id);
if (!is_dir($element->getValue())) {
$element->setErrors(array('Not a valid Directory'));
$element->setErrors(array(_('Not a valid Directory')));
return false;
} else {

View file

@ -7,9 +7,7 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract
{
const KEY_IS_EMPTY = 'keyIsEmpty';
protected $_messageTemplates = array(
self::KEY_IS_EMPTY => 'Value is required and can\'t be empty'
);
protected $_messageTemplates;
protected $_fieldValues;
@ -24,6 +22,9 @@ class ConditionalNotEmpty extends Zend_Validate_Abstract
public function __construct($fieldValues)
{
$this->_fieldValues = $fieldValues;
$this->_messageTemplates = array(
self::KEY_IS_EMPTY => _("Value is required and can't be empty")
);
}
/**

View file

@ -0,0 +1,96 @@
<?php
Class Application_Form_Helper_ValidationTypes {
public static function overrideNotEmptyValidator()
{
$validator = new Zend_Validate_NotEmpty();
$validator->setMessage(
_("Value is required and can't be empty"),
Zend_Validate_NotEmpty::IS_EMPTY
);
return $validator;
}
public static function overrideEmailAddressValidator()
{
$validator = new Zend_Validate_EmailAddress();
$validator->setMessage(
_("'%value%' is no valid email address in the basic format local-part@hostname"),
Zend_Validate_EmailAddress::INVALID_FORMAT
);
return $validator;
}
public static function overrrideDateValidator($p_format)
{
$validator = new Zend_Validate_Date();
$validator->setFormat($p_format);
$validator->setMessage(
_("'%value%' does not fit the date format '%format%'"),
Zend_Validate_Date::FALSEFORMAT
);
return $validator;
}
public static function overrideRegexValidator($p_pattern, $p_msg)
{
$validator = new Zend_Validate_Regex($p_pattern);
$validator->setMessage(
$p_msg,
Zend_Validate_Regex::NOT_MATCH
);
return $validator;
}
public static function overrideStringLengthValidator($p_min, $p_max)
{
$validator = new Zend_Validate_StringLength();
$validator->setMin($p_min);
$validator->setMax($p_max);
$validator->setMessage(
_("'%value%' is less than %min% characters long"),
Zend_Validate_StringLength::TOO_SHORT
);
$validator->setMessage(
_("'%value%' is more than %max% characters long"),
Zend_Validate_StringLength::TOO_LONG
);
return $validator;
}
public static function overrideBetweenValidator($p_min, $p_max)
{
$validator = new Zend_Validate_Between($p_min, $p_max, true);
$validator->setMessage(
_("'%value%' is not between '%min%' and '%max%', inclusively"),
Zend_Validate_Between::NOT_BETWEEN
);
return $validator;
}
public static function overridePasswordIdenticalValidator($p_matchAgainst)
{
$validator = new Zend_Validate_Identical();
$validator->setToken($p_matchAgainst);
$validator->setMessage(
_("Passwords do not match"),
Zend_Validate_Identical::NOT_SAME
);
return $validator;
}
}