Integrated r1947,r1953:Can now use a WYSIWYG editor for authoring the definitions of Glossary Items.
git-svn-id: https://svn.libreccm.org/ccm/trunk@253 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
4685905732
commit
d79d3985f1
|
|
@ -1,4 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<registry>
|
<registry>
|
||||||
<!-- nothing yet -->
|
<config class="com.arsdigita.cms.contenttypes.GlossaryItemConfig"
|
||||||
|
storage="ccm-cms-types-glossaryitem/glossaryitem.properties"/>
|
||||||
</registry>
|
</registry>
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,14 @@ public class GlossaryItem extends ContentPage {
|
||||||
/** Data object type for this domain object */
|
/** Data object type for this domain object */
|
||||||
public static final String BASE_DATA_OBJECT_TYPE
|
public static final String BASE_DATA_OBJECT_TYPE
|
||||||
= "com.arsdigita.cms.contenttypes.GlossaryItem";
|
= "com.arsdigita.cms.contenttypes.GlossaryItem";
|
||||||
|
|
||||||
|
private static GlossaryItemConfig config = new GlossaryItemConfig();
|
||||||
|
static {
|
||||||
|
config.load();
|
||||||
|
}
|
||||||
|
public static GlossaryItemConfig getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
public GlossaryItem() {
|
public GlossaryItem() {
|
||||||
this( BASE_DATA_OBJECT_TYPE );
|
this( BASE_DATA_OBJECT_TYPE );
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009 Permeance Technologies Ptd Ltd. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
|
import com.arsdigita.runtime.AbstractConfig;
|
||||||
|
import com.arsdigita.util.parameter.EnumerationParameter;
|
||||||
|
import com.arsdigita.util.parameter.Parameter;
|
||||||
|
import com.arsdigita.util.parameter.StringParameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Config options for GlossaryItem.
|
||||||
|
* @author <a href="http://sourceforge.net/users/timcarpenter/">timcarpenter</a>
|
||||||
|
*/
|
||||||
|
public class GlossaryItemConfig extends AbstractConfig {
|
||||||
|
private final EnumerationParameter definitionEditorType;
|
||||||
|
private final Parameter fckEditorConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum of the types of editor that can be used.
|
||||||
|
*/
|
||||||
|
public enum EDITOR_TYPE {
|
||||||
|
WYSIWYG,
|
||||||
|
TEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GlossaryItemConfig() {
|
||||||
|
definitionEditorType = new EnumerationParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.glossaryitem.definition.editor",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
EDITOR_TYPE.TEXT);
|
||||||
|
definitionEditorType.put(EDITOR_TYPE.WYSIWYG.name().toLowerCase(),
|
||||||
|
EDITOR_TYPE.WYSIWYG);
|
||||||
|
definitionEditorType.put(EDITOR_TYPE.TEXT.name().toLowerCase(),
|
||||||
|
EDITOR_TYPE.TEXT);
|
||||||
|
|
||||||
|
fckEditorConfig = new StringParameter(
|
||||||
|
"com.arsdigita.cms.contenttypes.glossaryitem.fck_editor_config",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
"/assets/fckeditor/config/fckconfig_glossaryitem.js");
|
||||||
|
|
||||||
|
register(definitionEditorType);
|
||||||
|
register(fckEditorConfig);
|
||||||
|
|
||||||
|
loadInfo();
|
||||||
|
}
|
||||||
|
|
||||||
|
public final EDITOR_TYPE getDefinitionEditorType() {
|
||||||
|
return ((EDITOR_TYPE) get(definitionEditorType));
|
||||||
|
}
|
||||||
|
|
||||||
|
public final String getFckEditorConfig() {
|
||||||
|
return (String) get(fckEditorConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
com.arsdigita.cms.contenttypes.glossaryitem.definition.editor.title=Type of editor for the definition field
|
||||||
|
com.arsdigita.cms.contenttypes.glossaryitem.definition.editor.purpose=Choose the type of editor that should be used for the definition field
|
||||||
|
com.arsdigita.cms.contenttypes.glossaryitem.definition.editor.example=text
|
||||||
|
com.arsdigita.cms.contenttypes.glossaryitem.definition.editor.format=[text|wysiwyg]
|
||||||
|
|
||||||
|
com.arsdigita.cms.contenttypes.glossaryitem.fck_editor_config.title=FCK Editor Config
|
||||||
|
com.arsdigita.cms.contenttypes.glossaryitem.fck_editor_config.purpose=Configuration JS for the FCK Editor
|
||||||
|
com.arsdigita.cms.contenttypes.glossaryitem.fck_editor_config.example=/assets/fckeditor/config/fckconfig_glossaryitem.js
|
||||||
|
com.arsdigita.cms.contenttypes.glossaryitem.fck_editor_config.format=[string]
|
||||||
|
|
@ -20,6 +20,7 @@ package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CMS initializer.
|
* The CMS initializer.
|
||||||
*
|
*
|
||||||
|
|
@ -27,10 +28,6 @@ import org.apache.log4j.Logger;
|
||||||
* @version $Id: GlossaryItemInitializer.java 757 2005-09-02 14:12:21Z sskracic $
|
* @version $Id: GlossaryItemInitializer.java 757 2005-09-02 14:12:21Z sskracic $
|
||||||
*/
|
*/
|
||||||
public class GlossaryItemInitializer extends ContentTypeInitializer {
|
public class GlossaryItemInitializer extends ContentTypeInitializer {
|
||||||
public final static String versionId =
|
|
||||||
"$Id: GlossaryItemInitializer.java 757 2005-09-02 14:12:21Z sskracic $" +
|
|
||||||
"$Author: sskracic $" +
|
|
||||||
"$DateTime: 2004/08/17 23:15:09 $";
|
|
||||||
|
|
||||||
private static final Logger s_log = Logger.getLogger(GlossaryItemInitializer.class);
|
private static final Logger s_log = Logger.getLogger(GlossaryItemInitializer.class);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,22 +19,14 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.GlossaryItem;
|
import com.arsdigita.cms.contenttypes.GlossaryItem;
|
||||||
import com.arsdigita.cms.contenttypes.util.GlossaryGlobalizationUtil;
|
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
|
||||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form to edit the basic properties of an GlossaryItem. This form can be
|
* Form to edit the basic properties of an GlossaryItem. This form can be
|
||||||
* extended to create forms for GlossaryItem subclasses.
|
* extended to create forms for GlossaryItem subclasses.
|
||||||
|
|
@ -50,7 +42,7 @@ public class GlossaryItemPropertyForm
|
||||||
|
|
||||||
/** Name of this form */
|
/** Name of this form */
|
||||||
public static final String ID = "GlossaryItem_edit";
|
public static final String ID = "GlossaryItem_edit";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new form to edit the GlossaryItem object specified by the item
|
* Creates a new form to edit the GlossaryItem object specified by the item
|
||||||
* selection model passed in.
|
* selection model passed in.
|
||||||
|
|
@ -82,16 +74,9 @@ public class GlossaryItemPropertyForm
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
add( new Label(GlossaryGlobalizationUtil.globalize("cms.contenttypes.ui.glossary.definition") ));
|
GlossaryItemWidgetBuilder builder = new GlossaryItemWidgetBuilder();
|
||||||
ParameterModel definitionParam
|
add(builder.makeDefinitionLabel());
|
||||||
= new StringParameter( DEFINITION );
|
add(builder.makeDefinitionArea());
|
||||||
definitionParam
|
|
||||||
.addParameterListener( new NotNullValidationListener() );
|
|
||||||
TextArea definition = new TextArea( definitionParam );
|
|
||||||
definition.setCols( 40 );
|
|
||||||
definition.setRows( 5 );
|
|
||||||
add( definition );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Form initialisation hook. Fills widgets with data. */
|
/** Form initialisation hook. Fills widgets with data. */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2009 Permeance Technologies Ptd Ltd. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2.1 of
|
||||||
|
* the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Bebop;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.form.DHTMLEditor;
|
||||||
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
|
import com.arsdigita.bebop.util.BebopConstants;
|
||||||
|
import com.arsdigita.cms.contenttypes.GlossaryItem;
|
||||||
|
import com.arsdigita.cms.contenttypes.ui.authoring.GlossaryItemCreate;
|
||||||
|
import com.arsdigita.cms.contenttypes.util.GlossaryGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.ui.CMSDHTMLEditor;
|
||||||
|
|
||||||
|
import static com.arsdigita.cms.contenttypes.ui.GlossaryItemPropertyForm.DEFINITION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helps to build some of the widgets for {@link GlossaryItemPropertyForm}
|
||||||
|
* and {@link GlossaryItemCreate}
|
||||||
|
* @author <a href="http://sourceforge.net/users/timcarpenter/">timcarpenter</a>
|
||||||
|
*/
|
||||||
|
public class GlossaryItemWidgetBuilder {
|
||||||
|
public TextArea makeDefinitionArea() {
|
||||||
|
TextArea definition = null;
|
||||||
|
switch (GlossaryItem.getConfig().getDefinitionEditorType()) {
|
||||||
|
case WYSIWYG:
|
||||||
|
definition = new CMSDHTMLEditor(DEFINITION);
|
||||||
|
((CMSDHTMLEditor) definition).setWrap(DHTMLEditor.SOFT);
|
||||||
|
if (Bebop.getConfig().getDHTMLEditor()
|
||||||
|
.equals(BebopConstants.BEBOP_FCKEDITOR))
|
||||||
|
{
|
||||||
|
((CMSDHTMLEditor) definition).setConfig(
|
||||||
|
new DHTMLEditor.Config("glossaryitem",
|
||||||
|
GlossaryItem.getConfig().getFckEditorConfig()));
|
||||||
|
} else {
|
||||||
|
// remove this so end users cannot browse through back end
|
||||||
|
// folder system
|
||||||
|
((CMSDHTMLEditor) definition).hideButton("insertlink");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
definition = new TextArea(DEFINITION);
|
||||||
|
definition.setWrap(TextArea.SOFT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
definition.addValidationListener(new NotNullValidationListener());
|
||||||
|
definition.setCols(40);
|
||||||
|
definition.setRows(5);
|
||||||
|
return definition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Label makeDefinitionLabel() {
|
||||||
|
return new Label(GlossaryGlobalizationUtil
|
||||||
|
.globalize("cms.contenttypes.ui.glossary.definition"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,18 +21,14 @@ package com.arsdigita.cms.contenttypes.ui.authoring;
|
||||||
import com.arsdigita.cms.contenttypes.GlossaryItem;
|
import com.arsdigita.cms.contenttypes.GlossaryItem;
|
||||||
import com.arsdigita.cms.Folder;
|
import com.arsdigita.cms.Folder;
|
||||||
import com.arsdigita.cms.ContentBundle;
|
import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentSection;
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.ui.authoring.PageCreate;
|
import com.arsdigita.cms.ui.authoring.PageCreate;
|
||||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||||
import com.arsdigita.bebop.Label;
|
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.cms.contenttypes.util.GlossaryGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.ui.GlossaryItemWidgetBuilder;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A page that will create a new GlossaryItem.
|
* A page that will create a new GlossaryItem.
|
||||||
|
|
@ -55,27 +51,20 @@ public class GlossaryItemCreate extends PageCreate {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
|
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
TextArea definition = new TextArea(DEFINITION);
|
GlossaryItemWidgetBuilder builder = new GlossaryItemWidgetBuilder();
|
||||||
definition.addValidationListener(new NotNullValidationListener());
|
add(builder.makeDefinitionLabel());
|
||||||
definition.setCols(40);
|
add(builder.makeDefinitionArea());
|
||||||
definition.setRows(5);
|
|
||||||
|
|
||||||
add(new Label(GlossaryGlobalizationUtil.globalize("cms.contenttypes.ui.glossary.definition")));
|
|
||||||
add(definition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void process(FormSectionEvent e) throws FormProcessException {
|
public void process(FormSectionEvent e) throws FormProcessException {
|
||||||
|
|
||||||
FormData data = e.getFormData();
|
FormData data = e.getFormData();
|
||||||
PageState state = e.getPageState();
|
PageState state = e.getPageState();
|
||||||
ItemSelectionModel m = getItemSelectionModel();
|
|
||||||
|
|
||||||
// Try to get the content section from the state parameter
|
// Try to get the content section from the state parameter
|
||||||
Folder f = m_parent.getFolder(state);
|
Folder f = m_parent.getFolder(state);
|
||||||
ContentSection sec = m_parent.getContentSection(state);
|
|
||||||
GlossaryItem item = (GlossaryItem)createContentPage(state);
|
GlossaryItem item = (GlossaryItem)createContentPage(state);
|
||||||
item.setLanguage((String) data.get(LANGUAGE));
|
item.setLanguage((String) data.get(LANGUAGE));
|
||||||
item.setName((String)data.get(NAME));
|
item.setName((String)data.get(NAME));
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* FCKeditor - The text editor for internet
|
||||||
|
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
|
||||||
|
*
|
||||||
|
* Custom amendments for Forum application.
|
||||||
|
*/
|
||||||
|
FCKConfig.FillEmptyBlocks = false ;
|
||||||
|
|
||||||
|
FCKConfig.ToolbarSets["Basic"] = [
|
||||||
|
['Source','-','Preview','-'],
|
||||||
|
['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'],
|
||||||
|
['Cut','Copy','Paste','PasteText','PasteWord','-','Print'],
|
||||||
|
'/',
|
||||||
|
['OrderedList','UnorderedList','-','Outdent','Indent'],
|
||||||
|
['Link','Unlink'],
|
||||||
|
['Undo','Redo','-','SelectAll'],
|
||||||
|
['TextColor','BGColor'],
|
||||||
|
['Rule','SpecialChar','Smiley'],
|
||||||
|
'/',
|
||||||
|
['FontFormat','FontName','FontSize']
|
||||||
|
] ;
|
||||||
|
|
||||||
|
//only licenced for private use
|
||||||
|
//FCKConfig.SpellChecker = 'ieSpell' ; // 'ieSpell' | 'SpellerPages'
|
||||||
|
//FCKConfig.IeSpellDownloadUrl = 'http://www.iespell.com/rel/ieSpellSetup211325.exe' ;
|
||||||
|
|
||||||
|
FCKConfig.LinkUpload = false ;
|
||||||
|
FCKConfig.LinkBrowser = false ; // forum - don't allow users to browse content centre or server file system
|
||||||
|
FCKConfig.ImageBrowser = false ;
|
||||||
|
FCKConfig.FlashBrowser = false ;
|
||||||
|
|
||||||
|
FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ;
|
||||||
Loading…
Reference in New Issue