source: extensions/net.sf.basedb.torrent/trunk/resources/upload_torrent.jsp @ 1304

Last change on this file since 1304 was 1304, checked in by Nicklas Nordborg, 12 years ago

Added support for aborting a torrent upload. Added support for resuming uploads in case of a server restart.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 3.3 KB
Line 
1<%-- $Id: upload_torrent.jsp 1304 2011-03-03 08:19:00Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) 2010 Nicklas Nordborg
4
5  This file is part of Bittorent download service for BASE.
6  Available at http://baseplugins.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 2
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 this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA  02111-1307, USA.
22  ------------------------------------------------------------------
23
24  @author Nicklas
25  @version 1.0
26--%>
27<%@ page session="false" pageEncoding="UTF-8"
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.ItemContext"
30  import="net.sf.basedb.core.DbControl"
31  import="net.sf.basedb.core.Directory"
32  import="net.sf.basedb.core.Item"
33  import="net.sf.basedb.clients.web.Base"
34  import="net.sf.basedb.clients.web.util.HTML"
35%>
36<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
37<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
38<%
39final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
40final ItemContext cc = Base.getAndSetCurrentContext(sc, Item.DIRECTORY, null, null);
41final int currentDirId = cc.getId();
42final String ID = sc.getId();
43final float scale = Base.getScale(sc);
44final DbControl dc = sc.newDbControl();
45try
46{
47  final Directory directory = Directory.getById(dc, currentDirId);
48 
49  final String clazz = "class=\"text\"";
50  final String requiredClazz = "class=\"text required\"";
51  %>
52  <base:page type="popup" title="Upload torrent">
53  <base:head>
54    <script language="JavaScript">
55    function doUpload()
56    {
57      var frm = document.forms['file'];
58      frm.submit();
59    }
60    </script>
61  </base:head>
62  <base:body>
63  <p>
64  <div id="selectForm">
65    <form action="UploadTorrent.servlet?ID=<%=ID%>&directory_id=<%=directory.getId()%>" 
66      method="post" name="file" enctype="multipart/form-data" onsubmit="return false;">
67
68    <h3 class="docked">Upload torrent</h3>
69    <div class="boxedbottom">
70      <table class="form" cellspacing=0>
71      <tr>
72        <td class="prompt">Save in</td>
73        <td><%=HTML.encodeTags(directory.getPath().toString())%></td>
74      </tr>
75      <tr>
76        <td class="prompt">Torrent file</td>
77        <td>
78          <input <%=requiredClazz%> type="file" name="torrent" size="50">
79        </td>
80      </tr>
81      <tr>
82        <td colspan="2">
83        <div class="helpmessage">
84        Select a torrent file on your local computer. The torrent file will
85        be submitted as a job to the torrent service on the BASE server.
86        When the service has downloaded all files they will be saved to
87        the current directory.
88        </div>
89        </td>
90      </tr>
91      </table>
92    </div>
93
94    <table align="center">
95    <tr>
96      <td width="50%"><base:button image="upload.gif" onclick="doUpload()" title="Upload" /></td>
97      <td width="50%"><base:button onclick="top.window.close()" title="Cancel" /></td>
98    </tr>
99    </table>
100  </form>
101 
102  </base:body>
103  </base:page>
104  <%
105}
106finally
107{
108  if (dc != null) dc.close();
109}
110%>
Note: See TracBrowser for help on using the repository browser.