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;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.RequestLocal;
@ -34,14 +33,12 @@ import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObject;
import com.arsdigita.util.Assert;
/**
* Displays the current text body of the article and allows the user
* to edit it, by uploading a file or entering text in a textbox.
* Displays the current text body of the article and allows the user to edit it, by uploading a file
* or entering text in a textbox.
*
* The {@link com.arsdigita.bebop.PropertySheet} class is often used
* as the display component in the default authoring kit steps of
* this class.
* The {@link com.arsdigita.bebop.PropertySheet} class is often used as the display component in the
* default authoring kit steps of this class.
*
* @author Stanislav Freidin (sfreidin@arsdigita.com)
* @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
*
* @param itemModel The {@link ItemSelectionModel} which will
* be responsible for loading the current item
* @param itemModel The {@link ItemSelectionModel} which will be responsible for loading the
* current item
*
* @param parent The parent wizard which contains the form. The form
* may use the wizard's methods, such as stepForward and stepBack,
* in its process listener.
* @param parent The parent wizard which contains the form. The form may use the wizard's
* methods, such as stepForward and stepBack, in its process listener.
*/
public GenericArticleBody(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
super(new ItemAssetModel(itemModel));
@ -69,17 +65,18 @@ public class GenericArticleBody extends TextAssetBody {
// Rest the component when it is hidden
parent.getList().addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PageState state = e.getPageState();
reset(state);
}
});
public void actionPerformed(ActionEvent e) {
PageState state = e.getPageState();
reset(state);
}
});
// Set the right component access on the forms
Component f = getComponent(FILE_UPLOAD);
if (f != null) {
setComponentAccess(FILE_UPLOAD,
new WorkflowLockedComponentAccess(f, itemModel));
setComponentAccess(FILE_UPLOAD,
new WorkflowLockedComponentAccess(f, itemModel));
}
Component t = getComponent(TEXT_ENTRY);
setComponentAccess(TEXT_ENTRY,
@ -87,9 +84,10 @@ public class GenericArticleBody extends TextAssetBody {
}
/**
* Adds the options for the mime type select widget of
* <code>GenericArticleForm</code> and sets the default mime type.
**/
* Adds the options for the mime type select widget of <code>GenericArticleForm</code> and sets
* the default mime type.
*
*/
@Override
protected void setMimeTypeOptions(SingleSelect mimeSelect) {
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
*
* @param s the current page state
*
* @return a valid TextAsset
*/
protected TextAsset createTextAsset(PageState s) {
@ -109,7 +108,7 @@ public class GenericArticleBody extends TextAssetBody {
final int idLen = item.getID().toString().length();
final int len = nameLen + 6 + idLen;
if (len < 200) {
t.setName(item.getName() + "_text_" + item.getID());
t.setName(item.getName() + "_text_" + item.getID());
} else {
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
* parent ID, after the asset has been successfully uploaded
* Set additional parameters of a brand new text asset, such as the parent ID, after the asset
* has been successfully uploaded
*
* @param s the current page state
* @param a the new <code>TextAsset</code>
@ -131,7 +130,7 @@ public class GenericArticleBody extends TextAssetBody {
Assert.exists(t);
// no need - cg. Text doesn't need a security context,
// and ownership of text is recorded in text_pages
// a.setParent(t);
t.setTextAsset(a);
a.save();
@ -142,12 +141,11 @@ public class GenericArticleBody extends TextAssetBody {
* Get the current GenericArticle
*/
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
* the text page
* An ACSObjectSelectionModel that selects the current text asset for the text page
*/
private static class ItemAssetModel extends ItemSelectionModel {
@ -158,25 +156,26 @@ public class GenericArticleBody extends TextAssetBody {
m_asset = new RequestLocal() {
@Override
protected Object initialValue(PageState s) {
GenericArticle t = (GenericArticle)
((ItemSelectionModel)getSingleSelectionModel())
.getSelectedObject(s);
Assert.exists(t);
return t.getTextAsset();
}
};
protected Object initialValue(PageState s) {
GenericArticle t
= (GenericArticle) ((ItemSelectionModel) getSingleSelectionModel()).
getSelectedObject(s);
Assert.exists(t);
return t.getTextAsset();
}
};
}
@Override
public Object getSelectedKey(PageState s) {
TextAsset a = (TextAsset)getSelectedObject(s);
TextAsset a = (TextAsset) getSelectedObject(s);
return (a == null) ? null : a.getID();
}
@Override
public DomainObject getSelectedObject(PageState s) {
return (DomainObject)m_asset.get(s);
return (DomainObject) m_asset.get(s);
}
@Override
@ -186,13 +185,15 @@ public class GenericArticleBody extends TextAssetBody {
@Override
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
public boolean isSelected(PageState s) {
return (getSelectedObject(s) != null);
}
}
}

View File

@ -34,6 +34,8 @@
storage="ccm-core/templating.properties"/>
<config class="com.arsdigita.ui.UIConfig"
storage="ccm-core/ui.properties"/>
<config class="com.arsdigita.util.SystemInformation"
storage="ccm-core/systeminformation.properties"/>
<config class="com.arsdigita.versioning.VersioningConfig"
storage="ccm-core/versioning.properties"/>
<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
loadSystemInformation();
// loadSystemInformation();
// register the document converters
Converter converter = new PDFConverter();
@ -229,14 +229,14 @@ public class Initializer extends CompoundInitializer {
s_log.info("Core init(DomainInitEvent) done");
}
private void loadSystemInformation() {
SystemInformation sysInfo = SystemInformation.getInstance();
// Hardcoded for now
sysInfo.put("version", "v2.1.0");
sysInfo.put("appname", "ScientificCMS");
sysInfo.put("apphomepage", "http://www.scientificcms.org");
sysInfo.lock();
}
// private void loadSystemInformation() {
// SystemInformation sysInfo = SystemInformation.getInstance();
//
// // Hardcoded for now
// sysInfo.put("version", "v2.3.x-SNAPSHOT");
// sysInfo.put("appname", "ScientificCMS");
// sysInfo.put("apphomepage", "http://www.scientificcms.org");
// sysInfo.lock();
// }
}

View File

@ -2,35 +2,43 @@ waf.debug.title=Global debug flag
waf.debug.purpose=Enables or disables WAF debugging
waf.debug.example=true
waf.debug.format=true|false
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.example=true
waf.kernel.data_permission_check_enabled.format=true|false
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.example=email
waf.kernel.primary_user_identifier.format=email|screen_name
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.example=true
waf.kernel.remember_login.format=true|false
waf.kernel.secure_login.title=Require secure login
waf.kernel.secure_login.purpose=Accept only credentials presented over secure connection
waf.kernel.secure_login.example=true
waf.kernel.secure_login.format=true|false
waf.kernel.sso_login.title=Enable SSO login
waf.kernel.sso_login.purpose=Enable alternative "RegisterSSO" login context.
waf.kernel.sso_login.example=false
waf.kernel.sso_login.format=true|false
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.example=en,de,fr,nl,it,pt,es
waf.kernel.supported_languages.format=[string]
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.example=false
waf.kernel.language_independent_items.format=true|false
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.example=--
waf.kernel.language_independent_code.format=[string]
waf.kernel.language_independent_code.format=[string]

View File

@ -4,63 +4,84 @@
*/
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.Iterator;
import java.util.Map;
import java.util.Set;
/**
*
* @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 boolean locked = false;
private Parameter sysInfoParam = new StringParameter(
"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
*/
private static final SystemInformation INSTANCE = new SystemInformation();
private static SystemInformation INSTANCE;// = new SystemInformation();
private SystemInformation() {
// Nothing
public SystemInformation() {
register(sysInfoParam);
loadInfo();
}
/**
* @return The instance of this class.
*/
public static SystemInformation getInstance() {
return SystemInformation.INSTANCE;
}
/**
* 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(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);
if (INSTANCE == null) {
INSTANCE = new SystemInformation();
INSTANCE.load();
}
return INSTANCE;
}
// /**
// * 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.
*
*
* @param key Key for the map
*
* @return value for key
*
* @throws IllegalArgumentException if key is null or empty
*/
final public String get(String key) throws IllegalArgumentException {
if (systemInformation == null) {
loadMap();
}
if (key == null || key.isEmpty()) {
throw new IllegalArgumentException("Parameter key must not be null or empty.");
}
@ -69,32 +90,59 @@ public class SystemInformation implements Lockable {
/**
* Get iterator of this map.
*
*
* @return iterator of map
*/
final public Iterator<Map.Entry<String, String>> iterator() {
return ((Set<Map.Entry<String, String>>) systemInformation.entrySet()).iterator();
}
/**
*
* @return
*/
final public boolean isEmpty() {
return systemInformation.isEmpty();
}
/**
* Lock this instance to prevent further changes.
*/
final public void lock() {
locked = true;
if (systemInformation == null) {
loadMap();
}
return (systemInformation.entrySet()).iterator();
}
/**
* Test, if this instance is locked.
* @return locked
*
* @return
*/
final public boolean isLocked() {
return locked;
final public boolean isEmpty() {
if (systemInformation == null) {
loadMap();
}
return systemInformation.isEmpty();
}
/**
* Lock this instance to prevent further changes.
*/
// final public void lock() {
// 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"
name="ccm-sci-publications"
prettyName="OpenCCM Content Types"
version="6.6.6"
version="6.6.7"
release="1"
webapp="ROOT">
<ccm:dependencies>

View File

@ -26,8 +26,8 @@ import com.arsdigita.cms.ContentBundle;
object type Publication extends ContentPage {
Integer[0..1] yearOfPublication = ct_publications.year INTEGER;
String[0..1] abstract = ct_publications.abstract VARCHAR(4096);
String[0..1] misc = ct_publications.misc VARCHAR(4096);
String[0..1] abstract = ct_publications.abstract CLOB;
String[0..1] misc = ct_publications.misc CLOB;
//The reviewed property has been moved here for performance reasons. It
//is necessary to have access to this property from a data query
//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">
<script class="com.arsdigita.cms.contenttypes.upgrades.SciPublicationsUpgrade665to666"/>
</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>

View File

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

View File

@ -181,4 +181,14 @@ com.arsdigita.cms.contenttypes.publications.enable_first_published_property.form
com.arsdigita.cms.contenttypes.publications.enable_language_property.title = 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.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);
sheet.add(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.abstract"),
Publication.ABSTRACT,
new PreFormattedTextFormatter());
Publication.ABSTRACT);
//new PreFormattedTextFormatter());
sheet.add(PublicationGlobalizationUtil.globalize(
"publications.ui.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.cms.ItemSelectionModel;
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.globalization.GlobalizationHelper;
import com.arsdigita.globalization.GlobalizedMessage;
@ -49,15 +51,20 @@ import org.apache.log4j.Logger;
* @author Jens Pelzetter
*/
public class PublicationPropertyForm
extends BasicPageForm
implements FormProcessListener,
FormInitListener,
FormSubmissionListener {
extends BasicPageForm
implements FormProcessListener,
FormInitListener,
FormSubmissionListener {
private static final Logger s_log = Logger.getLogger(
PublicationPropertyForm.class);
PublicationPropertyForm.class);
private PublicationPropertiesStep m_step;
public static final String ID = "Publication_edit";
private final static PublicationsConfig config = new PublicationsConfig();
static {
config.load();
}
public PublicationPropertyForm(ItemSelectionModel itemModel) {
this(itemModel, null);
@ -75,20 +82,22 @@ public class PublicationPropertyForm
super.addWidgets();
add(new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.publication.year_of_publication")));
final ParameterModel yearOfPublicationParam = new IntegerParameter(Publication.YEAR_OF_PUBLICATION);
"publications.ui.publication.year_of_publication")));
final ParameterModel yearOfPublicationParam = new IntegerParameter(
Publication.YEAR_OF_PUBLICATION);
final TextField yearOfPublication = new TextField(yearOfPublicationParam);
yearOfPublication.setMaxLength(4);
//yearOfPublication.addValidationListener(new NotNullValidationListener());
//yearOfPublication.addValidationListener(new NotEmptyValidationListener());
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 TextField firstPublished = new TextField(firstPublishedParam);
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 TextField lang = new TextField(langParam);
final SingleSelect lang = new SingleSelect(langParam);
@ -99,35 +108,47 @@ public class PublicationPropertyForm
public int compare(final Locale locale1, final Locale locale2) {
return locale1.getDisplayName().compareTo(locale2.getDisplayName());
}
});
for(Locale locale : locales) {
for (Locale locale : locales) {
final Locale currentLocale = locale;
final Label optionLabel = new Label(new PrintListener() {
@Override
public void prepare(final PrintEvent event) {
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));
}
add(lang);
add(new Label((String) PublicationGlobalizationUtil.globalize(
"publications.ui.publication.abstract").localize()));
add(new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.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.setRows(18);
add(abstractArea);
add(new Label((String) PublicationGlobalizationUtil.globalize(
"publications.ui.publication.misc").localize()));
add(new Label(PublicationGlobalizationUtil.globalize(
"publications.ui.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.setRows(18);
add(misc);
@ -152,7 +173,7 @@ public class PublicationPropertyForm
Publication publication = (Publication) super.processBasicWidgets(fse);
if ((publication != null) && getSaveCancelSection().getSaveButton().
isSelected(fse.getPageState())) {
isSelected(fse.getPageState())) {
//publication.setTitle((String) data.get(Publication.TITLE));
publication.setYearOfPublication((Integer) data.get(Publication.YEAR_OF_PUBLICATION));
publication.setYearFirstPublished((Integer) data.get(Publication.FIRST_PUBLISHED));
@ -167,7 +188,7 @@ public class PublicationPropertyForm
@Override
public void submitted(FormSectionEvent fse) throws FormProcessException {
if ((m_step != null) && getSaveCancelSection().getCancelButton().
isSelected(fse.getPageState())) {
isSelected(fse.getPageState())) {
m_step.cancelStreamlinedCreation(fse.getPageState());
}
}