1 | <%-- $Id: progress_reporter.jsp 6694 2015-01-26 14:41:25Z nicklas $ |
---|
2 | ------------------------------------------------------------------ |
---|
3 | Copyright (C) 2007 Nicklas Nordborg |
---|
4 | |
---|
5 | This file is part of BASE - BioArray Software Environment. |
---|
6 | Available at http://base.thep.lu.se/ |
---|
7 | |
---|
8 | BASE is free software; you can redistribute it and/or |
---|
9 | modify it under the terms of the GNU General Public License |
---|
10 | as published by the Free Software Foundation; either version 3 |
---|
11 | of the License, or (at your option) any later version. |
---|
12 | |
---|
13 | BASE is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | GNU General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU General Public License |
---|
19 | along with BASE. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | ------------------------------------------------------------------ |
---|
21 | |
---|
22 | Display a progress reporter |
---|
23 | |
---|
24 | @author Nicklas |
---|
25 | @version 2.0 |
---|
26 | --%> |
---|
27 | <%@ page pageEncoding="UTF-8" session="false" |
---|
28 | import="net.sf.basedb.core.SessionControl" |
---|
29 | import="net.sf.basedb.core.SimpleProgressReporter" |
---|
30 | import="net.sf.basedb.util.Values" |
---|
31 | import="net.sf.basedb.clients.web.Base" |
---|
32 | %> |
---|
33 | <%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
---|
34 | <%@ taglib prefix="tbl" uri="/WEB-INF/table.tld" %> |
---|
35 | <% |
---|
36 | String title = Values.getString(request.getParameter("title")); |
---|
37 | String progressName = request.getParameter("progress"); |
---|
38 | SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
39 | |
---|
40 | SimpleProgressReporter progress = (SimpleProgressReporter)sc.getSessionSetting("progress." + progressName); |
---|
41 | String message = null; |
---|
42 | int percentDone = 0; |
---|
43 | boolean isError = false; |
---|
44 | if (progress != null) |
---|
45 | { |
---|
46 | message = progress.getMessage(); |
---|
47 | percentDone = progress.getPercent(); |
---|
48 | } |
---|
49 | if (message == null) |
---|
50 | { |
---|
51 | message = "Please wait..."; |
---|
52 | } |
---|
53 | if (percentDone >= 100) |
---|
54 | { |
---|
55 | sc.setSessionSetting("progress." + progressName, null); |
---|
56 | isError = progress.getError() != null; |
---|
57 | } |
---|
58 | %> |
---|
59 | <base:page type="popup" title="<%=title%>"> |
---|
60 | <base:head styles="progressbar.css" scripts="~progress_reporter.js" /> |
---|
61 | <base:body data-percent-done="<%=percentDone %>" data-is-error="<%=isError ? 1 : 0 %>"> |
---|
62 | <h1><%=title%></h1> |
---|
63 | <div class="content"> |
---|
64 | |
---|
65 | <table class="fullcc bg-filled-50 bottomborder"><tr><td> |
---|
66 | <table class="progressbar" style="margin: auto;" id="progress-bar"> |
---|
67 | <tr> |
---|
68 | <td> |
---|
69 | <table class="bar" style="width: 200px;"> |
---|
70 | <tr> |
---|
71 | <%if (percentDone > 0) {%><td style="width: <%=percentDone%>%;" class="percentDone"> </td><%}%> |
---|
72 | <%if (percentDone < 100) {%><td style="width: <%=100-percentDone%>%;" class="percentRemain"> </td><%}%> |
---|
73 | </tr> |
---|
74 | </table> |
---|
75 | </td> |
---|
76 | <td id="percentText"><%=percentDone%>%</td> |
---|
77 | </tr> |
---|
78 | </table> |
---|
79 | <%=message %> |
---|
80 | <br><br> |
---|
81 | |
---|
82 | <div align="center" id="info"> |
---|
83 | <i>Closing this window will NOT abort the process</i> |
---|
84 | </div> |
---|
85 | </td></tr></table> |
---|
86 | </div> |
---|
87 | |
---|
88 | <base:buttongroup subclass="dialogbuttons"> |
---|
89 | <base:button id="close" title="Close" /> |
---|
90 | </base:buttongroup> |
---|
91 | |
---|
92 | </base:body> |
---|
93 | </base:page> |
---|