Changed the column type for the abstract and misc properties of Publications from varchar(4096) to text. It also now possible to enable the HTML editor for the abstract and misc fields of publications. The default is still no HTML editor.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2558 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-03-07 06:52:42 +00:00
parent 13b7c7cf2e
commit b396010920
15 changed files with 1557 additions and 1462 deletions

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui.authoring; package com.arsdigita.cms.ui.authoring;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.RequestLocal;
@ -34,14 +33,12 @@ import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
/** /**
* Displays the current text body of the article and allows the user * Displays the current text body of the article and allows the user to edit it, by uploading a file
* to edit it, by uploading a file or entering text in a textbox. * or entering text in a textbox.
* *
* The {@link com.arsdigita.bebop.PropertySheet} class is often used * The {@link com.arsdigita.bebop.PropertySheet} class is often used as the display component in the
* as the display component in the default authoring kit steps of * default authoring kit steps of this class.
* this class.
* *
* @author Stanislav Freidin (sfreidin@arsdigita.com) * @author Stanislav Freidin (sfreidin@arsdigita.com)
* @version $Id: GenericArticleBody.java 1949 2009-06-25 08:30:50Z terry $ * @version $Id: GenericArticleBody.java 1949 2009-06-25 08:30:50Z terry $
@ -54,12 +51,11 @@ public class GenericArticleBody extends TextAssetBody {
/** /**
* Construct a new GenericArticleBody component * Construct a new GenericArticleBody component
* *
* @param itemModel The {@link ItemSelectionModel} which will * @param itemModel The {@link ItemSelectionModel} which will be responsible for loading the
* be responsible for loading the current item * current item
* *
* @param parent The parent wizard which contains the form. The form * @param parent The parent wizard which contains the form. The form may use the wizard's
* may use the wizard's methods, such as stepForward and stepBack, * methods, such as stepForward and stepBack, in its process listener.
* in its process listener.
*/ */
public GenericArticleBody(ItemSelectionModel itemModel, AuthoringKitWizard parent) { public GenericArticleBody(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
super(new ItemAssetModel(itemModel)); super(new ItemAssetModel(itemModel));
@ -69,17 +65,18 @@ public class GenericArticleBody extends TextAssetBody {
// Rest the component when it is hidden // Rest the component when it is hidden
parent.getList().addActionListener(new ActionListener() { parent.getList().addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
PageState state = e.getPageState(); PageState state = e.getPageState();
reset(state); reset(state);
} }
});
});
// Set the right component access on the forms // Set the right component access on the forms
Component f = getComponent(FILE_UPLOAD); Component f = getComponent(FILE_UPLOAD);
if (f != null) { if (f != null) {
setComponentAccess(FILE_UPLOAD, setComponentAccess(FILE_UPLOAD,
new WorkflowLockedComponentAccess(f, itemModel)); new WorkflowLockedComponentAccess(f, itemModel));
} }
Component t = getComponent(TEXT_ENTRY); Component t = getComponent(TEXT_ENTRY);
setComponentAccess(TEXT_ENTRY, setComponentAccess(TEXT_ENTRY,
@ -87,9 +84,10 @@ public class GenericArticleBody extends TextAssetBody {
} }
/** /**
* Adds the options for the mime type select widget of * Adds the options for the mime type select widget of <code>GenericArticleForm</code> and sets
* <code>GenericArticleForm</code> and sets the default mime type. * the default mime type.
**/ *
*/
@Override @Override
protected void setMimeTypeOptions(SingleSelect mimeSelect) { protected void setMimeTypeOptions(SingleSelect mimeSelect) {
mimeSelect.addOption(new Option("text/html", "HTML Text")); mimeSelect.addOption(new Option("text/html", "HTML Text"));
@ -100,6 +98,7 @@ public class GenericArticleBody extends TextAssetBody {
* Create a new text asset and associate it with the current item * Create a new text asset and associate it with the current item
* *
* @param s the current page state * @param s the current page state
*
* @return a valid TextAsset * @return a valid TextAsset
*/ */
protected TextAsset createTextAsset(PageState s) { protected TextAsset createTextAsset(PageState s) {
@ -109,7 +108,7 @@ public class GenericArticleBody extends TextAssetBody {
final int idLen = item.getID().toString().length(); final int idLen = item.getID().toString().length();
final int len = nameLen + 6 + idLen; final int len = nameLen + 6 + idLen;
if (len < 200) { if (len < 200) {
t.setName(item.getName() + "_text_" + item.getID()); t.setName(item.getName() + "_text_" + item.getID());
} else { } else {
t.setName(item.getName().substring(0, 200 - (len - 200)) + "_text_" + item.getID()); t.setName(item.getName().substring(0, 200 - (len - 200)) + "_text_" + item.getID());
} }
@ -120,8 +119,8 @@ public class GenericArticleBody extends TextAssetBody {
} }
/** /**
* Set additional parameters of a brand new text asset, such as the * Set additional parameters of a brand new text asset, such as the parent ID, after the asset
* parent ID, after the asset has been successfully uploaded * has been successfully uploaded
* *
* @param s the current page state * @param s the current page state
* @param a the new <code>TextAsset</code> * @param a the new <code>TextAsset</code>
@ -142,12 +141,11 @@ public class GenericArticleBody extends TextAssetBody {
* Get the current GenericArticle * Get the current GenericArticle
*/ */
protected GenericArticle getGenericArticle(PageState s) { protected GenericArticle getGenericArticle(PageState s) {
return (GenericArticle)m_itemModel.getSelectedObject(s); return (GenericArticle) m_itemModel.getSelectedObject(s);
} }
/** /**
* An ACSObjectSelectionModel that selects the current text asset for * An ACSObjectSelectionModel that selects the current text asset for the text page
* the text page
*/ */
private static class ItemAssetModel extends ItemSelectionModel { private static class ItemAssetModel extends ItemSelectionModel {
@ -158,25 +156,26 @@ public class GenericArticleBody extends TextAssetBody {
m_asset = new RequestLocal() { m_asset = new RequestLocal() {
@Override @Override
protected Object initialValue(PageState s) { protected Object initialValue(PageState s) {
GenericArticle t = (GenericArticle) GenericArticle t
((ItemSelectionModel)getSingleSelectionModel()) = (GenericArticle) ((ItemSelectionModel) getSingleSelectionModel()).
.getSelectedObject(s); getSelectedObject(s);
Assert.exists(t); Assert.exists(t);
return t.getTextAsset(); return t.getTextAsset();
} }
};
};
} }
@Override @Override
public Object getSelectedKey(PageState s) { public Object getSelectedKey(PageState s) {
TextAsset a = (TextAsset)getSelectedObject(s); TextAsset a = (TextAsset) getSelectedObject(s);
return (a == null) ? null : a.getID(); return (a == null) ? null : a.getID();
} }
@Override @Override
public DomainObject getSelectedObject(PageState s) { public DomainObject getSelectedObject(PageState s) {
return (DomainObject)m_asset.get(s); return (DomainObject) m_asset.get(s);
} }
@Override @Override
@ -186,13 +185,15 @@ public class GenericArticleBody extends TextAssetBody {
@Override @Override
public void setSelectedKey(PageState s, Object key) { public void setSelectedKey(PageState s, Object key) {
throw new UnsupportedOperationException( (String) GlobalizationUtil.globalize("cms.ui.authoring.not_implemented").localize()); throw new UnsupportedOperationException((String) GlobalizationUtil.globalize(
"cms.ui.authoring.not_implemented").localize());
} }
@Override @Override
public boolean isSelected(PageState s) { public boolean isSelected(PageState s) {
return (getSelectedObject(s) != null); return (getSelectedObject(s) != null);
} }
} }
} }

View File

@ -34,6 +34,8 @@
storage="ccm-core/templating.properties"/> storage="ccm-core/templating.properties"/>
<config class="com.arsdigita.ui.UIConfig" <config class="com.arsdigita.ui.UIConfig"
storage="ccm-core/ui.properties"/> storage="ccm-core/ui.properties"/>
<config class="com.arsdigita.util.SystemInformation"
storage="ccm-core/systeminformation.properties"/>
<config class="com.arsdigita.versioning.VersioningConfig" <config class="com.arsdigita.versioning.VersioningConfig"
storage="ccm-core/versioning.properties"/> storage="ccm-core/versioning.properties"/>
<config class="com.arsdigita.web.WebConfig" <config class="com.arsdigita.web.WebConfig"

File diff suppressed because it is too large Load Diff

View File

@ -190,7 +190,7 @@ public class Initializer extends CompoundInitializer {
}); });
// Set system informations // Set system informations
loadSystemInformation(); // loadSystemInformation();
// register the document converters // register the document converters
Converter converter = new PDFConverter(); Converter converter = new PDFConverter();
@ -229,14 +229,14 @@ public class Initializer extends CompoundInitializer {
s_log.info("Core init(DomainInitEvent) done"); s_log.info("Core init(DomainInitEvent) done");
} }
private void loadSystemInformation() { // private void loadSystemInformation() {
SystemInformation sysInfo = SystemInformation.getInstance(); // SystemInformation sysInfo = SystemInformation.getInstance();
//
// Hardcoded for now // // Hardcoded for now
sysInfo.put("version", "v2.1.0"); // sysInfo.put("version", "v2.3.x-SNAPSHOT");
sysInfo.put("appname", "ScientificCMS"); // sysInfo.put("appname", "ScientificCMS");
sysInfo.put("apphomepage", "http://www.scientificcms.org"); // sysInfo.put("apphomepage", "http://www.scientificcms.org");
sysInfo.lock(); // sysInfo.lock();
} // }
} }

View File

@ -2,34 +2,42 @@ waf.debug.title=Global debug flag
waf.debug.purpose=Enables or disables WAF debugging waf.debug.purpose=Enables or disables WAF debugging
waf.debug.example=true waf.debug.example=true
waf.debug.format=true|false waf.debug.format=true|false
waf.kernel.data_permission_check_enabled.title=DML permission checking flag waf.kernel.data_permission_check_enabled.title=DML permission checking flag
waf.kernel.data_permission_check_enabled.purpose=Enables or disables permissions checks on database writes waf.kernel.data_permission_check_enabled.purpose=Enables or disables permissions checks on database writes
waf.kernel.data_permission_check_enabled.example=true waf.kernel.data_permission_check_enabled.example=true
waf.kernel.data_permission_check_enabled.format=true|false waf.kernel.data_permission_check_enabled.format=true|false
waf.kernel.primary_user_identifier.title=The primary user identification waf.kernel.primary_user_identifier.title=The primary user identification
waf.kernel.primary_user_identifier.purpose=Determines whether email addresses or screen names are used to authenticate users waf.kernel.primary_user_identifier.purpose=Determines whether email addresses or screen names are used to authenticate users
waf.kernel.primary_user_identifier.example=email waf.kernel.primary_user_identifier.example=email
waf.kernel.primary_user_identifier.format=email|screen_name waf.kernel.primary_user_identifier.format=email|screen_name
waf.kernel.remember_login.title=Remember login by default waf.kernel.remember_login.title=Remember login by default
waf.kernel.remember_login.purpose=Determines whether the "remember login" feature is enabled or disabled by default waf.kernel.remember_login.purpose=Determines whether the "remember login" feature is enabled or disabled by default
waf.kernel.remember_login.example=true waf.kernel.remember_login.example=true
waf.kernel.remember_login.format=true|false waf.kernel.remember_login.format=true|false
waf.kernel.secure_login.title=Require secure login waf.kernel.secure_login.title=Require secure login
waf.kernel.secure_login.purpose=Accept only credentials presented over secure connection waf.kernel.secure_login.purpose=Accept only credentials presented over secure connection
waf.kernel.secure_login.example=true waf.kernel.secure_login.example=true
waf.kernel.secure_login.format=true|false waf.kernel.secure_login.format=true|false
waf.kernel.sso_login.title=Enable SSO login waf.kernel.sso_login.title=Enable SSO login
waf.kernel.sso_login.purpose=Enable alternative "RegisterSSO" login context. waf.kernel.sso_login.purpose=Enable alternative "RegisterSSO" login context.
waf.kernel.sso_login.example=false waf.kernel.sso_login.example=false
waf.kernel.sso_login.format=true|false waf.kernel.sso_login.format=true|false
waf.kernel.supported_languages.title=Set the supported languages for categorization waf.kernel.supported_languages.title=Set the supported languages for categorization
waf.kernel.supported_languages.purpose=Set the supported languages for categorization. First entry is the default language waf.kernel.supported_languages.purpose=Set the supported languages for categorization. First entry is the default language
waf.kernel.supported_languages.example=en,de,fr,nl,it,pt,es waf.kernel.supported_languages.example=en,de,fr,nl,it,pt,es
waf.kernel.supported_languages.format=[string] waf.kernel.supported_languages.format=[string]
waf.kernel.language_independent_items.title=Allow language independent content items waf.kernel.language_independent_items.title=Allow language independent content items
waf.kernel.language_independent_items.purpose=Allow language independent content items waf.kernel.language_independent_items.purpose=Allow language independent content items
waf.kernel.language_independent_items.example=false waf.kernel.language_independent_items.example=false
waf.kernel.language_independent_items.format=true|false waf.kernel.language_independent_items.format=true|false
waf.kernel.language_independent_code.title=Select language independent code waf.kernel.language_independent_code.title=Select language independent code
waf.kernel.language_independent_code.purpose=Allow language independent code waf.kernel.language_independent_code.purpose=Allow language independent code
waf.kernel.language_independent_code.example=-- waf.kernel.language_independent_code.example=--

View File

@ -4,63 +4,84 @@
*/ */
package com.arsdigita.util; package com.arsdigita.util;
import com.arsdigita.runtime.AbstractConfig;
import com.arsdigita.util.parameter.Parameter;
import com.arsdigita.util.parameter.StringParameter;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* *
* @author Sören Bernstein <quasi@quasiweb.de> * @author Sören Bernstein <quasi@quasiweb.de>
* @author Jens Pelzetter
*/ */
public class SystemInformation implements Lockable { public class SystemInformation extends AbstractConfig { //implements Lockable {
private Map<String, String> systemInformation = new HashMap<String, String>(); private Parameter sysInfoParam = new StringParameter(
private boolean locked = false; "ccm.systeminformation",
Parameter.REQUIRED,
"version::2.x.y; appname::LibreCCM; apphomepage::http://www.libreccm.org;");
private Map<String, String> systemInformation;// = new HashMap<String, String>();
//private boolean locked = false;
/** /**
* The one and only instance of this class * The one and only instance of this class
*/ */
private static final SystemInformation INSTANCE = new SystemInformation(); private static SystemInformation INSTANCE;// = new SystemInformation();
private SystemInformation() { public SystemInformation() {
// Nothing register(sysInfoParam);
loadInfo();
} }
/** /**
* @return The instance of this class. * @return The instance of this class.
*/ */
public static SystemInformation getInstance() { public static SystemInformation getInstance() {
return SystemInformation.INSTANCE; if (INSTANCE == null) {
} INSTANCE = new SystemInformation();
INSTANCE.load();
/** }
* Put system information into the map. If this instance is locked, this method
* throw an {@link AssertionError}. return INSTANCE;
*
* @param key Key for the Map. Also used as attribute name during output.
* @param value Value
* @throws IllegalArgumentException if key or value is null or empty
*/
final public void put(String key, String value) throws IllegalArgumentException {
if (key == null || key.isEmpty()) {
throw new IllegalArgumentException("Parameter key must not be null or empty.");
}
if (value == null || value.isEmpty()) {
throw new IllegalArgumentException("Parameter value must not be null or empty.");
}
// Test if instance is not locked
Assert.isUnlocked(this);
systemInformation.put(key, value);
} }
// /**
// * Put system information into the map. If this instance is locked, this method throw an
// * {@link AssertionError}.
// *
// * @param key Key for the Map. Also used as attribute name during output.
// * @param value Value
// *
// * @throws IllegalArgumentException if key or value is null or empty
// */
// final public void put(final String key, final String value) throws IllegalArgumentException {
// if (key == null || key.isEmpty()) {
// throw new IllegalArgumentException("Parameter key must not be null or empty.");
// }
// if (value == null || value.isEmpty()) {
// throw new IllegalArgumentException("Parameter value must not be null or empty.");
// }
// // Test if instance is not locked
// Assert.isUnlocked(this);
// systemInformation.put(key, value);
// }
/** /**
* Get system informations by key. * Get system informations by key.
* *
* @param key Key for the map * @param key Key for the map
*
* @return value for key * @return value for key
*
* @throws IllegalArgumentException if key is null or empty * @throws IllegalArgumentException if key is null or empty
*/ */
final public String get(String key) throws IllegalArgumentException { final public String get(String key) throws IllegalArgumentException {
if (systemInformation == null) {
loadMap();
}
if (key == null || key.isEmpty()) { if (key == null || key.isEmpty()) {
throw new IllegalArgumentException("Parameter key must not be null or empty."); throw new IllegalArgumentException("Parameter key must not be null or empty.");
} }
@ -73,7 +94,11 @@ public class SystemInformation implements Lockable {
* @return iterator of map * @return iterator of map
*/ */
final public Iterator<Map.Entry<String, String>> iterator() { final public Iterator<Map.Entry<String, String>> iterator() {
return ((Set<Map.Entry<String, String>>) systemInformation.entrySet()).iterator(); if (systemInformation == null) {
loadMap();
}
return (systemInformation.entrySet()).iterator();
} }
/** /**
@ -81,20 +106,43 @@ public class SystemInformation implements Lockable {
* @return * @return
*/ */
final public boolean isEmpty() { final public boolean isEmpty() {
if (systemInformation == null) {
loadMap();
}
return systemInformation.isEmpty(); return systemInformation.isEmpty();
}
/**
* Lock this instance to prevent further changes.
*/
final public void lock() {
locked = true;
} }
/** /**
* Test, if this instance is locked. * Lock this instance to prevent further changes.
* @return locked
*/ */
final public boolean isLocked() { // final public void lock() {
return locked; // locked = true;
// }
//
// /**
// * Test, if this instance is locked.
// *
// * @return locked
// */
// final public boolean isLocked() {
// return locked;
// }
private void loadMap() {
systemInformation = new HashMap<String, String>();
final String[] tokens = ((String) get(sysInfoParam)).split(";");
for (String token : tokens) {
processToken(token);
}
} }
private void processToken(final String token) {
final String[] parts = token.split("::");
if (2 == parts.length) {
systemInformation.put(parts[0].trim(), parts[1].trim());
}
}
} }

View File

@ -2,7 +2,7 @@
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" <ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
name="ccm-sci-publications" name="ccm-sci-publications"
prettyName="OpenCCM Content Types" prettyName="OpenCCM Content Types"
version="6.6.6" version="6.6.7"
release="1" release="1"
webapp="ROOT"> webapp="ROOT">
<ccm:dependencies> <ccm:dependencies>

View File

@ -26,8 +26,8 @@ import com.arsdigita.cms.ContentBundle;
object type Publication extends ContentPage { object type Publication extends ContentPage {
Integer[0..1] yearOfPublication = ct_publications.year INTEGER; Integer[0..1] yearOfPublication = ct_publications.year INTEGER;
String[0..1] abstract = ct_publications.abstract VARCHAR(4096); String[0..1] abstract = ct_publications.abstract CLOB;
String[0..1] misc = ct_publications.misc VARCHAR(4096); String[0..1] misc = ct_publications.misc CLOB;
//The reviewed property has been moved here for performance reasons. It //The reviewed property has been moved here for performance reasons. It
//is necessary to have access to this property from a data query //is necessary to have access to this property from a data query
//over all publications of a person. Since this property was only //over all publications of a person. Since this property was only

View File

@ -0,0 +1,3 @@
-- Alter abstract and misc column type to text
ALTER TABLE ct_publications ALTER COLUMN abstract TYPE text;
ALTER TABLE ct_publications ALTER COLUMN misc TYPE text;

View File

@ -0,0 +1,8 @@
\echo 'ScientificCMS Publications module 6.6.6 -> 6.6.7 Upgrade script (PostgreSQL)'
begin;
\i ../default/upgrade/6.6.6-6.6.7/abstract_to_text.sql
end;

View File

@ -18,4 +18,7 @@
<version from="6.6.5" to="6.6.6"> <version from="6.6.5" to="6.6.6">
<script class="com.arsdigita.cms.contenttypes.upgrades.SciPublicationsUpgrade665to666"/> <script class="com.arsdigita.cms.contenttypes.upgrades.SciPublicationsUpgrade665to666"/>
</version> </version>
<version from="6.6.6" to="6.6.7">
<script sql="ccm-sci-publications/upgrade/::database::-6.6.6-6.6.7.sql" />
</version>
</upgrade> </upgrade>

View File

@ -74,201 +74,203 @@ public class PublicationsConfig extends AbstractConfig {
private final Parameter orgaBundleType; private final Parameter orgaBundleType;
private final Parameter enableFirstPublishedProperty; private final Parameter enableFirstPublishedProperty;
private final Parameter enableLanguageProperty; private final Parameter enableLanguageProperty;
private final Parameter enableAbstractHTML;
private final Parameter enableMiscHTML;
public PublicationsConfig() { public PublicationsConfig() {
attachOrgaUnitsStep = attachOrgaUnitsStep = new BooleanParameter(
new BooleanParameter( "com.arsdigita.cms.contenttypes.publications.attach_orgaunits_step",
"com.arsdigita.cms.contenttypes.publications.attach_orgaunits_step", Parameter.REQUIRED,
Parameter.REQUIRED, Boolean.FALSE);
Boolean.FALSE);
orgaUnitsStepSortKey = orgaUnitsStepSortKey = new IntegerParameter(
new IntegerParameter( "com.arsdigita.cms.contenttypes.publications.orgaunits_step_sort_key",
"com.arsdigita.cms.contenttypes.publications.orgaunits_step_sort_key", Parameter.REQUIRED,
Parameter.REQUIRED, 10);
10);
attachOrganizationPublicationsStepTo = attachOrganizationPublicationsStepTo = new StringParameter(
new StringParameter( "com.arsdigita.cms.contenttypes.publications.attach_organization_publications_step_to",
"com.arsdigita.cms.contenttypes.publications.attach_organization_publications_step_to", Parameter.REQUIRED,
Parameter.REQUIRED, "");
"");
organizationPublicationsStepSortKey = organizationPublicationsStepSortKey = new IntegerParameter(
new IntegerParameter( "com.arsdigita.cms.contenttypes.publications.organization_publications_step_sort_key",
"com.arsdigita.cms.contenttypes.publications.organization_publications_step_sort_key", Parameter.REQUIRED,
Parameter.REQUIRED, 10);
10);
attachPersonPublicationsStep = attachPersonPublicationsStep = new BooleanParameter(
new BooleanParameter( "com.arsdigita.cms.contenttypes.publications.attach_person_publications_step",
"com.arsdigita.cms.contenttypes.publications.attach_person_publications_step", Parameter.REQUIRED,
Parameter.REQUIRED, Boolean.TRUE);
Boolean.TRUE);
personPublicationsStepSortKey = personPublicationsStepSortKey = new IntegerParameter(
new IntegerParameter( "com.arsdigita.cms.contenttypes.publications.person_publications_step_sort_key",
"com.arsdigita.cms.contenttypes.publications.person_publications_step_sort_key", Parameter.REQUIRED,
Parameter.REQUIRED, 10);
10);
attachPublicationsStepTo = attachPublicationsStepTo = new StringParameter(
new StringParameter( "com.arsdigita.cms.contenttypes.publications.attach_publications_step_to",
"com.arsdigita.cms.contenttypes.publications.attach_publications_step_to", Parameter.REQUIRED,
Parameter.REQUIRED, "");
"");
publicationsStepSortKey = publicationsStepSortKey = new IntegerParameter(
new IntegerParameter( "com.arsdigita.cms.contenttypes.publications.publications_step_sort_key",
"com.arsdigita.cms.contenttypes.publications.publications_step_sort_key", Parameter.REQUIRED,
Parameter.REQUIRED, 11);
11);
attachPublisherPublicationsStep = attachPublisherPublicationsStep = new BooleanParameter(
new BooleanParameter( "com.arsdigita.cms.contenttypes.publications.attach_publisher_publications_step",
"com.arsdigita.cms.contenttypes.publications.attach_publisher_publications_step", Parameter.REQUIRED,
Parameter.REQUIRED, Boolean.TRUE);
Boolean.TRUE);
publisherPublicationsStepSortKey = publisherPublicationsStepSortKey = new IntegerParameter(
new IntegerParameter( "com.arsdigita.cms.contenttypes.publications.publisher_publications_step_sort_key",
"com.arsdigita.cms.contenttypes.publications.publisher_publications_step_sort_key", Parameter.REQUIRED,
Parameter.REQUIRED, 10);
10);
defaultAuthorsFolderID = new IntegerParameter( defaultAuthorsFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_authors_folder_id", "com.arsdigita.cms.contenttypes.publications.default_authors_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultAuthorsFolderPath = new StringParameter( defaultAuthorsFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_authors_folder_path", "com.arsdigita.cms.contenttypes.publications.default_authors_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultSeriesFolderID = new IntegerParameter( defaultSeriesFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_series_folder_id", "com.arsdigita.cms.contenttypes.publications.default_series_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultSeriesFolderPath = new StringParameter( defaultSeriesFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_series_folder_path", "com.arsdigita.cms.contenttypes.publications.default_series_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultPublisherFolderID = new IntegerParameter( defaultPublisherFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_publisher_folder_id", "com.arsdigita.cms.contenttypes.publications.default_publisher_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultPublisherFolderPath = new StringParameter( defaultPublisherFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_publisher_folder_path", "com.arsdigita.cms.contenttypes.publications.default_publisher_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultCollectedVolumesFolderID = new IntegerParameter( defaultCollectedVolumesFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_collectedvolumes_folder_id", "com.arsdigita.cms.contenttypes.publications.default_collectedvolumes_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultCollectedVolumesFolderPath = new StringParameter( defaultCollectedVolumesFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_collectedvolumes_folder_path", "com.arsdigita.cms.contenttypes.publications.default_collectedvolumes_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultJournalsFolderID = new IntegerParameter( defaultJournalsFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_journals_folder_id", "com.arsdigita.cms.contenttypes.publications.default_journals_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultJournalsFolderPath = new StringParameter( defaultJournalsFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_journals_folder_path", "com.arsdigita.cms.contenttypes.publications.default_journals_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultArticlesInCollectedVolumeFolderID = new IntegerParameter( defaultArticlesInCollectedVolumeFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_articlesincollectedvolume_folder_id", "com.arsdigita.cms.contenttypes.publications.default_articlesincollectedvolume_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultArticlesInCollectedVolumeFolderPath = new StringParameter( defaultArticlesInCollectedVolumeFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_articlesincollectedvolume_folder_path", "com.arsdigita.cms.contenttypes.publications.default_articlesincollectedvolume_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultOrganizationsFolderID = new IntegerParameter( defaultOrganizationsFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_organizations_folder_id", "com.arsdigita.cms.contenttypes.publications.default_organizations_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultOrganizationsFolderPath = new StringParameter( defaultOrganizationsFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_organizations_folder_path", "com.arsdigita.cms.contenttypes.publications.default_organizations_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultProceedingsFolderID = new IntegerParameter( defaultProceedingsFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_proceedings_folder_id", "com.arsdigita.cms.contenttypes.publications.default_proceedings_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultProceedingsFolderPath = new StringParameter( defaultProceedingsFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_proceedings_folder_path", "com.arsdigita.cms.contenttypes.publications.default_proceedings_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultInProceedingsFolderID = new IntegerParameter( defaultInProceedingsFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_inproccedings_folder_id", "com.arsdigita.cms.contenttypes.publications.default_inproccedings_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultInProceedingsFolderPath = new StringParameter( defaultInProceedingsFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_inproceedings_folder_path", "com.arsdigita.cms.contenttypes.publications.default_inproceedings_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultArticlesInJournalFolderID = new IntegerParameter( defaultArticlesInJournalFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_articlesinjournal_folder_id", "com.arsdigita.cms.contenttypes.publications.default_articlesinjournal_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultArticlesInJournalFolderPath = new StringParameter( defaultArticlesInJournalFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_articlesinjournal_folder_path", "com.arsdigita.cms.contenttypes.publications.default_articlesinjournal_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultPublicationsFolderID = new IntegerParameter( defaultPublicationsFolderID = new IntegerParameter(
"com.arsdigita.cms.contenttypes.publications.default_publications_folder_id", "com.arsdigita.cms.contenttypes.publications.default_publications_folder_id",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
defaultPublicationsFolderPath = new StringParameter( defaultPublicationsFolderPath = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.default_publications_folder_path", "com.arsdigita.cms.contenttypes.publications.default_publications_folder_path",
Parameter.OPTIONAL, Parameter.OPTIONAL,
null); null);
seriesVolumesOrder = new StringParameter( seriesVolumesOrder = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.series.volumes_order", "com.arsdigita.cms.contenttypes.publications.series.volumes_order",
Parameter.REQUIRED, Parameter.REQUIRED,
"desc"); "desc");
orgaType = new StringParameter( orgaType = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.organization_type", "com.arsdigita.cms.contenttypes.publications.organization_type",
Parameter.OPTIONAL, Parameter.OPTIONAL,
Publisher.BASE_DATA_OBJECT_TYPE); Publisher.BASE_DATA_OBJECT_TYPE);
orgaBundleType = new StringParameter( orgaBundleType = new StringParameter(
"com.arsdigita.cms.contenttypes.publications.organization_bundle_type", "com.arsdigita.cms.contenttypes.publications.organization_bundle_type",
Parameter.OPTIONAL, Parameter.OPTIONAL,
PublisherBundle.BASE_DATA_OBJECT_TYPE); PublisherBundle.BASE_DATA_OBJECT_TYPE);
enableFirstPublishedProperty = new BooleanParameter( enableFirstPublishedProperty = new BooleanParameter(
"com.arsdigita.cms.contenttypes.publications.enable_first_published_property", "com.arsdigita.cms.contenttypes.publications.enable_first_published_property",
Parameter.REQUIRED, Parameter.REQUIRED,
true); true);
enableLanguageProperty = new BooleanParameter( enableLanguageProperty = new BooleanParameter(
"com.arsdigita.cms.contenttypes.publications.enable_language_property", "com.arsdigita.cms.contenttypes.publications.enable_language_property",
Parameter.REQUIRED, Parameter.REQUIRED,
true); true);
enableAbstractHTML = new BooleanParameter(
"com.arsdigita.cms.contenttypes.publications.enable_abstract_html",
Parameter.REQUIRED,
false);
enableMiscHTML = new BooleanParameter(
"com.arsdigita.cms.contenttypes.publications.enable_misc_html",
Parameter.REQUIRED,
false);
register(attachOrgaUnitsStep); register(attachOrgaUnitsStep);
register(orgaUnitsStepSortKey); register(orgaUnitsStepSortKey);
@ -307,6 +309,8 @@ public class PublicationsConfig extends AbstractConfig {
register(orgaBundleType); register(orgaBundleType);
register(enableFirstPublishedProperty); register(enableFirstPublishedProperty);
register(enableLanguageProperty); register(enableLanguageProperty);
register(enableAbstractHTML);
register(enableMiscHTML);
loadInfo(); loadInfo();
} }
@ -328,7 +332,8 @@ public class PublicationsConfig extends AbstractConfig {
* default folder has been set. * default folder has been set.
* *
* @param folderPath Path of the default folder. * @param folderPath Path of the default folder.
* @param folderId ID of the default folder. * @param folderId ID of the default folder.
*
* @return * @return
*/ */
private Folder getDefaultFolder(final String folderPath, final Integer folderId) { private Folder getDefaultFolder(final String folderPath, final Integer folderId) {
@ -400,7 +405,7 @@ public class PublicationsConfig extends AbstractConfig {
/** /**
* *
* @return @deprecated Use {@link #getDefaultAuthorsFolderPath()} or * @return @deprecated Use {@link #getDefaultAuthorsFolderPath()} or
* {@link #getDefaultAuthorsFolder()} instead. * {@link #getDefaultAuthorsFolder()} instead.
*/ */
@Deprecated @Deprecated
public Integer getDefaultAuthorsFolderID() { public Integer getDefaultAuthorsFolderID() {
@ -435,7 +440,8 @@ public class PublicationsConfig extends AbstractConfig {
* the next releases. Instead the path property should be used. * the next releases. Instead the path property should be used.
* *
* @return {@code null} if {@link #getDefaultAuthorsFolderPath()} and * @return {@code null} if {@link #getDefaultAuthorsFolderPath()} and
* {@link #getDefaultAuthorsFolderID()} both are not set, otherwise a {@link Folder} object. * {@link #getDefaultAuthorsFolderID()} both are not set, otherwise a {@link Folder}
* object.
*/ */
public Folder getDefaultAuthorsFolder() { public Folder getDefaultAuthorsFolder() {
return getDefaultFolder(getDefaultAuthorsFolderPath(), getDefaultAuthorsFolderID()); return getDefaultFolder(getDefaultAuthorsFolderPath(), getDefaultAuthorsFolderID());
@ -653,8 +659,7 @@ public class PublicationsConfig extends AbstractConfig {
/** /**
* *
* @return * @return @deprecated Use {@link getDefaultInProccedingsFolder}
* @deprecated Use {@link getDefaultInProccedingsFolder}
*/ */
@Deprecated @Deprecated
public Integer getDefaultInProceedingsFolderID() { public Integer getDefaultInProceedingsFolderID() {
@ -706,8 +711,7 @@ public class PublicationsConfig extends AbstractConfig {
/** /**
* *
* @return * @return @deprecated Use {@link #getDefaultPublicationsFolder() }
* @deprecated Use {@link #getDefaultPublicationsFolder() }
*/ */
@Deprecated @Deprecated
public Integer getDefaultPublicationsFolderID() { public Integer getDefaultPublicationsFolderID() {
@ -751,4 +755,12 @@ public class PublicationsConfig extends AbstractConfig {
return (Boolean) get(enableLanguageProperty); return (Boolean) get(enableLanguageProperty);
} }
public Boolean getEnableAbstractHTML() {
return (Boolean) get(enableAbstractHTML);
}
public Boolean getEnableMiscHTML() {
return (Boolean) get(enableMiscHTML);
}
} }

View File

@ -182,3 +182,13 @@ com.arsdigita.cms.contenttypes.publications.enable_language_property.title = Ena
com.arsdigita.cms.contenttypes.publications.enable_language_property.purpose = Enable language property com.arsdigita.cms.contenttypes.publications.enable_language_property.purpose = Enable language property
com.arsdigita.cms.contenttypes.publications.enable_language_property.example = true com.arsdigita.cms.contenttypes.publications.enable_language_property.example = true
com.arsdigita.cms.contenttypes.publications.enable_language_property.format = Boolean com.arsdigita.cms.contenttypes.publications.enable_language_property.format = Boolean
com.arsdigita.cms.contenttypes.publications.enable_abstract_html.title = Enable HTML editor for the abstract
com.arsdigita.cms.contenttypes.publications.enable_abstract_html.purpose = Enables or disables the HTML editor for the abstract
com.arsdigita.cms.contenttypes.publications.enable_abstract_html.example = true
com.arsdigita.cms.contenttypes.publications.enable_abstract_html.format = Boolean
com.arsdigita.cms.contenttypes.publications.enable_misc_html.title = Enable HTML editor for the misc field
com.arsdigita.cms.contenttypes.publications.enable_misc_html.purpose = Enables or disables the HTML editor for the misc field
com.arsdigita.cms.contenttypes.publications.enable_misc_html.example = true
com.arsdigita.cms.contenttypes.publications.enable_misc_html.format = Boolean

View File

@ -76,8 +76,8 @@ public class PublicationPropertiesStep extends SimpleEditStep {
Publication.YEAR_OF_PUBLICATION); Publication.YEAR_OF_PUBLICATION);
sheet.add(PublicationGlobalizationUtil.globalize( sheet.add(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.abstract"), "publications.ui.publication.abstract"),
Publication.ABSTRACT, Publication.ABSTRACT);
new PreFormattedTextFormatter()); //new PreFormattedTextFormatter());
sheet.add(PublicationGlobalizationUtil.globalize( sheet.add(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.misc"), "publications.ui.publication.misc"),
Publication.MISC); Publication.MISC);

View File

@ -36,6 +36,8 @@ import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.contenttypes.PublicationsConfig;
import com.arsdigita.cms.ui.CMSDHTMLEditor;
import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.globalization.GlobalizationHelper; import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
@ -49,15 +51,20 @@ import org.apache.log4j.Logger;
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
public class PublicationPropertyForm public class PublicationPropertyForm
extends BasicPageForm extends BasicPageForm
implements FormProcessListener, implements FormProcessListener,
FormInitListener, FormInitListener,
FormSubmissionListener { FormSubmissionListener {
private static final Logger s_log = Logger.getLogger( private static final Logger s_log = Logger.getLogger(
PublicationPropertyForm.class); PublicationPropertyForm.class);
private PublicationPropertiesStep m_step; private PublicationPropertiesStep m_step;
public static final String ID = "Publication_edit"; public static final String ID = "Publication_edit";
private final static PublicationsConfig config = new PublicationsConfig();
static {
config.load();
}
public PublicationPropertyForm(ItemSelectionModel itemModel) { public PublicationPropertyForm(ItemSelectionModel itemModel) {
this(itemModel, null); this(itemModel, null);
@ -75,20 +82,22 @@ public class PublicationPropertyForm
super.addWidgets(); super.addWidgets();
add(new Label(PublicationGlobalizationUtil.globalize( add(new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.year_of_publication"))); "publications.ui.publication.year_of_publication")));
final ParameterModel yearOfPublicationParam = new IntegerParameter(Publication.YEAR_OF_PUBLICATION); final ParameterModel yearOfPublicationParam = new IntegerParameter(
Publication.YEAR_OF_PUBLICATION);
final TextField yearOfPublication = new TextField(yearOfPublicationParam); final TextField yearOfPublication = new TextField(yearOfPublicationParam);
yearOfPublication.setMaxLength(4); yearOfPublication.setMaxLength(4);
//yearOfPublication.addValidationListener(new NotNullValidationListener()); //yearOfPublication.addValidationListener(new NotNullValidationListener());
//yearOfPublication.addValidationListener(new NotEmptyValidationListener()); //yearOfPublication.addValidationListener(new NotEmptyValidationListener());
add(yearOfPublication); add(yearOfPublication);
add(new Label(PublicationGlobalizationUtil.globalize("publications.ui.publication.first_published"))); add(new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.first_published")));
final ParameterModel firstPublishedParam = new IntegerParameter(Publication.FIRST_PUBLISHED); final ParameterModel firstPublishedParam = new IntegerParameter(Publication.FIRST_PUBLISHED);
final TextField firstPublished = new TextField(firstPublishedParam); final TextField firstPublished = new TextField(firstPublishedParam);
add(firstPublished); add(firstPublished);
add(new Label( PublicationGlobalizationUtil.globalize("publications.ui.publication.language"))); add(new Label(PublicationGlobalizationUtil.globalize("publications.ui.publication.language")));
final ParameterModel langParam = new StringParameter(Publication.LANG); final ParameterModel langParam = new StringParameter(Publication.LANG);
//final TextField lang = new TextField(langParam); //final TextField lang = new TextField(langParam);
final SingleSelect lang = new SingleSelect(langParam); final SingleSelect lang = new SingleSelect(langParam);
@ -101,7 +110,7 @@ public class PublicationPropertyForm
} }
}); });
for(Locale locale : locales) { for (Locale locale : locales) {
final Locale currentLocale = locale; final Locale currentLocale = locale;
final Label optionLabel = new Label(new PrintListener() { final Label optionLabel = new Label(new PrintListener() {
@ -109,25 +118,37 @@ public class PublicationPropertyForm
@Override @Override
public void prepare(final PrintEvent event) { public void prepare(final PrintEvent event) {
final Label target = (Label) event.getTarget(); final Label target = (Label) event.getTarget();
target.setLabel(currentLocale.getDisplayName(GlobalizationHelper.getNegotiatedLocale())); target.setLabel(currentLocale.getDisplayName(GlobalizationHelper.
getNegotiatedLocale()));
} }
}); });
lang.addOption(new Option(locale.toString(), optionLabel)); lang.addOption(new Option(locale.toString(), optionLabel));
} }
add(lang); add(lang);
add(new Label((String) PublicationGlobalizationUtil.globalize( add(new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.abstract").localize())); "publications.ui.publication.abstract")));
ParameterModel abstractParam = new StringParameter(Publication.ABSTRACT); ParameterModel abstractParam = new StringParameter(Publication.ABSTRACT);
TextArea abstractArea = new TextArea(abstractParam); TextArea abstractArea;
if (config.getEnableAbstractHTML()) {
abstractArea = new CMSDHTMLEditor(abstractParam);
} else {
abstractArea = new TextArea(abstractParam);
}
abstractArea.setCols(60); abstractArea.setCols(60);
abstractArea.setRows(18); abstractArea.setRows(18);
add(abstractArea); add(abstractArea);
add(new Label((String) PublicationGlobalizationUtil.globalize( add(new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.misc").localize())); "publications.ui.publication.misc")));
ParameterModel miscParam = new StringParameter(Publication.MISC); ParameterModel miscParam = new StringParameter(Publication.MISC);
TextArea misc = new TextArea(miscParam); TextArea misc;
if (config.getEnableMiscHTML()) {
misc = new CMSDHTMLEditor(miscParam);
} else {
misc = new TextArea(miscParam);
}
misc.setCols(60); misc.setCols(60);
misc.setRows(18); misc.setRows(18);
add(misc); add(misc);
@ -152,7 +173,7 @@ public class PublicationPropertyForm
Publication publication = (Publication) super.processBasicWidgets(fse); Publication publication = (Publication) super.processBasicWidgets(fse);
if ((publication != null) && getSaveCancelSection().getSaveButton(). if ((publication != null) && getSaveCancelSection().getSaveButton().
isSelected(fse.getPageState())) { isSelected(fse.getPageState())) {
//publication.setTitle((String) data.get(Publication.TITLE)); //publication.setTitle((String) data.get(Publication.TITLE));
publication.setYearOfPublication((Integer) data.get(Publication.YEAR_OF_PUBLICATION)); publication.setYearOfPublication((Integer) data.get(Publication.YEAR_OF_PUBLICATION));
publication.setYearFirstPublished((Integer) data.get(Publication.FIRST_PUBLISHED)); publication.setYearFirstPublished((Integer) data.get(Publication.FIRST_PUBLISHED));
@ -167,7 +188,7 @@ public class PublicationPropertyForm
@Override @Override
public void submitted(FormSectionEvent fse) throws FormProcessException { public void submitted(FormSectionEvent fse) throws FormProcessException {
if ((m_step != null) && getSaveCancelSection().getCancelButton(). if ((m_step != null) && getSaveCancelSection().getCancelButton().
isSelected(fse.getPageState())) { isSelected(fse.getPageState())) {
m_step.cancelStreamlinedCreation(fse.getPageState()); m_step.cancelStreamlinedCreation(fse.getPageState());
} }
} }