1255 |
22 Oct 10 |
nicklas |
1 |
<%-- $Id$ |
1255 |
22 Oct 10 |
nicklas |
2 |
------------------------------------------------------------------ |
1255 |
22 Oct 10 |
nicklas |
Copyright (C) 2010 Nicklas Nordborg |
1255 |
22 Oct 10 |
nicklas |
4 |
|
1255 |
22 Oct 10 |
nicklas |
5 |
This file is part of Bittorent download service for BASE. |
1255 |
22 Oct 10 |
nicklas |
6 |
Available at http://baseplugins.thep.lu.se/ |
1255 |
22 Oct 10 |
nicklas |
7 |
|
1255 |
22 Oct 10 |
nicklas |
8 |
BASE is free software; you can redistribute it and/or |
1255 |
22 Oct 10 |
nicklas |
9 |
modify it under the terms of the GNU General Public License |
1255 |
22 Oct 10 |
nicklas |
10 |
as published by the Free Software Foundation; either version 2 |
1255 |
22 Oct 10 |
nicklas |
11 |
of the License, or (at your option) any later version. |
1255 |
22 Oct 10 |
nicklas |
12 |
|
1255 |
22 Oct 10 |
nicklas |
13 |
BASE is distributed in the hope that it will be useful, |
1255 |
22 Oct 10 |
nicklas |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1255 |
22 Oct 10 |
nicklas |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1255 |
22 Oct 10 |
nicklas |
16 |
GNU General Public License for more details. |
1255 |
22 Oct 10 |
nicklas |
17 |
|
1255 |
22 Oct 10 |
nicklas |
18 |
You should have received a copy of the GNU General Public License |
1255 |
22 Oct 10 |
nicklas |
19 |
along with this program; if not, write to the Free Software |
1255 |
22 Oct 10 |
nicklas |
20 |
Foundation, Inc., 59 Temple Place - Suite 330, |
1255 |
22 Oct 10 |
nicklas |
21 |
Boston, MA 02111-1307, USA. |
1255 |
22 Oct 10 |
nicklas |
22 |
------------------------------------------------------------------ |
1255 |
22 Oct 10 |
nicklas |
23 |
|
1255 |
22 Oct 10 |
nicklas |
24 |
@author Nicklas |
1255 |
22 Oct 10 |
nicklas |
25 |
@version 1.0 |
1255 |
22 Oct 10 |
nicklas |
26 |
--%> |
1255 |
22 Oct 10 |
nicklas |
27 |
<%@ page session="false" pageEncoding="UTF-8" |
1255 |
22 Oct 10 |
nicklas |
28 |
import="net.sf.basedb.core.SessionControl" |
1255 |
22 Oct 10 |
nicklas |
29 |
import="net.sf.basedb.core.ItemContext" |
1255 |
22 Oct 10 |
nicklas |
30 |
import="net.sf.basedb.core.DbControl" |
1255 |
22 Oct 10 |
nicklas |
31 |
import="net.sf.basedb.core.Directory" |
1255 |
22 Oct 10 |
nicklas |
32 |
import="net.sf.basedb.core.Item" |
1255 |
22 Oct 10 |
nicklas |
33 |
import="net.sf.basedb.clients.web.Base" |
1255 |
22 Oct 10 |
nicklas |
34 |
import="net.sf.basedb.clients.web.util.HTML" |
1255 |
22 Oct 10 |
nicklas |
35 |
%> |
1255 |
22 Oct 10 |
nicklas |
36 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
1255 |
22 Oct 10 |
nicklas |
37 |
<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %> |
1255 |
22 Oct 10 |
nicklas |
38 |
<% |
1255 |
22 Oct 10 |
nicklas |
39 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
1255 |
22 Oct 10 |
nicklas |
40 |
final ItemContext cc = Base.getAndSetCurrentContext(sc, Item.DIRECTORY, null, null); |
1255 |
22 Oct 10 |
nicklas |
41 |
final int currentDirId = cc.getId(); |
1255 |
22 Oct 10 |
nicklas |
42 |
final String ID = sc.getId(); |
1255 |
22 Oct 10 |
nicklas |
43 |
final float scale = Base.getScale(sc); |
1255 |
22 Oct 10 |
nicklas |
44 |
final DbControl dc = sc.newDbControl(); |
1255 |
22 Oct 10 |
nicklas |
45 |
try |
1255 |
22 Oct 10 |
nicklas |
46 |
{ |
1255 |
22 Oct 10 |
nicklas |
47 |
final Directory directory = Directory.getById(dc, currentDirId); |
1255 |
22 Oct 10 |
nicklas |
48 |
|
1255 |
22 Oct 10 |
nicklas |
49 |
final String clazz = "class=\"text\""; |
1255 |
22 Oct 10 |
nicklas |
50 |
final String requiredClazz = "class=\"text required\""; |
1255 |
22 Oct 10 |
nicklas |
51 |
%> |
1255 |
22 Oct 10 |
nicklas |
52 |
<base:page type="popup" title="Upload torrent"> |
1255 |
22 Oct 10 |
nicklas |
53 |
<base:head> |
1255 |
22 Oct 10 |
nicklas |
54 |
<script language="JavaScript"> |
1255 |
22 Oct 10 |
nicklas |
55 |
function doUpload() |
1255 |
22 Oct 10 |
nicklas |
56 |
{ |
1255 |
22 Oct 10 |
nicklas |
57 |
var frm = document.forms['file']; |
1255 |
22 Oct 10 |
nicklas |
58 |
frm.submit(); |
1255 |
22 Oct 10 |
nicklas |
59 |
} |
1255 |
22 Oct 10 |
nicklas |
60 |
</script> |
1255 |
22 Oct 10 |
nicklas |
61 |
</base:head> |
1255 |
22 Oct 10 |
nicklas |
62 |
<base:body> |
1636 |
03 May 12 |
nicklas |
63 |
|
1255 |
22 Oct 10 |
nicklas |
64 |
<div id="selectForm"> |
1636 |
03 May 12 |
nicklas |
65 |
<h1>Upload torrent</h1> |
1255 |
22 Oct 10 |
nicklas |
66 |
<form action="UploadTorrent.servlet?ID=<%=ID%>&directory_id=<%=directory.getId()%>" |
1255 |
22 Oct 10 |
nicklas |
67 |
method="post" name="file" enctype="multipart/form-data" onsubmit="return false;"> |
1255 |
22 Oct 10 |
nicklas |
68 |
|
1636 |
03 May 12 |
nicklas |
69 |
<div class="content filled"> |
1636 |
03 May 12 |
nicklas |
70 |
<div> |
1636 |
03 May 12 |
nicklas |
71 |
<table class="fullform input100 bottomborder"> |
1636 |
03 May 12 |
nicklas |
72 |
<tr> |
1636 |
03 May 12 |
nicklas |
73 |
<th>Save in</th> |
1636 |
03 May 12 |
nicklas |
74 |
<td><%=HTML.encodeTags(directory.getPath().toString())%></td> |
1636 |
03 May 12 |
nicklas |
75 |
</tr> |
1636 |
03 May 12 |
nicklas |
76 |
<tr> |
1636 |
03 May 12 |
nicklas |
77 |
<th>Torrent file</th> |
1636 |
03 May 12 |
nicklas |
78 |
<td> |
1636 |
03 May 12 |
nicklas |
79 |
<input <%=requiredClazz%> type="file" name="torrent" size="50"> |
1636 |
03 May 12 |
nicklas |
80 |
</td> |
1636 |
03 May 12 |
nicklas |
81 |
</tr> |
1636 |
03 May 12 |
nicklas |
82 |
</table> |
1636 |
03 May 12 |
nicklas |
83 |
<div class="padded"> |
1636 |
03 May 12 |
nicklas |
84 |
Select a torrent file on your local computer. The torrent file will |
1636 |
03 May 12 |
nicklas |
85 |
be submitted as a job to the torrent service on the BASE server. |
1636 |
03 May 12 |
nicklas |
86 |
When the service has downloaded all files they will be saved to |
1636 |
03 May 12 |
nicklas |
87 |
the current directory. |
1255 |
22 Oct 10 |
nicklas |
88 |
</div> |
1636 |
03 May 12 |
nicklas |
89 |
</div> |
1255 |
22 Oct 10 |
nicklas |
90 |
</div> |
1636 |
03 May 12 |
nicklas |
91 |
</form> |
1255 |
22 Oct 10 |
nicklas |
92 |
|
1636 |
03 May 12 |
nicklas |
93 |
<base:buttongroup subclass="dialogbuttons"> |
1636 |
03 May 12 |
nicklas |
94 |
<base:button image="upload.png" onclick="doUpload()" title="Upload" /> |
1636 |
03 May 12 |
nicklas |
95 |
<base:button onclick="top.window.close()" title="Cancel" /> |
1636 |
03 May 12 |
nicklas |
96 |
</base:buttongroup> |
1255 |
22 Oct 10 |
nicklas |
97 |
|
1255 |
22 Oct 10 |
nicklas |
98 |
</base:body> |
1255 |
22 Oct 10 |
nicklas |
99 |
</base:page> |
1255 |
22 Oct 10 |
nicklas |
100 |
<% |
1255 |
22 Oct 10 |
nicklas |
101 |
} |
1255 |
22 Oct 10 |
nicklas |
102 |
finally |
1255 |
22 Oct 10 |
nicklas |
103 |
{ |
1255 |
22 Oct 10 |
nicklas |
104 |
if (dc != null) dc.close(); |
1255 |
22 Oct 10 |
nicklas |
105 |
} |
1255 |
22 Oct 10 |
nicklas |
106 |
%> |