mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
DS-1596 fix for "Classic" theme
This commit is contained in:
@@ -8,7 +8,100 @@
|
||||
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">
|
||||
<!-- 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">
|
||||
<!-- Add page metadata to DRI -->
|
||||
<!-- This adds all Stylesheets (CSS) and Javascript (js) into the DRI XML,
|
||||
so that they are accessible to the XSLTs -->
|
||||
<map:select type="browser">
|
||||
<!-- Internet explorer 6 -->
|
||||
<map:when test="explorer6">
|
||||
<map:transform type="IncludePageMeta">
|
||||
<map:parameter name="stylesheet.screen#1" value="lib/style.css"/>
|
||||
<map:parameter name="stylesheet.screen#2" value="lib/style-ie6.css"/>
|
||||
<map:parameter name="stylesheet.screen#3" value="lib/jquery-ui-1.8.15.custom.css"/>
|
||||
|
||||
<map:parameter name="javascript#1" value="lib/jquery-1.6.2.min.js"/>
|
||||
<map:parameter name="javascript#2" value="lib/jquery-ui-1.8.15.custom.min.js"/>
|
||||
|
||||
<map:parameter name="theme.path" value="{global:theme-path}"/>
|
||||
<map:parameter name="theme.name" value="{global:theme-name}"/>
|
||||
</map:transform>
|
||||
</map:when>
|
||||
<!-- The theme has been tested with firefox 2.0 & i.e. 7.0 -->
|
||||
<map:otherwise>
|
||||
<map:transform type="IncludePageMeta">
|
||||
<map:parameter name="stylesheet.screen" value="lib/style.css"/>
|
||||
<map:parameter name="stylesheet.screen#2" value="lib/jquery-ui-1.8.15.custom.css"/>
|
||||
|
||||
<map:parameter name="javascript#1" value="lib/jquery-1.6.2.min.js"/>
|
||||
<map:parameter name="javascript#2" value="lib/jquery-ui-1.8.15.custom.min.js"/>
|
||||
<map:parameter name="theme.path" value="{global:theme-path}"/>
|
||||
<map:parameter name="theme.name" value="{global:theme-name}"/>
|
||||
</map:transform>
|
||||
</map:otherwise>
|
||||
</map:select>
|
||||
|
||||
<!-- 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="Classic.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>
|
||||
</map:resource>
|
||||
</map:resources>
|
||||
<map:pipelines>
|
||||
|
||||
<map:component-configurations>
|
||||
@@ -38,57 +131,54 @@
|
||||
<map:match pattern="**">
|
||||
|
||||
<!-- 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}"/>
|
||||
|
||||
<!-- Step 2 Add page metadata -->
|
||||
<map:select type="browser">
|
||||
<!-- Internet explorer 6 -->
|
||||
<map:when test="explorer6">
|
||||
<map:transform type="IncludePageMeta">
|
||||
<map:parameter name="stylesheet.screen#1" value="lib/style.css"/>
|
||||
<map:parameter name="stylesheet.screen#2" value="lib/style-ie6.css"/>
|
||||
<map:parameter name="stylesheet.screen#3" value="lib/jquery-ui-1.8.15.custom.css"/>
|
||||
|
||||
<map:parameter name="javascript#1" value="lib/jquery-1.6.2.min.js"/>
|
||||
<map:parameter name="javascript#2" value="lib/jquery-ui-1.8.15.custom.min.js"/>
|
||||
|
||||
<map:parameter name="theme.path" value="{global:theme-path}"/>
|
||||
<map:parameter name="theme.name" value="{global:theme-name}"/>
|
||||
</map:transform>
|
||||
</map:when>
|
||||
<!-- The theme has been tested with firefox 2.0 & i.e. 7.0 -->
|
||||
<map:otherwise>
|
||||
<map:transform type="IncludePageMeta">
|
||||
<map:parameter name="stylesheet.screen" value="lib/style.css"/>
|
||||
<map:parameter name="stylesheet.screen#2" value="lib/jquery-ui-1.8.15.custom.css"/>
|
||||
|
||||
<map:parameter name="javascript#1" value="lib/jquery-1.6.2.min.js"/>
|
||||
<map:parameter name="javascript#2" value="lib/jquery-ui-1.8.15.custom.min.js"/>
|
||||
<map:parameter name="theme.path" value="{global:theme-path}"/>
|
||||
<map:parameter name="theme.name" value="{global:theme-name}"/>
|
||||
</map:transform>
|
||||
</map:otherwise>
|
||||
</map:select>
|
||||
<!-- 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 XHTML -->
|
||||
<map:call resource="transform-to-xhtml"/>
|
||||
|
||||
<!-- Debuging output -->
|
||||
<map:match type="request" pattern="XML">
|
||||
<map:serialize type="xml"/>
|
||||
</map:match>
|
||||
|
||||
<!-- Step 3: Transform to XHTML -->
|
||||
<map:transform src="Classic.xsl"/>
|
||||
|
||||
<!-- Step 4: Localize the page -->
|
||||
<map:act type="locale">
|
||||
<map:transform type="i18n">
|
||||
<map:parameter name="locale" value="{locale}"/>
|
||||
</map:transform>
|
||||
</map:act>
|
||||
|
||||
<!-- Step 5: Serialize to the browser -->
|
||||
<!-- Step 3: Serialize to the browser -->
|
||||
<map:serialize type="xhtml"/>
|
||||
|
||||
</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="xhtml" status-code="400"/>
|
||||
</map:when>
|
||||
<!-- HTTP 404 Page Not Found -->
|
||||
<map:when test="not-found">
|
||||
<map:serialize type="xhtml" status-code="404"/>
|
||||
</map:when>
|
||||
<!-- All other errors (HTTP 500 Internal Server Error) -->
|
||||
<map:otherwise>
|
||||
<map:serialize type="xhtml" status-code="500"/>
|
||||
</map:otherwise>
|
||||
</map:select>
|
||||
</map:handle-errors>
|
||||
</map:pipelines>
|
||||
</map:sitemap>
|
||||
|
Reference in New Issue
Block a user