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">
<!--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="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>
</body>
</html>

View file

@ -326,11 +326,11 @@ class Application_Model_Schedule {
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;";
//Logging::log($sql);
Logging::log($sql);
$rows = $CC_DBC->GetAll($sql);
return $rows;

View file

@ -79,6 +79,14 @@ class Application_Model_Scheduler {
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) {
$id = intval($schedule["id"]);
@ -104,12 +112,18 @@ class Application_Model_Scheduler {
$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()
->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)
->filterByDbId($excludeIds, Criteria::NOT_IN)
->orderByDbStarts()
->find($this->con);
foreach ($excludeIds as $id) {
Logging::log("Excluding id {$id}");
}
}
foreach($schedFiles as $file) {
@ -128,6 +142,9 @@ class Application_Model_Scheduler {
else {
$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->setDbEnds($endTimeDT);
@ -143,11 +160,13 @@ class Application_Model_Scheduler {
$nextStartDT = $endTimeDT;
}
if ($id !== 0 && $adjustSched === true) {
if ($adjustSched === true) {
//recalculate the start/end times after the inserted items.
foreach($followingSchedItems as $item) {
Logging::log("adjusting iterm {$item->getDbId()}");
$durationDT = new DateTime("1970-01-01 {$item->getDbClipLength()}", new DateTimeZone("UTC"));
$endTimeEpoch = $nextStartDT->format("U") + $durationDT->format("U");
$endTimeDT = DateTime::createFromFormat("U", $endTimeEpoch, new DateTimeZone("UTC"));
@ -215,12 +234,14 @@ class Application_Model_Scheduler {
$selected = CcScheduleQuery::create()->findPk($selectedItem[0]["id"]);
$after = CcScheduleQuery::create()->findPk($afterItem[0]["id"]);
if ($origSelIns !== $selected->getDBInstanceId()
/*
if (isset($after) && $origSelIns !== $selected->getDBInstanceId()
|| $origAfterIns !== $after->getDBInstanceId()) {
Logging::log("items have been since updated");
return;
}
*/
$this->removeGaps($origSelIns, $selected->getDbId());

View file

@ -12,7 +12,7 @@ class Application_Model_ShowBuilder {
"footer" => false,
"empty" => false,
"checkbox" => false,
"id" => "",
"id" => 0,
"instance" => "",
"starts" => "",
"startsUnix" => null,
@ -77,11 +77,10 @@ class Application_Model_ShowBuilder {
$row["header"] = true;
$row["starts"] = $showStartDT->format("Y-m-d H:i");
$row["startsUnix"] = $showStartDT->format("U");
$row["ends"] = $showEndDT->format("Y-m-d H:i");
$row["endsUnix"] = $showEndDT->format("U");
$row["duration"] = $showEndDT->format("U") - $showStartDT->format("U");
$row["title"] = $p_item["show_name"];
$row["instance"] = intval($p_item["si_id"]);
return $row;
}
@ -101,10 +100,7 @@ class Application_Model_ShowBuilder {
$row["id"] = intval($p_item["sched_id"]);
$row["instance"] = intval($p_item["si_id"]);
$row["starts"] = $schedStartDT->format("H:i:s");
$row["startsUnix"] = $schedStartDT->format("U");
$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["title"] = $p_item["file_track_title"];
$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){
var oTable, tr;
if (json.message) {
alert(json.message);
}
oTable = $("#library_display").dataTable();
oTable.fnDeleteRow( $tr[0] );
});

View file

@ -43,6 +43,10 @@ $(document).ready(function() {
iServerOffset,
iClientOffset;
if ($(sDatePickerId).val() === "") {
return 0;
}
oDate = $( sDatePickerId ).datepicker( "getDate" );
//nothing has been selected from this datepicker.
@ -75,17 +79,16 @@ $(document).ready(function() {
var iStart,
iEnd,
iRange,
MIN_RANGE = 60*60*24;
DEFAULT_RANGE = 60*60*24;
iStart = fnGetUIPickerUnixTimestamp("#show_builder_datepicker_start", "#show_builder_timepicker_start");
iEnd = fnGetUIPickerUnixTimestamp("#show_builder_datepicker_end", "#show_builder_timepicker_end");
iRange = iEnd - iStart;
//return min range
if (iRange < MIN_RANGE){
iEnd = iStart + MIN_RANGE;
iRange = MIN_RANGE;
if (iRange === 0 || iEnd < iStart) {
iEnd = iStart + DEFAULT_RANGE;
iRange = DEFAULT_RANGE;
}
return {
@ -370,11 +373,14 @@ $(document).ready(function() {
};
return {
placeholder: "placeholder show-builder-placeholder",
placeholder: "placeholder show-builder-placeholder ui-state-highlight",
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,
update: fnUpdate
update: fnUpdate,
start: function(event, ui) {
//ui.placeholder.html("PLACE HOLDER");
},
};
}());