CC-3174 : Show builder

creating a scheduling system to work with the new timeline in mind using propel.
This commit is contained in:
Naomi Aro 2012-01-27 21:06:04 +01:00
parent f5761fd03c
commit 3f3117cf0e
8 changed files with 175 additions and 27 deletions

View file

@ -273,7 +273,7 @@ function saveNumEntriesSetting() {
* Use user preference for number of entries to show
*/
function getNumEntriesPreference(data) {
return parseInt(data.libraryInit.numEntries);
return parseInt(data.libraryInit.numEntries, 10);
}
function groupAdd() {
@ -457,11 +457,12 @@ function createDataTable(data) {
dTable = $('#library_display').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/Library/contents/format/json",
"sAjaxSource": "/Library/contents",
"fnServerData": function ( sSource, aoData, testCallback ) {
aoData.push( { name: "format", value: "json"} );
$.ajax( {
"dataType": 'json',
"type": "POST",
"type": "GET",
"url": sSource,
"data": aoData,
"success": testCallback
@ -490,7 +491,7 @@ function createDataTable(data) {
"sSearch": ""
},
"iDisplayLength": getNumEntriesPreference(data),
"bStateSave": true,
// R = ColReorder, C = ColVis, see datatables doc for others
"sDom": 'Rlfr<"H"C<"library_toolbar">>t<"F"ip>',
"oColVis": {
@ -499,10 +500,6 @@ function createDataTable(data) {
"aiExclude": [0, 1, 2],
"sSize": "css",
"bShowAll": true
},
"oColReorder": {
"aiOrder": [ 0, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], /* code this */
"iFixedColumns": 3
}
});
dTable.fnSetFilteringDelay(350);

View file

@ -138,6 +138,9 @@ var fnShowBuilderRowCallback = function ( nRow, aData, iDisplayIndex, iDisplayIn
fnPrepareSeparatorRow,
node;
//save some info for reordering purposes.
$(nRow).data({aData: aData});
fnPrepareSeparatorRow = function(sRowContent, sClass) {
node = nRow.children[1];
@ -167,6 +170,12 @@ var fnShowBuilderRowCallback = function ( nRow, aData, iDisplayIndex, iDisplayIn
sSeparatorHTML = '<span>Show Footer</span>';
fnPrepareSeparatorRow(sSeparatorHTML, "show-builder-footer");
}
else if (aData.empty === true) {
}
else {
$(nRow).attr("id", "sched_"+aData.id);
}
return nRow;
};
@ -197,7 +206,7 @@ $(document).ready(function() {
oTable = $('#show_builder_table').dataTable( {
"aoColumns": [
/* checkbox */ {"mDataProp": "checkbox", "sTitle": "<input type='checkbox' name='sb_all'>", "sWidth": "25px"},
// /* scheduled id */{"mDataProp": "id", "sTitle": "id", "bVisible": false, "sWidth": "1px"},
// /* scheduled id */{"mDataProp": "id", "sTitle": "id"},
// /* instance */{"mDataProp": "instance", "sTitle": "si_id"},
/* starts */{"mDataProp": "starts", "sTitle": "Airtime"},
/* ends */{"mDataProp": "ends", "sTitle": "Off Air"},
@ -215,6 +224,7 @@ $(document).ready(function() {
"bProcessing": true,
"bServerSide": true,
"bInfo": false,
"bAutoWidth": false,
"fnServerData": fnServerData,
"fnRowCallback": fnShowBuilderRowCallback,
@ -235,8 +245,6 @@ $(document).ready(function() {
"sAjaxSource": "/showbuilder/builder-feed"
});
//new FixedHeader( oTable );
new FixedColumns( oTable );
$( "#show_builder_datepicker_start" ).datepicker(oBaseDatePickerSettings);
@ -263,10 +271,39 @@ $(document).ready(function() {
$( "#show_builder_table" ).sortable({
placeholder: "placeholder show-builder-placeholder",
items: 'tr',
cancel: ".show-builder-header .show-builder-footer",
forceHelperSize: true,
forcePlaceholderSize: true,
items: 'tr:not(.show-builder-header):not(.show-builder-footer)',
//cancel: ".show-builder-header .show-builder-footer",
receive: function(event, ui) {
var x;
},
update: function(event, ui) {
var oItemData = ui.item.data("aData"),
oPrevData = ui.item.prev().data("aData"),
oRequestData = {format: "json"};
//if prev item is a footer, item is not scheduled into a show.
if (oPrevData.footer === false) {
oRequestData.instance = oPrevData.instance;
}
//set the start time appropriately
if (oPrevData.header === true) {
oRequestData.start = oPrevData.startsUnix;
}
else {
oRequestData.start = oPrevData.endsUnix;
}
oRequestData.id = oItemData.id;
oRequestData.duration = oItemData.duration;
/*
$.post("/showbuilder/schedule", oRequestData, function(json){
var x;
});
*/
}
});