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