Dotclear


Ignore:
Timestamp:
08/23/13 10:41:38 (12 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Children:
1530:18df991c4c1a, 1531:18a9e84c04e3, 1641:ae5dc7a055e1, 1885:d4803b6eba12
Parents:
1528:41b40915bb82 (diff), 1515:03b3235091cf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge 2.5 commits into default branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r1488 r1529  
    5050} 
    5151 
     52# Getting categories 
     53$categories_combo = array('&nbsp;' => ''); 
     54try { 
     55     $categories = $core->blog->getCategories(array('post_type'=>'post')); 
     56     while ($categories->fetch()) { 
     57          $categories_combo[] = new formSelectOption( 
     58               str_repeat('&nbsp;&nbsp;',$categories->level-1).($categories->level-1 == 0 ? '' : '&bull; ').html::escapeHTML($categories->cat_title), 
     59               $categories->cat_id 
     60          ); 
     61     } 
     62} catch (Exception $e) { } 
     63 
    5264# Status combo 
    5365foreach ($core->blog->getAllPostStatus() as $k => $v) { 
     
    8294if (!empty($_REQUEST['id'])) 
    8395{ 
     96     $page_title = __('Edit entry'); 
     97      
    8498     $params['post_id'] = $_REQUEST['id']; 
    8599      
     
    111125          $post_open_tb = (boolean) $post->post_open_tb; 
    112126           
    113           $page_title = __('Edit entry'); 
    114            
    115127          $can_edit_post = $post->isEditable(); 
    116128          $can_delete= $post->isDeletable(); 
     
    121133          if ($next_rs !== null) { 
    122134               $next_link = sprintf($post_link,$next_rs->post_id, 
    123                     html::escapeHTML($next_rs->post_title),__('next entry').'&nbsp;&#187;'); 
     135                    html::escapeHTML($next_rs->post_title),__('Next entry').'&nbsp;&#187;'); 
    124136               $next_headlink = sprintf($post_headlink,'next', 
    125137                    html::escapeHTML($next_rs->post_title),$next_rs->post_id); 
     
    128140          if ($prev_rs !== null) { 
    129141               $prev_link = sprintf($post_link,$prev_rs->post_id, 
    130                     html::escapeHTML($prev_rs->post_title),'&#171;&nbsp;'.__('previous entry')); 
     142                    html::escapeHTML($prev_rs->post_title),'&#171;&nbsp;'.__('Previous entry')); 
    131143               $prev_headlink = sprintf($post_headlink,'previous', 
    132144                    html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 
     
    314326} 
    315327 
     328if ($post_id) { 
     329     switch ($post_status) { 
     330          case 1: 
     331               $img_status = sprintf($img_status_pattern,__('Published'),'check-on.png'); 
     332               break; 
     333          case 0: 
     334               $img_status = sprintf($img_status_pattern,__('Unpublished'),'check-off.png'); 
     335               break; 
     336          case -1: 
     337               $img_status = sprintf($img_status_pattern,__('Scheduled'),'scheduled.png'); 
     338               break; 
     339          case -2: 
     340               $img_status = sprintf($img_status_pattern,__('Pending'),'check-wrn.png'); 
     341               break; 
     342          default: 
     343               $img_status = ''; 
     344     } 
     345     $edit_entry_str = __('&ldquo;%s&rdquo;'); 
     346     $page_title_edit = sprintf($edit_entry_str, html::escapeHTML($post_title)).' '.$img_status; 
     347} else { 
     348     $img_status = ''; 
     349} 
     350 
     351 
    316352dcPage::open($page_title.' - '.__('Entries'), 
    317353     dcPage::jsDatePicker(). 
     
    324360     $core->callBehavior('adminPostHeaders'). 
    325361     dcPage::jsPageTabs($default_tab). 
    326      $next_headlink."\n".$prev_headlink 
     362     $next_headlink."\n".$prev_headlink, 
     363     dcPage::breadcrumb( 
     364          array( 
     365               html::escapeHTML($core->blog->name) => '', 
     366               __('Entries') => 'posts.php', 
     367               '<span class="page-title">'.($post_id ? $page_title_edit : $page_title).'</span>' => '' 
     368          )) 
    327369); 
    328370 
     
    354396} 
    355397 
    356 echo '<h2>'.html::escapeHTML($core->blog->name).' &rsaquo; '.'<a href="posts.php">'.__('Entries').'</a> &rsaquo; <span class="page-title">'; 
    357 if ($post_id) { 
    358      switch ($post_status) { 
    359           case 1: 
    360                $img_status = sprintf($img_status_pattern,__('published'),'check-on.png'); 
    361                break; 
    362           case 0: 
    363                $img_status = sprintf($img_status_pattern,__('unpublished'),'check-off.png'); 
    364                break; 
    365           case -1: 
    366                $img_status = sprintf($img_status_pattern,__('scheduled'),'scheduled.png'); 
    367                break; 
    368           case -2: 
    369                $img_status = sprintf($img_status_pattern,__('pending'),'check-wrn.png'); 
    370                break; 
    371           default: 
    372                $img_status = ''; 
    373      } 
    374      $edit_entry_str = __('Edit entry &ldquo;%s&rdquo;'); 
    375      echo sprintf($edit_entry_str, html::escapeHTML($post_title)).' '.$img_status; 
    376 } else { 
    377      echo $page_title; 
    378 } 
    379 echo '</span></h2>'; 
    380  
    381398if ($post_id && $post->post_status == 1) { 
    382      echo '<p><a href="'.$post->getURL().'" onclick="window.open(this.href);return false;" title="'.$post_title.' ('.__('new window').')'.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; 
     399     echo '<p><a class="onblog_link" href="'.$post->getURL().'" onclick="window.open(this.href);return false;" title="'.$post_title.' ('.__('new window').')'.'">'.__('Go to this entry on the site').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; 
    383400} 
    384401if ($post_id) 
    385402{ 
    386      echo '<p>'; 
     403     echo '<p class="nav_prevnext">'; 
    387404     if ($prev_link) { echo $prev_link; } 
    388      if ($next_link && $prev_link) { echo ' - '; } 
     405     if ($next_link && $prev_link) { echo ' | '; } 
    389406     if ($next_link) { echo $next_link; } 
    390407      
     
    401418     exit; 
    402419} 
    403  
    404420/* Post form if we can edit post 
    405421-------------------------------------------------------- */ 
    406422if ($can_edit_post) 
    407423{ 
    408      echo '<div class="multi-part" title="'.__('Edit entry').'" id="edit-entry">'; 
     424     $sidebar_items = new ArrayObject(array( 
     425          'status-box' => array( 
     426               'title' => __('Status'), 
     427               'items' => array( 
     428                    'post_status' =>  
     429                         '<p class="entry-status"><label for="post_status" class="ib">'.__('Entry status').' '.$img_status.'</label>'. 
     430                         form::combo('post_status',$status_combo,$post_status,'maximal','',!$can_publish). 
     431                         '</p>', 
     432                    'post_dt' =>  
     433                         '<p><label for="post_dt" class="ib">'.__('Publication date and hour').'</label>'. 
     434                         form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
     435                         '</p>', 
     436                    'post_lang' => 
     437                         '<p><label for="post_lang" class="ib">'.__('Entry lang').'</label>'. 
     438                         form::combo('post_lang',$lang_combo,$post_lang). 
     439                         '</p>', 
     440                    'post_format' => 
     441                         '<p><label for="post_format" class="ib">'.__('Text formating').'</label>'. 
     442                         form::combo('post_format',$formaters_combo,$post_format,'maximal'). 
     443                         '</p>'. 
     444                         '<p>'.($post_id && $post_format != 'xhtml' ?  
     445                         '<a id="convert-xhtml" class="button maximal" href="post.php?id='.$post_id.'&amp;xconv=1">'. 
     446                         __('Convert to XHTML').'</a>' : '').'</p>')), 
     447          'metas-box' => array( 
     448               'title' => __('Ordering'), 
     449               'items' => array( 
     450                    'post_selected' =>  
     451                         '<p><label for="post_selected" class="classic">'. 
     452                         form::checkbox('post_selected',1,$post_selected).' '. 
     453                         __('Selected entry').'</label></p>', 
     454                    'cat_id' => 
     455                         '<p><label for="cat_id" class="ib">'.__('Category').'</label>'. 
     456                         form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 
     457                         '</p>'. 
     458                         ($core->auth->check('categories', $core->blog->id) ? 
     459                              '<div>'. 
     460                              '<p id="new_cat">'.__('Add a new category').'</p>'. 
     461                              '<p><label for="new_cat_title">'.__('Title:').' '. 
     462                              form::field('new_cat_title',30,255,'','maximal').'</label></p>'. 
     463                              '<p><label for="new_cat_parent">'.__('Parent:').' '. 
     464                              form::combo('new_cat_parent',$categories_combo,'','maximal'). 
     465                              '</label></p>'. 
     466                              '</div>' 
     467                         : ''))), 
     468          'options-box' => array( 
     469               'title' => __('Options'), 
     470               'items' => array( 
     471                    'post_open_comment' => 
     472                         '<p><label for="post_open_comment" class="classic">'. 
     473                         form::checkbox('post_open_comment',1,$post_open_comment).' '. 
     474                         __('Accept comments').'</label></p>'. 
     475                         ($core->blog->settings->system->allow_comments ?  
     476                              (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
     477                                   '' : 
     478                                   '<p class="form-note warn">'. 
     479                                   __('Warning: Comments are not more accepted for this entry.').'</p>') :  
     480                              '<p class="form-note warn">'. 
     481                              __('Warning: Comments are not accepted on this blog.').'</p>'), 
     482                    'post_open_tb' => 
     483                         '<p><label for="post_open_tb" class="classic">'. 
     484                         form::checkbox('post_open_tb',1,$post_open_tb).' '. 
     485                         __('Accept trackbacks').'</label></p>'. 
     486                         ($core->blog->settings->system->allow_trackbacks ?  
     487                              (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
     488                                   '' : 
     489                                   '<p class="form-note warn">'. 
     490                                   __('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
     491                              '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'), 
     492                    'post_password' => 
     493                         '<p><label for="post_password" class="ib">'.__('Password').'</label>'. 
     494                         form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
     495                         '</p>', 
     496                    'post_url' => 
     497                         '<div class="lockable">'. 
     498                         '<p><label for="post_url" class="ib">'.__('Edit basename').'</label>'. 
     499                         form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 
     500                         '</p>'. 
     501                         '<p class="form-note warn">'. 
     502                         __('Warning: If you set the URL manually, it may conflict with another entry.'). 
     503                         '</p></div>' 
     504     )))); 
     505 
     506     $main_items = new ArrayObject(array( 
     507          "post_title" => 
     508               '<p class="col">'. 
     509               '<label class="required no-margin"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:').'</label>'. 
     510               form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 
     511               '</p>', 
     512           
     513          "post_excerpt" => 
     514               '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'<span class="form-note">'. 
     515               __('Add an introduction to the post.').'</span></label> '. 
     516               form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
     517               '</p>', 
     518           
     519          "post_content" => 
     520               '<p class="area"><label class="required" '. 
     521               'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
     522               form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
     523               '</p>', 
     524           
     525          "post_notes" => 
     526               '<p class="area" id="notes-area"><label for="post_notes">'.__('Personal notes:').'<span class="form-note">'. 
     527               __('Add unpublished notes.').'</span></label>'. 
     528               form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 
     529               '</p>' 
     530          ) 
     531     ); 
     532      
     533     # --BEHAVIOR-- adminPostFormItems 
     534     $core->callBehavior('adminPostFormItems',$main_items,$sidebar_items, isset($post) ? $post : null); 
     535 
     536     echo '<div class="multi-part" title="'.($post_id ? __('Edit entry') : __('New entry')).'" id="edit-entry">'; 
    409537     echo '<form action="post.php" method="post" id="entry-form">'; 
    410538     echo '<div id="entry-wrapper">'; 
    411539     echo '<div id="entry-content"><div class="constrained">'; 
     540 
     541     echo '<h3 class="hidden">'.__('Edit post').'</h3>'; 
     542      
     543     foreach ($main_items as $id => $item) { 
     544          echo $item; 
     545     } 
     546 
     547     # --BEHAVIOR-- adminPostForm (may be deprecated) 
     548     $core->callBehavior('adminPostForm',isset($post) ? $post : null); 
    412549      
    413550     echo 
    414      '<p class="col"><label class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Title:'). 
    415      form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 
    416      '</label></p>'. 
    417       
    418      '<p class="area" id="excerpt-area"><label for="post_excerpt">'.__('Excerpt:').'</label> '. 
    419      form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
    420      '</p>'. 
    421       
    422      '<p class="area"><label class="required" '. 
    423      'for="post_content"><abbr title="'.__('Required field').'">*</abbr> '.__('Content:').'</label> '. 
    424      form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
    425      '</p>'. 
    426       
    427      '<p class="area" id="notes-area"><label for="post_notes">'.__('Notes:').'</label>'. 
    428      form::textarea('post_notes',50,5,html::escapeHTML($post_notes)). 
    429      '</p>'; 
    430       
    431      # --BEHAVIOR-- adminPostForm 
    432      $core->callBehavior('adminPostForm',isset($post) ? $post : null); 
    433       
    434      echo 
    435      '<p>'. 
     551     '<p class="border-top">'. 
    436552     ($post_id ? form::hidden('id',$post_id) : ''). 
    437553     '<input type="submit" value="'.__('Save').' (s)" '. 
     
    458574     echo '<div id="entry-sidebar">'; 
    459575      
    460      echo 
    461      '<p><label for="cat_id">'.__('Category:'). 
    462      form::combo('cat_id',$categories_combo,$cat_id,'maximal'). 
    463      '</label></p>'. 
    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       
    477      '<p><label for="post_status">'.__('Entry status:'). 
    478      form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 
    479      '</label></p>'. 
    480       
    481      '<p><label for="post_dt">'.__('Published on:'). 
    482      form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
    483      '</label></p>'. 
    484       
    485      '<p><label for="post_format">'.__('Text formating:'). 
    486      form::combo('post_format',$formaters_combo,$post_format). 
    487      '</label>'. 
    488      '</p>'. 
    489      '<p>'.($post_id && $post_format != 'xhtml' ? '<a id="convert-xhtml" class="button" href="post.php?id='.$post_id.'&amp;xconv=1">'.__('Convert to XHTML').'</a>' : '').'</p>'. 
    490       
    491      '<p><label for="post_open_comment" class="classic">'.form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    492      __('Accept comments').'</label></p>'. 
    493      ($core->blog->settings->system->allow_comments ?  
    494           (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
    495                '' : 
    496                '<p class="form-note warn">'.__('Warning: Comments are not more accepted for this entry.').'</p>') :  
    497           '<p class="form-note warn">'.__('Warning: Comments are not accepted on this blog.').'</p>'). 
    498  
    499      '<p><label for="post_open_tb" class="classic">'.form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    500      __('Accept trackbacks').'</label></p>'. 
    501      ($core->blog->settings->system->allow_trackbacks ?  
    502           (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
    503                '' : 
    504                '<p class="form-note warn">'.__('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
    505           '<p class="form-note warn">'.__('Warning: Trackbacks are not accepted on this blog.').'</p>'). 
    506  
    507      '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 
    508      __('Selected entry').'</label></p>'. 
    509       
    510      '<p><label for="post_lang">'.__('Entry lang:'). 
    511      form::combo('post_lang',$lang_combo,$post_lang). 
    512      '</label></p>'. 
    513       
    514      '<p><label for="post_password">'.__('Entry password:'). 
    515      form::field('post_password',10,32,html::escapeHTML($post_password),'maximal'). 
    516      '</label></p>'. 
    517       
    518      '<div class="lockable">'. 
    519      '<p><label for="post_url">'.__('Basename:'). 
    520      form::field('post_url',10,255,html::escapeHTML($post_url),'maximal'). 
    521      '</label></p>'. 
    522      '<p class="form-note warn">'. 
    523      __('Warning: If you set the URL manually, it may conflict with another entry.'). 
    524      '</p>'. 
    525      '</div>'; 
    526       
    527      # --BEHAVIOR-- adminPostFormSidebar 
     576     foreach ($sidebar_items as $id => $c) { 
     577          echo '<div id="'.$id.'" class="box">'. 
     578               '<h4>'.$c['title'].'</h4>'; 
     579          foreach ($c['items'] as $e_name=>$e_content) { 
     580               echo $e_content; 
     581          } 
     582          echo '</div>'; 
     583     } 
     584      
     585      
     586     # --BEHAVIOR-- adminPostFormSidebar (may be deprecated) 
    528587     $core->callBehavior('adminPostFormSidebar',isset($post) ? $post : null); 
    529       
    530588     echo '</div>';      // End #entry-sidebar 
    531589 
     
    558616     if ($can_edit_post && $core->auth->check('publish,contentadmin',$core->blog->id)) 
    559617     { 
    560           $combo_action[__('publish')] = 'publish'; 
    561           $combo_action[__('unpublish')] = 'unpublish'; 
    562           $combo_action[__('mark as pending')] = 'pending'; 
    563           $combo_action[__('mark as junk')] = 'junk'; 
     618          $combo_action[__('Publish')] = 'publish'; 
     619          $combo_action[__('Unpublish')] = 'unpublish'; 
     620          $combo_action[__('Mark as pending')] = 'pending'; 
     621          $combo_action[__('Mark as junk')] = 'junk'; 
    564622     } 
    565623      
     
    623681     '<form action="comment.php" method="post" id="comment-form">'. 
    624682     '<div class="constrained">'. 
    625      '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:'). 
     683     '<p><label for="comment_author" class="required"><abbr title="'.__('Required field').'">*</abbr> '.__('Name:').'</label>'. 
    626684     form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 
    627      '</label></p>'. 
    628       
    629      '<p><label for="comment_email">'.__('Email:'). 
     685     '</p>'. 
     686      
     687     '<p><label for="comment_email">'.__('Email:').'</label>'. 
    630688     form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 
    631      '</label></p>'. 
    632       
    633      '<p><label for="comment_site">'.__('Web site:'). 
     689     '</p>'. 
     690      
     691     '<p><label for="comment_site">'.__('Web site:').'</label>'. 
    634692     form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 
    635      '</label></p>'. 
     693     '</p>'. 
    636694      
    637695     '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 
     
    675733     echo 
    676734     '<table class="comments-list"><tr>'. 
    677      '<th colspan="2">'.__('Author').'</th>'. 
     735     '<th colspan="2" class="first">'.__('Author').'</th>'. 
    678736     '<th>'.__('Date').'</th>'. 
    679737     '<th class="nowrap">'.__('IP address').'</th>'. 
    680738     '<th>'.__('Status').'</th>'. 
    681      '<th>&nbsp;</th>'. 
     739     '<th>'.__('Edit').'</th>'. 
    682740     '</tr>'; 
    683741      
     
    689747          switch ($rs->comment_status) { 
    690748               case 1: 
    691                     $img_status = sprintf($img,__('published'),'check-on.png'); 
     749                    $img_status = sprintf($img,__('Published'),'check-on.png'); 
    692750                    break; 
    693751               case 0: 
    694                     $img_status = sprintf($img,__('unpublished'),'check-off.png'); 
     752                    $img_status = sprintf($img,__('Unpublished'),'check-off.png'); 
    695753                    break; 
    696754               case -1: 
    697                     $img_status = sprintf($img,__('pending'),'check-wrn.png'); 
     755                    $img_status = sprintf($img,__('Pending'),'check-wrn.png'); 
    698756                    break; 
    699757               case -2: 
    700                     $img_status = sprintf($img,__('junk'),'junk.png'); 
     758                    $img_status = sprintf($img,__('Junk'),'junk.png'); 
    701759                    break; 
    702760          } 
     
    713771          '<td class="nowrap status">'.$img_status.'</td>'. 
    714772          '<td class="nowrap status"><a href="'.$comment_url.'">'. 
    715           '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /></a></td>'. 
     773          '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. 
    716774           
    717775          '</tr>'; 
     
    721779} 
    722780 
    723 dcPage::helpBlock('core_post','core_wiki'); 
     781dcPage::helpBlock('core_post','core_trackbacks','core_wiki'); 
    724782dcPage::close(); 
    725783?> 
Note: See TracChangeset for help on using the changeset viewer.

Sites map