Dotclear


Ignore:
Files:
6 added
10 edited

Legend:

Unmodified
Added
Removed
  • admin/comments.php

    r1912 r1999  
    131131$combo_action = array(); 
    132132$default = ''; 
    133 if ($core->auth->check('publish,contentadmin',$core->blog->id)) 
     133if ($core->auth->check('delete,contentadmin',$core->blog->id) && $status == -2) 
    134134{ 
    135      $combo_action[__('Publish')] = 'publish'; 
    136      $combo_action[__('Unpublish')] = 'unpublish'; 
    137      $combo_action[__('Mark as pending')] = 'pending'; 
    138      $combo_action[__('Mark as junk')] = 'junk'; 
    139 } 
    140 if ($core->auth->check('delete,contentadmin',$core->blog->id)) 
    141 { 
    142      $combo_action[__('Delete')] = 'delete'; 
    143      if ($status == -2) { 
    144           $default = 'delete'; 
    145      } 
    146 } 
    147  
    148 # --BEHAVIOR-- adminCommentsActionsCombo 
    149 $core->callBehavior('adminCommentsActionsCombo',array(&$combo_action)); 
     135     $default = 'delete'; 
     136} 
     137 
     138$comments_actions_page = new dcCommentsActionsPage($core,'comments.php'); 
     139 
     140$comments_actions_page->process(); 
    150141 
    151142/* Get comments 
     
    165156     $starting_script .= dcPage::jsLoad('js/filter-controls.js'); 
    166157} 
    167 # --BEHAVIOR-- adminCommentsHeaders 
    168 $starting_script .= $core->callBehavior('adminCommentsHeaders'); 
    169158 
    170159dcPage::open(__('Comments and trackbacks'),$starting_script, 
     
    175164          )) 
    176165); 
     166if (!empty($_GET['upd'])) { 
     167     dcPage::success(__('Selected comments have been successfully updated.')); 
     168} elseif (!empty($_GET['del'])) { 
     169     dcPage::success(__('Selected comments have been successfully deleted.')); 
     170} 
    177171 
    178172if (!$core->error->flag()) 
     
    254248     # Show comments 
    255249     $comment_list->display($page,$nb_per_page, 
    256      '<form action="comments_actions.php" method="post" id="form-comments">'. 
     250     '<form action="comments.php" method="post" id="form-comments">'. 
    257251      
    258252     '%s'. 
     
    262256      
    263257     '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 
    264      form::combo('action',$combo_action,$default,'','','','title="'.__('Actions').'"'). 
     258     form::combo('action',$comments_actions_page->getCombo(),$default,'','','','title="'.__('Actions').'"'). 
    265259     $core->formNonce(). 
    266260     '<input type="submit" value="'.__('ok').'" /></p>'. 
  • admin/comments_actions.php

    r1474 r1905  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212 
     13/* ### THIS FILE IS DEPRECATED                         ### */ 
     14/* ### IT IS ONLY USED FOR PLUGINS COMPATIBILITY ### */ 
     15 
    1316require dirname(__FILE__).'/../inc/admin/prepend.php'; 
    1417 
    1518dcPage::check('usage,contentadmin'); 
    1619 
    17 $params = array(); 
    18 $redir = 'comments.php'; 
     20$comments_actions_page = new dcCommentsActionsPage($core,'posts.php'); 
    1921 
    20 if (!empty($_POST['action']) && !empty($_POST['comments'])) 
    21 { 
    22      $comments = $_POST['comments']; 
    23      $action = $_POST['action']; 
    24       
    25      if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false) 
    26      { 
    27           $redir = $_POST['redir']; 
    28      } 
    29      else 
    30      { 
    31           $redir = 
    32           'comments.php?type='.$_POST['type']. 
    33           '&author='.$_POST['author']. 
    34           '&status='.$_POST['status']. 
    35           '&sortby='.$_POST['sortby']. 
    36           '&ip='.$_POST['ip']. 
    37           '&order='.$_POST['order']. 
    38           '&page='.$_POST['page']. 
    39           '&nb='.(integer) $_POST['nb']; 
    40      } 
    41       
    42      foreach ($comments as $k => $v) { 
    43           $comments[$k] = (integer) $v; 
    44      } 
    45       
    46      $params['sql'] = 'AND C.comment_id IN('.implode(',',$comments).') '; 
    47       
    48      if (!isset($_POST['full_content']) || empty($_POST['full_content'])) { 
    49           $params['no_content'] = true; 
    50      } 
    51       
    52      $co = $core->blog->getComments($params); 
    53       
    54      $co_ids = array(); 
    55      while ($co->fetch())     { 
    56           $co_ids[] = $co->comment_id; 
    57      } 
    58       
    59      # --BEHAVIOR-- adminCommentsActions 
    60      $core->callBehavior('adminCommentsActions',$core,$co,$action,$redir); 
    61       
    62      if (preg_match('/^(publish|unpublish|pending|junk)$/',$action)) 
    63      { 
    64           switch ($action) { 
    65                case 'unpublish' : $status = 0; break; 
    66                case 'pending' : $status = -1; break; 
    67                case 'junk' : $status = -2; break; 
    68                default : $status = 1; break; 
    69           } 
    70            
    71           try { 
    72                $core->blog->updCommentsStatus($co_ids,$status); 
    73           } catch (Exception $e) { 
    74                $core->error->add($e->getMessage()); 
    75           } 
    76            
    77           if (!$core->error->flag()) { 
    78                http::redirect($redir); 
    79           } 
    80      } 
    81      elseif ($action == 'delete') 
    82      { 
    83           try { 
    84                // Backward compatibility 
    85                foreach($co_ids as $comment_id) 
    86                { 
    87                     # --BEHAVIOR-- adminBeforeCommentDelete 
    88                     $core->callBehavior('adminBeforeCommentDelete',$comment_id);                     
    89                } 
    90                 
    91                # --BEHAVIOR-- adminBeforeCommentsDelete 
    92                $core->callBehavior('adminBeforeCommentsDelete',$co_ids); 
    93                 
    94                $core->blog->delComments($co_ids); 
    95           } catch (Exception $e) { 
    96                $core->error->add($e->getMessage()); 
    97           } 
    98            
    99           if (!$core->error->flag()) { 
    100                http::redirect($redir); 
    101           } 
    102      } 
    103 } 
     22$comments_actions_page->process(); 
    10423 
    105 /* DISPLAY 
    106 -------------------------------------------------------- */ 
    107 dcPage::open(__('Comments')); 
    108  
    109 if (!isset($action)) { 
    110      dcPage::close(); 
    111      exit; 
    112 } 
    113  
    114 $hidden_fields = ''; 
    115 while ($co->fetch()) { 
    116      $hidden_fields .= form::hidden(array('comments[]'),$co->comment_id); 
    117 }  
    118  
    119 if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false) 
    120 { 
    121      $hidden_fields .= form::hidden(array('redir'),html::escapeURL($_POST['redir'])); 
    122 } 
    123 else 
    124 { 
    125      $hidden_fields .= 
    126      form::hidden(array('type'),$_POST['type']). 
    127      form::hidden(array('author'),$_POST['author']). 
    128      form::hidden(array('status'),$_POST['status']). 
    129      form::hidden(array('sortby'),$_POST['sortby']). 
    130      form::hidden(array('ip'),$_POST['ip']). 
    131      form::hidden(array('order'),$_POST['order']). 
    132      form::hidden(array('page'),$_POST['page']). 
    133      form::hidden(array('nb'),$_POST['nb']); 
    134 } 
    135  
    136 # --BEHAVIOR-- adminCommentsActionsContent 
    137 $core->callBehavior('adminCommentsActionsContent',$core,$action,$hidden_fields); 
    138  
    139 echo '<p><a class="back" href="'.str_replace('&','&amp;',$redir).'">'.__('Back to comments list').'</a></p>'; 
    140  
    141 dcPage::close(); 
    14224?> 
  • admin/js/_posts_actions.js

    r1638 r1806  
    11$(function() { 
    2      $('#new_auth_id').autocomplete(usersList, 
    3      { 
    4           delay: 1000, 
    5           matchSubset: true, 
    6           matchContains: true 
    7      }); 
     2     new_auth_id = $('#new_auth_id'); 
     3     if (new_auth_id.length) { 
     4          new_auth_id.autocomplete(usersList, 
     5          { 
     6               delay: 1000, 
     7               matchSubset: true, 
     8               matchContains: true 
     9          }); 
     10     } 
    811     $('#new_cat').toggleWithLegend($('#new_cat').parent().children().not('#new_cat'), { 
    912          // no cookie on new category as we don't use this every day 
  • admin/posts.php

    r1912 r1999  
    103103 
    104104# Actions combo box 
    105 $combo_action = array(); 
    106 if ($core->auth->check('publish,contentadmin',$core->blog->id)) 
    107 { 
    108      $combo_action[__('Status')] = array( 
    109           __('Publish') => 'publish', 
    110           __('Unpublish') => 'unpublish', 
    111           __('Schedule') => 'schedule', 
    112           __('Mark as pending') => 'pending' 
    113      ); 
    114 } 
    115 $combo_action[__('Mark')] = array( 
    116      __('Mark as selected') => 'selected', 
    117      __('Mark as unselected') => 'unselected' 
    118 ); 
    119 $combo_action[__('Change')] = array( 
    120      __('Change category') => 'category', 
    121      __('Change language') => 'lang'); 
    122 if ($core->auth->check('admin',$core->blog->id)) 
    123 { 
    124      $combo_action[__('Change')] = array_merge($combo_action[__('Change')], 
    125           array(__('Change author') => 'author')); 
    126 } 
    127 if ($core->auth->check('delete,contentadmin',$core->blog->id)) 
    128 { 
    129      $combo_action[__('Delete')] = array(__('Delete') => 'delete'); 
    130 } 
    131  
    132 # --BEHAVIOR-- adminPostsActionsCombo 
    133 $core->callBehavior('adminPostsActionsCombo',array(&$combo_action)); 
     105 
     106$posts_actions_page = new dcPostsActionsPage($core,'posts.php'); 
     107 
     108$posts_actions_page->process(); 
    134109 
    135110/* Get posts 
     
    304279     # Show posts 
    305280     $post_list->display($page,$nb_per_page, 
    306      '<form action="posts_actions.php" method="post" id="form-entries">'. 
     281     '<form action="posts.php" method="post" id="form-entries">'. 
    307282      
    308283     '%s'. 
     
    312287      
    313288     '<p class="col right"><label for="action" class="classic">'.__('Selected entries action:').'</label> '. 
    314      form::combo('action',$combo_action). 
     289     form::combo('action',$posts_actions_page->getCombo()). 
    315290     '<input type="submit" value="'.__('ok').'" /></p>'. 
    316291     form::hidden(array('user_id'),$user_id). 
  • admin/posts_actions.php

    r1964 r1999  
    1111# -- END LICENSE BLOCK ----------------------------------------- 
    1212 
     13/* ### THIS FILE IS DEPRECATED                         ### */ 
     14/* ### IT IS ONLY USED FOR PLUGINS COMPATIBILITY ### */ 
     15 
    1316require dirname(__FILE__).'/../inc/admin/prepend.php'; 
    1417 
    1518dcPage::check('usage,contentadmin'); 
    1619 
    17 $params = array(); 
     20$posts_actions_page = new dcPostsActionsPage($core,'posts.php'); 
    1821 
    19 /** 
    20 * FieldsList - Compatibility class for hidden fields & entries[] fields 
    21 * 
    22 */ 
    23 class FieldsList { 
    24      /** @var array list of hidden fields */ 
    25      protected $hidden; 
    26      /** @var array list of selected entries */ 
    27      protected $entries; 
     22$posts_actions_page->process(); 
    2823 
    29  
    30    /** 
    31      * Class constructor 
    32      */ 
    33      public function __construct() { 
    34           $this->hidden=array(); 
    35           $this->entries =array(); 
    36      } 
    37  
    38     /** 
    39      * addHidden - adds a hidden field 
    40      *  
    41      * @param string $name the field name. 
    42      * @param mixed $value the field value. 
    43      * 
    44      * @access public 
    45       * @return the FieldsList instance, enabling to chain requests 
    46      */    
    47       public function addHidden($name,$value) { 
    48           $this->hidden[] = form::hidden($name,$value); 
    49           return $this; 
    50      } 
    51  
    52     /** 
    53      * addEntry - adds a antry field 
    54      *  
    55      * @param string $id the entry id. 
    56      * @param mixed $title the entry title. 
    57      * 
    58      * @access public 
    59       * @return the FieldsList instance, enabling to chain requests 
    60      */    
    61       public function addEntry($id,$title) { 
    62           $this->entries[$id]=$title; 
    63           return $this; 
    64      } 
    65  
    66     /** 
    67      * getHidden - returns the list of hidden fields, html encoded 
    68      * 
    69      * @access public 
    70       * @return the list of hidden fields, html encoded 
    71      */ 
    72       public function getHidden() { 
    73           return join('',$this->hidden); 
    74      } 
    75       
    76     /** 
    77      * getEntries - returns the list of entry fields, html encoded 
    78      * 
    79       * @param boolean $hidden if set to true, returns entries as a list of hidden field 
    80       *                if set to false, returns html code displaying the list of entries 
    81       *                with a list of checkboxes to enable to select/deselect entries 
    82      * @access public 
    83       * @return the list of entry fields, html encoded 
    84      */ 
    85      public function getEntries ($hidden=false) { 
    86           $ret = ''; 
    87           if ($hidden) { 
    88                foreach ($this->entries as $id=> $e) { 
    89                     $ret .= form::hidden('entries[]',$id); 
    90                } 
    91           } else { 
    92                $ret =  
    93                     '<table class="posts-list"><tr>'. 
    94                     '<th colspan="2">'.__('Title').'</th>'. 
    95                     '</tr>'; 
    96                foreach ($this->entries as $id=>$title) { 
    97                     $ret .=  
    98                          '<tr><td>'. 
    99                          form::checkbox(array('entries[]'),$id,true,'','').'</td>'. 
    100                          '<td>'.   $title.'</td></tr>'; 
    101                } 
    102                $ret .= '</table>'; 
    103           } 
    104           return $ret; 
    105      } 
    106       
    107     /** 
    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     /** 
    122      * __toString - magic method. -- DEPRECATED here 
    123       *              This method is only used to preserve compatibility with plugins  
    124       *                  relying on previous versions of adminPostsActionsContent behavior,  
    125       * 
    126      * @access public 
    127       * @return the list of hidden fields and entries (as hidden fields too), html encoded 
    128      */ 
    129      public function __toString() { 
    130           return join('',$this->hidden).$this->getEntries(true); 
    131      } 
    132 } 
    133  
    134 $fields = new FieldsList(); 
    135 $posts_ids = array(); 
    136  
    137 if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false) 
    138 { 
    139      $redir = $_POST['redir']; 
    140 } 
    141 else 
    142 { 
    143      $redir = 
    144      'posts.php?user_id='.$_POST['user_id']. 
    145      '&cat_id='.$_POST['cat_id']. 
    146      '&status='.$_POST['status']. 
    147      '&selected='.$_POST['selected']. 
    148      '&month='.$_POST['month']. 
    149      '&lang='.$_POST['lang']. 
    150      '&sortby='.$_POST['sortby']. 
    151      '&order='.$_POST['order']. 
    152      '&page='.$_POST['page']. 
    153      '&nb='.$_POST['nb']; 
    154 } 
    155 $redir_sel = $redir; 
    156  
    157 if (!empty($_POST['entries'])) 
    158 { 
    159      $entries = $_POST['entries']; 
    160       
    161      foreach ($entries as $k => $v) { 
    162           $entries[$k] = (integer) $v; 
    163      } 
    164       
    165      $params['sql'] = 'AND P.post_id IN('.implode(',',$entries).') '; 
    166       
    167      if (!isset($_POST['full_content']) || empty($_POST['full_content'])) { 
    168           $params['no_content'] = true; 
    169      } 
    170       
    171      if (isset($_POST['post_type'])) { 
    172           $params['post_type'] = $_POST['post_type']; 
    173      } 
    174       
    175      $posts = $core->blog->getPosts($params); 
    176      while ($posts->fetch())  { 
    177           $posts_ids[] = $posts->post_id; 
    178           $fields->addEntry($posts->post_id,$posts->post_title); 
    179      } 
    180      // Redirection including selected entries 
    181      $redir_sel = $redir.'&'.$fields->getEntriesQS(); 
    182  
    183 } else { 
    184      $posts = $core->con->select("SELECT blog_id FROM ".$core->prefix."blog WHERE false");; 
    185 } 
    186  
    187 /* Actions 
    188 -------------------------------------------------------- */ 
    189 if (!empty($_POST['action'])) 
    190 { 
    191      $action = $_POST['action']; 
    192 }  
    193 else 
    194 { 
    195      $core->error->add(__('No action specified.')); 
    196      dcPage::open( 
    197           __('Entries'),'',dcPage::breadcrumb( 
    198           array( 
    199                html::escapeHTML($core->blog->name) => '', 
    200                __('Entries') => 'posts.php', 
    201                '<span class="page-title">'.__('Entries actions').'</span>' => '' 
    202           )) 
    203      ); 
    204       
    205      echo '<p><a class="back" href="'.html::escapeURL($redir_sel).'">'.__('Back to entries list').'</a></p>'; 
    206  
    207      dcPage::close(); 
    208      exit; 
    209 } 
    210  
    211 # --BEHAVIOR-- adminPostsActions 
    212 $core->callBehavior('adminPostsActions',$core,$posts,$action,$redir); 
    213  
    214 if (preg_match('/^(publish|unpublish|schedule|pending)$/',$action)) 
    215 { 
    216      switch ($action) { 
    217           case 'unpublish' : $status = 0; break; 
    218           case 'schedule' : $status = -1; break; 
    219           case 'pending' : $status = -2; break; 
    220           default : $status = 1; break; 
    221      } 
    222       
    223      try 
    224      { 
    225           $core->blog->updPostsStatus($posts_ids,$status); 
    226            
    227           http::redirect($redir_sel.'&upd=1'); 
    228      } 
    229      catch (Exception $e) 
    230      { 
    231           $core->error->add($e->getMessage()); 
    232      } 
    233 } 
    234 elseif ($action == 'selected' || $action == 'unselected') 
    235 { 
    236      try 
    237      { 
    238           $core->blog->updPostsSelected($posts_ids,$action == 'selected'); 
    239            
    240           http::redirect($redir_sel."&upd=1"); 
    241      } 
    242      catch (Exception $e) 
    243      { 
    244           $core->error->add($e->getMessage()); 
    245      } 
    246 } 
    247 elseif ($action == 'delete') 
    248 { 
    249      try 
    250      { 
    251           // Backward compatibility 
    252           foreach($posts_ids as $post_id) 
    253           { 
    254                # --BEHAVIOR-- adminBeforePostDelete 
    255                $core->callBehavior('adminBeforePostDelete',(integer) $post_id); 
    256           } 
    257            
    258           # --BEHAVIOR-- adminBeforePostsDelete 
    259           $core->callBehavior('adminBeforePostsDelete',$posts_ids); 
    260            
    261           $core->blog->delPosts($posts_ids); 
    262            
    263           http::redirect($redir."&del=1"); 
    264      } 
    265      catch (Exception $e) 
    266      { 
    267           $core->error->add($e->getMessage()); 
    268      } 
    269       
    270 } 
    271 elseif ($action == 'category' && isset($_POST['new_cat_id'])) 
    272 { 
    273      $new_cat_id = $_POST['new_cat_id']; 
    274       
    275      try 
    276      { 
    277           if (!empty($_POST['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) 
    278           { 
    279                $cur_cat = $core->con->openCursor($core->prefix.'category'); 
    280                $cur_cat->cat_title = $_POST['new_cat_title']; 
    281                $cur_cat->cat_url = ''; 
    282                 
    283                $parent_cat = !empty($_POST['new_cat_parent']) ? $_POST['new_cat_parent'] : ''; 
    284                 
    285                # --BEHAVIOR-- adminBeforeCategoryCreate 
    286                $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); 
    287                 
    288                $new_cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat); 
    289                 
    290                # --BEHAVIOR-- adminAfterCategoryCreate 
    291                $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $new_cat_id); 
    292           } 
    293            
    294           $core->blog->updPostsCategory($posts_ids, $new_cat_id); 
    295            
    296           http::redirect($redir_sel."&upd=1"); 
    297      } 
    298      catch (Exception $e) 
    299      { 
    300           $core->error->add($e->getMessage()); 
    301      } 
    302 } 
    303 elseif ($action == 'author' && isset($_POST['new_auth_id']) 
    304 && $core->auth->check('admin',$core->blog->id)) 
    305 { 
    306      $new_user_id = $_POST['new_auth_id']; 
    307       
    308      try 
    309      { 
    310           if ($core->getUser($new_user_id)->isEmpty()) { 
    311                throw new Exception(__('This user does not exist')); 
    312           } 
    313            
    314           $cur = $core->con->openCursor($core->prefix.'post'); 
    315           $cur->user_id = $new_user_id; 
    316           $cur->update('WHERE post_id '.$core->con->in($posts_ids)); 
    317            
    318           http::redirect($redir_sel."&upd=1"); 
    319      } 
    320      catch (Exception $e) 
    321      { 
    322           $core->error->add($e->getMessage()); 
    323      } 
    324 } 
    325 elseif ($action == 'lang' && isset($_POST['new_lang'])) 
    326 { 
    327      $new_lang = $_POST['new_lang']; 
    328      try 
    329      { 
    330           $cur = $core->con->openCursor($core->prefix.'post'); 
    331           $cur->post_lang = $new_lang; 
    332           $cur->update('WHERE post_id '.$core->con->in($posts_ids)); 
    333            
    334           http::redirect($redir_sel."&upd=1"); 
    335      } 
    336      catch (Exception $e) 
    337      { 
    338           $core->error->add($e->getMessages()); 
    339      } 
    340 } 
    341  
    342 /* DISPLAY 
    343 -------------------------------------------------------- */ 
    344 // Get current users list 
    345 $usersList = ''; 
    346 if ($action == 'author' && $core->auth->check('admin',$core->blog->id)) { 
    347      $params = array( 
    348           'limit' => 100, 
    349           'order' => 'nb_post DESC' 
    350           ); 
    351      $rs = $core->getUsers($params); 
    352      while ($rs->fetch()) 
    353      { 
    354           $usersList .= ($usersList != '' ? ',' : '').'"'.$rs->user_id.'"'; 
    355      } 
    356 } 
    357 dcPage::open( 
    358      __('Entries'), 
    359      '<script type="text/javascript">'."\n". 
    360      "//<![CDATA[\n". 
    361      'usersList = ['.$usersList.']'."\n". 
    362      "\n//]]>\n". 
    363      "</script>\n". 
    364      dcPage::jsLoad('js/jquery/jquery.autocomplete.js'). 
    365      dcPage::jsLoad('js/_posts_actions.js'). 
    366      dcPage::jsMetaEditor(). 
    367      # --BEHAVIOR-- adminBeforePostDelete 
    368      $core->callBehavior('adminPostsActionsHeaders') 
    369 ); 
    370  
    371 if (!isset($action)) { 
    372      dcPage::close(); 
    373      exit; 
    374 } 
    375  
    376 if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false) 
    377 { 
    378      $fields->addHidden(array('redir'),html::escapeURL($_POST['redir'])); 
    379 } 
    380 else 
    381 { 
    382      $fields 
    383           ->addHidden(array('user_id'),$_POST['user_id']) 
    384           ->addHidden(array('cat_id'),$_POST['cat_id']) 
    385           ->addHidden(array('status'),$_POST['status']) 
    386           ->addHidden(array('selected'),$_POST['selected']) 
    387           ->addHidden(array('month'),$_POST['month']) 
    388           ->addHidden(array('lang'),$_POST['lang']) 
    389           ->addHidden(array('sortby'),$_POST['sortby']) 
    390           ->addHidden(array('order'),$_POST['order']) 
    391           ->addHidden(array('page'),$_POST['page']) 
    392           ->addHidden(array('nb'),$_POST['nb']) 
    393      ; 
    394 } 
    395  
    396 if (isset($_POST['post_type'])) { 
    397      $fields->addHidden(array('post_type'),$_POST['post_type']); 
    398 } 
    399  
    400 # --BEHAVIOR-- adminPostsActionsContent 
    401 $core->callBehavior('adminPostsActionsContent',$core,$action,$fields); 
    402  
    403 if ($action == 'category') 
    404 { 
    405      echo dcPage::breadcrumb( 
    406           array( 
    407                html::escapeHTML($core->blog->name) => '', 
    408                __('Entries') => 'posts.php', 
    409                '<span class="page-title">'.__('Change category for this selection').'</span>' => '' 
    410      )); 
    411       
    412      echo '<p><a class="back" href="'.html::escapeURL($redir_sel).'">'.__('Back to entries list').'</a></p>'; 
    413  
    414      # categories list 
    415      # Getting categories 
    416      $categories_combo = dcAdminCombos::getCategoriesCombo( 
    417           $core->blog->getCategories(array('post_type'=>'post')) 
    418      ); 
    419       
    420      echo 
    421      '<form action="posts_actions.php" method="post">'. 
    422      $fields->getEntries(). 
    423      '<p><label for="new_cat_id" class="classic">'.__('Category:').'</label> '. 
    424      form::combo('new_cat_id',$categories_combo,''); 
    425       
    426      if ($core->auth->check('categories', $core->blog->id)) { 
    427           echo  
    428           '<div>'. 
    429           '<p id="new_cat">'.__('Create a new category for the post(s)').'</p>'. 
    430           '<p><label for="new_cat_title">'.__('Title:').'</label> '. 
    431           form::field('new_cat_title',30,255,'','').'</p>'. 
    432           '<p><label for="new_cat_parent">'.__('Parent:').'</label> '. 
    433           form::combo('new_cat_parent',$categories_combo,'',''). 
    434           '</p>'. 
    435           '</div>'; 
    436      } 
    437       
    438      echo 
    439      $fields->getHidden(). 
    440      $core->formNonce(). 
    441      form::hidden(array('action'),'category'). 
    442      '<input type="submit" value="'.__('Save').'" /></p>'. 
    443      '</form>'; 
    444 } 
    445 elseif ($action == 'lang') 
    446 { 
    447      echo dcPage::breadcrumb( 
    448           array( 
    449                html::escapeHTML($core->blog->name) => '', 
    450                __('Entries') => 'posts.php', 
    451                '<span class="page-title">'.__('Change language for this selection').'</span>' => '' 
    452      )); 
    453      echo '<p><a class="back" href="'.html::escapeURL($redir_sel).'">'.__('Back to entries list').'</a></p>'; 
    454  
    455      # lang list 
    456      # Languages combo 
    457      $rs = $core->blog->getLangs(array('order'=>'asc')); 
    458      $lang_combo = dcAdminCombos::getLangsCombo($rs,true); 
    459       
    460      echo 
    461      '<form action="posts_actions.php" method="post">'. 
    462      $fields->getEntries(). 
    463       
    464      '<p><label for="new_lang" class="classic">'.__('Entry language:').'</label> '. 
    465      form::combo('new_lang',$lang_combo,''); 
    466       
    467      echo 
    468      $fields->getHidden(). 
    469      $core->formNonce(). 
    470      form::hidden(array('action'),'lang'). 
    471      '<input type="submit" value="'.__('Save').'" /></p>'. 
    472      '</form>'; 
    473  
    474 } 
    475 elseif ($action == 'author' && $core->auth->check('admin',$core->blog->id)) 
    476 { 
    477      echo dcPage::breadcrumb( 
    478           array( 
    479                html::escapeHTML($core->blog->name) => '', 
    480                __('Entries') => 'posts.php', 
    481                '<span class="page-title">'.__('Change author for this selection').'</span>' => '' 
    482      )); 
    483      echo '<p><a class="back" href="'.html::escapeURL($redir_sel).'">'.__('Back to entries list').'</a></p>'; 
    484  
    485      echo 
    486      '<form action="posts_actions.php" method="post">'. 
    487      $fields->getEntries(). 
    488      '<p><label for="new_auth_id" class="classic">'.__('New author (author ID):').'</label> '. 
    489      form::field('new_auth_id',20,255); 
    490       
    491      echo 
    492      $fields->getHidden(). 
    493      $core->formNonce(). 
    494      form::hidden(array('action'),'author'). 
    495      '<input type="submit" value="'.__('Save').'" /></p>'. 
    496      '</form>'; 
    497 } 
    498  
    499 dcPage::close(); 
    50024?> 
  • inc/admin/lib.pager.php

    r1998 r1999  
    370370               $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); 
    371371                
     372               $comments = array(); 
     373               if (isset($_REQUEST['comments'])) { 
     374                    foreach ($_REQUEST['comments'] as $v) { 
     375                         $comments[(integer)$v]=true; 
     376                    } 
     377               }               
    372378               $html_block = 
    373379               '<table><caption class="hidden">'.__('Comments and trackbacks list').'</caption><tr>'. 
     
    400406     } 
    401407      
    402      private function commentLine() 
     408     private function commentLine($checked) 
    403409     { 
    404410          global $author, $status, $sortby, $order, $nb_per_page; 
  • inc/prepend.php

    r1949 r1999  
    6565$__autoload['context']                  = dirname(__FILE__).'/public/lib.tpl.context.php'; 
    6666$__autoload['dcUrlHandlers']            = dirname(__FILE__).'/public/lib.urlhandlers.php'; 
     67$__autoload['dcPostsActionsPage']            = dirname(__FILE__).'/admin/actions/class.dcactionposts.php'; 
     68$__autoload['dcCommentsActionsPage']              = dirname(__FILE__).'/admin/actions/class.dcactioncomments.php'; 
     69$__autoload['dcActionsPage']            = dirname(__FILE__).'/admin/actions/class.dcaction.php'; 
    6770 
    6871# Clearbricks extensions 
  • plugins/pages/index.php

    r1179 r1903  
    1212if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1313 
    14 $act = (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'page') ? 'page' : 'list'; 
     14$act = !empty($_REQUEST['act']) ? $_REQUEST['act'] : 'list'; 
    1515 
    1616 
     
    2020     include dirname(__FILE__).'/list.php'; 
    2121} 
    22  
    23 ?> 
  • plugins/pages/list.php

    r1926 r1999  
    2828                
    2929               $html_block = 
    30                '<table class="clear"><tr>'. 
    31                '<th colspan="2">'.__('Title').'</th>'. 
     30               '<table class="maximal dragable"><thead><tr>'. 
     31               '<th colspan="3">'.__('Title').'</th>'. 
    3232               '<th>'.__('Date').'</th>'. 
    3333               '<th>'.__('Author').'</th>'. 
     
    3535               '<th>'.__('Trackbacks').'</th>'. 
    3636               '<th>'.__('Status').'</th>'. 
    37                '</tr>%s</table>'; 
     37               '</tr></thead><tbody id="pageslist">%s</tbody></table>'; 
    3838                
    3939               if ($enclose_block) { 
     
    4747               echo $blocks[0]; 
    4848                
     49               $count = 0; 
    4950               while ($this->rs->fetch()) 
    5051               { 
    51                     echo $this->postLine(); 
     52                    echo $this->postLine($count); 
     53                    $count ++; 
    5254               } 
    5355                
     
    5860     } 
    5961      
    60      private function postLine() 
     62     private function postLine($count) 
    6163     { 
    6264          $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
     
    9799           
    98100          $res .= 
     101          '<td class="nowrap handle minimal">'.form::field(array('order['.$this->rs->post_id.']'),2,3,$count+1,'position','',false,'title="'.sprintf(__('position of %s'),html::escapeHTML($this->rs->post_title)).'"').'</td>'. 
    99102          '<td class="nowrap">'. 
    100103          form::checkbox(array('entries[]'),$this->rs->post_id,'','','',!$this->rs->isEditable(),'title="'.__('Select this page').'"').'</td>'. 
     
    138141} 
    139142 
     143class dcPagesActionsPage extends dcPostsActionsPage { 
     144 
     145     public function __construct($core,$uri,$redirect_args=array()) { 
     146          parent::__construct($core,$uri,$redirect_args); 
     147          $this->redirect_fields = array(); 
     148 
     149     } 
     150      
     151     public function beginPage($breadcrumb='',$header='') { 
     152          echo '<html><head><title>'.__('Pages').'</title>'. 
     153               dcPage::jsLoad('index.php?pf=pages/list.js'). 
     154               # --BEHAVIOR-- adminBeforePostDelete 
     155               $core->callBehavior('adminPagesActionsHeaders'). 
     156               '<script type="text/javascript">'. 
     157               '//<![CDATA['. 
     158               dcPage::jsVar('dotclear.msg.confirm_delete_posts',__("Are you sure you want to delete selected pages?")). 
     159               '//]]>'. 
     160               '</script></head><body>'; 
     161     } 
     162      
     163     public function endPage() { 
     164          echo '</body></html>'; 
     165     } 
     166     public function loadDefaults() { 
     167          parent::loadDefaults(); 
     168          unset ($this->combos[__('Mark')]); 
     169          unset ($this->actions['selected']); 
     170          unset ($this->actions['unselected']); 
     171          $this->actions['reorder']=array('dcPagesActionsPage','doReorderPages'); 
     172     } 
     173     public function process() { 
     174          // fake action for pages reordering 
     175          if (!empty($this->from['reorder'])) { 
     176               $this->from['action']='reorder'; 
     177          } 
     178          parent::process(); 
     179     } 
     180      
     181     public static function doReorderPages($core, dcPostsActionsPage $ap, $post) { 
     182          foreach($post['order'] as $post_id => $value) { 
     183               if (!$core->auth->check('publish,contentadmin',$core->blog->id)) 
     184                    throw new Exception(__('You are not allowed to change this entry status')); 
     185                
     186               $strReq = "WHERE blog_id = '".$core->con->escape($core->blog->id)."' ". 
     187                         "AND post_id ".$core->con->in($post_id); 
     188                
     189               #If user can only publish, we need to check the post's owner 
     190               if (!$core->auth->check('contentadmin',$core->blog->id)) 
     191                    $strReq .= "AND user_id = '".$core->con->escape($core->auth->userID())."' "; 
     192                
     193               $cur = $core->con->openCursor($core->prefix.'post'); 
     194                
     195               $cur->post_position = (integer) $value-1; 
     196               $cur->post_upddt = date('Y-m-d H:i:s'); 
     197                
     198               $cur->update($strReq); 
     199               $core->blog->triggerBlog(); 
     200                
     201          } 
     202          $ap->redirect(array('reo'=>1),false); 
     203     }     
     204} 
     205 
    140206# Actions combo box 
    141 $combo_action = array(); 
    142 if ($core->auth->check('publish,contentadmin',$core->blog->id)) 
    143 { 
    144      $combo_action[__('Publish')] = 'publish'; 
    145      $combo_action[__('Unpublish')] = 'unpublish'; 
    146      $combo_action[__('Schedule')] = 'schedule'; 
    147      $combo_action[__('Mark as pending')] = 'pending'; 
    148 } 
    149 if ($core->auth->check('admin',$core->blog->id)) { 
    150      $combo_action[__('Change author')] = 'author'; 
    151 } 
    152 if ($core->auth->check('delete,contentadmin',$core->blog->id)) 
    153 { 
    154      $combo_action[__('Delete')] = 'delete'; 
    155 } 
     207 
     208$pages_actions_page = new dcPagesActionsPage($core,'plugin.php',array('p'=>'pages')); 
     209 
     210$pages_actions_page->process(); 
     211 
    156212 
    157213# --BEHAVIOR-- adminPagesActionsCombo 
     
    164220<head> 
    165221  <title><?php echo __('Pages'); ?></title> 
    166   <script type="text/javascript" src="js/_posts_list.js"></script> 
     222  <?php 
     223     echo dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). 
     224          dcPage::jsLoad('index.php?pf=pages/list.js'); 
     225  ?> 
    167226  <script type="text/javascript"> 
    168227  //<![CDATA[ 
     
    180239     )); 
    181240 
     241if (!empty($_GET['upd'])) { 
     242     dcPage::success(__('Selected pages have been successfully updated.')); 
     243} elseif (!empty($_GET['del'])) { 
     244     dcPage::success(__('Selected pages have been successfully deleted.')); 
     245} elseif (!empty($_GET['reo'])) { 
     246     dcPage::success(__('Selected pages have been successfully reordered.')); 
     247} 
    182248echo 
    183249'<p class="top-add"><a class="button add" href="'.$p_url.'&amp;act=page">'.__('New page').'</a></p>'; 
     
    187253     # Show pages 
    188254     $post_list->display($page,$nb_per_page, 
    189      '<form action="posts_actions.php" method="post" id="form-entries">'. 
     255     '<form action="plugin.php" method="post" id="form-entries">'. 
    190256      
    191257     '%s'. 
     
    195261      
    196262     '<p class="col right"><label for="action" class="classic">'.__('Selected pages action:').'</label> '. 
    197      form::combo('action',$combo_action). 
     263     form::combo('action',$pages_actions_page->getCombo()). 
    198264     '<input type="submit" value="'.__('ok').'" /></p>'. 
    199265     form::hidden(array('post_type'),'page'). 
    200      form::hidden(array('redir'),html::escapeHTML($_SERVER['REQUEST_URI'])). 
     266     form::hidden(array('p'),'pages'). 
     267     '</div>'. 
    201268     $core->formNonce(). 
    202      '</div>'. 
     269     '<br class="clear"/>'. 
     270     '<input type="submit" value="'.__('Save categories order').'" name="reorder" class="clear"/>'. 
    203271     '</form>'); 
    204272} 
  • plugins/tags/_admin.php

    r1844 r1874  
    236236               )). 
    237237               '<form action="'.$form_uri.'" method="post">'. 
    238                $hidden_fields->getEntries(). 
     238               //$hidden_fields->getEntries(). 
    239239               '<div><label for="new_tags" class="area">'.__('Tags to add:').'</label> '. 
    240240               form::textarea('new_tags',60,3). 
    241241               '</div>'. 
    242                $hidden_fields->getHidden(). 
     242               $hidden_fields. 
    243243               $core->formNonce(). 
    244244               form::hidden(array('action'),'tags'). 
Note: See TracChangeset for help on using the changeset viewer.

Sites map