Dotclear


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r1488 r1288  
    4949     $post_status = -2; 
    5050} 
     51 
     52# Getting categories 
     53$categories_combo = array(' ' => ''); 
     54try { 
     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) { } 
    5163 
    5264# Status combo 
     
    206218if (!empty($_POST) && !empty($_POST['save']) && $can_edit_post && !$bad_dt) 
    207219{ 
    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       
    226220     $cur = $core->con->openCursor($core->prefix.'post'); 
    227221      
     
    289283     } 
    290284} 
    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) { } 
    305285 
    306286/* DISPLAY 
     
    463443     '</label></p>'. 
    464444      
    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       
    477445     '<p><label for="post_status">'.__('Entry status:'). 
    478446     form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 
Note: See TracChangeset for help on using the changeset viewer.

Sites map