Commit 59662d42 authored by emelinemancel's avatar emelinemancel
Browse files

Maj

parent f4b3e11c
Loading
Loading
Loading
Loading

ui/xsl/core/_menu.xsl

0 → 100644
+158 −0
Original line number Diff line number Diff line
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:param name="baseURI"/>
    <xsl:param name="selectedTarget"/>
    <xsl:param name="projectId"/>


    <xsl:template match="/">
  		<xsl:variable name="topEntry" select=".//entry[target/text()=$selectedTarget]"/>
  		<!-- top menu -->
  		<nav>
  			<xsl:attribute name="subbar"/>
  			<label for="toggle"></label>
  			<input type="checkbox" id="toggle"/>
              <ul class="navbar-nav">
                  <xsl:for-each select="/menu/entry">
                      <xsl:choose>
                          <!-- le sous-menu -->
                          <xsl:when test="count(./entry) > 0">
                              <li>
  								<xsl:attribute name="class">
  									<xsl:choose>
  										<xsl:when test=".//id/text()=$topEntry/id/text()">
  											<xsl:value-of select="'active nav-item '||subbar||'-menu-container'" />
  										</xsl:when>
  										<xsl:otherwise>
  											<xsl:value-of select="'nav-item '||subbar||'-menu-container'" />
  										</xsl:otherwise>
  									</xsl:choose>
  								</xsl:attribute>
                                  <a class="subbar-toggle">
                                  	<xsl:if test="target">
                                  		<xsl:attribute name="href" select="$baseURI||$projectId||'/'||./target/text()" />
                                  	</xsl:if>
                                      <xsl:choose>
                                          <xsl:when test="./label/child::*">
                                              <xsl:copy-of select="./label/child::*"/>
                                          </xsl:when>
                                          <xsl:otherwise>
                                              <xsl:value-of select="./label/text()"/>
                                          </xsl:otherwise>
                                      </xsl:choose>
                                  </a>
                                  <ul class="subbar-menu">
                                      <xsl:for-each select="./entry">
  										<xsl:choose>
  											<!-- le sous-sous-menu -->
  											<xsl:when test="count(./entry) > 0">
  												<li>
  													<xsl:attribute name="class">
  														<xsl:choose>
  															<xsl:when test=".//id/text()=$topEntry/id/text()">
  																<xsl:value-of select="'active nav-item dropdown-menu-container'" />
  															</xsl:when>
  															<xsl:otherwise>
  																<xsl:value-of select="'nav-item dropdown-menu-container'" />
  															</xsl:otherwise>
  														</xsl:choose>
  													</xsl:attribute>
  													<a class="subbar-item dropdown-toggle">
  														<xsl:choose>
  															<xsl:when test="./label/child::*">
  																<xsl:copy-of select="./label/child::*"/>
  															</xsl:when>
  															<xsl:otherwise>
  																<xsl:value-of select="./label/text()"/>
  															</xsl:otherwise>
  														</xsl:choose>
  													</a>
  													<ul class="dropdown-menu dropdown_menu--animated">
  														<xsl:for-each select="./entry">
  															<li>
  																<xsl:attribute name="class">
  																	<xsl:choose>
  																		<xsl:when test=".//id/text()=$topEntry/id/text()">
  																			<xsl:value-of select="'active nav-item'" />
  																		</xsl:when>
  																		<xsl:otherwise>
  																			<xsl:value-of select="'nav-item'" />
  																		</xsl:otherwise>
  																	</xsl:choose>
  																</xsl:attribute>
  																<a class="subbar-item" href="{$baseURI}{$projectId}/{./target/text()}">
  																	<xsl:choose>
  																		<xsl:when test="./label/child::*">
  																			<xsl:copy-of select="./label/child::*"/>
  																		</xsl:when>
  																		<xsl:otherwise>
  																			<xsl:value-of select="./label/text()"/>
  																		</xsl:otherwise>
  																	</xsl:choose>
  																</a>
  															</li>
  														</xsl:for-each>
  													</ul>
  												</li>
  											</xsl:when>
  											<xsl:otherwise>
  												<li>
  													<xsl:attribute name="class">
  														<xsl:choose>
  															<xsl:when test=".//id/text()=$topEntry/id/text()">
  																<xsl:value-of select="'active nav-item'" />
  															</xsl:when>
  															<xsl:otherwise>
  																<xsl:value-of select="'nav-item'" />
  															</xsl:otherwise>
  														</xsl:choose>
  													</xsl:attribute>
  													<a class="subbar-item" href="{$baseURI}{$projectId}/{./target/text()}">
  														<xsl:choose>
  															<xsl:when test="./label/child::*">
  																<xsl:copy-of select="./label/child::*"/>
  															</xsl:when>
  															<xsl:otherwise>
  																<xsl:value-of select="./label/text()"/>
  															</xsl:otherwise>
  														</xsl:choose>
  													</a>
  												</li>
  											</xsl:otherwise>
  										</xsl:choose>
                                      </xsl:for-each>
                                  </ul>
                              </li>
                          </xsl:when>
                          <xsl:otherwise>
                              <li>
  								<xsl:attribute name="class">
  									<xsl:choose>
  										<xsl:when test=".//id/text()=$topEntry/id/text()">
  											<xsl:value-of select="'active nav-item'" />
  										</xsl:when>
  										<xsl:otherwise>
  											<xsl:value-of select="'nav-item'" />
  										</xsl:otherwise>
  									</xsl:choose>
  								</xsl:attribute>
                                  <a href="{$baseURI}{$projectId}/{./target/text()}">
                                      <xsl:choose>
                                          <xsl:when test="./label/child::*">
                                              <xsl:copy-of select="./label/child::*"/>
                                          </xsl:when>
                                          <xsl:otherwise>
                                              <xsl:value-of select="./label/text()"/>
                                          </xsl:otherwise>
                                      </xsl:choose>
                                  </a>
                              </li>
                          </xsl:otherwise>
                      </xsl:choose>
                  </xsl:for-each>
              </ul>
          </nav>
      </xsl:template>


</xsl:stylesheet>

ui/xsl/core/toc.xsl

0 → 100644
+60 −0
Original line number Diff line number Diff line
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"                xmlns:max="https://max.unicaen.fr"
exclude-result-prefixes="max"
>

    <xsl:import href="../../../../../ui/xsl/core/i18n.xsl"/>

    <xsl:param name="project"/>
    <xsl:param name="locale"/>

    <xsl:template match="/">
        <div id="toc">
            <h1>
                <xsl:value-of select="max:i18n($project,'toc.title',$locale)"/>
            </h1>
            <xsl:apply-templates/>
        </div>
    </xsl:template>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
    </xsl:template>

    <xsl:template match="ul[@class='collection']">
        <xsl:choose>
            <xsl:when test="li[@data-dir='true']">
                <details>
                    <xsl:apply-templates/>
                </details>
            </xsl:when>
            <xsl:otherwise>
                <xsl:apply-templates/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>

    <xsl:template match="li[@data-dir='true']">
        <xsl:apply-templates/>
    </xsl:template>

    <xsl:template match="li[@data-href]">
        <div class="fichierXml c{@depth}">
            <!-- <xsl:variable name="href">
                <xsl:value-of select="replace(@data-href, 'xml', 'html')"/>
            </xsl:variable> -->
            <a href="{@data-href}">
                <xsl:apply-templates/>
            </a>
        </div>
    </xsl:template>

    <xsl:template match="span[@class='summary']">
        <summary class="c{@depth}">
            <xsl:variable name="i18nKey" select="'toc.'||./text()" />
            <xsl:value-of select="max:i18n($project,$i18nKey,$locale)"/>
        </summary>
    </xsl:template>

</xsl:stylesheet>

xq/toc.xq

0 → 100644
+36 −0
Original line number Diff line number Diff line
declare variable $baseURI external;
declare variable $dbPath external;
declare variable $project external;

declare function local:list-db-resources($projectId, $dbPath, $baseURI, $dir){
    for $d in db:dir($dbPath, $dir)
    let $subDirs := local:list-db-resources($projectId, $dbPath, $baseURI, $dir||'/'||$d)
    let $depth := count(string-to-codepoints($dir)[.=string-to-codepoints('/')])
    order by $d/text() 
    return
        
        let $fullPath := substring-after($dir || '/' || $d/text(),'/')
        return
        <ul class="collection">
            {if(ends-with($d/text(),'.xml'))
            then 
                (
                for $c in doc($dbPath || '/' || $fullPath)//*:ead
                return 
                <li data-href='{$baseURI}{$projectId}/{$fullPath}/info/eadheader.html' depth="{$depth}">
                {data($c//*:titleproper)}
                </li> 
                )
            else
                <li data-dir='true'>
                	{<span class="summary" depth="{$depth}">{$d/text()}</span>}
                        {local:list-db-resources($projectId, $dbPath, $baseURI, $dir||'/'||$d)}
                	
                </li>
            }
        </ul>
};

<nav id="toc">
	{local:list-db-resources($project, $dbPath, $baseURI,'')}
</nav>
 No newline at end of file
+1 −1

File changed.

Contains only whitespace changes.

+13 −13

File changed.

Contains only whitespace changes.