mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
DS-1596 fixes for Mirage 2 theme. Minor rework of shared
exception2dri.xslt (which has been tested on other themes)
This commit is contained in:
@@ -8,6 +8,41 @@
|
||||
http://www.dspace.org/license/
|
||||
|
||||
-->
|
||||
<!-- HOW A DSPACE THEME IS PROCESSED IN 5 STEPS:
|
||||
|
||||
1: Generate the DRI (XML) page
|
||||
|
||||
The first step is to generate a DRI page for the request;
|
||||
this is handled by the Aspect chain. Once it is generated
|
||||
it is the beginning of a theme's pipeline, the DRI page is
|
||||
ultimately transformed in the resulting XHTML that is
|
||||
given to the user's browser.
|
||||
|
||||
2: Add page metadata (to DRI) - see "transform-to-xhtml" resource
|
||||
|
||||
The next step is to add theme specific metadata to the
|
||||
DRI page. This is metadata about where the theme is
|
||||
located and its name. Typically this metadata is different
|
||||
depending on the users browser, this allows us to give
|
||||
different stylesheets to Internet Explorer than for other browsers.
|
||||
|
||||
3: Transform DRI to XHTML (via XSLT) - see "transform-to-xhtml" resource
|
||||
|
||||
The third step is the main component of a theme. The XSL
|
||||
transformations will turn the DRI page from the aspects
|
||||
into an XHTML page useable by browsers.
|
||||
|
||||
4: Localize the page (by replacing i18n tags) - see "transform-to-xhtml" resource
|
||||
|
||||
The second to last step is to localize the content for the
|
||||
particular user, if they user is requesting a page in a
|
||||
particular language then those language strings are inserted
|
||||
into the resulting XHTML.
|
||||
|
||||
5: Serialize to the browser
|
||||
|
||||
The last step sends the XHTML page to the user's browser.
|
||||
-->
|
||||
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
|
||||
|
||||
<map:components>
|
||||
@@ -30,6 +65,49 @@
|
||||
</map:serializers>
|
||||
</map:components>
|
||||
|
||||
<!-- Define global resources that are used in multiple areas of the pipeline. -->
|
||||
<map:resources>
|
||||
|
||||
<!--
|
||||
This "transform-to-xhtml" resource is in charge of transforming DRI to XHTML.
|
||||
It expects a pre-generated DRI page. It adds needed CSS/JS references to that DRI,
|
||||
and then transforms it to XHTML using the Theme's XSLT(s).
|
||||
Please note: this Sitemap 'resource' can be called from multiple places (almost like a function).
|
||||
-->
|
||||
<map:resource name="transform-to-xhtml">
|
||||
|
||||
<!-- Fix some overly convoluted DRI constructs in
|
||||
DSpace code without having to change java code and
|
||||
interfere with other themes -->
|
||||
<map:transform src="xsl/preprocess.xsl"/>
|
||||
|
||||
<!-- Add page metadata to DRI -->
|
||||
<map:transform type="IncludePageMeta">
|
||||
<map:parameter name="theme.path" value="{global:theme-path}/"/>
|
||||
<map:parameter name="theme.name" value="{global:theme-name}/"/>
|
||||
</map:transform>
|
||||
|
||||
<!-- Debugging output (this is only called when ?XML is passed on querystring) -->
|
||||
<!-- It allows developers to view the final DRI XML, in order to build/debug theme XSLTs -->
|
||||
<map:match type="request" pattern="XML">
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
|
||||
<!-- Transform DRI to XHTML using the Theme's XSLT(s) -->
|
||||
<map:transform src="xsl/theme.xsl"/>
|
||||
|
||||
<!-- Localize the XHTML page (by replacing i18n tags) -->
|
||||
<map:act type="locale">
|
||||
<map:transform type="i18n">
|
||||
<map:parameter name="locale" value="{locale}"/>
|
||||
</map:transform>
|
||||
</map:act>
|
||||
|
||||
<!-- Remove all namespaces in the output xhtml-->
|
||||
<map:transform type="strip-namespaces" />
|
||||
</map:resource>
|
||||
</map:resources>
|
||||
|
||||
<map:pipelines>
|
||||
|
||||
<!--
|
||||
@@ -47,12 +125,15 @@
|
||||
</global-variables>
|
||||
</map:component-configurations>
|
||||
|
||||
|
||||
<!--
|
||||
Caching Pipeline: This caching pipeline handles access to static content (css, js, etc)
|
||||
which is used by this Theme. These static files are simply passed directly to
|
||||
the user's browser without any proccesing.
|
||||
-->
|
||||
<map:pipeline>
|
||||
<!-- Allow the browser to cache static content for an hour -->
|
||||
<map:parameter name="expires" value="access plus 1 hours"/>
|
||||
|
||||
|
||||
<!-- handle static js and css -->
|
||||
<map:match pattern="themes/*/**.js">
|
||||
<map:read type="ConcatenationReader" src="{2}.js">
|
||||
@@ -77,93 +158,66 @@
|
||||
</map:pipeline>
|
||||
|
||||
<!--
|
||||
The theme's pipeline is used to process all requests handled
|
||||
by the theme. It is broken up into two parts, the first part
|
||||
handles all static theme content while the second part handle
|
||||
all dynamic aspect generated content. The static content is
|
||||
such things as stylesheets, images, or static pages. Typically
|
||||
these are just stored on disk and passed directly to the
|
||||
browser without any processing.
|
||||
Primary (non-caching) Pipeline:
|
||||
This pipeline is the one that generates *dynamic* content. It first creates
|
||||
the DRI (XML) by calling the Aspect chain. Then it transforms that DRI
|
||||
into the XHTML page which is passed to the user.
|
||||
-->
|
||||
<map:pipeline>
|
||||
<!-- Never allow the browser to cache dynamic content -->
|
||||
<map:parameter name="expires" value="now"/>
|
||||
|
||||
<!-- Aspect content
|
||||
|
||||
There are five steps to processing aspect content:
|
||||
|
||||
1: Generate the DRI page
|
||||
|
||||
The first step is to generate a DRI page for the request;
|
||||
this is handled by the aspect chain. Once it is generated
|
||||
it is the beginning of a theme's pipeline, the DRI page is
|
||||
ultimately transformed in the resulting XHTML that is
|
||||
given to the user's browser.
|
||||
|
||||
2: Add page metadata
|
||||
|
||||
The next step is to add theme specific metadata to the
|
||||
DRI page. This is metadata about where the theme is
|
||||
located and its name. Typically this metadata is different
|
||||
depending on the users browser, this allows us to give
|
||||
different stylesheets to Internet Explorer than for other
|
||||
browsers.
|
||||
|
||||
3: Transform to XHTML
|
||||
|
||||
The third step is the main component of a theme the XSL
|
||||
transformations will turn the DRI page from the aspects
|
||||
into an XHTML page useable by browsers.
|
||||
|
||||
4: Localize the page
|
||||
|
||||
The second to last step is to localize the content for the
|
||||
particular user, if they user is requesting a page in a
|
||||
particular language then those language strings are inserted
|
||||
into the resulting XHTML.
|
||||
|
||||
5: Serialize to the browser
|
||||
|
||||
The last step sends the page to the user's browser.
|
||||
|
||||
-->
|
||||
<map:match pattern="**">
|
||||
|
||||
<!-- Generate the DRI page -->
|
||||
<!-- Step 1: Generate the DRI page -->
|
||||
<!-- This line actually initiates the Aspect chain. The Aspect chain will build
|
||||
the DRI (XML) content based on which page the user is accessing. -->
|
||||
<map:generate type="file" src="cocoon://DRI/{1}"/>
|
||||
|
||||
<!-- Fix some overly convoluted DRI constructs in
|
||||
DSpace code without having to change java code and
|
||||
interfere with other themes -->
|
||||
<map:transform src="xsl/preprocess.xsl"/>
|
||||
<!-- Step 2: Transform the DRI page into XHTML -->
|
||||
<!-- This line calls the resource named 'transform-to-xhtml' (included above).
|
||||
That resource is in charge of tranforming this DRI content into HTML -->
|
||||
<map:call resource="transform-to-xhtml"/>
|
||||
|
||||
<map:transform type="IncludePageMeta">
|
||||
<map:parameter name="theme.path" value="{global:theme-path}/"/>
|
||||
<map:parameter name="theme.name" value="{global:theme-name}/"/>
|
||||
</map:transform>
|
||||
|
||||
<!-- Debuging output -->
|
||||
<map:match type="request" pattern="XML">
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
<!-- Transform to XHTML -->
|
||||
<map:transform src="xsl/theme.xsl"/>
|
||||
|
||||
<!-- Localize the page -->
|
||||
<map:act type="locale">
|
||||
<map:transform type="i18n">
|
||||
<map:parameter name="locale" value="{locale}"/>
|
||||
</map:transform>
|
||||
</map:act>
|
||||
|
||||
<!-- Remove all namespaces in the output xhtml-->
|
||||
<map:transform type="strip-namespaces" />
|
||||
|
||||
<!-- Serialize to the browser -->
|
||||
<!-- Step 3: Serialize to the browser (sends final HTML to user's browser) -->
|
||||
<map:serialize type="html-no-doctype"/>
|
||||
|
||||
</map:match>
|
||||
</map:pipeline>
|
||||
|
||||
<!--
|
||||
Handle any errors which are thrown during any step in the above pipelines.
|
||||
This would include simple invalid URL errors (404 page not found), as well as
|
||||
any errors that may occur from the Aspect chain, or from the Theme itself.
|
||||
-->
|
||||
<map:handle-errors>
|
||||
<!-- Step 1: Tell Cocoon to generate an XML formatted exception message -->
|
||||
<map:generate type="exception"/>
|
||||
|
||||
<!-- Step 2: Transform that Cocoon XML exception into valid DRI (using exception2dri.xslt)-->
|
||||
<map:transform src="../../exception2dri.xslt">
|
||||
<map:parameter name="contextPath" value="{request:contextPath}"/>
|
||||
</map:transform>
|
||||
|
||||
<!-- Step 3: Transform that DRI formatted exception into XHTML (using our Theme) -->
|
||||
<map:call resource="transform-to-xhtml"/>
|
||||
|
||||
<!-- Step 4: Serialize XHTML page to user's brower. Based on the type of error,
|
||||
provide a different HTTP response code. -->
|
||||
<map:select type="exception">
|
||||
<!-- HTTP 400 Bad Request -->
|
||||
<map:when test="bad-request">
|
||||
<map:serialize type="html-no-doctype" status-code="400"/>
|
||||
</map:when>
|
||||
<!-- HTTP 404 Page Not Found -->
|
||||
<map:when test="not-found">
|
||||
<map:serialize type="html-no-doctype" status-code="404"/>
|
||||
</map:when>
|
||||
<!-- All other errors (HTTP 500 Internal Server Error) -->
|
||||
<map:otherwise>
|
||||
<map:serialize type="html-no-doctype" status-code="500"/>
|
||||
</map:otherwise>
|
||||
</map:select>
|
||||
</map:handle-errors>
|
||||
</map:pipelines>
|
||||
</map:sitemap>
|
||||
|
@@ -118,4 +118,14 @@ table#aspect_administrative_ControlPanel_table_users a{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Themed error page (exception2dri.xsl) styles
|
||||
* -------
|
||||
*/
|
||||
span.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
/* Preserve whitespace. Used to display error stack in a readable way. */
|
||||
p.pre {
|
||||
white-space:pre;
|
||||
}
|
||||
|
@@ -36,7 +36,6 @@ Created by Tim Donohue
|
||||
<body>
|
||||
<div id="exception">
|
||||
<head><xsl:value-of select="$pageTitle"/></head>
|
||||
<p></p>
|
||||
<p>
|
||||
<xref><xsl:attribute name="target"><xsl:value-of select="$contextPath"/>/</xsl:attribute><i18n:text>xmlui.general.go_home</i18n:text></xref>
|
||||
</p>
|
||||
@@ -44,12 +43,9 @@ Created by Tim Donohue
|
||||
<i18n:text>xmlui.error.contact_msg</i18n:text>
|
||||
</p>
|
||||
<p>
|
||||
<xref><xsl:attribute name="target"><xsl:value-of select="$contextPath"/>/contact</xsl:attribute><i18n:text>xmlui.error.contact</i18n:text></xref>
|
||||
</p>
|
||||
<p></p>
|
||||
<!-- Create a link which lets users optionally display the error stacktrace (using JQuery) -->
|
||||
<p>
|
||||
<xref target="javascript:jQuery('#errorstack').show().css('visibility','visible');"><i18n:text>xmlui.error.show_stack</i18n:text></xref>
|
||||
<xref><xsl:attribute name="target"><xsl:value-of select="$contextPath"/>/contact</xsl:attribute><i18n:text>xmlui.error.contact</i18n:text></xref> ||
|
||||
<!-- Create a link which lets users optionally display the error stacktrace (using JQuery) -->
|
||||
<xref target="javascript:jQuery('#errorstack').toggleClass('hidden');"><i18n:text>xmlui.error.show_stack</i18n:text></xref>
|
||||
</p>
|
||||
<!-- Include the Java stacktrace on the page, but hide it from view by default. -->
|
||||
<p id="errorstack" rend="pre hidden">
|
||||
@@ -76,7 +72,7 @@ Created by Tim Donohue
|
||||
|
||||
<!-- Display Java error stack -->
|
||||
<xsl:template match="ex:stacktrace">
|
||||
<hi rend="bold">Java <xsl:value-of select="translate(local-name(), '-', ' ')"/>:</hi>
|
||||
<hi rend="bold">Java <xsl:value-of select="translate(local-name(), '-', ' ')"/>: </hi>
|
||||
<hi>
|
||||
<xsl:value-of select="translate(.,' ','')"/>
|
||||
</hi>
|
||||
|
Reference in New Issue
Block a user