META-INF.resources.naviox.selectModules.jsp Maven / Gradle / Ivy
<%--
NaviOX. Navigation and security for OpenXava applications.
Copyright 2014 Javier Paniza Lucas
License: Apache License, Version 2.0.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
License: GNU Lesser General Public License (LGPL), version 2.1 or later.
See the lgpl.txt file in the root directory or .
--%>
<%@include file="../xava/imports.jsp"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Collection"%>
<%@page import="org.openxava.util.Is"%>
<%@page import="org.openxava.util.Strings"%>
<%@page import="org.openxava.util.Locales"%>
<%@page import="org.openxava.application.meta.MetaModule"%>
<%
String searchWord = request.getParameter("searchWord");
searchWord = searchWord == null?"":Strings.removeAccents(searchWord.toLowerCase());
Collection modulesList = modules.getMenuModules(request);
boolean bookmarkModules = "true".equals(request.getParameter("bookmarkModules"));
String smodulesLimit = request.getParameter("modulesLimit");
int modulesLimit = smodulesLimit == null?30:Integer.parseInt(smodulesLimit);
int counter = 0;
boolean loadMore = false;
for (Iterator it= modulesList.iterator(); it.hasNext();) {
if (counter == modulesLimit) {
loadMore = true;
break;
}
MetaModule module = (MetaModule) it.next();
String selected = module.getName().equals(modules.getCurrentModuleName())?"selected":"";
String label = module.getLabel(Locales.getCurrent());
String description = module.getDescription(Locales.getCurrent());
String normalizedLabel = Strings.removeAccents(label.toLowerCase());
String normalizedDescription = Strings.removeAccents(description.toLowerCase());
if (!Is.emptyString(searchWord) && !normalizedLabel.contains(searchWord) && !normalizedDescription.contains(searchWord)) continue;
counter++;
%>
<%-- href with the URL in order right mouse button works to add in another tab --%>
<%=label%>
<% if (bookmarkModules) { %>
<% } %>
<%
}
if (loadMore) {
%>
...
...
<%
}
%>