Merge branch 'master' of dev.sourcefabric.org:airtime
This commit is contained in:
commit
da46757e28
10 changed files with 169 additions and 77 deletions
|
@ -632,7 +632,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$all = $request->getParam('all');
|
$all = $request->getParam('all');
|
||||||
|
|
||||||
$this->view->files =
|
$this->view->files =
|
||||||
Application_Model_StoredFile::listAllFiles($dir_id,$all);
|
Application_Model_StoredFile::listAllFiles($dir_id, $all);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function listAllWatchedDirsAction()
|
public function listAllWatchedDirsAction()
|
||||||
|
@ -800,7 +800,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
$watchDir = Application_Model_MusicDir::getDirByPath($rd);
|
||||||
// get all the files that is under $dirPath
|
// get all the files that is under $dirPath
|
||||||
$files = Application_Model_StoredFile::listAllFiles(
|
$files = Application_Model_StoredFile::listAllFiles(
|
||||||
$dir->getId(),$all=false, true);
|
$dir->getId(),$all=false);
|
||||||
foreach ($files as $f) {
|
foreach ($files as $f) {
|
||||||
// if the file is from this mount
|
// if the file is from this mount
|
||||||
if (substr($f->getFilePath(), 0, strlen($rd)) === $rd) {
|
if (substr($f->getFilePath(), 0, strlen($rd)) === $rd) {
|
||||||
|
|
|
@ -195,7 +195,7 @@ SQL;
|
||||||
|
|
||||||
$exist_dir = self::getDirByPath($p_path);
|
$exist_dir = self::getDirByPath($p_path);
|
||||||
|
|
||||||
if ($exist_dir == NULL) {
|
if (is_null($exist_dir)) {
|
||||||
$temp_dir = new CcMusicDirs();
|
$temp_dir = new CcMusicDirs();
|
||||||
$dir = new Application_Model_MusicDir($temp_dir);
|
$dir = new Application_Model_MusicDir($temp_dir);
|
||||||
} else {
|
} else {
|
||||||
|
@ -228,7 +228,12 @@ SQL;
|
||||||
return array("code"=>1, "error"=>"$msg");
|
return array("code"=>1, "error"=>"$msg");
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
return array("code"=>1,
|
return array("code"=>1,
|
||||||
"error"=>sprintf(_("%s is already set as the current storage dir or in the watched folders list"), $p_path));
|
"error" => sprintf(
|
||||||
|
_("%s is already set as the current storage dir or in the".
|
||||||
|
" watched folders list"),
|
||||||
|
$p_path
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,15 +438,12 @@ class Application_Model_Scheduler
|
||||||
->find($this->con);
|
->find($this->con);
|
||||||
|
|
||||||
foreach ($schedule as $item) {
|
foreach ($schedule as $item) {
|
||||||
|
|
||||||
$itemEndDT = $item->getDbEnds(null);
|
|
||||||
|
|
||||||
$item
|
|
||||||
->setDbStarts($itemStartDT)
|
|
||||||
->setDbEnds($itemEndDT);
|
|
||||||
|
|
||||||
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
|
|
||||||
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
|
||||||
|
|
||||||
|
$item->setDbStarts($itemStartDT)
|
||||||
|
->setDbEnds($itemEndDT);
|
||||||
|
|
||||||
|
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
$schedule->save($this->con);
|
$schedule->save($this->con);
|
||||||
|
|
|
@ -1071,7 +1071,7 @@ SQL;
|
||||||
* @param $dir_id - if this is not provided, it returns all files with full
|
* @param $dir_id - if this is not provided, it returns all files with full
|
||||||
* path constructed.
|
* path constructed.
|
||||||
*/
|
*/
|
||||||
public static function listAllFiles($dir_id=null, $all)
|
public static function listAllFiles($dir_id=null, $all=true)
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
|
@ -1081,10 +1081,6 @@ FROM CC_FILES AS f
|
||||||
WHERE f.directory = :dir_id
|
WHERE f.directory = :dir_id
|
||||||
SQL;
|
SQL;
|
||||||
|
|
||||||
# TODO : the option $all is deprecated now and is always true.
|
|
||||||
# refactor code where it's still being passed
|
|
||||||
$all = true;
|
|
||||||
|
|
||||||
if (!$all) {
|
if (!$all) {
|
||||||
$sql .= " AND f.file_exists = 'TRUE'";
|
$sql .= " AND f.file_exists = 'TRUE'";
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,71 +145,114 @@ class Application_Service_SchedulerService
|
||||||
return $dt;
|
return $dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function fillLinkedShows($ccShow)
|
public static function fillNewLinkedInstances($ccShow)
|
||||||
{
|
{
|
||||||
if ($ccShow->isLinked()) {
|
/* First check if any linked instances have content
|
||||||
/* First check if any linked instances have content
|
* If all instances are empty then we don't need to fill
|
||||||
* If all instances are empty then we don't need to fill
|
* any other instances with content
|
||||||
* any other instances with content
|
*/
|
||||||
|
$instanceIds = $ccShow->getInstanceIds();
|
||||||
|
$ccSchedules = CcScheduleQuery::create()
|
||||||
|
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
||||||
|
->find();
|
||||||
|
if (!$ccSchedules->isEmpty()) {
|
||||||
|
/* Find the show contents of just one of the instances. It doesn't
|
||||||
|
* matter which instance we use since all the content is the same
|
||||||
*/
|
*/
|
||||||
$instanceIds = $ccShow->getInstanceIds();
|
$ccSchedule = $ccSchedules->getFirst();
|
||||||
$ccSchedules = CcScheduleQuery::create()
|
$showStamp = CcScheduleQuery::create()
|
||||||
->filterByDbInstanceId($instanceIds, Criteria::IN)
|
->filterByDbInstanceId($ccSchedule->getDbInstanceId())
|
||||||
|
->orderByDbStarts()
|
||||||
->find();
|
->find();
|
||||||
if (!$ccSchedules->isEmpty()) {
|
|
||||||
/* Find the show contents of just one of the instances. It doesn't
|
//get time_filled so we can update cc_show_instances
|
||||||
* matter which instance we use since all the content is the same
|
$timeFilled = $ccSchedule->getCcShowInstances()->getDbTimeFilled();
|
||||||
*/
|
|
||||||
$ccSchedule = $ccSchedules->getFirst();
|
//need to find out which linked instances are empty
|
||||||
$showStamp = CcScheduleQuery::create()
|
foreach ($ccShow->getCcShowInstancess() as $ccShowInstance) {
|
||||||
->filterByDbInstanceId($ccSchedule->getDbInstanceId())
|
$ccSchedules = CcScheduleQuery::create()
|
||||||
->orderByDbStarts()
|
->filterByDbInstanceId($ccShowInstance->getDbId())
|
||||||
->find();
|
->find();
|
||||||
|
/* If the show instance is empty OR it has different content than
|
||||||
|
* the first instance, we cant to fill/replace with the show stamp
|
||||||
|
* (The show stamp is taken from the first show instance's content)
|
||||||
|
*/
|
||||||
|
if ($ccSchedules->isEmpty() ||
|
||||||
|
self::replaceInstanceContentCheck($ccShowInstance, $showStamp)) {
|
||||||
|
|
||||||
//get time_filled so we can update cc_show_instances
|
$nextStartDT = $ccShowInstance->getDbStarts(null);
|
||||||
$timeFilled = $ccSchedule->getCcShowInstances()->getDbTimeFilled();
|
|
||||||
|
|
||||||
//need to find out which linked instances are empty
|
foreach ($showStamp as $item) {
|
||||||
foreach ($ccShow->getCcShowInstancess() as $ccShowInstance) {
|
$endTimeDT = self::findEndTime($nextStartDT, $item->getDbClipLength());
|
||||||
$ccSchedules = CcScheduleQuery::create()
|
|
||||||
->filterByDbInstanceId($ccShowInstance->getDbId())
|
|
||||||
->find();
|
|
||||||
/* If the show instance is empty OR it has different content than
|
|
||||||
* the first instance, we cant to fill/replace with the show stamp
|
|
||||||
* (The show stamp is taken from the first show instance's content)
|
|
||||||
*/
|
|
||||||
if ($ccSchedules->isEmpty() || self::replaceInstanceContentCheck($ccShowInstance, $showStamp)) {
|
|
||||||
$nextStartDT = $ccShowInstance->getDbStarts(null);
|
|
||||||
|
|
||||||
foreach ($showStamp as $item) {
|
$ccSchedule = new CcSchedule();
|
||||||
$endTimeDT = self::findEndTime($nextStartDT, $item->getDbClipLength());
|
$ccSchedule
|
||||||
|
->setDbStarts($nextStartDT)
|
||||||
$ccSchedule = new CcSchedule();
|
->setDbEnds($endTimeDT)
|
||||||
$ccSchedule
|
->setDbFileId($item->getDbFileId())
|
||||||
->setDbStarts($nextStartDT)
|
->setDbStreamId($item->getDbStreamId())
|
||||||
->setDbEnds($endTimeDT)
|
->setDbClipLength($item->getDbClipLength())
|
||||||
->setDbFileId($item->getDbFileId())
|
->setDbFadeIn($item->getDbFadeIn())
|
||||||
->setDbStreamId($item->getDbStreamId())
|
->setDbFadeOut($item->getDbFadeOut())
|
||||||
->setDbClipLength($item->getDbClipLength())
|
->setDbCuein($item->getDbCueIn())
|
||||||
->setDbFadeIn($item->getDbFadeIn())
|
->setDbCueOut($item->getDbCueOut())
|
||||||
->setDbFadeOut($item->getDbFadeOut())
|
->setDbInstanceId($ccShowInstance->getDbId())
|
||||||
->setDbCuein($item->getDbCueIn())
|
->setDbPosition($item->getDbPosition())
|
||||||
->setDbCueOut($item->getDbCueOut())
|
|
||||||
->setDbInstanceId($ccShowInstance->getDbId())
|
|
||||||
->setDbPosition($item->getDbPosition())
|
|
||||||
->save();
|
|
||||||
|
|
||||||
$nextStartDT = $endTimeDT;
|
|
||||||
} //foreach show item
|
|
||||||
|
|
||||||
//update time_filled in cc_show_instances
|
|
||||||
$ccShowInstance
|
|
||||||
->setDbTimeFilled($timeFilled)
|
|
||||||
->setDbLastScheduled(gmdate("Y-m-d H:i:s"))
|
|
||||||
->save();
|
->save();
|
||||||
}
|
|
||||||
} //foreach linked instance
|
$nextStartDT = $endTimeDT;
|
||||||
} //if at least one linked instance has content
|
} //foreach show item
|
||||||
|
|
||||||
|
//update time_filled in cc_show_instances
|
||||||
|
$ccShowInstance
|
||||||
|
->setDbTimeFilled($timeFilled)
|
||||||
|
->setDbLastScheduled(gmdate("Y-m-d H:i:s"))
|
||||||
|
->save();
|
||||||
|
}
|
||||||
|
} //foreach linked instance
|
||||||
|
} //if at least one linked instance has content
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function fillPreservedLinkedShowContent($ccShow, $showStamp)
|
||||||
|
{
|
||||||
|
$item = $showStamp->getFirst();
|
||||||
|
$timeFilled = $item->getCcShowInstances()->getDbTimeFilled();
|
||||||
|
|
||||||
|
foreach ($ccShow->getCcShowInstancess() as $ccShowInstance) {
|
||||||
|
$ccSchedules = CcScheduleQuery::create()
|
||||||
|
->filterByDbInstanceId($ccShowInstance->getDbId())
|
||||||
|
->find();
|
||||||
|
|
||||||
|
if ($ccSchedules->isEmpty()) {
|
||||||
|
|
||||||
|
$nextStartDT = $ccShowInstance->getDbStarts(null);
|
||||||
|
|
||||||
|
foreach ($showStamp as $item) {
|
||||||
|
$endTimeDT = self::findEndTime($nextStartDT, $item->getDbClipLength());
|
||||||
|
|
||||||
|
$ccSchedule = new CcSchedule();
|
||||||
|
$ccSchedule
|
||||||
|
->setDbStarts($nextStartDT)
|
||||||
|
->setDbEnds($endTimeDT)
|
||||||
|
->setDbFileId($item->getDbFileId())
|
||||||
|
->setDbStreamId($item->getDbStreamId())
|
||||||
|
->setDbClipLength($item->getDbClipLength())
|
||||||
|
->setDbFadeIn($item->getDbFadeIn())
|
||||||
|
->setDbFadeOut($item->getDbFadeOut())
|
||||||
|
->setDbCuein($item->getDbCueIn())
|
||||||
|
->setDbCueOut($item->getDbCueOut())
|
||||||
|
->setDbInstanceId($ccShowInstance->getDbId())
|
||||||
|
->setDbPosition($item->getDbPosition())
|
||||||
|
->save();
|
||||||
|
|
||||||
|
$nextStartDT = $endTimeDT;
|
||||||
|
} //foreach show item
|
||||||
|
|
||||||
|
$ccShowInstance
|
||||||
|
->setDbTimeFilled($timeFilled)
|
||||||
|
->setDbLastScheduled(gmdate("Y-m-d H:i:s"))
|
||||||
|
->save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ class Application_Service_ShowService
|
||||||
private $isRebroadcast;
|
private $isRebroadcast;
|
||||||
private $repeatType;
|
private $repeatType;
|
||||||
private $isUpdate;
|
private $isUpdate;
|
||||||
|
private $linkedShowContent;
|
||||||
|
|
||||||
public function __construct($showId=null, $showData=null, $isUpdate=false)
|
public function __construct($showId=null, $showData=null, $isUpdate=false)
|
||||||
{
|
{
|
||||||
|
@ -217,10 +218,16 @@ class Application_Service_ShowService
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->ccShow) && ($this->isUpdate || $fillInstances)) {
|
if (isset($this->ccShow) && ($this->isUpdate || $fillInstances) &&
|
||||||
Application_Service_SchedulerService::fillLinkedShows(
|
$this->ccShow->isLinked()) {
|
||||||
$this->ccShow);
|
Application_Service_SchedulerService::fillNewLinkedInstances($this->ccShow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($this->linkedShowContent)) {
|
||||||
|
Application_Service_SchedulerService::fillPreservedLinkedShowContent(
|
||||||
|
$this->ccShow, $this->linkedShowContent);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->ccShow;
|
return $this->ccShow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,6 +386,9 @@ SQL;
|
||||||
if (count($daysRemoved) > 0) {
|
if (count($daysRemoved) > 0) {
|
||||||
//delete repeating show instances for the repeating
|
//delete repeating show instances for the repeating
|
||||||
//days that were removed
|
//days that were removed
|
||||||
|
if ($this->ccShow->isLinked()) {
|
||||||
|
$this->preserveLinkedShowContent();
|
||||||
|
}
|
||||||
$this->deleteRemovedShowDayInstances($daysRemoved,
|
$this->deleteRemovedShowDayInstances($daysRemoved,
|
||||||
$ccShowDays, $showId);
|
$ccShowDays, $showId);
|
||||||
}
|
}
|
||||||
|
@ -423,6 +433,22 @@ SQL;
|
||||||
return $daysAdded;
|
return $daysAdded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function preserveLinkedShowContent()
|
||||||
|
{
|
||||||
|
/* Get show content from any linekd instance. It doesn't
|
||||||
|
* matter which instance since content is the same in all.
|
||||||
|
*/
|
||||||
|
$ccShowInstance = $this->ccShow->getCcShowInstancess()->getFirst();
|
||||||
|
|
||||||
|
$ccSchedules = CcScheduleQuery::create()
|
||||||
|
->filterByDbInstanceId($ccShowInstance->getDbId())
|
||||||
|
->find();
|
||||||
|
|
||||||
|
if (!$ccSchedules->isEmpty()) {
|
||||||
|
$this->linkedShowContent = $ccSchedules;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getRepeatingEndDate()
|
public function getRepeatingEndDate()
|
||||||
{
|
{
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
|
|
|
@ -773,6 +773,9 @@ var AIRTIME = (function(AIRTIME) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//sort by title, by default
|
||||||
|
oTable.fnSort( [ [5, 'asc'] ] );
|
||||||
|
|
||||||
setColumnFilter(oTable);
|
setColumnFilter(oTable);
|
||||||
oTable.fnSetFilteringDelay(350);
|
oTable.fnSetFilteringDelay(350);
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,9 @@ $(document).ready(function() {
|
||||||
$.cookie("default_airtime_locale", $('#locale').val(), {path: '/'});
|
$.cookie("default_airtime_locale", $('#locale').val(), {path: '/'});
|
||||||
setTimeout(removeSuccessMsg, 5000);
|
setTimeout(removeSuccessMsg, 5000);
|
||||||
showErrorSections();
|
showErrorSections();
|
||||||
|
setMailServerInputReadonly();
|
||||||
|
setConfigureMailServerListener();
|
||||||
|
setEnableSystemEmailsListener();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -187,6 +187,13 @@ function setAddShowEvents() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
form.find("#add_show_linked").click(function(){
|
||||||
|
if (!$(this).attr("checked")) {
|
||||||
|
$(this).parent().after("<ul class='errors'><li>Warning: Shows cannot be re-linked</li></ul>");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
form.find("#add_show_record").click(function(){
|
form.find("#add_show_record").click(function(){
|
||||||
$(this).blur();
|
$(this).blur();
|
||||||
form.find("#add_show_rebroadcast").toggle();
|
form.find("#add_show_rebroadcast").toggle();
|
||||||
|
|
|
@ -283,6 +283,12 @@ function eventRender(event, element, view) {
|
||||||
.find(".fc-event-time")
|
.find(".fc-event-time")
|
||||||
.before('<span id="'+event.id+'" class="small-icon show-partial-filled"></span>');
|
.before('<span id="'+event.id+'" class="small-icon show-partial-filled"></span>');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (event.linked) {
|
||||||
|
$(element)
|
||||||
|
.find(".fc-event-time")
|
||||||
|
.before('<span id="'+event.id+'" class="small-icon linked"></span>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (view.name === 'month') {
|
} else if (view.name === 'month') {
|
||||||
if (event.show_empty === 1) {
|
if (event.show_empty === 1) {
|
||||||
|
@ -305,6 +311,12 @@ function eventRender(event, element, view) {
|
||||||
.find(".fc-event-title")
|
.find(".fc-event-title")
|
||||||
.after('<span id="'+event.id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
|
.after('<span id="'+event.id+'" title="'+$.i18n._("Show is partially filled")+'" class="small-icon show-partial-filled"></span>');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (event.linked) {
|
||||||
|
$(element)
|
||||||
|
.find(".fc-event-title")
|
||||||
|
.after('<span id="'+event.id+'" class="small-icon linked"></span>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue