From cf4e2c81f948a1a9e54258d3ced978d1ad2ef234 Mon Sep 17 00:00:00 2001 From: patdenice Date: Tue, 12 Apr 2011 11:40:06 +0000 Subject: merge r10307 from trunk to branch 2.2 feature:2262 Replace editarea by Codemirror: http://codemirror.net git-svn-id: http://piwigo.org/svn/branches/2.2@10310 68402e56-0260-453c-a942-63ccdbb3a9ee --- plugins/LocalFilesEditor/admin.php | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'plugins/LocalFilesEditor/admin.php') diff --git a/plugins/LocalFilesEditor/admin.php b/plugins/LocalFilesEditor/admin.php index 8295e19a8..a9205cfac 100644 --- a/plugins/LocalFilesEditor/admin.php +++ b/plugins/LocalFilesEditor/admin.php @@ -74,13 +74,6 @@ Author URI: */\n\n\n\n\n?>"; $newfile_page = isset($_GET['newfile']) ? true : false; -// Editarea options -$editarea_options = array( - 'language' => substr($user['language'], 0, 2), - 'start_highlight' => true, - 'allow_toggle' => false, - 'toolbar' => 'search,fullscreen, |,select_font, |, undo, redo, change_smooth_selection, highlight, reset_highlight, |, help'); - // Edit selected file for CSS, template and language if ((isset($_POST['edit'])) and !is_numeric($_POST['file_to_edit'])) { @@ -138,7 +131,7 @@ switch ($page['tab']) array('SHOW_DEFAULT' => LOCALEDIT_PATH . 'show_default.php?file=include/config_default.inc.php', 'FILE' => 'config_default.inc.php'))); - $editarea_options['syntax'] = 'php'; + $codemirror_mode = 'application/x-httpd-php'; break; case 'css': @@ -159,7 +152,7 @@ switch ($page['tab']) $template->assign('css_lang_tpl', array( 'OPTIONS' => $options, 'SELECTED' => $selected)); - $editarea_options['syntax'] = 'css'; + $codemirror_mode = 'text/css'; break; case 'tpl': @@ -238,7 +231,7 @@ switch ($page['tab']) 'NEW_FILE_URL' => $my_base_url.'-tpl&newfile', 'NEW_FILE_CLASS' => empty($edited_file) ? '' : 'top_right')); - $editarea_options['syntax'] = 'html'; + $codemirror_mode = 'text/html'; break; case 'lang': @@ -266,14 +259,14 @@ switch ($page['tab']) $template->assign('css_lang_tpl', array( 'OPTIONS' => $options, 'SELECTED' => $selected)); - $editarea_options['syntax'] = 'php'; + $codemirror_mode = 'application/x-httpd-php'; break; case 'plug': $edited_file = PHPWG_PLUGINS_PATH . "PersonalPlugin/main.inc.php"; $content_file = file_exists($edited_file) ? file_get_contents($edited_file) : $new_file['plug']; - $editarea_options['syntax'] = 'php'; + $codemirror_mode = 'application/x-httpd-php'; break; } @@ -367,8 +360,10 @@ if (!empty($edited_file)) $template->assign(array( 'F_ACTION' => PHPWG_ROOT_PATH.'admin.php?page=plugin-LocalFilesEditor-'.$page['tab'], 'LOCALEDIT_PATH' => LOCALEDIT_PATH, - 'LOAD_EDITAREA' => isset($conf['LocalFilesEditor']) ? $conf['LocalFilesEditor'] : 'off', - 'EDITAREA_OPTIONS' => $editarea_options)); + 'LOAD_CODEMIRROR' => isset($conf['LocalFilesEditor']) ? $conf['LocalFilesEditor'] : 'off', + 'CODEMIRROR_MODE' => @$codemirror_mode + ) +); $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); -- cgit v1.2.3