PublicationsPersons finished.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2647 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-05-23 08:58:35 +00:00
parent 6b0caaff4e
commit 3683f0e511
15 changed files with 711 additions and 533 deletions

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<ddenums>
<ddenum name="publications_persons_relations">
<entry key="interview" lang="en">
<value>Interview</value>
</entry>
</ddenum>
<ddenum name="publications_persons_relations">
<entry key="interview" lang="de">
<value>Interview</value>
</entry>
</ddenum>
<ddenum name="publications_persons_relations">
<entry key="character" lang="en">
<value>Character</value>
</entry>
</ddenum>
<ddenum name="publications_persons_relations">
<entry key="character" lang="de">
<value>Charakter</value>
</entry>
</ddenum>
</ddenums>

View File

@ -18,6 +18,8 @@
*/ */
package com.arsdigita.cms.contentassets; package com.arsdigita.cms.contentassets;
import com.arsdigita.cms.RelationAttribute;
import com.arsdigita.cms.RelationAttributeImportTool;
import com.arsdigita.loader.PackageLoader; import com.arsdigita.loader.PackageLoader;
import com.arsdigita.runtime.ScriptContext; import com.arsdigita.runtime.ScriptContext;
@ -30,7 +32,9 @@ public class SciPublicationsPersonsLoader extends PackageLoader {
@Override @Override
public void run(final ScriptContext ctx) { public void run(final ScriptContext ctx) {
//Nothing
final RelationAttributeImportTool importTool = new RelationAttributeImportTool();
importTool.loadData("WEB-INF/resources/publications_persons_relations.xml");
} }
} }

View File

@ -11,3 +11,4 @@ com.arsdigita.cms.contentassets.publications_persons.person=Person
com.arsdigita.cms.contentassets.publications_persons.person.relation=Relation com.arsdigita.cms.contentassets.publications_persons.person.relation=Relation
com.arsdigita.cms.contentassets.publications_persons.person.remove=Remove com.arsdigita.cms.contentassets.publications_persons.person.remove=Remove
com.arsdigita.cms.contentassets.publications_persons.person.remove.confirm=Are you sure to remove the relation to the selected person? com.arsdigita.cms.contentassets.publications_persons.person.remove.confirm=Are you sure to remove the relation to the selected person?
com.arsdigita.cms.contentassets.publications_persons.person_add=Add person

View File

@ -11,3 +11,4 @@ com.arsdigita.cms.contentassets.publications_persons.person=Person
com.arsdigita.cms.contentassets.publications_persons.person.relation=Beziehung com.arsdigita.cms.contentassets.publications_persons.person.relation=Beziehung
com.arsdigita.cms.contentassets.publications_persons.person.remove=Entfernen com.arsdigita.cms.contentassets.publications_persons.person.remove=Entfernen
com.arsdigita.cms.contentassets.publications_persons.person.remove.confirm=Sie sie sicher das Sie die Beziehung mit der ausgew\u00e4hlten Person l\u00f6schen wollen? com.arsdigita.cms.contentassets.publications_persons.person.remove.confirm=Sie sie sicher das Sie die Beziehung mit der ausgew\u00e4hlten Person l\u00f6schen wollen?
com.arsdigita.cms.contentassets.publications_persons.person_add=Person hinzuf\u00fcgen

View File

@ -36,6 +36,7 @@ public class SciPublicationsPersonsService {
public static final String PERSONS = "persons"; public static final String PERSONS = "persons";
public static final String PUBLICATIONS = "publications"; public static final String PUBLICATIONS = "publications";
public static final String RELATION = "relation"; public static final String RELATION = "relation";
public static final String RELATION_ATTRIBUTE = "publications_persons_relations";
private static final String PUBLICATIONS_PERSONS = "publicationsPersons"; private static final String PUBLICATIONS_PERSONS = "publicationsPersons";
private static final String PERSONS_PUBLICATIONS = "personsPublications"; private static final String PERSONS_PUBLICATIONS = "personsPublications";

View File

@ -22,11 +22,13 @@ import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ExtraXMLGenerator; import com.arsdigita.cms.ExtraXMLGenerator;
import com.arsdigita.cms.RelationAttributeCollection;
import com.arsdigita.cms.contentassets.SciPublicationsPersonsPersonCollection; import com.arsdigita.cms.contentassets.SciPublicationsPersonsPersonCollection;
import com.arsdigita.cms.contentassets.SciPublicationsPersonsService; import com.arsdigita.cms.contentassets.SciPublicationsPersonsService;
import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
/** /**
@ -59,7 +61,7 @@ public class SciPublicationsPersonsExtraXMLGenerator implements ExtraXMLGenerato
final SciPublicationsPersonsService service = new SciPublicationsPersonsService(); final SciPublicationsPersonsService service = new SciPublicationsPersonsService();
final SciPublicationsPersonsPersonCollection persons = service.getPersons(publication); final SciPublicationsPersonsPersonCollection persons = service.getPersons(publication);
if ((persons != null) && !persons.isEmpty()) { if ((persons != null) && !persons.isEmpty()) {
final Element personsElem = element.newChildElement("persons"); final Element personsElem = element.newChildElement("relatedPersons");
while (persons.next()) { while (persons.next()) {
addPerson(personsElem, persons.getPerson(), persons.getRelation(), state); addPerson(personsElem, persons.getPerson(), persons.getRelation(), state);
@ -75,7 +77,17 @@ public class SciPublicationsPersonsExtraXMLGenerator implements ExtraXMLGenerato
final XmlGenerator generator = new XmlGenerator(person); final XmlGenerator generator = new XmlGenerator(person);
generator.setItemElemName("person", ""); generator.setItemElemName("person", "");
final RelationAttributeCollection relations = new RelationAttributeCollection(
SciPublicationsPersonsService.RELATION_ATTRIBUTE);
relations.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage());
relations.addKeyFilter(relation);
if (relations.isEmpty()) {
generator.addItemAttribute("relation", relation); generator.addItemAttribute("relation", relation);
} else {
relations.next();
generator.addItemAttribute("relation", relations.getName());
relations.close();
}
generator.setListMode(true); generator.setListMode(true);
generator.generateXML(state, parent, ""); generator.generateXML(state, parent, "");

View File

@ -80,7 +80,7 @@ public class SciPublicationsPersonsPersonForm extends BasicItemForm {
relationSelect.addOption(new Option("", new Label(ContenttypesGlobalizationUtil.globalize( relationSelect.addOption(new Option("", new Label(ContenttypesGlobalizationUtil.globalize(
"cms.ui.select_one")))); "cms.ui.select_one"))));
final RelationAttributeCollection relations = new RelationAttributeCollection( final RelationAttributeCollection relations = new RelationAttributeCollection(
"publications_persons_relations"); SciPublicationsPersonsService.RELATION_ATTRIBUTE);
relations.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage()); relations.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage());
while (relations.next()) { while (relations.next()) {
RelationAttribute relation; RelationAttribute relation;

View File

@ -34,12 +34,15 @@ import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.RelationAttribute;
import com.arsdigita.cms.RelationAttributeCollection;
import com.arsdigita.cms.contentassets.SciPublicationsPersonsPersonCollection; import com.arsdigita.cms.contentassets.SciPublicationsPersonsPersonCollection;
import com.arsdigita.cms.contentassets.SciPublicationsPersonsService; import com.arsdigita.cms.contentassets.SciPublicationsPersonsService;
import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.globalization.GlobalizedMessage; import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -190,7 +193,7 @@ public class SciPublicationsPersonsPersonTable extends Table implements TableAct
final boolean canEdit = securityManager.canAccess( final boolean canEdit = securityManager.canAccess(
state.getRequest(), state.getRequest(),
"com.arsdigita.cms.SecurityManager.EDIT_ITEM", com.arsdigita.cms.SecurityManager.EDIT_ITEM,
publication); publication);
if (canEdit) { if (canEdit) {
@ -229,8 +232,22 @@ public class SciPublicationsPersonsPersonTable extends Table implements TableAct
final int row, final int row,
final int column) { final int column) {
return new Label(value.toString()); final String relation = (String) value;
final RelationAttributeCollection relations = new RelationAttributeCollection(
SciPublicationsPersonsService.RELATION_ATTRIBUTE,
relation);
relations.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage());
if (relations.isEmpty()) {
return new Label(relation);
} else {
relations.next();
final String label = relations.getName();
relations.close();
return new Label(label);
}
//return new Label(value.toString());
} }
} }

View File

@ -1,3 +1,4 @@
\ com.arsdigita.cms.contentassets.publicationtypes.label\ =Also published as \ com.arsdigita.cms.contentassets.publicationtypes.label\ =Also published as
scipublications.publication_type_asset.none=No publication types found scipublications.publication_type_asset.none=No publication types found
com.arsdigita.cms.contentassets.publicationtypes.label=Type of publication

View File

@ -1,3 +1,4 @@
\ com.arsdigita.cms.contentassets.publicationtypes.label\ =Auch ver\u00f6ffentlicht als \ com.arsdigita.cms.contentassets.publicationtypes.label\ =Auch ver\u00f6ffentlicht als
scipublications.publication_type_asset.none=Noch keine Publikationsarten definiert scipublications.publication_type_asset.none=Noch keine Publikationsarten definiert
com.arsdigita.cms.contentassets.publicationtypes.label=Typ der Publikation

View File

@ -231,7 +231,8 @@ Setting up global templates like getStaticText and getSetting
<xsl:template name="mandalay:getColorset"> <xsl:template name="mandalay:getColorset">
<xsl:for-each select="$resultTree/nav:categoryMenu/nav:category/nav:category"> <xsl:for-each select="$resultTree/nav:categoryMenu/nav:category/nav:category">
<xsl:if test="@isSelected = 'true'"> <xsl:if test="@isSelected = 'true'">
<xsl:text>colorset_</xsl:text><xsl:value-of select="position()"/> <xsl:text>colorset_</xsl:text>
<xsl:value-of select="position()"/>
</xsl:if> </xsl:if>
</xsl:for-each> </xsl:for-each>
</xsl:template> </xsl:template>
@ -393,7 +394,7 @@ Setting up global templates like getStaticText and getSetting
<!-- EN Process all attributes --> <!-- EN Process all attributes -->
<xsl:template name="mandalay:processAttributes"> <xsl:template name="mandalay:processAttributes">
<xsl:for-each select="@*"> <xsl:for-each select="@*">
<xsl:if test="name()!='href_no_javascript'"> <xsl:if test="name() != 'href_no_javascript'">
<xsl:attribute name="{name()}"> <xsl:attribute name="{name()}">
<xsl:value-of select="."/> <xsl:value-of select="."/>
</xsl:attribute> </xsl:attribute>
@ -412,11 +413,19 @@ Setting up global templates like getStaticText and getSetting
<span class="moveButton"> <span class="moveButton">
<xsl:if test="@prevURL"> <xsl:if test="@prevURL">
<a> <a>
<xsl:attribute name="href"><xsl:value-of select="./@prevURL"/></xsl:attribute> <xsl:attribute name="href">
<xsl:attribute name="title"><xsl:value-of select="'moveUp'"/></xsl:attribute> <xsl:value-of select="./@prevURL"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="'moveUp'"/>
</xsl:attribute>
<img> <img>
<xsl:attribute name="src"><xsl:value-of select="'/assets/gray-triangle-up.gif'"/></xsl:attribute> <xsl:attribute name="src">
<xsl:attribute name="title"><xsl:value-of select="'moveUp'"/></xsl:attribute> <xsl:value-of select="'/assets/gray-triangle-up.gif'"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="'moveUp'"/>
</xsl:attribute>
</img> </img>
</a> </a>
</xsl:if> </xsl:if>
@ -424,11 +433,19 @@ Setting up global templates like getStaticText and getSetting
<span class="moveButton"> <span class="moveButton">
<xsl:if test="@nextURL"> <xsl:if test="@nextURL">
<a> <a>
<xsl:attribute name="href"><xsl:value-of select="./@nextURL"/></xsl:attribute> <xsl:attribute name="href">
<xsl:attribute name="title"><xsl:value-of select="'moveDown'"/></xsl:attribute> <xsl:value-of select="./@nextURL"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="'moveDown'"/>
</xsl:attribute>
<img> <img>
<xsl:attribute name="src"><xsl:value-of select="'/assets/gray-triangle-down.gif'"/></xsl:attribute> <xsl:attribute name="src">
<xsl:attribute name="title"><xsl:value-of select="'moveDown'"/></xsl:attribute> <xsl:value-of select="'/assets/gray-triangle-down.gif'"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="'moveDown'"/>
</xsl:attribute>
</img> </img>
</a> </a>
</xsl:if> </xsl:if>

View File

@ -83,6 +83,7 @@
<useEditLink/> <useEditLink/>
<showDiscussedPublications/> <showDiscussedPublications/>
<showDiscussingPublications/> <showDiscussingPublications/>
<showPublicationRelatedPersons/>
</showContent> </showContent>
</div> </div>

View File

@ -117,6 +117,10 @@
<xsl:call-template name="showDiscussingPublications"/> <xsl:call-template name="showDiscussingPublications"/>
</xsl:template> </xsl:template>
<xsl:template match="showPublicationRelatedPersons">
<xsl:call-template name="showPublicationRelatedPersons"/>
</xsl:template>
<xsl:template match="showPPPOwnerName"> <xsl:template match="showPPPOwnerName">
<xsl:apply-templates select="$resultTree//ppp:ownerName"/> <xsl:apply-templates select="$resultTree//ppp:ownerName"/>
</xsl:template> </xsl:template>

View File

@ -34,6 +34,7 @@
<xsl:import href="SciPublications/formatParser.xsl"/> <xsl:import href="SciPublications/formatParser.xsl"/>
<xsl:import href="SciPublications/librarySignatures.xsl"/> <xsl:import href="SciPublications/librarySignatures.xsl"/>
<xsl:import href="SciPublications/publications-about.xsl"/> <xsl:import href="SciPublications/publications-about.xsl"/>
<xsl:import href="SciPublications/publications-persons.xsl"/>
<xsl:import href="SciPublications/SciPublicationsList.xsl"/> <xsl:import href="SciPublications/SciPublicationsList.xsl"/>

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE stylesheet [<!ENTITY nbsp '&#160;'>]>
<!--
Copyright: 2014 Jens Pelzetter
This file is part of Mandalay.
Mandalay is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Mandalay is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Mandalay. If not, see <http://www.gnu.org/licenses/>.
-->
<!--
XSL file for displaying the informations from the related persons asset.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:bebop="http://www.arsdigita.com/bebop/1.0"
xmlns:cms="http://www.arsdigita.com/cms/1.0"
xmlns:nav="http://ccm.redhat.com/navigation"
xmlns:mandalay="http://mandalay.quasiweb.de"
exclude-result-prefixes="xsl bebop cms nav mandalay"
version="1.0">
<xsl:template name="showPublicationRelatedPersons">
<xsl:param name="layoutTree" select="."/>
<xsl:if test="$resultTree//relatedPersons">
<xsl:variable name="setHeading">
<xsl:call-template name="mandalay:getSetting">
<xsl:with-param name="node" select="$layoutTree/setHeading" />
<xsl:with-param name="module" select="'SciPublications'" />
<xsl:with-param name="setting" select="'relatedPersons/setHeading'" />
<xsl:with-param name="default" select="'true'" />
</xsl:call-template>
</xsl:variable>
<div class="relatedPersons">
<xsl:if test="$setHeading = 'true'">
<h2>
<xsl:call-template name="mandalay:getStaticText">
<xsl:with-param name="module"
select="'SciPublications'"/>
<xsl:with-param name="id"
select="'relatedPersons/heading'"/>
</xsl:call-template>
</h2>
</xsl:if>
<ul>
<xsl:for-each select="$resultTree//relatedPersons/person">
<xsl:sort select="./surname" data-type="text"/>
<xsl:sort select="./givenname" data-type="text"/>
<li>
<xsl:if test="string-length(./titlepre) &gt; 0">
<xsl:value-of select="./titlepre"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="string-length(./givenname) &gt; 0">
<xsl:value-of select="./givenname"/>
<xsl:text> </xsl:text>
</xsl:if>
<xsl:if test="string-length(./givenname) &gt; 0">
<xsl:value-of select="./surname"/>
</xsl:if>
<xsl:if test="string-length(./titlepost) &gt; 0">
<xsl:text>, </xsl:text>
<xsl:value-of select="./titlepost"/>
</xsl:if>
</li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>