Changeset 1417:c13469e071ea
- Timestamp:
- 08/16/13 20:35:03 (11 years ago)
- Branch:
- 2.5
- Location:
- admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_post.js
r1256 r1417 123 123 hide: $('#post_notes').val() == '' 124 124 }); 125 $('#new_cat').toggleWithLegend( 126 $('#new_cat').parent().children().not('#new_cat'), 127 {} // no cookie on new category as we don't use this every day 128 ); 125 129 $('#post_lang').parent().toggleWithLegend($('#post_lang'),{ 126 130 cookie: 'dcx_post_lang' -
admin/post.php
r1288 r1417 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 $l = $categories->level; 298 $full_name = array($categories->cat_title); 299 300 while ($categories->fetch()) { 301 if ($categories->level < $l) { 302 $full_name = array(); 303 } elseif ($categories->level == $l) { 304 array_pop($full_name); 305 } 306 $full_name[] = html::escapeHTML($categories->cat_title); 307 $categories_combo[implode(' / ',$full_name)] = $categories->cat_id; 308 $l = $categories->level; 309 } 310 } 311 } catch (Exception $e) { } 285 312 286 313 /* DISPLAY … … 443 470 '</label></p>'. 444 471 472 ($core->auth->check('categories', $core->blog->id) ? 473 '<div>'. 474 '<p id="new_cat">'.__('Add a new category').'</p>'. 475 '<p><label for="new_cat_title">'.__('Title:').' '. 476 form::field('new_cat_title',30,255,'','maximal').'</label></p>'. 477 '<p><label for="new_cat_parent">'.__('Parent:').' '. 478 form::combo('new_cat_parent',$categories_combo,'','maximal'). 479 '</label></p>'. 480 '</div>' 481 : ''). 482 445 483 '<p><label for="post_status">'.__('Entry status:'). 446 484 form::combo('post_status',$status_combo,$post_status,'','',!$can_publish).
Note: See TracChangeset
for help on using the changeset viewer.