Dotclear

Changeset 3251:9ed815f75542 for plugins


Ignore:
Timestamp:
06/15/16 17:36:30 (9 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Upgrade codemirror (from 2.35.0 to 5.15.2) and move from themeEditor plugin to admin/js

Location:
plugins/themeEditor
Files:
9 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • plugins/themeEditor/_admin.php

    r2820 r3251  
    3838          try { 
    3939               $core->auth->user_prefs->interface->put('colorsyntax',!empty($_POST['colorsyntax']),'boolean'); 
     40               $core->auth->user_prefs->interface->put('colorsyntax_theme', 
     41                    (!empty($_POST['colorsyntax_theme']) ? $_POST['colorsyntax_theme'] : '')); 
    4042          } 
    4143          catch (Exception $e) 
     
    5052          $core->auth->user_prefs->addWorkspace('interface'); 
    5153 
     54          $themes_list = dcPage::getCodeMirrorThemes(); 
     55          $themes_combo = array(__('Default') => ''); 
     56          foreach ($themes_list as $theme) { 
     57               $themes_combo[$theme] = $theme; 
     58          } 
     59 
    5260          echo 
    53           '<p><label for="colorsyntax" class="classic">'. 
    54           form::checkbox('colorsyntax',1,$core->auth->user_prefs->interface->colorsyntax).'</label>'. 
    55           __('Syntax highlighting in theme editor'). 
    56           '</p>'; 
     61               '<div class="fieldset two-cols clearfix">'. 
     62               '<h5>'.__('Syntax highlighting').'</h5>'; 
     63          echo 
     64               '<div class="col">'. 
     65               '<p><label for="colorsyntax" class="classic">'. 
     66               form::checkbox('colorsyntax',1,$core->auth->user_prefs->interface->colorsyntax).'</label>'. 
     67               __('Syntax highlighting in theme editor'). 
     68               '</p>'; 
     69          if (count($themes_combo) > 1) { 
     70               echo 
     71                    '<p><label for="colorsyntax_theme" class="classic">'.__('Theme:').'</label> '. 
     72                    form::combo('colorsyntax_theme',$themes_combo,$core->auth->user_prefs->interface->colorsyntax_theme, 
     73                         '','',false,'onchange="selectTheme()"'). 
     74                    '</p>'; 
     75          } else { 
     76               echo form::hidden('colorsyntax_theme',''); 
     77          } 
     78          echo '</div>'; 
     79          echo '<div class="col">'; 
     80          echo dcPage::jsCodeMirror('',false,array('javascript')); 
     81          foreach ($themes_list as $theme) { 
     82               echo dcPage::cssLoad('js/codemirror/theme/'.$theme.'.css'); 
     83          } 
     84          echo ' 
     85<textarea id="codemirror" name="codemirror"> 
     86function findSequence(goal) { 
     87  function find(start, history) { 
     88    if (start == goal) 
     89      return history; 
     90    else if (start > goal) 
     91      return null; 
     92    else 
     93      return find(start + 5, "(" + history + " + 5)") || 
     94             find(start * 3, "(" + history + " * 3)"); 
     95  } 
     96  return find(1, "1"); 
     97}</textarea>'; 
     98          echo 
     99          '<script> 
     100               var input = document.getElementById("colorsyntax_theme"); 
     101               var theme = input.options[input.selectedIndex].textContent; 
     102          var editor = CodeMirror.fromTextArea(document.getElementById("codemirror"), { 
     103               mode: "javascript", 
     104                    tabMode: "indent", 
     105                    lineWrapping: "true", 
     106                    lineNumbers: "true", 
     107                    matchBrackets: "true", 
     108                    autoCloseBrackets: "true", 
     109                    theme: "'.($core->auth->user_prefs->interface->colorsyntax_theme != '' ? $core->auth->user_prefs->interface->colorsyntax_theme : 'default').'" 
     110               }); 
     111               function selectTheme() { 
     112                    var input = document.getElementById("colorsyntax_theme"); 
     113                    var theme = input.options[input.selectedIndex].value; 
     114                    if (theme == "") theme = "default"; 
     115                    editor.setOption("theme", theme); 
     116                    editor.refresh(); 
     117               } 
     118         </script>'; 
     119          echo '</div>'; 
     120          echo '</div>'; 
    57121     } 
    58122} 
  • plugins/themeEditor/_define.php

    r2890 r3251  
    1616     /* Description*/         "Theme Editor", 
    1717     /* Author */             "Olivier Meunier", 
    18      /* Version */            '1.2', 
     18     /* Version */            '1.3', 
    1919     array( 
    2020          'type'         =>        'plugin' 
  • plugins/themeEditor/index.php

    r3021 r3251  
    1919$core->auth->user_prefs->addWorkspace('interface'); 
    2020$user_ui_colorsyntax = $core->auth->user_prefs->interface->colorsyntax; 
     21$user_ui_colorsyntax_theme = $core->auth->user_prefs->interface->colorsyntax_theme; 
    2122 
    2223# Loading themes 
     
    8384  <script type="text/javascript" src="<?php echo dcPage::getPF('themeEditor/script.js'); ?>"></script> 
    8485<?php if ($user_ui_colorsyntax) { ?> 
    85   <?php echo dcPage::cssLoad(dcPage::getPF('themeEditor/codemirror/codemirror.css'));?> 
    86   <?php echo dcPage::cssLoad(dcPage::getPF('themeEditor/codemirror.css'));?> 
    87   <?php echo dcPage::jsLoad(dcPage::getPF('themeEditor/codemirror/codemirror.js'));?> 
    88   <?php echo dcPage::jsLoad(dcPage::getPF('themeEditor/codemirror/multiplex.js'));?> 
    89   <?php echo dcPage::jsLoad(dcPage::getPF('themeEditor/codemirror/xml.js'));?> 
    90   <?php echo dcPage::jsLoad(dcPage::getPF('themeEditor/codemirror/javascript.js'));?> 
    91   <?php echo dcPage::jsLoad(dcPage::getPF('themeEditor/codemirror/css.js'));?> 
    92   <?php echo dcPage::jsLoad(dcPage::getPF('themeEditor/codemirror/php.js'));?> 
    93   <?php echo dcPage::jsLoad(dcPage::getPF('themeEditor/codemirror/htmlmixed.js'));?> 
     86     <?php echo dcPage::jsCodeMirror($user_ui_colorsyntax_theme); ?> 
    9487<?php } ?> 
    9588</head> 
     
    171164                    lineWrapping: "true", 
    172165                    lineNumbers: "true", 
    173                     matchBrackets: "true" 
     166                    matchBrackets: "true", 
     167                    autoCloseBrackets: "true"'. 
     168                    ($user_ui_colorsyntax_theme != '' ? ',theme: "'.$user_ui_colorsyntax_theme.'"' : '').' 
    174169               }); 
    175170         </script>'; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map