CC-4732: Ask for admin username + password in Stream Settings page

- done
This commit is contained in:
James 2013-01-03 17:58:50 -05:00
parent 1f7e0ce042
commit ae7b6fe092
8 changed files with 101 additions and 30 deletions

View file

@ -190,6 +190,30 @@ class Application_Form_StreamSettingSubForm extends Zend_Form_SubForm
}
$user->setAttrib('alt', 'regular_text');
$this->addElement($user);
$adminUser = new Zend_Form_Element_Text('admin_user');
$adminUser->setLabel(_("Admin User"))
->setValue(Application_Model_StreamSetting::getAdminUser($prefix))
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$adminUser->setAttrib("disabled", "disabled");
}
$adminUser->setAttrib('alt', 'regular_text');
$this->addElement($adminUser);
$adminPass = new Zend_Form_Element_Text('admin_pass');
$adminPass->setLabel(_("Admin Password"))
->setValue(Application_Model_StreamSetting::getAdminPass($prefix))
->setValidators(array(
array('regex', false, array('/^[^ &<>]+$/', 'messages' => _('Invalid character entered')))))
->setDecorators(array('ViewHelper'));
if ($disable_all) {
$adminPass->setAttrib("disabled", "disabled");
}
$adminPass->setAttrib('alt', 'regular_text');
$this->addElement($adminPass);
$liquidsopa_error_msg = '<div class="stream-status status-info"><h3>'._('Getting information from the server...').'</h3></div>';

View file

@ -163,7 +163,7 @@ class Application_Model_StreamSetting
$con = Propel::getConnection();
$sql = "SELECT *"
." FROM cc_stream_setting"
." WHERE keyname not like '%_error'";
." WHERE keyname not like '%_error' AND keyname not like '%_admin_%'";
$rows = $con->query($sql)->fetchAll();
@ -433,4 +433,20 @@ class Application_Model_StreamSetting
{
return self::getValue("dj_live_stream_mp");
}
public static function getAdminUser($stream){
return self::getValue($stream."_admin_user");
}
public static function setAdminUser($stream, $v){
self::setValue($stream."_admin_user", $v, "string");
}
public static function getAdminPass($stream){
return self::getValue($stream."_admin_pass");
}
public static function setAdminPass($stream, $v){
self::setValue($stream."_admin_pass", $v, "string");
}
}

View file

@ -1,4 +1,4 @@
<?php
<?php
$s_name = "s".$this->stream_number;
?>
<h3 class="collapsible-header <?php echo $this->stream_number == '1'?"closed":""?>"><span class="arrow-icon"></span><? echo _("Stream "); ?><?php echo $this->stream_number?></h3>
@ -104,6 +104,34 @@
</ul>
<?php endif; ?>
</dd>
<dt id="adminUser-label">
<label for="outputUser"><?php echo $this->element->getElement('admin_user')->getLabel()?> :
<span class='admin_username_help_icon'></span>
</label>
</dt>
<dd id="adminUser-element">
<?php echo $this->element->getElement('admin_user')?>
<?php if($this->element->getElement('admin_user')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('admin_user')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="adminPassword-label">
<label class="optional" for="outputPassword"><?php echo $this->element->getElement('admin_pass')->getLabel()?> :</label>
</dt>
<dd id="adminPassword-element" class="clearfix">
<?php echo $this->element->getElement('admin_pass')?>
<?php if($this->element->getElement('admin_pass')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('admin_pass')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt class="block-display info-block">
<?php echo _("The following info will be displayed to listeners in their media player:")?>
</dt>