Component zur Anzeige von Publikationen oder Projekten einer Person auf einer normalen Navigationsseite
git-svn-id: https://svn.libreccm.org/ccm/trunk@1890 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c9e969bb13
commit
c2056c4f7c
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||||
|
name="ccm-sci-types-personalpublicationsitem"
|
||||||
|
prettyName="PersonalPublicationsItem"
|
||||||
|
version="6.6.0"
|
||||||
|
release="1"
|
||||||
|
webapp="ROOT">
|
||||||
|
|
||||||
|
<ccm:dependencies>
|
||||||
|
<ccm:requires name="ccm-core" version="6.6.3" relation="ge"/>
|
||||||
|
<ccm:requires name="ccm-cms" version="6.6.7" relation="ge"/>
|
||||||
|
<ccm:requires name="ccm-cms-publicpersonalprofile" version="6.6.0" release="ge"/>
|
||||||
|
</ccm:dependencies>
|
||||||
|
|
||||||
|
<ccm:directories>
|
||||||
|
<ccm:directory name="src"/>
|
||||||
|
</ccm:directories>
|
||||||
|
|
||||||
|
<ccm:contacts>
|
||||||
|
<ccm:contact uri="http://www.scientificcms.org" type="website"/>
|
||||||
|
<ccm:contact uri="mailto:info@scientificcms.org" type="support"/>
|
||||||
|
</ccm:contacts>
|
||||||
|
<ccm:description>
|
||||||
|
Allows it to use the PersonalPublications content generator as navigation item.
|
||||||
|
</ccm:description>
|
||||||
|
|
||||||
|
</ccm:application>
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
This module provides component which allows it to use an implementation of
|
||||||
|
the content generator interface provided by the PublicPersonalProfile module
|
||||||
|
on an Navigation page.
|
||||||
|
|
||||||
|
Example usages are the components for publications and project lists in the
|
||||||
|
modules ccm-sci-personalpublications and ccm-sci-personalprojects.
|
||||||
|
|
||||||
|
To use the component create new JSP template like to following:
|
||||||
|
|
||||||
|
<jsp:root
|
||||||
|
xmlns:jsp="http://java.sun.com/JSP/Page"
|
||||||
|
xmlns:define="/WEB-INF/bebop-define.tld"
|
||||||
|
xmlns:show="/WEB-INF/bebop-show.tld"
|
||||||
|
version="1.2">
|
||||||
|
|
||||||
|
<jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/>
|
||||||
|
<jsp:directive.page import="com.arsdigita.bebop.parameters.BigDecimalParameter"/>
|
||||||
|
<jsp:directive.page import="com.arsdigita.navigation.Navigation"/>
|
||||||
|
<jsp:directive.page import="com.arsdigita.navigation.cms.CMSDataCollectionDefinition"/>
|
||||||
|
<jsp:directive.page import="com.arsdigita.navigation.cms.CMSDataCollectionRenderer"/>
|
||||||
|
<jsp:directive.page import="com.arsdigita.cms.publicpersonalprofile.PersonalPublications"/>
|
||||||
|
|
||||||
|
<jsp:scriptlet>
|
||||||
|
long age = Navigation.getConfig().getIndexPageCacheLifetime();
|
||||||
|
if (age == 0) {
|
||||||
|
DispatcherHelper.cacheDisable(response);
|
||||||
|
} else {
|
||||||
|
DispatcherHelper.cacheForWorld(response, (int)age);
|
||||||
|
}
|
||||||
|
</jsp:scriptlet>
|
||||||
|
|
||||||
|
<define:page name="defaultItemPage" application="PublicPersonalProfile"
|
||||||
|
title="Navigation" cache="true">
|
||||||
|
|
||||||
|
<define:component name="greetingItem"
|
||||||
|
classname="com.arsdigita.cms.publicpersonalprofile.ui.PersonalContentComponent"/>
|
||||||
|
<define:component name="categoryPath"
|
||||||
|
classname="com.arsdigita.navigation.ui.category.Path"/>
|
||||||
|
<define:component name="categoryMenu"
|
||||||
|
classname="com.arsdigita.navigation.ui.category.Menu"/>
|
||||||
|
<jsp:scriptlet>
|
||||||
|
((com.arsdigita.cms.publicpersonalprofile.ui.PersonalContentComponent) greetingItem).setGenerator(new PersonalPublications());
|
||||||
|
</jsp:scriptlet>
|
||||||
|
|
||||||
|
<define:component name="assignedTerms"
|
||||||
|
classname="com.arsdigita.navigation.ui.CategoryIndexAssignedTerms"/>
|
||||||
|
|
||||||
|
</define:page>
|
||||||
|
<show:all/>
|
||||||
|
</jsp:root>
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<registry>
|
||||||
|
<!-- Nothing -->
|
||||||
|
</registry>
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
<load>
|
||||||
|
<requires>
|
||||||
|
<table name="inits"/>
|
||||||
|
<table name="acs_objects"/>
|
||||||
|
<table name="cms_items"/>
|
||||||
|
<table name="ct_public_personal_profiles"/>
|
||||||
|
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||||
|
<initializer class="com.arsdigita.cms.publicpersonalprofile.PublicPersonalProfileInitializer"/>
|
||||||
|
<initializer class="com.arsdigita.cms.contenttypes.PublicPersonalProfileInitializer"/>
|
||||||
|
</requires>
|
||||||
|
</load>
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
package com.arsdigita.cms.publicpersonalprofile.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.cms.ContentBundle;
|
||||||
|
import com.arsdigita.cms.ContentItem;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||||
|
import com.arsdigita.cms.contenttypes.GenericPersonBundle;
|
||||||
|
import com.arsdigita.cms.publicpersonalprofile.ContentGenerator;
|
||||||
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.kernel.Party;
|
||||||
|
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
|
import com.arsdigita.navigation.ui.AbstractComponent;
|
||||||
|
import com.arsdigita.web.LoginSignal;
|
||||||
|
import com.arsdigita.xml.Element;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PersonalContentComponent extends AbstractComponent {
|
||||||
|
|
||||||
|
private ContentGenerator generator;
|
||||||
|
|
||||||
|
public ContentGenerator getGenerator() {
|
||||||
|
return generator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGenerator(final ContentGenerator generator) {
|
||||||
|
this.generator = generator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Element generateXML(final HttpServletRequest request, final HttpServletResponse response) {
|
||||||
|
ContentItem item = (ContentItem) getObject();
|
||||||
|
|
||||||
|
if (!(item instanceof GenericPersonBundle) || !(item.isLive())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ContentItem.LIVE.equals(item.getVersion())) {
|
||||||
|
item = item.getLiveVersion();
|
||||||
|
}
|
||||||
|
|
||||||
|
final Party currentParty;
|
||||||
|
if (Kernel.getContext().getParty() == null) {
|
||||||
|
currentParty = Kernel.getPublicUser();
|
||||||
|
} else {
|
||||||
|
currentParty = Kernel.getContext().getParty();
|
||||||
|
}
|
||||||
|
|
||||||
|
final PermissionDescriptor read = new PermissionDescriptor(
|
||||||
|
PrivilegeDescriptor.get(com.arsdigita.cms.SecurityManager.CMS_READ_ITEM),
|
||||||
|
item,
|
||||||
|
currentParty);
|
||||||
|
if (!PermissionService.checkPermission(read)) {
|
||||||
|
throw new LoginSignal(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
final ContentBundle bundle = (ContentBundle) item;
|
||||||
|
GenericPerson baseItem = (GenericPerson) bundle.getInstance(GlobalizationHelper.
|
||||||
|
getNegotiatedLocale().getLanguage());
|
||||||
|
if (baseItem == null) {
|
||||||
|
// get the primary instance instead (fallback)
|
||||||
|
baseItem = (GenericPerson) bundle.getPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
final Element parent = new Element("ppp:profile", "http://www.arsdigita.com/PublicPersonalProfile/1.0");
|
||||||
|
generator.generateContent(parent, baseItem, PageState.getPageState(), baseItem.getLanguage());
|
||||||
|
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -60,7 +60,6 @@ public class GreetingItem extends AbstractComponent {
|
||||||
|
|
||||||
public Element generateXML(HttpServletRequest request,
|
public Element generateXML(HttpServletRequest request,
|
||||||
HttpServletResponse response) {
|
HttpServletResponse response) {
|
||||||
long start = System.currentTimeMillis();
|
|
||||||
ContentItem item = (ContentItem) getObject();
|
ContentItem item = (ContentItem) getObject();
|
||||||
if (null == item || !item.isLive()) {
|
if (null == item || !item.isLive()) {
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -70,7 +69,6 @@ public class GreetingItem extends AbstractComponent {
|
||||||
item = item.getLiveVersion();
|
item = item.getLiveVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Element content = Navigation.newElement("greetingItem");
|
Element content = Navigation.newElement("greetingItem");
|
||||||
Party currentParty = Kernel.getContext().getParty();
|
Party currentParty = Kernel.getContext().getParty();
|
||||||
if (currentParty == null) {
|
if (currentParty == null) {
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ public class CustomizableObjectList extends ComplexObjectList {
|
||||||
//- They have to be registered very early, so we can't add new parameters
|
//- They have to be registered very early, so we can't add new parameters
|
||||||
// from a JSP.
|
// from a JSP.
|
||||||
//- The HttpRequest is available here.
|
//- The HttpRequest is available here.
|
||||||
//So we use the HTTP request directly, which allows use to use a
|
//So we use the HTTP request directly, which allows us to use a
|
||||||
//dedicated parameter for each of the filters.
|
//dedicated parameter for each of the filters.
|
||||||
/*
|
/*
|
||||||
* if (request.getCharacterEncoding() == null) {
|
* if (request.getCharacterEncoding() == null) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue