ajax-demo:file-upload auto-close

This commit is contained in:
Martijn Voncken 2008-07-18 17:44:56 +00:00
parent 7faed7ec1c
commit 864f69ef5d
1 changed files with 65 additions and 0 deletions

View File

@ -0,0 +1,65 @@
$def with (add_form, options_form, error)
<html>
<head>
<title>Deluge:add torrent</title>
<link rel="icon" href="/static/images/deluge_icon.gif" type="image/gif" />
<link rel="shortcut icon" href="/static/images/deluge_icon.gif" type="image/gif" />
<link rel="stylesheet" type="text/css" href="/template_style.css" />
<script language="javascript" src="/static/deluge.js"></script>
</head>
<div class="panel">
<h2>$_("Add Torrent")</h2>
<form method="POST" action="$base/torrent/add" ENCTYPE="multipart/form-data">
<input type="hidden" name="redir" value="/close">
$if error:
<div class="error">$error</div>
<div id="torrent_add" >
<table>
$:add_form.as_table()
</table>
<a onclick="javascript:toggle_options()">$_('Options')</a>
<!--todo: cookie setting for last-used options display or not-->
<br>
<div id="torrent_add_options" style="display:none">
<table>
$:options_form.as_table()
</table>
</div>
<div class="form_row">
<span class="form_label"></span>
<input type="submit" name="submit"
value="$_('Submit')" class="form_input">
</div>
</form>
</div>
<script language="javascript">
function toggle_options(){
el = document.getElementById("torrent_add_options");
if (el.style.display == "block"){
el.style.display = "none";
setCookie("torrent_add_options","hide");
}
else{
el.style.display = "block";
setCookie("torrent_add_options","show");
}
}
if (getCookie("torrent_add_options") == "show") {
el = document.getElementById("torrent_add_options");
el.style.display = "block";
}
</script>
$:render.footer()