- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r1488 r1288 49 49 $post_status = -2; 50 50 } 51 52 # Getting categories 53 $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_id 60 ); 61 } 62 } catch (Exception $e) { } 51 63 52 64 # Status combo … … 206 218 if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) 207 219 { 208 # Create category209 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-- adminBeforeCategoryCreate218 $core->callBehavior('adminBeforeCategoryCreate', $cur_cat);219 220 $cat_id = $core->blog->addCategory($cur_cat, (integer) $parent_cat);221 222 # --BEHAVIOR-- adminAfterCategoryCreate223 $core->callBehavior('adminAfterCategoryCreate', $cur_cat, $cat_id);224 }225 226 220 $cur = $core->con->openCursor($core->prefix.'post'); 227 221 … … 289 283 } 290 284 } 291 292 # Getting categories293 $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_id301 );302 }303 }304 } catch (Exception $e) { }305 285 306 286 /* DISPLAY … … 463 443 '</label></p>'. 464 444 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 477 445 '<p><label for="post_status">'.__('Entry status:'). 478 446 form::combo('post_status',$status_combo,$post_status,'','',!$can_publish).
Note: See TracChangeset
for help on using the changeset viewer.