mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
add adding a torrent via file upload
This commit is contained in:
parent
df6a905226
commit
a7ad189bd0
1 changed files with 32 additions and 10 deletions
|
@ -208,25 +208,47 @@ Deluge.Add.Options = new Ext.TabPanel({
|
||||||
});
|
});
|
||||||
|
|
||||||
Deluge.Add.File = {
|
Deluge.Add.File = {
|
||||||
|
onAdd: function() {
|
||||||
|
if (this.form.getForm().isValid()) {
|
||||||
|
this.form.getForm().submit({
|
||||||
|
url: '/upload',
|
||||||
|
waitMsg: _('Uploading your torrent...'),
|
||||||
|
success: this.onUploadSuccess.bindWithEvent(this)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onUploadSuccess: function(fp, upload) {
|
||||||
|
this.Window.hide();
|
||||||
|
var filename = upload.result.toString();
|
||||||
|
Deluge.Client.web.get_torrent_info(filename, {
|
||||||
|
onSuccess: this.onGotInfo.bindWithEvent(this)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onGotInfo: function(info) {
|
||||||
|
var bound = Deluge.Add.onTorrentAdded.bind(Deluge.Add)
|
||||||
|
this.form.items.get('torrentFile').setValue('');
|
||||||
|
bound(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Deluge.Add.File.form = new Ext.form.FormPanel({
|
Deluge.Add.File.form = new Ext.form.FormPanel({
|
||||||
defaultType: 'textfield',
|
fileUpload: true,
|
||||||
id: 'fileAddForm',
|
id: 'fileAddForm',
|
||||||
baseCls: 'x-plain',
|
baseCls: 'x-plain',
|
||||||
labelWidth: 55,
|
labelWidth: 55,
|
||||||
items: [new Ext.form.FileUploadField({
|
autoHeight: true,
|
||||||
|
items: [{
|
||||||
|
xtype: 'fileuploadfield',
|
||||||
|
id: 'torrentFile',
|
||||||
|
emptyText: _('Select a torrent'),
|
||||||
fieldLabel: _('File'),
|
fieldLabel: _('File'),
|
||||||
id: 'file',
|
|
||||||
name: 'file',
|
name: 'file',
|
||||||
listeners: {
|
buttonCfg: {
|
||||||
'specialkey': {
|
text: _('Browse...')
|
||||||
fn: Deluge.Add.File.onAdd,
|
}
|
||||||
scope: Deluge.Add.File
|
}]
|
||||||
}
|
|
||||||
}
|
|
||||||
})]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Deluge.Add.File.Window = new Ext.Window({
|
Deluge.Add.File.Window = new Ext.Window({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue