Changeset 1999:a0ed28c2da5a for plugins/pages
- Timestamp:
- 09/22/13 11:38:22 (12 years ago)
- Branch:
- default
- Parents:
- 1998:dae906985ebb (diff), 1905:d72d24250853 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
plugins/pages/list.php
r1903 r1999 25 25 else 26 26 { 27 $pager = new pager($page,$this->rs_count,$nb_per_page,10); 28 $pager->html_prev = $this->html_prev; 29 $pager->html_next = $this->html_next; 30 $pager->var_page = 'page'; 27 $pager = new dcPager($page,$this->rs_count,$nb_per_page,10); 31 28 32 29 $html_block = … … 44 41 } 45 42 46 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';43 echo $pager->getLinks(); 47 44 48 45 $blocks = explode('%s',$html_block); … … 59 56 echo $blocks[1]; 60 57 61 echo '<p class="pagination">'.__('Page(s)').' : '.$pager->getLinks().'</p>';58 echo $pager->getLinks(); 62 59 } 63 60 } … … 125 122 ); 126 123 127 $page = !empty($_GET['page']) ? (integer) $_GET['page']: 1;124 $page = !empty($_GET['page']) ? max(1,(integer) $_GET['page']) : 1; 128 125 $nb_per_page = 30; 129 126 -
plugins/pages/list.php
r1926 r1999 28 28 29 29 $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>'. 32 32 '<th>'.__('Date').'</th>'. 33 33 '<th>'.__('Author').'</th>'. … … 35 35 '<th>'.__('Trackbacks').'</th>'. 36 36 '<th>'.__('Status').'</th>'. 37 '</tr> %s</table>';37 '</tr></thead><tbody id="pageslist">%s</tbody></table>'; 38 38 39 39 if ($enclose_block) { … … 47 47 echo $blocks[0]; 48 48 49 $count = 0; 49 50 while ($this->rs->fetch()) 50 51 { 51 echo $this->postLine(); 52 echo $this->postLine($count); 53 $count ++; 52 54 } 53 55 … … 58 60 } 59 61 60 private function postLine( )62 private function postLine($count) 61 63 { 62 64 $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; … … 97 99 98 100 $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>'. 99 102 '<td class="nowrap">'. 100 103 form::checkbox(array('entries[]'),$this->rs->post_id,'','','',!$this->rs->isEditable(),'title="'.__('Select this page').'"').'</td>'. … … 138 141 } 139 142 143 class 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 140 206 # 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 156 212 157 213 # --BEHAVIOR-- adminPagesActionsCombo … … 164 220 <head> 165 221 <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 ?> 167 226 <script type="text/javascript"> 168 227 //<![CDATA[ … … 180 239 )); 181 240 241 if (!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 } 182 248 echo 183 249 '<p class="top-add"><a class="button add" href="'.$p_url.'&act=page">'.__('New page').'</a></p>'; … … 187 253 # Show pages 188 254 $post_list->display($page,$nb_per_page, 189 '<form action="p osts_actions.php" method="post" id="form-entries">'.255 '<form action="plugin.php" method="post" id="form-entries">'. 190 256 191 257 '%s'. … … 195 261 196 262 '<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()). 198 264 '<input type="submit" value="'.__('ok').'" /></p>'. 199 265 form::hidden(array('post_type'),'page'). 200 form::hidden(array('redir'),html::escapeHTML($_SERVER['REQUEST_URI'])). 266 form::hidden(array('p'),'pages'). 267 '</div>'. 201 268 $core->formNonce(). 202 '</div>'. 269 '<br class="clear"/>'. 270 '<input type="submit" value="'.__('Save categories order').'" name="reorder" class="clear"/>'. 203 271 '</form>'); 204 272 }
Note: See TracChangeset
for help on using the changeset viewer.