Syncing Foundry files

git-svn-id: https://svn.libreccm.org/ccm/trunk@2875 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-09-24 13:37:41 +00:00
parent b18536aa4f
commit e8a69ca7fb
5 changed files with 216 additions and 117 deletions

View File

@ -15,7 +15,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
package com.arsdigita.portalworkspace.ui; package com.arsdigita.portalworkspace.ui;
import com.arsdigita.bebop.Page; import com.arsdigita.bebop.Page;
@ -26,8 +25,8 @@ import com.arsdigita.portalworkspace.Workspace;
import com.arsdigita.portalworkspace.WorkspacePage; import com.arsdigita.portalworkspace.WorkspacePage;
/** /**
* *
* *
*/ */
public abstract class AbstractWorkspaceComponent extends SimpleContainer { public abstract class AbstractWorkspaceComponent extends SimpleContainer {
@ -42,16 +41,15 @@ public abstract class AbstractWorkspaceComponent extends SimpleContainer {
private PersistentPortal m_portalDisplay; private PersistentPortal m_portalDisplay;
/** /**
* Default constructor creates a new, empty * Default constructor creates a new, empty <code>AbstractWorkspaceComponent</code> using
* <code>AbstractWorkspaceComponent</code> using parents * parents (SimpleContainer) default constructor.
* (SimpleContainer) default constructor.
*/ */
public AbstractWorkspaceComponent() { public AbstractWorkspaceComponent() {
this(null); this(null);
} }
/** /**
* *
* @param workspace * @param workspace
*/ */
public AbstractWorkspaceComponent(WorkspaceSelectionAbstractModel workspace) { public AbstractWorkspaceComponent(WorkspaceSelectionAbstractModel workspace) {
@ -63,7 +61,7 @@ public abstract class AbstractWorkspaceComponent extends SimpleContainer {
m_workspace = workspace; m_workspace = workspace;
m_details = new WorkspaceDetails(m_workspace); m_details = new WorkspaceDetails(m_workspace);
m_portal = new DefaultPortalSelectionModel(new BigDecimalParameter( m_portal = new DefaultPortalSelectionModel(new BigDecimalParameter(
"portal")); "portal"));
m_portalList = createPortalList(m_portal); m_portalList = createPortalList(m_portal);
m_portalDisplay = createPortalDisplay(m_portal); m_portalDisplay = createPortalDisplay(m_portal);
@ -87,25 +85,25 @@ public abstract class AbstractWorkspaceComponent extends SimpleContainer {
} }
/** /**
* To be overwritten by children class with class specific logic. * To be overwritten by children class with class specific logic.
* *
* @param portal * @param portal
* @return * @return
*/ */
protected abstract PortalList createPortalList(PortalSelectionModel portal); protected abstract PortalList createPortalList(PortalSelectionModel portal);
/** /**
* To be overwritten by children class with class specific logic. * To be overwritten by children class with class specific logic.
* *
* @param portal * @param portal
* @return * @return
*/ */
protected abstract PersistentPortal createPortalDisplay( protected abstract PersistentPortal createPortalDisplay(
PortalSelectionModel portal); PortalSelectionModel portal);
/** /**
* *
*/ */
public void register(Page page) { public void register(Page page) {
super.register(page); super.register(page);

View File

@ -1,36 +1,36 @@
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:define="/WEB-INF/bebop-define.tld" xmlns:define="/WEB-INF/bebop-define.tld"
xmlns:show="/WEB-INF/bebop-show.tld" xmlns:show="/WEB-INF/bebop-show.tld"
version="1.2"> version="1.2">
<jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/> <jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/>
<jsp:directive.page import="com.arsdigita.kernel.permissions.PrivilegeDescriptor"/> <jsp:directive.page import="com.arsdigita.kernel.permissions.PrivilegeDescriptor"/>
<jsp:directive.page import="com.arsdigita.portalworkspace.Workspace"/> <jsp:directive.page import="com.arsdigita.portalworkspace.Workspace"/>
<jsp:directive.page import="com.arsdigita.portalworkspace.ui.AbstractWorkspaceComponent"/> <jsp:directive.page import="com.arsdigita.portalworkspace.ui.AbstractWorkspaceComponent"/>
<jsp:directive.page import="com.arsdigita.portalworkspace.ui.WorkspaceSelectionDefaultModel"/> <jsp:directive.page import="com.arsdigita.portalworkspace.ui.WorkspaceSelectionDefaultModel"/>
<jsp:directive.page import="com.arsdigita.toolbox.ui.ApplicationAuthenticationListener"/> <jsp:directive.page import="com.arsdigita.toolbox.ui.ApplicationAuthenticationListener"/>
<jsp:scriptlet>
DispatcherHelper.cacheDisable(response);
</jsp:scriptlet>
<define:page name="viewWorkspace" application="portal"
title="Workspace" cache="true">
<jsp:scriptlet> <jsp:scriptlet>
DispatcherHelper.cacheDisable(response);
</jsp:scriptlet>
<define:page name="viewWorkspace" application="portal"
title="Workspace" cache="true">
<jsp:scriptlet>
if (Workspace.getConfig().getCheckWorkspaceReadPermissions()) { if (Workspace.getConfig().getCheckWorkspaceReadPermissions()) {
viewWorkspace.addRequestListener( viewWorkspace.addRequestListener(
new ApplicationAuthenticationListener(PrivilegeDescriptor.READ)); new ApplicationAuthenticationListener(PrivilegeDescriptor.READ));
} }
</jsp:scriptlet> </jsp:scriptlet>
<define:component name="view" <define:component name="view"
classname="com.arsdigita.portalworkspace.ui.WorkspaceViewer" /> classname="com.arsdigita.portalworkspace.ui.WorkspaceViewer" />
<jsp:scriptlet> <jsp:scriptlet>
((AbstractWorkspaceComponent) view).setWorkspaceModel( ((AbstractWorkspaceComponent) view).setWorkspaceModel(
new WorkspaceSelectionDefaultModel()); new WorkspaceSelectionDefaultModel());
</jsp:scriptlet> </jsp:scriptlet>
</define:page> </define:page>
<show:all/> <show:all/>
</jsp:root> </jsp:root>

View File

@ -29,13 +29,40 @@
<foundry:doc> <foundry:doc>
<foundry:doc-desc> <foundry:doc-desc>
Generates a HTML <code>a</code> element. <p>
Generates a HTML <code>a</code> element. There are some differences to the
<code>a</code> element in HTML. First, there two attribute for the URL:
</p>
<dl>
<dt>
<code>href-property</code>
</dt>
<dd>
The name of a property of the current object which contains the URL for the
link.
</dd>
<dt>
<dt>
<code>href-static</code>
</dt>
<dd>
A static URL.
</dd>
</dt>
</dl>
<p>
The third variant for providing an URL is to call the template with a href
parameter in the XSL.
</p>
</foundry:doc-desc> </foundry:doc-desc>
<foundry:doc-see-also> <foundry:doc-see-also>
<foundry:doc-link href="http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element"/> <foundry:doc-link href="http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element"/>
</foundry:doc-see-also> </foundry:doc-see-also>
</foundry:doc> </foundry:doc>
<xsl:template match="a"> <xsl:template match="a">
<xsl:with-param name="href" select="''"/>
<xsl:with-param name="title" select="''"/>
<a> <a>
<xsl:if test="./@download"> <xsl:if test="./@download">
<xsl:attribute name="download"> <xsl:attribute name="download">
@ -52,6 +79,11 @@
<xsl:value-of select="./@href-static"/> <xsl:value-of select="./@href-static"/>
</xsl:attribute> </xsl:attribute>
</xsl:if> </xsl:if>
<xsl:if test="$href != ''">
<xsl:attribute name="href">
<xsl:value-of select="$href"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="./@href-lang"> <xsl:if test="./@href-lang">
<xsl:attribute name="hreflang"> <xsl:attribute name="hreflang">
<xsl:value-of select="./@href-lang"/> <xsl:value-of select="./@href-lang"/>
@ -62,6 +94,16 @@
<xsl:value-of select="./@rel"/> <xsl:value-of select="./@rel"/>
</xsl:attribute> </xsl:attribute>
</xsl:if> </xsl:if>
<xsl:if test="./title-static">
<xsl:attribute name="title">
<xsl:value-of select="foundry:get-static-text('', ./@static-title)"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="$title != ''">
<xsl:attribute name="title">
<xsl:value-of select="$title"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="./@type"> <xsl:if test="./@type">
<xsl:attribute name="type"> <xsl:attribute name="type">
<xsl:value-of select="./@type"/> <xsl:value-of select="./@type"/>

View File

@ -9,29 +9,39 @@
exclude-result-prefixes="xsl bebop foundry nav" exclude-result-prefixes="xsl bebop foundry nav"
version="1.0"> version="1.0">
<xsl:template match="navigation-layout"> <foundry:doc>
<xsl:apply-templates> <foundry:doc-attribute name="navigation-id">
<xsl:with-param name="navigation-id" The id of the navigation/category system from which URL should be retrieved. Default
select="foundry:get-attribute-value('navigation-id', 'categoryMenu')"/> value is <code>categoryMenu</code>, which is suitable in most cases.
<xsl:with-param name="with-colorset" </foundry:doc-attribute>
select="foundry:get-attribute-value('with-colorset', 'false')"/> <foundry:doc-attribute name="show-description-text">
<xsl:with-param name="min-level" If set to <code>true</code> (true) the description text for the category system from the
select="foundry:get-attribute-value('min-level', '1')"/> data tree XML will be used as value of the title attribute.
<xsl:with-param name="max-level" If set to <code>false</code>, the translated name of the category system will be used.
select="foundry:get-attribute-value('max-level', '999')"/> </foundry:doc-attribute>
<xsl:with-param name="show-description-text" <foundry:doc-attribute name="use-static-title">
select="foundry:get-attribute-value('show-description-text', 'true')"/> if set the to <code>true</code> (default) Foundry will try to translate the title of the
<xsl:with-param name="current-level-tree" navigation/category system using the language file <code>lang/navigation.xml</code>.
select="$data-tree//nav:categoryMenu[@id=foundry:get-attribute-value('navigation-id', 'categoryMenu')]/nav:category/nav:category"/> If set to <code>false</code> the title is retrieved from the data tree XML.
</xsl:apply-templates> </foundry:doc-attribute>
</xsl:template> <foundry:doc-desc>
Environment for outputting the home link for a navigation/category system. This tag
<xsl:template match="navigation-layout//navigation-home-link"> only intializes the context. The link itself has to be rendered using the <code>a</code>
<xsl:param name="navigation-id"/> HTML tag. The title of the navigation is printed using the <code>navigation-title</code>
<xsl:param name="show-description-text"/> tag.
</foundry:doc-desc>
<foundry:doc-see-also>#a</foundry:doc-see-also>
<foundry:doc-see-also>#navigation-title</foundry:doc-see-also>
</foundry:doc>
<xsl:template match="navigation-home-link">
<xsl:variable name="navigation-id"
select="foundry:get-attribute-value('navigation-id', 'categoryMenu')"/>
<a href="{$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@url}"> <xsl:apply-templates>
<xsl:attribute name="title"> <xsl:with-param name="href"
select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@url"/>
<xsl:with-param name="navigation-id" select="$navigation-id"/>
<xsl:with-param name="title">
<xsl:choose> <xsl:choose>
<xsl:when test="./@show-description-text = 'false'"> <xsl:when test="./@show-description-text = 'false'">
<xsl:choose> <xsl:choose>
@ -49,11 +59,34 @@
<xsl:value-of select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@description"/> <xsl:value-of select="$data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@description"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:with-param>
<xsl:value-of select="foundry:shying($data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@title)"/> </xsl:apply-templates>
</a>
</xsl:template> </xsl:template>
<xsl:template match="navigation-home-link//navigation-title">
<xsl:param name="navigation-id"/>
<xsl:value-of select="foundry:shying($data-tree//nav:categoryMenu[@id=$navigation-id]/nav:category/@title)"/>
</xsl:template>
<xsl:template match="navigation-layout">
<xsl:apply-templates>
<xsl:with-param name="navigation-id"
select="foundry:get-attribute-value('navigation-id', 'categoryMenu')"/>
<xsl:with-param name="with-colorset"
select="foundry:get-attribute-value('with-colorset', 'false')"/>
<xsl:with-param name="min-level"
select="foundry:get-attribute-value('min-level', '1')"/>
<xsl:with-param name="max-level"
select="foundry:get-attribute-value('max-level', '999')"/>
<xsl:with-param name="show-description-text"
select="foundry:get-attribute-value('show-description-text', 'true')"/>
<xsl:with-param name="current-level-tree"
select="$data-tree//nav:categoryMenu[@id=foundry:get-attribute-value('navigation-id', 'categoryMenu')]/nav:category/nav:category"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="navigation-layout//navigation-link-list" <xsl:template match="navigation-layout//navigation-link-list"
name="navigation-link-list"> name="navigation-link-list">
<xsl:param name="navigation-id"/> <xsl:param name="navigation-id"/>
@ -95,13 +128,21 @@
<h1>applied navigation-link-list with these values:</h1> <h1>applied navigation-link-list with these values:</h1>
<dl> <dl>
<dt>navigation-id</dt> <dt>navigation-id</dt>
<dd><xsl:value-of select="$navigation-id"/></dd> <dd>
<xsl:value-of select="$navigation-id"/>
</dd>
<dt>min-level</dt> <dt>min-level</dt>
<dd><xsl:value-of select="$min-level"/></dd> <dd>
<xsl:value-of select="$min-level"/>
</dd>
<dt>max-level</dt> <dt>max-level</dt>
<dd><xsl:value-of select="$max-level"/></dd> <dd>
<xsl:value-of select="$max-level"/>
</dd>
<dt>current-level</dt> <dt>current-level</dt>
<dd><xsl:value-of select="$current-level"/></dd> <dd>
<xsl:value-of select="$current-level"/>
</dd>
</dl> </dl>
<xsl:if test="$current-level &gt;= min-level"> <xsl:if test="$current-level &gt;= min-level">

View File

@ -44,56 +44,56 @@ public class SciProjectCSVExporter extends Program {
super("SciProjectCSVExporter", "1.0.0", ""); super("SciProjectCSVExporter", "1.0.0", "");
getOptions().addOption(OptionBuilder getOptions().addOption(OptionBuilder
.hasArg(true) .hasArg(true)
.withLongOpt(START_BEFORE) .withLongOpt(START_BEFORE)
.withDescription( .withDescription(
"Include only projects started before a data. Date is in ISO format (yyyy-mm-dd)") "Include only projects started before a data. Date is in ISO format (yyyy-mm-dd)").
.create()); create());
getOptions().addOption(OptionBuilder getOptions().addOption(OptionBuilder
.hasArg(true) .hasArg(true)
.withLongOpt(START_AFTER) .withLongOpt(START_AFTER)
.withDescription( .withDescription(
"Include only projects started after a data. Date is in ISO format (yyyy-mm-dd)") "Include only projects started after a data. Date is in ISO format (yyyy-mm-dd)").
.create()); create());
getOptions().addOption(OptionBuilder getOptions().addOption(OptionBuilder
.hasArg(true) .hasArg(true)
.withLongOpt(END_BEFORE) .withLongOpt(END_BEFORE)
.withDescription( .withDescription(
"Include only projects finished before a data. Date is in ISO format (yyyy-mm-dd)") "Include only projects finished before a data. Date is in ISO format (yyyy-mm-dd)").
.create()); create());
getOptions().addOption(OptionBuilder getOptions().addOption(OptionBuilder
.hasArg(true) .hasArg(true)
.withLongOpt(END_AFTER) .withLongOpt(END_AFTER)
.withDescription( .withDescription(
"Include only projects finished after a data. Date is in ISO format (yyyy-mm-dd)") "Include only projects finished after a data. Date is in ISO format (yyyy-mm-dd)").
.create()); create());
getOptions().addOption(OptionBuilder getOptions().addOption(OptionBuilder
.hasArg(false) .hasArg(false)
.withLongOpt(OMIT_FUNDING_VOLUME) .withLongOpt(OMIT_FUNDING_VOLUME)
.withDescription("Omit funding volume") .withDescription("Omit funding volume")
.create()); .create());
getOptions().addOption(OptionBuilder getOptions().addOption(OptionBuilder
.hasArg(false) .hasArg(false)
.withLongOpt(OMIT_FUNDING_CODE) .withLongOpt(OMIT_FUNDING_CODE)
.withDescription("Omit funding code") .withDescription("Omit funding code")
.create()); .create());
getOptions().addOption(OptionBuilder getOptions().addOption(OptionBuilder
.hasArg(false) .hasArg(false)
.withLongOpt(OMIT_ROLES) .withLongOpt(OMIT_ROLES)
.withDescription("Omit roles") .withDescription("Omit roles")
.create()); .create());
getOptions().addOption(OptionBuilder getOptions().addOption(OptionBuilder
.hasArg(false) .hasArg(false)
.withLongOpt(WITH_DESC) .withLongOpt(WITH_DESC)
.withDescription("Add description to CSV") .withDescription("Add description to CSV")
.create()); .create());
} }
@ -141,10 +141,28 @@ public class SciProjectCSVExporter extends Program {
withDesc = true; withDesc = true;
} }
//First line with column labels
createColumn("Name", buffer);
createColumn("Begin", buffer);
createColumn("End", buffer);
createColumn("Members", buffer);
createColumn("Short description", buffer);
if (withDesc) {
createColumn("Description", buffer);
}
createColumn("Sponsors", buffer);
if (withFundingVolume) {
createColumn("Funding volme", buffer);
}
buffer.append(LINE_SEPARATOR);
while (projects.next()) { while (projects.next()) {
final SciProject project = (SciProject) DomainObjectFactory.newInstance(projects final SciProject project = (SciProject) DomainObjectFactory.newInstance(projects
.getDataObject()); .getDataObject());
createLine(project, buffer); createLine(project, buffer);
@ -208,16 +226,16 @@ public class SciProjectCSVExporter extends Program {
while (members.next()) { while (members.next()) {
buffer buffer
.append(members.getSurname()) .append(members.getSurname())
.append(", ") .append(", ")
.append(members.getGivenName()); .append(members.getGivenName());
if (withRoles) { if (withRoles) {
final String roleName = members.getRoleName(); final String roleName = members.getRoleName();
final String roleLabel; final String roleLabel;
final RelationAttributeCollection roles = new RelationAttributeCollection( final RelationAttributeCollection roles = new RelationAttributeCollection(
SciProject.ROLE_ENUM_NAME, roleName); SciProject.ROLE_ENUM_NAME, roleName);
roles.addLanguageFilter(Kernel.getConfig().getDefaultLanguage()); roles.addLanguageFilter(Kernel.getConfig().getDefaultLanguage());
if (roles.isEmpty()) { if (roles.isEmpty()) {
@ -229,9 +247,9 @@ public class SciProjectCSVExporter extends Program {
} }
buffer buffer
.append(" (") .append(" (")
.append(roleLabel) .append(roleLabel)
.append(')'); .append(')');
} }
buffer.append("; "); buffer.append("; ");
@ -246,14 +264,14 @@ public class SciProjectCSVExporter extends Program {
while (sponsors.next()) { while (sponsors.next()) {
if (withFundingCode && sponsors.getFundingCode() != null) { if (withFundingCode && sponsors.getFundingCode() != null) {
buffer buffer
.append(sponsors.getSponsor().getTitle()) .append(sponsors.getSponsor().getTitle())
.append(" (") .append(" (")
.append(sponsors.getFundingCode()) .append(sponsors.getFundingCode())
.append(");"); .append(");");
} else { } else {
buffer buffer
.append(sponsors.getSponsor().getTitle()) .append(sponsors.getSponsor().getTitle())
.append("; "); .append("; ");
} }
} }
} }