Merge branch 'saas-showbuilder' of https://github.com/sourcefabric/Airtime into saas-showbuilder

This commit is contained in:
drigato 2015-08-25 12:43:15 -04:00
commit a41793666d
7 changed files with 40 additions and 51 deletions

View File

@ -76,7 +76,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
<div class="media_type_selector" data-selection-id="1">
<a href="/showbuilder#"><i class='icon-home icon-white'></i><?php echo _("Dashboard") ?></a></div>
<div class="media_type_selector dashboard_sub_nav" data-selection-id="1">
<a href="/showbuilder#files"><i class='icon-file icon-white'></i><?php echo _("Files") ?></a></div>
<a href="/showbuilder#files"><i class='icon-music icon-white'></i><?php echo _("Tracks") ?></a></div>
<div class="media_type_selector dashboard_sub_nav" data-selection-id="2">
<a href="/showbuilder#playlists"><i class='icon-list icon-white'></i><?php echo _("Playlists") ?></a></div>
<div class="media_type_selector dashboard_sub_nav" data-selection-id="3">

View File

@ -61,9 +61,9 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
<div class="personal-block solo">
<ol>
<li>
<span class="trial-box-button"><a title="Billing" href=<?php echo $baseUrl . 'billing/upgrade'?>>Upgrade</a></span>&nbsp;
<a id="current-user" href=<?php echo $baseUrl . "user/edit-user"?>><span class="name"><?php echo $this->escape($this->loggedInAs()); ?></span></a>
| <a href=<?php echo $baseUrl . "login/logout"?>><?php echo _("Logout")?></a>
<span class="trial-box-button"><a title="Billing" href=<?php echo $baseUrl . '/billing/upgrade'?>>Upgrade</a></span>&nbsp;
<a id="current-user" href=<?php echo $baseUrl . "/user/edit-user"?>><span class="name"><?php echo $this->escape($this->loggedInAs()); ?></span></a>
| <a href=<?php echo $baseUrl . "/login/logout"?>><?php echo _("Logout")?></a>
</li>
</ol>
</div>

View File

@ -412,6 +412,8 @@ class Application_Model_Scheduler
private function findNextStartTime($DT, $instanceId)
{
// TODO: there is at least one case where this function creates a filler block with
// an incorrect length; should keep an eye on it
$sEpoch = $DT->format("U.u");
$nEpoch = $this->epochNow;
@ -450,73 +452,58 @@ class Application_Model_Scheduler
private function calculateCrossfades($instanceId)
{
Logging::info("adjusting start, end times of scheduled items to account for crossfades show instance #".$instanceId);
$sql = "SELECT * FROM cc_show_instances ".
"WHERE id = {$instanceId}";
$instance = Application_Common_Database::prepareAndExecute(
$sql, array(), Application_Common_Database::SINGLE);
$instance = CcShowInstancesQuery::create()->findPk($instanceId);
if (is_null($instance)) {
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
}
$itemStartDT = new DateTime($instance["starts"], new DateTimeZone("UTC"));
$itemEndDT = null;
$schedule_sql = "SELECT * FROM cc_schedule ".
"WHERE instance_id = {$instanceId} ".
"ORDER BY starts";
$schedule = Application_Common_Database::prepareAndExecute($schedule_sql);
$schedule = CcScheduleQuery::create()
->filterByDbInstanceId($instanceId)
->orderByDbStarts()
->find($this->con);
$itemStartDT = $instance->getDbStarts(null);
foreach ($schedule as $item) {
$itemEndDT = $this->findEndTime($itemStartDT, $item["clip_length"]);
$update_sql = "UPDATE cc_schedule SET ".
"starts = '{$itemStartDT->format(DEFAULT_MICROTIME_FORMAT)}', ".
"ends = '{$itemEndDT->format(DEFAULT_MICROTIME_FORMAT)}' ".
"WHERE id = {$item["id"]}";
Application_Common_Database::prepareAndExecute(
$update_sql, array(), Application_Common_Database::EXECUTE);
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
Logging::info($itemEndDT);
$item->setDbStarts($itemStartDT)
->setDbEnds($itemEndDT)
->save($this->con);
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
}
}
/*
* @param int $showInstance
* @param array $exclude
* ids of sched items to remove from the calulation.
* This function squeezes all items of a show together so that
* there are no gaps between them.
*/
* @param array $exclude
* ids of sched items to remove from the calculation.
* This function squeezes all items of a show together so that
* there are no gaps between them.
*/
public function removeGaps($showInstance, $exclude=null)
{
Logging::info("removing gaps from show instance #".$showInstance);
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
$instance = CcShowInstancesQuery::create()->findPk($showInstance, $this->con);
if (is_null($instance)) {
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
}
$itemStartDT = $instance->getDbStarts(null);
$schedule = CcScheduleQuery::create()
->filterByDbInstanceId($showInstance)
->filterByDbId($exclude, Criteria::NOT_IN)
->orderByDbStarts()
->find($this->con);
$itemStartDT = $instance->getDbStarts(null);
foreach ($schedule as $item) {
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
$item->setDbStarts($itemStartDT)
->setDbEnds($itemEndDT);
$itemStartDT = $itemEndDT;
->setDbEnds($itemEndDT)
->save($this->con);
$itemStartDT = $this->findTimeDifference($itemEndDT, $this->crossfadeDuration);
}
$schedule->save($this->con);
}
/**

View File

@ -57,7 +57,7 @@
<div class="personal-block solo">
<ol>
<li>
<a id="current-user" href=<?php echo $this->baseUrl . "user/edit-user"?>><span class="name"><?php echo $this->escape($this->loggedInAs()); ?></span></a>
<a id="current-user" href=<?php echo $this->baseUrl . "/user/edit-user"?>><span class="name"><?php echo $this->escape($this->loggedInAs()); ?></span></a>
| <a href=<?php echo $this->baseUrl . "/login/logout"?>><?php echo _("Logout")?></a>
</li>
</ol>

View File

@ -4,8 +4,8 @@
<div>
<div class="media_type_selector dashboard_sub_nav" data-selection-id="1">
<a href="#files">
<i class='icon-file icon-white'></i>
<span class="selector-name hidden"><?php echo _("Files") ?></span>
<i class='icon-music icon-white'></i>
<span class="selector-name hidden"><?php echo _("Tracks") ?></span>
</a>
</div>
<div class="media_type_selector dashboard_sub_nav" data-selection-id="2">

View File

@ -403,6 +403,7 @@ var AIRTIME = (function(AIRTIME) {
//Re-enable the delete button
AIRTIME.button.enableButton("btn-group #sb-trash", false);
});
mod.selectNone();
};
mod.fnDeleteSelectedItems = function() {
@ -432,13 +433,14 @@ var AIRTIME = (function(AIRTIME) {
// close the object (playlist/block/webstream)
// on the right side if it was just deleted
// from the library
if (closeObj) {
$.post(baseUrl+"playlist/close-playlist",
{"format": "json", "type": currentObjType},
function(json) {
$("#editor_pane_wrapper").empty().append(json.html);
});
}
//if (closeObj) {
// $.post(baseUrl+"playlist/close-playlist",
// {"format": "json", "type": currentObjType},
// function(json) {
// $("#editor_pane_wrapper").empty().append(json.html);
// });
//}
}
};

View File

@ -342,9 +342,9 @@ var AIRTIME = (function(AIRTIME){
};
mod.fnRemove = function(aItems) {
mod.disableUI();
if (confirm($.i18n._("Delete selected item(s)?"))) {
mod.selectNone();
$.post( baseUrl+"showbuilder/schedule-remove",
{"items": aItems, "format": "json"},
mod.fnItemCallback