Dotclear


Ignore:
Timestamp:
07/10/16 17:43:26 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Children:
3266:7af12b0d86d2, 3286:756eedc2fc15
Message:

Optional display of columns in posts and pages lists, closes #1074

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/preferences.php

    r3245 r3265  
    9999$lang_combo = dcAdminCombos::getAdminLangsCombo(); 
    100100 
     101# Get default colums (admin lists) 
     102$cols = array( 
     103     'posts' => array(__('Posts'), array( 
     104          'date' => array(true,__('Date')), 
     105          'category' => array(true,__('Category')), 
     106          'author' => array(true,__('Author')), 
     107          'comments' => array(true,__('Comments')), 
     108          'trackbacks' => array(true,__('Trackbacks')) 
     109     )) 
     110); 
     111$cols = new arrayObject($cols); 
     112$core->callBehavior('adminColumnsLists',$core,$cols); 
     113# Load user settings 
     114$cols_user = @$core->auth->user_prefs->interface->cols; 
     115if (is_array($cols_user)) { 
     116     foreach ($cols_user as $ct => $cv) { 
     117          foreach ($cv as $cn => $cd) { 
     118               if (isset($cols[$ct][1][$cn])) { 
     119                    $cols[$ct][1][$cn][0] = $cd; 
     120               } 
     121          } 
     122     } 
     123} 
     124 
    101125# Add or update user 
    102126if (isset($_POST['user_name'])) 
     
    196220          $core->auth->user_prefs->interface->put('media_last_dirs',array(),'array',null,false); 
    197221          $core->auth->user_prefs->interface->put('media_fav_dirs',array(),'array',null,false); 
     222 
     223          # Update user columns (lists) 
     224          $cu = array(); 
     225          foreach ($cols as $col_type => $cols_list) { 
     226               $ct = array(); 
     227               foreach ($cols_list[1] as $col_name => $col_data) { 
     228                    $ct[$col_name] = isset($_POST['cols_'.$col_type]) && in_array($col_name,$_POST['cols_'.$col_type],true) ? true : false; 
     229               } 
     230               if (count($ct)) { 
     231                    $cu[$col_type] = $ct; 
     232               } 
     233          } 
     234          $core->auth->user_prefs->interface->put('cols',$cu,'array'); 
    198235 
    199236          # Update user 
     
    463500echo 
    464501'<div class="fieldset">'. 
     502'<h4>'.__('Optional columns displayed in lists').'</h4>'; 
     503foreach ($cols as $col_type => $col_list) { 
     504     echo '<h5>'.$col_list[0].'</h5>'; 
     505     foreach ($col_list[1] as $col_name => $col_data) { 
     506          echo 
     507          '<p><label for="cols_'.$col_type.'-"'.$col_name.'" class="classic">'. 
     508          form::checkbox(array('cols_'.$col_type.'[]','cols_'.$col_type.'-'.$col_name),$col_name,$col_data[0]).$col_data[1].'</label>'; 
     509     } 
     510} 
     511echo '</div>'; 
     512 
     513echo 
     514'<div class="fieldset">'. 
    465515'<h4>'.__('Edition').'</h4>'; 
    466516 
Note: See TracChangeset for help on using the changeset viewer.

Sites map