diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/publicpersonalprofile/PublicPersonalProfilesServlet.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/publicpersonalprofile/PublicPersonalProfilesServlet.java
index 9df448cc0..d887abe3e 100644
--- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/publicpersonalprofile/PublicPersonalProfilesServlet.java
+++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/publicpersonalprofile/PublicPersonalProfilesServlet.java
@@ -9,6 +9,7 @@ import com.arsdigita.bebop.PageFactory;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ReusableImageAsset;
@@ -292,7 +293,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
final DataCollection links =
RelatedLink.getRelatedLinks(
profile,
- PublicPersonalProfile.LINK_LIST_NAME);
+ PublicPersonalProfile.LINK_LIST_NAME);
links.addFilter(String.format("linkTitle = '%s'",
navPath));
@@ -329,8 +330,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
generator.generateContent(
profileElem,
- owner,
- state);
+ owner,
+ state);
} else {
throw new ServletException(String.
@@ -368,11 +369,14 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
links.close();
final ContentItem item =
link.getTargetItem();
+ final Element contentPanelElem = root.
+ newChildElement("cms:contentPanel",
+ CMS.CMS_XML_NS);
final PublicPersonalProfileXmlGenerator generator =
new PublicPersonalProfileXmlGenerator(
item);
generator.generateXML(state,
- root,
+ contentPanelElem,
"");
}
@@ -390,10 +394,16 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
(ContentItem) DomainObjectFactory.
newInstance(itemOid);
+ final Element contentPanelElem = root.
+ newChildElement("cms:contentPanel",
+ CMS.CMS_XML_NS);
+
final PublicPersonalProfileXmlGenerator generator =
new PublicPersonalProfileXmlGenerator(
item);
- generator.generateXML(state, root, "");
+ generator.generateXML(state,
+ contentPanelElem,
+ "");
} catch (DataObjectNotFoundException ex) {
logger.error(String.format(
diff --git a/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl b/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl
index c17bb410c..fd0719f00 100644
--- a/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl
+++ b/ccm-cms/pdl/com/arsdigita/content-types/GenericOrganizationalUnit.pdl
@@ -161,11 +161,23 @@ query getIdsOfMembersOfOrgaUnits {
String givenname;
String roleName;
String status;
+
+ options {
+ WRAP_QUERIES = false;
+ }
- do {
- select distinct on (cms_persons.person_id) cms_persons.person_id, cms_persons.surname, cms_persons.givenname, cms_organizationalunits_person_map.organizationalunit_id, cms_organizationalunits_person_map.role_name, cms_organizationalunits_person_map.status
+ do {
+ select distinct on (cms_persons.person_id)
+ cms_persons.person_id,
+ cms_persons.surname,
+ cms_persons.givenname,
+ cms_organizationalunits_person_map.organizationalunit_id,
+ cms_organizationalunits_person_map.role_name,
+ cms_organizationalunits_person_map.status
from cms_persons
- join cms_organizationalunits_person_map on cms_persons.person_id = cms_organizationalunits_person_map.person_id
+ join cms_organizationalunits_person_map on cms_persons.person_id = cms_organizationalunits_person_map.person_id
+ where cms_organizationalunits_person_map.organizationalunit_id in :orgaunitIds
+
} map {
memberId = cms_persons.person_id;
orgaunitId = cms_organizationalunits_person_map.organizationalunit_id;
@@ -174,4 +186,5 @@ query getIdsOfMembersOfOrgaUnits {
roleName = cms_organizationalunits_person_map.role_name;
status = cms_organizationalunits_person_map.status;
}
-}
\ No newline at end of file
+}
+//select distinct on (cms_persons.person_id)
diff --git a/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java b/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java
index e0ca5934d..43f7c98c8 100644
--- a/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java
+++ b/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java
@@ -115,8 +115,10 @@ public class ContentItemXMLRenderer extends DomainObjectXMLRenderer {
getNegotiatedLocale().getLanguage());
if (relationAttributeCollection.size() > 0) {
relationAttributeCollection.next();
- Element element = newElement(m_element, m_keyName);
+ Element element = newElement(m_element, m_keyName);
element.setText(relationAttributeCollection.getName());
+ Element elementId = newElement(m_element, m_keyName + "Id");
+ elementId.setText(relationAttributeCollection.getKey());
relationAttributeCollection.close();
}
return;
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
index b4982094f..7c64e7b24 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
@@ -144,8 +144,14 @@ public class GenericOrganizationalUnitContactAddForm
if (selectedContact == null) {
GenericContact contact = (GenericContact) data.get(ITEM_SEARCH);
- contact = (GenericContact) contact.getContentBundle().
- getInstance(orgaunit.getLanguage());
+ if (orgaunit.getLanguage().equals(
+ GlobalizationHelper.LANG_INDEPENDENT)) {
+ contact = (GenericContact) contact.getContentBundle().
+ getPrimaryInstance();
+ } else {
+ contact = (GenericContact) contact.getContentBundle().
+ getInstance(orgaunit.getLanguage());
+ }
orgaunit.addContact(contact,
(String) data.get(
@@ -203,18 +209,29 @@ public class GenericOrganizationalUnitContactAddForm
GenericContact contact = (GenericContact) data.get(ITEM_SEARCH);
- if (!(contact.getContentBundle().hasInstance(orgaunit.getLanguage(),
- Kernel.getConfig().
- languageIndependentItems()))) {
- data.addError(
- ContenttypesGlobalizationUtil.globalize(
- "cms.contenttypes.ui.genericorgaunit.select_contact.no_suitable_language_variant"));
+ if (!(orgaunit.getLanguage().equals(
+ GlobalizationHelper.LANG_INDEPENDENT))) {
+ if (!(contact.getContentBundle().hasInstance(orgaunit.
+ getLanguage(),
+ Kernel.getConfig().
+ languageIndependentItems()))) {
+ data.addError(
+ ContenttypesGlobalizationUtil.globalize(
+ "cms.contenttypes.ui.genericorgaunit.select_contact.no_suitable_language_variant"));
- return;
+ return;
+ }
}
- contact = (GenericContact) contact.getContentBundle().getInstance(orgaunit.
- getLanguage());
+
+ if (orgaunit.getLanguage().equals(
+ GlobalizationHelper.LANG_INDEPENDENT)) {
+ contact = (GenericContact) contact.getContentBundle().
+ getPrimaryInstance();
+ } else {
+ contact = (GenericContact) contact.getContentBundle().
+ getInstance(orgaunit.getLanguage());
+ }
GenericOrganizationalUnitContactCollection contacts = orgaunit.
getContacts();
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/panels/Paginator.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/panels/Paginator.java
index 85e027ec2..1ffc8e0f5 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/panels/Paginator.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/panels/Paginator.java
@@ -89,11 +89,11 @@ public class Paginator {
logger.debug(String.format("Applying limits: %d, %d",
getBegin(),
getEnd()));
- if (getBegin() == getEnd()) {
+ /*if (getBegin() == getEnd()) {
query.setRange(getBegin(), getEnd() + 1);
- } else {
- query.setRange(getBegin(), getEnd());
- }
+ } else {*/
+ query.setRange(getBegin(), getEnd() + 1);
+ //}
}
public int getPageCount() {
diff --git a/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java b/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java
index a1b9e27fa..f754828e7 100755
--- a/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java
+++ b/ccm-cms/src/com/arsdigita/cms/dispatcher/SimpleXMLGenerator.java
@@ -45,6 +45,8 @@ import com.arsdigita.xml.Element;
import org.apache.log4j.Logger;
import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
/**
*
The default XMLGenerator implementation.
@@ -67,6 +69,11 @@ public class SimpleXMLGenerator implements XMLGenerator {
* your generator.
*/
private boolean useExtraXml = true;
+ /**
+ * Extra attributes for the cms:item element.
+ */
+ private Map itemAttributes =
+ new LinkedHashMap();
/**
* Allows to overwrite the name and the namespace of the XML element
* used to wrap the rendered item.
@@ -96,14 +103,17 @@ public class SimpleXMLGenerator implements XMLGenerator {
this.useExtraXml = useExtraXml;
}
+ public void addItemAttribute(final String name,
+ final String value) {
+ itemAttributes.put(name, value);
+ }
+
public void setItemElemName(final String itemElemName,
final String itemElemNs) {
- this.itemElemName = itemElemName;
+ this.itemElemName = itemElemName;
this.itemElemNs = itemElemNs;
}
-
-
-
+
/**
* Generates the XML to render the content panel.
*
@@ -266,6 +276,11 @@ public class SimpleXMLGenerator implements XMLGenerator {
if (useContext != null) {
element.addAttribute("useContext", useContext);
}
+
+ for (Map.Entry attr : itemAttributes.entrySet()) {
+ element.addAttribute(attr.getKey(), attr.getValue());
+ }
+
return element;
}
diff --git a/ccm-sci-bundle/src/com/arsdigita/bundle/ui/GenericOrgaUnitTabComponent.java b/ccm-sci-bundle/src/com/arsdigita/bundle/ui/GenericOrgaUnitTabComponent.java
new file mode 100644
index 000000000..c96bfa392
--- /dev/null
+++ b/ccm-sci-bundle/src/com/arsdigita/bundle/ui/GenericOrgaUnitTabComponent.java
@@ -0,0 +1,75 @@
+package com.arsdigita.bundle.ui;
+
+import com.arsdigita.bebop.Page;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
+import com.arsdigita.cms.contenttypes.ui.GenericOrgaUnitTab;
+import com.arsdigita.dispatcher.DispatcherHelper;
+import com.arsdigita.domain.DomainObjectFactory;
+import com.arsdigita.navigation.ui.AbstractComponent;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.util.UncheckedWrapperException;
+import com.arsdigita.xml.Element;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * A wrapper around {@link GenericOrgaUnitTab} which allows it to use the
+ * output of an implementation of {@link GenericOrgaUnitTab} independently from
+ * a {@link GenericOrganizationalUnit} item. This allows it to create an
+ * special JSP and the show a tab as a navigation point.
+ *
+ * @author Jens Pelzetter
+ * @version $Id$
+ */
+public class GenericOrgaUnitTabComponent extends AbstractComponent {
+
+ private Page page;
+ private OID orgaunitOid;
+ private GenericOrgaUnitTab tab;
+
+ public void setPage(final Page page) {
+ this.page = page;
+ }
+
+ /**
+ * The OID of the orga unit to use. Use the OID of the master version (can
+ * be found in the overview tab in the content-center in the stable link)
+ * here
+ * @param oid
+ */
+ public void setOrgaUnit(final String oid) {
+ this.orgaunitOid = OID.valueOf(oid);
+ }
+
+ public void setOrgaUnitTab(final GenericOrgaUnitTab tab) {
+ this.tab = tab;
+ }
+
+ public Element generateXML(final HttpServletRequest request,
+ final HttpServletResponse response) {
+ final PageState state;
+ try {
+ state = new PageState(page, request, response);
+ } catch (ServletException ex) {
+ throw new UncheckedWrapperException(ex);
+ }
+
+ GenericOrganizationalUnit orgaunit =
+ (GenericOrganizationalUnit) DomainObjectFactory.
+ newInstance(orgaunitOid);
+ if (!DispatcherHelper.getDispatcherPrefix(request).equals("preview")) {
+ orgaunit = (GenericOrganizationalUnit) orgaunit.getLiveVersion();
+ }
+
+ final Element tabsElem = new Element("orgaUnitTabs");
+ final Element selectedTabElem = tabsElem.newChildElement("selectedTab");
+
+ if (orgaunit != null) {
+ tab.generateXml(orgaunit, selectedTabElem, state);
+ }
+
+ return tabsElem;
+ }
+}
diff --git a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublications.java b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublications.java
index 56f0535b0..e0e7707aa 100644
--- a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublications.java
+++ b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublications.java
@@ -251,7 +251,7 @@ public class PersonalPublications implements ContentGenerator {
if (typeToken.endsWith("_reviewed")) {
return String.format("(objectType = '%s' and reviewed = 'true')",
typeToken.substring(0, typeToken.length() - 9));
- } else if (typeToken.endsWith("notreviewed")) {
+ } else if (typeToken.endsWith("_notreviewed")) {
return String.format(
"(objectType = '%s' and (reviewed = 'false' or reviewed is null))",
typeToken.substring(0, typeToken.length() - 12));
diff --git a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig.java b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig.java
index 852476a4b..af986dc34 100644
--- a/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig.java
+++ b/ccm-sci-personalpublications/src/com/arsdigita/cms/publicpersonalprofile/PersonalPublicationsConfig.java
@@ -61,9 +61,7 @@ public class PersonalPublicationsConfig extends AbstractConfig {
* be used here.
*/
private final Parameter defaultGroup;
-
private final Parameter pageSize;
-
private final Parameter order;
public PersonalPublicationsConfig() {
@@ -73,8 +71,8 @@ public class PersonalPublicationsConfig extends AbstractConfig {
Parameter.REQUIRED,
"monographs:com.arsdigita.cms.contenttypes.Monograph;"
+ "collectedVolumeArticles:com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;"
- + "journalArticles:com.arsdigita.cms.contenttypes.ArticleInJournal;"
+ "journalArticlesReviewed:com.arsdigita.cms.contenttypes.ArticleInJournal_reviewed;"
+ + "journalArticles:com.arsdigita.cms.contenttypes.ArticleInJournal_notreviewed;"
+ "collectedVolumes:com.arsdigita.cms.contenttypes.CollectedVolume");
groupSplit = new IntegerParameter(
@@ -82,21 +80,22 @@ public class PersonalPublicationsConfig extends AbstractConfig {
Parameter.REQUIRED,
12);
- defaultGroup = new StringParameter(
+ defaultGroup =
+ new StringParameter(
"com.arsdigita.cms.publicpersonalprofile.publications.defaultGroup",
Parameter.REQUIRED,
"monographs,journalArticlesReviewed,journalArticles,misc");
-
+
pageSize = new IntegerParameter(
- "com.arsdigita.cms.publicpersonlprofile.publications.pageSize",
- Parameter.REQUIRED,
+ "com.arsdigita.cms.publicpersonlprofile.publications.pageSize",
+ Parameter.REQUIRED,
10);
-
+
order = new StringParameter(
- "com.arsdigita.cms.publicpersonlprofile.publications.order",
- Parameter.REQUIRED,
+ "com.arsdigita.cms.publicpersonlprofile.publications.order",
+ Parameter.REQUIRED,
"year,title");
-
+
register(publicationGroups);
register(groupSplit);
register(defaultGroup);
@@ -113,15 +112,15 @@ public class PersonalPublicationsConfig extends AbstractConfig {
public final Integer getGroupSplit() {
return (Integer) get(groupSplit);
}
-
+
public final String getDefaultGroup() {
return (String) get(defaultGroup);
}
-
+
public final Integer getPageSize() {
return (Integer) get(pageSize);
}
-
+
public final String getOrder() {
return (String) get(order);
}
diff --git a/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.1-6.6.2/add-authors-field.sql b/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.1-6.6.2/add-authors-field.sql
new file mode 100644
index 000000000..b9f00c0b1
--- /dev/null
+++ b/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.1-6.6.2/add-authors-field.sql
@@ -0,0 +1,9 @@
+-- Add column for authors property in ct_publications table
+alter table ct_publications add column authors varchar(2048);
+
+-- Fill the authors property for existing publications
+update ct_publications set authors = (array_to_string(array(select cms_persons.surname || ', ' || cms_persons.givenname
+ from cms_persons
+ join ct_publications_authorship on cms_persons.person_id = ct_publications_authorship.person_id
+ where ct_publications_authorship.publication_id = ct_publications.publication_id
+ order by ct_publications_authorship.authorship_order), '; '));
\ No newline at end of file
diff --git a/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.1-6.6.2/add-internet-articles-properties.sql b/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.1-6.6.2/add-internet-articles-properties.sql
new file mode 100644
index 000000000..218a9c8f2
--- /dev/null
+++ b/ccm-sci-publications/sql/ccm-sci-publications/default/upgrade/6.6.1-6.6.2/add-internet-articles-properties.sql
@@ -0,0 +1,4 @@
+-- Add columns
+alter table ct_internet_article add column url varchar(2048);
+alter table ct_internet_article add column urn varchar(2048);
+alter table ct_internet_article add column doi varchar(2048);
\ No newline at end of file
diff --git a/ccm-sci-publications/sql/ccm-sci-publications/upgrade/postgres-6.6.1-6.6.2.sql b/ccm-sci-publications/sql/ccm-sci-publications/upgrade/postgres-6.6.1-6.6.2.sql
new file mode 100644
index 000000000..8466ae835
--- /dev/null
+++ b/ccm-sci-publications/sql/ccm-sci-publications/upgrade/postgres-6.6.1-6.6.2.sql
@@ -0,0 +1,8 @@
+\echo 'Scientific CMS Publications module 6.6.1 -> 6.6.2 Upgrade Script (PostgreSQL)'
+
+begin;
+
+\i ../default/upgrade/6.6.1-6.6.2/add-authors-field.sql
+\i ../default/upgrade/6.6.1-6.6.2/add-internet-articles-properties.sql
+
+commit;
\ No newline at end of file
diff --git a/ccm-sci-types-department/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml b/ccm-sci-types-department/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml
index 9b71ef4a1..b29f666f9 100644
--- a/ccm-sci-types-department/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml
+++ b/ccm-sci-types-department/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml
@@ -10,10 +10,10 @@
-
+
diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig.java
index 5bb9ef2ae..5e807a587 100644
--- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig.java
+++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/SciDepartmentConfig.java
@@ -70,7 +70,7 @@ public class SciDepartmentConfig extends AbstractConfig {
new StringParameter(
"com.arsdigita.cms.contenttypes.sciproject.tabs",
Parameter.REQUIRED,
- "summary:com.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTab");
+ "summary:com.arsdigita.cms.contenttypes.ui.SciDepartmentSummaryTab;desc:com.arsdigita.cms.contenttypes.ui.SciDepartmentDescTab;members:com.arsdigita.cms.contenttypes.ui.SciDepartmentMembersTab");
register(enableSubDepartmentsStep);
register(enableSuperDepartmentsStep);
diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescTab.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescTab.java
index 2f16c9bce..666911d24 100644
--- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescTab.java
+++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescTab.java
@@ -42,14 +42,16 @@ public class SciDepartmentDescTab implements GenericOrgaUnitTab {
final long start = System.currentTimeMillis();
final Desc desc = getData(orgaunit);
+ final Element descTabElem = parent.newChildElement("departmentDescription");
+
if ((desc.getShortDesc() != null)
&& !desc.getShortDesc().trim().isEmpty()) {
- final Element shortDescElem = parent.newChildElement(
+ final Element shortDescElem = descTabElem.newChildElement(
"shortDescription");
shortDescElem.setText(desc.getShortDesc());
}
- final Element descElem = parent.newChildElement("description");
+ final Element descElem = descTabElem.newChildElement("description");
descElem.setText(desc.getDesc());
logger.debug(String.format("Generated XML for description tab of "
diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTab.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTab.java
index 8640c1650..7c498d3e7 100644
--- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTab.java
+++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTab.java
@@ -3,7 +3,6 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.SciDepartment;
import com.arsdigita.cms.contenttypes.ui.panels.CompareFilter;
@@ -14,6 +13,9 @@ import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.xml.Element;
import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
@@ -24,14 +26,15 @@ import org.apache.log4j.Logger;
*/
public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
- private final Logger logger = Logger.getLogger(SciDepartmentMembersTab.class);
+ private final Logger logger =
+ Logger.getLogger(SciDepartmentMembersTab.class);
private static final SciDepartmentMembersTabConfig config =
- new SciDepartmentMembersTabConfig();
+ new SciDepartmentMembersTabConfig();
private static final String STATUS_PARAM = "memberStatus";
private static final String SURNAME_PARAM = "memberSurname";
private final CompareFilter statusFilter = new CompareFilter(
STATUS_PARAM,
- GenericOrganizationalUnitPersonCollection.LINK_STATUS,
+ "status",
false,
false,
false);
@@ -79,12 +82,24 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
final Element filtersElem = depMembersElem.newChildElement("filters");
+ statusFilter.generateXml(filtersElem);
+
+ if (persons.isEmpty()) {
+ if ((surnameFilter != null)
+ && (surnameFilter.getFilter() != null)
+ && !(surnameFilter.getFilter().trim().isEmpty())) {
+ surnameFilter.generateXml(filtersElem);
+ }
+ depMembersElem.newChildElement("noMembers");
+ return;
+ }
+
final Paginator paginator = new Paginator(request,
(int) persons.size(),
config.getPageSize());
- statusFilter.generateXml(filtersElem);
- if (paginator.getPageCount() > config.getEnableSearchLimit()) {
+ if ((paginator.getPageCount() > config.getEnableSearchLimit())
+ || !(surnameFilter.getFilter().trim().isEmpty())) {
surnameFilter.generateXml(filtersElem);
}
@@ -118,6 +133,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
retrieveQuery(
"com.arsdigita.cms.contenttypes.getIdsOfMembersOfOrgaUnits");
final StringBuffer personsFilter = new StringBuffer();
+ final List orgaUnitIds = new ArrayList();
if (config.isMergingMembers()) {
final DataQuery subDepartmentsQuery =
@@ -135,13 +151,17 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
personsFilter.append(String.format("orgaunitId = %s",
subDepartmentsQuery.get(
"orgaunitId").toString()));
+ orgaUnitIds.add(subDepartmentsQuery.get(
+ "orgaunitId").toString());
}
} else {
personsFilter.append(String.format("orgaunitId = %s",
orgaunit.getID().toString()));
+ orgaUnitIds.add(orgaunit.getID().toString());
}
-
- personsQuery.addFilter(personsFilter.toString());
+
+ //personsQuery.addFilter(personsFilter.toString());
+ personsQuery.setParameter("orgaunitIds", orgaUnitIds);
personsQuery.addOrder(GenericPerson.SURNAME);
personsQuery.addOrder(GenericPerson.GIVENNAME);
@@ -162,7 +182,10 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
statusFilter.setValue(statusValue);
}
- persons.addFilter(statusFilter.getFilter());
+ String filter = statusFilter.getFilter();
+ if ((filter != null) && !(filter.trim().isEmpty())) {
+ persons.addFilter(statusFilter.getFilter());
+ }
}
private void applySurnameFilter(final DataQuery persons,
@@ -172,7 +195,10 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
surnameFilter.setValue(surnameValue);
}
- persons.addFilter(surnameFilter.getFilter());
+ final String filter = surnameFilter.getFilter();
+ if ((filter != null) && !(filter.trim().isEmpty())) {
+ persons.addFilter(filter);
+ }
}
protected void generateMemberXml(final BigDecimal memberId,
@@ -193,6 +219,7 @@ public class SciDepartmentMembersTab implements GenericOrgaUnitTab {
final long start = System.currentTimeMillis();
final XmlGenerator generator = new XmlGenerator(member);
generator.setUseExtraXml(false);
+ generator.setItemElemName("member", "");
generator.generateXML(state, parent, "");
logger.debug(String.format("Generated XML for member '%s' in %d ms.",
member.getFullName(),
diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig.java
index 1030993b6..f5bf31ae4 100644
--- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig.java
+++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig.java
@@ -27,7 +27,7 @@ public class SciDepartmentMembersTabConfig extends AbstractConfig {
pageSize =
new IntegerParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.tabs.embers.page_size",
+ "com.arsdigita.cms.contenttypes.scidepartment.tabs.members.page_size",
Parameter.REQUIRED,
30);
@@ -35,7 +35,7 @@ public class SciDepartmentMembersTabConfig extends AbstractConfig {
new IntegerParameter(
"com.arsdigita.cms.contenttypes.scidepartment.tabs.members.enable_search_limit",
Parameter.REQUIRED,
- 2);
+ 0);
mergeMembers =
new BooleanParameter(
diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig_parameter.properties b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig_parameter.properties
index 37814fd12..0b13e26f2 100644
--- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig_parameter.properties
+++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMembersTabConfig_parameter.properties
@@ -3,10 +3,10 @@ com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_values.purpose
com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_values.example = active,associated,former
com.arsdigita.cms.contenttypes.scidepartment.tabs.members.status_values.format = [String]
-com.arsdigita.cms.contenttypes.scidepartment.tabs.embers.page_size.title = Page size
-com.arsdigita.cms.contenttypes.scidepartment.tabs.embers.page_size.purpose = Maximum number of members per page
-com.arsdigita.cms.contenttypes.scidepartment.tabs.embers.page_size.example = 30
-com.arsdigita.cms.contenttypes.scidepartment.tabs.embers.page_size.format = [Integer]
+com.arsdigita.cms.contenttypes.scidepartment.tabs.members.page_size.title = Page size
+com.arsdigita.cms.contenttypes.scidepartment.tabs.members.page_size.purpose = Maximum number of members per page
+com.arsdigita.cms.contenttypes.scidepartment.tabs.members.page_size.example = 30
+com.arsdigita.cms.contenttypes.scidepartment.tabs.members.page_size.format = [Integer]
com.arsdigita.cms.contenttypes.scidepartment.tabs.members.enable_search_limit.title = Enable search limit
com.arsdigita.cms.contenttypes.scidepartment.tabs.members.enable_search_limit.purpose = Number of result pages when to activate the search. Set to 1 or 0 to show the search on every time.
diff --git a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSummaryTab.java b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSummaryTab.java
index 9d97c4102..947ddb7c9 100644
--- a/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSummaryTab.java
+++ b/ccm-sci-types-department/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSummaryTab.java
@@ -121,7 +121,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
heads.addOrder("givenname");
while (heads.next()) {
- generateMemberXml(heads.getPerson(), headsElem, state);
+ generateHeadXml(heads.getPerson(), headsElem, state);
}
logger.debug(String.format("Generated head of department XML for department '%s' "
@@ -139,7 +139,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
department.
getSubordinateOrgaUnits();
subDepartments.addFilter(
- String.format("%s = '%s",
+ String.format("%s = '%s'",
GenericOrganizationalUnitSubordinateCollection.LINK_ASSOCTYPE,
SciDepartmentSubDepartmentsStep.ASSOC_TYPE));
@@ -187,7 +187,7 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
System.currentTimeMillis() - start));
}
- protected void generateMemberXml(final BigDecimal memberId,
+ protected void generateHeadXml(final BigDecimal memberId,
final Element parent,
final PageState state) {
final long start = System.currentTimeMillis();
@@ -196,15 +196,16 @@ public class SciDepartmentSummaryTab implements GenericOrgaUnitTab {
+ "in %d ms.",
member.getFullName(),
System.currentTimeMillis() - start));
- generateMemberXml(member, parent, state);
+ generateHeadXml(member, parent, state);
}
- protected void generateMemberXml(final GenericPerson member,
+ protected void generateHeadXml(final GenericPerson member,
final Element parent,
final PageState state) {
final long start = System.currentTimeMillis();
final XmlGenerator generator = new XmlGenerator(member);
generator.setUseExtraXml(false);
+ generator.setItemElemName("head", "");
generator.generateXML(state, parent, "");
logger.debug(String.format("Generated XML for member '%s' in %d ms.",
member.getFullName(),
diff --git a/ccm-sci-types-project/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml b/ccm-sci-types-project/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml
index bb5ab9147..7cd1dfae8 100644
--- a/ccm-sci-types-project/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml
+++ b/ccm-sci-types-project/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml
@@ -9,10 +9,12 @@
+
+
-
-
+
diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescTab.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescTab.java
index f0e7cc80f..3987a8c6c 100644
--- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescTab.java
+++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescTab.java
@@ -39,24 +39,26 @@ public class SciProjectDescTab implements GenericOrgaUnitTab {
final long start = System.currentTimeMillis();
final Desc desc = getData(orgaunit);
+ final Element descTabElem = parent.newChildElement("projectDescription");
+
if ((desc.getShortDesc() != null)
&& !desc.getShortDesc().trim().isEmpty()) {
- final Element shortDescElem = parent.newChildElement("shortDescription");
+ final Element shortDescElem = descTabElem.newChildElement("shortDescription");
shortDescElem.setText(desc.getShortDesc());
}
- final Element descElem = parent.newChildElement("description");
+ final Element descElem = descTabElem.newChildElement("description");
descElem.setText(desc.getDesc());
if ((desc.getFunding() != null)
&& !desc.getFunding().trim().isEmpty()) {
- final Element fundingElem = parent.newChildElement("funding");
+ final Element fundingElem = descTabElem.newChildElement("funding");
fundingElem.setText(desc.getFunding());
}
if ((desc.getFundingVolume() != null)
&& !desc.getFundingVolume().trim().isEmpty()) {
- final Element volumeElem = parent.newChildElement("fundingVolume");
+ final Element volumeElem = descTabElem.newChildElement("fundingVolume");
volumeElem.setText(desc.getFundingVolume());
}
diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java
index 058e4e58d..24dbe72e9 100644
--- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java
+++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java
@@ -17,7 +17,6 @@ import com.arsdigita.persistence.SessionManager;
import com.arsdigita.xml.Element;
import java.math.BigDecimal;
import java.text.DateFormat;
-import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
@@ -214,6 +213,7 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
while (personsQuery.next()) {
generateMemberXml((BigDecimal) personsQuery.get("memberId"),
membersElem,
+ (String) personsQuery.get("roleName"),
state);
}
} else {
@@ -224,7 +224,10 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
members.addOrder("givenname");
while (members.next()) {
- generateMemberXml(members.getPerson(), membersElem, state);
+ generateMemberXml(members.getPerson(),
+ membersElem,
+ members.getRoleName(),
+ state);
}
}
@@ -237,6 +240,7 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
protected void generateMemberXml(final BigDecimal memberId,
final Element parent,
+ final String role,
final PageState state) {
final long start = System.currentTimeMillis();
final GenericPerson member = new GenericPerson(memberId);
@@ -244,15 +248,18 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
+ "in %d ms.",
member.getFullName(),
System.currentTimeMillis() - start));
- generateMemberXml(member, parent, state);
+ generateMemberXml(member, parent, role, state);
}
protected void generateMemberXml(final GenericPerson member,
final Element parent,
+ final String role,
final PageState state) {
final long start = System.currentTimeMillis();
final XmlGenerator generator = new XmlGenerator(member);
generator.setUseExtraXml(false);
+ generator.setItemElemName("member", "");
+ generator.addItemAttribute("role", role);
generator.generateXML(state, parent, "");
logger.debug(String.format("Generated XML for member '%s' in %d ms.",
member.getFullName(),
@@ -287,6 +294,7 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
final long start = System.currentTimeMillis();
final XmlGenerator generator = new XmlGenerator(contact);
generator.setUseExtraXml(false);
+ generator.setItemElemName("contact", "");
generator.generateXML(state, parent, "");
logger.debug(String.format("Generated XML for contact '%s' in %d ms.",
contact.getName(),