Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-04-25 09:19:26 -04:00
commit eec14f9592
3 changed files with 50 additions and 2 deletions

View file

@ -65,6 +65,16 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$week_start_day->setDecorators(array('ViewHelper'));
$this->addElement($week_start_day);
//enable system emails.
$this->addElement('checkbox', 'enableSystemEmail', array(
'label' => 'Enable System Emails (Password Reset)',
'required' => false,
'value' => Application_Model_Preference::GetEnableSystemEmail(),
'decorators' => array(
'ViewHelper'
)
));
// Add end date element
$systemEmail = new Zend_Form_Element_Text('systemEmail');
$systemEmail->class = 'input_text';
@ -75,8 +85,22 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
->setValidators(array(
'NotEmpty',
'EmailAddress'
))
->setDecorators(array('ViewHelper'));
))
->setDecorators(array('ViewHelper'));
$systemEmail->addValidator('Callback', true, array(
'callback' => function($value, $context) {
if ($context['enableSystemEmail']) {
return true;
}
return false;
},
'messages' => array(
Zend_Validate_Callback::INVALID_VALUE => 'Email must be enabled'
),
));
$this->addElement($systemEmail);
}