CC-3174 : showbuilder
making sure an item is not added outside of a show.
This commit is contained in:
parent
9b639a9b6d
commit
b5f510de85
2 changed files with 28 additions and 23 deletions
|
@ -76,22 +76,6 @@ class Application_Model_ShowBuilder {
|
|||
return $formatted;
|
||||
}
|
||||
|
||||
private function makeFooterRow($p_item) {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
$this->isAllowed($p_item, $row);
|
||||
$row["footer"] = true;
|
||||
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
$contentDT = $this->contentDT;
|
||||
|
||||
$runtime = bcsub($contentDT->format("U.u"), $showEndDT->format("U.u"), 6);
|
||||
$row["runtime"] = $runtime;
|
||||
$row["fRuntime"] = $this->formatTimeFilled($runtime);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
private function isAllowed($p_item, &$row) {
|
||||
|
||||
$showStartDT = new DateTime($p_item["si_starts"], new DateTimeZone("UTC"));
|
||||
|
@ -197,16 +181,31 @@ class Application_Model_ShowBuilder {
|
|||
}
|
||||
//show is empty
|
||||
else {
|
||||
|
||||
$row["empty"] = true;
|
||||
$row["id"] = 0 ;
|
||||
$row["instance"] = intval($p_item["si_id"]);
|
||||
|
||||
//return null;
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
private function makeFooterRow($p_item) {
|
||||
|
||||
$row = $this->defaultRowArray;
|
||||
$this->isAllowed($p_item, $row);
|
||||
$row["footer"] = true;
|
||||
|
||||
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
|
||||
$contentDT = $this->contentDT;
|
||||
|
||||
$runtime = bcsub($contentDT->format("U.u"), $showEndDT->format("U.u"), 6);
|
||||
$row["runtime"] = $runtime;
|
||||
$row["fRuntime"] = $this->formatTimeFilled($runtime);
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
public function GetItems() {
|
||||
|
||||
$current_id = -1;
|
||||
|
|
|
@ -535,8 +535,17 @@ $(document).ready(function() {
|
|||
};
|
||||
|
||||
fnUpdate = function(event, ui) {
|
||||
var prev = ui.item.prev();
|
||||
|
||||
//can't add items outside of shows.
|
||||
if (prev.hasClass("sb-footer")) {
|
||||
alert("Cannot add an item outside a show.");
|
||||
ui.item.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
aItemData = [];
|
||||
oPrevData = ui.item.prev().data("aData");
|
||||
oPrevData = prev.data("aData");
|
||||
|
||||
//item was dragged in
|
||||
if (origTrs !== undefined) {
|
||||
|
@ -561,10 +570,7 @@ $(document).ready(function() {
|
|||
forcePlaceholderSize: true,
|
||||
items: 'tr:not(:first, :last, .sb-header, .sb-footer, .sb-not-allowed)',
|
||||
receive: fnReceive,
|
||||
update: fnUpdate,
|
||||
start: function(event, ui) {
|
||||
//ui.placeholder.html("PLACE HOLDER");
|
||||
}
|
||||
update: fnUpdate
|
||||
};
|
||||
}());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue