- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r1288 r1488 49 49 $post_status = -2; 50 50 } 51 52 # Getting categories53 $categories_combo = array(' ' => '');54 try {55 $categories = $core->blog->getCategories(array('post_type'=>'post'));56 while ($categories->fetch()) {57 $categories_combo[] = new formSelectOption(58 str_repeat(' ',$categories->level-1).($categories->level-1 == 0 ? '' : '• ').html::escapeHTML($categories->cat_title),59 $categories->cat_id60 );61 }62 } catch (Exception $e) { }63 51 64 52 # Status combo … … 218 206 if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) 219 207 { 208 # Create category 209 if (!empty($_POST['new_cat_title']) && $core->auth->check('categories', $core->blog->id)) { 210 211 $cur_cat = $core->con->openCursor($core->prefix.'category'); 212 $cur_cat->cat_title = $_POST['new_cat_title']; 213 $cur_cat->cat_url = ''; 214 215 $parent_cat = !empty($_POST['new_cat_parent']) ? $_POST['new_cat_parent'] : ''; 216 217 # --BEHAVIOR-- adminBeforeCategoryCreate 218 $core->callBehavior('adminBeforeCategoryCreate', $cur_cat); 219 220 $cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat); 221 222 # --BEHAVIOR-- adminAfterCategoryCreate 223 $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $cat_id); 224 } 225 220 226 $cur = $core->con->openCursor($core->prefix.'post'); 221 227 … … 283 289 } 284 290 } 291 292 # Getting categories 293 $categories_combo = array(__('(No cat)') => ''); 294 try { 295 $categories = $core->blog->getCategories(array('post_type'=>'post')); 296 if (!$categories->isEmpty()) { 297 while ($categories->fetch()) { 298 $catparents_combo[] = $categories_combo[] = new formSelectOption( 299 str_repeat(' ',$categories->level-1).($categories->level-1 == 0 ? '' : '• ').html::escapeHTML($categories->cat_title), 300 $categories->cat_id 301 ); 302 } 303 } 304 } catch (Exception $e) { } 285 305 286 306 /* DISPLAY … … 443 463 '</label></p>'. 444 464 465 ($core->auth->check('categories', $core->blog->id) ? 466 '<div>'. 467 '<p id="new_cat">'.__('Add a new category').'</p>'. 468 '<p class="form-note info clear">'.__('This category will be created when you will save your post.').'</p>'. 469 '<p><label for="new_cat_title">'.__('Title:').' '. 470 form::field('new_cat_title',30,255,'','maximal').'</label></p>'. 471 '<p><label for="new_cat_parent">'.__('Parent:').' '. 472 form::combo('new_cat_parent',$categories_combo,'','maximal'). 473 '</label></p>'. 474 '</div>' 475 : ''). 476 445 477 '<p><label for="post_status">'.__('Entry status:'). 446 478 form::combo('post_status',$status_combo,$post_status,'','',!$can_publish).
Note: See TracChangeset
for help on using the changeset viewer.