Xinha ist jetzt default DHTML Editor. CMS nutzt eine spezielle Konfigurationsdatei fuer Xinha.

git-svn-id: https://svn.libreccm.org/ccm/trunk@522 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2010-09-03 07:42:06 +00:00
parent bc47734c93
commit 0e8c56ee19
7 changed files with 133 additions and 16 deletions

View File

@ -239,8 +239,19 @@ public final class CMSConfig extends AbstractConfig {
m_dhtmlEditorConfig = new DHTMLEditorConfigParameter
("com.arsdigita.cms.dhtml_editor_config",
Parameter.REQUIRED,
DHTMLEditor.Config.STANDARD);
Parameter.REQUIRED,
new DHTMLEditor.Config( "XinhaConfig",
"/assets/xinha/CCMcmsXinhaConfig.js") );
// previous parameter definition:
// > DHTMLEditor.Config.STANDARD); <
// didn't work because of broken unmarshalling (cf. similiar problem
// with ResourceParameter and patch provided by Brad). It work for
// HTMLArea, because configuration was hard coded into xsl(!).
// Additionally, we would like to use a specific configuration for cms
// to include cms specific functions (like access to internal .
// content items for links and internal image assets, which may not
// be accessable by other modules which use DHTMLeditor.
// Would be bad style to configure a cms specific parameter in core.
m_dhtmlEditorPlugins = new StringArrayParameter
("com.arsdigita.cms.dhtml_editor_plugins",
@ -629,13 +640,32 @@ public final class CMSConfig extends AbstractConfig {
/**
* Internal class representing a DHTMLEditor configuration parameter. It
* creates a new DHMTLEditor Config object (internal class in DHTMLEditor).
*
* XXX Method unmarshal is broken and currently does not work correctly. It
* does not process default values provided by using
* DHTMLEditor.Config.Standard (see parameter m_dhtmlEditorConfig above).
* May be a similiar problem as with ResourceParameter and default value,
* see patch provided by pbrucha.
* Best solution may be to remove this special parameter class and use a
* string parameter instead to directly create a DHTMLEditor.Config object.
* (pboy, 2010-09-02)
*/
private class DHTMLEditorConfigParameter extends StringParameter {
public DHTMLEditorConfigParameter(final String name,
final int multiplicity,
final Object defaultObj) {
super(name, multiplicity, defaultObj);
}
/**
* WARNING: Does not correctly process default values, see above!
* @param value
* @param errors
* @return
*/
@Override
protected Object unmarshal(String value, ErrorList errors) {
return DHTMLEditor.Config.valueOf(value);

View File

@ -0,0 +1,22 @@
/* This is the OpenCCM default Xinha configuration file. It provides basic funcionality *
* which might be used by any CCM module. A module may provide its own configuration *
* file during Xinha loading or may extend com.arsdigita.bebop.form.DHTMLEditor as *
* ccm-cms does (com.arsdigita.cms.CMSDHTMLEditor) to provide extensive configuration *
* options. */
/* It is based on the original configuration file XinhaConfig.js (compressed version) */
/* http://svn.xinha.webfactional.com/trunk/examples/XinhaConfig.js */
xinha_init=null;
xinha_config=null;
xinha_init=xinha_init?xinha_init:function(){
xinha_editors=xinha_editors?xinha_editors:["myTextArea","anotherOne"];
xinha_plugins=xinha_plugins?xinha_plugins:["CharacterMap","ContextMenu","SmartReplace","Stylist","TableOperations"];
if(!Xinha.loadPlugins(xinha_plugins,xinha_init)){
return;
}
xinha_config=xinha_config?xinha_config():new Xinha.Config();
xinha_config.pageStyleSheets=[_editor_url+"examples/full_example.css"];
xinha_editors=Xinha.makeEditors(xinha_editors,xinha_config,xinha_plugins);
Xinha.startEditors(xinha_editors);
};
Xinha.addOnloadHandler(xinha_init);

View File

@ -42,12 +42,15 @@ public final class BebopConfig extends AbstractConfig {
private final Parameter m_presenter;
private final Parameter m_page;
/** Pointer to JTidy validation listener config file */
private final Parameter m_tidy;
private final Parameter m_fancyErrors;
private final Parameter m_dcpOnButtons;
private final Parameter m_dcpOnLinks;
private final Parameter m_enableTreeSelect;
/** List of supported DHTML editors, first one is default (Xinha) */
private final EnumerationParameter m_dhtmlEditor;
/** Path to DHTML editor source file, relativ to document root */
private final Parameter m_dhtmlEditorSrcFile;
private final Parameter m_showClassName;
@ -59,6 +62,7 @@ public final class BebopConfig extends AbstractConfig {
m_page = new ClassParameter
("waf.bebop.base_page", Parameter.REQUIRED, SimplePage.class);
/* Pointer to JTidy validation listener config file */
m_tidy = new StringParameter
("waf.bebop.tidy_config_file", Parameter.REQUIRED,
"com/arsdigita/bebop/parameters/tidy.properties");
@ -73,13 +77,16 @@ public final class BebopConfig extends AbstractConfig {
Parameter.REQUIRED,
Boolean.FALSE);
m_dhtmlEditor = new EnumerationParameter("waf.bebop.dhtml_editor",
Parameter.REQUIRED,BebopConstants.BEBOP_DHTMLEDITOR);
// HTMLArea for compatibility with old XSL
m_dhtmlEditor.put("HTMLArea", BebopConstants.BEBOP_DHTMLEDITOR);
m_dhtmlEditor.put("FCKeditor", BebopConstants.BEBOP_FCKEDITOR);
/** List of supported DHTML editors, first one is default (Xinha) */
m_dhtmlEditor = new EnumerationParameter("waf.bebop.dhtml_editor",
Parameter.REQUIRED,BebopConstants.BEBOP_XINHAEDITOR);
// Parameter.REQUIRED,BebopConstants.BEBOP_DHTMLEDITOR);
m_dhtmlEditor.put("Xinha", BebopConstants.BEBOP_XINHAEDITOR);
m_dhtmlEditor.put("FCKeditor", BebopConstants.BEBOP_FCKEDITOR);
// HTMLArea for backwards compatibility with old XSL. to be removed soon!
m_dhtmlEditor.put("HTMLArea", BebopConstants.BEBOP_DHTMLEDITOR);
// Xinha is now default!
m_dhtmlEditorSrcFile = new StringParameter
("waf.bebop.dhtml_editor_src", Parameter.REQUIRED,
"/assets/xinha/XinhaLoader.js");
@ -140,10 +147,16 @@ public final class BebopConfig extends AbstractConfig {
return ((Boolean) get(m_enableTreeSelect)).booleanValue();
}
/**
* Gets the DHTML editor to use
*/
public final String getDHTMLEditor() {
return (String) get(m_dhtmlEditor);
}
/**
* Gets the location of DHTML editor's xource file
*/
public final String getDHTMLEditorSrcFile() {
return (String) get(m_dhtmlEditorSrcFile);
}

View File

@ -31,7 +31,7 @@ waf.bebop.dcp_on_links.format=[boolean]
waf.bebop.dhtml_editor.title=DHTML editor implementation
waf.bebop.dhtml_editor.purpose=Select which DHTML text input widget is used for DHTMLEditor Bebop component.
waf.bebop.dhtml_editor.example=FCKeditor
waf.bebop.dhtml_editor.format=HTMLArea|FCKeditor|Xinha
waf.bebop.dhtml_editor.format=Xinha|FCKeditor|HTMLArea
waf.bebop.dhtml_editor_src.title=Relative path to the source javascript file
waf.bebop.dhtml_editor_src.purpose=Relative path to the source javascript file

View File

@ -32,11 +32,12 @@ import com.arsdigita.xml.Element;
/**
* Displays and manages a WYSIWYG HTML editor that takes advantage of
* DHTML scripting features.
* This class can use the HTMLArea <a href="http://women.cs.uiuc.edu/htmlarea/">
* http://women.cs.uiuc.edu/htmlarea/</a>
* or FCKeditor <a href="http://www.fckeditor.net">http://www.fckeditor.net</a>.
* This class can use:
* - <a href="http://www.xonha.org>Xinha</a>
* - <a href="http://www.fckeditor.net">FCKeditor</a>
* - HTMLarea for backwards compatibility, development discontinued
* Editor is choosen based on the config parameter waf.bebop.dhtml_editor,
* default is "HTMLArea" for compatibility reasons.
* default is "Xinha", which is the successor of HTNLarea
*
* @author Jim Parsons
* @author Richard Li
@ -73,9 +74,19 @@ public class DHTMLEditor extends TextArea {
* for a description of what this attribute does.
*/
public static final int SOFT = 2;
/**
* Config objects for supported DHTMP editors
*/
public static class Config {
public static final Config STANDARD = new Config("HTMLArea.Config", null);
// WARNING: Processing of these default values by CMSConfig does NOT
// work correctly because of deviciencies in unmarshal method there.
public static final Config STANDARD =
new Config("Xinha.Config",
"/assets/xinha/CCMcoreXinhaConfig.js");
/** Example FCKEditor configuration. */
public static final Config FCK_STANDARD =
@ -86,6 +97,10 @@ public class DHTMLEditor extends TextArea {
new Config("FCKEditor.Config.StyleCMSAdmin",
"/assets/fckeditor/config/fckconfigstylecmsadmin.js");
/** Example old HTMLarea configuration. */
public static final Config HTMLAREA =
new Config("HTMLArea.Config", null);
private String m_name;
private String m_path;
@ -123,20 +138,34 @@ public class DHTMLEditor extends TextArea {
return m_name + "," + m_path;
}
}
}
} //end config object(s)
private Config m_config;
private Set m_plugins;
private Set m_hiddenButtons;
/**
* Constructor
*
* @param name
*/
public DHTMLEditor(String name) {
this(new StringParameter(name));
}
/**
* Constructor
* @param model
*/
public DHTMLEditor(ParameterModel model) {
this(model, Config.STANDARD);
}
/**
* Constructor
* @param model
* @param config
*/
public DHTMLEditor(ParameterModel model,
Config config) {
super(model);
@ -176,6 +205,7 @@ public class DHTMLEditor extends TextArea {
public void addPlugin(String name) {
m_plugins.add(name);
}
/**
* Prevent the specified button from being displayed in the editor toolbar.
* @param name name of the button, as specified in the btnList of the htmlarea.js file

View File

@ -70,7 +70,7 @@ public class ResourceParameter extends AbstractParameter {
*
* Developers note:
* This makes the trick to use Parameter.java interface rsp AbstractParameter
* for other types of parameter as Strint. If you don't overwrite this
* for other types of parameter as String. If you don't overwrite this
* method, you will always get a casting error, because the parameter
* returns a string instead of the intended object!
*

View File

@ -0,0 +1,22 @@
/* This is the OpenCCM default Xinha configuration file. It provides basic funcionality *
* which might be used by any CCM module. A module may provide its own configuration *
* file during Xinha loading or may extend com.arsdigita.bebop.form.DHTMLEditor as *
* ccm-cms does (com.arsdigita.cms.CMSDHTMLEditor) to provide extensive configuration *
* options. */
/* It is based on the original configuration file XinhaConfig.js (compressed version) */
/* http://svn.xinha.webfactional.com/trunk/examples/XinhaConfig.js */
xinha_init=null;
xinha_config=null;
xinha_init=xinha_init?xinha_init:function(){
xinha_editors=xinha_editors?xinha_editors:["myTextArea","anotherOne"];
xinha_plugins=xinha_plugins?xinha_plugins:["CharacterMap","ContextMenu","SmartReplace","Stylist","TableOperations"];
if(!Xinha.loadPlugins(xinha_plugins,xinha_init)){
return;
}
xinha_config=xinha_config?xinha_config():new Xinha.Config();
xinha_config.pageStyleSheets=[_editor_url+"examples/full_example.css"];
xinha_editors=Xinha.makeEditors(xinha_editors,xinha_config,xinha_plugins);
Xinha.startEditors(xinha_editors);
};
Xinha.addOnloadHandler(xinha_init);