From 1c28082fc392ab311a8e568619377a49c6c592bd Mon Sep 17 00:00:00 2001
From: Fernando Pietchaki Domingues <fpd09@c3sl.ufpr.br>
Date: Tue, 11 Feb 2014 16:22:06 -0200
Subject: [PATCH] =?UTF-8?q?Adicionado=20c=C3=B3digo=20gerador=20do=20Trail?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/main/webapp/themes/mobile/mobile.xsl  | 79 +++++++++++++++++++
 1 file changed, 79 insertions(+)

diff --git a/dspace-xmlui/src/main/webapp/themes/mobile/mobile.xsl b/dspace-xmlui/src/main/webapp/themes/mobile/mobile.xsl
index ca6b5e3..460d9ba 100755
--- a/dspace-xmlui/src/main/webapp/themes/mobile/mobile.xsl
+++ b/dspace-xmlui/src/main/webapp/themes/mobile/mobile.xsl
@@ -72,6 +72,9 @@
                     <xsl:call-template name="buildHeader"/>
                     -->
 
+                        <!--The trail is built by applying a template over pageMeta's trail children. -->
+                        <xsl:call-template name="buildTrail"/>
+
                     <!--
                         Goes over the document tag's children elements: body, options, meta. The body template
                         generates the ds-body div that contains all the content. The options template generates
@@ -803,4 +806,80 @@
 <xsl:template match="dri:options">&#160;
 </xsl:template>
 
+
+<!-- ******************************************************************** -->
+    <xsl:template name="buildTrail">
+        <div id="ds-trail-wrapper">
+            <ul id="ds-trail">
+                <!-- Display a language selection if more than 1 language is supported -->
+                <xsl:if
+                    test="count(/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='page'][@qualifier='supportedLocale']) &gt; 1">
+                    <div id="ds-language-selection">
+                        <xsl:for-each
+                            select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='page'][@qualifier='supportedLocale']">
+                            <xsl:variable name="locale" select="." />
+                            <a>
+                                <xsl:attribute name="href">
+                                    <xsl:value-of select="concat($context-path,'/?locale-attribute=')" />
+                                    <xsl:value-of select="$locale" />
+                                </xsl:attribute>
+                                <xsl:value-of
+                                    select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='supportedLocale'][@qualifier=$locale]" />
+                            </a>
+                        </xsl:for-each>
+                    </div>
+                </xsl:if>
+
+                <xsl:choose>
+                    <xsl:when test="starts-with($request-uri, 'page/about')">
+                        <li class="ds-trail-link first-link">
+                            <i18n:text>xmlui.structure.AboutRepositoryTrail</i18n:text>
+                        </li>
+                    </xsl:when>
+                    <xsl:when test="count(/dri:document/dri:meta/dri:pageMeta/dri:trail) = 0">
+                        <li class="ds-trail-link first-link">-</li>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:apply-templates select="/dri:document/dri:meta/dri:pageMeta/dri:trail"/>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </ul>
+        </div>
+    </xsl:template>
+
+    <xsl:template match="dri:trail">
+        <!--put an arrow between the parts of the trail-->
+        <xsl:if test="position()>1">
+            <li class="ds-trail-arrow">
+                <xsl:text>&#8594;</xsl:text>
+            </li>
+        </xsl:if>
+        <li>
+            <xsl:attribute name="class">
+                <xsl:text>ds-trail-link </xsl:text>
+                <xsl:if test="position()=1">
+                    <xsl:text>first-link </xsl:text>
+                </xsl:if>
+                <xsl:if test="position()=last()">
+                    <xsl:text>last-link</xsl:text>
+                </xsl:if>
+            </xsl:attribute>
+            <!-- Determine whether we are dealing with a link or plain text trail link -->
+            <xsl:choose>
+                <xsl:when test="./@target">
+                    <a>
+                        <xsl:attribute name="href">
+                            <xsl:value-of select="./@target"/>
+                        </xsl:attribute>
+                        <xsl:apply-templates />
+                    </a>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:apply-templates />
+                </xsl:otherwise>
+            </xsl:choose>
+        </li>
+    </xsl:template>
+<!-- ******************************************************************** -->
+
 </xsl:stylesheet>
-- 
GitLab