From 5fa92f3d17acefa4a1fc689d6a925d520f3be915 Mon Sep 17 00:00:00 2001 From: James Date: Wed, 4 Jan 2012 12:47:27 -0500 Subject: [PATCH] - temp commit on group action --- .../controllers/LibraryController.php | 1 + airtime_mvc/application/models/StoredFile.php | 19 +++++++-- airtime_mvc/public/css/media_library.css | 10 ++++- .../public/js/airtime/library/library.js | 41 +++++++++++-------- 4 files changed, 48 insertions(+), 23 deletions(-) diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index f0b72099d..7bad3225e 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -182,6 +182,7 @@ class LibraryController extends Zend_Controller_Action public function contentsAction() { $post = $this->getRequest()->getPost(); + Logging::log(print_r($post, true)); $datatables = Application_Model_StoredFile::searchFilesForPlaylistBuilder($post); //format clip lengh to 1 decimal diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index d48c3c420..8b6fe4a99 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -666,9 +666,8 @@ class Application_Model_StoredFile { UNION (".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES)) AS RESULTS"; - + return Application_Model_StoredFile::searchFiles($fromTable, $datatables); - } public static function searchPlaylistsForSchedule($datatables) @@ -690,7 +689,12 @@ class Application_Model_StoredFile { $searchTerms = explode(" ", $data["sSearch"]); $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; $totalRows = $CC_DBC->getOne($sql); @@ -733,7 +737,7 @@ class Application_Model_StoredFile { // End Order By clause //ordered by integer as expected by datatables. - $CC_DBC->setFetchMode(DB_FETCHMODE_ORDERED); + //$CC_DBC->setFetchMode(DB_FETCHMODE_ORDERED); if(isset($where)) { $where = join(" AND ", $where); @@ -746,6 +750,13 @@ class Application_Model_StoredFile { } $results = $CC_DBC->getAll($sql); + // add checkbox row + foreach($results as &$row){ + $row['checkbox'] = ""; + } + //$results['checkbox'] + //$results = $CC_DBC->getAssoc($sql); + Logging::log(print_r($results, true)); //echo $results; //echo $sql; diff --git a/airtime_mvc/public/css/media_library.css b/airtime_mvc/public/css/media_library.css index dbef3052a..925baa36a 100644 --- a/airtime_mvc/public/css/media_library.css +++ b/airtime_mvc/public/css/media_library.css @@ -66,4 +66,12 @@ -moz-user-select: none; -o-user-select: none; user-select: none; -} \ No newline at end of file +} + +.datatable_checkbox { + text-align: center; +} + +.datatable_checkbox .DataTables_sort_wrapper { + text-align: center; +} diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index eefa73ccf..88fc6a9aa 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -1,13 +1,15 @@ +var dTable; + //used by jjmenu function getId() { - var tr_id = $(this.triggerElement).attr("id"); + var tr_id = $(this.triggerElement).parent().attr("id"); tr_id = tr_id.split("_"); return tr_id[1]; } function getType() { - var tr_id = $(this.triggerElement).attr("id"); + var tr_id = $(this.triggerElement).parent().attr("id"); tr_id = tr_id.split("_"); return tr_id[0]; @@ -90,7 +92,7 @@ function addLibraryItemEvents() { cursor: 'pointer' }); - $('#library_display tbody tr') + $('#library_display tbody tr td').not('[class=datatable_checkbox]') .jjmenu("click", [{get:"/Library/context-menu/format/json/id/#id#/type/#type#"}], {id: getId, type: getType}, @@ -101,20 +103,20 @@ function addLibraryItemEvents() { function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { var id, type, once; - type = aData[6].substring(0,2); - id = aData[0]; + type = aData["ftype"].substring(0,2); + id = aData["id"]; if(type == "au") { - $('td:eq(5)', nRow).html( '' ); + $('td:eq(6)', nRow).html( '' ); } else if(type == "pl") { - $('td:eq(5)', nRow).html( '' ); + $('td:eq(6)', nRow).html( '' ); } $(nRow).attr("id", type+'_'+id); // insert id on lenth field - $('td:eq(4)', nRow).attr("id", "length"); + $('td:eq(5)', nRow).attr("id", "length"); return nRow; } @@ -123,6 +125,8 @@ function dtDrawCallback() { addLibraryItemEvents(); addMetadataQtip(); saveNumEntriesSetting(); + var temp = dTable.fnGetData() + console.log(temp) } function addProgressIcon(id) { @@ -298,29 +302,30 @@ function getNumEntriesPreference(data) { } function createDataTable(data) { - var dTable = $('#library_display').dataTable( { + dTable = $('#library_display').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": "/Library/contents/format/json", - "fnServerData": function ( sSource, aoData, fnCallback ) { + "fnServerData": function ( sSource, aoData, testCallback ) { $.ajax( { "dataType": 'json', "type": "POST", "url": sSource, "data": aoData, - "success": fnCallback + "success": testCallback } ); }, "fnRowCallback": dtRowCallback, "fnDrawCallback": dtDrawCallback, "aoColumns": [ - /* Id */ { "sName": "id", "bSearchable": false, "bVisible": false }, - /* Title */ { "sTitle": "Title", "sName": "track_title" }, - /* Creator */ { "sTitle": "Creator", "sName": "artist_name" }, - /* Album */ { "sTitle": "Album", "sName": "album_title" }, - /* Genre */ { "sTitle": "Genre", "sName": "genre" }, - /* Length */ { "sTitle": "Length", "sName": "length" }, - /* Type */ { "sTitle": "Type", "sName": "ftype", "bSearchable": false } + /* Checkbox */ { "sTitle": "", "bSortable": false, "bSearchable": false, "mDataProp": "checkbox", "sWidth": "25px", "sClass": "datatable_checkbox" }, + /* Id */ { "sName": "id", "bSearchable": false, "bVisible": false, "mDataProp": "id" }, + /* Title */ { "sTitle": "Title", "sName": "track_title", "mDataProp": "track_title" }, + /* Creator */ { "sTitle": "Creator", "sName": "artist_name", "mDataProp": "artist_name" }, + /* Album */ { "sTitle": "Album", "sName": "album_title", "mDataProp": "album_title" }, + /* Genre */ { "sTitle": "Genre", "sName": "genre", "mDataProp": "genre" }, + /* Length */ { "sTitle": "Length", "sName": "length", "mDataProp": "length" }, + /* Type */ { "sTitle": "Type", "sName": "ftype", "bSearchable": false, "mDataProp": "ftype", "sWidth": "50px" }, ], "aaSorting": [[2,'asc']], "sPaginationType": "full_numbers",