(trunk web) #4993 "Add Set Location on WebUI" -- use luizpaulo's patch to implement this
This commit is contained in:
parent
4f4529ae09
commit
b150f1158e
|
@ -304,6 +304,23 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="dialog_container" id="move_container" style="display:none;">
|
||||
<div class="dialog_top_bar"></div>
|
||||
<div class="dialog_window">
|
||||
<div class="dialog_logo" id="move_dialog_logo"></div>
|
||||
<h2 class="dialog_heading">Set Location</h2>
|
||||
<form action="#" method="post" id="torrent_move_form"
|
||||
enctype="multipart/form-data" target="torrent_move_frame">
|
||||
<div class="dialog_message">
|
||||
<label for="torrent_path">Location:</label>
|
||||
<input type="text" id="torrent_path"/>
|
||||
</div>
|
||||
<a href="#move" id="move_confirm_button">Apply</a>
|
||||
<a href="#cancel" id="move_cancel_button">Cancel</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="torrent_footer">
|
||||
<ul id="settings_menu" title="Settings Menu">
|
||||
<li id="button">
|
||||
|
@ -394,6 +411,7 @@
|
|||
<li id="context_removedata">Trash Data & Remove From List...</li>
|
||||
<li class="separator"></li>
|
||||
<li id="context_verify">Verify Local Data</li>
|
||||
<li id="context_move">Set Location...</li>
|
||||
<li class="separator"></li>
|
||||
<li id="context_reannounce">Ask tracker for more peers</li>
|
||||
<li class="separator"></li>
|
||||
|
|
|
@ -103,6 +103,7 @@ Dialog.prototype = {
|
|||
setTextContent(this._cancel_button[0], cancel_button_label);
|
||||
// Just in case
|
||||
$('#upload_container').hide();
|
||||
$('#move_container').hide();
|
||||
$('body').addClass('dialog_showing');
|
||||
transmission.updateButtonStates();
|
||||
if (isMobileDevice)
|
||||
|
|
|
@ -157,6 +157,13 @@ TransmissionRemote.prototype =
|
|||
stopTorrents: function(torrent_ids, callback, context) {
|
||||
this.sendTorrentActionRequests('torrent-stop', torrent_ids, callback, context);
|
||||
},
|
||||
|
||||
moveTorrents: function(torrent_ids, new_location, callback, context) {
|
||||
var remote = this;
|
||||
this.sendTorrentSetRequests( 'torrent-set-location', torrent_ids,
|
||||
{"move": true, "location": new_location}, callback, context);
|
||||
},
|
||||
|
||||
removeTorrents: function(torrent_ids, callback, context) {
|
||||
this.sendTorrentActionRequests('torrent-remove', torrent_ids, callback, context);
|
||||
},
|
||||
|
|
|
@ -76,6 +76,7 @@ Torrent.Fields.Stats = [
|
|||
'sizeWhenDone',
|
||||
'status',
|
||||
'trackers',
|
||||
'downloadDir',
|
||||
'uploadedEver',
|
||||
'uploadRatio'
|
||||
];
|
||||
|
@ -97,7 +98,6 @@ Torrent.Fields.StatsExtra = [
|
|||
'activityDate',
|
||||
'corruptEver',
|
||||
'desiredAvailable',
|
||||
'downloadDir',
|
||||
'downloadedEver',
|
||||
'fileStats',
|
||||
'haveUnchecked',
|
||||
|
|
|
@ -53,6 +53,10 @@ Transmission.prototype =
|
|||
|
||||
$('#upload_confirm_button').click($.proxy(this.confirmUploadClicked,this));
|
||||
$('#upload_cancel_button').click($.proxy(this.hideUploadDialog,this));
|
||||
|
||||
$('#move_confirm_button').click($.proxy(this.confirmMoveClicked,this));
|
||||
$('#move_cancel_button').click($.proxy(this.hideMoveDialog,this));
|
||||
|
||||
$('#turtle-button').click($.proxy(this.toggleTurtleClicked,this));
|
||||
$('#compact-button').click($.proxy(this.toggleCompactClicked,this));
|
||||
|
||||
|
@ -176,6 +180,7 @@ Transmission.prototype =
|
|||
context_pause_selected: function() { tr.stopSelectedTorrents(); },
|
||||
context_resume_selected: function() { tr.startSelectedTorrents(false); },
|
||||
context_resume_now_selected: function() { tr.startSelectedTorrents(true); },
|
||||
context_move: function() { tr.moveSelectedTorrents(false); },
|
||||
context_remove: function() { tr.removeSelectedTorrents(); },
|
||||
context_removedata: function() { tr.removeSelectedTorrentsAndData(); },
|
||||
context_verify: function() { tr.verifySelectedTorrents(); },
|
||||
|
@ -500,7 +505,7 @@ Transmission.prototype =
|
|||
drop: function(ev)
|
||||
{
|
||||
var i, uri, uris=null,
|
||||
types = ["text/uri-list", "text/plain"];
|
||||
types = ["text/uri-list", "text/plain"],
|
||||
paused = this.shouldAddedTorrentsStart();
|
||||
|
||||
if (!ev.dataTransfer || !ev.dataTransfer.types)
|
||||
|
@ -532,6 +537,16 @@ Transmission.prototype =
|
|||
this.hideUploadDialog();
|
||||
},
|
||||
|
||||
hideMoveDialog: function() {
|
||||
$('#move_container').hide();
|
||||
this.updateButtonStates();
|
||||
},
|
||||
|
||||
confirmMoveClicked: function() {
|
||||
this.moveSelectedTorrents(true);
|
||||
this.hideUploadDialog();
|
||||
},
|
||||
|
||||
removeClicked: function(ev) {
|
||||
if (this.isButtonEnabled(ev)) {
|
||||
this.removeSelectedTorrents();
|
||||
|
@ -887,6 +902,34 @@ Transmission.prototype =
|
|||
}
|
||||
},
|
||||
|
||||
promptSetLocation: function(confirmed, torrents) {
|
||||
if (! confirmed) {
|
||||
var path;
|
||||
if (torrents.length === 1) {
|
||||
path = torrents[0].getDownloadDir();
|
||||
} else {
|
||||
path = $("#download-dir").val();
|
||||
}
|
||||
$('input#torrent_path').attr('value', path);
|
||||
$('#move_container').show();
|
||||
$('#torrent_path').focus();
|
||||
} else {
|
||||
var ids = this.getTorrentIds(torrents);
|
||||
this.remote.moveTorrents(
|
||||
ids,
|
||||
$("input#torrent_path").val(),
|
||||
this.refreshTorrents,
|
||||
this);
|
||||
$('#move_container').hide();
|
||||
}
|
||||
},
|
||||
|
||||
moveSelectedTorrents: function(confirmed) {
|
||||
var torrents = this.getSelectedTorrents();
|
||||
if (torrents.length)
|
||||
this.promptSetLocation(confirmed, torrents);
|
||||
},
|
||||
|
||||
removeSelectedTorrents: function() {
|
||||
var torrents = this.getSelectedTorrents();
|
||||
if (torrents.length)
|
||||
|
@ -899,8 +942,7 @@ Transmission.prototype =
|
|||
this.promptToRemoveTorrentsAndData(torrents);
|
||||
},
|
||||
|
||||
promptToRemoveTorrents:function(torrents)
|
||||
{
|
||||
promptToRemoveTorrents: function(torrents) {
|
||||
if (torrents.length === 1)
|
||||
{
|
||||
var torrent = torrents[0],
|
||||
|
|
|
@ -1083,6 +1083,10 @@ div.dialog_container div.dialog_window form {
|
|||
margin: 0;
|
||||
padding: 0px; }
|
||||
|
||||
div#move_container input#torrent_path {
|
||||
width: 286px;
|
||||
padding: 2px; }
|
||||
|
||||
iframe#torrent_upload_frame {
|
||||
display: block;
|
||||
/* Don't change this : safari forms won't target hidden frames (they open a new window) */
|
||||
|
|
|
@ -933,6 +933,12 @@ div.dialog_container div.dialog_window form {
|
|||
padding: 0px;
|
||||
}
|
||||
|
||||
div#move_container input#torrent_path {
|
||||
width: 286px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
|
||||
iframe#torrent_upload_frame {
|
||||
display: block; /* Don't change this : safari forms won't target hidden frames (they open a new window) */
|
||||
position: absolute;
|
||||
|
|
Loading…
Reference in New Issue