- temp commit on group action

This commit is contained in:
James 2012-01-04 12:47:27 -05:00
parent 9216da7f03
commit 5fa92f3d17
4 changed files with 48 additions and 23 deletions

View file

@ -182,6 +182,7 @@ class LibraryController extends Zend_Controller_Action
public function contentsAction() public function contentsAction()
{ {
$post = $this->getRequest()->getPost(); $post = $this->getRequest()->getPost();
Logging::log(print_r($post, true));
$datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($post); $datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($post);
//format clip lengh to 1 decimal //format clip lengh to 1 decimal

View file

@ -666,9 +666,8 @@ class Application_Model_StoredFile {
UNION UNION
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS"; (".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS";
return Application_Model_StoredFile::searchFiles($fromTable, $datatables); return Application_Model_StoredFile::searchFiles($fromTable, $datatables);
} }
public static function searchPlaylistsForSchedule($datatables) public static function searchPlaylistsForSchedule($datatables)
@ -690,7 +689,12 @@ class Application_Model_StoredFile {
$searchTerms = explode(" ", $data["sSearch"]); $searchTerms = explode(" ", $data["sSearch"]);
$selectorCount = "SELECT COUNT(*)"; $selectorCount = "SELECT COUNT(*)";
$selectorRows = "SELECT ". join("," , $columnsDisplayed); foreach( $columnsDisplayed as $key=>$col){
if($col == ''){
unset($columnsDisplayed[$key]);
}
}
$selectorRows = "SELECT " . join(',', $columnsDisplayed );
$sql = $selectorCount." FROM ".$fromTable; $sql = $selectorCount." FROM ".$fromTable;
$totalRows = $CC_DBC->getOne($sql); $totalRows = $CC_DBC->getOne($sql);
@ -733,7 +737,7 @@ class Application_Model_StoredFile {
// End Order By clause // End Order By clause
//ordered by integer as expected by datatables. //ordered by integer as expected by datatables.
$CC_DBC->setFetchMode(DB_FETCHMODE_ORDERED); //$CC_DBC->setFetchMode(DB_FETCHMODE_ORDERED);
if(isset($where)) { if(isset($where)) {
$where = join(" AND ", $where); $where = join(" AND ", $where);
@ -746,6 +750,13 @@ class Application_Model_StoredFile {
} }
$results = $CC_DBC->getAll($sql); $results = $CC_DBC->getAll($sql);
// add checkbox row
foreach($results as &$row){
$row['checkbox'] = "<input type='checkbox' name='cb_".$row[id]."'>";
}
//$results['checkbox']
//$results = $CC_DBC->getAssoc($sql);
Logging::log(print_r($results, true));
//echo $results; //echo $results;
//echo $sql; //echo $sql;

View file

@ -66,4 +66,12 @@
-moz-user-select: none; -moz-user-select: none;
-o-user-select: none; -o-user-select: none;
user-select: none; user-select: none;
} }
.datatable_checkbox {
text-align: center;
}
.datatable_checkbox .DataTables_sort_wrapper {
text-align: center;
}

View file

@ -1,13 +1,15 @@
var dTable;
//used by jjmenu //used by jjmenu
function getId() { function getId() {
var tr_id = $(this.triggerElement).attr("id"); var tr_id = $(this.triggerElement).parent().attr("id");
tr_id = tr_id.split("_"); tr_id = tr_id.split("_");
return tr_id[1]; return tr_id[1];
} }
function getType() { function getType() {
var tr_id = $(this.triggerElement).attr("id"); var tr_id = $(this.triggerElement).parent().attr("id");
tr_id = tr_id.split("_"); tr_id = tr_id.split("_");
return tr_id[0]; return tr_id[0];
@ -90,7 +92,7 @@ function addLibraryItemEvents() {
cursor: 'pointer' cursor: 'pointer'
}); });
$('#library_display tbody tr') $('#library_display tbody tr td').not('[class=datatable_checkbox]')
.jjmenu("click", .jjmenu("click",
[{get:"/Library/context-menu/format/json/id/#id#/type/#type#"}], [{get:"/Library/context-menu/format/json/id/#id#/type/#type#"}],
{id: getId, type: getType}, {id: getId, type: getType},
@ -101,20 +103,20 @@ function addLibraryItemEvents() {
function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
var id, type, once; var id, type, once;
type = aData[6].substring(0,2); type = aData["ftype"].substring(0,2);
id = aData[0]; id = aData["id"];
if(type == "au") { if(type == "au") {
$('td:eq(5)', nRow).html( '<img src="css/images/icon_audioclip.png">' ); $('td:eq(6)', nRow).html( '<img src="css/images/icon_audioclip.png">' );
} }
else if(type == "pl") { else if(type == "pl") {
$('td:eq(5)', nRow).html( '<img src="css/images/icon_playlist.png">' ); $('td:eq(6)', nRow).html( '<img src="css/images/icon_playlist.png">' );
} }
$(nRow).attr("id", type+'_'+id); $(nRow).attr("id", type+'_'+id);
// insert id on lenth field // insert id on lenth field
$('td:eq(4)', nRow).attr("id", "length"); $('td:eq(5)', nRow).attr("id", "length");
return nRow; return nRow;
} }
@ -123,6 +125,8 @@ function dtDrawCallback() {
addLibraryItemEvents(); addLibraryItemEvents();
addMetadataQtip(); addMetadataQtip();
saveNumEntriesSetting(); saveNumEntriesSetting();
var temp = dTable.fnGetData()
console.log(temp)
} }
function addProgressIcon(id) { function addProgressIcon(id) {
@ -298,29 +302,30 @@ function getNumEntriesPreference(data) {
} }
function createDataTable(data) { function createDataTable(data) {
var dTable = $('#library_display').dataTable( { dTable = $('#library_display').dataTable( {
"bProcessing": true, "bProcessing": true,
"bServerSide": true, "bServerSide": true,
"sAjaxSource": "/Library/contents/format/json", "sAjaxSource": "/Library/contents/format/json",
"fnServerData": function ( sSource, aoData, fnCallback ) { "fnServerData": function ( sSource, aoData, testCallback ) {
$.ajax( { $.ajax( {
"dataType": 'json', "dataType": 'json',
"type": "POST", "type": "POST",
"url": sSource, "url": sSource,
"data": aoData, "data": aoData,
"success": fnCallback "success": testCallback
} ); } );
}, },
"fnRowCallback": dtRowCallback, "fnRowCallback": dtRowCallback,
"fnDrawCallback": dtDrawCallback, "fnDrawCallback": dtDrawCallback,
"aoColumns": [ "aoColumns": [
/* Id */ { "sName": "id", "bSearchable": false, "bVisible": false }, /* Checkbox */ { "sTitle": "<input type='checkbox' name='cb_all'>", "bSortable": false, "bSearchable": false, "mDataProp": "checkbox", "sWidth": "25px", "sClass": "datatable_checkbox" },
/* Title */ { "sTitle": "Title", "sName": "track_title" }, /* Id */ { "sName": "id", "bSearchable": false, "bVisible": false, "mDataProp": "id" },
/* Creator */ { "sTitle": "Creator", "sName": "artist_name" }, /* Title */ { "sTitle": "Title", "sName": "track_title", "mDataProp": "track_title" },
/* Album */ { "sTitle": "Album", "sName": "album_title" }, /* Creator */ { "sTitle": "Creator", "sName": "artist_name", "mDataProp": "artist_name" },
/* Genre */ { "sTitle": "Genre", "sName": "genre" }, /* Album */ { "sTitle": "Album", "sName": "album_title", "mDataProp": "album_title" },
/* Length */ { "sTitle": "Length", "sName": "length" }, /* Genre */ { "sTitle": "Genre", "sName": "genre", "mDataProp": "genre" },
/* Type */ { "sTitle": "Type", "sName": "ftype", "bSearchable": false } /* Length */ { "sTitle": "Length", "sName": "length", "mDataProp": "length" },
/* Type */ { "sTitle": "Type", "sName": "ftype", "bSearchable": false, "mDataProp": "ftype", "sWidth": "50px" },
], ],
"aaSorting": [[2,'asc']], "aaSorting": [[2,'asc']],
"sPaginationType": "full_numbers", "sPaginationType": "full_numbers",