Dotclear

Changeset 2511:798af8190003


Ignore:
Timestamp:
11/03/13 18:11:26 (10 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
2.6
Message:

Fixes URL of "convert to XHTML" on page edit form, fixes #1838

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/pages/page.php

    r2390 r2511  
    7373     $params['post_type'] = 'page'; 
    7474     $params['post_id'] = $_REQUEST['id']; 
    75       
     75 
    7676     $post = $core->blog->getPosts($params); 
    77       
     77 
    7878     if ($post->isEmpty()) 
    7979     { 
     
    100100          $post_open_tb = (boolean) $post->post_open_tb; 
    101101          $post_selected = (boolean) $post->post_selected; 
    102            
     102 
    103103          $page_title = __('Edit page'); 
    104            
     104 
    105105          $can_edit_page = $post->isEditable(); 
    106106          $can_delete= $post->isDeletable(); 
    107            
     107 
    108108          $next_rs = $core->blog->getNextPost($post,1); 
    109109          $prev_rs = $core->blog->getNextPost($post,-1); 
    110            
     110 
    111111          if ($next_rs !== null) { 
    112112               $next_link = sprintf($post_link,$next_rs->post_id, 
     
    115115                    html::escapeHTML($next_rs->post_title),$next_rs->post_id); 
    116116          } 
    117            
     117 
    118118          if ($prev_rs !== null) { 
    119119               $prev_link = sprintf($post_link,$prev_rs->post_id, 
     
    122122                    html::escapeHTML($prev_rs->post_title),$prev_rs->post_id); 
    123123          } 
    124            
     124 
    125125          try { 
    126126               $core->media = new dcMedia($core); 
     
    138138     $post_excerpt = $_POST['post_excerpt']; 
    139139     $post_content = $_POST['post_content']; 
    140       
     140 
    141141     $post_title = $_POST['post_title']; 
    142       
     142 
    143143     if (isset($_POST['post_status'])) { 
    144144          $post_status = (integer) $_POST['post_status']; 
    145145     } 
    146       
     146 
    147147     if (empty($_POST['post_dt'])) { 
    148148          $post_dt = ''; 
     
    162162          } 
    163163     } 
    164       
     164 
    165165     $post_open_comment = !empty($_POST['post_open_comment']); 
    166166     $post_open_tb = !empty($_POST['post_open_tb']); 
     
    169169     $post_password = !empty($_POST['post_password']) ? $_POST['post_password'] : null; 
    170170     $post_position = (integer) $_POST['post_position']; 
    171       
     171 
    172172     $post_notes = $_POST['post_notes']; 
    173173 
     
    175175          $post_url = $_POST['post_url']; 
    176176     } 
    177       
     177 
    178178     $core->blog->setPostContent( 
    179179          $post_id,$post_format,$post_lang, 
     
    199199{ 
    200200     $cur = $core->con->openCursor($core->prefix.'post'); 
    201       
     201 
    202202     # Magic tweak :) 
    203203     $core->blog->settings->system->post_url_format = $page_url_format; 
    204       
     204 
    205205     $cur->post_type = 'page'; 
    206206     $cur->post_title = $post_title; 
     
    220220     $cur->post_open_tb = (integer) $post_open_tb; 
    221221     $cur->post_selected = (integer) $post_selected; 
    222       
     222 
    223223     if (isset($_POST['post_url'])) { 
    224224          $cur->post_url = $post_url; 
    225225     } 
    226       
     226 
    227227     # Update post 
    228228     if ($post_id) 
     
    232232               # --BEHAVIOR-- adminBeforePageUpdate 
    233233               $core->callBehavior('adminBeforePageUpdate',$cur,$post_id); 
    234                 
     234 
    235235               $core->blog->updPost($post_id,$cur); 
    236                 
     236 
    237237               # --BEHAVIOR-- adminAfterPageUpdate 
    238238               $core->callBehavior('adminAfterPageUpdate',$cur,$post_id); 
    239                 
     239 
    240240               http::redirect($redir_url.'&id='.$post_id.'&upd=1'); 
    241241          } 
     
    248248     { 
    249249          $cur->user_id = $core->auth->userID(); 
    250            
     250 
    251251          try 
    252252          { 
    253253               # --BEHAVIOR-- adminBeforePageCreate 
    254254               $core->callBehavior('adminBeforePageCreate',$cur); 
    255                 
     255 
    256256               $return_id = $core->blog->addPost($cur); 
    257                 
     257 
    258258               # --BEHAVIOR-- adminAfterPageCreate 
    259259               $core->callBehavior('adminAfterPageCreate',$cur,$return_id); 
    260                 
     260 
    261261               http::redirect($redir_url.'&id='.$return_id.'&crea=1'); 
    262262          } 
     
    351351     $post_content = $post_content_xhtml; 
    352352     $post_format = 'xhtml'; 
    353       
     353 
    354354     dcPage::message(__('Don\'t forget to validate your XHTML conversion by saving your post.')); 
    355355} 
     
    367367     if ($next_link && $prev_link) { echo ' | '; } 
    368368     if ($next_link) { echo $next_link; } 
    369       
    370      # --BEHAVIOR-- adminPageNavLinks  
     369 
     370     # --BEHAVIOR-- adminPageNavLinks 
    371371     $core->callBehavior('adminPageNavLinks',isset($post) ? $post : null); 
    372       
     372 
    373373     echo '</p>'; 
    374374} 
     
    389389               'title' => __('Status'), 
    390390               'items' => array( 
    391                     'post_status' =>  
     391                    'post_status' => 
    392392                         '<p><label for="post_status">'.__('Page status').'</label> '. 
    393393                         form::combo('post_status',$status_combo,$post_status,'','',!$can_publish). 
    394394                         '</p>', 
    395                     'post_dt' =>  
     395                    'post_dt' => 
    396396                         '<p><label for="post_dt">'.__('Publication date and hour').'</label>'. 
    397397                         form::field('post_dt',16,16,$post_dt,($bad_dt ? 'invalid' : '')). 
     
    407407                         '</p>'. 
    408408                         '<p class="format_control control_wiki">'. 
    409                          '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="post.php?id='.$post_id.'&amp;xconv=1">'. 
     409                         '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : ''). 
     410                         '" href="'.html::escapeURL($redir_url).'&amp;id='.$post_id.'&amp;xconv=1">'. 
    410411                         __('Convert to XHTML').'</a></p></div>')), 
    411412          'metas-box' => array( 
    412413               'title' => __('Filing'), 
    413414               'items' => array( 
    414                     'post_position' =>  
     415                    'post_position' => 
    415416                         '<p><label for="post_position" class="classic">'.__('Page position').'</label> '. 
    416417                         form::field('post_position',3,3,(string) $post_position). 
     
    425426                         form::checkbox('post_open_comment',1,$post_open_comment).' '. 
    426427                         __('Accept comments').'</label></p>'. 
    427                          ($core->blog->settings->system->allow_comments ?  
    428                               (isContributionAllowed($post_id,strtotime($post_dt),true) ?  
     428                         ($core->blog->settings->system->allow_comments ? 
     429                              (isContributionAllowed($post_id,strtotime($post_dt),true) ? 
    429430                                   '' : 
    430431                                   '<p class="form-note warn">'. 
    431                                    __('Warning: Comments are not more accepted for this entry.').'</p>') :  
     432                                   __('Warning: Comments are not more accepted for this entry.').'</p>') : 
    432433                              '<p class="form-note warn">'. 
    433434                              __('Comments are not accepted on this blog so far.').'</p>'). 
     
    435436                         form::checkbox('post_open_tb',1,$post_open_tb).' '. 
    436437                         __('Accept trackbacks').'</label></p>'. 
    437                          ($core->blog->settings->system->allow_trackbacks ?  
    438                               (isContributionAllowed($post_id,strtotime($post_dt),false) ?  
     438                         ($core->blog->settings->system->allow_trackbacks ? 
     439                              (isContributionAllowed($post_id,strtotime($post_dt),false) ? 
    439440                                   '' : 
    440441                                   '<p class="form-note warn">'. 
    441                                    __('Warning: Trackbacks are not more accepted for this entry.').'</p>') :  
     442                                   __('Warning: Trackbacks are not more accepted for this entry.').'</p>') : 
    442443                              '<p class="form-note warn">'.__('Trackbacks are not accepted on this blog so far.').'</p>'). 
    443444                         '</div>', 
    444                     'post_hide' =>  
     445                    'post_hide' => 
    445446                         '<p><label for="post_selected" class="classic">'.form::checkbox('post_selected',1,$post_selected).' '. 
    446447                         __('Hide in widget Pages').'</label>'. 
     
    465466               form::field('post_title',20,255,html::escapeHTML($post_title),'maximal'). 
    466467               '</p>', 
    467            
     468 
    468469          "post_excerpt" => 
    469470               '<p class="area" id="excerpt-area"><label for="post_excerpt" class="bold">'.__('Excerpt:').' <span class="form-note">'. 
     
    471472               form::textarea('post_excerpt',50,5,html::escapeHTML($post_excerpt)). 
    472473               '</p>', 
    473            
     474 
    474475          "post_content" => 
    475476               '<p class="area" id="content-area"><label class="required bold" '. 
     
    477478               form::textarea('post_content',50,$core->auth->getOption('edit_size'),html::escapeHTML($post_content)). 
    478479               '</p>', 
    479            
     480 
    480481          "post_notes" => 
    481482               '<p class="area" id="notes-area"><label for="post_notes" class="bold">'.__('Personal notes:').' <span class="form-note">'. 
     
    495496     echo '<div id="entry-content"><div class="constrained">'; 
    496497     echo '<h3 class="out-of-screen-if-js">'.__('Edit page').'</h3>'; 
    497       
    498       
     498 
     499 
    499500     foreach ($main_items as $id => $item) { 
    500501          echo $item; 
     
    503504     # --BEHAVIOR-- adminPageForm 
    504505     $core->callBehavior('adminPageForm',isset($post) ? $post : null); 
    505       
     506 
    506507     echo 
    507508     '<p class="border-top">'. 
     
    526527     $core->formNonce(). 
    527528     '</p>'; 
    528       
     529 
    529530     echo '</div></div>';          // End #entry-content 
    530531     echo '</div>';      // End #entry-wrapper 
    531532 
    532533     echo '<div id="entry-sidebar">'; 
    533       
     534 
    534535     foreach ($sidebar_items as $id => $c) { 
    535536          echo '<div id="'.$id.'" class="sb-box">'. 
     
    540541          echo '</div>'; 
    541542     } 
    542       
     543 
    543544     # --BEHAVIOR-- adminPageFormSidebar 
    544545     $core->callBehavior('adminPageFormSidebar',isset($post) ? $post : null); 
    545       
     546 
    546547     echo '</div>';      // End #entry-sidebar 
    547       
     548 
    548549     echo '</form>'; 
    549      echo '</div>';      // End  
    550       
     550     echo '</div>';      // End 
     551 
    551552     if ($post_id && !empty($post_media)) 
    552553     { 
     
    566567{ 
    567568     $params = array('post_id' => $post_id, 'order' => 'comment_dt ASC'); 
    568       
     569 
    569570     $comments = $core->blog->getComments(array_merge($params,array('comment_trackback'=>0))); 
    570571     $trackbacks = $core->blog->getComments(array_merge($params,array('comment_trackback'=>1))); 
    571       
     572 
    572573     # Actions combo box 
    573574     $combo_action = array(); 
     
    579580          $combo_action[__('Mark as junk')] = 'junk'; 
    580581     } 
    581       
     582 
    582583     if ($can_edit_page && $core->auth->check('delete,contentadmin',$core->blog->id)) 
    583584     { 
    584585          $combo_action[__('Delete')] = 'delete'; 
    585586     } 
    586       
     587 
    587588     $has_action = !empty($combo_action) && (!$trackbacks->isEmpty() || !$comments->isEmpty()); 
    588       
     589 
    589590     echo 
    590591     '<div id="comments" class="multi-part" title="'.__('Comments').'">'; 
    591       
     592 
    592593     echo 
    593594     '<p class="top-add"><a class="button add" href="#comment-form">'.__('Add a comment').'</a></p>'; 
     
    596597          echo '<form action="comments_actions.php" method="post">'; 
    597598     } 
    598       
     599 
    599600     echo '<h3>'.__('Trackbacks').'</h3>'; 
    600       
     601 
    601602     if (!$trackbacks->isEmpty()) { 
    602603          showComments($trackbacks,$has_action); 
     
    604605          echo '<p>'.__('No trackback').'</p>'; 
    605606     } 
    606       
     607 
    607608     echo '<h3>'.__('Comments').'</h3>'; 
    608609     if (!$comments->isEmpty()) { 
     
    611612          echo '<p>'.__('No comment').'</p>'; 
    612613     } 
    613       
     614 
    614615     if ($has_action) { 
    615616          echo 
    616617          '<div class="two-cols">'. 
    617618          '<p class="col checkboxes-helpers"></p>'. 
    618            
     619 
    619620          '<p class="col right"><label for="action" class="classic">'.__('Selected comments action:').'</label> '. 
    620621          form::combo('action',$combo_action). 
     
    631632     '<div class="fieldset clear">'. 
    632633     '<h3>'.__('Add a comment').'</h3>'. 
    633       
     634 
    634635     '<form action="comment.php" method="post" id="comment-form">'. 
    635636     '<div class="constrained">'. 
     
    637638     form::field('comment_author',30,255,html::escapeHTML($core->auth->getInfo('user_cn'))). 
    638639     '</p>'. 
    639       
     640 
    640641     '<p><label for="comment_email">'.__('Email:').'</label>'. 
    641642     form::field('comment_email',30,255,html::escapeHTML($core->auth->getInfo('user_email'))). 
    642643     '</p>'. 
    643       
     644 
    644645     '<p><label for="comment_site">'.__('Web site:').'</label>'. 
    645646     form::field('comment_site',30,255,html::escapeHTML($core->auth->getInfo('user_url'))). 
    646647     '</p>'. 
    647       
     648 
    648649     '<p class="area"><label for="comment_content" class="required"><abbr title="'.__('Required field').'">*</abbr> '. 
    649650     __('Comment:').'</label> '. 
    650651     form::textarea('comment_content',50,8,html::escapeHTML('')). 
    651652     '</p>'. 
    652       
     653 
    653654     '<p>'.form::hidden('post_id',$post_id). 
    654655     $core->formNonce(). 
     
    670671     } 
    671672     if ($com) { 
    672           if (($core->blog->settings->system->comments_ttl == 0) ||  
     673          if (($core->blog->settings->system->comments_ttl == 0) || 
    673674               (time() - $core->blog->settings->system->comments_ttl*86400 < $dt)) { 
    674675               return true; 
    675676          } 
    676677     } else { 
    677           if (($core->blog->settings->system->trackbacks_ttl == 0) ||  
     678          if (($core->blog->settings->system->trackbacks_ttl == 0) || 
    678679               (time() - $core->blog->settings->system->trackbacks_ttl*86400 < $dt)) { 
    679680               return true; 
     
    694695     '<th>'.__('Edit').'</th>'. 
    695696     '</tr>'; 
    696       
     697 
    697698     while($rs->fetch()) 
    698699     { 
    699700          $comment_url = 'comment.php?id='.$rs->comment_id; 
    700            
     701 
    701702          $img = '<img alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    702703          switch ($rs->comment_status) { 
     
    714715                    break; 
    715716          } 
    716            
     717 
    717718          echo 
    718719          '<tr class="line'.($rs->comment_status != 1 ? ' offline' : '').'"'. 
    719720          ' id="c'.$rs->comment_id.'">'. 
    720            
     721 
    721722          '<td class="nowrap">'. 
    722723          ($has_action ? form::checkbox(array('comments[]'),$rs->comment_id,'','','',0,'title="'.__('Select this comment').'"') : '').'</td>'. 
     
    727728          '<td class="nowrap status"><a href="'.$comment_url.'">'. 
    728729          '<img src="images/edit-mini.png" alt="" title="'.__('Edit this comment').'" /> '.__('Edit').'</a></td>'. 
    729            
     730 
    730731          '</tr>'; 
    731732     } 
    732       
     733 
    733734     echo '</table>'; 
    734735} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map