%
request.setCharacterEncoding("UTF-8");
Servlets.setCharacterEncoding(request, response);
%> <%-- Must be the very first, in order character encoding takes effect --%>
<%@ include file="imports.jsp"%>
<%@page import="java.io.File"%>
<%@page import="java.util.Arrays"%>
<%@page import="org.openxava.util.XavaResources"%>
<%@page import="org.openxava.util.Locales"%>
<%@page import="org.openxava.util.Users"%>
<%@page import="org.openxava.util.XSystem"%>
<%@page import="org.openxava.util.Strings"%>
<%@page import="org.openxava.util.Is"%>
<%@page import="org.openxava.web.dwr.Module"%>
<%@page import="org.openxava.web.servlets.Servlets"%>
<%@page import="org.openxava.web.Ids"%>
<%@page import="org.openxava.web.Requests"%>
<%@page import="org.openxava.web.style.Themes"%>
<%@page import="org.apache.commons.logging.LogFactory" %>
<%@page import="org.apache.commons.logging.Log" %>
<%@page import="org.openxava.web.Browsers"%>
<%@page contentType="text/html; charset=UTF-8" %>
<%!private static Log log = LogFactory.getLog("module.jsp");
private String getAdditionalParameters(HttpServletRequest request) {
StringBuffer result = new StringBuffer();
for (java.util.Enumeration en = request.getParameterNames(); en
.hasMoreElements();) {
String name = (String) en.nextElement();
if ("application".equals(name) || "module".equals(name)
|| "xava.portlet.application".equals(name)
|| "xava.portlet.module".equals(name))
continue;
String value = request.getParameter(name);
result.append('&');
result.append(name);
result.append('=');
result.append(value);
}
return result.toString();
}%>
<%
request.setAttribute("style", org.openxava.web.style.Style.getInstance(request));
%>
<%
if ("true".equals(request.getParameter("init"))) {
context.resetModule(request);
}
String windowId = context.getWindowId(request);
context.setCurrentWindowId(windowId);
Locales.setCurrent(request);
request.getSession().setAttribute("xava.user",
request.getRemoteUser());
String app = request.getParameter("application");
String module = context.getCurrentModule(request);
String contextPath = (String) request.getAttribute("xava.contextPath");
if (contextPath == null) contextPath = request.getContextPath();
org.openxava.controller.ModuleManager managerHome = (org.openxava.controller.ModuleManager) context
.get(request, "manager",
"org.openxava.controller.ModuleManager");
org.openxava.controller.ModuleManager manager = (org.openxava.controller.ModuleManager) context
.get(app, module, "manager",
"org.openxava.controller.ModuleManager");
manager.setSession(session);
managerHome.setSession(session);
manager.setApplicationName(request.getParameter("application"));
manager.setModuleName(module); // In order to show the correct description in head
boolean restoreLastMessage = false;
if (manager.isFormUpload()) {
new Module().requestMultipart(request, response, app, module);
}
else {
restoreLastMessage = true;
}
boolean isPortlet = (session.getAttribute(Ids.decorate(app, request
.getParameter("module"), "xava.portlet.uploadActionURL")) != null);
Module.setPortlet(isPortlet);
boolean htmlHead = isPortlet?false:!Is.equalAsStringIgnoreCase(request.getParameter("htmlHead"), "false");
String version = org.openxava.controller.ModuleManager.getVersion();
String realPath = request.getSession().getServletContext()
.getRealPath("/");
Requests.init(request, app, module);
manager.log(request, "MODULE:" + module);
manager.setModuleURL(request);
%>
<%
if (htmlHead) {
%>
<%=managerHome.getModuleDescription()%>
<%=style.getMetaTags()%>
<%
String[] jsFiles = style.getNoPortalModuleJsFiles();
if (jsFiles != null) {
for (int i = 0; i < jsFiles.length; i++) {
%>
<%
}
}
%>
<%
}
if (style.getCssFile() != null) {
%>
<%
}
for (java.util.Iterator it = style.getAdditionalCssFiles()
.iterator(); it.hasNext();) {
String cssFile = (String) it.next();
%>
<%
}
%>
<%
File styleEditorsFolder = new File(realPath + "/xava/editors/style");
String[] styleEditors = styleEditorsFolder.list();
Arrays.sort(styleEditors);
for (int i = 0; i < styleEditors.length; i++) {
if (styleEditors[i].endsWith(".css")) {
%>
<%
}
}
%>
<% if (Browsers.isIE(request)) { %>
<% } %>
<%
if (style.isNeededToIncludeCalendar()) {
%>
<%
}
%>
<%
if (new File(realPath + "/xava/js/custom-editors.js").exists()) {
%>
<%
log.warn(XavaResources.getString("custom_editors_deprecated"));
}
%>
<%
File jsEditorsFolder = new File(realPath + "/xava/editors/js");
String[] jsEditors = jsEditorsFolder.list();
Arrays.sort(jsEditors);
for (int i = 0; i < jsEditors.length; i++) {
if (jsEditors[i].endsWith(".js")) {
%>
<%
}
}
String[] jsFiles = request.getParameterValues("jsFiles");
if (jsFiles != null) {
for (int i = 0; i < jsFiles.length; i++) {
if (jsFiles[i].endsWith(".js")) {
%>
<% }
}
}
%>
<%
if (htmlHead) {
%>
<%=style.getNoPortalModuleStartDecoration(managerHome
.getModuleDescription())%>
<%
}
%>
<%
boolean coreViaAJAX = manager.isCoreViaAJAX(request);
if (!coreViaAJAX && restoreLastMessage) {
Module.restoreLastMessages(request, app, module);
}
if (manager.isResetFormPostNeeded()) {
%>
<% } else { %>
<% if (!coreViaAJAX) manager.executeBeforeLoadPage(request, errors, messages); %>
<%-- Layer for progress bar --%>
<%=XavaResources.getString(request, "processing")%>
<%=style.getCoreStartDecoration()%>
<%
if (!coreViaAJAX) {
%>
<%
}
%>
<%=style.getCoreEndDecoration()%>
<% } %>
<% if (Themes.isChooserEnabled()) { %>
<% } %>
...
<% if (!style.isFixedPositionSupported()) { %>
...
<% } %>
<%
if (htmlHead) {
%>
<%=style.getNoPortalModuleEndDecoration()%>