Verschiedene Bugfixes
git-svn-id: https://svn.libreccm.org/ccm/trunk@1263 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c1eb647a73
commit
ca7b771a11
|
|
@ -61,33 +61,33 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
|
||||
private static final long serialVersionUID = -1495852395804455609L;
|
||||
private static final Logger logger =
|
||||
Logger.getLogger(
|
||||
Logger.getLogger(
|
||||
PublicPersonalProfilesServlet.class);
|
||||
private static final String ADMIN = "admin";
|
||||
private static final String PREVIEW = "preview";
|
||||
private static final String PPP_NS =
|
||||
"http://www.arsdigita.com/PublicPersonalProfile/1.0";
|
||||
"http://www.arsdigita.com/PublicPersonalProfile/1.0";
|
||||
public static final String SELECTED_NAV_ITEM = "selectedNavItem";
|
||||
private final PublicPersonalProfileConfig config =
|
||||
PublicPersonalProfiles.getConfig();
|
||||
PublicPersonalProfiles.getConfig();
|
||||
|
||||
@Override
|
||||
protected void doService(final HttpServletRequest request,
|
||||
final HttpServletResponse response,
|
||||
final Application app) throws ServletException,
|
||||
IOException {
|
||||
final HttpServletResponse response,
|
||||
final Application app) throws ServletException,
|
||||
IOException {
|
||||
String path = "";
|
||||
|
||||
logger.debug("PublicPersonalProfileServlet is starting...");
|
||||
logger.debug(String.format("pathInfo = '%s'", request.getPathInfo()));
|
||||
|
||||
logger.debug("Extracting path from pathInfo by removing leading and "
|
||||
+ "trailing slashes...");
|
||||
+ "trailing slashes...");
|
||||
if (request.getPathInfo() != null) {
|
||||
if ("/".equals(request.getPathInfo())) {
|
||||
path = "";
|
||||
} else if (request.getPathInfo().startsWith("/")
|
||||
&& request.getPathInfo().endsWith("/")) {
|
||||
&& request.getPathInfo().endsWith("/")) {
|
||||
path = request.getPathInfo().substring(1, request.getPathInfo().
|
||||
length() - 1);
|
||||
} else if (request.getPathInfo().startsWith("/")) {
|
||||
|
|
@ -119,7 +119,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
|
||||
|
||||
page = PageFactory.buildPage("PublicPersonalProfile",
|
||||
"");
|
||||
"");
|
||||
|
||||
if (pathTokens.length < 1) {
|
||||
//ToDo: Fehlerbehandlung?
|
||||
|
|
@ -150,6 +150,11 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
}
|
||||
}
|
||||
|
||||
if (preview) {
|
||||
page.addRequestListener(
|
||||
new ApplicationAuthenticationListener());
|
||||
}
|
||||
|
||||
page.lock();
|
||||
|
||||
Document document = page.buildDocument(request, response);
|
||||
|
|
@ -158,16 +163,16 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
final Session session = SessionManager.getSession();
|
||||
|
||||
DataCollection profiles =
|
||||
session.retrieve(
|
||||
session.retrieve(
|
||||
com.arsdigita.cms.contenttypes.PublicPersonalProfile.BASE_DATA_OBJECT_TYPE);
|
||||
profiles.addFilter(String.format("profileUrl = '%s'",
|
||||
profileOwner));
|
||||
profileOwner));
|
||||
if (preview) {
|
||||
profiles.addFilter(String.format("version = '%s'",
|
||||
ContentItem.DRAFT));
|
||||
ContentItem.DRAFT));
|
||||
} else {
|
||||
profiles.addFilter(String.format("version = '%s'",
|
||||
ContentItem.LIVE));
|
||||
ContentItem.LIVE));
|
||||
}
|
||||
|
||||
if (profiles.size() == 0) {
|
||||
|
|
@ -178,17 +183,18 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
"More than one matching members found...");
|
||||
} else {
|
||||
final PageState state = new PageState(page,
|
||||
request,
|
||||
response);
|
||||
request,
|
||||
response);
|
||||
|
||||
profiles.next();
|
||||
PublicPersonalProfile profile =
|
||||
(PublicPersonalProfile) DomainObjectFactory.newInstance(profiles.getDataObject());
|
||||
(PublicPersonalProfile) DomainObjectFactory.
|
||||
newInstance(profiles.getDataObject());
|
||||
profiles.close();
|
||||
|
||||
if (config.getEmbedded()) {
|
||||
final ContentSection section =
|
||||
profile.getContentSection();
|
||||
profile.getContentSection();
|
||||
final ItemResolver resolver = section.getItemResolver();
|
||||
|
||||
String context;
|
||||
|
|
@ -198,10 +204,11 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
context = ContentItem.LIVE;
|
||||
}
|
||||
|
||||
final String url = String.format("/ccm%s", resolver.generateItemURL(state,
|
||||
profile,
|
||||
section,
|
||||
context));
|
||||
final String url = String.format("/ccm%s", resolver.
|
||||
generateItemURL(state,
|
||||
profile,
|
||||
section,
|
||||
context));
|
||||
|
||||
throw new RedirectSignal(url, false);
|
||||
}
|
||||
|
|
@ -217,98 +224,117 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
"ppp:ownerName", PPP_NS);
|
||||
profileOwnerName.setText(owner.getFullName());
|
||||
|
||||
final DataCollection images = ItemImageAttachment.getImageAttachments(profile);
|
||||
final DataCollection images = ItemImageAttachment.
|
||||
getImageAttachments(profile);
|
||||
if (!images.isEmpty()) {
|
||||
images.next();
|
||||
final Element profileImageElem = profileElem.newChildElement("ppp:profileImage",
|
||||
PPP_NS);
|
||||
final Element profileImageElem = profileElem.
|
||||
newChildElement("ppp:profileImage",
|
||||
PPP_NS);
|
||||
|
||||
final Element attachmentElem = profileImageElem.newChildElement("imageAttachments");
|
||||
final ItemImageAttachment attachment = new ItemImageAttachment(images.getDataObject());
|
||||
attachmentElem.addAttribute("oid", attachment.getOID().toString());
|
||||
final Element caption = attachmentElem.newChildElement("caption");
|
||||
final Element attachmentElem = profileImageElem.
|
||||
newChildElement("imageAttachments");
|
||||
final ItemImageAttachment attachment =
|
||||
new ItemImageAttachment(images.
|
||||
getDataObject());
|
||||
attachmentElem.addAttribute("oid", attachment.getOID().
|
||||
toString());
|
||||
final Element caption = attachmentElem.newChildElement(
|
||||
"caption");
|
||||
caption.setText(attachment.getCaption());
|
||||
final ReusableImageAsset image = attachment.getImage();
|
||||
final Element imageElem = attachmentElem.newChildElement("image");
|
||||
final Element imageElem =
|
||||
attachmentElem.newChildElement("image");
|
||||
imageElem.addAttribute("oid", image.getOID().toString());
|
||||
final Element widthElem = imageElem.newChildElement("width");
|
||||
final Element widthElem = imageElem.newChildElement(
|
||||
"width");
|
||||
widthElem.setText(image.getWidth().toString());
|
||||
final Element heightElem = imageElem.newChildElement("height");
|
||||
final Element heightElem = imageElem.newChildElement(
|
||||
"height");
|
||||
heightElem.setText(image.getHeight().toString());
|
||||
final Element descElem = imageElem.newChildElement("description");
|
||||
final Element descElem = imageElem.newChildElement(
|
||||
"description");
|
||||
descElem.setText(image.getDescription());
|
||||
final Element nameElem = imageElem.newChildElement("name");
|
||||
final Element nameElem = imageElem.newChildElement(
|
||||
"name");
|
||||
nameElem.setText(image.getName());
|
||||
final Element idElem = imageElem.newChildElement("id");
|
||||
idElem.setText(image.getID().toString());
|
||||
final Element displayNameElem = imageElem.newChildElement("displayName");
|
||||
final Element displayNameElem = imageElem.
|
||||
newChildElement("displayName");
|
||||
displayNameElem.setText(image.getDisplayName());
|
||||
|
||||
images.close();
|
||||
}
|
||||
|
||||
final PublicPersonalProfileXmlUtil util =
|
||||
new PublicPersonalProfileXmlUtil();
|
||||
new PublicPersonalProfileXmlUtil();
|
||||
String prefix =
|
||||
DispatcherHelper.getDispatcherPrefix(request);
|
||||
DispatcherHelper.getDispatcherPrefix(request);
|
||||
if (prefix == null) {
|
||||
prefix = "";
|
||||
}
|
||||
util.createNavigation(profile,
|
||||
root,
|
||||
navPath,
|
||||
prefix,
|
||||
app.getPath(),
|
||||
preview);
|
||||
root,
|
||||
navPath,
|
||||
prefix,
|
||||
app.getPath(),
|
||||
preview);
|
||||
|
||||
if (navPath == null) {
|
||||
final PublicPersonalProfileXmlGenerator generator =
|
||||
new PublicPersonalProfileXmlGenerator(
|
||||
new PublicPersonalProfileXmlGenerator(
|
||||
profile);
|
||||
generator.generateXML(state, root, "");
|
||||
|
||||
} else {
|
||||
if (itemPath == null) {
|
||||
final DataCollection links =
|
||||
RelatedLink.getRelatedLinks(profile,
|
||||
PublicPersonalProfile.LINK_LIST_NAME);
|
||||
RelatedLink.getRelatedLinks(
|
||||
profile,
|
||||
PublicPersonalProfile.LINK_LIST_NAME);
|
||||
links.addFilter(String.format("linkTitle = '%s'",
|
||||
navPath));
|
||||
navPath));
|
||||
|
||||
if (links.size() == 0) {
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
response.setStatus(
|
||||
HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
} else {
|
||||
if (config.getShowPersonInfoEverywhere()) {
|
||||
generateProfileOwnerXml(profileElem, owner,
|
||||
state);
|
||||
state);
|
||||
}
|
||||
|
||||
PublicPersonalProfileNavItemCollection navItems =
|
||||
new PublicPersonalProfileNavItemCollection();
|
||||
navItems.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
|
||||
new PublicPersonalProfileNavItemCollection();
|
||||
navItems.addLanguageFilter(GlobalizationHelper.
|
||||
getNegotiatedLocale().
|
||||
getLanguage());
|
||||
navItems.addKeyFilter(navPath);
|
||||
navItems.next();
|
||||
|
||||
if (navItems.getNavItem().getGeneratorClass()
|
||||
!= null) {
|
||||
!= null) {
|
||||
try {
|
||||
Object generatorObj =
|
||||
Class.forName(navItems.getNavItem().
|
||||
getGeneratorClass()).getConstructor().
|
||||
Class.forName(navItems.getNavItem().
|
||||
getGeneratorClass()).
|
||||
getConstructor().
|
||||
newInstance();
|
||||
|
||||
if (generatorObj instanceof ContentGenerator) {
|
||||
final ContentGenerator generator =
|
||||
(ContentGenerator) generatorObj;
|
||||
(ContentGenerator) generatorObj;
|
||||
|
||||
generator.generateContent(profileElem,
|
||||
owner,
|
||||
state);
|
||||
generator.generateContent(
|
||||
profileElem,
|
||||
owner,
|
||||
state);
|
||||
|
||||
} else {
|
||||
throw new ServletException(String.format(
|
||||
throw new ServletException(String.
|
||||
format(
|
||||
"Class '%s' is not a ContentGenerator.",
|
||||
navItems.getNavItem().
|
||||
getGeneratorClass()));
|
||||
|
|
@ -337,15 +363,17 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
|
||||
links.next();
|
||||
final RelatedLink link =
|
||||
(RelatedLink) DomainObjectFactory.newInstance(links.getDataObject());
|
||||
(RelatedLink) DomainObjectFactory.
|
||||
newInstance(links.getDataObject());
|
||||
links.close();
|
||||
final ContentItem item = link.getTargetItem();
|
||||
final ContentItem item =
|
||||
link.getTargetItem();
|
||||
final PublicPersonalProfileXmlGenerator generator =
|
||||
new PublicPersonalProfileXmlGenerator(
|
||||
new PublicPersonalProfileXmlGenerator(
|
||||
item);
|
||||
generator.generateXML(state,
|
||||
root,
|
||||
"");
|
||||
root,
|
||||
"");
|
||||
}
|
||||
|
||||
navItems.close();
|
||||
|
|
@ -353,15 +381,17 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
} else {
|
||||
if (config.getShowPersonInfoEverywhere()) {
|
||||
generateProfileOwnerXml(profileElem, owner,
|
||||
state);
|
||||
state);
|
||||
}
|
||||
|
||||
final OID itemOid = OID.valueOf(itemPath);
|
||||
try {
|
||||
final ContentItem item = (ContentItem) DomainObjectFactory.newInstance(itemOid);
|
||||
final ContentItem item =
|
||||
(ContentItem) DomainObjectFactory.
|
||||
newInstance(itemOid);
|
||||
|
||||
final PublicPersonalProfileXmlGenerator generator =
|
||||
new PublicPersonalProfileXmlGenerator(
|
||||
new PublicPersonalProfileXmlGenerator(
|
||||
item);
|
||||
generator.generateXML(state, root, "");
|
||||
|
||||
|
|
@ -369,8 +399,9 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
logger.error(String.format(
|
||||
"Item '%s' not found: ",
|
||||
itemPath),
|
||||
ex);
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
ex);
|
||||
response.setStatus(
|
||||
HttpServletResponse.SC_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -378,7 +409,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
}
|
||||
}
|
||||
|
||||
PresentationManager presentationManager = Templating.getPresentationManager();
|
||||
PresentationManager presentationManager = Templating.
|
||||
getPresentationManager();
|
||||
presentationManager.servePage(document, request, response);
|
||||
}
|
||||
|
||||
|
|
@ -387,29 +419,29 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
}
|
||||
|
||||
private void generateProfileOwnerXml(final Element profileElem,
|
||||
final GenericPerson owner,
|
||||
final PageState state) {
|
||||
final GenericPerson owner,
|
||||
final PageState state) {
|
||||
Element profileOwnerElem = profileElem.newChildElement(
|
||||
"profileOwner");
|
||||
if ((owner.getSurname() != null)
|
||||
&& !owner.getSurname().trim().isEmpty()) {
|
||||
&& !owner.getSurname().trim().isEmpty()) {
|
||||
Element surname =
|
||||
profileOwnerElem.newChildElement("surname");
|
||||
surname.setText(owner.getSurname());
|
||||
}
|
||||
if ((owner.getGivenName() != null)
|
||||
&& !owner.getGivenName().trim().isEmpty()) {
|
||||
&& !owner.getGivenName().trim().isEmpty()) {
|
||||
Element givenName = profileOwnerElem.newChildElement(
|
||||
"givenName");
|
||||
givenName.setText(owner.getGivenName());
|
||||
}
|
||||
if ((owner.getTitlePre() != null)
|
||||
&& !owner.getTitlePre().trim().isEmpty()) {
|
||||
&& !owner.getTitlePre().trim().isEmpty()) {
|
||||
Element titlePre = profileOwnerElem.newChildElement("titlePre");
|
||||
titlePre.setText(owner.getTitlePre());
|
||||
}
|
||||
if ((owner.getTitlePost() != null)
|
||||
&& !owner.getTitlePost().trim().isEmpty()) {
|
||||
&& !owner.getTitlePost().trim().isEmpty()) {
|
||||
Element titlePost = profileOwnerElem.newChildElement(
|
||||
"titlePost");
|
||||
titlePost.setText(owner.getTitlePost());
|
||||
|
|
@ -421,8 +453,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
if (contacts.size() > 0) {
|
||||
contacts.next();
|
||||
generateContactXml(profileOwnerElem,
|
||||
contacts.getContact(),
|
||||
state);
|
||||
contacts.getContact(),
|
||||
state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -441,13 +473,13 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
}
|
||||
|
||||
private void generateContactXml(final Element profileOwnerElem,
|
||||
final GenericContact contact,
|
||||
final PageState state) {
|
||||
final GenericContact contact,
|
||||
final PageState state) {
|
||||
final Element contactElem = profileOwnerElem.newChildElement("contact");
|
||||
final Element entriesElem = contactElem.newChildElement("entries");
|
||||
|
||||
final GenericContactEntryCollection entries =
|
||||
contact.getContactEntries();
|
||||
contact.getContactEntries();
|
||||
Element entryElem;
|
||||
GenericContactEntry entry;
|
||||
while (entries.next()) {
|
||||
|
|
@ -483,8 +515,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
}
|
||||
|
||||
private void showAdminPage(final Page page,
|
||||
final HttpServletRequest request,
|
||||
final HttpServletResponse response)
|
||||
final HttpServletRequest request,
|
||||
final HttpServletResponse response)
|
||||
throws ServletException {
|
||||
|
||||
page.addRequestListener(new ApplicationAuthenticationListener());
|
||||
|
|
@ -496,7 +528,7 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
final StringParameter navItemKeyParam = new StringParameter(
|
||||
"selectedNavItem");
|
||||
final ParameterSingleSelectionModel navItemSelect =
|
||||
new ParameterSingleSelectionModel(
|
||||
new ParameterSingleSelectionModel(
|
||||
navItemKeyParam);
|
||||
|
||||
page.addGlobalStateParam(navItemKeyParam);
|
||||
|
|
@ -505,10 +537,10 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
final FormSection tableSection = new FormSection(box);
|
||||
|
||||
final PublicPersonalProfileNavItemsAddForm addForm =
|
||||
new PublicPersonalProfileNavItemsAddForm(
|
||||
new PublicPersonalProfileNavItemsAddForm(
|
||||
navItemSelect);
|
||||
final PublicPersonalProfileNavItemsTable table =
|
||||
new PublicPersonalProfileNavItemsTable(
|
||||
new PublicPersonalProfileNavItemsTable(
|
||||
navItemSelect);
|
||||
|
||||
box.add(table);
|
||||
|
|
@ -521,7 +553,8 @@ public class PublicPersonalProfilesServlet extends BaseApplicationServlet {
|
|||
|
||||
final Document document = page.buildDocument(request, response);
|
||||
|
||||
final PresentationManager presentationManager = Templating.getPresentationManager();
|
||||
final PresentationManager presentationManager = Templating.
|
||||
getPresentationManager();
|
||||
presentationManager.servePage(document, request, response);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,11 @@ public class Paginator {
|
|||
logger.debug(String.format("Applying limits: %d, %d",
|
||||
getBegin(),
|
||||
getEnd()));
|
||||
query.setRange(getBegin(), getEnd());
|
||||
if (getBegin() == getEnd()) {
|
||||
query.setRange(getBegin(), getEnd() + 1);
|
||||
} else {
|
||||
query.setRange(getBegin(), getEnd());
|
||||
}
|
||||
}
|
||||
|
||||
public int getPageCount() {
|
||||
|
|
|
|||
|
|
@ -354,8 +354,10 @@ public class DomainObjectXMLRenderer extends DomainObjectTraversal {
|
|||
// Add attributes for date and time
|
||||
Locale negLocale = com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale();
|
||||
DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM, negLocale);
|
||||
DateFormat longDateFormatter = DateFormat.getDateInstance(DateFormat.LONG, negLocale);
|
||||
DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, negLocale);
|
||||
element.addAttribute("date", dateFormatter.format(date));
|
||||
element.addAttribute("longDate", longDateFormatter.format(date));
|
||||
element.addAttribute("time", timeFormatter.format(date));
|
||||
// Quasimodo: END
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@ import com.arsdigita.cms.contenttypes.ui.PublicationXmlHelper;
|
|||
import com.arsdigita.cms.contenttypes.ui.panels.Paginator;
|
||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
import com.arsdigita.persistence.Filter;
|
||||
import com.arsdigita.persistence.FilterFactory;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.xml.Element;
|
||||
|
|
@ -193,6 +197,18 @@ public class PersonalPublications implements ContentGenerator {
|
|||
final boolean addOrders) {
|
||||
query.addFilter(String.format("authorId = %s",
|
||||
person.getID().toString()));
|
||||
/*if (Kernel.getConfig().languageIndependentItems()) {
|
||||
FilterFactory ff = query.getFilterFactory();
|
||||
Filter filter = ff.or().
|
||||
addFilter(ff.equals("language", com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale().getLanguage())).
|
||||
addFilter(ff.and().
|
||||
addFilter(ff.equals("language", GlobalizationHelper.LANG_INDEPENDENT)).
|
||||
addFilter(ff.notIn("parent", "com.arsdigita.navigation.getParentIDsOfMatchedItems")
|
||||
.set("language", com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale().getLanguage())));
|
||||
query.addFilter(filter);
|
||||
} else {*/
|
||||
query.addEqualsFilter("language", com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale().getLanguage());
|
||||
//}
|
||||
if (addOrders) {
|
||||
final String[] orders = config.getOrder().split(",");
|
||||
for (String order : orders) {
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ query getIdsOfPublicationsForOrgaUnitOneRowPerAuthor {
|
|||
Integer year;
|
||||
String authorSurname;
|
||||
String authorGivenname;
|
||||
String language;
|
||||
|
||||
do {
|
||||
select cms_pages.item_id,
|
||||
|
|
@ -97,7 +98,8 @@ query getIdsOfPublicationsForOrgaUnitOneRowPerAuthor {
|
|||
cms_organizationalunits.organizationalunit_id,
|
||||
ct_publications.year,
|
||||
cms_persons.surname,
|
||||
cms_persons.givenname
|
||||
cms_persons.givenname,
|
||||
cms_items.language
|
||||
from cms_pages
|
||||
join ct_publications on cms_pages.item_id = ct_publications.publication_id
|
||||
join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
|
||||
|
|
@ -105,6 +107,7 @@ query getIdsOfPublicationsForOrgaUnitOneRowPerAuthor {
|
|||
join cms_organizationalunits_publications_map on cms_pages.item_id = cms_organizationalunits_publications_map.publication_id
|
||||
join cms_organizationalunits on cms_organizationalunits_publications_map.orgaunit_id = cms_organizationalunits.organizationalunit_id
|
||||
join acs_objects on cms_pages.item_id = acs_objects.object_id
|
||||
join cms_items on cms_items.item_id = cms_pages.item_id;
|
||||
} map {
|
||||
publicationId = cms_pages.item_id;
|
||||
objectType = acs_objects.object_type;
|
||||
|
|
@ -113,6 +116,7 @@ query getIdsOfPublicationsForOrgaUnitOneRowPerAuthor {
|
|||
year = ct_publications.year;
|
||||
authorSurname = cms_persons.surname;
|
||||
authorGivenname = cms_persons.givenname;
|
||||
language = cms_items.item_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,6 +130,7 @@ query getIdsOfPublicationsForOrgaUnit {
|
|||
String title;
|
||||
Integer year;
|
||||
String authors;
|
||||
String language;
|
||||
|
||||
do {
|
||||
select cms_pages.item_id,
|
||||
|
|
@ -133,22 +138,21 @@ query getIdsOfPublicationsForOrgaUnit {
|
|||
cms_pages.title,
|
||||
cms_organizationalunits.organizationalunit_id,
|
||||
ct_publications.year,
|
||||
(select 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 = cms_pages.item_id), '; ')) as authors
|
||||
ct_publications.authors
|
||||
cms_items.language
|
||||
from cms_pages
|
||||
join ct_publications on cms_pages.item_id = ct_publications.publication_id
|
||||
join cms_organizationalunits_publications_map on cms_pages.item_id = cms_organizationalunits_publications_map.publication_id
|
||||
join cms_organizationalunits on cms_organizationalunits_publications_map.orgaunit_id = cms_organizationalunits.organizationalunit_id
|
||||
join cms_organizationalunits on cms_organizationalunits_publications_map.orgaunit_id = cms_organizationalunits.organizationalunit_id
|
||||
join acs_objects on cms_pages.item_id = acs_objects.object_id
|
||||
join cms_items on cms_pages.item_id = cms_items.item_id
|
||||
} map {
|
||||
publicationId = cms_pages.item_id;
|
||||
objectType = acs_objects.object_type;
|
||||
orgaunitId = cms_organizationalunits.organizationalunit_id;
|
||||
title = cms_pages.title;
|
||||
year = ct_publications.year;
|
||||
authors = authors;
|
||||
year = ct_publications.year;
|
||||
authors = ct_publications.authors;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,6 +163,7 @@ query getPublicationsForAuthor {
|
|||
String objectType;
|
||||
String title;
|
||||
Integer year;
|
||||
String language;
|
||||
Boolean reviewed;
|
||||
|
||||
do {
|
||||
|
|
@ -167,10 +172,12 @@ query getPublicationsForAuthor {
|
|||
cms_pages.title,
|
||||
ct_publications_authorship.person_id,
|
||||
ct_publications.year,
|
||||
cms_items.language,
|
||||
ct_publications.reviewed
|
||||
from cms_pages
|
||||
join ct_publications on cms_pages.item_id = ct_publications.publication_id
|
||||
join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
|
||||
join cms_items on cms_pages.item_id = cms_items.item_id
|
||||
join acs_objects on cms_pages.item_id = acs_objects.object_id
|
||||
} map {
|
||||
publicationId = cms_pages.item_id;
|
||||
|
|
@ -178,6 +185,7 @@ query getPublicationsForAuthor {
|
|||
authorId = ct_publications_authorship.person_id;
|
||||
title = cms_pages.title;
|
||||
year = ct_publications.year;
|
||||
language = ct_items.language;
|
||||
reviewed = ct_publications.reviewed;
|
||||
}
|
||||
}
|
||||
|
|
@ -190,6 +198,7 @@ query getPublicationsForAuthorWithAuthors {
|
|||
String title;
|
||||
Integer year;
|
||||
String authors;
|
||||
String language;
|
||||
Boolean reviewed;
|
||||
|
||||
do {
|
||||
|
|
@ -207,6 +216,7 @@ query getPublicationsForAuthorWithAuthors {
|
|||
from cms_pages
|
||||
join ct_publications on cms_pages.item_id = ct_publications.publication_id
|
||||
join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
|
||||
join cms_items on cms_pages.item_id = cms_items.item_id
|
||||
join acs_objects on cms_pages.item_id = acs_objects.object_id
|
||||
} map {
|
||||
publicationId = cms_pages.item_id;
|
||||
|
|
@ -215,6 +225,7 @@ query getPublicationsForAuthorWithAuthors {
|
|||
title = cms_pages.title;
|
||||
year = ct_publications.year;
|
||||
authors = ct_publications.authors;
|
||||
language = ct_items.language;
|
||||
reviewed = ct_publications.reviewed;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,8 +234,8 @@ public class PublicationXmlHelper {
|
|||
final ArticleInCollectedVolume article =
|
||||
(ArticleInCollectedVolume) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "pageFrom", article.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pageTo", article.getPagesTo());
|
||||
generateXmlElement(publicationElem, "pagesFrom", article.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pagesTo", article.getPagesTo());
|
||||
generateXmlElement(publicationElem, "chapter", article.getChapter());
|
||||
generateXmlElement(publicationElem, "reviewed", article.getReviewed());
|
||||
generateCollectedVolumeLinkXml(publicationElem, article);
|
||||
|
|
@ -261,8 +261,8 @@ public class PublicationXmlHelper {
|
|||
|
||||
generateXmlElement(publicationElem, "volume", article.getVolume());
|
||||
generateXmlElement(publicationElem, "issue", article.getIssue());
|
||||
generateXmlElement(publicationElem, "pageFrom", article.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pageTo", article.getPagesTo());
|
||||
generateXmlElement(publicationElem, "pagesFrom", article.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pagesTo", article.getPagesTo());
|
||||
generateXmlElement(publicationElem, "reviewed", article.getReviewed());
|
||||
|
||||
generateJournalLinkXml(publicationElem, article);
|
||||
|
|
@ -309,15 +309,15 @@ public class PublicationXmlHelper {
|
|||
private void generateGreyLiteratureXml(final Element publicationElem) {
|
||||
GreyLiterature grey = (GreyLiterature) publication;
|
||||
|
||||
generateXmlElement(publicationElem, "pageFrom", grey.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pageTo", grey.getPagesTo());
|
||||
generateXmlElement(publicationElem, "pagesFrom", grey.getPagesFrom());
|
||||
generateXmlElement(publicationElem, "pagesTo", grey.getPagesTo());
|
||||
}
|
||||
|
||||
private void generateInProceedingsXml(final Element publicationElem) {
|
||||
InProceedings inProceedings = (InProceedings) publication;
|
||||
|
||||
generateXmlElement(publicationElem,
|
||||
"pageFrom",
|
||||
"pagesFrom",
|
||||
inProceedings.getPagesFrom());
|
||||
generateXmlElement(publicationElem,
|
||||
"pagesTo",
|
||||
|
|
|
|||
|
|
@ -11,12 +11,16 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSuperiorCollectio
|
|||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciProject;
|
||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.persistence.DataQuery;
|
||||
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;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -95,14 +99,30 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
|||
|
||||
if ((project.getBegin() != null) || (project.getEnd() != null)) {
|
||||
final Element lifeSpanElem = parent.newChildElement("lifeSpan");
|
||||
final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
if (project.getBegin() != null) {
|
||||
lifeSpanElem.addAttribute("begin",
|
||||
dateFormat.format(project.getBegin()));
|
||||
final Element beginElem = lifeSpanElem.newChildElement("begin");
|
||||
addDateAttributes(beginElem, project.getBegin());
|
||||
|
||||
final Element beginSkipMonthElem = lifeSpanElem.newChildElement(
|
||||
"beginSkipMonth");
|
||||
beginSkipMonthElem.setText(project.getBeginSkipMonth().toString());
|
||||
|
||||
final Element beginSkipDayElem = lifeSpanElem.newChildElement(
|
||||
"beginSkipDay");
|
||||
beginSkipDayElem.setText(project.getBeginSkipDay().toString());
|
||||
}
|
||||
if (project.getEnd() != null) {
|
||||
lifeSpanElem.addAttribute("end",
|
||||
dateFormat.format(project.getEnd()));
|
||||
if (project.getEnd() != null) {
|
||||
final Element endElem = lifeSpanElem.newChildElement("end");
|
||||
addDateAttributes(endElem, project.getEnd());
|
||||
|
||||
final Element endSkipMonthElem = lifeSpanElem.newChildElement(
|
||||
"endSkipMonth");
|
||||
endSkipMonthElem.setText(project.getEndSkipMonth().toString());
|
||||
|
||||
final Element endSkipDayElem = lifeSpanElem.newChildElement(
|
||||
"endSkipDay");
|
||||
endSkipDayElem.setText(project.getEndSkipDay().toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -118,6 +138,41 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab {
|
|||
System.currentTimeMillis() - start));
|
||||
}
|
||||
|
||||
private void addDateAttributes(final Element elem, final Date date) {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
|
||||
elem.addAttribute("year",
|
||||
Integer.toString(cal.get(
|
||||
Calendar.YEAR)));
|
||||
elem.addAttribute("month",
|
||||
Integer.toString(cal.get(
|
||||
Calendar.MONTH) + 1));
|
||||
elem.addAttribute("day",
|
||||
Integer.toString(cal.get(
|
||||
Calendar.DAY_OF_MONTH)));
|
||||
elem.addAttribute("hour",
|
||||
Integer.toString(cal.get(
|
||||
Calendar.HOUR_OF_DAY)));
|
||||
elem.addAttribute("minute",
|
||||
Integer.toString(cal.get(
|
||||
Calendar.MINUTE)));
|
||||
elem.addAttribute("second",
|
||||
Integer.toString(cal.get(
|
||||
Calendar.SECOND)));
|
||||
|
||||
final Locale negLocale = GlobalizationHelper.getNegotiatedLocale();
|
||||
final DateFormat dateFormat = DateFormat.getDateInstance(
|
||||
DateFormat.MEDIUM, negLocale);
|
||||
final DateFormat longDateFormat = DateFormat.getDateInstance(
|
||||
DateFormat.LONG, negLocale);
|
||||
final DateFormat timeFormat = DateFormat.getDateInstance(
|
||||
DateFormat.SHORT, negLocale);
|
||||
elem.addAttribute("date", dateFormat.format(date));
|
||||
elem.addAttribute("longDate", longDateFormat.format(date));
|
||||
elem.addAttribute("time", timeFormat.format(date));
|
||||
}
|
||||
|
||||
protected void generateMembersXml(final SciProject project,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue