Merge branch 'group_action_playlist_builder' into devel

This commit is contained in:
Yuchen Wang 2012-01-13 14:21:29 -05:00
commit 9629e2bbae
3 changed files with 29 additions and 26 deletions
airtime_mvc
application/models
public/js/airtime/user

View File

@ -685,7 +685,17 @@ class Application_Model_StoredFile {
UNION UNION
(".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exists = 'TRUE')) AS RESULTS"; (".$fileSelect."id FROM ".$CC_CONFIG["filesTable"]." AS FILES WHERE file_exists = 'TRUE')) AS RESULTS";
return Application_Model_StoredFile::searchFiles($fromTable, $datatables); $results = Application_Model_StoredFile::searchFiles($fromTable, $datatables);
foreach($results['aaData'] as &$row){
// add checkbox row
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
// a full timestamp is being returned for playlists' year column;
// split it and grab only the year info
$yearSplit = explode('-', $row['year']);
$row['year'] = $yearSplit[0];
}
return $results;
} }
public static function searchPlaylistsForSchedule($datatables) public static function searchPlaylistsForSchedule($datatables)
@ -765,16 +775,7 @@ class Application_Model_StoredFile {
} }
$results = $CC_DBC->getAll($sql); $results = $CC_DBC->getAll($sql);
foreach($results as &$row){
// add checkbox row
$row['checkbox'] = "<input type='checkbox' name='cb_".$row['id']."'>";
// a full timestamp is being returned for playlists' year column;
// split it and grab only the year info
$yearSplit = explode('-', $row['year']);
$row['year'] = $yearSplit[0];
}
if(!isset($totalDisplayRows)) { if(!isset($totalDisplayRows)) {
$totalDisplayRows = $totalRows; $totalDisplayRows = $totalRows;
} }

View File

@ -236,8 +236,10 @@ class Application_Model_User {
// mark record which is for the current user // mark record which is for the current user
foreach($res['aaData'] as &$record){ foreach($res['aaData'] as &$record){
if($record[1] == $username){ if($record['login'] == $username){
$record[5] = "self"; $record['delete'] = "self";
} else {
$record['delete'] = "";
} }
} }

View File

@ -35,23 +35,23 @@ function removeUserCallback(row_id, nRow){
} }
function rowCallback( nRow, aData, iDisplayIndex ){ function rowCallback( nRow, aData, iDisplayIndex ){
$(nRow).click(function(){rowClickCallback(aData[0])}); $(nRow).click(function(){rowClickCallback(aData['id'])});
if( aData[5] != "self"){ if( aData['delete'] != "self"){
$('td:eq(4)', nRow).append( '<span class="ui-icon ui-icon-closethick"></span>').children('span').click(function(e){e.stopPropagation(); removeUserCallback(aData[0], nRow)}); $('td:eq(4)', nRow).append( '<span class="ui-icon ui-icon-closethick"></span>').children('span').click(function(e){e.stopPropagation(); removeUserCallback(aData['id'], nRow)});
}else{ }else{
$('td:eq(4)', nRow).empty().append( '<span class="ui-icon ui-icon-closethick"></span>').children('span').click(function(e){e.stopPropagation(); alert("Can't delete yourself!")}); $('td:eq(4)', nRow).empty().append( '<span class="ui-icon ui-icon-closethick"></span>').children('span').click(function(e){e.stopPropagation(); alert("Can't delete yourself!")});
} }
if ( aData[4] == "A" ) if ( aData['type'] == "A" )
{ {
$('td:eq(3)', nRow).html( 'Admin' ); $('td:eq(3)', nRow).html( 'Admin' );
} else if ( aData[4] == "H" ) } else if ( aData['type'] == "H" )
{ {
$('td:eq(3)', nRow).html( 'DJ' ); $('td:eq(3)', nRow).html( 'DJ' );
} else if ( aData[4] == "G" ) } else if ( aData['type'] == "G" )
{ {
$('td:eq(3)', nRow).html( 'Guest' ); $('td:eq(3)', nRow).html( 'Guest' );
} else if ( aData[4] == "P" ) } else if ( aData['type'] == "P" )
{ {
$('td:eq(3)', nRow).html( 'Program Manager' ); $('td:eq(3)', nRow).html( 'Program Manager' );
} }
@ -75,12 +75,12 @@ $(document).ready(function() {
}, },
"fnRowCallback": rowCallback, "fnRowCallback": rowCallback,
"aoColumns": [ "aoColumns": [
/* Id */ { "sName": "id", "bSearchable": false, "bVisible": false }, /* Id */ { "sName": "id", "bSearchable": false, "bVisible": false, "mDataProp": "id" },
/* user name */ { "sName": "login" }, /* user name */ { "sName": "login", "mDataProp": "login" },
/* first name */ { "sName": "first_name" }, /* first name */ { "sName": "first_name", "mDataProp": "first_name" },
/* last name */ { "sName": "last_name" }, /* last name */ { "sName": "last_name", "mDataProp": "last_name" },
/* user type */ { "sName": "type", "bSearchable": false }, /* user type */ { "sName": "type", "bSearchable": false, "mDataProp": "type" },
/* del button */ { "sName": "null as delete", "bSearchable": false, "bSortable": false} /* del button */ { "sName": "null as delete", "bSearchable": false, "bSortable": false, "mDataProp": "delete"}
], ],
"bJQueryUI": true, "bJQueryUI": true,
"bAutoWidth": false, "bAutoWidth": false,