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

This commit is contained in:
denise 2012-06-07 16:10:04 -04:00
commit 24f4e589a4
3 changed files with 21 additions and 2 deletions

View File

@ -83,7 +83,11 @@ class DashboardController extends Zend_Controller_Action
if($source_connected){
$this->view->error = "You don't have permission to switch source.";
}else{
$this->view->error = "There is no source connected to this input.";
if($sourcename == 'scheduled_play'){
$this->view->error = "You don't have permission to disconnect source.";
}else{
$this->view->error = "There is no source connected to this input.";
}
}
}
}

View File

@ -83,14 +83,16 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
}
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=false) {
public function checkReliantFields($formData, $validateStartDate, $originalStartDate=null) {
$valid = true;
$start_time = $formData['add_show_start_date']." ".$formData['add_show_start_time'];
$end_time = $formData['add_show_end_date_no_repeat']." ".$formData['add_show_end_time'];
//DateTime stores $start_time in the current timezone
$nowDateTime = new DateTime();
$showStartDateTime = new DateTime($start_time);
$showEndDateTime = new DateTime($end_time);
if ($validateStartDate){
if($showStartDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
$this->getElement('add_show_start_time')->setErrors(array('Cannot create show in the past'));
@ -99,6 +101,8 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
// if edit action, check if original show start time is in the past. CC-3864
if($originalStartDate){
if($originalStartDate->getTimestamp() < $nowDateTime->getTimestamp()) {
$this->getElement('add_show_start_time')->setValue($originalStartDate->format("H:i"));
$this->getElement('add_show_start_date')->setValue($originalStartDate->format("Y-m-d"));
$this->getElement('add_show_start_time')->setErrors(array('Cannot modify start date/time of the show that is already started'));
$this->disableStartDateAndTime();
$valid = false;
@ -106,6 +110,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
}
}
// if end time is in the past, return error
if($showEndDateTime->getTimestamp() < $nowDateTime->getTimestamp()) {
$this->getElement('add_show_end_time')->setErrors(array('End date/time cannot be in the past'));
$valid = false;
}
$pattern = '/([0-9][0-9])h ([0-9][0-9])m/';
preg_match($pattern, $formData['add_show_duration'], $matches);
$hours = $matches[1];

View File

@ -39,6 +39,11 @@ function openAudioPreview(p_event) {
}
function open_audio_preview(audioFileID, audioFileTitle, audioFileArtist) {
// we need to remove soundcloud icon from audioFileTitle
var index = audioFileTitle.indexOf("<span class=");
if(index != -1){
audioFileTitle = audioFileTitle.substring(0,index);
}
openPreviewWindow('audiopreview/audio-preview/audioFileID/'+audioFileID+'/audioFileArtist/'+audioFileArtist+'/audioFileTitle/'+audioFileTitle);
_preview_window.focus();
}