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
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.arsdigita.portalworkspace.ui;
import com.arsdigita.bebop.Page;
@ -26,8 +25,8 @@ import com.arsdigita.portalworkspace.Workspace;
import com.arsdigita.portalworkspace.WorkspacePage;
/**
*
*
*
*
*/
public abstract class AbstractWorkspaceComponent extends SimpleContainer {
@ -42,16 +41,15 @@ public abstract class AbstractWorkspaceComponent extends SimpleContainer {
private PersistentPortal m_portalDisplay;
/**
* Default constructor creates a new, empty
* <code>AbstractWorkspaceComponent</code> using parents
* (SimpleContainer) default constructor.
* Default constructor creates a new, empty <code>AbstractWorkspaceComponent</code> using
* parents (SimpleContainer) default constructor.
*/
public AbstractWorkspaceComponent() {
this(null);
}
/**
*
*
* @param workspace
*/
public AbstractWorkspaceComponent(WorkspaceSelectionAbstractModel workspace) {
@ -63,7 +61,7 @@ public abstract class AbstractWorkspaceComponent extends SimpleContainer {
m_workspace = workspace;
m_details = new WorkspaceDetails(m_workspace);
m_portal = new DefaultPortalSelectionModel(new BigDecimalParameter(
"portal"));
"portal"));
m_portalList = createPortalList(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
* @return
*/
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
* @return
*/
protected abstract PersistentPortal createPortalDisplay(
PortalSelectionModel portal);
PortalSelectionModel portal);
/**
*
*/
*
*/
public void register(Page page) {
super.register(page);

View File

@ -1,36 +1,36 @@
<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">
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.kernel.permissions.PrivilegeDescriptor"/>
<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.WorkspaceSelectionDefaultModel"/>
<jsp:directive.page import="com.arsdigita.toolbox.ui.ApplicationAuthenticationListener"/>
<jsp:directive.page import="com.arsdigita.dispatcher.DispatcherHelper"/>
<jsp:directive.page import="com.arsdigita.kernel.permissions.PrivilegeDescriptor"/>
<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.WorkspaceSelectionDefaultModel"/>
<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>
DispatcherHelper.cacheDisable(response);
</jsp:scriptlet>
<define:page name="viewWorkspace" application="portal"
title="Workspace" cache="true">
<jsp:scriptlet>
if (Workspace.getConfig().getCheckWorkspaceReadPermissions()) {
viewWorkspace.addRequestListener(
new ApplicationAuthenticationListener(PrivilegeDescriptor.READ));
}
</jsp:scriptlet>
</jsp:scriptlet>
<define:component name="view"
classname="com.arsdigita.portalworkspace.ui.WorkspaceViewer" />
<jsp:scriptlet>
<define:component name="view"
classname="com.arsdigita.portalworkspace.ui.WorkspaceViewer" />
<jsp:scriptlet>
((AbstractWorkspaceComponent) view).setWorkspaceModel(
new WorkspaceSelectionDefaultModel());
</jsp:scriptlet>
</define:page>
</jsp:scriptlet>
</define:page>
<show:all/>
<show:all/>
</jsp:root>

View File

@ -29,13 +29,40 @@
<foundry:doc>
<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-see-also>
<foundry:doc-link href="http://www.w3.org/TR/html5/text-level-semantics.html#the-a-element"/>
</foundry:doc-see-also>
</foundry:doc>
<xsl:template match="a">
<xsl:with-param name="href" select="''"/>
<xsl:with-param name="title" select="''"/>
<a>
<xsl:if test="./@download">
<xsl:attribute name="download">
@ -52,6 +79,11 @@
<xsl:value-of select="./@href-static"/>
</xsl:attribute>
</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:attribute name="hreflang">
<xsl:value-of select="./@href-lang"/>
@ -62,6 +94,16 @@
<xsl:value-of select="./@rel"/>
</xsl:attribute>
</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:attribute name="type">
<xsl:value-of select="./@type"/>

View File

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

View File

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