CC-3077: Preference/stream-setting page has no Vorbis metadata option

- done
This commit is contained in:
James 2011-11-23 17:03:30 -05:00
parent 7ac13d26f0
commit a886b53d74
5 changed files with 56 additions and 21 deletions

View file

@ -165,10 +165,10 @@ class PreferenceController extends Zend_Controller_Action
$num_of_stream = intval(Application_Model_Preference::GetNumOfStreams());
$form = new Application_Form_StreamSetting();
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$form->setSetting($setting);
$form->startFrom();
}
for($i=1; $i<=$num_of_stream; $i++){
$subform = new Application_Form_StreamSettingSubForm();
$subform->setPrefix($i);
@ -192,9 +192,14 @@ class PreferenceController extends Zend_Controller_Action
}
}
}
if(Application_Model_Preference::GetPlanLevel() == 'disabled' && $form->isValid($post_data['output_sound_device'])){
if($form->isValid($post_data)){
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){// && $form->isValid($post_data['output_sound_device'])){
$values['output_sound_device'] = $form->getValue('output_sound_device');
}
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
}
var_dump($form->getValue('icecast_vorbis_metadata'));
if(!$error){
Application_Model_StreamSetting::setStreamSetting($values);
$data = array();

View file

@ -15,8 +15,9 @@ class Application_Form_StreamSetting extends Zend_Form
public function startFrom() {
$setting = $this->setting;
if(Application_Model_Preference::GetPlanLevel() == 'disabled'){
$output_sound_device = new Zend_Form_Element_Checkbox('output_sound_device');
$output_sound_device->setLabel('Enabled')
$output_sound_device->setLabel('Hardware Audio Ouput')
->setRequired(false)
->setValue(($setting['output_sound_device'] == "true")?1:0)
->setDecorators(array('ViewHelper'));
@ -26,8 +27,19 @@ class Application_Form_StreamSetting extends Zend_Form
$this->addElement($output_sound_device);
}
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Meatadata')
->setRequired(false)
->setValue(($setting['icecast_vorbis_metadata'] == "true")?1:0)
->setDecorators(array('ViewHelper'));
if (Application_Model_Preference::GetEnableStreamConf() == "false"){
$icecast_vorbis_metadata->setAttrib("readonly", true);
}
$this->addElement($icecast_vorbis_metadata);
}
public function isValid($data){
$this->populate(array("output_sound_device"=>$data));
$this->populate(array("output_sound_device"=>$data['output_sound_device'], "icecast_vorbis_metadata"=>$data['icecast_vorbis_metadata']));
return true;
}
}

View file

@ -60,12 +60,13 @@ class Application_Model_StreamSetting {
public static function setStreamSetting($data){
global $CC_DBC;
foreach($data as $key=>$d){
if($key == "output_sound_device"){
if($key == "output_sound_device" || $key == "icecast_vorbis_metadata"){
$v = $d == 1?"true":"false";
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$key'";
$CC_DBC->query($sql);
}
else{
var_dump($key);
$temp = explode('_', $key);
$prefix = $temp[0];
foreach($d as $k=>$v){

View file

@ -8,21 +8,29 @@
<div style="clear:both"></div>
<?php }?>
<?php echo $this->statusMsg;?>
<?php if($this->form->getElement('output_sound_device') != null){?>
<fieldset class="padded">
<legend>Hardware Audio Out</legend>
<fieldset class="padded stream-setting-global">
<legend>Global Settings</legend>
<dl class="zend_form">
<?php if($this->form->getElement('output_sound_device') != null){?>
<dt id="hardwareOut-label">
<label class="required" for="EnableHardwareOut">
<label class="required">
<?php echo $this->form->getElement('output_sound_device')->getLabel() ?> :
</label>
</dt>
<dd id="hardwareOut-element">
<?php echo $this->form->getElement('output_sound_device') ?>
</dd>
<?php } ?>
<dt id="vorbisMetadata-label">
<label class="required">
<?php echo $this->form->getElement('icecast_vorbis_metadata')->getLabel() ?> :
</label>
</dt>
<dd id="vorbisMetadata-element">
<?php echo $this->form->getElement('icecast_vorbis_metadata') ?>
</dd>
</dl>
</fieldset>
<?php } ?>
<?php
for($i=1;$i<=$this->num_stream;$i++){
echo $this->form->getSubform("s".$i."_subform");

View file

@ -2429,3 +2429,12 @@ dd .stream-status {
.status-disabled h3 {
color:#646664;
}
.stream-setting-global dt{
width: 180px;
}
.stream-setting-global dd{
width: auto;
}