Skip to content

Instantly share code, notes, and snippets.

@apetro
Created August 27, 2014 13:21
Show Gist options
  • Select an option

  • Save apetro/3736f0727299567b7a62 to your computer and use it in GitHub Desktop.

Select an option

Save apetro/3736f0727299567b7a62 to your computer and use it in GitHub Desktop.
Bucky theme regions.xsl at 59efa651f265985dfbfb7cd031c7ae575ab955b3
<?xml version="1.0" encoding="utf-8"?>
<!--
Licensed to Jasig under one or more contributor license
agreements. See the NOTICE file distributed with this work
for additional information regarding copyright ownership.
Jasig licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a
copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
| This file defines areas or _Regions_ of the page in which non-tab/column
| portlets may be placed. Regions with portlets present must display them
| properly; regions without portlets must "disappear" gracefully. ALL of the
| essential page structure markup (related to regions) MUST be provided by the
| regions themselves, not by rendered portlets.
|
| The file is imported by the base stylesheet bucky.xsl.
| Parameters and templates from other XSL files may be referenced; refer to bucky.xsl for the list of parameters and imported XSL files.
| For more information on XSL, refer to [http://www.w3.org/Style/XSL/].
-->
<!-- ============================================= -->
<!-- ========== STYLESHEET DELCARATION =========== -->
<!-- ============================================= -->
<!--
| RED
| This statement defines this document as XSL and declares the Xalan extension
| elements used for URL generation and permissions checks.
|
| If a change is made to this section it MUST be copied to all other XSL files
| used by the theme
-->
<xsl:stylesheet
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dlm="http://www.uportal.org/layout/dlm"
xmlns:upAuth="http://xml.apache.org/xalan/java/org.jasig.portal.security.xslt.XalanAuthorizationHelper"
xmlns:upGroup="http://xml.apache.org/xalan/java/org.jasig.portal.security.xslt.XalanGroupMembershipHelper"
xmlns:upMsg="http://xml.apache.org/xalan/java/org.jasig.portal.security.xslt.XalanMessageHelper"
xmlns:url="https://source.jasig.org/schemas/uportal/layout/portal-url"
xsi:schemaLocation="https://source.jasig.org/schemas/uportal/layout/portal-url https://source.jasig.org/schemas/uportal/layout/portal-url-4.0.xsd"
exclude-result-prefixes="url upAuth upGroup upMsg dlm xsi"
version="1.0">
<!-- ========== TEMPLATE: HIDDEN-TOP ========== -->
<!-- ======================================== -->
<!--
| This template renders portlets at the very top of the page, across the entire width.
-->
<xsl:template name="region.hidden-top">
<xsl:if test="//region[@name='hidden-top']/channel">
<div id="region-page-top-hidden" class="container-fluid">
<div class="row">
<div class="col-sm-12">
<xsl:for-each select="//region[@name='hidden-top']/channel">
<xsl:call-template name="regions.portlet.decorator" />
</xsl:for-each>
</div>
</div>
</div>
</xsl:if>
</xsl:template>
<!-- ========== TEMPLATE: PAGE-TOP ========== -->
<!-- ======================================== -->
<!--
| This template renders portlets at the very top of the page, across the entire width.
-->
<xsl:template name="region.page-top">
<xsl:if test="//region[@name='page-top']/channel">
<div id="region-page-top" class="container-fluid">
<div class="row">
<div class="col-sm-12">
<xsl:for-each select="//region[@name='page-top']/channel">
<xsl:call-template name="regions.portlet.decorator" />
</xsl:for-each>
</div>
</div>
</div>
</xsl:if>
</xsl:template>
<!-- ========== TEMPLATE: HEADER-BOTTOM ========== -->
<!-- ========================================= -->
<!--
| This template renders portlets at the bottom of the header area.
-->
<xsl:template name="region.header-bottom">
<xsl:if test="//region[@name='header-bottom']/channel">
<div id="region-header-bottom" class="container-fluid">
<div class="row">
<div class="col-sm-12">
<xsl:for-each select="//region[@name='header-bottom']/channel">
<xsl:call-template name="regions.portlet.decorator" />
</xsl:for-each>
</div>
</div>
</div>
</xsl:if>
</xsl:template>
<!-- ========== TEMPLATE: Navigation Header ========== -->
<xsl:template name="region.nav-header">
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bucky-navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<xsl:if test="//region[@name='nav-header-brand']/channel">
<xsl:for-each select="//region[@name='nav-header-brand']/channel">
<xsl:call-template name="regions.portlet.decorator.lite" />
</xsl:for-each>
</xsl:if>
</div>
<div class="collapse navbar-collapse" id="bucky-navbar-collapse">
<xsl:if test="//region[@name='nav-header-content-small']/channel">
<ul class="nav navbar-nav hidden-sm hidden-md hidden-lg bucky-nav">
<xsl:for-each select="//region[@name='nav-header-content-small']/channel">
<li>
<xsl:call-template name="regions.portlet.decorator.lite" />
</li>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="//region[@name='nav-header-content-left']/channel">
<ul class="nav navbar-nav hidden-xs">
<xsl:for-each select="//region[@name='nav-header-content-left']/channel">
<li>
<xsl:call-template name="regions.portlet.decorator.lite" />
</li>
</xsl:for-each>
</ul>
</xsl:if>
<xsl:if test="//region[@name='nav-header-content-right']/channel">
<ul class="nav navbar-nav navbar-right hidden-xs">
<xsl:for-each select="//region[@name='nav-header-content-right']/channel">
<li>
<xsl:call-template name="regions.portlet.decorator.lite" />
</li>
</xsl:for-each>
</ul>
</xsl:if>
</div>
</div>
</nav>
</xsl:template>
<!-- ========== TEMPLATE: SIDEBAR-LEFT ========== -->
<!-- =========================================== -->
<!--
| This template renders portlets in the area left of the pre-content, content, and post-content regions.
-->
<xsl:template name="region.sidebar-left">
<xsl:if test="//region[@name='sidebar-left']/channel">
<div id="region-sidebar-left" class="col-{$SIDE_BAR_TRANSITION_POINT}-2 {$SIDE_BAR_ADDITIONAL_CLASSES}">
<xsl:for-each select="//region[@name='sidebar-left']/channel">
<xsl:call-template name="regions.portlet.decorator" />
</xsl:for-each>
</div>
</xsl:if>
</xsl:template>
<!-- ========== TEMPLATE: REGIONS PORTLET DECORATOR ========== -->
<!-- ========================================================= -->
<!--
| This template decorates a portlet that appears in a region (in lieu of chrome).
-->
<xsl:template name="regions.portlet.decorator">
<section id="portlet_{@ID}" class="up-portlet-wrapper {@fname}">
<xsl:if test="@portletMode!='edit' and @portletMode!='config' and @windowState!='minimized'">
<xsl:call-template name="regions.hover-menu"/>
</xsl:if>
<xsl:copy-of select="."/> <!-- Write in the contents of the portlet. -->
</section>
</xsl:template>
<xsl:template name="regions.portlet.decorator.lite">
<xsl:copy-of select="."/>
</xsl:template>
<!-- ========== TEMPLATE: REGIONS HOVER MENU ========== -->
<!-- ========================================================= -->
<!--
| For portlets in regions, the markup in this template provides access to
| some functions that normally appear in portlet chrome (e.g. EDIT and CONFIG).
-->
<xsl:template name="regions.hover-menu">
<xsl:variable name="editable">
<xsl:if test="parameter[@name='editable']/@value = 'true'">true</xsl:if>
</xsl:variable>
<xsl:variable name="permissionChannelId">PORTLET_ID.<xsl:value-of select="@chanID"/></xsl:variable>
<xsl:variable name="canConfigure">
<!-- This option is special in that it evaluates both whether (1) the portlet supports CONFIG mode and (2) this user is allowed to access it. -->
<xsl:if test="parameter[@name='configurable']/@value = 'true' and upAuth:hasPermission('UP_PORTLET_PUBLISH', 'PORTLET_MODE_CONFIG', $permissionChannelId)">true</xsl:if>
</xsl:variable>
<xsl:if test="$editable='true' or $canConfigure='true'">
<ul class="hover-chrome">
<xsl:if test="$editable='true'">
<xsl:variable name="portletEditUrl">
<xsl:call-template name="portalUrl">
<xsl:with-param name="url">
<url:portal-url>
<url:layoutId><xsl:value-of select="@ID"/></url:layoutId>
<url:portlet-url mode="EDIT" copyCurrentRenderParameters="true" />
</url:portal-url>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<li class="hover-option">
<a href="{$portletEditUrl}#{@ID}" title="{upMsg:getMessage('edit.portlet', $USER_LANG)}" class="up-portlet-control edit"><i class="fa fa-edit"></i></a>
</li>
</xsl:if>
<xsl:if test="$canConfigure='true'">
<xsl:variable name="portletConfigureUrl">
<xsl:call-template name="portalUrl">
<xsl:with-param name="url">
<url:portal-url>
<url:fname><xsl:value-of select="@fname"/></url:fname>
<url:portlet-url mode="CONFIG" copyCurrentRenderParameters="true" />
</url:portal-url>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<li class="hover-option">
<a href="{$portletConfigureUrl}" title="{upMsg:getMessage('configure.portlet', $USER_LANG)}" class="up-portlet-control configure"><i class="fa fa-gears"></i></a>
</li>
</xsl:if>
</ul>
<script type="text/javascript">
up.jQuery(document).ready(function() {
var $ = up.jQuery;
$('section.<xsl:value-of select="@fname" />').hover(function() {
$(this).find('.hover-chrome').stop(true, true).slideDown('medium');
},
function() {
$(this).find('.hover-chrome').stop(true,true).slideUp('medium');
});
});
</script>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment