Dotclear


Ignore:
Timestamp:
08/25/14 09:20:20 (11 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Message:

Addresses #1896
Preferences: one editor for each available formats.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r2722 r2736  
    6060$img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; 
    6161 
    62 # Formaters combo 
    63 $formaters_combo = dcAdminCombos::getFormatersCombo(); 
    64 foreach ($formaters_combo as $editor => $formats) { 
     62# Formats combo 
     63$core_formaters = $core->getFormaters(); 
     64$available_formats = array('' => ''); 
     65foreach ($core_formaters as $editor => $formats) { 
    6566     foreach ($formats as $format) { 
    66           $formaters_combo[$editor][$format] = "$editor:$format"; 
    67      } 
     67        $available_formats[$format] = $format; 
     68    } 
    6869} 
    6970 
     
    7879$TB = new dcTrackback($core); 
    7980$tb_urls = $tb_excerpt = ''; 
    80  
    81 if (count($formaters_combo)==0 || !$core->auth->getOption('editor') || $core->auth->getOption('editor')=='') { 
    82      dcPage::addNotice("message", 
    83                            sprintf(__('Choose an active editor in %s.'), 
    84                                           '<a href="'.$core->adminurl->get("admin.user.preferences").'#user-options">'.__('your preferences').'</a>' 
    85                                           ) 
    86                            ); 
    87 } 
    8881 
    8982# Get entry informations 
     
    195188# Format excerpt and content 
    196189elseif (!empty($_POST) && $can_edit_post) { 
    197     list(, $post_format) = explode(':', $_POST['post_format']); 
     190     $post_format = $_POST['post_format']; 
    198191     $post_excerpt = $_POST['post_excerpt']; 
    199192     $post_content = $_POST['post_content']; 
     
    382375 
    383376$admin_post_behavior = ''; 
    384 if (($core->auth->getOption('editor')==$post_editor) 
    385     && in_array($post_format, $core->getFormaters($core->auth->getOption('editor')))) { 
    386     $admin_post_behavior = $core->callBehavior('adminPostEditor'); 
     377if (!empty($core->auth->getOption('editor')) && !empty($core->auth->getOption('editor')[$post_format])) { 
     378     $admin_post_behavior = $core->callBehavior('adminPostEditor', $core->auth->getOption('editor')[$post_format]); 
    387379} 
    388380 
     
    461453-------------------------------------------------------- */ 
    462454if ($can_edit_post) { 
    463      if (count($formaters_combo)>0 && ($core->auth->getOption('editor') && $core->auth->getOption('editor')!='')) { 
    464         $post_format_field = form::combo('post_format',$formaters_combo,"$post_editor:$post_format",'maximal'); 
    465      } else { 
    466           $post_format_field = sprintf(__('Choose an active editor in %s.'), 
    467           '<a href="'.$core->adminurl->get("admin.user.preferences").'#user-options">'.__('your preferences').'</a>' 
    468           ); 
    469           $post_format_field .= form::hidden('post_format','xhtml'); 
    470      } 
    471  
    472455     $sidebar_items = new ArrayObject(array( 
    473456          'status-box' => array( 
     
    489472                         '<div>'. 
    490473                         '<h5 id="label_format"><label for="post_format" class="classic">'.__('Text formatting').'</label></h5>'. 
    491                          '<p>'.$post_format_field.'</p>'. 
     474                         '<p>'.form::combo('post_format',$available_formats,$post_format,'maximal').'</p>'. 
    492475                         '<p class="format_control control_no_xhtml">'. 
    493476                         '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="'. 
Note: See TracChangeset for help on using the changeset viewer.

Sites map