DS-1768 Add a default navigation-bar when no one is requested to allow minimal brand and navigation

This commit is contained in:
Andrea Bollini
2013-12-02 01:16:30 +01:00
parent c1dfbc0199
commit cc8eff7c3a
3 changed files with 115 additions and 0 deletions

View File

@@ -133,6 +133,14 @@
</div> </div>
<% <%
} }
else
{
%>
<div class="container">
<dspace:include page="/layout/navbar-minimal.jsp" />
</div>
<%
}
%> %>
</header> </header>

View File

@@ -133,6 +133,14 @@
</div> </div>
<% <%
} }
else
{
%>
<div class="container">
<dspace:include page="/layout/navbar-minimal.jsp" />
</div>
<%
}
%> %>
</header> </header>

View File

@@ -0,0 +1,99 @@
<%--
The contents of this file are subject to the license and copyright
detailed in the LICENSE and NOTICE files at the root of the source
tree and available online at
http://www.dspace.org/license/
--%>
<%--
- Default navigation bar
--%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/dspace-tags.tld" prefix="dspace" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
<%@ page import="org.dspace.app.webui.util.UIUtil" %>
<%@ page import="org.dspace.content.Collection" %>
<%@ page import="org.dspace.content.Community" %>
<%@ page import="org.dspace.eperson.EPerson" %>
<%@ page import="org.dspace.core.ConfigurationManager" %>
<%@ page import="org.dspace.browse.BrowseIndex" %>
<%@ page import="org.dspace.browse.BrowseInfo" %>
<%@ page import="java.util.Map" %>
<%
// Is anyone logged in?
EPerson user = (EPerson) request.getAttribute("dspace.current.user");
// Is the logged in user an admin
Boolean admin = (Boolean)request.getAttribute("is.admin");
boolean isAdmin = (admin == null ? false : admin.booleanValue());
// Get the current page, minus query string
String currentPage = UIUtil.getOriginalURL(request);
int c = currentPage.indexOf( '?' );
if( c > -1 )
{
currentPage = currentPage.substring( 0, c );
}
// E-mail may have to be truncated
String navbarEmail = null;
if (user != null)
{
navbarEmail = user.getEmail();
}
%>
<div class="navbar-header">
<a class="navbar-brand" href="<%= request.getContextPath() %>/"><img height="25px" src="<%= request.getContextPath() %>/image/dspace-logo-only.png" /></a>
</div>
<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
<div class="nav navbar-nav navbar-right">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<%
if (user != null)
{
%>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> <fmt:message key="jsp.layout.navbar-default.loggedin">
<fmt:param><%= StringUtils.abbreviate(navbarEmail, 20) %></fmt:param>
</fmt:message> <b class="caret"></b></a>
<%
} else {
%>
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> <fmt:message key="jsp.layout.navbar-default.sign"/> <b class="caret"></b></a>
<% } %>
<ul class="dropdown-menu">
<li><a href="<%= request.getContextPath() %>/mydspace"><fmt:message key="jsp.layout.navbar-default.users"/></a></li>
<li><a href="<%= request.getContextPath() %>/subscribe"><fmt:message key="jsp.layout.navbar-default.receive"/></a></li>
<li><a href="<%= request.getContextPath() %>/profile"><fmt:message key="jsp.layout.navbar-default.edit"/></a></li>
<%
if (isAdmin)
{
%>
<li class="divider"></li>
<li><a href="<%= request.getContextPath() %>/dspace-admin"><fmt:message key="jsp.administer"/></a></li>
<%
}
if (user != null) {
%>
<li><a href="<%= request.getContextPath() %>/logout"><span class="glyphicon glyphicon-log-out"></span> <fmt:message key="jsp.layout.navbar-default.logout"/></a></li>
<% } %>
</ul>
</li>
</ul>
</div>
</nav>