CC-3184 : Preferences: "Stream Label" needs to be moved to "Stream Settings"->"Global"

This commit is contained in:
Naomi Aro 2011-12-13 12:10:25 +01:00
parent 9275b21f48
commit 3cd11c696f
5 changed files with 61 additions and 59 deletions

View file

@ -33,7 +33,6 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view); Application_Model_Preference::SetHeadTitle($values["preferences_general"]["stationName"], $this->view);
Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]); Application_Model_Preference::SetDefaultFade($values["preferences_general"]["stationDefaultFade"]);
Application_Model_Preference::SetStreamLabelFormat($values["preferences_general"]["streamFormat"]);
Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]); Application_Model_Preference::SetAllow3rdPartyApi($values["preferences_general"]["thirdPartyApi"]);
Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]); Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]);
Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]); Application_Model_Preference::SetWeekStartDay($values["preferences_general"]["weekStartDay"]);
@ -180,6 +179,7 @@ class PreferenceController extends Zend_Controller_Action
} }
if ($request->isPost()) { if ($request->isPost()) {
$post_data = $request->getPost(); $post_data = $request->getPost();
$error = false; $error = false;
$values = array(); $values = array();
for($i=1; $i<=$num_of_stream; $i++){ for($i=1; $i<=$num_of_stream; $i++){
@ -197,8 +197,10 @@ class PreferenceController extends Zend_Controller_Action
$values['output_sound_device'] = $form->getValue('output_sound_device'); $values['output_sound_device'] = $form->getValue('output_sound_device');
} }
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata'); $values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type'); $values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
} }
if(!$error){ if(!$error){
Application_Model_StreamSetting::setStreamSetting($values); Application_Model_StreamSetting::setStreamSetting($values);

View file

@ -41,15 +41,6 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
) )
)); ));
$stream_format = new Zend_Form_Element_Radio('streamFormat');
$stream_format->setLabel('Stream Label:');
$stream_format->setMultiOptions(array("Artist - Title",
"Show - Artist - Title",
"Station name - Show name"));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
$third_party_api = new Zend_Form_Element_Radio('thirdPartyApi'); $third_party_api = new Zend_Form_Element_Radio('thirdPartyApi');
$third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)'); $third_party_api->setLabel('Allow Remote Websites To Access "Schedule" Info?<br> (Enable this to make front-end widgets work.)');
$third_party_api->setMultiOptions(array("Disabled", $third_party_api->setMultiOptions(array("Disabled",

View file

@ -56,11 +56,20 @@ class Application_Form_StreamSetting extends Zend_Form
$icecast_vorbis_metadata->setAttrib("readonly", true); $icecast_vorbis_metadata->setAttrib("readonly", true);
} }
$this->addElement($icecast_vorbis_metadata); $this->addElement($icecast_vorbis_metadata);
$stream_format = new Zend_Form_Element_Radio('streamFormat');
$stream_format->setLabel('Stream Label:');
$stream_format->setMultiOptions(array("Artist - Title",
"Show - Artist - Title",
"Station name - Show name"));
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
$stream_format->setDecorators(array('ViewHelper'));
$this->addElement($stream_format);
} }
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'], $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'])); "output_sound_device_type"=>$data['output_sound_device_type'], "streamFormat"=>$data['streamFormat']));
return true; return true;
} }
} }

View file

@ -27,29 +27,6 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="streamFormat-label" class="block-display">
<label class="optional"><?php echo $this->element->getElement('streamFormat')->getLabel() ?></label>
</dt>
<dd id="streamFormat-element" class="block-display radio-inline-list">
<?php $i=0;
$value = $this->element->getElement('streamFormat')->getValue();
?>
<?php foreach ($this->element->getElement('streamFormat')->getMultiOptions() as $radio) : ?>
<label for="streamFormat-<?php echo $i ?>">
<input type="radio" value="<?php echo $i ?>" id="streamFormat-<?php echo $i ?>" name="streamFormat" <?php if($i == $value){echo 'checked="checked"';}?> >
<?php echo $radio ?>
</input>
</label>
<?php $i = $i + 1; ?>
<?php endforeach; ?>
<?php if($this->element->getElement('streamFormat')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('streamFormat')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="thirdPartyApi-label" class="block-display"> <dt id="thirdPartyApi-label" class="block-display">
<label class="optional"><?php echo $this->element->getElement('thirdPartyApi')->getLabel() ?></label> <label class="optional"><?php echo $this->element->getElement('thirdPartyApi')->getLabel() ?></label>
</dt> </dt>

View file

@ -42,6 +42,29 @@
<dd id="vorbisMetadata-element"> <dd id="vorbisMetadata-element">
<?php echo $this->form->getElement('icecast_vorbis_metadata') ?> <?php echo $this->form->getElement('icecast_vorbis_metadata') ?>
</dd> </dd>
<dt id="streamFormat-label" class="block-display">
<label class="optional"><?php echo $this->form->getElement('streamFormat')->getLabel() ?></label>
</dt>
<dd id="streamFormat-element" class="block-display radio-inline-list">
<?php $i=0;
$value = $this->form->getElement('streamFormat')->getValue();
?>
<?php foreach ($this->form->getElement('streamFormat')->getMultiOptions() as $radio) : ?>
<label for="streamFormat-<?php echo $i ?>">
<input type="radio" value="<?php echo $i ?>" id="streamFormat-<?php echo $i ?>" name="streamFormat" <?php if($i == $value){echo 'checked="checked"';}?> >
<?php echo $radio ?>
</input>
</label>
<?php $i = $i + 1; ?>
<?php endforeach; ?>
<?php if($this->form->getElement('streamFormat')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->form->getElement('streamFormat')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
</dl> </dl>
</fieldset> </fieldset>
<?php <?php