Dotclear


Ignore:
Timestamp:
06/24/19 14:29:57 (6 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Switching from inline JS variables to JSON script, theme editor plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/themeEditor/index.php

    r3874 r3980  
    6666    <title><?php echo __('Edit theme files'); ?></title> 
    6767    <?php 
    68 echo dcPage::jsVars([ 
    69     'dotclear.msg.saving_document'    => __("Saving document..."), 
    70     'dotclear.msg.document_saved'     => __("Document saved"), 
    71     'dotclear.msg.error_occurred'     => __("An error occurred:"), 
    72     'dotclear.msg.confirm_reset_file' => __("Are you sure you want to reset this file?") 
     68if ($user_ui_colorsyntax) { 
     69    echo dcPage::jsJson('dotclear_colorsyntax', ['colorsyntax' => $user_ui_colorsyntax]); 
     70} 
     71echo dcPage::jsJson('theme_editor_msg', [ 
     72    'saving_document'    => __("Saving document..."), 
     73    'document_saved'     => __("Document saved"), 
     74    'error_occurred'     => __("An error occurred:"), 
     75    'confirm_reset_file' => __("Are you sure you want to reset this file?") 
    7376]) . 
    74 dcPage::jsConfirmClose('file-form') . 
    75 dcPage::jsLoad(dcPage::getPF('themeEditor/js/script.js')); 
     77dcPage::jsLoad(dcPage::getPF('themeEditor/js/script.js')) . 
     78dcPage::jsConfirmClose('file-form') ; 
    7679if ($user_ui_colorsyntax) { 
    77     echo dcPage::jsVars(['dotclear.colorsyntax' => $user_ui_colorsyntax]); 
    7880    echo dcPage::jsLoadCodeMirror($user_ui_colorsyntax_theme); 
    7981} 
     
    135137            (!empty($_REQUEST['js']) ? "javascript" : 
    136138                (!empty($_REQUEST['po']) ? "text/plain" : "text/html"))); 
    137         echo 
    138             '<script type="text/javascript"> 
    139             window.CodeMirror.defineMode("dotclear", function(config) { 
    140                 return CodeMirror.multiplexingMode( 
    141                     CodeMirror.getMode(config, "' . $editorMode . '"), 
    142                     {open: "{{tpl:", close: "}}", 
    143                      mode: CodeMirror.getMode(config, "text/plain"), 
    144                      delimStyle: "delimit"}, 
    145                     {open: "<tpl:", close: ">", 
    146                      mode: CodeMirror.getMode(config, "text/plain"), 
    147                      delimStyle: "delimit"}, 
    148                     {open: "</tpl:", close: ">", 
    149                      mode: CodeMirror.getMode(config, "text/plain"), 
    150                      delimStyle: "delimit"} 
    151                     ); 
    152             }); 
    153         </script>'; 
     139        echo dcPage::jsJson('theme_editor_mode', ['mode' => $editorMode]); 
     140        echo dcPage::jsLoad(dcPage::getPF('themeEditor/js/mode.js')); 
    154141        echo dcPage::jsRunCodeMirror('editor', 'file_content', 'dotclear', $user_ui_colorsyntax_theme); 
    155142    } 
Note: See TracChangeset for help on using the changeset viewer.

Sites map