1 | <%-- $Id: upload_torrent.jsp 1636 2012-05-03 11:23:14Z 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 | <% |
---|
39 | final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
---|
40 | final ItemContext cc = Base.getAndSetCurrentContext(sc, Item.DIRECTORY, null, null); |
---|
41 | final int currentDirId = cc.getId(); |
---|
42 | final String ID = sc.getId(); |
---|
43 | final float scale = Base.getScale(sc); |
---|
44 | final DbControl dc = sc.newDbControl(); |
---|
45 | try |
---|
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 | |
---|
64 | <div id="selectForm"> |
---|
65 | <h1>Upload torrent</h1> |
---|
66 | <form action="UploadTorrent.servlet?ID=<%=ID%>&directory_id=<%=directory.getId()%>" |
---|
67 | method="post" name="file" enctype="multipart/form-data" onsubmit="return false;"> |
---|
68 | |
---|
69 | <div class="content filled"> |
---|
70 | <div> |
---|
71 | <table class="fullform input100 bottomborder"> |
---|
72 | <tr> |
---|
73 | <th>Save in</th> |
---|
74 | <td><%=HTML.encodeTags(directory.getPath().toString())%></td> |
---|
75 | </tr> |
---|
76 | <tr> |
---|
77 | <th>Torrent file</th> |
---|
78 | <td> |
---|
79 | <input <%=requiredClazz%> type="file" name="torrent" size="50"> |
---|
80 | </td> |
---|
81 | </tr> |
---|
82 | </table> |
---|
83 | <div class="padded"> |
---|
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 | </div> |
---|
90 | </div> |
---|
91 | </form> |
---|
92 | |
---|
93 | <base:buttongroup subclass="dialogbuttons"> |
---|
94 | <base:button image="upload.png" onclick="doUpload()" title="Upload" /> |
---|
95 | <base:button onclick="top.window.close()" title="Cancel" /> |
---|
96 | </base:buttongroup> |
---|
97 | |
---|
98 | </base:body> |
---|
99 | </base:page> |
---|
100 | <% |
---|
101 | } |
---|
102 | finally |
---|
103 | { |
---|
104 | if (dc != null) dc.close(); |
---|
105 | } |
---|
106 | %> |
---|