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

This commit is contained in:
Martin Konecny 2012-06-28 15:29:52 -04:00
commit a322e4678e
4 changed files with 106 additions and 117 deletions

View file

@ -41,7 +41,7 @@ class LibraryController extends Zend_Controller_Action
$user = new Application_Model_User($userInfo->id); $user = new Application_Model_User($userInfo->id);
//Open a jPlayer window and play the audio clip. //Open a jPlayer window and play the audio clip.
$menu["play"] = array("name"=> "Play", "icon" => "play"); $menu["play"] = array("name"=> "Preview", "icon" => "play");
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));

View file

@ -327,7 +327,10 @@ class Application_Model_StoredFile {
throw new DeleteScheduledFileException(); throw new DeleteScheduledFileException();
} }
if (file_exists($filepath)) { $music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
$type = $music_dir->getType();
if (file_exists($filepath) && $type == "stor") {
$data = array("filepath" => $filepath, "delete" => 1); $data = array("filepath" => $filepath, "delete" => 1);
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data); Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
} }

View file

@ -1,6 +1,6 @@
/** /**
* *
* Full Calendar callback methods. * Full Calendar callback methods.
* *
*/ */
@ -9,12 +9,12 @@ function scheduleRefetchEvents(json) {
alert("The show instance doesn't exist anymore!"); alert("The show instance doesn't exist anymore!");
} }
if(json.show_id) { if(json.show_id) {
var dialog_id = parseInt($("#add_show_id").val(), 10); var dialog_id = parseInt($("#add_show_id").val(), 10);
//if you've deleted the show you are currently editing, close the add show dialog. //if you've deleted the show you are currently editing, close the add show dialog.
if (dialog_id === json.show_id) { if (dialog_id === json.show_id) {
$("#add-show-close").click(); $("#add-show-close").click();
} }
} }
$("#schedule_calendar").fullCalendar( 'refetchEvents' ); $("#schedule_calendar").fullCalendar( 'refetchEvents' );
} }
@ -31,9 +31,9 @@ function openAddShowForm() {
$("#schedule_calendar").fullCalendar('render'); $("#schedule_calendar").fullCalendar('render');
} }
$("#schedule-show-what").show(0, function(){ $("#schedule-show-what").show(0, function(){
$add_show_name = $("#add_show_name"); $add_show_name = $("#add_show_name");
$add_show_name.focus(); $add_show_name.focus();
$add_show_name.select(); $add_show_name.select();
}); });
} }
} }
@ -59,16 +59,16 @@ function removeAddShowButton(){
} }
function makeTimeStamp(date){ function makeTimeStamp(date){
var sy, sm, sd, h, m, s, timestamp; var sy, sm, sd, h, m, s, timestamp;
sy = date.getFullYear(); sy = date.getFullYear();
sm = date.getMonth() + 1; sm = date.getMonth() + 1;
sd = date.getDate(); sd = date.getDate();
h = date.getHours(); h = date.getHours();
m = date.getMinutes(); m = date.getMinutes();
s = date.getSeconds(); s = date.getSeconds();
timestamp = sy+"-"+ pad(sm, 2) +"-"+ pad(sd, 2) +" "+ pad(h, 2) +":"+ pad(m, 2) +":"+ pad(s, 2); timestamp = sy+"-"+ pad(sm, 2) +"-"+ pad(sd, 2) +" "+ pad(h, 2) +":"+ pad(m, 2) +":"+ pad(s, 2);
return timestamp; return timestamp;
} }
function dayClick(date, allDay, jsEvent, view){ function dayClick(date, allDay, jsEvent, view){
@ -176,7 +176,7 @@ function viewDisplay( view ) {
//save slotMin value to db //save slotMin value to db
var url = '/Schedule/set-time-interval/format/json'; var url = '/Schedule/set-time-interval/format/json';
$.post(url, {timeInterval: slotMin}); $.post(url, {timeInterval: slotMin});
}); });
var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first"); var topLeft = $(view.element).find("table.fc-agenda-days > thead th:first");
@ -206,71 +206,53 @@ function viewDisplay( view ) {
function eventRender(event, element, view) { function eventRender(event, element, view) {
$(element).data("event", event); $(element).data("event", event);
//only put progress bar on shows that aren't being recorded. //only put progress bar on shows that aren't being recorded.
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) { if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 0) {
var div = $('<div/>'); var div = $('<div/>');
div div
.height('5px') .height('5px')
.width('95%') .width('95%')
.css('margin-top', '1px') .css('margin-top', '1px')
.css('margin-left', 'auto') .css('margin-left', 'auto')
.css('margin-right', 'auto') .css('margin-right', 'auto')
.progressbar({ .progressbar({
value: event.percent value: event.percent
}); });
$(element).find(".fc-event-content").append(div); $(element).find(".fc-event-content").append(div);
} }
//add the record/rebroadcast icons if needed. //add the record/rebroadcast/soundcloud icons if needed
//record icon (only if not on soundcloud, will always be true for future events)
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -1) { if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -1) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span>');
} else if ((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id > 0) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon soundcloud"></span>');
} else if ((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -2) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon progress"></span>');
} else if ((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.record === 1 && event.soundcloud_id === -3) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon sc-error"></span>');
}
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon recording"></span>');
}
if(view.name === 'month' && event.record === 1 && event.soundcloud_id === -1) { if(view.name === 'month' && event.record === 1 && event.soundcloud_id === -1) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span>');
} else if (view.name === 'month' && event.record === 1 && event.soundcloud_id > 0) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon soundcloud"></span>');
} else if (view.name === 'month' && event.record === 1 && event.soundcloud_id === -2) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon progress"></span>');
} else if (view.name === 'month' && event.record === 1 && event.soundcloud_id === -3) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span><span id="'+event.id+'" class="small-icon sc-error"></span>');
}
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon recording"></span>');
}
//rebroadcast icon //rebroadcast icon
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.rebroadcast === 1) { if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.rebroadcast === 1) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon rebroadcast"></span>'); $(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon rebroadcast"></span>');
} }
if(view.name === 'month' && event.rebroadcast === 1) { if(view.name === 'month' && event.rebroadcast === 1) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon rebroadcast"></span>'); $(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon rebroadcast"></span>');
}
//soundcloud icon
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id > 0 && event.record === 1) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon soundcloud"></span>');
}
if(view.name === 'month' && event.soundcloud_id > 0 && event.record === 1) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon soundcloud"></span>');
}
//progress icon
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id === -2 && event.record === 1) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon progress"></span>');
}
if(view.name === 'month' && event.soundcloud_id === -2 && event.record === 1) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon progress"></span>');
}
//error icon
if((view.name === 'agendaDay' || view.name === 'agendaWeek') && event.soundcloud_id === -3 && event.record === 1) {
$(element).find(".fc-event-time").before('<span id="'+event.id+'" class="small-icon sc-error"></span>');
}
if(view.name === 'month' && event.soundcloud_id === -3 && event.record === 1) {
$(element).find(".fc-event-title").after('<span id="'+event.id+'" class="small-icon sc-error"></span>');
} }
} }
@ -282,56 +264,56 @@ function eventAfterRender( event, element, view ) {
} }
function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) { function eventDrop(event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view) {
var url; var url;
url = '/Schedule/move-show/format/json'; url = '/Schedule/move-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showInstanceId: event.id}, {day: dayDelta, min: minuteDelta, showInstanceId: event.id},
function(json){ function(json){
if(json.show_error == true){ if(json.show_error == true){
alertShowErrorAndReload(); alertShowErrorAndReload();
} }
if(json.error) { if(json.error) {
alert(json.error); alert(json.error);
revertFunc(); revertFunc();
} }
}); });
} }
function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) { function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, view ) {
var url; var url;
url = '/Schedule/resize-show/format/json'; url = '/Schedule/resize-show/format/json';
$.post(url, $.post(url,
{day: dayDelta, min: minuteDelta, showId: event.showId}, {day: dayDelta, min: minuteDelta, showId: event.showId},
function(json){ function(json){
if(json.show_error == true){ if(json.show_error == true){
alertShowErrorAndReload(); alertShowErrorAndReload();
} }
if(json.error) { if(json.error) {
alert(json.error); alert(json.error);
revertFunc(); revertFunc();
} }
scheduleRefetchEvents(json); scheduleRefetchEvents(json);
}); });
} }
function getFullCalendarEvents(start, end, callback) { function getFullCalendarEvents(start, end, callback) {
var url, start_date, end_date; var url, start_date, end_date;
start_date = makeTimeStamp(start); start_date = makeTimeStamp(start);
end_date = makeTimeStamp(end); end_date = makeTimeStamp(end);
url = '/Schedule/event-feed'; url = '/Schedule/event-feed';
var d = new Date(); var d = new Date();
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){ $.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){
callback(json.events); callback(json.events);
}); });
} }
function checkSCUploadStatus(){ function checkSCUploadStatus(){
@ -340,9 +322,9 @@ function checkSCUploadStatus(){
var id = $(this).attr("id"); var id = $(this).attr("id");
$.post(url, {format: "json", id: id, type:"show"}, function(json){ $.post(url, {format: "json", id: id, type:"show"}, function(json){
if(json.sc_id > 0){ if(json.sc_id > 0){
$("span[id="+id+"]").removeClass("progress").addClass("soundcloud"); $("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("soundcloud");
}else if(json.sc_id == "-3"){ }else if(json.sc_id == "-3"){
$("span[id="+id+"]").removeClass("progress").addClass("sc-error"); $("span[id="+id+"]:not(.recording)").removeClass("progress").addClass("sc-error");
} }
}); });
}); });

View file

@ -321,6 +321,10 @@ class AirtimeInstall
$con = Propel::getConnection(); $con = Propel::getConnection();
// we need to run php as commandline because we want to get the timezone in cli php.ini file // we need to run php as commandline because we want to get the timezone in cli php.ini file
$defaultTimezone = exec("php -r 'echo date_default_timezone_get().PHP_EOL;'"); $defaultTimezone = exec("php -r 'echo date_default_timezone_get().PHP_EOL;'");
$defaultTimezone = trim($defaultTimezone);
if((!in_array($defaultTimezone, DateTimeZone::listIdentifiers()))){
$defaultTimezone = "UTC";
}
$sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')"; $sql = "INSERT INTO cc_pref (keystr, valstr) VALUES ('timezone', '$defaultTimezone')";
$result = $con->exec($sql); $result = $con->exec($sql);
if ($result < 1) { if ($result < 1) {