Changeset 851:0993f64c4809 for admin
- Timestamp:
- 07/31/12 13:52:11 (13 years ago)
- Branch:
- sexy
- Location:
- admin
- Files:
-
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/index.php
r848 r851 294 294 if ($core->auth->check('usage,contentadmin',$core->blog->id)) 295 295 { 296 $categories_combo = array(' ' => '');297 try {298 $categories = $core->blog->getCategories(array('post_type'=>'post'));299 while ($categories->fetch()) {300 $categories_combo[] = new formSelectOption(301 str_repeat(' ',$categories->level-1).302 ($categories->level-1 == 0 ? '' : '• ').html::escapeHTML($categories->cat_title),303 $categories->cat_id304 );305 }306 } catch (Exception $e) { }307 308 296 echo 309 297 '<div id="quick">'. … … 318 306 form::textarea('post_content',50,7). 319 307 '</p>'. 320 '<p><label for="cat_id" class="classic">'.__('Category:').' '.321 form::combo('cat_id',$categories_combo).'</label></p>'.322 308 '<p><input type="submit" value="'.__('Save').'" name="save" /> '. 323 309 ($core->auth->check('publish',$core->blog->id) -
admin/post.php
r848 r851 16 16 17 17 $post_id = ''; 18 $cat_id = '';19 18 $post_dt = ''; 20 19 $post_format = $core->auth->getOption('post_format'); … … 48 47 } 49 48 50 # Getting categories51 $categories_combo = array(' ' => '');52 try {53 $categories = $core->blog->getCategories(array('post_type'=>'post'));54 while ($categories->fetch()) {55 $categories_combo[] = new formSelectOption(56 str_repeat(' ',$categories->level-1).($categories->level-1 == 0 ? '' : '• ').html::escapeHTML($categories->cat_title),57 $categories->cat_id58 );59 }60 } catch (Exception $e) { }61 62 49 # Status combo 63 50 foreach ($core->blog->getAllPostStatus() as $k => $v) { … … 101 88 { 102 89 $post_id = $post->post_id; 103 $cat_id = $post->cat_id;104 90 $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 105 91 $post_format = $post->post_format; … … 153 139 $post_title = $_POST['post_title']; 154 140 155 $cat_id = (integer) $_POST['cat_id'];156 157 141 if (isset($_POST['post_status'])) { 158 142 $post_status = (integer) $_POST['post_status']; … … 188 172 189 173 $cur->post_title = $post_title; 190 $cur->cat_id = ($cat_id ? $cat_id : null);191 174 $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 192 175 $cur->post_format = $post_format; … … 389 372 390 373 echo 391 '<p><label for="cat_id">'.__('Category:').392 form::combo('cat_id',$categories_combo,$cat_id,'maximal').393 '</label></p>'.394 395 374 '<p><label for="post_status">'.__('Entry status:'). 396 375 form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). -
admin/posts.php
r796 r851 15 15 dcPage::check('usage,contentadmin'); 16 16 17 # Getting categories18 try {19 $categories = $core->blog->getCategories(array('post_type'=>'post'));20 } catch (Exception $e) {21 $core->error->add($e->getMessage());22 }23 24 17 # Getting authors 25 18 try { … … 47 40 { 48 41 # Filter form we'll put in html_block 49 $users_combo = $categories_combo =array();50 $users_combo['-'] = $categories_combo['-'] ='';42 $users_combo = array(); 43 $users_combo['-'] = ''; 51 44 while ($users->fetch()) 52 45 { … … 61 54 } 62 55 63 $categories_combo[__('None')] = 'NULL';64 while ($categories->fetch()) {65 $categories_combo[str_repeat(' ',$categories->level-1).($categories->level-1 == 0 ? '' : '• ').66 html::escapeHTML($categories->cat_title).67 ' ('.$categories->nb_post.')'] = $categories->cat_id;68 }69 70 56 $status_combo = array( 71 57 '-' => '' … … 95 81 __('Date') => 'post_dt', 96 82 __('Title') => 'post_title', 97 __('Category') => 'cat_title',98 83 __('Author') => 'user_id', 99 84 __('Status') => 'post_status', … … 122 107 __('Mark as unselected') => 'unselected' 123 108 ); 124 $combo_action[__('Change')] = array( __('Change category') => 'category');109 $combo_action[__('Change')] = array(); 125 110 if ($core->auth->check('admin',$core->blog->id)) 126 111 { … … 139 124 -------------------------------------------------------- */ 140 125 $user_id = !empty($_GET['user_id']) ? $_GET['user_id'] : ''; 141 $cat_id = !empty($_GET['cat_id']) ? $_GET['cat_id'] : '';142 126 $status = isset($_GET['status']) ? $_GET['status'] : ''; 143 127 $selected = isset($_GET['selected']) ? $_GET['selected'] : ''; … … 168 152 } else { 169 153 $user_id=''; 170 }171 172 # - Categories filter173 if ($cat_id !== '' && in_array($cat_id,$categories_combo)) {174 $params['cat_id'] = $cat_id;175 $show_filters = true;176 } else {177 $cat_id='';178 154 } 179 155 … … 263 239 '<label for="user_id">'.__('Author:'). 264 240 form::combo('user_id',$users_combo,$user_id).'</label> '. 265 '<label for="cat_id">'.__('Category:').266 form::combo('cat_id',$categories_combo,$cat_id).'</label> '.267 241 '<label for="status">'.__('Status:'). 268 242 form::combo('status',$status_combo,$status).'</label> '. … … 305 279 '<input type="submit" value="'.__('ok').'" /></p>'. 306 280 form::hidden(array('user_id'),$user_id). 307 form::hidden(array('cat_id'),$cat_id).308 281 form::hidden(array('status'),$status). 309 282 form::hidden(array('selected'),$selected). -
admin/posts_actions.php
r500 r851 32 32 $redir = 33 33 'posts.php?user_id='.$_POST['user_id']. 34 '&cat_id='.$_POST['cat_id'].35 34 '&status='.$_POST['status']. 36 35 '&selected='.$_POST['selected']. … … 117 116 118 117 } 119 elseif ($action == 'category' && isset($_POST['new_cat_id']))120 {121 try122 {123 while ($posts->fetch())124 {125 $new_cat_id = (integer) $_POST['new_cat_id'];126 $core->blog->updPostCategory($posts->post_id,$new_cat_id);127 }128 http::redirect($redir);129 }130 catch (Exception $e)131 {132 $core->error->add($e->getMessage());133 }134 }135 118 elseif ($action == 'author' && isset($_POST['new_auth_id']) 136 119 && $core->auth->check('admin',$core->blog->id)) … … 187 170 $hidden_fields .= 188 171 form::hidden(array('user_id'),$_POST['user_id']). 189 form::hidden(array('cat_id'),$_POST['cat_id']).190 172 form::hidden(array('status'),$_POST['status']). 191 173 form::hidden(array('selected'),$_POST['selected']). … … 205 187 $core->callBehavior('adminPostsActionsContent',$core,$action,$hidden_fields); 206 188 207 if ($action == 'category') 208 { 209 echo '<h2 class="page-title">'.__('Change category for entries').'</h2>'; 210 211 # categories list 212 # Getting categories 213 $categories_combo = array(' ' => ''); 214 try { 215 $categories = $core->blog->getCategories(array('post_type'=>'post')); 216 while ($categories->fetch()) { 217 $categories_combo[] = new formSelectOption( 218 str_repeat(' ',$categories->level-1). 219 ($categories->level-1 == 0 ? '' : '• ').html::escapeHTML($categories->cat_title), 220 $categories->cat_id 221 ); 222 } 223 } catch (Exception $e) { } 224 225 echo 226 '<form action="posts_actions.php" method="post">'. 227 '<p><label for="new_cat_id" class="classic">'.__('Category:').' '. 228 form::combo('new_cat_id',$categories_combo,''). 229 '</label> '; 230 231 echo 232 $hidden_fields. 233 $core->formNonce(). 234 form::hidden(array('action'),'category'). 235 '<input type="submit" value="'.__('Save').'" /></p>'. 236 '</form>'; 237 } 238 elseif ($action == 'author' && $core->auth->check('admin',$core->blog->id)) 189 if ($action == 'author' && $core->auth->check('admin',$core->blog->id)) 239 190 { 240 191 echo '<h2 class="page-title">'.__('Change author for entries').'</h2>'; -
admin/search.php
r848 r851 81 81 $combo_action[__('mark as pending')] = 'pending'; 82 82 } 83 $combo_action[__('change category')] = 'category';84 if ($core->auth->check('admin',$core->blog->id)) {85 $combo_action[__('change author')] = 'author';86 }87 83 if ($core->auth->check('delete,contentadmin',$core->blog->id)) 88 84 {
Note: See TracChangeset
for help on using the changeset viewer.