CC-3174 : showbuilder

fixed moving an item to an earlier position in a show,
timeline needs a width or connected list doesn't work.
place holder still has problems with floats.
This commit is contained in:
Naomi Aro 2012-02-06 01:51:22 +01:00
parent 16863ee95e
commit 8212624c4a
6 changed files with 49 additions and 22 deletions

View file

@ -22,7 +22,7 @@
<div class="wrapper"> <div class="wrapper">
<!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist--> <!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist-->
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div> <div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
<div id="show_builder" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->builder ?></div> <div id="show_builder" style="width:500px;" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->builder ?></div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -326,11 +326,11 @@ class Application_Model_Schedule {
JOIN cc_show AS showt ON (showt.id = si.show_id) JOIN cc_show AS showt ON (showt.id = si.show_id)
) )
WHERE si.starts >= '{$p_startDateTime}' AND si.ends <= '{$p_endDateTime}' WHERE si.starts >= '{$p_startDateTime}' AND si.starts <= '{$p_endDateTime}'
ORDER BY si.starts, sched.starts;"; ORDER BY si.starts, sched.starts;";
//Logging::log($sql); Logging::log($sql);
$rows = $CC_DBC->GetAll($sql); $rows = $CC_DBC->GetAll($sql);
return $rows; return $rows;

View file

@ -79,6 +79,14 @@ class Application_Model_Scheduler {
try { try {
//dont want to recalculate times for moved items.
$excludeIds = array();
foreach ($schedFiles as $file) {
if (isset($file["sched_id"])) {
$excludeIds[] = intval($file["sched_id"]);
}
}
foreach ($scheduleItems as $schedule) { foreach ($scheduleItems as $schedule) {
$id = intval($schedule["id"]); $id = intval($schedule["id"]);
@ -104,12 +112,18 @@ class Application_Model_Scheduler {
$instance = intval($schedule["instance"]); $instance = intval($schedule["instance"]);
} }
if ($id !== 0 && $adjustSched === true) { Logging::log("finding items >= {$nextStartDT->format("Y-m-d H:i:s.u")}");
if ($adjustSched === true) {
$followingSchedItems = CcScheduleQuery::create() $followingSchedItems = CcScheduleQuery::create()
->filterByDBStarts($schedItem->getDbStarts("Y-m-d H:i:s.u"), Criteria::GREATER_THAN) ->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)
->filterByDbInstanceId($instance) ->filterByDbInstanceId($instance)
->filterByDbId($excludeIds, Criteria::NOT_IN)
->orderByDbStarts() ->orderByDbStarts()
->find($this->con); ->find($this->con);
foreach ($excludeIds as $id) {
Logging::log("Excluding id {$id}");
}
} }
foreach($schedFiles as $file) { foreach($schedFiles as $file) {
@ -128,6 +142,9 @@ class Application_Model_Scheduler {
else { else {
$sched = new CcSchedule(); $sched = new CcSchedule();
} }
Logging::log("id {$sched->getDbId()}");
Logging::log("start time {$nextStartDT->format("Y-m-d H:i:s.u")}");
Logging::log("end time {$endTimeDT->format("Y-m-d H:i:s.u")}");
$sched->setDbStarts($nextStartDT); $sched->setDbStarts($nextStartDT);
$sched->setDbEnds($endTimeDT); $sched->setDbEnds($endTimeDT);
@ -143,11 +160,13 @@ class Application_Model_Scheduler {
$nextStartDT = $endTimeDT; $nextStartDT = $endTimeDT;
} }
if ($id !== 0 && $adjustSched === true) { if ($adjustSched === true) {
//recalculate the start/end times after the inserted items. //recalculate the start/end times after the inserted items.
foreach($followingSchedItems as $item) { foreach($followingSchedItems as $item) {
Logging::log("adjusting iterm {$item->getDbId()}");
$durationDT = new DateTime("1970-01-01 {$item->getDbClipLength()}", new DateTimeZone("UTC")); $durationDT = new DateTime("1970-01-01 {$item->getDbClipLength()}", new DateTimeZone("UTC"));
$endTimeEpoch = $nextStartDT->format("U") + $durationDT->format("U"); $endTimeEpoch = $nextStartDT->format("U") + $durationDT->format("U");
$endTimeDT = DateTime::createFromFormat("U", $endTimeEpoch, new DateTimeZone("UTC")); $endTimeDT = DateTime::createFromFormat("U", $endTimeEpoch, new DateTimeZone("UTC"));
@ -215,12 +234,14 @@ class Application_Model_Scheduler {
$selected = CcScheduleQuery::create()->findPk($selectedItem[0]["id"]); $selected = CcScheduleQuery::create()->findPk($selectedItem[0]["id"]);
$after = CcScheduleQuery::create()->findPk($afterItem[0]["id"]); $after = CcScheduleQuery::create()->findPk($afterItem[0]["id"]);
if ($origSelIns !== $selected->getDBInstanceId() /*
if (isset($after) && $origSelIns !== $selected->getDBInstanceId()
|| $origAfterIns !== $after->getDBInstanceId()) { || $origAfterIns !== $after->getDBInstanceId()) {
Logging::log("items have been since updated"); Logging::log("items have been since updated");
return; return;
} }
*/
$this->removeGaps($origSelIns, $selected->getDbId()); $this->removeGaps($origSelIns, $selected->getDbId());

View file

@ -12,7 +12,7 @@ class Application_Model_ShowBuilder {
"footer" => false, "footer" => false,
"empty" => false, "empty" => false,
"checkbox" => false, "checkbox" => false,
"id" => "", "id" => 0,
"instance" => "", "instance" => "",
"starts" => "", "starts" => "",
"startsUnix" => null, "startsUnix" => null,
@ -77,11 +77,10 @@ class Application_Model_ShowBuilder {
$row["header"] = true; $row["header"] = true;
$row["starts"] = $showStartDT->format("Y-m-d H:i"); $row["starts"] = $showStartDT->format("Y-m-d H:i");
$row["startsUnix"] = $showStartDT->format("U");
$row["ends"] = $showEndDT->format("Y-m-d H:i"); $row["ends"] = $showEndDT->format("Y-m-d H:i");
$row["endsUnix"] = $showEndDT->format("U");
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U"); $row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
$row["title"] = $p_item["show_name"]; $row["title"] = $p_item["show_name"];
$row["instance"] = intval($p_item["si_id"]);
return $row; return $row;
} }
@ -101,10 +100,7 @@ class Application_Model_ShowBuilder {
$row["id"] = intval($p_item["sched_id"]); $row["id"] = intval($p_item["sched_id"]);
$row["instance"] = intval($p_item["si_id"]); $row["instance"] = intval($p_item["si_id"]);
$row["starts"] = $schedStartDT->format("H:i:s"); $row["starts"] = $schedStartDT->format("H:i:s");
$row["startsUnix"] = $schedStartDT->format("U");
$row["ends"] = $schedEndDT->format("H:i:s"); $row["ends"] = $schedEndDT->format("H:i:s");
$row["endsUnix"] = $schedEndDT->format("U");
$row["duration"] = $schedEndDT->format("U") - $schedStartDT->format("U");
$row["runtime"] = $this->formatDuration($runtime); $row["runtime"] = $this->formatDuration($runtime);
$row["title"] = $p_item["file_track_title"]; $row["title"] = $p_item["file_track_title"];
$row["creator"] = $p_item["file_artist_name"]; $row["creator"] = $p_item["file_artist_name"];

View file

@ -443,6 +443,10 @@ $(document).ready(function() {
$.post(oItems.del.url, {format: "json", media: media }, function(json){ $.post(oItems.del.url, {format: "json", media: media }, function(json){
var oTable, tr; var oTable, tr;
if (json.message) {
alert(json.message);
}
oTable = $("#library_display").dataTable(); oTable = $("#library_display").dataTable();
oTable.fnDeleteRow( $tr[0] ); oTable.fnDeleteRow( $tr[0] );
}); });

View file

@ -42,6 +42,10 @@ $(document).ready(function() {
iMin, iMin,
iServerOffset, iServerOffset,
iClientOffset; iClientOffset;
if ($(sDatePickerId).val() === "") {
return 0;
}
oDate = $( sDatePickerId ).datepicker( "getDate" ); oDate = $( sDatePickerId ).datepicker( "getDate" );
@ -75,19 +79,18 @@ $(document).ready(function() {
var iStart, var iStart,
iEnd, iEnd,
iRange, iRange,
MIN_RANGE = 60*60*24; DEFAULT_RANGE = 60*60*24;
iStart = fnGetUIPickerUnixTimestamp("#show_builder_datepicker_start", "#show_builder_timepicker_start"); iStart = fnGetUIPickerUnixTimestamp("#show_builder_datepicker_start", "#show_builder_timepicker_start");
iEnd = fnGetUIPickerUnixTimestamp("#show_builder_datepicker_end", "#show_builder_timepicker_end"); iEnd = fnGetUIPickerUnixTimestamp("#show_builder_datepicker_end", "#show_builder_timepicker_end");
iRange = iEnd - iStart; iRange = iEnd - iStart;
//return min range if (iRange === 0 || iEnd < iStart) {
if (iRange < MIN_RANGE){ iEnd = iStart + DEFAULT_RANGE;
iEnd = iStart + MIN_RANGE; iRange = DEFAULT_RANGE;
iRange = MIN_RANGE;
} }
return { return {
start: iStart, start: iStart,
end: iEnd, end: iEnd,
@ -370,11 +373,14 @@ $(document).ready(function() {
}; };
return { return {
placeholder: "placeholder show-builder-placeholder", placeholder: "placeholder show-builder-placeholder ui-state-highlight",
forcePlaceholderSize: true, forcePlaceholderSize: true,
items: 'tr:not(:first):not(.sb-header):not(.sb-footer):not(.sb-not-allowed):not(.sb-empty)', items: 'tr:not(:first):not(.sb-header):not(.sb-footer):not(.sb-not-allowed)',
receive: fnReceive, receive: fnReceive,
update: fnUpdate update: fnUpdate,
start: function(event, ui) {
//ui.placeholder.html("PLACE HOLDER");
},
}; };
}()); }());