diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php
index 499cf68b1..808f32f24 100644
--- a/airtime_mvc/application/models/Schedule.php
+++ b/airtime_mvc/application/models/Schedule.php
@@ -328,11 +328,11 @@ class Application_Model_Schedule {
WHERE si.modified_instance = false AND
- si.starts >= '{$p_startDateTime}' AND si.starts <= '{$p_endDateTime}'
+ 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;
diff --git a/airtime_mvc/application/models/ShowBuilder.php b/airtime_mvc/application/models/ShowBuilder.php
index 0e398a94f..fba33c08c 100644
--- a/airtime_mvc/application/models/ShowBuilder.php
+++ b/airtime_mvc/application/models/ShowBuilder.php
@@ -122,7 +122,7 @@ class Application_Model_ShowBuilder {
private function makeScheduledItemRow($p_item) {
$row = $this->defaultRowArray;
- if ($this->user->canSchedule($item["show_id"]) == true) {
+ if ($this->user->canSchedule($p_item["show_id"]) == true) {
$row["checkbox"] = true;
}
diff --git a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js
index ffb1d2f9a..a2cb407e1 100644
--- a/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js
+++ b/airtime_mvc/public/js/airtime/library/events/library_showbuilder.js
@@ -72,7 +72,6 @@ var AIRTIME = (function(AIRTIME){
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
function(json){
oLibTT.fnSelectNone();
- oSchedTT.fnSelectNone();
oSchedTable.fnDraw();
});
};
diff --git a/airtime_mvc/public/js/airtime/showbuilder/builder.js b/airtime_mvc/public/js/airtime/showbuilder/builder.js
index 31d598bfd..0a212c3cf 100644
--- a/airtime_mvc/public/js/airtime/showbuilder/builder.js
+++ b/airtime_mvc/public/js/airtime/showbuilder/builder.js
@@ -124,7 +124,8 @@ $(document).ready(function() {
var i,
sSeparatorHTML,
fnPrepareSeparatorRow,
- node;
+ node,
+ cl="";
//save some info for reordering purposes.
$(nRow).data({"aData": aData});
@@ -144,40 +145,30 @@ $(document).ready(function() {
};
if (aData.header === true) {
- //node = nRow.children[0];
- //node.innerHTML = '';
- //node.innerHTML = '';
+ cl = 'sb-header';
sSeparatorHTML = ''+aData.title+''+aData.starts+''+aData.ends+'';
- fnPrepareSeparatorRow(sSeparatorHTML, "sb-header", 0);
+ fnPrepareSeparatorRow(sSeparatorHTML, cl, 0);
}
else if (aData.footer === true) {
- var c,
node = nRow.children[0];
+ cl = 'sb-footer';
//check the show's content status.
if (aData.runtime > 0) {
node.innerHTML = '';
- cl = 'ui-state-highlight';
+ cl = cl + ' ui-state-highlight';
}
else {
node.innerHTML = '';
- cl = 'ui-state-error';
+ cl = cl + ' ui-state-error';
}
sSeparatorHTML = ''+aData.fRuntime+'';
fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
- }
- else if (aData.empty === true) {
-
- node = nRow.children[0];
- node.innerHTML = '';
-
- sSeparatorHTML = 'Show Empty';
- fnPrepareSeparatorRow(sSeparatorHTML, "sb-empty odd", 1);
- }
+ }
else {
- $(nRow).attr("id", "sched_"+aData.id);
+ //$(nRow).attr("id", "sched_"+aData.id);
node = nRow.children[0];
if (aData.checkbox === true) {
@@ -185,8 +176,15 @@ $(document).ready(function() {
}
else {
node.innerHTML = '';
+ cl = cl + " sb-not-allowed";
+ }
+
+ if (aData.empty === true) {
- $(nRow).addClass("sb-not-allowed");
+ sSeparatorHTML = 'Show Empty';
+ cl = cl + " sb-empty odd";
+
+ fnPrepareSeparatorRow(sSeparatorHTML, cl, 1);
}
}
};
@@ -208,7 +206,6 @@ $(document).ready(function() {
$.post( "/showbuilder/schedule-remove",
{"ids": ids, "format": "json"},
function(data) {
- oTT.fnSelectNone();
oTable.fnDraw();
});
};
@@ -237,6 +234,11 @@ $(document).ready(function() {
"fnHeaderCallback": function(nHead) {
$(nHead).find("input[type=checkbox]").attr("checked", false);
},
+ //remove any selected nodes before the draw.
+ "fnPreDrawCallback": function( oSettings ) {
+ var oTT = TableTools.fnGetInstance('show_builder_table');
+ oTT.fnSelectNone();
+ },
"oColVis": {
"aiExclude": [ 0, 1 ]
@@ -270,9 +272,10 @@ $(document).ready(function() {
}
},
"fnRowDeselected": function ( node ) {
-
+
//seems to happen if everything is deselected
if ( node === null) {
+ var oTable = $("#show_builder_table").dataTable();
oTable.find("input[type=checkbox]").attr("checked", false);
}
else {
@@ -294,7 +297,7 @@ $(document).ready(function() {
if ($(this).is(":checked")) {
var allowedNodes;
- allowedNodes = oTable.find('tr:not(.sb-header):not(.sb-footer):not(.sb-not-allowed)');
+ allowedNodes = oTable.find('tr:not(:first):not(.sb-header):not(.sb-footer):not(.sb-not-allowed)');
allowedNodes.each(function(i, el){
oTT.fnSelect(el);
@@ -333,8 +336,7 @@ $(document).ready(function() {
fnAdd,
fnMove,
fnReceive,
- fnUpdate,
- oTT = TableTools.fnGetInstance('show_builder_table');
+ fnUpdate;
fnAdd = function() {
var aMediaIds = [],
@@ -346,7 +348,6 @@ $(document).ready(function() {
$.post("/showbuilder/schedule-add",
{"format": "json", "mediaIds": aMediaIds, "schedIds": aSchedIds},
function(json){
- oTT.fnSelectNone();
oTable.fnDraw();
});
};