Dotclear

Changeset 1476:c45f3be639b6


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

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/posts.php

    r1474 r1476  
    252252          )) 
    253253); 
    254  
     254if (!empty($_GET['upd'])) { 
     255     dcPage::message(__('Selected entries have been successfully updated.')); 
     256} elseif (!empty($_GET['del'])) { 
     257     dcPage::message(__('Selected entries have been successfully deleted.')); 
     258} 
    255259if (!$core->error->flag()) 
    256260{ 
  • 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?> 
  • inc/admin/lib.pager.php

    r1468 r1476  
    4242               $pager->html_next = $this->html_next; 
    4343               $pager->var_page = 'page'; 
    44                 
     44               $entries = array(); 
     45               if (isset($_REQUEST['entries'])) { 
     46                    foreach ($_REQUEST['entries'] as $v) { 
     47                         $entries[(integer)$v]=true; 
     48                    } 
     49               } 
    4550               $html_block = 
    4651               '<table class="clear"><tr>'. 
     
    6671               while ($this->rs->fetch()) 
    6772               { 
    68                     echo $this->postLine(); 
     73                    echo $this->postLine(isset($entries[$this->rs->post_id])); 
    6974               } 
    7075                
     
    7580     } 
    7681      
    77      private function postLine() 
     82     private function postLine($checked) 
    7883     { 
    7984          if ($this->core->auth->check('categories',$this->core->blog->id)) { 
     
    128133          $res .= 
    129134          '<td class="nowrap">'. 
    130           form::checkbox(array('entries[]'),$this->rs->post_id,'','','',!$this->rs->isEditable()).'</td>'. 
     135          form::checkbox(array('entries[]'),$this->rs->post_id,$checked,'','',!$this->rs->isEditable()).'</td>'. 
    131136          '<td class="maximal"><a href="'.$this->core->getPostAdminURL($this->rs->post_type,$this->rs->post_id).'">'. 
    132137          html::escapeHTML($this->rs->post_title).'</a></td>'. 
Note: See TracChangeset for help on using the changeset viewer.

Sites map