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

This commit is contained in:
denise 2013-10-11 13:22:12 -04:00
commit 9fa2f010b4
2 changed files with 38 additions and 21 deletions

View File

@ -575,26 +575,38 @@ class Application_Service_HistoryService
$instanceEnd = $showInstance->getDbEnds(null); $instanceEnd = $showInstance->getDbEnds(null);
$itemEnd = $item->getDbEnds(null); $itemEnd = $item->getDbEnds(null);
$recordStart = $item->getDbStarts(null);
$recordEnd = ($instanceEnd < $itemEnd) ? $instanceEnd : $itemEnd; $recordEnd = ($instanceEnd < $itemEnd) ? $instanceEnd : $itemEnd;
$history = new CcPlayoutHistory(); //first check if this is a duplicate
$history->setDbFileId($fileId); // (caused by restarting liquidsoap)
$history->setDbStarts($item->getDbStarts(null));
$history->setDbEnds($recordEnd); $prevRecord = CcPlayoutHistoryQuery::create()
$history->setDbInstanceId($item->getDbInstanceId()); ->filterByDbStarts($recordStart)
->filterByDbEnds($recordEnd)
foreach ($metadata as $key => $val) { ->filterByDbFileId($fileId)
$meta = new CcPlayoutHistoryMetaData(); ->findOne($this->con);
$meta->setDbKey($key);
$meta->setDbValue($val); if (empty($prevRecord)) {
$history->addCcPlayoutHistoryMetaData($meta); $history = new CcPlayoutHistory();
} $history->setDbFileId($fileId);
$history->setDbStarts($recordStart);
$history->save($this->con); $history->setDbEnds($recordEnd);
} $history->setDbInstanceId($item->getDbInstanceId());
$this->con->commit(); foreach ($metadata as $key => $val) {
$meta = new CcPlayoutHistoryMetaData();
$meta->setDbKey($key);
$meta->setDbValue($val);
$history->addCcPlayoutHistoryMetaData($meta);
}
$history->save($this->con);
$this->con->commit();
}
}
} }
catch (Exception $e) { catch (Exception $e) {
$this->con->rollback(); $this->con->rollback();

View File

@ -13,8 +13,13 @@ var AIRTIME = (function(AIRTIME){
var serverTimezoneOffset = 0; var serverTimezoneOffset = 0;
function closeDialogCalendar(event, ui) { function closeDialogCalendar(event, ui) {
//$("#schedule_calendar").fullCalendar( 'refetchEvents' );
$(this).remove(); $el = $(this);
$el.dialog('destroy');
$el.remove();
//need to refetch the events to update scheduled status.
$("#schedule_calendar").fullCalendar( 'refetchEvents' );
} }
function checkShowLength(json) { function checkShowLength(json) {