CC-2753: Ability to disable stream 1 but still show it in the interface
- interface change - all elements becomes 'disabled' depending on 'disable_stream_conf' flag
This commit is contained in:
parent
0c72b8b6bf
commit
fa929d45a6
5 changed files with 56 additions and 0 deletions
|
@ -188,6 +188,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
$this->view->disable_stream_conf = Application_Model_Preference::GetDisableStreamConf();
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,9 @@ class Application_Form_StreamSetting extends Zend_Form
|
|||
->setRequired(false)
|
||||
->setValue(($setting['output_sound_device'] == "true")?1:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if(Application_Model_Preference::GetDisableStreamConf() == "true"){
|
||||
$output_sound_device->setAttrib("readonly", true);
|
||||
}
|
||||
$this->addElement($output_sound_device);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,10 +36,18 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
$this->setIsArray(true);
|
||||
$this->setElementsBelongTo($prefix."_data");
|
||||
|
||||
$disable_all = false;
|
||||
if(Application_Model_Preference::GetDisableStreamConf() == "true"){
|
||||
$disable_all = true;
|
||||
}
|
||||
|
||||
$enable = new Zend_Form_Element_Checkbox('enable');
|
||||
$enable->setLabel('Enabled:')
|
||||
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$enable->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($enable);
|
||||
|
||||
$type = new Zend_Form_Element_Select('type');
|
||||
|
@ -47,6 +55,9 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
->setMultiOptions($stream_types)
|
||||
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$type->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($type);
|
||||
|
||||
$bitrate = new Zend_Form_Element_Select('bitrate');
|
||||
|
@ -54,6 +65,10 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
->setMultiOptions($stream_bitrates)
|
||||
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$bitrate->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($type);
|
||||
$this->addElement($bitrate);
|
||||
|
||||
$output = new Zend_Form_Element_Select('output');
|
||||
|
@ -61,54 +76,81 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
|
||||
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$output->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($output);
|
||||
|
||||
$host = new Zend_Form_Element_Text('host');
|
||||
$host->setLabel("Server")
|
||||
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$host->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($host);
|
||||
|
||||
$port = new Zend_Form_Element_Text('port');
|
||||
$port->setLabel("Port")
|
||||
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$port->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($port);
|
||||
|
||||
$pass = new Zend_Form_Element_Text('pass');
|
||||
$pass->setLabel("Password")
|
||||
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$pass->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($pass);
|
||||
|
||||
$genre = new Zend_Form_Element_Text('genre');
|
||||
$genre->setLabel("Genre")
|
||||
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$genre->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($genre);
|
||||
|
||||
$url = new Zend_Form_Element_Text('url');
|
||||
$url->setLabel("URL")
|
||||
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$url->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($url);
|
||||
|
||||
$description = new Zend_Form_Element_Text('description');
|
||||
$description->setLabel("Name/Description")
|
||||
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$description->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($description);
|
||||
|
||||
$mount = new Zend_Form_Element_Text('mount');
|
||||
$mount->setLabel("Mount Point")
|
||||
->setValue(isset($setting[$prefix.'_mount'])?$setting[$prefix.'_mount']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$mount->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($mount);
|
||||
|
||||
$user = new Zend_Form_Element_Text('user');
|
||||
$user->setLabel("Username")
|
||||
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
if($disable_all){
|
||||
$user->setAttrib("disabled", "disabled");
|
||||
}
|
||||
$this->addElement($user);
|
||||
|
||||
$this->setDecorators(array(
|
||||
|
|
|
@ -426,5 +426,13 @@ class Application_Model_Preference
|
|||
public static function GetTrialEndingDate(){
|
||||
return Application_Model_Preference::GetValue("trial_end_date");
|
||||
}
|
||||
|
||||
public static function SetDisableStreamConf($bool){
|
||||
Application_Model_Preference::SetValue("disable_stream_conf", $bool);
|
||||
}
|
||||
|
||||
public static function GetDisableStreamConf(){
|
||||
return Application_Model_Preference::GetValue("disable_stream_conf");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
echo $this->form->getSubform("s".$i."_subform");
|
||||
}
|
||||
?>
|
||||
<?php if($this->disable_stream_conf != "true"){?>
|
||||
<div class="button-bar bottom" id="submit-element">
|
||||
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
|
||||
</div>
|
||||
<?php }?>
|
||||
</form>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue