Dotclear


Ignore:
Timestamp:
11/01/12 07:54:41 (13 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Add syntax color option to theme editor plugin, using CodeMirror? ( http://codemirror.net/), fixes #628

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/themeEditor/_admin.php

    r270 r948  
    1616} 
    1717 
    18 $core->addBehavior('adminCurrentThemeDetails','theme_editor_details'); 
     18$core->addBehavior('adminCurrentThemeDetails', array('themeEditorBehaviors','theme_editor_details')); 
    1919 
    20 function theme_editor_details($core,$id) 
     20$core->addBehavior('adminBeforeUserOptionsUpdate',array('themeEditorBehaviors','adminBeforeUserUpdate')); 
     21$core->addBehavior('adminPreferencesForm',array('themeEditorBehaviors','adminPreferencesForm')); 
     22 
     23class themeEditorBehaviors 
    2124{ 
    22      if ($id != 'default' && $core->auth->isSuperAdmin()) { 
    23           return '<p><a href="plugin.php?p=themeEditor" class="button">'.__('Theme Editor').'</a></p>'; 
     25     function theme_editor_details($core,$id) 
     26     { 
     27          if ($id != 'default' && $core->auth->isSuperAdmin()) { 
     28               return '<p><a href="plugin.php?p=themeEditor" class="button">'.__('Theme Editor').'</a></p>'; 
     29          } 
     30     } 
     31 
     32     public static function adminBeforeUserUpdate($cur,$userID) 
     33     { 
     34          global $core; 
     35 
     36          // Get and store user's prefs for plugin options 
     37          $core->auth->user_prefs->addWorkspace('interface'); 
     38          try { 
     39               $core->auth->user_prefs->interface->put('colorsyntax',!empty($_POST['colorsyntax']),'boolean'); 
     40          }  
     41          catch (Exception $e) 
     42          { 
     43               $core->error->add($e->getMessage()); 
     44          } 
     45     } 
     46      
     47     public static function adminPreferencesForm($core) 
     48     { 
     49          // Add fieldset for plugin options 
     50          $core->auth->user_prefs->addWorkspace('interface'); 
     51 
     52          echo 
     53          '<fieldset><legend>'.__('Theme Editor').'</legend>'. 
     54           
     55          '<p><label for"colorsyntax" class="classic">'. 
     56          form::checkbox('colorsyntax',1,$core->auth->user_prefs->interface->colorsyntax).' '. 
     57          __('Syntax color').'</label></p>'. 
     58 
     59          '<br class="clear" />'. //Opera sucks 
     60          '</fieldset>'; 
    2461     } 
    2562} 
Note: See TracChangeset for help on using the changeset viewer.

Sites map