Dotclear


Ignore:
Timestamp:
09/03/15 14:07:40 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add behaviors for posts/pages/comments/users lists' column, addresses #2133

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/admin/lib.pager.php

    r3087 r3089  
    180180               } 
    181181 
    182                $html_block .= '<tr>'. 
    183                '<th colspan="2" class="first">'.__('Title').'</th>'. 
    184                '<th scope="col">'.__('Date').'</th>'. 
    185                '<th scope="col">'.__('Category').'</th>'. 
    186                '<th scope="col">'.__('Author').'</th>'. 
    187                '<th scope="col"><img src="images/comments.png" alt="" title="'.__('Comments').'" /><span class="hidden">'.__('Comments').'</span></th>'. 
    188                '<th scope="col"><img src="images/trackbacks.png" alt="" title="'.__('Trackbacks').'" /><span class="hidden">'.__('Trackbacks').'</span></th>'. 
    189                '<th scope="col">'.__('Status').'</th>'. 
    190                '</tr>%s</table></div>'; 
    191  
     182               $cols = array( 
     183                    'title' =>               '<th colspan="2" class="first">'.__('Title').'</th>', 
     184                    'date' =>           '<th scope="col">'.__('Date').'</th>', 
     185                    'category' =>       '<th scope="col">'.__('Category').'</th>', 
     186                    'author' =>              '<th scope="col">'.__('Author').'</th>', 
     187                    'comments' =>       '<th scope="col"><img src="images/comments.png" alt="" title="'.__('Comments'). 
     188                                             '" /><span class="hidden">'.__('Comments').'</span></th>', 
     189                    'trackbacks' =>          '<th scope="col"><img src="images/trackbacks.png" alt="" title="'.__('Trackbacks'). 
     190                                             '" /><span class="hidden">'.__('Trackbacks').'</span></th>', 
     191                    'status' =>              '<th scope="col">'.__('Status').'</th>' 
     192               ); 
     193               $cols = new ArrayObject($cols); 
     194               $this->core->callBehavior('adminPostListHeader',$this->core,$this->rs,$cols); 
     195 
     196               $html_block .= '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; 
    192197               if ($enclose_block) { 
    193198                    $html_block = sprintf($enclose_block,$html_block); 
     
    262267          ' id="p'.$this->rs->post_id.'">'; 
    263268 
    264           $res .= 
    265           '<td class="nowrap">'. 
    266           form::checkbox(array('entries[]'),$this->rs->post_id,$checked,'','',!$this->rs->isEditable()).'</td>'. 
    267           '<td class="maximal" scope="row"><a href="'.$this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'">'. 
    268           html::escapeHTML($this->rs->post_title).'</a></td>'. 
    269           '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'. 
    270           '<td class="nowrap">'.$cat_title.'</td>'. 
    271           '<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>'. 
    272           '<td class="nowrap count">'.$this->rs->nb_comment.'</td>'. 
    273           '<td class="nowrap count">'.$this->rs->nb_trackback.'</td>'. 
    274           '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'. 
    275           '</tr>'; 
     269          $cols = array( 
     270               'check' =>               '<td class="nowrap">'. 
     271                                        form::checkbox(array('entries[]'),$this->rs->post_id,$checked,'','',!$this->rs->isEditable()). 
     272                                        '</td>', 
     273               'title' =>               '<td class="maximal" scope="row"><a href="'. 
     274                                        $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'">'. 
     275                                        html::escapeHTML($this->rs->post_title).'</a></td>', 
     276               'date' =>           '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>', 
     277               'category' =>       '<td class="nowrap">'.$cat_title.'</td>', 
     278               'author' =>              '<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>', 
     279               'comments' =>       '<td class="nowrap count">'.$this->rs->nb_comment.'</td>', 
     280               'trackbacks' =>          '<td class="nowrap count">'.$this->rs->nb_trackback.'</td>', 
     281               'status' =>              '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>' 
     282          ); 
     283          $cols = new ArrayObject($cols); 
     284          $this->core->callBehavior('adminPostListValue',$this->core,$this->rs,$cols); 
     285 
     286          $res .= implode(iterator_to_array($cols)); 
     287          $res .= '</tr>'; 
    276288 
    277289          return $res; 
     
    293305               $html_block = 
    294306               '<div class="table-outer clear">'. 
    295                '<table><caption class="hidden">'.__('Entries list').'</caption><tr>'. 
    296                '<th scope="col">'.__('Title').'</th>'. 
    297                '<th scope="col">'.__('Date').'</th>'. 
    298                '<th scope="col">'.__('Author').'</th>'. 
    299                '<th scope="col">'.__('Status').'</th>'. 
    300                '</tr>%s</table></div>'; 
    301  
     307               '<table><caption class="hidden">'.__('Entries list').'</caption><tr>'; 
     308 
     309               $cols = array( 
     310                    'title' =>          '<th scope="col">'.__('Title').'</th>', 
     311                    'date' =>      '<th scope="col">'.__('Date').'</th>', 
     312                    'author' =>         '<th scope="col">'.__('Author').'</th>', 
     313                    'status' =>         '<th scope="col">'.__('Status').'</th>' 
     314               ); 
     315 
     316               $cols = new ArrayObject($cols); 
     317               $this->core->callBehavior('adminPostMiniListHeader',$this->core,$this->rs,$cols); 
     318 
     319               $html_block .= '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; 
    302320               if ($enclose_block) { 
    303321                    $html_block = sprintf($enclose_block,$html_block); 
     
    359377          ' id="p'.$this->rs->post_id.'">'; 
    360378 
    361           $res .= 
    362           '<td scope="row" class="maximal"><a href="'.$this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'" '. 
    363           'title="'.html::escapeHTML($this->rs->getURL()).'">'. 
    364           html::escapeHTML($this->rs->post_title).'</a></td>'. 
    365           '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>'. 
    366           '<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>'. 
    367           '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>'. 
    368           '</tr>'; 
     379          $cols = array( 
     380               'title' =>          '<td scope="row" class="maximal"><a href="'. 
     381                                   $this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'" '. 
     382                                   'title="'.html::escapeHTML($this->rs->getURL()).'">'. 
     383                                   html::escapeHTML($this->rs->post_title).'</a></td>', 
     384               'date' =>      '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->post_dt).'</td>', 
     385               'author' =>         '<td class="nowrap">'.html::escapeHTML($this->rs->user_id).'</td>', 
     386               'status' =>         '<td class="nowrap status">'.$img_status.' '.$selected.' '.$protected.' '.$attach.'</td>' 
     387          ); 
     388 
     389          $cols = new ArrayObject($cols); 
     390          $this->core->callBehavior('adminPostMiniListValue',$this->core,$this->rs,$cols); 
     391 
     392          $res .= implode(iterator_to_array($cols)); 
     393          $res .= '</tr>'; 
    369394 
    370395          return $res; 
     
    422447               } 
    423448 
    424                $html_block .= '<tr>'. 
    425                '<th colspan="2" scope="col" abbr="comm" class="first">'.__('Type').'</th>'. 
    426                '<th scope="col">'.__('Author').'</th>'. 
    427                '<th scope="col">'.__('Date').'</th>'. 
    428                '<th scope="col" class="txt-center">'.__('Status').'</th>'; 
     449               $cols = array( 
     450                    'type' => '<th colspan="2" scope="col" abbr="comm" class="first">'.__('Type').'</th>', 
     451                    'author' =>    '<th scope="col">'.__('Author').'</th>', 
     452                    'date' => '<th scope="col">'.__('Date').'</th>', 
     453                    'status' =>    '<th scope="col" class="txt-center">'.__('Status').'</th>' 
     454               ); 
    429455               if ($spam) { 
    430                     $html_block .= 
    431                     '<th scope="col">'.__('IP').'</th>'. 
    432                     '<th scope="col">'.__('Spam filter').'</th>'; 
    433                } 
    434                $html_block .= 
    435                '<th scope="col" abbr="entry">'.__('Entry').'</th>'. 
    436                '</tr>%s</table></div>'; 
     456                    $cols['ip'] = '<th scope="col">'.__('IP').'</th>'; 
     457                    $cols['spam_filter'] = '<th scope="col">'.__('Spam filter').'</th>'; 
     458               } 
     459               $cols['entry'] = '<th scope="col" abbr="entry">'.__('Entry').'</th>'; 
     460 
     461               $cols = new ArrayObject($cols); 
     462               $this->core->callBehavior('adminCommentListHeader',$this->core,$this->rs,$cols); 
     463 
     464               $html_block .= '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; 
    437465 
    438466               if ($enclose_block) { 
     
    505533          ' id="c'.$this->rs->comment_id.'">'; 
    506534 
    507           $res .= 
    508           '<td class="nowrap">'. 
    509           form::checkbox(array('comments[]'),$this->rs->comment_id,$checked,'','',0).'</td>'. 
    510           '<td class="nowrap" abbr="'.__('Type and author').'" scope="row">'. 
    511                '<a href="'.$comment_url.'" title="'.$comment_title.'">'. 
    512                '<img src="images/edit-mini.png" alt="'.__('Edit').'"/> '. 
    513                ($this->rs->comment_trackback ? __('trackback') : __('comment')).' '.'</a></td>'. 
    514           '<td class="nowrap maximal"><a href="'.$author_url.'">'.html::escapeHTML($this->rs->comment_author).'</a></td>'. 
    515           '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->comment_dt).'</td>'. 
    516           '<td class="nowrap status txt-center">'.$img_status.'</td>'; 
     535          $cols = array( 
     536               'check' =>     '<td class="nowrap">'. 
     537                              form::checkbox(array('comments[]'),$this->rs->comment_id,$checked,'','',0).'</td>', 
     538               'type' => '<td class="nowrap" abbr="'.__('Type and author').'" scope="row">'. 
     539                              '<a href="'.$comment_url.'" title="'.$comment_title.'">'. 
     540                              '<img src="images/edit-mini.png" alt="'.__('Edit').'"/> '. 
     541                              ($this->rs->comment_trackback ? __('trackback') : __('comment')).' '.'</a></td>', 
     542               'author' =>    '<td class="nowrap maximal"><a href="'.$author_url.'">'. 
     543                              html::escapeHTML($this->rs->comment_author).'</a></td>', 
     544               'date'    =>   '<td class="nowrap count">'.dt::dt2str(__('%Y-%m-%d %H:%M'),$this->rs->comment_dt).'</td>', 
     545               'status' =>    '<td class="nowrap status txt-center">'.$img_status.'</td>' 
     546          ); 
     547 
    517548          if ($spam) { 
    518549               $filter_name = ''; 
     
    524555                    } 
    525556               } 
    526                $res .= 
    527                '<td class="nowrap"><a href="'.$core->adminurl->get("admin.comments",array('ip' => $this->rs->comment_ip)).'">'.$this->rs->comment_ip.'</a></td>'. 
    528                '<td class="nowrap">'.$filter_name.'</td>'; 
    529           } 
    530           $res .= 
    531           '<td class="nowrap discrete"><a href="'.$post_url.'">'. 
    532           $post_title.'</a>'. 
    533           ($this->rs->post_type != 'post' ? ' ('.html::escapeHTML($this->rs->post_type).')' : '').'</td>'; 
    534  
     557               $cols['ip'] = '<td class="nowrap"><a href="'. 
     558                    $core->adminurl->get("admin.comments",array('ip' => $this->rs->comment_ip)).'">'. 
     559                    $this->rs->comment_ip.'</a></td>'; 
     560               $cols['spam_filter'] = '<td class="nowrap">'.$filter_name.'</td>'; 
     561          } 
     562          $cols['entry'] = '<td class="nowrap discrete"><a href="'.$post_url.'">'.$post_title.'</a>'. 
     563               ($this->rs->post_type != 'post' ? ' ('.html::escapeHTML($this->rs->post_type).')' : '').'</td>'; 
     564 
     565          $cols = new ArrayObject($cols); 
     566          $this->core->callBehavior('adminCommentListValue',$this->core,$this->rs,$cols); 
     567 
     568          $res .= implode(iterator_to_array($cols)); 
    535569          $res .= '</tr>'; 
    536570 
     
    565599               } 
    566600 
    567                $html_block .= '<tr>'. 
    568                '<th colspan="2" scope="col" class="first">'.__('Username').'</th>'. 
    569                '<th scope="col">'.__('First Name').'</th>'. 
    570                '<th scope="col">'.__('Last Name').'</th>'. 
    571                '<th scope="col">'.__('Display name').'</th>'. 
    572                '<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>'. 
    573                '</tr>%s</table></div>'; 
    574  
     601               $cols = array( 
     602                    'username' =>       '<th colspan="2" scope="col" class="first">'.__('Username').'</th>', 
     603                    'first_name' =>          '<th scope="col">'.__('First Name').'</th>', 
     604                    'last_name' =>      '<th scope="col">'.__('Last Name').'</th>', 
     605                    'display_name' =>   '<th scope="col">'.__('Display name').'</th>', 
     606                    'entries' =>        '<th scope="col" class="nowrap">'.__('Entries (all types)').'</th>' 
     607               ); 
     608 
     609               $cols = new ArrayObject($cols); 
     610               $this->core->callBehavior('adminUserListHeader',$this->core,$this->rs,$cols); 
     611 
     612               $html_block .= '<tr>'.implode(iterator_to_array($cols)).'</tr>%s</table></div>'; 
    575613               if ($enclose_block) { 
    576614                    $html_block = sprintf($enclose_block,$html_block); 
     
    607645               $img_status = sprintf($img,__('superadmin'),'superadmin.png'); 
    608646          } 
    609           return 
    610           '<tr class="line">'. 
    611           '<td class="nowrap">'.form::hidden(array('nb_post[]'),(integer) $this->rs->nb_post). 
    612           form::checkbox(array('users[]'),$this->rs->user_id).'</td>'. 
    613           '<td class="maximal" scope="row"><a href="'.$this->core->adminurl->get('admin.user',array('id' => $this->rs->user_id)).'">'. 
    614           $this->rs->user_id.'</a>&nbsp;'.$img_status.'</td>'. 
    615           '<td class="nowrap">'.html::escapeHTML($this->rs->user_firstname).'</td>'. 
    616           '<td class="nowrap">'.html::escapeHTML($this->rs->user_name).'</td>'. 
    617           '<td class="nowrap">'.html::escapeHTML($this->rs->user_displayname).'</td>'. 
    618           '<td class="nowrap count"><a href="'.$this->core->adminurl->get('admin.posts',array('user_id' => $this->rs->user_id)).'">'. 
    619           $this->rs->nb_post.'</a></td>'. 
    620           '</tr>'; 
     647 
     648          $res = '<tr class="line">'; 
     649 
     650          $cols = array( 
     651               'check' =>               '<td class="nowrap">'.form::hidden(array('nb_post[]'),(integer) $this->rs->nb_post). 
     652                                        form::checkbox(array('users[]'),$this->rs->user_id).'</td>', 
     653               'username' =>       '<td class="maximal" scope="row"><a href="'. 
     654                                        $this->core->adminurl->get('admin.user',array('id' => $this->rs->user_id)).'">'. 
     655                                        $this->rs->user_id.'</a>&nbsp;'.$img_status.'</td>', 
     656               'first_name' =>          '<td class="nowrap">'.html::escapeHTML($this->rs->user_firstname).'</td>', 
     657               'last_name' =>      '<td class="nowrap">'.html::escapeHTML($this->rs->user_name).'</td>', 
     658               'display_name' =>   '<td class="nowrap">'.html::escapeHTML($this->rs->user_displayname).'</td>', 
     659               'entries' =>        '<td class="nowrap count"><a href="'. 
     660                                        $this->core->adminurl->get('admin.posts',array('user_id' => $this->rs->user_id)).'">'. 
     661                                        $this->rs->nb_post.'</a></td>' 
     662          ); 
     663 
     664          $cols = new ArrayObject($cols); 
     665          $this->core->callBehavior('adminUserListValue',$this->core,$this->rs,$cols); 
     666 
     667          $res .= implode(iterator_to_array($cols)); 
     668          $res .= '</tr>'; 
     669 
     670          return $res; 
    621671     } 
    622672} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map