Last active
November 18, 2016 18:33
-
-
Save joannaho/a22baf2dd066f43c471d5c0fa0e853f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@include file="/apps/inchemistry/components/shared/global.jsp" %> | |
<%@ page session="false" | |
import="org.acs.inchemistry.configuration.ConfigurationPropertiesService" %> | |
<%@ page import="com.day.cq.wcm.api.PageFilter, | |
com.day.cq.wcm.api.Page, | |
com.day.cq.wcm.foundation.Navigation, | |
com.day.util.Timing" %> | |
<% | |
ConfigurationPropertiesService acs = sling.getService(ConfigurationPropertiesService.class); | |
pageContext.setAttribute("acs",acs); | |
pageContext.setAttribute("headerSearch", acs.getInchemistryHeaderSearch()); | |
%> | |
<% | |
PageFilter filter = new PageFilter(request); | |
%> | |
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top navbar-custom"> | |
<div class="container"> | |
<!-- Brand and toggle get grouped for better mobile display --> | |
<div class="navbar-header page-scroll"> | |
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> | |
<span class="sr-only">Toggle navigation</span><i class="fa fa-bars"></i> | |
</button> | |
<a class="navbar-brand" href="/content/inchemistry/en.html"><img src="/etc/designs/inchemistry/static/images/inchemistry-logo.svg" alt="logo"></a> | |
</div> | |
<!-- Collect the nav links, forms, and other content for toggling --> | |
<div class="collapse navbar-collapse col-md-9" id="bs-example-navbar-collapse-1"> | |
<ul class="nav navbar-nav"> | |
<li class="hidden"> | |
<a href="#page-top"></a> | |
</li> | |
<% | |
/* This determines if the Topic link needs to be highlighted. This happens when the current page | |
belongs to a child of Topics that is hidden */ | |
Navigation fakeNav = new Navigation(pageManager.getPage("/content/inchemistry/en/topics"), 3, null, 1); | |
boolean highlightTopic = false; | |
for(Navigation.Element e: fakeNav) { | |
switch(e.getType()) { | |
case ITEM_BEGIN: | |
Page p = pageManager.getPage(e.getPath()); | |
if(p.isHideInNav() && currentPage.getPath().contains(p.getPath())) { | |
highlightTopic = true; | |
} | |
} | |
} | |
%> | |
<% | |
Navigation nav = new Navigation(pageManager.getPage("/content/inchemistry/en"), homeLevel, filter, 1); | |
for ( Navigation.Element e: nav ) { | |
switch ( e.getType() ) { | |
case ITEM_BEGIN: | |
/* We need to explode the children of Topics as well */ | |
if(e.getPath().equals("/content/inchemistry/en/topics")) { | |
highlightTopic = highlightTopic || currentPage.getPath().equals(e.getPath()); | |
%> | |
<li <%if(highlightTopic) {%>class="active"<%}%>><a href="<%=e.getPath()%>.html"><%=e.getPage().getNavigationTitle() != null ? e.getPage().getNavigationTitle().toUpperCase() : e.getTitle()%></a></li> | |
<% | |
Navigation topicsNav = new Navigation(pageManager.getPage((e.getPath())), 3, filter, 1); | |
if(topicsNav != null) { | |
for(Navigation.Element el : topicsNav) { | |
switch(el.getType()) { | |
case ITEM_BEGIN: | |
%> | |
<li <%if(currentPage.getPath().contains(el.getPath())) {%>class="active"<%}%>><a href="<%=el.getPath()%>.html"><%=el.getPage().getNavigationTitle() != null ? el.getPage().getNavigationTitle().toUpperCase() : el.getTitle()%></a></li> | |
<% | |
break; | |
} | |
} | |
} | |
} | |
/* This simply prints out the remaining children of the nav list */ | |
else { | |
%> | |
<li <%if(currentPage.getPath().equals(e.getPath())) {%>class="active"<%}%>><a href="<%=e.getPath()%>.html"><%=e.getPage().getNavigationTitle() != null ? e.getPage().getNavigationTitle().toUpperCase() : e.getTitle()%></a></li> | |
<% | |
} | |
break; | |
} | |
} | |
%> | |
</ul> | |
</div> | |
<ul id="search-icon" class="col-md-1"> <li class="search-icon"><a href="#search-full" class="glyphicon glyphicon-search"></a></li></ul> | |
<!-- /.navbar-collapse --> | |
<div id="search-full"> | |
<i class="icon-close ion-ios-close-empty close"></i> | |
<form action="${headerSearch}/search" method="get" role="search"> | |
<!--form action="http://searchtest.acs.org/search" method="get" role="search"--> | |
<input type="text" name="q" id="searchsite" title="Enter keywords to search" placeholder="Type to Search InChemistry" autocomplete="off" /> | |
<input type="hidden" value="inchemistry" name="client"/> | |
<input type="hidden" value="xml_no_dtd" name="output"/> | |
<input type="hidden" value="inchemistry" name="proxystylesheet"/> | |
<input type="hidden" value="date:D:L:d1" name="sort"/> | |
<input type="hidden" value="3" name="entqr"/> | |
<input type="hidden" value="UTF-8" name="oe"/> | |
<input type="hidden" value="UTF-8" name="ie"/> | |
<input type="hidden" value="1" name="ud"/> | |
<input type="hidden" value="acs" name="site"/> | |
<input type="hidden" value="p" name="filter"/> | |
<button type="submit" class="glyphicon glyphicon-search"></button> | |
</form> | |
</div> | |
</div> | |
<!-- /.container-fluid --> | |
</nav> | |
<!-- header end --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment