Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Martin Konecny 2012-03-26 16:18:43 -04:00
commit 3308cbb7de
5 changed files with 76 additions and 34 deletions

View File

@ -600,6 +600,7 @@ class ScheduleController extends Zend_Controller_Action
$what = $formWhat->isValid($data); $what = $formWhat->isValid($data);
$when = $formWhen->isValid($data); $when = $formWhen->isValid($data);
$live = $formLive->isValid($data);
if($when) { if($when) {
$when = $formWhen->checkReliantFields($data, $startDateModified); $when = $formWhen->checkReliantFields($data, $startDateModified);
} }
@ -691,7 +692,7 @@ class ScheduleController extends Zend_Controller_Action
$who = $formWho->isValid($data); $who = $formWho->isValid($data);
$style = $formStyle->isValid($data); $style = $formStyle->isValid($data);
if ($what && $when && $repeats && $who && $style) { if ($what && $when && $repeats && $who && $style && $live) {
if(!$isSaas){ if(!$isSaas){
if($record && $rebroadAb && $rebroad){ if($record && $rebroadAb && $rebroad){
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $userInfo = Zend_Auth::getInstance()->getStorage()->read();

View File

@ -47,8 +47,31 @@ class Application_Form_AddShowLiveStream extends Zend_Form_SubForm
->setDecorators(array('ViewHelper')); ->setDecorators(array('ViewHelper'));
$this->addElement($custom_password); $this->addElement($custom_password);
$connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
if(trim($connection_url) == ""){
$connection_url = "N/A";
}
$this->setDecorators(array( $this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url"=>Application_Model_Preference::GetLiveDJSourceConnectionURL())) array('ViewScript', array('viewScript' => 'form/add-show-live-stream.phtml', "connection_url"=>$connection_url))
)); ));
} }
public function isValid($data){
$isValid = parent::isValid($data);
if($data['cb_custom_auth'] == 1){
if(trim($data['custom_username']) == ''){
$element = $this->getElement("custom_username");
$element->addError("Username field cannot be empty.");
$isValid = false;
}
if(trim($data['custom_password']) == ''){
$element = $this->getElement("custom_password");
$element->addError("Password field cannot be empty.");
$isValid = false;
}
}
return $isValid;
}
} }

View File

@ -26,36 +26,36 @@
<dd id="cb_custom_auth_override-element"> <dd id="cb_custom_auth_override-element">
<?php echo $this->element->getElement('cb_custom_auth') ?> <?php echo $this->element->getElement('cb_custom_auth') ?>
</dd> </dd>
<div id="custom_auth_div">
<dt id="custom_username-label" class="block-display">
<dt id="custom_username-label" class="block-display"> <label class="optional" for="custom_username"><?php echo $this->element->getElement('custom_username')->getLabel() ?> :
<label class="optional" for="custom_username"><?php echo $this->element->getElement('custom_username')->getLabel() ?> : </label>
</label> </dt>
</dt> <dd id="custom_username-element" class="block-display">
<dd id="custom_username-element" class="block-display"> <?php echo $this->element->getElement('custom_username') ?>
<?php echo $this->element->getElement('custom_username') ?> <?php if($this->element->getElement('custom_username')->hasErrors()) : ?>
<?php if($this->element->getElement('custom_username')->hasErrors()) : ?> <ul class='errors'>
<ul class='errors'> <?php foreach($this->element->getElement('custom_username')->getMessages() as $error): ?>
<?php foreach($this->element->getElement('custom_username')->getMessages() as $error): ?> <li><?php echo $error; ?></li>
<li><?php echo $error; ?></li> <?php endforeach; ?>
<?php endforeach; ?> </ul>
</ul> <?php endif; ?>
<?php endif; ?> </dd>
</dd> <dt id="custom_password-label" class="block-display">
<dt id="custom_password-label" class="block-display"> <label class="optional" for="custom_password"><?php echo $this->element->getElement('custom_password')->getLabel() ?> :
<label class="optional" for="custom_password"><?php echo $this->element->getElement('custom_password')->getLabel() ?> : </label>
</label> </dt>
</dt> <dd id="custom_password-element" class="block-display">
<dd id="custom_password-element" class="block-display"> <?php echo $this->element->getElement('custom_password') ?>
<?php echo $this->element->getElement('custom_password') ?> <?php if($this->element->getElement('custom_password')->hasErrors()) : ?>
<?php if($this->element->getElement('custom_password')->hasErrors()) : ?> <ul class='errors'>
<ul class='errors'> <?php foreach($this->element->getElement('custom_password')->getMessages() as $error): ?>
<?php foreach($this->element->getElement('custom_password')->getMessages() as $error): ?> <li><?php echo $error; ?></li>
<li><?php echo $error; ?></li> <?php endforeach; ?>
<?php endforeach; ?> </ul>
</ul> <?php endif; ?>
<?php endif; ?> </dd>
</dd> </div>
<dt id="Connection_URL-label"> <dt id="Connection_URL-label">
<label for="outputStreamURL">Connection URL: </label> <label for="outputStreamURL">Connection URL: </label>
</dt> </dt>

View File

@ -401,6 +401,21 @@ function setAddShowEvents() {
// calculate duration // calculate duration
calculateDuration(endDateTime, startDateTime); calculateDuration(endDateTime, startDateTime);
}); });
if($('#cb_custom_auth').attr('checked')){
$('#custom_auth_div').show()
}else{
$('#custom_auth_div').hide()
}
$('#cb_custom_auth').change(function(){
if($(this).attr('checked')){
$('#custom_auth_div').show()
}else{
$('#custom_auth_div').hide()
}
})
function calculateDuration(endDateTime, startDateTime){ function calculateDuration(endDateTime, startDateTime){
var duration; var duration;
@ -446,6 +461,9 @@ function showErrorSections() {
$("#schedule-record-rebroadcast").show(); $("#schedule-record-rebroadcast").show();
$("#add_show_rebroadcast_absolute").show(); $("#add_show_rebroadcast_absolute").show();
} }
if($("#live-stream-override .errors").length > 0) {
$("#live-stream-override").show();
}
if($("#add_show_rebroadcast_relative .errors").length > 0) { if($("#add_show_rebroadcast_relative .errors").length > 0) {
$("#schedule-record-rebroadcast").show(); $("#schedule-record-rebroadcast").show();
$("#add_show_rebroadcast_relative").show(); $("#add_show_rebroadcast_relative").show();

View File

@ -28,7 +28,7 @@ liquidsoap_start () {
liquidsoap_stop () { liquidsoap_stop () {
monit unmonitor airtime-liquidsoap >/dev/null 2>&1 monit unmonitor airtime-liquidsoap >/dev/null 2>&1
python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py /usr/lib/airtime/airtime_virtualenv/bin/python2.6 /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
# Send TERM after 5 seconds, wait at most 30 seconds. # Send TERM after 5 seconds, wait at most 30 seconds.
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1 start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
@ -65,7 +65,7 @@ monit_restart() {
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE0 start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE0
rm -f $PIDFILE0 rm -f $PIDFILE0
python /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py /usr/lib/airtime/airtime_virtualenv/bin/python2.6 /usr/lib/airtime/pypo/bin/liquidsoap_scripts/liquidsoap_prepare_terminate.py
start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1 start-stop-daemon --stop --oknodo --retry TERM/5/0/30 --quiet --pidfile $PIDFILE1
rm -f $PIDFILE1 rm -f $PIDFILE1