Merge branch 'airtime-2.0.x' of dev.sourcefabric.org:airtime into airtime-2.0.x

This commit is contained in:
Martin Konecny 2011-12-22 17:21:43 -05:00
commit f4449865cc
5 changed files with 33 additions and 2 deletions

View file

@ -133,6 +133,7 @@ class PreferenceController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl(); $baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript'); $this->view->headScript()->appendFile($baseUrl.'/js/airtime/preferences/streamsetting.js','text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
// get current settings // get current settings
$temp = Application_Model_StreamSetting::getStreamSetting(); $temp = Application_Model_StreamSetting::getStreamSetting();

View file

@ -68,8 +68,10 @@ class Application_Form_StreamSetting extends Zend_Form
} }
public function isValid($data){ public function isValid($data){
$this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata'], if($data['output_sound_device']){
$this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata'],
"output_sound_device_type"=>$data['output_sound_device_type'], "streamFormat"=>$data['streamFormat'])); "output_sound_device_type"=>$data['output_sound_device_type'], "streamFormat"=>$data['streamFormat']));
}
return true; return true;
} }
} }

View file

@ -83,10 +83,13 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
$host = new Zend_Form_Element_Text('host'); $host = new Zend_Form_Element_Text('host');
$host->setLabel("Server") $host->setLabel("Server")
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"") ->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
->setValidators(array(
array('regex', false, array('/^[0-9a-zA-Z-_.]+$/', 'messages' => 'Invalid character entered'))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if($disable_all){ if($disable_all){
$host->setAttrib("disabled", "disabled"); $host->setAttrib("disabled", "disabled");
} }
$host->setAttrib('alt', 'domain');
$this->addElement($host); $this->addElement($host);
$port = new Zend_Form_Element_Text('port'); $port = new Zend_Form_Element_Text('port');
@ -103,10 +106,13 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
$pass = new Zend_Form_Element_Text('pass'); $pass = new Zend_Form_Element_Text('pass');
$pass->setLabel("Password") $pass->setLabel("Password")
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"") ->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if($disable_all){ if($disable_all){
$pass->setAttrib("disabled", "disabled"); $pass->setAttrib("disabled", "disabled");
} }
$pass->setAttrib('alt', 'regular_text');
$this->addElement($pass); $this->addElement($pass);
$genre = new Zend_Form_Element_Text('genre'); $genre = new Zend_Form_Element_Text('genre');
@ -121,10 +127,13 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
$url = new Zend_Form_Element_Text('url'); $url = new Zend_Form_Element_Text('url');
$url->setLabel("URL") $url->setLabel("URL")
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"") ->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
->setValidators(array(
array('regex', false, array('/^[0-9a-zA-Z\-_.:\/]+$/', 'messages' => 'Invalid character entered'))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if($disable_all){ if($disable_all){
$url->setAttrib("disabled", "disabled"); $url->setAttrib("disabled", "disabled");
} }
$url->setAttrib('alt', 'url');
$this->addElement($url); $this->addElement($url);
$description = new Zend_Form_Element_Text('description'); $description = new Zend_Form_Element_Text('description');
@ -139,19 +148,25 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
$mount = new Zend_Form_Element_Text('mount'); $mount = new Zend_Form_Element_Text('mount');
$mount->setLabel("Mount Point") $mount->setLabel("Mount Point")
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"") ->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if($disable_all){ if($disable_all){
$mount->setAttrib("disabled", "disabled"); $mount->setAttrib("disabled", "disabled");
} }
$mount->setAttrib('alt', 'regular_text');
$this->addElement($mount); $this->addElement($mount);
$user = new Zend_Form_Element_Text('user'); $user = new Zend_Form_Element_Text('user');
$user->setLabel("Username") $user->setLabel("Username")
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"") ->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => 'Invalid character entered'))))
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
if($disable_all){ if($disable_all){
$user->setAttrib("disabled", "disabled"); $user->setAttrib("disabled", "disabled");
} }
$user->setAttrib('alt', 'regular_text');
$this->addElement($user); $this->addElement($user);
$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>';

View file

@ -174,5 +174,18 @@ $(document).ready(function() {
showErrorSections() showErrorSections()
setInterval('checkLiquidsoapStatus()', 1000) setInterval('checkLiquidsoapStatus()', 1000)
$.mask.rules = {
'@': /[^ &<>]/,
'u': /[0-9a-zA-Z-_.:/]/,
'd': /[0-9a-zA-Z-_.]/
}
// add masking on the fields that don't allow special chars
$.mask.masks = $.extend($.mask.masks,{
regular_text:{ mask: '@', type:'repeat', 'maxLength': 256, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'},
url:{ mask: 'u', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),]'},
domain:{ mask: 'd', type:'repeat', 'maxLength': 261, selectCharsOnFocus: false, autoTab: false, fixedChars : '[(),:/]'}
})
$('input:text').setMask()
}); });

View file

@ -79,7 +79,7 @@ if(Application_Model_Preference::GetSupportFeedback() == '1'){
// Get latest version from stat server and store to db // Get latest version from stat server and store to db
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){ if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$url = 'http://stat.sourcefabric.org/airtime_latest_version'; $url = 'http://stat.sourcefabric.org/airtime-stats/airtime_latest_version';
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);