Dotclear


Ignore:
Timestamp:
08/19/13 16:38:02 (11 years ago)
Author:
Dsls
Branch:
default
Children:
1477:6ffbcd3cfb6f, 1480:9451796b02e2
Message:
  • Selection is kept when going back to entries
  • Notifications when applying changes
  • Added "back to entries" link

see #1540

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/posts_actions.php

    r1473 r1476  
    106106      
    107107    /** 
     108     * getEntriesQS - returns the list of entry fields as query string 
     109     * 
     110     * @access public 
     111      * @return the list of entry fields, html encoded 
     112     */ 
     113     public function getEntriesQS() { 
     114          $ret=array(); 
     115          foreach ($this->entries as $id=>$title) { 
     116               $ret[] = 'entries[]='.$id; 
     117          } 
     118          return join('&',$ret); 
     119     } 
     120      
     121    /** 
    108122     * __toString - magic method. -- DEPRECATED here 
    109123      *              This method is only used to preserve compatibility with plugins  
     
    118132} 
    119133 
    120  
    121 function listEntries($titles) { 
    122      $ret =  
    123           '<table class="posts-list"><tr>'. 
    124           '<th colspan="2">'.__('Title').'</th>'. 
    125           '</tr>'; 
    126      foreach ($titles as $id=>$title) { 
    127           $ret .=  
    128                '<tr><td>'. 
    129                form::checkbox(array('entries[]'),$id,true,'','').'</td>'. 
    130                '<td>'.   $title.'</td></tr>'; 
    131      } 
    132      $ret .= '</table>'; 
    133      return $ret; 
    134 } 
     134$fields = new FieldsList(); 
    135135 
    136136/* Actions 
     
    179179     while ($posts->fetch())  { 
    180180          $posts_ids[] = $posts->post_id; 
    181      } 
     181          $fields->addEntry($posts->post_id,$posts->post_title); 
     182     } 
     183     // Redirection including selected entries 
     184     $redir_sel = $redir.'&'.$fields->getEntriesQS(); 
    182185      
    183186     # --BEHAVIOR-- adminPostsActions 
     
    197200               $core->blog->updPostsStatus($posts_ids,$status); 
    198201                
    199                http::redirect($redir); 
     202               http::redirect($redir_sel.'&upd=1'); 
    200203          } 
    201204          catch (Exception $e) 
     
    210213               $core->blog->updPostsSelected($posts_ids,$action == 'selected'); 
    211214                
    212                http::redirect($redir); 
     215               http::redirect($redir_sel."&upd=1"); 
    213216          } 
    214217          catch (Exception $e) 
     
    233236               $core->blog->delPosts($posts_ids); 
    234237                
    235                http::redirect($redir); 
     238               http::redirect($redir."&del=1"); 
    236239          } 
    237240          catch (Exception $e) 
     
    266269               $core->blog->updPostsCategory($posts_ids, $new_cat_id); 
    267270                
    268                http::redirect($redir); 
     271               http::redirect($redir_sel."&upd=1"); 
    269272          } 
    270273          catch (Exception $e) 
     
    288291               $cur->update('WHERE post_id '.$core->con->in($posts_ids)); 
    289292                
    290                http::redirect($redir); 
     293               http::redirect($redir_sel."&upd=1"); 
    291294          } 
    292295          catch (Exception $e) 
     
    304307               $cur->update('WHERE post_id '.$core->con->in($posts_ids)); 
    305308                
    306                http::redirect($redir); 
     309               http::redirect($redir_sel."&upd=1"); 
    307310          } 
    308311          catch (Exception $e) 
     
    325328          )) 
    326329     ); 
     330      
     331     echo '<p><a class="back" href="'.html::escapeURL($redir_sel).'">'.__('Back to entries list').'</a></p>'; 
    327332 
    328333     dcPage::close(); 
     
    361366     dcPage::close(); 
    362367     exit; 
    363 } 
    364  
    365 $fields = new FieldsList(); 
    366 while ($posts->fetch()) { 
    367      $fields->addEntry($posts->post_id,$posts->post_title); 
    368368} 
    369369 
     
    403403               __('Change category for entries') => '' 
    404404     )); 
     405      
     406     echo '<p><a class="back" href="'.html::escapeURL($redir_sel).'">'.__('Back to entries list').'</a></p>'; 
    405407 
    406408     # categories list 
     
    452454               '<span class="page-title">'.__('Change language for entries').'</span>' => '' 
    453455     )); 
    454       
     456     echo '<p><a class="back" href="'.html::escapeURL($redir_sel).'">'.__('Back to entries list').'</a></p>'; 
     457 
    455458     # lang list 
    456459     # Languages combo 
     
    492495               '<span class="page-title">'.__('Change author for entries').'</span>' => '' 
    493496     )); 
    494       
     497     echo '<p><a class="back" href="'.html::escapeURL($redir_sel).'">'.__('Back to entries list').'</a></p>'; 
     498 
    495499     echo 
    496500     '<form action="posts_actions.php" method="post">'. 
     
    507511} 
    508512 
    509 echo '<p><a class="back" href="'.html::escapeURL($redir).'">'.__('back').'</a></p>'; 
    510  
    511513dcPage::close(); 
    512514?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map