Dotclear

Changeset 2682:cac55fdd7178


Ignore:
Timestamp:
03/11/14 20:46:03 (12 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Children:
2683:fb8aa74332f1, 2684:599c0d392db2
Message:

Addresses #1896. Multiple editors.
Fix issue when no editor is activated or when choosen editor has been deactivated.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r2681 r2682  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2014 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    449449if ($can_edit_post) 
    450450{ 
     451     if (count($formaters_combo)>0) { 
     452          $post_format_field = form::combo('post_format',$formaters_combo,$post_format,'maximal'); 
     453     } else { 
     454          $post_format_field = '<a href="preferences.php#user-options">'.__('Choose an activated editor').'</a>'; 
     455     } 
     456 
    451457     $sidebar_items = new ArrayObject(array( 
    452458          'status-box' => array( 
     
    468474                         '<div>'. 
    469475                         '<h5 id="label_format"><label for="post_format" class="classic">'.__('Text formatting').'</label></h5>'. 
    470                          '<p>'.form::combo('post_format',$formaters_combo,$post_format,'maximal'). 
    471                          '</p>'. 
     476                         '<p>'.$post_format_field.'</p>'. 
    472477                         '<p class="format_control control_no_xhtml">'. 
    473478                         '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="post.php?id='.$post_id.'&amp;xconv=1">'. 
  • admin/preferences.php

    r2679 r2682  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2014 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    6868$formaters_combo = dcAdminCombos::getFormatersCombo(); 
    6969 
    70 if (!empty($user_options['editor'])) { 
     70if (!empty($user_options['editor']) && !empty($formaters_combo[$user_options['editor']])) { 
    7171    $formaters_combo_editor = $formaters_combo[$user_options['editor']]; 
    7272} elseif (count($editors)!=0) { 
     
    468468'</div>'; 
    469469 
     470// hide editor selector if less than 2 editors 
     471if (count($editors)<2) { 
     472    $editor_class = ' hidden';     
     473} else { 
     474    $editor_class = ''; 
     475} 
     476 
    470477echo 
    471478'<div class="fieldset">'. 
    472479'<h4>'.__('Edition').'</h4>'. 
    473480 
    474 '<p class="field"><label for="user_editor">'.__('Preferred editor:').'</label>'. 
     481'<p class="field'.$editor_class.'"><label for="user_editor">'.__('Preferred editor:').'</label>'. 
    475482form::combo('user_editor',$editors_combo,$user_options['editor']).'</p>'. 
    476483 
  • inc/core/class.dc.core.php

    r2679 r2682  
    44# This file is part of Dotclear 2. 
    55# 
    6 # Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear 
     6# Copyright (c) 2003-2014 Olivier Meunier & Association Dotclear 
    77# Licensed under the GPL version 2.0 license. 
    88# See LICENSE file or 
     
    262262     @param    editor_id <b>string</b>  Editor id (dcLegacyEditor, dcCKEditor, ...) 
    263263     @return   <b>array</b> An array of formaters names in values. 
     264 
     265    /** 
     266    if @param editor_id is empty: 
     267    return all formaters sorted by actives editors 
     268     
     269    if @param editor_id is not empty 
     270    return formaters for an editor if editor is active 
     271    return empty() array if editor is not active.  
     272    It can happens when a user choose an editor and admin deactivate that editor later 
    264273     */ 
    265274     public function getFormaters($editor_id='') 
     
    267276          $formaters_list = array(); 
    268277 
    269           if (!empty($editor_id) && isset($this->formaters[$editor_id])) { 
    270                $formaters_list = array_keys($this->formaters[$editor_id]); 
     278          if (!empty($editor_id)) { 
     279            if (isset($this->formaters[$editor_id])) { 
     280                $formaters_list = array_keys($this->formaters[$editor_id]); 
     281            } 
    271282          } else { 
    272283               foreach ($this->formaters as $editor => $formaters) { 
Note: See TracChangeset for help on using the changeset viewer.

Sites map