CC-2706: Streams should have a username field
- adding "User" field on stream setting form - change key name from "output_s1" to "s1_output" format to be consistent - changed order of inserting in default.sql file - hiding username field on shoutcast selection - liquidsoap and pypo takes care of user field input
This commit is contained in:
parent
9eb21cb327
commit
58837ff89b
8 changed files with 136 additions and 89 deletions
|
@ -38,74 +38,83 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
|
||||
$enable = new Zend_Form_Element_Checkbox('enable');
|
||||
$enable->setLabel('Enabled:')
|
||||
->setValue($setting['output_'.$prefix] != 'disabled'?1:0)
|
||||
->setValue($setting[$prefix.'_output'] != 'disabled'?1:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($enable);
|
||||
|
||||
$type = new Zend_Form_Element_Select('type');
|
||||
$type->setLabel("Type:")
|
||||
->setMultiOptions($stream_types)
|
||||
->setValue($setting[$prefix.'_type'])
|
||||
->setValue(isset($setting[$prefix.'_type'])?$setting[$prefix.'_type']:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($type);
|
||||
|
||||
$bitrate = new Zend_Form_Element_Select('bitrate');
|
||||
$bitrate->setLabel("Bitrate:")
|
||||
->setMultiOptions($stream_bitrates)
|
||||
->setValue($setting[$prefix.'_bitrate'])
|
||||
->setValue(isset($setting[$prefix.'_bitrate'])?$setting[$prefix.'_bitrate']:0)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($bitrate);
|
||||
|
||||
$output = new Zend_Form_Element_Select('output');
|
||||
$output->setLabel("Output to:")
|
||||
->setMultiOptions(array("icecast"=>"Icecast", "shoutcast"=>"Shoutcast"))
|
||||
->setValue($setting['output_'.$prefix])
|
||||
->setValue(isset($setting[$prefix.'_output'])?$setting[$prefix.'_output']:"icecast")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($output);
|
||||
|
||||
$host = new Zend_Form_Element_Text('host');
|
||||
$host->setLabel("Server")
|
||||
->setValue($setting[$prefix.'_host'])
|
||||
->setValue(isset($setting[$prefix.'_host'])?$setting[$prefix.'_host']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($host);
|
||||
|
||||
$port = new Zend_Form_Element_Text('port');
|
||||
$port->setLabel("Port")
|
||||
->setValue($setting[$prefix.'_port'])
|
||||
->setValue(isset($setting[$prefix.'_port'])?$setting[$prefix.'_port']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($port);
|
||||
|
||||
$pass = new Zend_Form_Element_Text('pass');
|
||||
$pass->setLabel("Password")
|
||||
->setValue($setting[$prefix.'_pass'])
|
||||
->setValue(isset($setting[$prefix.'_pass'])?$setting[$prefix.'_pass']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($pass);
|
||||
|
||||
$genre = new Zend_Form_Element_Text('genre');
|
||||
$genre->setLabel("Genre:")
|
||||
->setValue($setting[$prefix.'_genre'])
|
||||
$genre->setLabel("Genre")
|
||||
->setValue(isset($setting[$prefix.'_genre'])?$setting[$prefix.'_genre']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($genre);
|
||||
|
||||
$url = new Zend_Form_Element_Text('url');
|
||||
$url->setLabel("URL")
|
||||
->setValue($setting[$prefix.'_url'])
|
||||
->setValue(isset($setting[$prefix.'_url'])?$setting[$prefix.'_url']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($url);
|
||||
|
||||
$description = new Zend_Form_Element_Text('description');
|
||||
$description->setLabel("Name/Description")
|
||||
->setValue($setting[$prefix.'_description'])
|
||||
->setValue(isset($setting[$prefix.'_description'])?$setting[$prefix.'_description']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($description);
|
||||
|
||||
$mount_info = explode('.',$setting[$prefix.'_mount']);
|
||||
$mount_info = array();
|
||||
if(isset($setting[$prefix.'_mount'])){
|
||||
$mount_info = explode('.',$setting[$prefix.'_mount']);
|
||||
}
|
||||
$mount = new Zend_Form_Element_Text('mount');
|
||||
$mount->setLabel("Mount Point")
|
||||
->setValue($mount_info[0])
|
||||
->setValue(isset($mount_info[0])?$mount_info[0]:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($mount);
|
||||
|
||||
$user = new Zend_Form_Element_Text('user');
|
||||
$user->setLabel("Username")
|
||||
->setValue(isset($setting[$prefix.'_user'])?$setting[$prefix.'_user']:"")
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($user);
|
||||
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/stream-setting-form.phtml', "stream_number"=>$stream_number))
|
||||
));
|
||||
|
@ -124,11 +133,6 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm{
|
|||
$element->addError("Port cannot be empty.");
|
||||
$isValid = false;
|
||||
}
|
||||
if($data['pass'] == ''){
|
||||
$element = $this->getElement("pass");
|
||||
$element->addError("Password cannot be empty.");
|
||||
$isValid = false;
|
||||
}
|
||||
if($data['output'] == 'icecast'){
|
||||
if($data['mount'] == ''){
|
||||
$element = $this->getElement("mount");
|
||||
|
|
|
@ -26,7 +26,6 @@ class Application_Model_StreamSetting {
|
|||
foreach($d as $k=>$v){
|
||||
$keyname = $prefix."_".$k;
|
||||
if( $k == 'output'){
|
||||
$keyname = $k."_".$prefix;
|
||||
if( $d["enable"] == 0){
|
||||
$v = 'disabled';
|
||||
}
|
||||
|
|
|
@ -63,8 +63,21 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="outputUser-label" class="block-display">
|
||||
<label for="outputUser"><?php echo $this->element->getElement('user')->getLabel()?> :</label>
|
||||
</dt>
|
||||
<dd id="outputUser-element" class="block-display">
|
||||
<?php echo $this->element->getElement('user')?>
|
||||
<?php if($this->element->getElement('user')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('user')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="outputPassword-label" class="block-display">
|
||||
<label class="optional" for="outputPassword"><?php echo $this->element->getElement('pass')->getLabel()?><span class="info-text-small">(Required)</span> :</label>
|
||||
<label class="optional" for="outputPassword"><?php echo $this->element->getElement('pass')->getLabel()?> :</label>
|
||||
</dt>
|
||||
<dd id="outputPassword-element" class="block-display clearfix">
|
||||
<?php echo $this->element->getElement('pass')?>
|
||||
|
@ -80,7 +93,7 @@
|
|||
The following info will be displayed to listeners in their media player:
|
||||
</dt>
|
||||
<dt id="stationDescription-label" class="block-display">
|
||||
<label for="stationDescription"><?php echo $this->element->getElement('description')->getLabel()?></label>
|
||||
<label for="stationDescription"><?php echo $this->element->getElement('description')->getLabel()?> :</label>
|
||||
</dt>
|
||||
<dd id="stationDescription-element" class="block-display clearfix">
|
||||
<?php echo $this->element->getElement('description')?>
|
||||
|
@ -106,7 +119,7 @@
|
|||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="outputGenre-label" class="block-display">
|
||||
<label for="outputGenre"><?php echo $this->element->getElement('genre')->getLabel()?></label>
|
||||
<label for="outputGenre"><?php echo $this->element->getElement('genre')->getLabel()?> :</label>
|
||||
</dt>
|
||||
<dd id="outputGenre-element" class="block-display">
|
||||
<?php echo $this->element->getElement('genre')?>
|
||||
|
|
|
@ -4,38 +4,42 @@ INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_type', 'ogg, mp3');
|
|||
INSERT INTO cc_pref("keystr", "valstr") VALUES('stream_bitrate', '24, 32, 48, 64, 96, 128, 160, 192, 224, 256, 320');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_sound_device', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_icecast_vorbis_metadata', 'false', 'boolean');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_s1', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_s2', 'disabled', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('output_s3', 'disabled', 'string');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_output', 'icecast', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_type', 'ogg', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_bitrate', '128', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_host', '127.0.0.1', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_port', '8000', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_pass', 'hackme', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_mount', 'airtime_128.ogg', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_url', 'http://airtime.sourcefabric.org', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_description', 'Airtime Radio! Stream #1', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s1_genre', 'genre', 'string');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_output', 'disabled', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s2_genre', '', 'string');
|
||||
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_output', 'disabled', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_type', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_bitrate', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_host', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_port', '', 'integer');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_user', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_pass', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_mount', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_url', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_description', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('s3_genre', '', 'string');
|
||||
INSERT INTO cc_stream_setting ("keyname", "value", "type") VALUES ('log_file', '/var/log/airtime/pypo-liquidsoap/<script>.log', 'string');
|
||||
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('AFG', 'Afghanistan ');
|
||||
INSERT INTO cc_country (isocode, name) VALUES ('ALA', 'Åland Islands');
|
||||
|
|
|
@ -28,6 +28,20 @@ function rebuildStreamURL(ele){
|
|||
div.find("#stream_url").html(streamurl)
|
||||
}
|
||||
|
||||
function hideForShoutcast(ele){
|
||||
ele.closest("div").find("#outputMountpoint-label").hide()
|
||||
ele.closest("div").find("#outputMountpoint-element").hide()
|
||||
ele.closest("div").find("#outputUser-label").hide()
|
||||
ele.closest("div").find("#outputUser-element").hide()
|
||||
}
|
||||
|
||||
function showForIcecast(ele){
|
||||
ele.closest("div").find("#outputMountpoint-label").show()
|
||||
ele.closest("div").find("#outputMountpoint-element").show()
|
||||
ele.closest("div").find("#outputUser-label").show()
|
||||
ele.closest("div").find("#outputUser-element").show()
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
// initial stream url
|
||||
$("dd[id=outputStreamURL-element]").each(function(){
|
||||
|
@ -50,11 +64,15 @@ $(document).ready(function() {
|
|||
|
||||
$("select[id$=-output]").change(function(){
|
||||
if($(this).val() == 'shoutcast'){
|
||||
$(this).closest("div").find("#outputMountpoint-label").hide()
|
||||
$(this).closest("div").find("#outputMountpoint-element").hide()
|
||||
hideForShoutcast($(this))
|
||||
}else{
|
||||
$(this).closest("div").find("#outputMountpoint-label").show()
|
||||
$(this).closest("div").find("#outputMountpoint-element").show()
|
||||
showForIcecast($(this))
|
||||
}
|
||||
})
|
||||
|
||||
$("select[id$=-output]").each(function(){
|
||||
if($(this).val() == 'shoutcast'){
|
||||
hideForShoutcast($(this))
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue