CC-1960: Internationalize Airtime / Support translations

-added gettext wrapper functions for all strings in view/scripts, and forms
This commit is contained in:
denise 2012-11-15 10:59:06 -05:00
parent f0e2d5d295
commit b173b6dda4
78 changed files with 481 additions and 423 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

@ -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,7 +8,7 @@ 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",
@ -22,7 +22,7 @@ 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",
@ -37,7 +37,7 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm
// 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')
));
@ -26,7 +26,7 @@ class Application_Form_AddShowStyle extends Zend_Form_SubForm
// Add show color input
$this->addElement('text', 'add_show_color', array(
'label' => 'Text Colour:',
'label' => _('Text Colour:'),
'class' => 'input_text',
'filters' => array('StringTrim')
));

View file

@ -22,7 +22,7 @@ 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'),
@ -33,7 +33,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
// Add URL element
$this->addElement('text', 'add_show_url', array(
'label' => 'URL:',
'label' => _('URL:'),
'class' => 'input_text',
'required' => false,
'filters' => array('StringTrim'),
@ -42,7 +42,7 @@ class Application_Form_AddShowWhat extends Zend_Form_SubForm
// 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

@ -13,7 +13,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$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(
@ -32,7 +32,7 @@ class Application_Form_AddShowWhen 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' => 'Time format should be HH:mm'))
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Time format should be HH:mm')))
))->setDecorators(array('ViewHelper'));
$startTime->setAttrib('alt', 'time');
$this->addElement($startTime);
@ -41,7 +41,7 @@ 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(
@ -60,14 +60,14 @@ class Application_Form_AddShowWhen 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' => 'Time format should be HH:mm'))))
array('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Time format should be HH:mm')))))
->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 +76,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 +96,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 +104,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 +113,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 +123,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 {
@ -247,7 +247,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);
@ -261,7 +261,7 @@ 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')));
}
} elseif ($formData["add_show_rebroadcast"]) {
/* Check first show
@ -284,18 +284,18 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
$overlapping = Application_Model_Schedule::checkOverlappingShows($rebroadcastShowStart, $rebroadcastShowEnd, $update, $instanceId);
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;
}
}
} 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

@ -18,7 +18,7 @@ class Application_Form_AddUser extends Zend_Form
$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->addFilter('StringTrim');
@ -26,7 +26,7 @@ class Application_Form_AddUser extends Zend_Form
$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');
@ -34,21 +34,21 @@ class Application_Form_AddUser extends Zend_Form
$this->addElement($password);
$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);
@ -56,33 +56,33 @@ class Application_Form_AddUser extends Zend_Form
$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');
$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);
@ -90,7 +90,7 @@ class Application_Form_AddUser extends Zend_Form
$saveBtn = new Zend_Form_Element_Button('save_user');
$saveBtn->setAttrib('class', 'btn btn-small right-floated');
$saveBtn->setIgnore(true);
$saveBtn->setLabel('Save');
$saveBtn->setLabel(_('Save'));
$this->addElement($saveBtn);
}
@ -100,7 +100,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;
}

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

@ -10,42 +10,42 @@ class Application_Form_EditAudioMD extends Zend_Form
// 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(
@ -57,28 +57,28 @@ class Application_Form_EditAudioMD extends Zend_Form
// 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')
));
@ -86,7 +86,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)),
@ -95,28 +95,28 @@ 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')
));
@ -125,7 +125,7 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->addElement('submit', 'submit', array(
'ignore' => true,
'class' => 'btn',
'label' => 'Save',
'label' => _('Save'),
'decorators' => array(
'ViewHelper'
)
@ -135,7 +135,7 @@ class Application_Form_EditAudioMD extends Zend_Form
$this->addElement('button', 'cancel', array(
'ignore' => true,
'class' => 'btn md-cancel',
'label' => 'Cancel',
'label' => _('Cancel'),
'onclick' => 'javascript:document.location.href="'.$baseUrl.'/Library"',
'decorators' => array(
'ViewHelper'

View file

@ -14,7 +14,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(
@ -24,14 +24,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 (
@ -40,7 +40,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(
@ -50,7 +50,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'),
@ -64,7 +64,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'),
@ -79,7 +79,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'),
@ -97,7 +97,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

@ -18,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(),
@ -30,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):',
'label' => _('Default Fade (s):'),
'required' => false,
'filters' => array('StringTrim'),
'validators' => array(array('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'
@ -43,7 +43,8 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
));
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)');
$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());
@ -52,7 +53,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
/* Form Element for setting the Timezone */
$timezone = new Zend_Form_Element_Select("timezone");
$timezone->setLabel("Timezone");
$timezone->setLabel(_("Timezone"));
$timezone->setMultiOptions($this->getTimezones());
$timezone->setValue(Application_Model_Preference::GetTimezone());
$timezone->setDecorators(array('ViewHelper'));
@ -60,7 +61,7 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
/* 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'));

View file

@ -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);
@ -83,38 +83,38 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
//liquidsoap harbor.input port
$m_port = Application_Model_StreamSetting::getMasterLiveStreamPort();
$master_dj_port = new Zend_Form_Element_Text('master_harbor_input_port');
$master_dj_port->setLabel("Master Source Port")
$master_dj_port->setLabel(_("Master Source Port"))
->setValue($m_port)
->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151))))
->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'));
$this->addElement($master_dj_port);
$m_mount = Application_Model_StreamSetting::getMasterLiveStreamMountPoint();
$master_dj_mount = new Zend_Form_Element_Text('master_harbor_input_mount_point');
$master_dj_mount->setLabel("Master Source Mount Point")
$master_dj_mount->setLabel(_("Master Source Mount Point"))
->setValue($m_mount)
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$this->addElement($master_dj_mount);
//liquidsoap harbor.input port
$l_port = Application_Model_StreamSetting::getDjLiveStreamPort();
$live_dj_port = new Zend_Form_Element_Text('dj_harbor_input_port');
$live_dj_port->setLabel("Show Source Port")
$live_dj_port->setLabel(_("Show Source Port"))
->setValue($l_port)
->setValidators(array(new Zend_Validate_Between(array('min'=>1024, 'max'=>49151))))
->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'));
$this->addElement($live_dj_port);
$l_mount = Application_Model_StreamSetting::getDjLiveStreamMountPoint();
$live_dj_mount = new Zend_Form_Element_Text('dj_harbor_input_mount_point');
$live_dj_mount->setLabel("Show Source Mount Point")
$live_dj_mount->setLabel(_("Show Source Mount Point"))
->setValue($l_mount)
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
$this->addElement($live_dj_mount);
// demo only code
@ -149,7 +149,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
if ($master_harbor_input_port == $dj_harbor_input_port && $master_harbor_input_port != "") {
$element = $this->getElement("dj_harbor_input_port");
$element->addError("You cannot use same port as Master DJ port.");
$element->addError(_("You cannot use same port as Master DJ port."));
$isValid = false;
}
if ($master_harbor_input_port != "") {
@ -160,7 +160,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
socket_bind($sock, 0, $master_harbor_input_port);
} catch (Exception $e) {
$element = $this->getElement("master_harbor_input_port");
$element->addError("Port '$master_harbor_input_port' is not available.");
$element->addError(sprintf(_("Port %s is not available"), $master_harbor_input_port));
$isValid = false;
}
@ -178,7 +178,7 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
socket_bind($sock, 0, $dj_harbor_input_port);
} catch (Exception $e) {
$element = $this->getElement("dj_harbor_input_port");
$element->addError("Port '$dj_harbor_input_port' is not available.");
$element->addError(sprintf(_("Port %s is not available"). $dj_harbor_input_port));
$isValid = false;
}
socket_close($sock);

View file

@ -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':'',
@ -56,7 +56,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 +74,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

@ -11,7 +11,7 @@ class Application_Form_PasswordChange extends Zend_Form
));
$this->addElement('password', 'password', array(
'label' => 'Password',
'label' => _('Password'),
'required' => true,
'filters' => array('stringTrim'),
'validators' => array(
@ -23,7 +23,7 @@ class Application_Form_PasswordChange extends Zend_Form
));
$this->addElement('password', 'password_confirm', array(
'label' => 'Confirm new password',
'label' => _('Confirm new password'),
'required' => true,
'filters' => array('stringTrim'),
'validators' => array(
@ -38,7 +38,7 @@ class Application_Form_PasswordChange extends Zend_Form
));
$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

@ -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))
));
}
@ -285,17 +316,17 @@ class Application_Form_SmartBlockCriteria extends Zend_Form_SubForm
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
$this->addElement('checkbox', 'UseSoundCloud', array(
'label' => 'Automatically Upload Recorded Shows',
'label' => _('Automatically Upload Recorded Shows'),
'required' => false,
'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(),
'decorators' => array(
@ -23,7 +23,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(
@ -33,7 +33,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(
@ -44,7 +44,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(),
@ -64,7 +64,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(),
@ -84,7 +84,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(),
@ -96,7 +96,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(),
@ -106,7 +106,7 @@ 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(
"" => "",
@ -130,7 +130,7 @@ 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(
"" => "",

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,10 +51,10 @@ 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);

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,10 +180,10 @@ 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");
@ -205,18 +205,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

@ -17,7 +17,7 @@ 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'),
@ -30,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(),
@ -42,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(),
@ -53,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(),
@ -64,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,
@ -75,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(),
@ -87,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'))
@ -97,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)
@ -108,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(
@ -118,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());
@ -143,7 +143,10 @@ 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);
@ -151,7 +154,7 @@ class Application_Form_SupportSettings extends Zend_Form
$submit = new Zend_Form_Element_Submit("submit");
$submit->class = 'ui-button ui-state-default right-floated';
$submit->setIgnore(true)
->setLabel("Save")
->setLabel(_("Save"))
->setDecorators(array('ViewHelper'));
$this->addElement($submit);
}
@ -166,7 +169,7 @@ class Application_Form_SupportSettings 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

@ -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 {