[abportal] View of /src/main/webapp/result-view.jsp
View of /src/main/webapp/result-view.jsp
Parent Directory
| Revision Log
Revision 1 -
( download)
( annotate)
Wed Jul 28 10:05:51 2010 UTC
(13 years, 10 months ago)
by dgarcia
File size: 5239 byte(s)
First code commit
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.List" %>
<%@ page import="eu.smartlm.abs.portal.util.StringUtil" %>
<%@ page import="eu.smartlm.abs.portal.view.event.EventData" %>
<%@ page import="eu.smartlm.abs.portal.view.portlet.QueryPortlet" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<link href="<%=request.getContextPath()%>/css/style.css" type="text/css" rel="stylesheet" />
<portlet:defineObjects />
<%
String selectedProducts = "";
String selectedUsers = "";
String selectedAccountingGroups = "";
String selectedProjects = "";
String selectedHosts = "";
String selectedSubmitHosts = "";
PortletPreferences prefs = renderRequest.getPreferences();
String startDateToShow = "";
String endDateToShow = "";
EventData eventData = null;
List<List<String>> usageInformationList = (List<List<String>>) portletSession.getAttribute("usageInformationList");
boolean representGraph = ((Boolean) portletSession.getAttribute("representGraph")).booleanValue();
if(representGraph) {
eventData = (EventData) portletSession.getAttribute("eventdata");
startDateToShow = eventData.getStartDate();
endDateToShow = eventData.getEndDate();
pageContext.setAttribute("representGraph", representGraph);
selectedProducts = StringUtil.listToStringWithCommas(eventData.getQueryProducts());
selectedUsers = StringUtil.listToStringWithCommas(eventData.getQueryUsers());
selectedAccountingGroups = StringUtil.listToStringWithCommas(eventData.getQueryAccountingGroups());
selectedProjects = StringUtil.listToStringWithCommas(eventData.getQueryProjects());
selectedHosts = StringUtil.listToStringWithCommas(eventData.getQueryHosts());
selectedSubmitHosts = StringUtil.listToStringWithCommas(eventData.getQuerySubmitHosts());
// To Show the Query
pageContext.setAttribute("selectedProductsLength", eventData.getQueryProducts().size());
pageContext.setAttribute("selectedProducts", selectedProducts);
pageContext.setAttribute("selectedUsersLength", eventData.getQueryUsers().size());
pageContext.setAttribute("selectedUsers", selectedUsers);
pageContext.setAttribute("selectedAccountingGroupsLength", eventData.getQueryAccountingGroups().size());
pageContext.setAttribute("selectedAccountingGroups",selectedAccountingGroups);
pageContext.setAttribute("selectedProjectsLength", eventData.getQueryProjects().size());
pageContext.setAttribute("selectedProjects", selectedProjects);
pageContext.setAttribute("selectedHostsLength", eventData.getQueryHosts().size());
pageContext.setAttribute("selectedHosts", selectedHosts);
pageContext.setAttribute("selectedSubmitHostsLength", eventData.getQuerySubmitHosts().size());
pageContext.setAttribute("selectedSubmitHosts", selectedSubmitHosts);
pageContext.setAttribute("total", eventData.getTotal());
}
%>
<c:if test="${representGraph}">
<!-- Query used to retrieve the data: -->
<div id="roundbox">
<p><strong>Query:</strong></p>
<ul>
<li>From <strong><%=startDateToShow%></strong> to <strong><%=endDateToShow%></strong>.</li>
<c:if test="${selectedProductsLength > 0}">
<li>Products: <strong><c:out value="${selectedProducts}" /></strong>.</li>
</c:if>
<c:if test="${selectedUsersLength > 0}">
<li>Users: <strong><c:out value="${selectedUsers}" /></strong>.</li>
</c:if>
<c:if test="${selectedAccountingGroupsLength > 0}">
<li>Accounting Groups: <strong><c:out value="${selectedAccountingGroups}" /></strong>.</li>
</c:if>
<c:if test="${selectedProjectsLength > 0}">
<li>Projects: <strong><c:out value="${selectedProjects}" /></strong>.</li>
</c:if>
<c:if test="${selectedHostsLength > 0}">
<li>Hosts: <strong><c:out value="${selectedHosts}" /></strong>.</li>
</c:if>
<c:if test="${selectedSubmitHostsLength > 0}">
<li>SubmitHosts: <strong><c:out value="${selectedSubmitHosts}" /></strong>.</li>
</c:if>
</ul>
</div>
<!-- Graph representation that resumes the data -->
<div id="roundbox">
<p><strong>Graph representation:</strong></p>
<center><img src="<%= renderRequest.getContextPath() + "/displayPieChartGraph" %>" /></center>
</div>
<div id="roundbox">
<p><strong>Records:</strong></p>
<div id="queryconstructorbox">
<table cellpadding="10" border="1" cellspacing="10" width="500">
<%
int i = 0;
for(List<String> line : usageInformationList) {
%>
<tr>
<%
for(String cell : line) {
if(i != 0) {
%>
<td style="padding:5px;"><%= cell %></td>
<%
} else {
%>
<th width="100" style="padding:5px;"><%= cell %></th>
<% }
}
%>
</tr>
<%
i++;
}
if(eventData.getType().equals(QueryPortlet.TYPE_BILLING)) {
%>
<tr>
<td colspan="6" align="right">Total: <%=eventData.getTotal() %> €</td>
</tr>
<% } %>
</table>
</div>
</div>
<!-- OUTPUT OPTIONS -->
<div id="roundbox">
<p><a href="<%= renderRequest.getContextPath() + "/pdfOutput" %>">Export results to PDF</a>.</p>
</div>
</c:if>
|