This is an automated email from the ASF dual-hosted git repository. juanpablo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/jspwiki.git
commit 4c5940f9fae59652eb6d30c306bc752fd5df2d11 Author: juanpablo <[email protected]> AuthorDate: Sat Jan 11 21:38:46 2020 +0100 move RenderingManager#WYSIWYG_EDITOR_MODE constant to WikiContext#VAR_WYSIWYG_EDITOR_MODE --- .../src/main/java/org/apache/wiki/WikiContext.java | 3 + .../apache/wiki/parser/JSPWikiMarkupParser.java | 43 +++--- .../java/org/apache/wiki/parser/PluginContent.java | 151 ++++++++++----------- .../org/apache/wiki/parser/VariableContent.java | 56 +++----- .../wiki/render/DefaultRenderingManager.java | 2 +- .../org/apache/wiki/render/RenderingManager.java | 32 ++--- .../wiki/variables/DefaultVariableManager.java | 65 ++------- .../org/apache/wiki/variables/VariableManager.java | 7 +- .../InterWikiLinkAttributeProviderState.java | 8 +- .../WysiwygEditingAttributeProviderState.java | 8 +- .../AccessRuleLinkNodePostProcessorState.java | 3 +- .../InterWikiLinkNodePostProcessorState.java | 3 +- .../MetadataLinkNodePostProcessorState.java | 3 +- .../NodePostProcessorStateCommonOperations.java | 3 +- .../PluginLinkNodePostProcessorState.java | 3 +- .../VariableLinkNodePostProcessorState.java | 3 +- .../main/webapp/templates/210/editors/CKeditor.jsp | 4 +- .../src/main/webapp/templates/210/editors/FCK.jsp | 4 +- .../main/webapp/templates/210/editors/TinyMCE.jsp | 12 +- .../webapp/templates/default/editors/CKeditor.jsp | 5 +- .../webapp/templates/default/editors/TinyMCE.jsp | 7 +- .../webapp/templates/default/editors/wysiwyg.jsp | 6 +- 22 files changed, 162 insertions(+), 269 deletions(-) diff --git a/jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java b/jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java index 4f4f42c..ace5764 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/WikiContext.java @@ -71,6 +71,9 @@ public class WikiContext implements Cloneable, Command { public static final String ATTR_CONTEXT = "jspwiki.context"; + /** Name of the variable which is set to Boolean.TRUE or Boolean.FALSE depending on whether WYSIWYG is currently in effect. */ + public static final String VAR_WYSIWYG_EDITOR_MODE = "WYSIWYG_EDITOR_MODE"; + /** User is administering JSPWiki (Install, SecurityConfig). */ public static final String INSTALL = WikiCommand.INSTALL.getRequestContext(); diff --git a/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java b/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java index 8b2806b..fe14f59 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/parser/JSPWikiMarkupParser.java @@ -39,7 +39,6 @@ import org.apache.wiki.auth.acl.Acl; import org.apache.wiki.i18n.InternationalizationManager; import org.apache.wiki.preferences.Preferences; import org.apache.wiki.render.CleanTextRenderer; -import org.apache.wiki.render.RenderingManager; import org.apache.wiki.util.TextUtil; import org.jdom2.Attribute; import org.jdom2.Content; @@ -173,8 +172,7 @@ public class JSPWikiMarkupParser extends MarkupParser { } // FIXME: parsers should be pooled for better performance. - private void initialize() - { + private void initialize() { initInlineImagePatterns(); m_camelCasePattern = m_engine.getAttribute( CAMELCASE_PATTERN ); @@ -187,38 +185,29 @@ public class JSPWikiMarkupParser extends MarkupParser { } m_engine.setAttribute( CAMELCASE_PATTERN, m_camelCasePattern ); } - // - // Set the properties. - // - Properties props = m_engine.getWikiProperties(); - String cclinks = m_context.getPage().getAttribute( PROP_CAMELCASELINKS ); + // Set the properties. + final Properties props = m_engine.getWikiProperties(); + final String cclinks = m_context.getPage().getAttribute( PROP_CAMELCASELINKS ); - if( cclinks != null ) - { + if( cclinks != null ) { m_camelCaseLinks = TextUtil.isPositive( cclinks ); - } - else - { - m_camelCaseLinks = TextUtil.getBooleanProperty( props, - PROP_CAMELCASELINKS, - m_camelCaseLinks ); + } else { + m_camelCaseLinks = TextUtil.getBooleanProperty( props, PROP_CAMELCASELINKS, m_camelCaseLinks ); } - Boolean wysiwygVariable = (Boolean)m_context.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); - if( wysiwygVariable != null ) - { - m_wysiwygEditorMode = wysiwygVariable.booleanValue(); + final Boolean wysiwygVariable = (Boolean)m_context.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); + if( wysiwygVariable != null ) { + m_wysiwygEditorMode = wysiwygVariable; } - m_plainUris = m_context.getBooleanWikiProperty( PROP_PLAINURIS, m_plainUris ); - m_useOutlinkImage = m_context.getBooleanWikiProperty( PROP_USEOUTLINKIMAGE, m_useOutlinkImage ); - m_useAttachmentImage = m_context.getBooleanWikiProperty( PROP_USEATTACHMENTIMAGE, m_useAttachmentImage ); - m_allowHTML = m_context.getBooleanWikiProperty( PROP_ALLOWHTML, m_allowHTML ); - m_useRelNofollow = m_context.getBooleanWikiProperty( PROP_USERELNOFOLLOW, m_useRelNofollow ); + m_plainUris = m_context.getBooleanWikiProperty( PROP_PLAINURIS, m_plainUris ); + m_useOutlinkImage = m_context.getBooleanWikiProperty( PROP_USEOUTLINKIMAGE, m_useOutlinkImage ); + m_useAttachmentImage = m_context.getBooleanWikiProperty( PROP_USEATTACHMENTIMAGE, m_useAttachmentImage ); + m_allowHTML = m_context.getBooleanWikiProperty( PROP_ALLOWHTML, m_allowHTML ); + m_useRelNofollow = m_context.getBooleanWikiProperty( PROP_USERELNOFOLLOW, m_useRelNofollow ); - if( m_engine.getUserManager().getUserDatabase() == null || m_engine.getAuthorizationManager() == null ) - { + if( m_engine.getUserManager().getUserDatabase() == null || m_engine.getAuthorizationManager() == null ) { disableAccessRules(); } diff --git a/jspwiki-main/src/main/java/org/apache/wiki/parser/PluginContent.java b/jspwiki-main/src/main/java/org/apache/wiki/parser/PluginContent.java index 8ef5c22..56b9c30 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/parser/PluginContent.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/parser/PluginContent.java @@ -18,13 +18,6 @@ */ package org.apache.wiki.parser; -import java.io.IOException; -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.ResourceBundle; - import org.apache.log4j.Logger; import org.apache.oro.text.regex.MatchResult; import org.apache.oro.text.regex.PatternMatcher; @@ -40,6 +33,13 @@ import org.apache.wiki.preferences.Preferences; import org.apache.wiki.render.RenderingManager; import org.jdom2.Text; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.ResourceBundle; + /** * Stores the contents of a plugin in a WikiDocument DOM tree. @@ -78,7 +78,7 @@ public class PluginContent extends Text { * @param pluginName The FQN of a plugin. * @param parameters A Map of parameters. */ - public PluginContent(String pluginName, Map<String, String> parameters) { + public PluginContent( final String pluginName, final Map< String, String > parameters) { m_pluginName = pluginName; m_params = parameters; } @@ -99,7 +99,7 @@ public class PluginContent extends Text { * @param name the name of the parameter. * @return The value from the map, or null, if no such parameter exists. */ - public String getParameter(String name) { + public String getParameter( final String name) { return m_params.get(name); } @@ -108,7 +108,7 @@ public class PluginContent extends Text { * * @return The parameter map. */ - public Map<String, String> getParameters() { + public Map< String, String > getParameters() { return m_params; } @@ -129,22 +129,17 @@ public class PluginContent extends Text { * @return The plugin rendered according to the options set in the WikiContext. */ public String getText() { - WikiDocument doc = ( WikiDocument )getDocument(); - - if (doc == null) { + final WikiDocument doc = ( WikiDocument )getDocument(); + if( doc == null ) { // - // This element has not yet been attached anywhere, so we simply assume there is - // no rendering and return the plugin name. This is required e.g. when the - // paragraphify() checks whether the element is empty or not. We can't of course - // know whether the rendering would result in an empty string or not, but let us - // assume it does not. + // This element has not yet been attached anywhere, so we simply assume there is no rendering and return the plugin name. + // This is required e.g. when the paragraphify() checks whether the element is empty or not. We can't of course know + // whether the rendering would result in an empty string or not, but let us assume it does not. // - return getPluginName(); } - WikiContext context = doc.getContext(); - + final WikiContext context = doc.getContext(); if( context == null ) { log.info( "WikiContext garbage-collected, cannot proceed" ); return getPluginName(); @@ -159,12 +154,12 @@ public class PluginContent extends Text { * @param context WikiContext in which the plugin is executed. Must NOT be null. * @return plugin contents. */ - public String invoke( WikiContext context ) { + public String invoke( final WikiContext context ) { String result; - Boolean wysiwygVariable = (Boolean) context.getVariable(RenderingManager.WYSIWYG_EDITOR_MODE); + final Boolean wysiwygVariable = ( Boolean )context.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); boolean wysiwygEditorMode = false; - if (wysiwygVariable != null) { - wysiwygEditorMode = wysiwygVariable.booleanValue(); + if( wysiwygVariable != null ) { + wysiwygEditorMode = wysiwygVariable; } try { @@ -178,36 +173,32 @@ public class PluginContent extends Text { result = PLUGIN_START + m_pluginName + SPACE; // convert newlines to <br> in case the plugin has a body. - String cmdLine = (m_params.get(CMDLINE)).replaceAll(LINEBREAK, ELEMENT_BR); - + final String cmdLine = m_params.get( CMDLINE ).replaceAll( LINEBREAK, ELEMENT_BR ); result = result + cmdLine + PLUGIN_END; } else { - Boolean b = (Boolean) context.getVariable(RenderingManager.VAR_EXECUTE_PLUGINS); - if (b != null && !b.booleanValue()) { + final Boolean b = ( Boolean )context.getVariable(RenderingManager.VAR_EXECUTE_PLUGINS ); + if (b != null && !b ) { return BLANK; } - WikiEngine engine = context.getEngine(); + final WikiEngine engine = context.getEngine(); + final Map< String, String > parsedParams = new HashMap<>(); - Map<String, String> parsedParams = new HashMap<String, String>(); - - // // Parse any variable instances from the string - // - for (Map.Entry<String, String> e : m_params.entrySet()) { + for( final Map.Entry< String, String > e : m_params.entrySet() ) { String val = e.getValue(); - val = engine.getVariableManager().expandVariables(context, val); - parsedParams.put(e.getKey(), val); + val = engine.getVariableManager().expandVariables( context, val ); + parsedParams.put( e.getKey(), val ); } - PluginManager pm = engine.getPluginManager(); - result = pm.execute(context, m_pluginName, parsedParams); + final PluginManager pm = engine.getPluginManager(); + result = pm.execute( context, m_pluginName, parsedParams ); } - } catch (Exception e) { - if (wysiwygEditorMode) { + } catch( final Exception e ) { + if( wysiwygEditorMode ) { result = ""; } else { // log.info("Failed to execute plugin",e); - ResourceBundle rb = Preferences.getBundle(context, WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE); + final ResourceBundle rb = Preferences.getBundle( context, WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE ); result = MarkupParser.makeError( MessageFormat.format( rb.getString( "plugin.error.insertionfailed" ), context.getRealPage().getWiki(), context.getRealPage().getName(), @@ -215,7 +206,6 @@ public class PluginContent extends Text { } } - return result; } @@ -225,18 +215,18 @@ public class PluginContent extends Text { * @param context The WikiContext * @throws PluginException If something goes wrong. */ - public void executeParse(WikiContext context) throws PluginException { - PluginManager pm = context.getEngine().getPluginManager(); - if (pm.pluginsEnabled()) { - ResourceBundle rb = Preferences.getBundle(context, WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE); - Map<String, String> params = getParameters(); - WikiPlugin plugin = pm.newWikiPlugin(getPluginName(), rb); + public void executeParse( final WikiContext context ) throws PluginException { + final PluginManager pm = context.getEngine().getPluginManager(); + if( pm.pluginsEnabled() ) { + final ResourceBundle rb = Preferences.getBundle(context, WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE); + final Map< String, String > params = getParameters(); + final WikiPlugin plugin = pm.newWikiPlugin( getPluginName(), rb ); try { - if (plugin != null && plugin instanceof ParserStagePlugin) { - ((ParserStagePlugin) plugin).executeParser(this, context, params); + if( plugin != null && plugin instanceof ParserStagePlugin ) { + ( ( ParserStagePlugin )plugin ).executeParser(this, context, params ); } - } catch (ClassCastException e) { - throw new PluginException(MessageFormat.format(rb.getString("plugin.error.notawikiplugin"), getPluginName()), e); + } catch( final ClassCastException e ) { + throw new PluginException( MessageFormat.format( rb.getString("plugin.error.notawikiplugin"), getPluginName() ), e ); } } } @@ -251,43 +241,38 @@ public class PluginContent extends Text { * @throws PluginException If plugin invocation is faulty * @since 2.10.0 */ - public static PluginContent parsePluginLine(WikiContext context, String commandline, int pos) throws PluginException { - PatternMatcher matcher = new Perl5Matcher(); + public static PluginContent parsePluginLine( final WikiContext context, final String commandline, final int pos ) throws PluginException { + final PatternMatcher matcher = new Perl5Matcher(); try { - PluginManager pm = context.getEngine().getPluginManager(); - if (matcher.contains(commandline, pm.getPluginPattern())) { - - MatchResult res = matcher.getMatch(); - - String plugin = res.group(2); - String args = commandline.substring(res.endOffset(0), - commandline.length() - - (commandline.charAt(commandline.length() - 1) == '}' ? 1 : 0)); - Map<String, String> arglist = pm.parseArgs(args); + final PluginManager pm = context.getEngine().getPluginManager(); + if( matcher.contains( commandline, pm.getPluginPattern() ) ) { + final MatchResult res = matcher.getMatch(); + final String plugin = res.group( 2 ); + final String args = commandline.substring( res.endOffset( 0 ), + commandline.length() - ( commandline.charAt( commandline.length() - 1 ) == '}' ? 1 : 0 ) ); + final Map< String, String > arglist = pm.parseArgs( args ); // set wikitext bounds of plugin as '_bounds' parameter, e.g., [345,396] - if (pos != -1) { - int end = pos + commandline.length() + 2; - String bounds = pos + "|" + end; - arglist.put(PluginManager.PARAM_BOUNDS, bounds); + if( pos != -1 ) { + final int end = pos + commandline.length() + 2; + final String bounds = pos + "|" + end; + arglist.put( PluginManager.PARAM_BOUNDS, bounds ); } - PluginContent result = new PluginContent(plugin, arglist); - - return result; + return new PluginContent( plugin, arglist ); } - } catch (ClassCastException e) { - log.error("Invalid type offered in parsing plugin arguments.", e); - throw new InternalWikiException("Oops, someone offered !String!", e); - } catch (NoSuchElementException e) { - String msg = "Missing parameter in plugin definition: " + commandline; - log.warn(msg, e); - throw new PluginException(msg); - } catch (IOException e) { - String msg = "Zyrf. Problems with parsing arguments: " + commandline; - log.warn(msg, e); - throw new PluginException(msg); + } catch( final ClassCastException e ) { + log.error( "Invalid type offered in parsing plugin arguments.", e ); + throw new InternalWikiException( "Oops, someone offered !String!", e ); + } catch( final NoSuchElementException e ) { + final String msg = "Missing parameter in plugin definition: " + commandline; + log.warn( msg, e ); + throw new PluginException( msg ); + } catch( final IOException e ) { + final String msg = "Zyrf. Problems with parsing arguments: " + commandline; + log.warn( msg, e ); + throw new PluginException( msg ); } return null; diff --git a/jspwiki-main/src/main/java/org/apache/wiki/parser/VariableContent.java b/jspwiki-main/src/main/java/org/apache/wiki/parser/VariableContent.java index ea12aa0..2d7ba47 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/parser/VariableContent.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/parser/VariableContent.java @@ -19,22 +19,20 @@ package org.apache.wiki.parser; import org.apache.commons.text.StringEscapeUtils; -import org.jdom2.Text; import org.apache.wiki.WikiContext; import org.apache.wiki.api.exceptions.NoSuchVariableException; -import org.apache.wiki.render.RenderingManager; +import org.jdom2.Text; /** * Stores the contents of a WikiVariable in a WikiDocument DOM tree. * <p> - * When the WikiDocument is rendered, if the {@link RenderingManager#WYSIWYG_EDITOR_MODE} - * is set to {@link Boolean#TRUE}, the variable declaration is rendered instead - * of the variable value. + * When the WikiDocument is rendered, if the {@link WikiContext#VAR_WYSIWYG_EDITOR_MODE} is set to {@link Boolean#TRUE}, the + * variable declaration is rendered instead of the variable value. * * @since 2.4 */ -public class VariableContent extends Text -{ +public class VariableContent extends Text { + private static final long serialVersionUID = 1L; private String m_varName; @@ -44,7 +42,7 @@ public class VariableContent extends Text * * @param varName The name of the variable. */ - public VariableContent( String varName ) + public VariableContent( final String varName ) { m_varName = varName; } @@ -54,36 +52,27 @@ public class VariableContent extends Text * * @return The rendered value of the variable. */ - public String getValue() - { - String result = ""; - WikiDocument root = (WikiDocument) getDocument(); + public String getValue() { + String result; + final WikiDocument root = (WikiDocument) getDocument(); - if( root == null ) - { + if( root == null ) { // See similar note in PluginContent return m_varName; } - WikiContext context = root.getContext(); - - if( context == null ) + final WikiContext context = root.getContext(); + if( context == null ) { return "No WikiContext available: INTERNAL ERROR"; + } - Boolean wysiwygEditorMode = (Boolean)context.getVariable(RenderingManager.WYSIWYG_EDITOR_MODE); - - if( wysiwygEditorMode != null && wysiwygEditorMode.booleanValue() ) - { + final Boolean wysiwygEditorMode = ( Boolean )context.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); + if( wysiwygEditorMode != null && wysiwygEditorMode ) { result = "[" + m_varName + "]"; - } - else - { - try - { + } else { + try { result = context.getEngine().getVariableManager().parseAndGetValue( context, m_varName ); - } - catch( NoSuchVariableException e ) - { + } catch( final NoSuchVariableException e ) { result = MarkupParser.makeError( "No such variable: " + e.getMessage() ).getText(); } } @@ -95,8 +84,7 @@ public class VariableContent extends Text * Returns exactly getValue(). * @return Whatever getValue() returns. */ - public String getText() - { + public String getText() { return getValue(); } @@ -104,8 +92,8 @@ public class VariableContent extends Text * Returns a debug-suitable string. * @return Debug string */ - public String toString() - { - return "VariableElement[\""+m_varName+"\"]"; + public String toString() { + return "VariableElement[\"" + m_varName + "\"]"; } + } diff --git a/jspwiki-main/src/main/java/org/apache/wiki/render/DefaultRenderingManager.java b/jspwiki-main/src/main/java/org/apache/wiki/render/DefaultRenderingManager.java index cb9969f..989a7ba 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/render/DefaultRenderingManager.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/render/DefaultRenderingManager.java @@ -200,7 +200,7 @@ public class DefaultRenderingManager implements RenderingManager { */ @Override public String getHTML( final WikiContext context, final WikiDocument doc ) throws IOException { - final Boolean wysiwygVariable = ( Boolean )context.getVariable( WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )context.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); final boolean wysiwygEditorMode; if( wysiwygVariable != null ) { wysiwygEditorMode = wysiwygVariable; diff --git a/jspwiki-main/src/main/java/org/apache/wiki/render/RenderingManager.java b/jspwiki-main/src/main/java/org/apache/wiki/render/RenderingManager.java index e80dbfa..12564dc 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/render/RenderingManager.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/render/RenderingManager.java @@ -57,12 +57,6 @@ public interface RenderingManager extends WikiEventListener, InternalModule { String DOCUMENTCACHE_NAME = "jspwiki.renderingCache"; /** - * Name of the WikiContext variable which is set to Boolean.TRUE or Boolean.FALSE depending on whether WYSIWYG is currently - * in effect. - */ - String WYSIWYG_EDITOR_MODE = "WYSIWYG_EDITOR_MODE"; - - /** * Variable name which tells whether plugins should be executed or not. Value can be either {@code Boolean.TRUE} or * {@code Boolean.FALSE}. While not set it's value is {@code null}. */ @@ -97,19 +91,6 @@ public interface RenderingManager extends WikiEventListener, InternalModule { WikiDocument getRenderedDocument( WikiContext context, String pagedata ); /** - * Simply renders a WikiDocument to a String. This version does not get the document from the cache - in fact, it does - * not cache the document at all. This is very useful, if you have something that you want to render outside the caching - * routines. Because the cache is based on full pages, and the cache keys are based on names, use this routine if you're - * rendering anything for yourself. - * - * @param context The WikiContext to render in - * @param doc A proper WikiDocument - * @return Rendered HTML. - * @throws IOException If the WikiDocument is poorly formed. - */ - String getHTML( WikiContext context, WikiDocument doc ) throws IOException; - - /** * Returns a WikiRenderer instance, initialized with the given context and doc. The object is an XHTMLRenderer, * unless overridden in jspwiki.properties with PROP_RENDERER. * @@ -131,6 +112,19 @@ public interface RenderingManager extends WikiEventListener, InternalModule { WikiRenderer getWysiwygRenderer( WikiContext context, WikiDocument doc ); /** + * Simply renders a WikiDocument to a String. This version does not get the document from the cache - in fact, it does + * not cache the document at all. This is very useful, if you have something that you want to render outside the caching + * routines. Because the cache is based on full pages, and the cache keys are based on names, use this routine if you're + * rendering anything for yourself. + * + * @param context The WikiContext to render in + * @param doc A proper WikiDocument + * @return Rendered HTML. + * @throws IOException If the WikiDocument is poorly formed. + */ + String getHTML( WikiContext context, WikiDocument doc ) throws IOException; + + /** * Convenience method for rendering, using the default parser and renderer. Note that you can't use this method * to do any arbitrary rendering, as the pagedata MUST be the data from the that the WikiContext refers to - this * method caches the HTML internally, and will return the cached version. If the pagedata is different from what diff --git a/jspwiki-main/src/main/java/org/apache/wiki/variables/DefaultVariableManager.java b/jspwiki-main/src/main/java/org/apache/wiki/variables/DefaultVariableManager.java index 7ba3d1a..c998d1d 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/variables/DefaultVariableManager.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/variables/DefaultVariableManager.java @@ -29,7 +29,6 @@ import org.apache.wiki.api.exceptions.NoSuchVariableException; import org.apache.wiki.api.filters.PageFilter; import org.apache.wiki.i18n.InternationalizationManager; import org.apache.wiki.modules.InternalModule; -import org.apache.wiki.parser.LinkParsingOperations; import org.apache.wiki.preferences.Preferences; import javax.servlet.http.HttpServletRequest; @@ -66,17 +65,9 @@ public class DefaultVariableManager implements VariableManager { } /** - * Parses the link and finds a value. This is essentially used once - * {@link LinkParsingOperations#isVariableLink(String)} has found that - * the link text actually contains a variable. For example, you could - * pass in "{$username}" and get back "JanneJalkanen". - * - * @param context The WikiContext - * @param link The link text containing the variable name. - * @return The variable value. - * @throws IllegalArgumentException If the format is not valid (does not start with "{$", is zero length, etc.) - * @throws NoSuchVariableException If a variable is not known. + * {@inheritDoc} */ + @Override public String parseAndGetValue( final WikiContext context, final String link ) throws IllegalArgumentException, NoSuchVariableException { if( !link.startsWith( "{$" ) ) { throw new IllegalArgumentException( "Link does not start with {$" ); @@ -90,15 +81,9 @@ public class DefaultVariableManager implements VariableManager { } /** - * This method does in-place expansion of any variables. However, the expansion is not done twice, that is, - * a variable containing text $variable will not be expanded. - * <P> - * The variables should be in the same format ({$variablename} as in the web pages. - * - * @param context The WikiContext of the current page. - * @param source The source string. - * @return The source string with variables expanded. + * {@inheritDoc} */ + @Override // FIXME: somewhat slow. public String expandVariables( final WikiContext context, final String source ) { final StringBuilder result = new StringBuilder(); @@ -132,14 +117,9 @@ public class DefaultVariableManager implements VariableManager { } /** - * Returns the value of a named variable. See {@link #getValue(WikiContext, String)}. The only difference is that - * this method does not throw an exception, but it returns the given default value instead. - * - * @param context WikiContext - * @param varName The name of the variable - * @param defValue A default value. - * @return The variable value, or if not found, the default value. + * {@inheritDoc} */ + @Override public String getValue( final WikiContext context, final String varName, final String defValue ) { try { return getValue( context, varName ); @@ -149,42 +129,17 @@ public class DefaultVariableManager implements VariableManager { } /** - * Shortcut to getValue(). However, this method does not throw a NoSuchVariableException, but returns null - * in case the variable does not exist. - * - * @param context WikiContext to look the variable in - * @param name Name of the variable to look for - * @return Variable value, or null, if there is no such variable. - * @since 2.2 on WikiEngine, moved to VariableManager on 2.11.0 + * {@inheritDoc} */ + @Override public String getVariable( final WikiContext context, final String name ) { return getValue( context, name, null ); } /** - * Returns a value of the named variable. The resolving order is - * <ol> - * <li>Known "constant" name, such as "pagename", etc. This is so - * that pages could not override certain constants. - * <li>WikiContext local variable. This allows a programmer to - * set a parameter which cannot be overridden by user. - * <li>HTTP Session - * <li>HTTP Request parameters - * <li>WikiPage variable. As set by the user with the SET directive. - * <li>jspwiki.properties - * </ol> - * - * Use this method only whenever you really need to have a parameter that - * can be overridden by anyone using the wiki. - * - * @param context The WikiContext - * @param varName Name of the variable. - * - * @return The variable value. - * - * @throws IllegalArgumentException If the name is somehow broken. - * @throws NoSuchVariableException If a variable is not known. + * {@inheritDoc} */ + @Override public String getValue( final WikiContext context, final String varName ) throws IllegalArgumentException, NoSuchVariableException { if( varName == null ) { throw new IllegalArgumentException( "Null variable name." ); diff --git a/jspwiki-main/src/main/java/org/apache/wiki/variables/VariableManager.java b/jspwiki-main/src/main/java/org/apache/wiki/variables/VariableManager.java index 043c395..92cfab3 100644 --- a/jspwiki-main/src/main/java/org/apache/wiki/variables/VariableManager.java +++ b/jspwiki-main/src/main/java/org/apache/wiki/variables/VariableManager.java @@ -20,7 +20,6 @@ package org.apache.wiki.variables; import org.apache.wiki.WikiContext; import org.apache.wiki.api.exceptions.NoSuchVariableException; -import org.apache.wiki.parser.LinkParsingOperations; /** * Manages variables. Variables are case-insensitive. A list of all available variables is on a Wiki page called "WikiVariables". @@ -35,9 +34,9 @@ public interface VariableManager { /** * Parses the link and finds a value. This is essentially used once - * {@link LinkParsingOperations#isVariableLink(String)} has found that - * the link text actually contains a variable. For example, you could - * pass in "{$username}" and get back "JanneJalkanen". + * {@link org.apache.wiki.parser.LinkParsingOperations#isVariableLink(String) LinkParsingOperations#isVariableLink(String)} + * has found that the link text actually contains a variable. For example, you could pass in "{$username}" and get back + * "JanneJalkanen". * * @param context The WikiContext * @param link The link text containing the variable name. diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/attributeprovider/InterWikiLinkAttributeProviderState.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/attributeprovider/InterWikiLinkAttributeProviderState.java index 3c7daf4..4de92d6 100755 --- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/attributeprovider/InterWikiLinkAttributeProviderState.java +++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/attributeprovider/InterWikiLinkAttributeProviderState.java @@ -18,17 +18,15 @@ */ package org.apache.wiki.markdown.extensions.jspwikilinks.attributeprovider; +import com.vladsch.flexmark.ast.Link; import com.vladsch.flexmark.util.ast.Node; +import com.vladsch.flexmark.util.html.Attributes; import org.apache.wiki.WikiContext; import org.apache.wiki.markdown.nodes.JSPWikiLink; import org.apache.wiki.parser.LinkParsingOperations; import org.apache.wiki.parser.MarkupParser; -import org.apache.wiki.render.RenderingManager; import org.apache.wiki.util.TextUtil; -import com.vladsch.flexmark.ast.Link; -import com.vladsch.flexmark.util.html.Attributes; - /** * {@link NodeAttributeProviderState} which sets the attributes for interwiki links. @@ -44,7 +42,7 @@ public class InterWikiLinkAttributeProviderState implements NodeAttributeProvide this.hasRef = hasRef; this.wikiContext = wikiContext; this.linkOperations = new LinkParsingOperations( wikiContext ); - final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); m_wysiwygEditorMode = wysiwygVariable != null ? wysiwygVariable : false; } diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/attributeprovider/WysiwygEditingAttributeProviderState.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/attributeprovider/WysiwygEditingAttributeProviderState.java index 48c5406..e0efb76 100755 --- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/attributeprovider/WysiwygEditingAttributeProviderState.java +++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/attributeprovider/WysiwygEditingAttributeProviderState.java @@ -19,14 +19,12 @@ package org.apache.wiki.markdown.extensions.jspwikilinks.attributeprovider; import com.vladsch.flexmark.util.ast.Node; +import com.vladsch.flexmark.util.html.Attributes; import org.apache.wiki.WikiContext; import org.apache.wiki.htmltowiki.XHtmlToWikiConfig; import org.apache.wiki.markdown.nodes.JSPWikiLink; -import org.apache.wiki.render.RenderingManager; import org.apache.wiki.render.WikiRenderer; -import com.vladsch.flexmark.util.html.Attributes; - /** * {@link NodeAttributeProviderState} to finish up polishing WYSIWYG editing mode. More or less equivalent to WysiwygEditingRenderer, the main difference @@ -39,7 +37,7 @@ public class WysiwygEditingAttributeProviderState implements NodeAttributeProvid public WysiwygEditingAttributeProviderState( final WikiContext wikiContext ) { this.wikiContext = wikiContext; - final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); m_wysiwygEditorMode = wysiwygVariable != null ? wysiwygVariable : false; } @@ -71,7 +69,7 @@ public class WysiwygEditingAttributeProviderState implements NodeAttributeProvid // to this wiki string: "TargetPage#Heading2". attributes.replaceValue( "href", newHref.replaceFirst( WikiRenderer.LINKS_SOURCE, WikiRenderer.LINKS_TRANSLATION ) ); } else if( href != null && href.startsWith( editPageLinkUrl ) ) { - String title = attributes.getValue( "title" ); + final String title = attributes.getValue( "title" ); if( title != null ) { // remove the title since we don't want to eventually save the default undefined page title. attributes.replaceValue( "title", "" ); diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/AccessRuleLinkNodePostProcessorState.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/AccessRuleLinkNodePostProcessorState.java index c7e46d4..3d6c4cb 100755 --- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/AccessRuleLinkNodePostProcessorState.java +++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/AccessRuleLinkNodePostProcessorState.java @@ -26,7 +26,6 @@ import org.apache.wiki.WikiPage; import org.apache.wiki.auth.WikiSecurityException; import org.apache.wiki.auth.acl.Acl; import org.apache.wiki.markdown.nodes.JSPWikiLink; -import org.apache.wiki.render.RenderingManager; /** @@ -40,7 +39,7 @@ public class AccessRuleLinkNodePostProcessorState implements NodePostProcessorSt public AccessRuleLinkNodePostProcessorState( final WikiContext wikiContext ) { this.wikiContext = wikiContext; - final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); m_wysiwygEditorMode = wysiwygVariable != null ? wysiwygVariable : false; } diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/InterWikiLinkNodePostProcessorState.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/InterWikiLinkNodePostProcessorState.java index 66b9cd7..39a1252 100755 --- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/InterWikiLinkNodePostProcessorState.java +++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/InterWikiLinkNodePostProcessorState.java @@ -29,7 +29,6 @@ import org.apache.wiki.markdown.nodes.JSPWikiLink; import org.apache.wiki.parser.LinkParsingOperations; import org.apache.wiki.parser.MarkupParser; import org.apache.wiki.preferences.Preferences; -import org.apache.wiki.render.RenderingManager; import org.apache.wiki.util.TextUtil; import java.text.MessageFormat; @@ -53,7 +52,7 @@ public class InterWikiLinkNodePostProcessorState implements NodePostProcessorSta this.linkOperations = new LinkParsingOperations( wikiContext ); this.document = document; this.m_useOutlinkImage = wikiContext.getBooleanWikiProperty( MarkupParser.PROP_USEOUTLINKIMAGE, m_useOutlinkImage ); - final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); m_wysiwygEditorMode = wysiwygVariable != null ? wysiwygVariable : false; } diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/MetadataLinkNodePostProcessorState.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/MetadataLinkNodePostProcessorState.java index 99a9ed5..47661b5 100755 --- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/MetadataLinkNodePostProcessorState.java +++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/MetadataLinkNodePostProcessorState.java @@ -25,7 +25,6 @@ import org.apache.wiki.WikiContext; import org.apache.wiki.i18n.InternationalizationManager; import org.apache.wiki.markdown.nodes.JSPWikiLink; import org.apache.wiki.preferences.Preferences; -import org.apache.wiki.render.RenderingManager; import java.text.MessageFormat; import java.util.ResourceBundle; @@ -42,7 +41,7 @@ public class MetadataLinkNodePostProcessorState implements NodePostProcessorStat public MetadataLinkNodePostProcessorState( final WikiContext wikiContext ) { this.wikiContext = wikiContext; - final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); m_wysiwygEditorMode = wysiwygVariable != null ? wysiwygVariable : false; } diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/NodePostProcessorStateCommonOperations.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/NodePostProcessorStateCommonOperations.java index 87d5b3c..4012797 100755 --- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/NodePostProcessorStateCommonOperations.java +++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/NodePostProcessorStateCommonOperations.java @@ -25,7 +25,6 @@ import com.vladsch.flexmark.util.sequence.CharSubSequence; import org.apache.wiki.WikiContext; import org.apache.wiki.markdown.nodes.JSPWikiLink; import org.apache.wiki.parser.MarkupParser; -import org.apache.wiki.render.RenderingManager; /** @@ -47,7 +46,7 @@ class NodePostProcessorStateCommonOperations { } static void addOutlinkImage( final NodeTracker state, final Node node, final WikiContext wikiContext, final boolean useOutlinkImage ) { - final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); final boolean wysiwygEditorMode = wysiwygVariable != null && wysiwygVariable; if( useOutlinkImage && !wysiwygEditorMode ) { diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/PluginLinkNodePostProcessorState.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/PluginLinkNodePostProcessorState.java index 4e13e3d..ea18af3 100755 --- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/PluginLinkNodePostProcessorState.java +++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/PluginLinkNodePostProcessorState.java @@ -30,7 +30,6 @@ import org.apache.wiki.api.plugin.WikiPlugin; import org.apache.wiki.markdown.nodes.JSPWikiLink; import org.apache.wiki.parser.PluginContent; import org.apache.wiki.preferences.Preferences; -import org.apache.wiki.render.RenderingManager; import java.text.MessageFormat; import java.util.ResourceBundle; @@ -47,7 +46,7 @@ public class PluginLinkNodePostProcessorState implements NodePostProcessorState< public PluginLinkNodePostProcessorState( final WikiContext wikiContext ) { this.wikiContext = wikiContext; - final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); m_wysiwygEditorMode = wysiwygVariable != null ? wysiwygVariable : false; } diff --git a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/VariableLinkNodePostProcessorState.java b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/VariableLinkNodePostProcessorState.java index 8855af5..6a72cf7 100755 --- a/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/VariableLinkNodePostProcessorState.java +++ b/jspwiki-markdown/src/main/java/org/apache/wiki/markdown/extensions/jspwikilinks/postprocessor/VariableLinkNodePostProcessorState.java @@ -26,7 +26,6 @@ import org.apache.commons.text.StringEscapeUtils; import org.apache.wiki.WikiContext; import org.apache.wiki.api.exceptions.NoSuchVariableException; import org.apache.wiki.markdown.nodes.JSPWikiLink; -import org.apache.wiki.render.RenderingManager; /** @@ -39,7 +38,7 @@ public class VariableLinkNodePostProcessorState implements NodePostProcessorStat public VariableLinkNodePostProcessorState( final WikiContext wikiContext ) { this.wikiContext = wikiContext; - final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( RenderingManager.WYSIWYG_EDITOR_MODE ); + final Boolean wysiwygVariable = ( Boolean )wikiContext.getVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE ); m_wysiwygEditorMode = wysiwygVariable != null && wysiwygVariable; } diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/CKeditor.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/CKeditor.jsp index 71bdce9..d7ab340 100644 --- a/jspwiki-war/src/main/webapp/templates/210/editors/CKeditor.jsp +++ b/jspwiki-war/src/main/webapp/templates/210/editors/CKeditor.jsp @@ -50,7 +50,7 @@ "//cdn.ckeditor.com/4.5.1/standard/ckeditor.js" ); */ - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.TRUE ); + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.TRUE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, "false" ); WikiPage wikiPage = context.getPage(); @@ -108,7 +108,7 @@ // Disable the WYSIWYG_EDITOR_MODE and reset the other properties immediately // after the XHTML for CKeditor has been rendered. - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.FALSE ); + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.FALSE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, null ); wikiPage.setAttribute( JSPWikiMarkupParser.PROP_CAMELCASELINKS, originalCCLOption ); diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/FCK.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/FCK.jsp index 4d5ca8d..470d060 100644 --- a/jspwiki-war/src/main/webapp/templates/210/editors/FCK.jsp +++ b/jspwiki-war/src/main/webapp/templates/210/editors/FCK.jsp @@ -38,7 +38,7 @@ --%> <% WikiContext context = WikiContext.findContext( pageContext ); WikiEngine engine = context.getEngine(); - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.TRUE ); + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.TRUE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, "false" ); WikiPage wikiPage = context.getPage(); @@ -85,7 +85,7 @@ // Disable the WYSIWYG_EDITOR_MODE and reset the other properties immediately // after the XHTML for FCK has been rendered. - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.FALSE ); + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.FALSE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, null ); wikiPage.setAttribute( JSPWikiMarkupParser.PROP_CAMELCASELINKS, originalCCLOption ); diff --git a/jspwiki-war/src/main/webapp/templates/210/editors/TinyMCE.jsp b/jspwiki-war/src/main/webapp/templates/210/editors/TinyMCE.jsp index 1ce9593..45c4335 100644 --- a/jspwiki-war/src/main/webapp/templates/210/editors/TinyMCE.jsp +++ b/jspwiki-war/src/main/webapp/templates/210/editors/TinyMCE.jsp @@ -50,7 +50,7 @@ "//tinymce.cachefly.net/4.2/tinymce.min.js" ); */ - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.TRUE ); + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.TRUE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, "false" ); WikiPage wikiPage = context.getPage(); @@ -95,21 +95,17 @@ if( usertext == null ) usertext = ""; String pageAsHtml; - try - { + try { //pageAsHtml = StringEscapeUtils.escapeJavaScript( engine.getRenderingManager().getHTML( context, usertext ) ); pageAsHtml = engine.getRenderingManager().getHTML( context, usertext ); - } - catch( Exception e ) - { + } catch( Exception e ) { pageAsHtml = "Error in converting wiki-markup to well-formed HTML \n" + e.toString(); //pageAsHtml = e.toString() + "\n" + usertext; //error } // Disable the WYSIWYG_EDITOR_MODE and reset the other properties immediately // after the XHTML for TinyMCE has been rendered. - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.FALSE ); - + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.FALSE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, null ); wikiPage.setAttribute( JSPWikiMarkupParser.PROP_CAMELCASELINKS, originalCCLOption ); diff --git a/jspwiki-war/src/main/webapp/templates/default/editors/CKeditor.jsp b/jspwiki-war/src/main/webapp/templates/default/editors/CKeditor.jsp index 081e5cd..9fa10da 100644 --- a/jspwiki-war/src/main/webapp/templates/default/editors/CKeditor.jsp +++ b/jspwiki-war/src/main/webapp/templates/default/editors/CKeditor.jsp @@ -51,7 +51,7 @@ "//cdn.ckeditor.com/4.5.1/standard/ckeditor.js" ); */ - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.TRUE ); + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.TRUE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, "false" ); WikiPage wikiPage = context.getPage(); @@ -114,8 +114,7 @@ // Disable the WYSIWYG_EDITOR_MODE and reset the other properties immediately // after the XHTML for CKeditor has been rendered. - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.FALSE ); - + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.FALSE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, null ); wikiPage.setAttribute( JSPWikiMarkupParser.PROP_CAMELCASELINKS, originalCCLOption ); diff --git a/jspwiki-war/src/main/webapp/templates/default/editors/TinyMCE.jsp b/jspwiki-war/src/main/webapp/templates/default/editors/TinyMCE.jsp index 2965c13..5e46921 100644 --- a/jspwiki-war/src/main/webapp/templates/default/editors/TinyMCE.jsp +++ b/jspwiki-war/src/main/webapp/templates/default/editors/TinyMCE.jsp @@ -48,7 +48,7 @@ WikiContext context = WikiContext.findContext( pageContext ); WikiEngine engine = context.getEngine(); - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.TRUE ); + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.TRUE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, "false" ); WikiPage wikiPage = context.getPage(); @@ -115,15 +115,12 @@ // Disable the WYSIWYG_EDITOR_MODE and reset the other properties immediately // after the XHTML for TinyMCE has been rendered. - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.FALSE ); - + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.FALSE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, null ); wikiPage.setAttribute( JSPWikiMarkupParser.PROP_CAMELCASELINKS, originalCCLOption ); - /*FSS not used String templateDir = (String)engine.getWikiProperties().get( WikiEngine.PROP_TEMPLATEDIR ); - String protocol = "http://"; if( request.isSecure() ) { diff --git a/jspwiki-war/src/main/webapp/templates/default/editors/wysiwyg.jsp b/jspwiki-war/src/main/webapp/templates/default/editors/wysiwyg.jsp index ba2e504..7c2db80 100644 --- a/jspwiki-war/src/main/webapp/templates/default/editors/wysiwyg.jsp +++ b/jspwiki-war/src/main/webapp/templates/default/editors/wysiwyg.jsp @@ -44,7 +44,7 @@ WikiContext context = WikiContext.findContext( pageContext ); WikiEngine engine = context.getEngine(); - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.TRUE ); + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.TRUE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, "false" ); WikiPage wikiPage = context.getPage(); @@ -106,14 +106,12 @@ // Disable the WYSIWYG_EDITOR_MODE and reset the other properties immediately // after the XHTML for wysiwyg editor has been rendered. - context.setVariable( RenderingManager.WYSIWYG_EDITOR_MODE, Boolean.FALSE ); - + context.setVariable( WikiContext.VAR_WYSIWYG_EDITOR_MODE, Boolean.FALSE ); context.setVariable( WikiEngine.PROP_RUNFILTERS, null ); wikiPage.setAttribute( JSPWikiMarkupParser.PROP_CAMELCASELINKS, originalCCLOption ); /*not used String templateDir = (String)engine.getWikiProperties().get( WikiEngine.PROP_TEMPLATEDIR ); - String protocol = "http://"; if( request.isSecure() ) {
