<?xml version="1.0" encoding="UTF-8"?>
<rules
    xmlns="http://namespaces.plone.org/diazo"
    xmlns:css="http://namespaces.plone.org/diazo/css"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xi="http://www.w3.org/2001/XInclude">

  <theme href="home.html" css:if-content="body.template-frontpageview" />
  <theme href="full.html" css:if-content="#portal-column-content.width-full"/>
  <theme href="full.html"
         css:if-not-content="#portal-column-two, #newsportlet" />
  <theme href="example.html"/>
  <notheme if="$ajax_load" />
  <!--<notheme if="contains($path, 'manage')"/>-->
  <notheme if="contains($path, 'plugins')"/>
  <notheme if="contains($path, 'querybuilder')"/>
  <notheme if="contains($path, 'advanced/anchor.htm')"/>
  <notheme if="contains($path, 'advanced/source_editor.htm')"/>
  <notheme if="contains($path, 'image_view_fullscreen')"/>
  <notheme if-path="@@updated_search"/><!-- ajax response-view -->
  <notheme if-path="@@manage-viewlets" />


  <!-- Head -->
  <before content="/html/head/meta" css:theme="meta" />
  <replace theme="/html/head/title" content="/html/head/title"
           if-not-path="/" />
  <replace theme="/html/head/base" content="/html/head/base" />
  <append theme="/html/head" content="/html/head/script" />
  <append theme="/html/head" content="/html/head/link | /html/head/style" />


  <!-- Top / Header -->
  <copy attributes="href" css:content='#portal-logo'
        css:theme="#logo-container a" />

  <!-- User options (upper right) -->
  <!--      user name in options menu   -->
  <replace css:theme-children="#user-options-name"
           css:content-children="#portal-personaltools li:nth-child(1) a" />
  <!--      href of username link -->
  <copy attributes="href"
        css:content="#portal-personaltools li:nth-child(1) a"
        css:theme="#user-options a:nth-child(1)" />

  <!--      2nd to last link of user options (separators filtered out)
            These go into user options dropdown
  -->
  <copy css:theme="#user-options ul"
        css:if-content="#portal-personaltools li:nth-child(3)">
    <xsl:for-each css:select="#portal-personaltools li">
      <xsl:if test="not(position() mod 2 = 0)">
        <xsl:if test="not(position() = 1)">
          <xsl:copy-of select="." />
        </xsl:if>
      </xsl:if>
    </xsl:for-each>
  </copy>
  <!--       if user options are empty (only login and separator):
             avoid dropdown -->
  <drop css:theme="#user-options ul"
        css:if-not-content="#portal-personaltools li:nth-child(3)">
  </drop>
  <drop css:theme="#user-options a:nth-child(2)"
        css:if-not-content="#portal-personaltools li:nth-child(3)">
  </drop>
  <!-- /user-options -->

  <replace css:theme=".navbar-form" css:content="#portal-searchbox form"/>
  <drop css:content=".searchSection"/>
  <drop css:content="#LSResult"/>


  <replace css:theme-children="#menu-collapse .nav"
           css:content-children="#portal-globalnav"/>
  <!-- Frontpage Content -->
  <replace css:theme=".full-col" css:content=".full-col"
           css:if-content="body.template-frontpageview"/>
  <replace css:theme=".rslides" css:content=".rslides"/>
  <replace css:theme=".left-col" css:content=".left-col"
           css:if-content="body.template-frontpageview"/>


  <replace css:theme-children=".right-col"
           css:content-children="#portal-column-two"
           css:if-not-content="body.template-frontpageview"/>
  <replace css:theme-children=".right-col"
           css:content-children="#newsportlet"
           css:if-content="body.template-frontpageview"/>

  <!-- Content -->
  <before css:theme=".rslides_container" css:content="#edit-bar"/>

  <copy css:theme=".content-container"
        css:content-children="#portal-column-content"/>

  <!-- Footer -->
  <replace css:theme=".footer .section"
           css:content="#portal-footer-wrapper .section"/>

</rules>
