Dotclear

Changeset 1879:9948ea7d24e8


Ignore:
Timestamp:
08/15/13 00:32:10 (12 years ago)
Author:
Lepeltier kévin
Branch:
Ticket #1181
Message:

Ticket #1181
Ajout de l'action reorder dans le menu d'action.
Par defaut dans la combobox, pour que le bouton mettre à jour valide cette action.

Location:
plugins/pages
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/pages/_admin.php

    r1179 r1879  
    1515$core->addBehavior('adminDashboardFavs','pages_dashboard_favs'); 
    1616$core->addBehavior('adminDashboardFavsIcon','pages_dashboard_favs_icon'); 
     17 
     18$core->addBehavior('adminPostsActionsContent','pages_PostsActionsContent'); 
     19 
    1720function pages_dashboard($core,$icons) 
    1821{ 
     
    4245} 
    4346 
     47 
     48function pages_PostsActionsContent($core,$action,$hidden_fields,$form_uri="posts_actions.php") 
     49{ 
     50      
     51     if ($action == 'reorder' && !empty($_POST['order'])) { 
     52          try { 
     53                
     54               foreach($_POST['order'] as $post_id => $value) { 
     55                     
     56                    if (!$core->auth->check('publish,contentadmin',$core->blog->id)) 
     57                         throw new Exception(__('You are not allowed to change this entry status')); 
     58                     
     59                    $strReq = "WHERE blog_id = '".$core->con->escape($core->blog->id)."' ". 
     60                              "AND post_id ".$core->con->in($post_id); 
     61                     
     62                    #If user can only publish, we need to check the post's owner 
     63                    if (!$core->auth->check('contentadmin',$core->blog->id)) 
     64                         $strReq .= "AND user_id = '".$core->con->escape($core->auth->userID())."' "; 
     65                     
     66                    $cur = $core->con->openCursor($core->prefix.'post'); 
     67                     
     68                    $cur->post_position = (integer) $value-1; 
     69                    $cur->post_upddt = date('Y-m-d H:i:s'); 
     70                     
     71                    $cur->update($strReq); 
     72                    $core->blog->triggerBlog(); 
     73                     
     74               } 
     75 
     76               http::redirect($_POST['redir']); 
     77          } catch (Exception $e) { 
     78               $core->error->add($e->getMessage()); 
     79          } 
     80     } 
     81} 
     82 
    4483$_menu['Blog']->addItem(__('Pages'),'plugin.php?p=pages','index.php?pf=pages/icon.png', 
    4584          preg_match('/plugin.php\?p=pages(&.*)?$/',$_SERVER['REQUEST_URI']), 
  • plugins/pages/list.php

    r1878 r1879  
    103103           
    104104          $res .= 
    105           '<td class="handle minimal">'.form::field(array('order['.$count.']'),2,3,$count+1,'position','',false,'title="'.sprintf(__('position of %s'),html::escapeHTML($this->rs->post_title)).'"'). 
    106                     form::hidden(array('dynorder[]','dynorder-'.$count),$count).'</td>'. 
     105          '<td class="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>'. 
    107106          '<td class="nowrap">'. 
    108107          form::checkbox(array('entries[]'),$this->rs->post_id,'','','',!$this->rs->isEditable(),'title="'.__('select this page').'"').'</td>'. 
     
    150149if ($core->auth->check('publish,contentadmin',$core->blog->id)) 
    151150{ 
     151     $combo_action[__('reorder')] = 'reorder'; 
    152152     $combo_action[__('publish')] = 'publish'; 
    153153     $combo_action[__('unpublish')] = 'unpublish'; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map