Merge branch '2.1.x' of dev.sourcefabric.org:airtime into 2.1.x

This commit is contained in:
denise 2012-06-15 14:42:37 -04:00
commit 87faf47c94
8 changed files with 151 additions and 72 deletions

View File

@ -814,6 +814,12 @@ class ApiController extends Zend_Controller_Action
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "off");
Application_Model_LiveLog::SetEndTime($sourcename == 'scheduled_play'?'S':'L',
new DateTime("now", new DateTimeZone('UTC')));
}elseif($status == "true" && Application_Model_Preference::GetAutoSwitch()){
$data = array("sourcename"=>$sourcename, "status"=>"on");
Application_Model_RabbitMq::SendMessageToPypo("switch_source", $data);
Application_Model_Preference::SetSourceSwitchStatus($sourcename, "on");
Application_Model_LiveLog::SetNewLogTime($sourcename == 'scheduled_play'?'S':'L',
new DateTime("now", new DateTimeZone('UTC')));
}
Application_Model_Preference::SetSourceStatus($sourcename, $status);
}

View File

@ -215,6 +215,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetLiveSteamMasterPassword($values["master_password"]);
Application_Model_Preference::SetDefaultTransitionFade($values["transition_fade"]);
Application_Model_Preference::SetAutoTransition($values["auto_transition"]);
Application_Model_Preference::SetAutoSwitch($values["auto_switch"]);
if (!$isSaas) {
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
@ -265,7 +266,7 @@ class PreferenceController extends Zend_Controller_Action
}
$live_stream_subform->updateVariables();
$this->view->confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings).";
$this->view->confirm_pypo_restart_text = "If you change the username or password values for an enabled stream the playout engine will be rebooted and your listeners will hear silence for 5-10 seconds. Changing the following fields will NOT cause a reboot: Stream Label (Global Settings), and Switch Transition Fade(s), Master Username, and Master Password (Input Stream Settings). If Airtime is recording, and if the change causes a playout engine restart, the recording will be interrupted.";
$this->view->num_stream = $num_of_stream;
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();

View File

@ -49,6 +49,7 @@ class Application_Form_AddUser extends Zend_Form
$email->setLabel('Email:');
$email->setAttrib('class', 'input_text');
$email->addFilter('StringTrim');
$email->setRequired(true);
$email->addValidator('EmailAddress');
$this->addElement($email);

View File

@ -15,13 +15,20 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$defaultFade = '00.000000';
}
// automatic switch off
// automatic trasition on source disconnection
$auto_transition = new Zend_Form_Element_Checkbox("auto_transition");
$auto_transition->setLabel("Auto Switch Off")
->setValue(Application_Model_Preference::GetAutoTransition())
->setDecorators(array('ViewHelper'));
$this->addElement($auto_transition);
// automatic switch on upon source connection
$auto_switch = new Zend_Form_Element_Checkbox("auto_switch");
$auto_switch->setLabel("Auto Switch On")
->setValue(Application_Model_Preference::GetAutoSwitch())
->setDecorators(array('ViewHelper'));
$this->addElement($auto_switch);
// Default transition fade
$transition_fade = new Zend_Form_Element_Text("transition_fade");
$transition_fade->setLabel("Switch Transition Fade (s)")

View File

@ -877,6 +877,14 @@ class Application_Model_Preference
return self::GetValue("auto_transition");
}
public static function SetAutoSwitch($value){
self::SetValue("auto_switch", $value, false);
}
public static function GetAutoSwitch(){
return self::GetValue("auto_switch");
}
public static function SetEnableSystemEmail($upload) {
self::SetValue("enable_system_email", $upload);
}

View File

@ -17,6 +17,22 @@
</ul>
<?php endif; ?>
</dd>
<dt id="auto_switch-label">
<label class="optional" for="auto_transition"><?php echo $this->element->getElement('auto_switch')->getLabel() ?> :
<span class="icecast_metadata_help_icon" id="auto_switch_help">
</span>
</label>
</dt>
<dd id="auto_switch-element">
<?php echo $this->element->getElement('auto_switch') ?>
<?php if($this->element->getElement('auto_switch')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('auto_switch')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</dd>
<dt id="transition_fade-label">
<label class="optional" for="transition_fade"><?php echo $this->element->getElement('transition_fade')->getLabel() ?> :
</label>

View File

@ -311,6 +311,27 @@ $(document).ready(function() {
},
})
$("#auto_switch_help").qtip({
content: {
text: "Check this box to automatically switch on Master/Show source upon source disconnection."
},
hide: {
delay: 500,
fixed: true
},
style: {
border: {
width: 0,
radius: 4
},
classes: "ui-tooltip-dark ui-tooltip-rounded"
},
position: {
my: "left bottom",
at: "right center"
},
})
$(".stream_username_help_icon").qtip({
content: {
text: "If your live streaming client does not ask for a username, this field should be 'source'."

View File

@ -12,7 +12,7 @@ function startDpSelect(dateText, inst) {
date = new Date(time[0], time[1] - 1, time[2]);
if (inst.input)
inst.input.trigger('change');
inst.input.trigger('input');
}
function endDpSelect(dateText, inst) {
@ -22,19 +22,19 @@ function endDpSelect(dateText, inst) {
date = new Date(time[0], time[1] - 1, time[2]);
if (inst.input)
inst.input.trigger('change');
inst.input.trigger('input');
}
function createDateInput(el, onSelect) {
var date;
el.datepicker({
minDate: adjustDateToServerDate(new Date(), timezoneOffset),
onSelect: onSelect,
dateFormat: 'yy-mm-dd',
closeText: 'Close',
showButtonPanel: true,
firstDay: weekStart
minDate: adjustDateToServerDate(new Date(), timezoneOffset),
onSelect: onSelect,
dateFormat: 'yy-mm-dd',
closeText: 'Close',
showButtonPanel: true,
firstDay: weekStart
});
}
@ -83,6 +83,14 @@ function beginEditShow(data){
openAddShowForm();
}
function onStartTimeSelect(){
$("#add_show_start_time").trigger('input');
}
function onEndTimeSelect(){
$("#add_show_end_time").trigger('input');
}
function setAddShowEvents() {
var form = $("#add-show-form");
@ -255,12 +263,14 @@ function setAddShowEvents() {
createDateInput(form.find("#add_show_end_date_no_repeat"), endDpSelect);
createDateInput(form.find("#add_show_end_date"), endDpSelect);
form.find("#add_show_start_time").timepicker({
$("#add_show_start_time").timepicker({
amPmText: ['', ''],
defaultTime: '00:00'
defaultTime: '00:00',
onSelect: onStartTimeSelect
});
form.find("#add_show_end_time").timepicker({
amPmText: ['', '']
$("#add_show_end_time").timepicker({
amPmText: ['', ''],
onSelect: onEndTimeSelect
});
form.find('input[name^="add_show_rebroadcast_date_absolute"]').datepicker({
@ -438,72 +448,81 @@ function setAddShowEvents() {
});
});
var regDate = new RegExp(/^[0-9]{4}-[0-1][0-9]-[0-3][0-9]/);
var regTime = new RegExp(/^[0-2][0-9]:[0-5][0-9]/);
// when start date/time changes, set end date/time to start date/time+1 hr
$('#add_show_start_date, #add_show_start_time').change(function(){
$('#add_show_start_date, #add_show_start_time').bind('input', 'change', function(){
var startDateString = $('#add_show_start_date').val();
var startTimeString = $('#add_show_start_time').val();
var startDate = startDateString.split('-');
var startTime = startTimeString.split(':');
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
var endDateString = $('#add_show_end_date_no_repeat').val();
var endTimeString = $('#add_show_end_time').val()
var endDate = endDateString.split('-');
var endTime = endTimeString.split(':');
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
if(startDateTime.getTime() >= endDateTime.getTime()){
var duration = $('#add_show_duration').val();
// parse duration
var time = 0;
var info = duration.split(' ');
var h = parseInt(info[0], 10);
time += h * 60 * 60* 1000;
if(info.length >1 && $.trim(info[1]) !== ''){
var m = parseInt(info[1], 10);
time += m * 60 * 1000;
}
endDateTime = new Date(startDateTime.getTime() + time);
}
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
$('#add_show_end_date_no_repeat').val(endDateFormat);
$('#add_show_end_time').val(endTimeFormat);
// calculate duration
var startDateTimeString = startDateString + " " + startTimeString;
var endDateTimeString = $('#add_show_end_date_no_repeat').val() + " " + $('#add_show_end_time').val();
calculateDuration(startDateTimeString, endDateTimeString);
if(regDate.test(startDateString) && regTime.test(startTimeString)){
var startDate = startDateString.split('-');
var startTime = startTimeString.split(':');
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
var endDateString = $('#add_show_end_date_no_repeat').val();
var endTimeString = $('#add_show_end_time').val()
var endDate = endDateString.split('-');
var endTime = endTimeString.split(':');
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
if(startDateTime.getTime() >= endDateTime.getTime()){
var duration = $('#add_show_duration').val();
// parse duration
var time = 0;
var info = duration.split(' ');
var h = parseInt(info[0], 10);
time += h * 60 * 60* 1000;
if(info.length >1 && $.trim(info[1]) !== ''){
var m = parseInt(info[1], 10);
time += m * 60 * 1000;
}
endDateTime = new Date(startDateTime.getTime() + time);
}
var endDateFormat = endDateTime.getFullYear() + '-' + pad(endDateTime.getMonth()+1,2) + '-' + pad(endDateTime.getDate(),2);
var endTimeFormat = pad(endDateTime.getHours(),2) + ':' + pad(endDateTime.getMinutes(),2);
$('#add_show_end_date_no_repeat').val(endDateFormat);
$('#add_show_end_time').val(endTimeFormat);
// calculate duration
var startDateTimeString = startDateString + " " + startTimeString;
var endDateTimeString = $('#add_show_end_date_no_repeat').val() + " " + $('#add_show_end_time').val();
calculateDuration(startDateTimeString, endDateTimeString);
}
});
// when end date/time changes, check if the changed date is in past of start date/time
$('#add_show_end_date_no_repeat, #add_show_end_time').change(function(){
var startDateString = $('#add_show_start_date').val();
var startTimeString = $('#add_show_start_time').val();
var startDate = startDateString.split('-');
var startTime = startTimeString.split(':');
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
var endDateString = $('#add_show_end_date_no_repeat').val();
$('#add_show_end_date_no_repeat, #add_show_end_time').bind('input', 'change', function(){
var endDateString = $('#add_show_end_date_no_repeat').val();
var endTimeString = $('#add_show_end_time').val()
var endDate = endDateString.split('-');
var endTime = endTimeString.split(':');
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
if(regDate.test(endDateString) && regTime.test(endTimeString)){
var startDateString = $('#add_show_start_date').val();
var startTimeString = $('#add_show_start_time').val();
var startDate = startDateString.split('-');
var startTime = startTimeString.split(':');
var startDateTime = new Date(startDate[0], parseInt(startDate[1], 10)-1, startDate[2], startTime[0], startTime[1], 0, 0);
if(startDateTime.getTime() > endDateTime.getTime()){
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
$('#add_show_end_time').css('background-color', '#F49C9C');
}else{
$('#add_show_end_date_no_repeat').css('background-color', '');
$('#add_show_end_time').css('background-color', '');
}
// calculate duration
var startDateTimeString = startDateString + " " + startTimeString;
var endDateTimeString = endDateString + " " + endTimeString;
calculateDuration(startDateTimeString, endDateTimeString);
var endDate = endDateString.split('-');
var endTime = endTimeString.split(':');
var endDateTime = new Date(endDate[0], parseInt(endDate[1], 10)-1, endDate[2], endTime[0], endTime[1], 0, 0);
if(startDateTime.getTime() > endDateTime.getTime()){
$('#add_show_end_date_no_repeat').css('background-color', '#F49C9C');
$('#add_show_end_time').css('background-color', '#F49C9C');
}else{
$('#add_show_end_date_no_repeat').css('background-color', '');
$('#add_show_end_time').css('background-color', '');
}
// calculate duration
var startDateTimeString = startDateString + " " + startTimeString;
var endDateTimeString = endDateString + " " + endTimeString;
calculateDuration(startDateTimeString, endDateTimeString);
}
});
if($('#cb_custom_auth').attr('checked')){