sintonia/airtime_mvc/application/forms/AddShowLiveStream.php
Paul Baranowski 869eb77ca4 CC-3611: Show Form: "Repeats" font is wrong, info images in the wrong place
Fixed both of these issues.

Fixed issue with connection URLs in "Add Show" and in "Stream Prefs" where
the text was unstyled.

Fixed issue with long connection URLS causing display problems
in "Add Show" and in "Stream Prefs".  Now a scrollbar will appear if the
connection URL is too long.

Fixed bug in Stream Prefs where zooming out caused the page to be formatted
differently.

Fixed bug in Stream Prefs where the labels "Master Source Connection URL" and
"Show Source Connection URL" wrapped on multiple lines.

Fixed help text for Add Show -> Live Stream authication settings, the
instructions were wrong and there were misspelled words.
2012-05-17 17:33:50 -04:00

77 lines
No EOL
3.4 KiB
PHP

<?php
require_once 'customvalidators/ConditionalNotEmpty.php';
class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
{
public function init()
{
$description1 = "This follows the same security pattern for the shows: only users assigned to the show can connect.";
$cb_airtime_auth = new Zend_Form_Element_Checkbox("cb_airtime_auth");
$cb_airtime_auth->setLabel("Use Airtime Authentication:")
->setDescription($description1)
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_airtime_auth);
$description2 = "Specify custom authentication which will work for only for this show.";
$cb_custom_auth = new Zend_Form_Element_Checkbox("cb_custom_auth");
$cb_custom_auth ->setLabel("Use Custom Authentication:")
->setDescription($description2)
->setRequired(false)
->setDecorators(array('ViewHelper'));
$this->addElement($cb_custom_auth);
//custom username
$custom_username = new Zend_Form_Element_Text('custom_username');
$custom_username->setAttrib('class', 'input_text')
->setAttrib('autocomplete', 'off')
->setAllowEmpty(true)
->setLabel('Custom Username')
->setFilters(array('StringTrim'))
->setValidators(array(
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
->setDecorators(array('ViewHelper'));
$this->addElement($custom_username);
//custom password
$custom_password = new Zend_Form_Element_Password('custom_password');
$custom_password->setAttrib('class', 'input_text')
->setAttrib('autocomplete', 'off')
->setAttrib('renderPassword','true')
->setAllowEmpty(true)
->setLabel('Custom Password')
->setFilters(array('StringTrim'))
->setValidators(array(
new ConditionalNotEmpty(array("cb_custom_auth"=>"1"))))
->setDecorators(array('ViewHelper'));
$this->addElement($custom_password);
$connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
if(trim($connection_url) == ""){
$connection_url = "N/A";
}
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url"=>$connection_url))
));
}
public function isValid($data){
$isValid = parent::isValid($data);
if($data['cb_custom_auth'] == 1){
if(trim($data['custom_username']) == ''){
$element = $this->getElement("custom_username");
$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.");
$isValid = false;
}
}
return $isValid;
}
}