- Allow to download torrents from a local file (Web UI)

This commit is contained in:
Christophe Dumez
2008-07-31 12:03:28 +00:00
parent a4318cc060
commit b9c4a434c9
9 changed files with 92 additions and 9 deletions

View File

@@ -27,6 +27,7 @@
<a class="returnFalse">File</a>
<ul>
<li><a id="downloadLink">Download from URL</a></li>
<li><a id="uploadLink">Download local torrent</a></li>
</ul>
</li>
<li>
@@ -52,6 +53,7 @@
</div>
<div id="mochaToolbar">
<a id="downloadButton"><img class="mochaToolButton" title="Download from URL" src="images/skin/url.png"/></a>
<a id="uploadButton"><img class="mochaToolButton" title="Download local torrent" src="images/skin/open.png"/></a>
<a id="deleteButton"><img class="mochaToolButton" title="Delete" src="images/skin/delete.png"/></a>
<a id="resumeButton"><img class="mochaToolButton" title="Resume" src="images/skin/play.png"/></a>
<a id="pauseButton"><img class="mochaToolButton" title="Pause" src="images/skin/pause.png"/></a>

View File

@@ -35,6 +35,23 @@ function attachMochaLinkEvents(){
height: 270
});
});
addClickEvent('upload', function(e){
new Event(e).stop();
document.mochaUI.newWindow({
id: 'uploadPage',
title: 'Upload torrent file',
loadMethod: 'iframe',
contentURL:'upload.html',
scrollbars: false,
resizable: false,
maximizable: false,
paddingVertical: 0,
paddingHorizontal: 0,
width: 500,
height: 120
});
});
addClickEvent('delete', function(e){
new Event(e).stop();

21
src/webui/upload.html Normal file
View File

@@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Upload local torrent file</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
<link rel="stylesheet" href="css/mocha.css" type="text/css" />
<script type="text/javascript" src="scripts/mootools-trunk-1475.js" charset="utf-8"></script>
<!-- <script type="text/javascript" src="scripts/upload.js" charset="utf-8"></script> -->
</head>
<body>
<center>
<h1 class="vcenter"><img class="vcenter" title="Download local torrent" src="images/skin/open.png"/>Download local torrent</h1>
<form action="/command/upload" enctype="multipart/form-data" method="post" name="uploadForm">
<input type="file" name="torrentfile" id="torrentfile" size="40"/><p>Point to torrent file</p><!--<input type="submit" value="Download"/> -->
<a id="upButton" onclick="document.uploadForm.submit();window.parent.document.getElementById('uploadPage').parentNode.removeChild(window.parent.document.getElementById('uploadPage'));">Download</a>
</form>
</center>
</body>
</html>