Changeset 1471:136cc800ade6
- Timestamp:
- 08/19/13 11:39:45 (10 years ago)
- Branch:
- default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/posts_actions.php
r1399 r1471 17 17 $params = array(); 18 18 19 class FieldsList { 20 protected $hidden; 21 protected $entries; 22 public function __construct() { 23 $this->hidden=array(); 24 $this->entries =array(); 25 } 26 public function addHidden($name,$value) { 27 $this->hidden[] = form::hidden($name,$value); 28 return $this; 29 } 30 public function addEntry($id,$title) { 31 $this->entries[$id]=$title; 32 return $this; 33 } 34 35 public function getHidden() { 36 return join('',$this->hidden); 37 } 38 39 public function getEntries ($hidden=false) { 40 $ret = ''; 41 if ($hidden) { 42 foreach ($this->entries as $id=> $e) { 43 $ret .= form::hidden('entries[]',$id); 44 } 45 } else { 46 $ret = 47 '<table class="posts-list"><tr>'. 48 '<th colspan="2">'.__('Title').'</th>'. 49 '</tr>'; 50 foreach ($this->entries as $id=>$title) { 51 $ret .= 52 '<tr><td>'. 53 form::checkbox(array('entries[]'),$id,true,'','').'</td>'. 54 '<td>'. $title.'</td></tr>'; 55 } 56 $ret .= '</table>'; 57 } 58 return $ret; 59 } 60 61 public function __toString() { 62 return join('',$this->hidden).$this->getEntries(true); 63 } 64 } 65 66 67 function listEntries($titles) { 68 $ret = 69 '<table class="posts-list"><tr>'. 70 '<th colspan="2">'.__('Title').'</th>'. 71 '</tr>'; 72 foreach ($titles as $id=>$title) { 73 $ret .= 74 '<tr><td>'. 75 form::checkbox(array('entries[]'),$id,true,'','').'</td>'. 76 '<td>'. $title.'</td></tr>'; 77 } 78 $ret .= '</table>'; 79 return $ret; 80 } 81 19 82 /* Actions 20 83 -------------------------------------------------------- */ … … 175 238 } 176 239 } 177 } 178 240 } else { 241 if (empty($_POST['entries'])) { 242 $core->error->add(__('At least one entry should be selected')); 243 } else { 244 $core->error->add(__('No action specified.')); 245 } 246 dcPage::open( 247 __('Entries'),'',dcPage::breadcrumb( 248 array( 249 html::escapeHTML($core->blog->name) => '', 250 __('Entries') => 'posts.php', 251 '<span class="page-title">'.__('Entries actions').'</span>' => '' 252 )) 253 ); 254 255 dcPage::close(); 256 exit; 257 } 179 258 /* DISPLAY 180 259 -------------------------------------------------------- */ … … 211 290 } 212 291 213 $ hidden_fields = '';292 $fields = new FieldsList(); 214 293 while ($posts->fetch()) { 215 $ hidden_fields .= form::hidden(array('entries[]'),$posts->post_id);294 $fields->addEntry($posts->post_id,$posts->post_title); 216 295 } 217 296 218 297 if (isset($_POST['redir']) && strpos($_POST['redir'],'://') === false) 219 298 { 220 $ hidden_fields .= form::hidden(array('redir'),html::escapeURL($_POST['redir']));299 $fields->addHidden(array('redir'),html::escapeURL($_POST['redir'])); 221 300 } 222 301 else 223 302 { 224 $hidden_fields .= 225 form::hidden(array('user_id'),$_POST['user_id']). 226 form::hidden(array('cat_id'),$_POST['cat_id']). 227 form::hidden(array('status'),$_POST['status']). 228 form::hidden(array('selected'),$_POST['selected']). 229 form::hidden(array('month'),$_POST['month']). 230 form::hidden(array('lang'),$_POST['lang']). 231 form::hidden(array('sortby'),$_POST['sortby']). 232 form::hidden(array('order'),$_POST['order']). 233 form::hidden(array('page'),$_POST['page']). 234 form::hidden(array('nb'),$_POST['nb']); 303 $fields 304 ->addHidden(array('user_id'),$_POST['user_id']) 305 ->addHidden(array('cat_id'),$_POST['cat_id']) 306 ->addHidden(array('status'),$_POST['status']) 307 ->addHidden(array('selected'),$_POST['selected']) 308 ->addHidden(array('month'),$_POST['month']) 309 ->addHidden(array('lang'),$_POST['lang']) 310 ->addHidden(array('sortby'),$_POST['sortby']) 311 ->addHidden(array('order'),$_POST['order']) 312 ->addHidden(array('page'),$_POST['page']) 313 ->addHidden(array('nb'),$_POST['nb']) 314 ; 235 315 } 236 316 237 317 if (isset($_POST['post_type'])) { 238 $ hidden_fields .= form::hidden(array('post_type'),$_POST['post_type']);318 $fields->addHidden(array('post_type'),$_POST['post_type']); 239 319 } 240 320 241 321 # --BEHAVIOR-- adminPostsActionsContent 242 $core->callBehavior('adminPostsActionsContent',$core,$action,$ hidden_fields);322 $core->callBehavior('adminPostsActionsContent',$core,$action,$fields); 243 323 244 324 if ($action == 'category') 245 325 { 246 echo '<h2 class="page-title">'.__('Change category for entries').'</h2>'; 247 326 echo dcPage::breadcrumb( 327 array( 328 html::escapeHTML($core->blog->name) => '', 329 __('Entries') => 'posts.php', 330 __('Change category for entries') => '' 331 )); 332 248 333 # categories list 249 334 # Getting categories … … 262 347 echo 263 348 '<form action="posts_actions.php" method="post">'. 264 '<p><label for="new_cat_id" class="classic">'.__('Category:').'</label> '. 265 form::combo('new_cat_id',$categories_combo,''); 266 267 echo 268 $hidden_fields. 349 $fields->getEntries(). 350 '<p><label for="new_cat_id" class="classic">'.__('Category:').' '. 351 form::combo('new_cat_id',$categories_combo,''). 352 '</label> '; 353 354 echo 355 $fields->getHidden(). 269 356 $core->formNonce(). 270 357 form::hidden(array('action'),'category'). … … 274 361 elseif ($action == 'lang') 275 362 { 276 echo '<h2 class="page-title">'.__('Change language for entries').'</h2>'; 363 echo dcPage::breadcrumb( 364 array( 365 html::escapeHTML($core->blog->name) => '', 366 __('Entries') => 'posts.php', 367 '<span class="page-title">'.__('Change language for entries').'</span>' => '' 368 )); 277 369 278 370 # lang list … … 294 386 echo 295 387 '<form action="posts_actions.php" method="post">'. 296 '<p><label for="new_lang" class="classic">'.__('Entry lang:').'</label> '. 297 form::combo('new_lang',$lang_combo,''); 298 299 echo 300 $hidden_fields. 388 $fields->getEntries(). 389 '<p><label for="new_lang" class="classic">'.__('Entry lang:').' '. 390 form::combo('new_lang',$lang_combo,''). 391 '</label> '; 392 393 echo 394 $fields->getHidden(). 301 395 $core->formNonce(). 302 396 form::hidden(array('action'),'lang'). … … 307 401 elseif ($action == 'author' && $core->auth->check('admin',$core->blog->id)) 308 402 { 309 echo '<h2 class="page-title">'.__('Change author for entries').'</h2>'; 403 echo dcPage::breadcrumb( 404 array( 405 html::escapeHTML($core->blog->name) => '', 406 __('Entries') => 'posts.php', 407 '<span class="page-title">'.__('Change author for entries').'</span>' => '' 408 )); 310 409 311 410 echo 312 411 '<form action="posts_actions.php" method="post">'. 313 '<p><label for="new_auth_id" class="classic">'.__('Author ID:').'</label> '. 314 form::field('new_auth_id',20,255); 315 316 echo 317 $hidden_fields. 412 $fields->getEntries(). 413 '<p><label for="new_auth_id" class="classic">'.__('Author ID:').' '. 414 form::field('new_auth_id',20,255). 415 '</label> '; 416 417 echo 418 $fields->getHidden(). 318 419 $core->formNonce(). 319 420 form::hidden(array('action'),'author'). -
plugins/tags/_admin.php
r1454 r1471 229 229 if ($action == 'tags') 230 230 { 231 echo 232 '<h2 class="page-title">'.__('Add tags to entries').'</h2>'. 231 echo dcPage::breadcrumb( 232 array( 233 html::escapeHTML($core->blog->name) => '', 234 __('Entries') => 'posts.php', 235 '<span class="page-title">'.__('Add tags to entries').'</span>' => '' 236 )). 233 237 '<form action="'.$form_uri.'" method="post">'. 238 $hidden_fields->getEntries(). 234 239 '<div><label for="new_tags" class="area">'.__('Tags to add:').'</label> '. 235 240 form::textarea('new_tags',60,3). 236 241 '</div>'. 237 $hidden_fields .242 $hidden_fields->getHidden(). 238 243 $core->formNonce(). 239 244 form::hidden(array('action'),'tags'). … … 259 264 } 260 265 } 261 262 echo '<h2 class="page-title">'.__('Remove selected tags from entries').'</h2>'; 266 echo dcPage::breadcrumb( 267 array( 268 html::escapeHTML($core->blog->name) => '', 269 __('Entries') => 'posts.php', 270 '<span class="page-title">'.__('Remove selected tags from entries').'</span>' => '' 271 )); 263 272 264 273 if (empty($tags)) {
Note: See TracChangeset
for help on using the changeset viewer.