source: trunk/www/common/plugin/download_immediately.jsp @ 5798

Last change on this file since 5798 was 5798, checked in by Nicklas Nordborg, 11 years ago

References #1590: Documentation cleanup

New and updated screenshots for chapter 18+19 - Import/export.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 4.7 KB
Line 
1<%-- $Id: download_immediately.jsp 5798 2011-10-11 16:32:48Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2006, 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  @author Nicklas
23  @version 2.0
24--%>
25<%@ page pageEncoding="UTF-8" session="false"
26  import="net.sf.basedb.core.SessionControl"
27  import="net.sf.basedb.core.DbControl"
28  import="net.sf.basedb.core.PluginResponse"
29  import="net.sf.basedb.clients.web.Base"
30  import="net.sf.basedb.util.Values"
31  import="net.sf.basedb.clients.web.util.HTML"
32%>
33<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
34<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
35
36<%
37final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
38final String ID = sc.getId();
39final DbControl dc = sc.newDbControl();
40PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response");
41String title = pluginResponse.getMessage() == null ? 
42  "Download export" : HTML.encodeTags(pluginResponse.getMessage());
43try
44{
45  %>
46  <base:page type="popup" title="<%=title%>">
47  <base:head scripts="ajax.js" styles="progressbar.css">
48    <script language="JavaScript">
49    function downloadExport()
50    {
51      Main.hide("download");
52      Main.hide("beforeDownloadInfo");
53      Main.show("afterDownloadInfo");
54      Main.show("progress");   
55      document.getElementById("downloadFrame").src = 'index.jsp?ID=<%=ID%>&cmd=ExportImmediately';
56      sendProgressUpdateWithAjax();
57    }
58    function doCancel()
59    {
60      location = 'index.jsp?ID=<%=ID%>&cmd=CancelWizard';
61    }
62    function updateProgressWithAjax(request)
63    {
64      var percent = request.responseText;
65      displayProgress(percent);
66      if (percent < 100)
67      {
68        setTimeout('sendProgressUpdateWithAjax()', 1500);
69      }
70    }
71    function sendProgressUpdateWithAjax()
72    {
73      var request = Ajax.getXmlHttpRequest();
74      if (request != null)
75      {
76        var url = 'progress.jsp?ID=<%=ID%>&ajax=1&'+Math.random();
77        request.open("GET", url, true);
78        Ajax.setReadyStateHandler(request, updateProgressWithAjax);
79        request.send(null);
80      }
81      return request != null;
82    }
83    function displayProgress(percentDone)
84    {   
85      document.getElementById('percent').innerHTML = '&nbsp;' + percentDone+'%';
86      var doneElement = document.getElementById('percentDone');
87      doneElement.style.width = percentDone+'%';
88      var remainElement = document.getElementById('percentRemain');
89      remainElement.style.width = (100-percentDone)+'%';
90      if (percentDone == 100) Main.hide('percentRemain');
91    }
92    function init()
93    {
94      Main.hide("progress");
95      document.getElementById('percentDone').width = '0%';
96      document.getElementById('percentRemain').width = '100%';
97      document.getElementById('percent').innerHTML = '&nbsp;0%';
98    }
99    </script>
100  </base:head>
101  <base:body onload="init()">
102
103  <br><br>
104  <div align="center">
105  <base:note type="info" title="<%=title%>" style="width:80%;">
106    <br>
107    <div id="beforeDownloadInfo">
108    The configuration has been successfully completed.
109    Use the <code>Download</code> button to download the
110    exported data.
111    </div>
112    <div id="afterDownloadInfo">
113    Do not close this window until the download has finished.
114    </div>
115    <br>
116    <!-- The progress bar -->
117    <div id="progress" style="align:center;">
118      <table width="90%" border=0 cellspacing=0 cellpadding=0 align="center">
119      <tr>
120      <td width="80%" >
121        <table width="100%" class="progressbar" border=0 cellspacing=0 cellpadding=0>
122        <tr>
123          <td width="0%" class="done" id="percentDone">&nbsp;</td>
124          <td width="100%" class="remain" id="percentRemain">&nbsp;</td>
125        </tr>
126        </table>
127      </td>
128        <td width="20%" id="percent">&nbsp;0%</td>
129      </tr>
130      </table>
131    </div>
132    <br><br>
133  </base:note>
134  </div>
135  <br>
136
137    <table align="center">
138    <tr>
139      <td width="50%"><base:button id="download" onclick="downloadExport();" title="Download" 
140        image="download.gif" /></td>
141      <td width="50%"><base:button onclick="doCancel();" title="Cancel" /></td>
142    </tr>
143    </table>
144    <iframe id="downloadFrame" src="" frameborder=0 width=1 height=1/>
145  </base:body>
146  </base:page>
147  <%
148}
149finally
150{
151  if (dc != null) dc.close();
152}
153%>
154
Note: See TracBrowser for help on using the repository browser.