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"> <div class="media_type_selector" data-selection-id="1">
<a href="/showbuilder#"><i class='icon-home icon-white'></i><?php echo _("Dashboard") ?></a></div> <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"> <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"> <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> <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"> <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"> <div class="personal-block solo">
<ol> <ol>
<li> <li>
<span class="trial-box-button"><a title="Billing" href=<?php echo $baseUrl . 'billing/upgrade'?>>Upgrade</a></span>&nbsp; <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 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> | <a href=<?php echo $baseUrl . "/login/logout"?>><?php echo _("Logout")?></a>
</li> </li>
</ol> </ol>
</div> </div>

View File

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

View File

@ -57,7 +57,7 @@
<div class="personal-block solo"> <div class="personal-block solo">
<ol> <ol>
<li> <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> | <a href=<?php echo $this->baseUrl . "/login/logout"?>><?php echo _("Logout")?></a>
</li> </li>
</ol> </ol>

View File

@ -4,8 +4,8 @@
<div> <div>
<div class="media_type_selector dashboard_sub_nav" data-selection-id="1"> <div class="media_type_selector dashboard_sub_nav" data-selection-id="1">
<a href="#files"> <a href="#files">
<i class='icon-file icon-white'></i> <i class='icon-music icon-white'></i>
<span class="selector-name hidden"><?php echo _("Files") ?></span> <span class="selector-name hidden"><?php echo _("Tracks") ?></span>
</a> </a>
</div> </div>
<div class="media_type_selector dashboard_sub_nav" data-selection-id="2"> <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 //Re-enable the delete button
AIRTIME.button.enableButton("btn-group #sb-trash", false); AIRTIME.button.enableButton("btn-group #sb-trash", false);
}); });
mod.selectNone();
}; };
mod.fnDeleteSelectedItems = function() { mod.fnDeleteSelectedItems = function() {
@ -432,13 +433,14 @@ var AIRTIME = (function(AIRTIME) {
// close the object (playlist/block/webstream) // close the object (playlist/block/webstream)
// on the right side if it was just deleted // on the right side if it was just deleted
// from the library // from the library
if (closeObj) {
$.post(baseUrl+"playlist/close-playlist", //if (closeObj) {
{"format": "json", "type": currentObjType}, // $.post(baseUrl+"playlist/close-playlist",
function(json) { // {"format": "json", "type": currentObjType},
$("#editor_pane_wrapper").empty().append(json.html); // function(json) {
}); // $("#editor_pane_wrapper").empty().append(json.html);
} // });
//}
} }
}; };

View File

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