Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
James 2012-01-13 16:26:38 -05:00
commit f9aab1b5ac
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
(".$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)
@ -765,16 +775,7 @@ class Application_Model_StoredFile {
}
$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)) {
$totalDisplayRows = $totalRows;
}

View File

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

View File

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