Jeremy Newman : remove xinha editor loader
Jeremy Newman
jnewman at winehq.org
Fri Feb 3 11:06:49 CST 2017
Module: appdb
Branch: master
Commit: c364568a9e53ff09c45f327b6b556b12dc6c43e4
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=c364568a9e53ff09c45f327b6b556b12dc6c43e4
Author: Jeremy Newman <jnewman at codeweavers.com>
Date: Fri Feb 3 11:05:58 2017 -0600
remove xinha editor loader
---
include/util.php | 217 -------------------------------------------------------
1 file changed, 217 deletions(-)
diff --git a/include/util.php b/include/util.php
index 367179d..6626027 100644
--- a/include/util.php
+++ b/include/util.php
@@ -603,223 +603,6 @@ function Simplify($dirs, $idx)
}
// End of snippet of code copied from php.net
-// Use the directory of PHP_SELF and BASE and the relative path
-// to get a simplified path to an appdb directory or file
-// Used for the Xinha _editor_url because some plugins like SpellChecker
-// won't work with relative paths like ../xinha
-function GetSimplifiedPath($relative)
-{
- return "/".SimplifyPath(dirname($_SERVER['PHP_SELF'])."/".BASE.$relative);
-}
-
-function HtmlAreaLoaderScript($aTextareas)
-{
- static $outputIndex = 0;
-
- /* Check if the user wants to display the HTML editor (always, for supported browsers or never) */
- switch($_SESSION['current']->getPref('htmleditor', 'for supported browsers'))
- {
- case 'never':
- return;
- case 'for supported browsers':
- // Xinha 0.96.1 tested fine in Opera 11.6 & Konqueror 4.7.2
- break;
- case 'always':
- break;
- }
-
- echo '
- <script type="text/javascript">';
- // You must set _editor_url to the URL (including trailing slash) where
- // where xinha is installed, it's highly recommended to use an absolute URL
- // eg: _editor_url = "/path/to/xinha/";
- // You may try a relative URL if you wish]
- // eg: _editor_url = "../";
- // in this example we do a little regular expression to find the absolute path.
- // NOTE: we use GetSimplifiedPath() because we cannot use a relative path and have
- // all of the plugins work correctly. Specifically the SpellChecker plugin
- // requires a absolute url path to the xinha directory
- echo '
- _editor_url = "'.GetSimplifiedPath("xinha/").'", \'\';
- _editor_lang = "en"; // And the language we need to use in the editor.
- </script>';
-
- echo '
- <!-- Load up the actual editor core -->
- <script type="text/javascript" src="'.BASE.'xinha/XinhaCore.js"></script>
-
- <script type="text/javascript">
- xinha_editors_'.$outputIndex.' = null;
- xinha_init_'.$outputIndex.' = null;';
-
- /* only need to nll out the first set of config and plugins */
- /* as we will reuse these for additional htmlareas */
- if($outputIndex == 0)
- {
- echo '
- xinha_config_'.$outputIndex.' = null;
- xinha_plugins_'.$outputIndex.' = null;';
- }
-
- echo '
- // This contains the names of textareas we will make into Xinha editors
- xinha_init_'.$outputIndex.' = xinha_init_'.$outputIndex.' ? xinha_init_'.$outputIndex.' : function()
- {';
-
- /** STEP 1 ***************************************************************
- * First, what are the plugins you will be using in the editors on this
- * page. List all the plugins you will need, even if not all the editors
- * will use all the plugins.
- ************************************************************************/
- if($outputIndex == 0)
- {
- echo '
- xinha_plugins_'.$outputIndex.' = xinha_plugins_'.$outputIndex.' ? xinha_plugins_'.$outputIndex.' :
- [
- \'CharacterMap\',
- \'CharCounter\',
- \'ContextMenu\',
- \'FullPage\',
- \'ListType\',
- \'SpellChecker\',
- \'Stylist\',
- \'SuperClean\',
- \'TableOperations\',
- \'DynamicCSS\',
- \'FindReplace\'
- ];
-
- // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :)
- if(!HTMLArea.loadPlugins(xinha_plugins_'.$outputIndex.', xinha_init_'.$outputIndex.')) return;';
- } else
- {
- echo '
- // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING :)
- if(!HTMLArea.loadPlugins(xinha_plugins_0, xinha_init_'.$outputIndex.')) return;';
- }
-
- /** STEP 2 ***************************************************************
- * Now, what are the names of the textareas you will be turning into
- * editors?
- ************************************************************************/
-
- // NOTE: we generate the editor names here so we can easily have any number of htmlarea editors
- // and can reuse all of this code
- echo '
- xinha_editors_'.$outputIndex.' = xinha_editors_'.$outputIndex.' ? xinha_editors_'.$outputIndex.' :
- [';
-
- $firstEntry = true;
- foreach($aTextareas as $key=>$value)
- {
- if($firstEntry)
- {
- echo "'$value'";
- $firstEntry = false;
- } else
- {
- echo ", '$value'";
- }
- }
-
- echo '
- ];';
-
- /** STEP 3 ***************************************************************
- * We create a default configuration to be used by all the editors.
- * If you wish to configure some of the editors differently this will be
- * done in step 5.
- *
- * If you want to modify the default config you might do something like this.
- *
- * xinha_config = new HTMLArea.Config();
- * xinha_config.width = \'640px\';
- * xinha_config.height = \'420px\';
- *
- *************************************************************************/
- /* We only need the configuration output for the first htmlarea on a given page */
- if($outputIndex == 0)
- {
- echo '
- xinha_config_'.$outputIndex.' = new HTMLArea.Config();
-
- xinha_config_'.$outputIndex.'.toolbar = [
- ["popupeditor"],
- ["separator","fontsize","bold","italic","underline","strikethrough"],
- ["separator","forecolor","hilitecolor","textindicator"],
- ["separator","subscript","superscript"],
- ["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],
- ["separator","insertorderedlist","insertunorderedlist","outdent","indent"],
- ["separator","inserthorizontalrule","createlink","inserttable"],
- ["separator","undo","redo","selectall"], (HTMLArea.is_gecko ? [] : ["cut","copy","paste","overwrite","saveas"]),
- ["separator","killword","removeformat","toggleborders","lefttoright", "righttoleft","separator","htmlmode","about"]
- ];
-
- xinha_config_'.$outputIndex.'.pageStyle = "@import url('.BASE."application.css".');";
- ';
- }
-
- /** STEP 4 ***************************************************************
- * We first create editors for the textareas.
- *
- * You can do this in two ways, either
- *
- * xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
- *
- * if you want all the editor objects to use the same set of plugins, OR;
- *
- * xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
- * xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
- * xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
- *
- * if you want to use a different set of plugins for one or more of the
- * editors.
- ************************************************************************/
-
- echo '
- xinha_editors_'.$outputIndex.' = HTMLArea.makeEditors(xinha_editors_'.$outputIndex.',
- xinha_config_0, xinha_plugins_0);';
-
- /** STEP 5 ***************************************************************
- * If you want to change the configuration variables of any of the
- * editors, this is the place to do that, for example you might want to
- * change the width and height of one of the editors, like this...
- *
- * xinha_editors.myTextArea.config.width = '640px';
- * xinha_editors.myTextArea.config.height = '480px';
- *
- ************************************************************************/
-
-
- /** STEP 6 ***************************************************************
- * Finally we "start" the editors, this turns the textareas into
- * Xinha editors.
- ************************************************************************/
- echo '
- HTMLArea.startEditors(xinha_editors_'.$outputIndex.');
- }';
-
- if($outputIndex != 0)
- {
- echo '
- var old_on_load_'.$outputIndex.' = window.onload;
- window.onload = function() {
- if (typeof old_on_load_'.$outputIndex.' == "function") old_on_load_'.$outputIndex.'();
- xinha_init_'.$outputIndex.'();
- }';
- } else
- {
- echo '
- window.onload = xinha_init_'.$outputIndex.';';
- }
-
- echo '
- </SCRIPT>
- ';
-
- $outputIndex++; /* increment the output index */
-}
-
/**
* Cuts the link text to the specified number of chars if it's longer,
* and adds an ellipsis
More information about the wine-cvs
mailing list