Kleinere Korrekturen und Ergänzungen:
- Im Title eines Personen Items wird ein Zusatz zum Namen, z.B. PhD jetzt mit einem Komma abgetrennt - Fehlende TraversalAdapter hinzugefügt - Kleinere Korrekturen - Erster Teil für eine Erweiterung der GUI von SciMember, Ziel der Erweiterung ist die Möglichkeit ein SciMember direkt bestehenden Organisationen (SciOrganization), Abteilungen (SciDepartment) und Projekten (SciProject) zuweisen zu können. Die Arbeiten hierfür sind nicht *nicht* abgeschlossen. git-svn-id: https://svn.libreccm.org/ccm/trunk@838 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c175af4662
commit
6f6e2bcc65
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xrd:adapters
|
||||||
|
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||||
|
|
||||||
|
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||||
|
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Member"
|
||||||
|
extends="com.arsdigita.cms.ContentPage">
|
||||||
|
|
||||||
|
<xrd:attributes rule="exclude">
|
||||||
|
<xrd:property name="/object/birthdate"/>
|
||||||
|
<xrd:property name="/object/gender"/>
|
||||||
|
</xrd:attributes>
|
||||||
|
|
||||||
|
<xrd:associations rule="include">
|
||||||
|
<xrd:property name="/object/contacts"/>
|
||||||
|
<xrd:property name="/object/contacts/contactentries"/>
|
||||||
|
<xrd:property name="/object/contacts/address"/>
|
||||||
|
<xrd:property name="/object/organizationalunit"/>
|
||||||
|
</xrd:associations>
|
||||||
|
</xrd:adapter>
|
||||||
|
|
||||||
|
</xrd:context>
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -42,4 +42,9 @@ public class MemberInitializer extends ContentTypeInitializer {
|
||||||
public String[] getStylesheets() {
|
public String[] getStylesheets() {
|
||||||
return new String[]{"/static/content-types/com/arsdigita/cms/contenttypes/Member.xsl"};
|
return new String[]{"/static/content-types/com/arsdigita/cms/contenttypes/Member.xsl"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTraversalXML() {
|
||||||
|
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Member.xml";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xrd:adapters
|
||||||
|
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||||
|
|
||||||
|
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator">
|
||||||
|
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.Person"
|
||||||
|
extends="com.arsdigita.cms.ContentPage">
|
||||||
|
|
||||||
|
<xrd:attributes rule="exclude">
|
||||||
|
<xrd:property name="/object/birthdate"/>
|
||||||
|
<xrd:property name="/object/gender"/>
|
||||||
|
</xrd:attributes>
|
||||||
|
|
||||||
|
<xrd:associations rule="include">
|
||||||
|
<xrd:property name="/object/contacts"/>
|
||||||
|
<xrd:property name="/object/contacts/contactentries"/>
|
||||||
|
<xrd:property name="/object/contacts/address"/>
|
||||||
|
<xrd:property name="/object/organizationalunit"/>
|
||||||
|
</xrd:associations>
|
||||||
|
</xrd:adapter>
|
||||||
|
|
||||||
|
</xrd:context>
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -43,4 +43,9 @@ public class PersonInitializer extends ContentTypeInitializer {
|
||||||
public String[] getStylesheets() {
|
public String[] getStylesheets() {
|
||||||
return new String[]{"/static/content-types/com/arsdigita/cms/contenttypes/Person.xsl"};
|
return new String[]{"/static/content-types/com/arsdigita/cms/contenttypes/Person.xsl"};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTraversalXML() {
|
||||||
|
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Person.xml";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,8 @@ import java.util.Date;
|
||||||
* @author Sören Bernstein
|
* @author Sören Bernstein
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
*/
|
*/
|
||||||
public class GenericPerson extends ContentPage implements RelationAttributeInterface {
|
public class GenericPerson extends ContentPage implements
|
||||||
|
RelationAttributeInterface {
|
||||||
|
|
||||||
public static final String PERSON = "person";
|
public static final String PERSON = "person";
|
||||||
public static final String SURNAME = "surname";
|
public static final String SURNAME = "surname";
|
||||||
|
|
@ -48,12 +49,11 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
public static final String CONTACTS = "contacts";
|
public static final String CONTACTS = "contacts";
|
||||||
public static final String CONTACTS_KEY = "link_key";
|
public static final String CONTACTS_KEY = "link_key";
|
||||||
public static final String CONTACTS_ORDER = "link_order";
|
public static final String CONTACTS_ORDER = "link_order";
|
||||||
|
private static final String RELATION_ATTRIBUTES =
|
||||||
private static final String RELATION_ATTRIBUTES = "contacts.link_key:GenericContactType";
|
"contacts.link_key:GenericContactType";
|
||||||
|
|
||||||
/** 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.GenericPerson";
|
"com.arsdigita.cms.contenttypes.GenericPerson";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. This creates a new (empty) GenericPerson.
|
* Default constructor. This creates a new (empty) GenericPerson.
|
||||||
|
|
@ -163,7 +163,12 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
surname = "";
|
surname = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.format("%s %s %s %s", titlePre, givenName, surname, titlePost).trim();
|
if (titlePost.trim().isEmpty()) {
|
||||||
|
return String.format("%s %s %s", titlePre, givenName, surname).trim();
|
||||||
|
} else {
|
||||||
|
return String.format("%s %s %s, %s", titlePre, givenName, surname,
|
||||||
|
titlePost).trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNameAndTitle() {
|
private void updateNameAndTitle() {
|
||||||
|
|
@ -171,7 +176,8 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
String fullname = getFullName();
|
String fullname = getFullName();
|
||||||
if (fullname != null && !fullname.isEmpty()) {
|
if (fullname != null && !fullname.isEmpty()) {
|
||||||
setTitle(fullname);
|
setTitle(fullname);
|
||||||
setName(GenericPerson.urlSave(String.format("%s %s", getSurname(), getGivenName())));
|
setName(GenericPerson.urlSave(String.format("%s %s", getSurname(),
|
||||||
|
getGivenName())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -207,7 +213,8 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
if (in != null && !in.isEmpty()) {
|
if (in != null && !in.isEmpty()) {
|
||||||
|
|
||||||
// Replacement map
|
// Replacement map
|
||||||
String[][] replacements = {{"ä", "ae"}, {"Ä", "Ae"}, {"ö", "oe"}, {"Ö", "Oe"}, {"ü", "ue"}, {"Ü", "Ue"}, {"ß", "ss"}, {".", ""}};
|
String[][] replacements = {{"ä", "ae"}, {"Ä", "Ae"}, {"ö", "oe"}, {
|
||||||
|
"Ö", "Oe"}, {"ü", "ue"}, {"Ü", "Ue"}, {"ß", "ss"}, {".", ""}};
|
||||||
|
|
||||||
// Replace all spaces with dash
|
// Replace all spaces with dash
|
||||||
String out = in.replace(" ", "-");
|
String out = in.replace(" ", "-");
|
||||||
|
|
@ -233,9 +240,9 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
@Override
|
@Override
|
||||||
public boolean hasRelationAttributeProperty(String propertyName) {
|
public boolean hasRelationAttributeProperty(String propertyName) {
|
||||||
StringTokenizer strTok = new StringTokenizer(RELATION_ATTRIBUTES, ";");
|
StringTokenizer strTok = new StringTokenizer(RELATION_ATTRIBUTES, ";");
|
||||||
while(strTok.hasMoreTokens()) {
|
while (strTok.hasMoreTokens()) {
|
||||||
String token = strTok.nextToken();
|
String token = strTok.nextToken();
|
||||||
if(token.startsWith(propertyName + ".")) {
|
if (token.startsWith(propertyName + ".")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -250,10 +257,11 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
@Override
|
@Override
|
||||||
public String getRelationAttributeKeyName(String propertyName) {
|
public String getRelationAttributeKeyName(String propertyName) {
|
||||||
StringTokenizer strTok = new StringTokenizer(RELATION_ATTRIBUTES, ";");
|
StringTokenizer strTok = new StringTokenizer(RELATION_ATTRIBUTES, ";");
|
||||||
while(strTok.hasMoreTokens()) {
|
while (strTok.hasMoreTokens()) {
|
||||||
String token = strTok.nextToken();
|
String token = strTok.nextToken();
|
||||||
if(token.startsWith(propertyName + ".")) {
|
if (token.startsWith(propertyName + ".")) {
|
||||||
return token.substring(token.indexOf(".") + 1, token.indexOf(":"));
|
return token.substring(token.indexOf(".") + 1,
|
||||||
|
token.indexOf(":"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -262,9 +270,9 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
@Override
|
@Override
|
||||||
public String getRelationAttributeName(String propertyName) {
|
public String getRelationAttributeName(String propertyName) {
|
||||||
StringTokenizer strTok = new StringTokenizer(RELATION_ATTRIBUTES, ";");
|
StringTokenizer strTok = new StringTokenizer(RELATION_ATTRIBUTES, ";");
|
||||||
while(strTok.hasMoreTokens()) {
|
while (strTok.hasMoreTokens()) {
|
||||||
String token = strTok.nextToken();
|
String token = strTok.nextToken();
|
||||||
if(token.startsWith(propertyName + ".")) {
|
if (token.startsWith(propertyName + ".")) {
|
||||||
return token.substring(token.indexOf(":") + 1);
|
return token.substring(token.indexOf(":") + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -275,5 +283,4 @@ public class GenericPerson extends ContentPage implements RelationAttributeInter
|
||||||
public String getRelationAttributeKey(String propertyName) {
|
public String getRelationAttributeKey(String propertyName) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -139,8 +139,8 @@ public class GenericOrganizationalUnitPersonAddForm
|
||||||
status = selector.getSelectedPersonStatus();
|
status = selector.getSelectedPersonStatus();
|
||||||
|
|
||||||
if (person == null) {
|
if (person == null) {
|
||||||
//m_itemSearch.setVisible(state, true);
|
m_itemSearch.setVisible(state, true);
|
||||||
//selectedPersonNameLabel.setVisible(state, false);
|
selectedPersonNameLabel.setVisible(state, false);
|
||||||
} else {
|
} else {
|
||||||
data.put(ITEM_SEARCH, person);
|
data.put(ITEM_SEARCH, person);
|
||||||
data.put(GenericOrganizationalUnitPersonCollection.PERSON_ROLE,
|
data.put(GenericOrganizationalUnitPersonCollection.PERSON_ROLE,
|
||||||
|
|
@ -148,9 +148,9 @@ public class GenericOrganizationalUnitPersonAddForm
|
||||||
data.put(GenericOrganizationalUnitPersonCollection.STATUS,
|
data.put(GenericOrganizationalUnitPersonCollection.STATUS,
|
||||||
status);
|
status);
|
||||||
|
|
||||||
//m_itemSearch.setVisible(state, false);
|
m_itemSearch.setVisible(state, false);
|
||||||
//selectedPersonNameLabel.setVisible(state, true);
|
selectedPersonNameLabel.setVisible(state, true);
|
||||||
//selectedPersonNameLabel.setLabel(person.getFullName(), state);
|
selectedPersonNameLabel.setLabel(person.getFullName(), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
setVisible(state, true);
|
setVisible(state, true);
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ public class GenericPersonCreate extends PageCreate {
|
||||||
private static final String TITLEPRE = GenericPerson.TITLEPRE;
|
private static final String TITLEPRE = GenericPerson.TITLEPRE;
|
||||||
private static final String TITLEPOST = GenericPerson.TITLEPOST;
|
private static final String TITLEPOST = GenericPerson.TITLEPOST;
|
||||||
|
|
||||||
public GenericPersonCreate(final ItemSelectionModel itemModel, final CreationSelector parent) {
|
public GenericPersonCreate(final ItemSelectionModel itemModel,
|
||||||
|
final CreationSelector parent) {
|
||||||
super(itemModel, parent);
|
super(itemModel, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -47,7 +48,8 @@ public class GenericPersonCreate extends PageCreate {
|
||||||
ContentType type = getItemSelectionModel().getContentType();
|
ContentType type = getItemSelectionModel().getContentType();
|
||||||
m_workflowSection = new ApplyWorkflowFormSection(type);
|
m_workflowSection = new ApplyWorkflowFormSection(type);
|
||||||
add(m_workflowSection, ColumnPanel.INSERT);
|
add(m_workflowSection, ColumnPanel.INSERT);
|
||||||
add(new Label(GlobalizationUtil.globalize("cms.ui.authoring.content_type")));
|
add(new Label(GlobalizationUtil.globalize(
|
||||||
|
"cms.ui.authoring.content_type")));
|
||||||
add(new Label(type.getLabel()));
|
add(new Label(type.getLabel()));
|
||||||
add(new Label(GlobalizationUtil.globalize("cms.ui.language.field")));
|
add(new Label(GlobalizationUtil.globalize("cms.ui.language.field")));
|
||||||
add(new LanguageWidget(LANGUAGE));
|
add(new LanguageWidget(LANGUAGE));
|
||||||
|
|
@ -56,11 +58,14 @@ public class GenericPersonCreate extends PageCreate {
|
||||||
GenericPersonPropertyForm.mandatoryFieldWidgets(this);
|
GenericPersonPropertyForm.mandatoryFieldWidgets(this);
|
||||||
|
|
||||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||||
add(new Label(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date")));
|
add(new Label(GlobalizationUtil.globalize(
|
||||||
|
"cms.ui.authoring.page_launch_date")));
|
||||||
ParameterModel launchDateParam = new DateParameter(LAUNCH_DATE);
|
ParameterModel launchDateParam = new DateParameter(LAUNCH_DATE);
|
||||||
com.arsdigita.bebop.form.Date launchDate = new com.arsdigita.bebop.form.Date(launchDateParam);
|
com.arsdigita.bebop.form.Date launchDate = new com.arsdigita.bebop.form.Date(
|
||||||
|
launchDateParam);
|
||||||
if (ContentSection.getConfig().getRequireLaunchDate()) {
|
if (ContentSection.getConfig().getRequireLaunchDate()) {
|
||||||
launchDate.addValidationListener(new LaunchDateValidationListener());
|
launchDate.addValidationListener(
|
||||||
|
new LaunchDateValidationListener());
|
||||||
// if launch date is required, help user by suggesting today's date
|
// if launch date is required, help user by suggesting today's date
|
||||||
launchDateParam.setDefaultValue(new Date());
|
launchDateParam.setDefaultValue(new Date());
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +138,11 @@ public class GenericPersonCreate extends PageCreate {
|
||||||
surname = "";
|
surname = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.format("%s %s %s %s", titlePre, givenName, surname, titlePost).trim();
|
if (titlePost.trim().isEmpty()) {
|
||||||
|
return String.format("%s %s %s", titlePre, givenName, surname).trim();
|
||||||
|
} else {
|
||||||
|
return String.format("%s %s %s, %s", titlePre, givenName, surname,
|
||||||
|
titlePost).trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import com.arsdigita.cms.ContentPage;
|
||||||
//PDL definition for a journal
|
//PDL definition for a journal
|
||||||
object type Journal extends Publication {
|
object type Journal extends Publication {
|
||||||
|
|
||||||
|
Integer[0..1] lastYear = ct_journal.lastyear INTEGER;
|
||||||
String[0..1] issn = ct_journal.issn VARCHAR(9);
|
String[0..1] issn = ct_journal.issn VARCHAR(9);
|
||||||
|
|
||||||
reference key (ct_journal.journal_id);
|
reference key (ct_journal.journal_id);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ object type Series extends ContentPage {
|
||||||
|
|
||||||
reference key (ct_series.series_id);
|
reference key (ct_series.series_id);
|
||||||
|
|
||||||
|
String[0..1] abstract = ct_series.abstract VARCHAR(4096);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Assoication for the editship of a series
|
//Assoication for the editship of a series
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
<xrd:associations rule="include">
|
<xrd:associations rule="include">
|
||||||
<xrd:property name="/object/articles"/>
|
<xrd:property name="/object/articles"/>
|
||||||
|
<xrd:property name="/object/articles/authors"/>
|
||||||
</xrd:associations>
|
</xrd:associations>
|
||||||
|
|
||||||
</xrd:adapter>
|
</xrd:adapter>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xrd:adapters
|
||||||
|
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||||
|
|
||||||
|
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
|
||||||
|
|
||||||
|
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.GreyLiterature"
|
||||||
|
extends="com.arsdigita.cms.contenttypes.Publication">
|
||||||
|
|
||||||
|
<xrd:associations rule="include">
|
||||||
|
<xrd:property name="/object/organization"/>
|
||||||
|
</xrd:associations>
|
||||||
|
|
||||||
|
</xrd:adapter>
|
||||||
|
|
||||||
|
</xrd:context>
|
||||||
|
|
||||||
|
</xrd:adapters>
|
||||||
|
|
@ -42,7 +42,7 @@ public class ExpertiseInitializer extends ContentTypeInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTraversalXML() {
|
public String getTraversalXML() {
|
||||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Publication.xml";
|
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Expertise.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ public class GreyLiteratureInitializer extends ContentTypeInitializer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTraversalXML() {
|
public String getTraversalXML() {
|
||||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/Publication.xml";
|
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/GreyLiterature.xml";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import java.math.BigDecimal;
|
||||||
public class Journal extends Publication {
|
public class Journal extends Publication {
|
||||||
|
|
||||||
public static final String ISSN = "issn";
|
public static final String ISSN = "issn";
|
||||||
|
public static final String LAST_YEAR = "lastYear";
|
||||||
public static final String ARTICLES = "articles";
|
public static final String ARTICLES = "articles";
|
||||||
public static final String ARTICLE_ORDER = "articleOrder";
|
public static final String ARTICLE_ORDER = "articleOrder";
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
|
|
@ -66,6 +67,14 @@ public class Journal extends Publication {
|
||||||
set(ISSN, issn);
|
set(ISSN, issn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getLastYear() {
|
||||||
|
return (Integer) get(LAST_YEAR);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastYear(Integer lastYear) {
|
||||||
|
set(LAST_YEAR, lastYear);
|
||||||
|
}
|
||||||
|
|
||||||
public ArticleInJournalCollection getArticles() {
|
public ArticleInJournalCollection getArticles() {
|
||||||
return new ArticleInJournalCollection((DataCollection) get(ARTICLES));
|
return new ArticleInJournalCollection((DataCollection) get(ARTICLES));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public class Series extends ContentPage {
|
||||||
public static final String EDITOR_ORDER = "editor_order";
|
public static final String EDITOR_ORDER = "editor_order";
|
||||||
public static final String PUBLICATIONS = "publications";
|
public static final String PUBLICATIONS = "publications";
|
||||||
public static final String VOLUME_OF_SERIES = "volumeOfSeries";
|
public static final String VOLUME_OF_SERIES = "volumeOfSeries";
|
||||||
|
public static final String ABSTRACT ="abstract";
|
||||||
|
|
||||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Series";
|
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.Series";
|
||||||
|
|
||||||
|
|
@ -62,6 +63,14 @@ public class Series extends ContentPage {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAbstract() {
|
||||||
|
return (String) get(ABSTRACT);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAbstract(String abstractStr) {
|
||||||
|
set(ABSTRACT, abstractStr);
|
||||||
|
}
|
||||||
|
|
||||||
public EditshipCollection getEditors() {
|
public EditshipCollection getEditors() {
|
||||||
return new EditshipCollection((DataCollection) get(EDITORS));
|
return new EditshipCollection((DataCollection) get(EDITORS));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,16 +26,16 @@ 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.event.ParameterEvent;
|
||||||
|
import com.arsdigita.bebop.event.ParameterListener;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.DateParameter;
|
import com.arsdigita.bebop.parameters.DateParameter;
|
||||||
import com.arsdigita.bebop.parameters.IntegerParameter;
|
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterData;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ContentType;
|
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
|
||||||
import com.arsdigita.cms.contenttypes.InternetArticle;
|
import com.arsdigita.cms.contenttypes.InternetArticle;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
@ -102,6 +102,34 @@ public class InternetArticlePropertyForm
|
||||||
new StringParameter(InternetArticle.ISSN);
|
new StringParameter(InternetArticle.ISSN);
|
||||||
TextField issn = new TextField(issnParam);
|
TextField issn = new TextField(issnParam);
|
||||||
issn.setMaxLength(9);
|
issn.setMaxLength(9);
|
||||||
|
issn.addValidationListener(new ParameterListener() {
|
||||||
|
|
||||||
|
public void validate(ParameterEvent event) throws
|
||||||
|
FormProcessException {
|
||||||
|
ParameterData data = event.getParameterData();
|
||||||
|
String value = (String) data.getValue();
|
||||||
|
|
||||||
|
if(value.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = value.replace("-", "");
|
||||||
|
|
||||||
|
if (value.length() != 8) {
|
||||||
|
data.invalidate();
|
||||||
|
data.addError(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.invalid_issn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Long num = Long.parseLong(value);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
data.invalidate();
|
||||||
|
data.addError(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.invalid_issn"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
add(issn);
|
add(issn);
|
||||||
|
|
||||||
Calendar today = new GregorianCalendar();
|
Calendar today = new GregorianCalendar();
|
||||||
|
|
@ -147,7 +175,9 @@ public class InternetArticlePropertyForm
|
||||||
article.setNumberOfPages(
|
article.setNumberOfPages(
|
||||||
(Integer) data.get(InternetArticle.NUMBER_OF_PAGES));
|
(Integer) data.get(InternetArticle.NUMBER_OF_PAGES));
|
||||||
article.setEdition((String) data.get(InternetArticle.EDITION));
|
article.setEdition((String) data.get(InternetArticle.EDITION));
|
||||||
article.setISSN((String) data.get(InternetArticle.ISSN));
|
String issn = (String) data.get(InternetArticle.ISSN);
|
||||||
|
issn = issn.replace("-", "");
|
||||||
|
article.setISSN(issn);
|
||||||
article.setLastAccessed(
|
article.setLastAccessed(
|
||||||
(Date) data.get(InternetArticle.LAST_ACCESSED));
|
(Date) data.get(InternetArticle.LAST_ACCESSED));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,13 @@ public class JournalPropertiesStep extends PublicationPropertiesStep {
|
||||||
DomainObjectPropertySheet sheet = (DomainObjectPropertySheet) PublicationPropertiesStep.
|
DomainObjectPropertySheet sheet = (DomainObjectPropertySheet) PublicationPropertiesStep.
|
||||||
getPublicationPropertySheet(itemModel);
|
getPublicationPropertySheet(itemModel);
|
||||||
|
|
||||||
sheet.add(PublicationGlobalizationUtil.globalize(
|
sheet.add(PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.journal.issn"),
|
"publications.ui.journal.issn"),
|
||||||
Journal.ISSN);
|
Journal.ISSN);
|
||||||
|
|
||||||
|
sheet.add(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.journal.lastYearOfPublication"),
|
||||||
|
Journal.LAST_YEAR);
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,11 @@ 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.event.ParameterEvent;
|
||||||
|
import com.arsdigita.bebop.event.ParameterListener;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterData;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
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;
|
||||||
|
|
@ -67,7 +71,40 @@ public class JournalPropertyForm
|
||||||
"publications.ui.journal.issn").localize()));
|
"publications.ui.journal.issn").localize()));
|
||||||
ParameterModel issnParam = new StringParameter(Journal.ISSN);
|
ParameterModel issnParam = new StringParameter(Journal.ISSN);
|
||||||
TextField issn = new TextField(issnParam);
|
TextField issn = new TextField(issnParam);
|
||||||
|
issn.addValidationListener(new ParameterListener() {
|
||||||
|
|
||||||
|
public void validate(ParameterEvent event) throws
|
||||||
|
FormProcessException {
|
||||||
|
ParameterData data = event.getParameterData();
|
||||||
|
String value = (String) data.getValue();
|
||||||
|
|
||||||
|
if (value.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = value.replace("-", "");
|
||||||
|
|
||||||
|
if (value.length() != 8) {
|
||||||
|
data.invalidate();
|
||||||
|
data.addError(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.invalid_issn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Long num = Long.parseLong(value);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
data.invalidate();
|
||||||
|
data.addError(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.invalid_issn"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
add(issn);
|
add(issn);
|
||||||
|
|
||||||
|
add(new Label((String) PublicationGlobalizationUtil.globalize("publications.ui.journal.lastYearOfPublication").localize()));
|
||||||
|
ParameterModel lastYearParam = new IntegerParameter(Journal.LAST_YEAR);
|
||||||
|
TextField lastYear = new TextField(lastYearParam);
|
||||||
|
add(lastYear);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -78,6 +115,7 @@ public class JournalPropertyForm
|
||||||
Journal journal = (Journal) super.initBasicWidgets(fse);
|
Journal journal = (Journal) super.initBasicWidgets(fse);
|
||||||
|
|
||||||
data.put(Journal.ISSN, journal.getISSN());
|
data.put(Journal.ISSN, journal.getISSN());
|
||||||
|
data.put(Journal.LAST_YEAR, journal.getLastYear());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -89,9 +127,15 @@ public class JournalPropertyForm
|
||||||
|
|
||||||
if ((journal != null) && getSaveCancelSection().getSaveButton().
|
if ((journal != null) && getSaveCancelSection().getSaveButton().
|
||||||
isSelected(fse.getPageState())) {
|
isSelected(fse.getPageState())) {
|
||||||
journal.setISSN((String) data.get(Journal.ISSN));
|
|
||||||
|
|
||||||
journal.save();;
|
String issn = (String) data.get(Journal.ISSN);
|
||||||
|
issn = issn.replace("-", "");
|
||||||
|
journal.setISSN(issn);
|
||||||
|
|
||||||
|
Integer lastYear = (Integer) data.get(Journal.LAST_YEAR);
|
||||||
|
journal.setLastYear(lastYear);
|
||||||
|
|
||||||
|
journal.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ public class MonographPropertyForm
|
||||||
private static final String REVIEWED = "reviewed";
|
private static final String REVIEWED = "reviewed";
|
||||||
private MonographPropertiesStep m_step;
|
private MonographPropertiesStep m_step;
|
||||||
public static final String ID = "MonographEdit";
|
public static final String ID = "MonographEdit";
|
||||||
|
|
||||||
private CheckboxGroup reviewed;
|
private CheckboxGroup reviewed;
|
||||||
|
|
||||||
public MonographPropertyForm(ItemSelectionModel itemModel) {
|
public MonographPropertyForm(ItemSelectionModel itemModel) {
|
||||||
|
|
@ -64,11 +63,11 @@ public class MonographPropertyForm
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
/* add(new Label(PublicationGlobalizationUtil.globalize(
|
/*add(new Label(PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.monograph.reviewed")));
|
"publications.ui.monograph.reviewed")));
|
||||||
reviewed = new CheckboxGroup("reviewedGroup");
|
reviewed = new CheckboxGroup("reviewedGroup");
|
||||||
reviewed.addOption(new Option(REVIEWED, ""));
|
reviewed.addOption(new Option(REVIEWED, ""));
|
||||||
add(reviewed);*/
|
add(reviewed); */
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -78,10 +77,13 @@ public class MonographPropertyForm
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
Monograph monograph = (Monograph) super.initBasicWidgets(fse);
|
Monograph monograph = (Monograph) super.initBasicWidgets(fse);
|
||||||
|
|
||||||
if ((monograph.getReviewed() != null) && (monograph.getReviewed())) {
|
if (reviewed != null) {
|
||||||
reviewed.setValue(fse.getPageState(), new String[]{REVIEWED});
|
if ((monograph.getReviewed() != null)
|
||||||
} else {
|
&& (monograph.getReviewed())) {
|
||||||
reviewed.setValue(fse.getPageState(), null);
|
reviewed.setValue(fse.getPageState(), new String[]{REVIEWED});
|
||||||
|
} else {
|
||||||
|
reviewed.setValue(fse.getPageState(), null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,15 +96,15 @@ public class MonographPropertyForm
|
||||||
|
|
||||||
if ((monograph != null) && getSaveCancelSection().getSaveButton().
|
if ((monograph != null) && getSaveCancelSection().getSaveButton().
|
||||||
isSelected(fse.getPageState())) {
|
isSelected(fse.getPageState())) {
|
||||||
if (reviewed.getValue(fse.getPageState()) == null) {
|
if (reviewed != null) {
|
||||||
monograph.setReviewed(false);
|
if (reviewed.getValue(fse.getPageState()) == null) {
|
||||||
} else {
|
monograph.setReviewed(false);
|
||||||
monograph.setReviewed(true);
|
} else {
|
||||||
|
monograph.setReviewed(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
monograph.save();
|
monograph.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ public class PublicationPropertiesStep extends SimpleEditStep {
|
||||||
step);
|
step);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PreFormattedTextFormatter
|
protected static class PreFormattedTextFormatter
|
||||||
extends DomainService
|
extends DomainService
|
||||||
implements DomainObjectPropertySheet.AttributeFormatter {
|
implements DomainObjectPropertySheet.AttributeFormatter {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -301,4 +301,8 @@ publication.ui.internetarticle.organization.remove=Remove
|
||||||
publications.ui.monograph.reviewed=Reviewed
|
publications.ui.monograph.reviewed=Reviewed
|
||||||
publications.ui.monograph.reviewed.yes=Yes
|
publications.ui.monograph.reviewed.yes=Yes
|
||||||
publications.ui.monograph.reviewed.no=No
|
publications.ui.monograph.reviewed.no=No
|
||||||
publications.ui.internetarticle.lastAccessed=
|
publications.ui.internetarticle.lastAccessed=Date of last access
|
||||||
|
publications.ui.invalid_isbn=The ISBN entered is invalid
|
||||||
|
publications.ui.invalid_issn=The ISSN entered is invalid
|
||||||
|
publications.ui.journal.lastYearOfPublication=Last year of publication
|
||||||
|
publications.ui.series.abstract=Description
|
||||||
|
|
|
||||||
|
|
@ -301,3 +301,7 @@ publications.ui.monograph.reviewed=Begutachtet
|
||||||
publications.ui.monograph.reviewed.yes=Ja
|
publications.ui.monograph.reviewed.yes=Ja
|
||||||
publications.ui.monograph.reviewed.no=Nein
|
publications.ui.monograph.reviewed.no=Nein
|
||||||
publications.ui.internetarticle.lastAccessed=Letztes Zugriffsdatum
|
publications.ui.internetarticle.lastAccessed=Letztes Zugriffsdatum
|
||||||
|
publications.ui.invalid_isbn=Die eingegebene ISBN ist fehlerhaft.
|
||||||
|
publications.ui.invalid_issn=Die eingegebene ISSN ist fehlerhaft.
|
||||||
|
publications.ui.journal.lastYearOfPublication=Letztes Jahr der Ver\u00f6ffentlichung
|
||||||
|
publications.ui.series.abstract=Beschreibung
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,11 @@ 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.event.ParameterEvent;
|
||||||
|
import com.arsdigita.bebop.event.ParameterListener;
|
||||||
import com.arsdigita.bebop.form.TextField;
|
import com.arsdigita.bebop.form.TextField;
|
||||||
import com.arsdigita.bebop.parameters.IntegerParameter;
|
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterData;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
|
|
@ -77,6 +80,34 @@ public class PublicationWithPublisherPropertyForm
|
||||||
PublicationWithPublisher.ISBN);
|
PublicationWithPublisher.ISBN);
|
||||||
TextField isbn = new TextField(isbnParam);
|
TextField isbn = new TextField(isbnParam);
|
||||||
isbn.setMaxLength(17);
|
isbn.setMaxLength(17);
|
||||||
|
isbn.addValidationListener(new ParameterListener() {
|
||||||
|
|
||||||
|
public void validate(ParameterEvent event)
|
||||||
|
throws FormProcessException {
|
||||||
|
ParameterData data = event.getParameterData();
|
||||||
|
String value = (String) data.getValue();
|
||||||
|
|
||||||
|
if (value.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = value.replace("-", "");
|
||||||
|
|
||||||
|
if (value.length() != 13) {
|
||||||
|
data.invalidate();
|
||||||
|
data.addError(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.invalid_isbn"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Long num = Long.parseLong(value);
|
||||||
|
} catch (NumberFormatException ex) {
|
||||||
|
data.invalidate();
|
||||||
|
data.addError(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.invalid_isbn"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
add(isbn);
|
add(isbn);
|
||||||
|
|
||||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||||
|
|
@ -143,7 +174,9 @@ public class PublicationWithPublisherPropertyForm
|
||||||
|
|
||||||
if ((publication != null) && getSaveCancelSection().getSaveButton().
|
if ((publication != null) && getSaveCancelSection().getSaveButton().
|
||||||
isSelected(fse.getPageState())) {
|
isSelected(fse.getPageState())) {
|
||||||
publication.setISBN((String) data.get(PublicationWithPublisher.ISBN));
|
String isbn = (String) data.get(PublicationWithPublisher.ISBN);
|
||||||
|
isbn = isbn.replace("-", "");
|
||||||
|
publication.setISBN(isbn);
|
||||||
|
|
||||||
publication.setVolume((Integer) data.get(
|
publication.setVolume((Integer) data.get(
|
||||||
PublicationWithPublisher.VOLUME));
|
PublicationWithPublisher.VOLUME));
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,10 @@ public class SeriesPropertiesStep extends SimpleEditStep {
|
||||||
sheet.add(PublicationGlobalizationUtil.globalize(
|
sheet.add(PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.series.title"),
|
"publications.ui.series.title"),
|
||||||
Series.TITLE);
|
Series.TITLE);
|
||||||
|
sheet.add(PublicationGlobalizationUtil.globalize(
|
||||||
|
"publications.ui.series.abstract"),
|
||||||
|
Series.ABSTRACT,
|
||||||
|
new PublicationPropertiesStep.PreFormattedTextFormatter());
|
||||||
|
|
||||||
|
|
||||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,15 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
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.form.TextField;
|
||||||
|
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.contenttypes.Series;
|
import com.arsdigita.cms.contenttypes.Series;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
|
|
@ -60,11 +65,13 @@ public class SeriesPropertyForm
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
/*add(new Label((String) PublicationGlobalizationUtil.globalize(
|
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||||
"publications.ui.series.title").localize()));
|
"publications.ui.series.abstract").localize()));
|
||||||
ParameterModel titleParam = new StringParameter(Series.NAME);
|
ParameterModel abstractParam = new StringParameter(Series.ABSTRACT);
|
||||||
TextField title = new TextField(titleParam);
|
TextArea abstractArea = new TextArea(abstractParam);
|
||||||
add(title);*/
|
abstractArea.setCols(60);
|
||||||
|
abstractArea.setRows(18);
|
||||||
|
add(abstractArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -72,7 +79,7 @@ public class SeriesPropertyForm
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
Series series = (Series) super.initBasicWidgets(fse);
|
Series series = (Series) super.initBasicWidgets(fse);
|
||||||
|
|
||||||
//data.put(Series.NAME, series.getTitle());
|
data.put(Series.ABSTRACT, series.getAbstract());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -82,9 +89,9 @@ public class SeriesPropertyForm
|
||||||
|
|
||||||
if ((series != null) && getSaveCancelSection().getSaveButton().
|
if ((series != null) && getSaveCancelSection().getSaveButton().
|
||||||
isSelected(fse.getPageState())) {
|
isSelected(fse.getPageState())) {
|
||||||
/*series.setTitle((String) data.get(Series.NAME));
|
series.setAbstract((String) data.get(Series.ABSTRACT));
|
||||||
|
|
||||||
series.save();*/
|
series.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.templating.PresentationManager;
|
import com.arsdigita.templating.PresentationManager;
|
||||||
import com.arsdigita.templating.Templating;
|
import com.arsdigita.templating.Templating;
|
||||||
import com.arsdigita.web.Application;
|
import com.arsdigita.web.Application;
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,17 @@
|
||||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciMember"
|
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciMember"
|
||||||
extends="com.arsdigita.cms.ContentPage">
|
extends="com.arsdigita.cms.ContentPage">
|
||||||
|
|
||||||
<xrd:associations rule="include">
|
<xrd:attributes rule="exclude">
|
||||||
<xrd:property name="/object/contacts"/>
|
<xrd:property name="/object/birthdate"/>
|
||||||
<xrd:property name="/object/contacts/contactentries"/>
|
<xrd:property name="/object/gender"/>
|
||||||
<xrd:property name="/object/contacts/address"/>
|
</xrd:attributes>
|
||||||
<xrd:property name="/object/organizationalunit"/>
|
|
||||||
</xrd:associations>
|
<xrd:associations rule="include">
|
||||||
|
<xrd:property name="/object/contacts"/>
|
||||||
|
<xrd:property name="/object/contacts/contactentries"/>
|
||||||
|
<xrd:property name="/object/contacts/address"/>
|
||||||
|
<xrd:property name="/object/organizationalunit"/>
|
||||||
|
</xrd:associations>
|
||||||
|
|
||||||
</xrd:adapter>
|
</xrd:adapter>
|
||||||
</xrd:context>
|
</xrd:context>
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,10 @@
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
import com.arsdigita.persistence.DataObject;
|
import com.arsdigita.persistence.DataObject;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
|
import com.arsdigita.util.Assert;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -37,6 +39,9 @@ public class SciMember extends GenericPerson {
|
||||||
private static final Logger logger = Logger.getLogger(SciMember.class);
|
private static final Logger logger = Logger.getLogger(SciMember.class);
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.contenttypes.SciMember";
|
"com.arsdigita.cms.contenttypes.SciMember";
|
||||||
|
private static final String ORGANIZATIONS = "organizationalunit";
|
||||||
|
private static final String DEPARTMENTS = "organizationalunit";
|
||||||
|
private static final String PROJECTS = "organizationalunit";
|
||||||
private static final SciOrganizationConfig s_config =
|
private static final SciOrganizationConfig s_config =
|
||||||
new SciOrganizationConfig();
|
new SciOrganizationConfig();
|
||||||
|
|
||||||
|
|
@ -66,6 +71,23 @@ public class SciMember extends GenericPerson {
|
||||||
super(type);
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SciMemberSciOrganizationsCollection getOrganizations() {
|
||||||
|
return new SciMemberSciOrganizationsCollection((DataCollection) get(
|
||||||
|
ORGANIZATIONS));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOrganization(SciOrganization organization) {
|
||||||
|
Assert.exists(organization, SciOrganization.class);
|
||||||
|
|
||||||
|
add(ORGANIZATIONS, organization);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeOrganization(SciOrganization organization) {
|
||||||
|
Assert.exists(organization, SciOrganization.class);
|
||||||
|
|
||||||
|
remove(ORGANIZATIONS, organization);
|
||||||
|
}
|
||||||
|
|
||||||
public static SciOrganizationConfig getConfig() {
|
public static SciOrganizationConfig getConfig() {
|
||||||
return s_config;
|
return s_config;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Jens Pelzetter,
|
||||||
|
* for the Center of Social Politics of the University of Bremen
|
||||||
|
*
|
||||||
|
* 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.cms.ContentType;
|
||||||
|
import com.arsdigita.domain.DomainCollection;
|
||||||
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
import com.arsdigita.persistence.DataObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SciMemberSciOrganizationsCollection extends DomainCollection {
|
||||||
|
|
||||||
|
public static final String LINK_MEMBER_ROLE = "link.role_name";
|
||||||
|
public static final String LINK_STATUS = "link.status";
|
||||||
|
public static final String MEMBER_ROLE = "role_name";
|
||||||
|
public static final String STATUS = "status";
|
||||||
|
|
||||||
|
public SciMemberSciOrganizationsCollection(DataCollection dataCollection) {
|
||||||
|
super(dataCollection);
|
||||||
|
|
||||||
|
m_dataCollection.addFilter(String.format("type = %s",
|
||||||
|
ContentType.
|
||||||
|
findByAssociatedObjectType(SciOrganization.class.getName()).
|
||||||
|
getID().toString()));
|
||||||
|
|
||||||
|
m_dataCollection.addOrder("title");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return (String) m_dataCollection.get(LINK_MEMBER_ROLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
DataObject link = (DataObject) this.get("link");
|
||||||
|
|
||||||
|
link.set(MEMBER_ROLE, roleName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return (String) m_dataCollection.get(LINK_STATUS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
DataObject link = (DataObject) this.get("link");
|
||||||
|
|
||||||
|
link.set(STATUS, status);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciOrganization getOrganization() {
|
||||||
|
return (SciOrganization) DomainObjectFactory.newInstance(m_dataCollection.
|
||||||
|
getDataObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -53,7 +53,7 @@ public class SciDepartmentMemberStep
|
||||||
|
|
||||||
BasicItemForm addMemberSheet =
|
BasicItemForm addMemberSheet =
|
||||||
new SciDepartmentMemberAddForm(itemModel,
|
new SciDepartmentMemberAddForm(itemModel,
|
||||||
this);
|
this);
|
||||||
add(ADD_MEMBER_SHEET_NAME,
|
add(ADD_MEMBER_SHEET_NAME,
|
||||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||||
"sciorganization.ui.department.add_member").localize(),
|
"sciorganization.ui.department.add_member").localize(),
|
||||||
|
|
@ -71,15 +71,15 @@ public class SciDepartmentMemberStep
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedPerson(final GenericPerson selectedPerson) {
|
public void setSelectedPerson(final GenericPerson selectedPerson) {
|
||||||
this.selectedPerson = selectedPerson;
|
this.selectedPerson = selectedPerson;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectedPersonRole() {
|
public String getSelectedPersonRole() {
|
||||||
return selectedPersonRole;
|
return selectedPersonRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelectedPersonRole(final String selectedPersonRole) {
|
public void setSelectedPersonRole(final String selectedPersonRole) {
|
||||||
this.selectedPersonRole = selectedPersonRole;
|
this.selectedPersonRole = selectedPersonRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectedPersonStatus() {
|
public String getSelectedPersonStatus() {
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.SegmentedPanel;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
import com.arsdigita.cms.contenttypes.SciMember;
|
import com.arsdigita.cms.contenttypes.SciMember;
|
||||||
|
|
@ -39,21 +41,41 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
public class SciMemberPropertiesStep extends SimpleEditStep {
|
public class SciMemberPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
public static final String EDIT_SHEET_NAME = "edit";
|
public static final String EDIT_SHEET_NAME = "edit";
|
||||||
|
private SegmentedPanel segmentedPanel;
|
||||||
|
|
||||||
public SciMemberPropertiesStep(ItemSelectionModel itemModel,
|
public SciMemberPropertiesStep(ItemSelectionModel itemModel,
|
||||||
AuthoringKitWizard parent) {
|
AuthoringKitWizard parent) {
|
||||||
super(itemModel, parent);
|
super(itemModel, parent);
|
||||||
|
|
||||||
|
segmentedPanel = new SegmentedPanel();
|
||||||
|
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||||
|
|
||||||
|
SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
|
||||||
|
parent,
|
||||||
|
EDIT_SHEET_NAME);
|
||||||
|
|
||||||
BasicPageForm editSheet;
|
BasicPageForm editSheet;
|
||||||
editSheet = new SciMemberPropertyForm(itemModel, this);
|
editSheet = new SciMemberPropertyForm(itemModel, this);
|
||||||
add(EDIT_SHEET_NAME,
|
basicProperties.add(EDIT_SHEET_NAME,
|
||||||
(String) SciOrganizationGlobalizationUtil.globalize(
|
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||||
"sciorganization.ui.member.edit_basic_properties").localize(),
|
"sciorganization.ui.member.edit_basic_properties").localize(),
|
||||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
new WorkflowLockedComponentAccess(editSheet,
|
||||||
editSheet.getSaveCancelSection().getCancelButton());
|
itemModel),
|
||||||
|
editSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
setDisplayComponent(getSciMemberPropertySheet(itemModel));
|
basicProperties.setDisplayComponent(getSciMemberPropertySheet(itemModel));
|
||||||
|
|
||||||
|
segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
|
||||||
|
globalize("scimember.ui.basic_properties").localize()),
|
||||||
|
basicProperties);
|
||||||
|
|
||||||
|
segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
|
||||||
|
globalize("scimember.ui.organizations").localize()),
|
||||||
|
new SciMemberSciOrganizationsStep(itemModel,
|
||||||
|
parent));
|
||||||
|
|
||||||
|
|
||||||
|
setDisplayComponent(segmentedPanel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getSciMemberPropertySheet(
|
public static Component getSciMemberPropertySheet(
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.FormData;
|
||||||
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
import com.arsdigita.cms.ContentType;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciMember;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||||
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciMemberSciOrganizationAddForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
private ItemSearchWidget itemSearch;
|
||||||
|
private final String ITEM_SEARCH = "sciMemberOrganization";
|
||||||
|
|
||||||
|
public SciMemberSciOrganizationAddForm(ItemSelectionModel itemModel) {
|
||||||
|
super("sciMemberOrganizationAddForm", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addWidgets() {
|
||||||
|
add(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organization.select_organization")));
|
||||||
|
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
|
||||||
|
findByAssociatedObjectType(SciOrganization.class.getName()));
|
||||||
|
add(itemSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
|
||||||
|
state);
|
||||||
|
|
||||||
|
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
member.addOrganization((SciOrganization) data.get(ITEM_SEARCH));
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciMemberSciOrganizationsStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String MEMBER_ADD_ORGANIZATION_SHEET_NAME = "memberAddOrganization";
|
||||||
|
private SciOrganization selectedOrganization;
|
||||||
|
private String selectedOrganizationRole;
|
||||||
|
private String selectedOrganizationStatus;
|
||||||
|
|
||||||
|
public SciMemberSciOrganizationsStep(ItemSelectionModel itemModel,
|
||||||
|
AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SciMemberSciOrganizationsStep(ItemSelectionModel itemModel,
|
||||||
|
AuthoringKitWizard parent,
|
||||||
|
String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
BasicItemForm addOrganizationForm = new SciMemberSciOrganizationAddForm(
|
||||||
|
itemModel);
|
||||||
|
add(MEMBER_ADD_ORGANIZATION_SHEET_NAME,
|
||||||
|
(String) SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organization.add").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(addOrganizationForm, itemModel),
|
||||||
|
addOrganizationForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
setDisplayComponent(new SciMemberSciOrganizationsTable(itemModel, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setSelectedOrganization(SciOrganization organization) {
|
||||||
|
this.selectedOrganization = organization;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setSelectedOrganizationRole(String role) {
|
||||||
|
this.selectedOrganizationRole = role;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setSelectedOrganizationStatus(String status) {
|
||||||
|
this.selectedOrganizationStatus = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void showEditComponent(PageState state) {
|
||||||
|
showComponent(state, MEMBER_ADD_ORGANIZATION_SHEET_NAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,331 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.bebop.ControlLink;
|
||||||
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.Link;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Table;
|
||||||
|
import com.arsdigita.bebop.event.TableActionEvent;
|
||||||
|
import com.arsdigita.bebop.event.TableActionListener;
|
||||||
|
import com.arsdigita.bebop.table.TableCellRenderer;
|
||||||
|
import com.arsdigita.bebop.table.TableColumn;
|
||||||
|
import com.arsdigita.bebop.table.TableColumnModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModel;
|
||||||
|
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||||
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.ContentSection;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.RelationAttribute;
|
||||||
|
import com.arsdigita.cms.RelationAttributeCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciMember;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciMemberSciOrganizationsCollection;
|
||||||
|
import com.arsdigita.cms.contenttypes.SciOrganization;
|
||||||
|
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||||
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
|
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||||
|
import com.arsdigita.util.LockableImpl;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
*/
|
||||||
|
public class SciMemberSciOrganizationsTable
|
||||||
|
extends Table
|
||||||
|
implements TableActionListener {
|
||||||
|
|
||||||
|
private static final Logger logger = Logger.getLogger(
|
||||||
|
SciMemberSciOrganizationsTable.class);
|
||||||
|
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||||
|
private final String TABLE_COL_EDIT_LINK = "table_col_edit_link";
|
||||||
|
private final String TABLE_COL_DEL = "table_col_del";
|
||||||
|
private final String TABLE_COL_UP = "table_col_up";
|
||||||
|
private final String TABLE_COL_DOWN = "table_col_down";
|
||||||
|
private ItemSelectionModel itemModel;
|
||||||
|
private SciMemberSciOrganizationsStep step;
|
||||||
|
|
||||||
|
public SciMemberSciOrganizationsTable(ItemSelectionModel itemModel,
|
||||||
|
SciMemberSciOrganizationsStep step) {
|
||||||
|
super();
|
||||||
|
this.itemModel = itemModel;
|
||||||
|
this.step = step;
|
||||||
|
|
||||||
|
setEmptyView(new Label(SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organizations.none")));
|
||||||
|
|
||||||
|
TableColumnModel columnModel = getColumnModel();
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
0,
|
||||||
|
SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organization").localize(),
|
||||||
|
TABLE_COL_EDIT));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
1,
|
||||||
|
SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organization.role").localize()));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
2,
|
||||||
|
SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organization.status").localize()));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
3,
|
||||||
|
SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organization.edit").localize(),
|
||||||
|
TABLE_COL_EDIT_LINK));
|
||||||
|
columnModel.add(new TableColumn(
|
||||||
|
4,
|
||||||
|
SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organization.remove").localize(),
|
||||||
|
TABLE_COL_DEL));
|
||||||
|
|
||||||
|
setModelBuilder(
|
||||||
|
new SciMemberSciOrganizationsTableModelBuilder(itemModel));
|
||||||
|
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||||
|
columnModel.get(3).setCellRenderer(new EditLinkCellRenderer());
|
||||||
|
columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
|
addTableActionListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciMemberSciOrganizationsTableModelBuilder
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableModelBuilder {
|
||||||
|
|
||||||
|
public SciMemberSciOrganizationsTableModelBuilder(
|
||||||
|
ItemSelectionModel itemModel) {
|
||||||
|
SciMemberSciOrganizationsTable.this.itemModel = itemModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableModel makeModel(Table table, PageState state) {
|
||||||
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
|
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||||
|
return new SciMemberSciOrganizationsTableModel(table,
|
||||||
|
state,
|
||||||
|
member);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SciMemberSciOrganizationsTableModel implements TableModel {
|
||||||
|
|
||||||
|
private Table table;
|
||||||
|
private SciMemberSciOrganizationsCollection organizations;
|
||||||
|
private SciOrganization organization;
|
||||||
|
|
||||||
|
public SciMemberSciOrganizationsTableModel(Table table,
|
||||||
|
PageState state,
|
||||||
|
SciMember member) {
|
||||||
|
this.table = table;
|
||||||
|
this.organizations = member.getOrganizations();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getColumnCount() {
|
||||||
|
return table.getColumnModel().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean nextRow() {
|
||||||
|
boolean ret;
|
||||||
|
|
||||||
|
if ((organizations != null) && organizations.next()) {
|
||||||
|
organization = organizations.getOrganization();
|
||||||
|
ret = true;
|
||||||
|
} else {
|
||||||
|
ret = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getElementAt(int columnIndex) {
|
||||||
|
switch (columnIndex) {
|
||||||
|
case 0:
|
||||||
|
return organization.getTitle();
|
||||||
|
case 1:
|
||||||
|
RelationAttributeCollection role = new RelationAttributeCollection(
|
||||||
|
"SciOrganizationRole",
|
||||||
|
organizations.getRoleName());
|
||||||
|
if (role.next()) {
|
||||||
|
String roleName = role.getName();
|
||||||
|
role.close();
|
||||||
|
return roleName;
|
||||||
|
} else {
|
||||||
|
return ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.ui.unknownRole").localize();
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
RelationAttributeCollection status = new RelationAttributeCollection(
|
||||||
|
"SciOrganizationStatus",
|
||||||
|
organizations.getStatus());
|
||||||
|
if (status.next()) {
|
||||||
|
String statusName = status.getName();
|
||||||
|
status.close();
|
||||||
|
return statusName;
|
||||||
|
} else {
|
||||||
|
return ContenttypesGlobalizationUtil.globalize(
|
||||||
|
"cms.ui.unknownStatus").localize();
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
return SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organizations.edit_assoc").localize();
|
||||||
|
case 4:
|
||||||
|
return SciOrganizationGlobalizationUtil.globalize(
|
||||||
|
"scimember.ui.organizations.remove").localize();
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getKeyAt(int columnIndex) {
|
||||||
|
return organization.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(Table table,
|
||||||
|
PageState state,
|
||||||
|
Object value,
|
||||||
|
boolean isSelected,
|
||||||
|
Object key,
|
||||||
|
int row,
|
||||||
|
int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
member);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
SciOrganization organization;
|
||||||
|
try {
|
||||||
|
organization = new SciOrganization((BigDecimal) key);
|
||||||
|
} catch (DataObjectNotFoundException ex) {
|
||||||
|
logger.warn(String.format("No object with key '%s' found.",
|
||||||
|
key),
|
||||||
|
ex);
|
||||||
|
return new Label(value.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentSection section = CMS.getContext().getContentSection();
|
||||||
|
ItemResolver resolver = section.getItemResolver();
|
||||||
|
Link link = new Link(value.toString(),
|
||||||
|
resolver.generateItemURL(state,
|
||||||
|
organization,
|
||||||
|
section, organization.
|
||||||
|
getVersion()));
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EditLinkCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
public Component getComponent(Table table,
|
||||||
|
PageState state,
|
||||||
|
Object value,
|
||||||
|
boolean isSelected,
|
||||||
|
Object key,
|
||||||
|
int row,
|
||||||
|
int column) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager =
|
||||||
|
Utilities.getSecurityManager(state);
|
||||||
|
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
member);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
ControlLink link = new ControlLink(value.toString());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DeleteCellRenderer
|
||||||
|
extends LockableImpl
|
||||||
|
implements TableCellRenderer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getComponent(Table table,
|
||||||
|
PageState state,
|
||||||
|
Object value,
|
||||||
|
boolean isSelected,
|
||||||
|
Object key,
|
||||||
|
int row,
|
||||||
|
int col) {
|
||||||
|
com.arsdigita.cms.SecurityManager securityManager = Utilities.
|
||||||
|
getSecurityManager(state);
|
||||||
|
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||||
|
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||||
|
member);
|
||||||
|
|
||||||
|
if (canEdit) {
|
||||||
|
ControlLink link = new ControlLink(value.toString());
|
||||||
|
link.setConfirmation((String) SciOrganizationGlobalizationUtil.
|
||||||
|
globalize(
|
||||||
|
"scimember.ui.organization."
|
||||||
|
+ ".confirm_remove").
|
||||||
|
localize());
|
||||||
|
return link;
|
||||||
|
} else {
|
||||||
|
Label label = new Label(value.toString());
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cellSelected(TableActionEvent event) {
|
||||||
|
PageState state = event.getPageState();
|
||||||
|
|
||||||
|
SciOrganization organization = new SciOrganization(new BigDecimal(event.
|
||||||
|
getRowKey().toString()));
|
||||||
|
|
||||||
|
SciMember member = (SciMember) itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
|
SciMemberSciOrganizationsCollection organizations = member.
|
||||||
|
getOrganizations();
|
||||||
|
|
||||||
|
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||||
|
|
||||||
|
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||||
|
} else if(TABLE_COL_EDIT_LINK.equals(column.getHeaderKey().toString())) {
|
||||||
|
while(organizations.next()) {
|
||||||
|
if (organizations.getOrganization().equals(organization)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||||
|
member.removeOrganization(organization);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void headSelected(TableActionEvent event) {
|
||||||
|
//Nothing to do
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -125,8 +125,7 @@ public class SciProjectDepartmentsTable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SciProjectDepartmentsTableModel
|
private class SciProjectDepartmentsTableModel implements TableModel {
|
||||||
implements TableModel {
|
|
||||||
|
|
||||||
private Table m_table;
|
private Table m_table;
|
||||||
private SciProjectDepartmentsCollection m_departments;
|
private SciProjectDepartmentsCollection m_departments;
|
||||||
|
|
@ -227,7 +226,6 @@ public class SciProjectDepartmentsTable
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Label label = new Label(value.toString());
|
Label label = new Label(value.toString());
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue