qBittorrent/src/webui/html/preferences_content.html

909 lines
38 KiB
HTML
Raw Normal View History

<div id="ConnectionTab" class="PrefTab">
<fieldset>
2011-04-18 20:58:13 +04:00
<legend><b>_(Listening Port)</b></legend>
<div style="padding-left: 30px;">
_(Port used for incoming connections:)
<input type="text" id="port_value" style="width: 4em;"/>
<br/>
<table>
<tr>
2010-12-06 13:16:10 +03:00
<td style="vertical-align: bottom;"><input type="checkbox" id="upnp_checkbox" style="margin-bottom: -2px;"/></td><td>_(Use UPnP / NAT-PMP port forwarding from my router)</td>
</tr>
</table>
</div>
</fieldset>
<fieldset>
2011-04-18 20:58:13 +04:00
<legend><b>_(Connections Limits)</b></legend>
<div style="padding-left: 30px;">
<table>
<tr>
<td style="vertical-align: bottom;"><input type="checkbox" id="max_connec_checkbox" onClick="updateMaxConnecEnabled();"/></td><td style="padding-right: 3px;">_(Global maximum number of connections:)</td><td><input type="text" id="max_connec_value" style="width: 4em;"/></td>
</tr>
<tr>
<td style="vertical-align: bottom;"><input type="checkbox" id="max_connec_per_torrent_checkbox" onClick="updateMaxConnecPerTorrentEnabled();" style="margin-bottom: -2px;"/></td><td style="padding-right: 3px;">_(Maximum number of connections per torrent:)</td><td><input type="text" id="max_connec_per_torrent_value" style="width: 4em;"/></td>
</tr>
<tr>
<td style="vertical-align: bottom;"><input type="checkbox" id="max_uploads_per_torrent_checkbox" onClick="updateMaxUploadsPerTorrentEnabled();" style="margin-bottom: -2px;"/></td><td style="padding-right: 3px;">_(Maximum number of upload slots per torrent:)</td><td><input type="text" id="max_uploads_per_torrent_value" style="width: 4em;"/></td>
</tr>
</table>
</div>
</fieldset>
<fieldset>
2011-04-18 20:58:13 +04:00
<legend><b>_(Global Rate Limits)</b></legend>
<div style="padding-left: 30px;">
<table>
<tr>
<td style="vertical-align: bottom;"><input type="checkbox" id="up_limit_checkbox" onClick="updateUpLimitEnabled();"/></td><td style="padding-right: 3px;">_(Upload:)</td><td><input type="text" id="up_limit_value" style="width: 4em;"/>&nbsp;&nbsp;_(KiB/s)</td>
</tr>
<tr>
<td style="vertical-align: bottom;"><input type="checkbox" id="dl_limit_checkbox" onClick="updateDlLimitEnabled();"/></td><td style="padding-right: 3px;">_(Download:)</td><td><input type="text" id="dl_limit_value" style="width: 4em;"/>&nbsp;&nbsp;_(KiB/s)</td>
</tr>
</table>
</div>
</fieldset>
</div>
<div id="BittorrentTab" class="PrefTab invisible">
<fieldset>
2011-04-18 20:58:13 +04:00
<legend><b>_(Privacy)</b></legend>
<div style="padding-left: 30px;">
<table>
<tr>
2010-12-06 13:16:10 +03:00
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="dht_checkbox"/></td><td>_(Enable DHT (decentralized network) to find more peers)</td>
</tr>
<tr>
2011-01-14 21:57:15 +03:00
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="DHTPortDiffThanBT_checkbox" onclick="updateDHTPortSettings();"/></td><td>_(Use a different port for DHT and BitTorrent)</td>
2010-03-22 23:34:12 +03:00
</tr>
<tr>
<td style="vertical-align: bottom; text-align: right;">_(DHT port:)</td><td><input type="text" id="DHTPort_txt" value="6881"/></td>
</tr>
<tr>
2010-12-06 13:16:10 +03:00
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="pex_checkbox"/></td><td>_(Enable Peer Exchange (PeX) to find more peers)</td>
</tr>
<tr>
2010-12-06 13:16:10 +03:00
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="lsd_checkbox"/></td><td>_(Enable Local Peer Discovery to find more peers)</td>
</tr>
</table>
2010-12-06 13:16:10 +03:00
_(Encryption mode:)
<select id="encryption_select">
2010-12-06 13:16:10 +03:00
<option value="0">_(Prefer encryption)</option>
<option value="1">_(Require encryption)</option>
<option value="2">_(Disable encryption)</option>
</select><br/>
</div>
</fieldset>
</div>
<div id="DownloadsTab" class="PrefTab invisible">
<fieldset>
2011-04-18 20:58:13 +04:00
<legend><b>_(Hard Disk)</b></legend>
<div style="padding-left: 30px;">
<table>
<tr>
2010-06-29 12:08:43 +04:00
<td style="vertical-align: bottom; text-align: right;">_(Save files to location:)</td><td><input type="text" id="savepath_text"/></td>
</tr>
<tr>
2010-06-29 12:08:43 +04:00
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="temppath_checkbox" onclick="updateTempDirEnabled();"/></td><td>_(Keep incomplete torrents in:)</td>
</tr>
<tr>
<td style="vertical-align: bottom; text-align: right;"></td><td><input type="text" id="temppath_text"/></td>
</tr>
2010-06-29 12:08:43 +04:00
<tr><td colspan="2">_(Automatically add torrents from:)</td></tr>
<tr>
2010-03-18 22:25:16 +03:00
<td></td>
<td>
<table style="text-align: center" border="1" id="watched_folders_tab">
<thead><tr><th>_(Watched Folder)</th><th>_(Download here)</th></tr></thead>
2010-03-18 22:25:16 +03:00
<tbody></tbody>
2010-12-13 21:22:19 +03:00
<tfoot><tr><td style="padding-top:4px;"><input type="text" id="new_watch_folder_txt"/></td><td style="padding-top:4px;"><input type="checkbox" id="new_watch_folder_dl" style="padding-left:18px;"/><img src="theme/list-add" alt="Add" style="padding-left:2px;width:16px;cursor:pointer;margin-right:-18px;" onclick="javascript:addWatchFolder();"/></td></tr></tfoot>
2010-03-18 22:25:16 +03:00
</table>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="exportdir_checkbox" onclick="updateExportDirEnabled();"/></td><td>_(Copy .torrent files to:)</td>
</tr>
<tr>
<td style="vertical-align: bottom; text-align: right;"></td><td><input type="text" id="exportdir_text"/></td>
</tr>
<tr id="appendexttr">
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="appendext_checkbox"/></td><td>_(Append .!qB extension to incomplete files)</td>
</tr>
<tr>
2010-06-29 12:08:43 +04:00
<td style="vertical-align: bottom; text-align: right;"><input type="checkbox" id="preallocateall_checkbox"/></td><td>_(Pre-allocate disk space for all files)</td>
</tr>
</table>
</div>
</fieldset>
<fieldset>
<legend><b>_(Email notification upon download completion)</b></legend>
<div style="padding-left: 30px;">
<input type="checkbox" id="mail_notification_checkbox" onclick="updateMailNotification();"/> _(Email notification upon download completion)
<table>
<tr>
<td style="vertical-align: bottom; text-align: right;">_(Destination email:)</td><td><input type="text" id="dest_email_txt"/></td>
</tr>
<tr>
<td style="vertical-align: bottom; text-align: right;">_(SMTP server:)</td><td><input type="text" id="smtp_server_txt"/></td>
</tr>
</table>
</div>
</fieldset>
<fieldset>
<legend><b>_(Run an external program on torrent completion)</b></legend>
<div style="padding-left: 30px;">
<input type="checkbox" id="autorun_checkbox" onclick="updateAutoRun();"/> _(Run an external program on torrent completion)<br/>
<input type="text" id="autorunProg_txt" style="width: 400px;"/><br/>
2011-04-18 20:58:13 +04:00
<i>The following parameters are supported:
<ul>
<li>%f: _(Torrent path)</li>
<li>%n: _(Torrent name)</li>
2011-04-18 20:58:13 +04:00
</ul></i>
</div>
</fieldset>
<fieldset>
2011-04-18 20:58:13 +04:00
<legend><b>_(Torrent Queueing)</b></legend>
<div style="padding-left: 30px;">
2011-04-18 20:58:13 +04:00
<input type="checkbox" id="queueing_checkbox" onclick="updateQueuingSystem();"/> _(Torrent Queueing)
<table>
<tr>
<td style="vertical-align: bottom; text-align: right;">_(Maximum active downloads:)</td><td><input type="text" id="max_active_dl_value" style="width: 4em;"/></td>
</tr>
<tr>
<td style="vertical-align: bottom; text-align: right;">_(Maximum active uploads:)</td><td><input type="text" id="max_active_up_value" style="width: 4em;"/></td>
</tr>
<tr>
<td style="vertical-align: bottom; text-align: right;">_(Maximum active torrents:)</td><td><input type="text" id="max_active_to_value" style="width: 4em;"/></td>
</tr>
</table>
</div>
</fieldset>
</div>
<div id="FilterTab" class="PrefTab invisible">
2010-06-29 12:08:43 +04:00
<legend><b>_(IP Filtering)</b></legend>
<div style="padding-left: 30px;">
2010-06-29 12:08:43 +04:00
<input type="checkbox" id="ipfilter_enabled_checkbox" onclick="updateFilterSettings();"/> _(IP Filtering)
<table>
<tr>
<td style="vertical-align: bottom;">_(Filter path (.dat, .p2p, .p2b):)</td><td><input type="text" id="ipfilter_text"/></td>
</tr>
</table>
</div>
</fieldset>
</div>
<div id="ProxyTab" class="PrefTab invisible">
2011-04-18 20:58:13 +04:00
<legend><b>_(Proxy Server)</b></legend>
<div style="padding-left: 30px;">
_(Type:) <select id ="peer_proxy_type_select" onchange="updatePeerProxySettings();">
<option value="none">_((None))</option>
<option value="socks4">_(SOCKS4)</option>
<option value="socks5">_(SOCKS5)</option>
<option value="http">_(HTTP)</option>
</select>&nbsp;&nbsp;&nbsp;&nbsp;
_(Host:) <input type="text" id="peer_proxy_host_text" />&nbsp;&nbsp;&nbsp;&nbsp;
2011-05-01 16:00:23 +04:00
_(Port:) <input type="text" id="peer_proxy_port_value" style="width: 4em;"/><br/>
<input type="checkbox" id="use_peer_proxy_checkbox" />&nbsp;&nbsp;_(Use proxy for peer connections)<br/><br/>
<input type="checkbox" id="peer_proxy_auth_checkbox" onclick="updatePeerProxyAuthSettings();" />&nbsp;&nbsp;_(Authentication)<br/>
<table>
<tr><td style="padding-left: 10px;">_(Username:)</td><td><input type="text" id="peer_proxy_username_text" /></td></tr>
<tr><td style="padding-left: 10px;">_(Password:)</td><td><input type="password" id="peer_proxy_password_text" /></td></tr>
</table>
</div>
</fieldset>
</div>
<div id="WebUITab" class="PrefTab invisible">
<fieldset>
2011-04-18 20:58:13 +04:00
<legend><b>_(Language)</b></legend>
<div style="padding-left: 30px;">
<table>
<tr>
2011-04-18 20:58:13 +04:00
<td style="vertical-align: bottom;">_(User Interface Language:)</td>
<td style="padding-right: 3px;">
<select id="locale_select">
2011-01-12 18:47:50 +03:00
<option value="en_GB">English</option>
<option value="fr_FR">Français</option>
<option value="de_DE">Deutsch</option>
<option value="hu_HU">Magyar</option>
<option value="it_IT">Italiano</option>
<option value="nl_NL">Nederlands</option>
<option value="es_ES">Español</option>
<option value="ca_ES">Català</option>
<option value="gl_ES">Galego</option>
<option value="pt_PT">Português</option>
<option value="pt_BR">Português brasileiro</option>
<option value="pl_PL">Polski</option>
<option value="cs_CZ">Čeština</option>
2011-02-07 21:56:17 +03:00
<option value="lt_LT">Lietuvių</option>
2011-01-12 18:47:50 +03:00
<option value="sk_SK">Slovenčina</option>
<option value="sr_CS">Српски</option>
<option value="hy_AM">Հայերեն</option>
<option value="ro_RO">Română</option>
<option value="tr_TR">Türkçe</option>
<option value="el_GR">Ελληνικά</option>
<option value="sv_SE">Svenska</option>
<option value="fi_FI">Suomi</option>
<option value="nb_NO">Norsk</option>
<option value="da_DK">Dansk</option>
<option value="bg_BG">Български</option>
<option value="uk_UA">Українська</option>
<option value="ru_RU">Русский</option>
<option value="ja_JP">日本語</option>
<option value="zh_CN">中文 (简体)</option>
<option value="zh_TW">中文 (繁體)</option>
<option value="ko_KR">한글</option>
</select>
</td>
</tr>
</table>
</div>
</fieldset>
<fieldset>
<legend><b>_(HTTP Server)</b></legend>
<div style="padding-left: 30px;">
<table>
<tr>
<td style="vertical-align: bottom;">_(Port:)</td><td style="padding-right: 3px;"><input type="text" id="webui_port_value" style="width: 4em;"/></td>
</tr>
</table>
</div>
</fieldset>
<fieldset>
<legend><b>_(Authentication)</b></legend>
<div style="padding-left: 30px;">
<table>
<tr>
<td style="vertical-align: bottom;">_(Username:)</td><td style="padding-right: 3px;"><input type="text" id="webui_username_text" /></td>
</tr>
<tr>
<td style="vertical-align: bottom;">_(Password:)</td><td style="padding-right: 3px;"><input type="password" id="webui_password_text" /></td>
</tr>
</table>
</div>
</fieldset>
</div>
<br/>
2011-01-14 21:57:15 +03:00
<center><input type="button" value="_(Save)" onclick="applyPreferences();"/></center>
<script type="text/javascript">
2010-03-18 22:25:16 +03:00
var WatchedFoldersTable = new HtmlTable($("watched_folders_tab"));
applyPreferences = function() {
// Validate form data
// Connection
var listen_port = $('port_value').get('value').toInt();
if(listen_port <= 1024 || listen_port > 65535) {
alert("_(The port used for incoming connections must be greater than 1024 and less than 65535.)");
return;
}
var upnp = 0;
if($defined($('upnp_checkbox').get('checked')) && $('upnp_checkbox').get('checked'))
upnp = 1;
var dl_limit = -1;
if($defined($('dl_limit_checkbox').get('checked')) && $('dl_limit_checkbox').get('checked')) {
dl_limit = $('dl_limit_value').get('value');
if(dl_limit <= 0) {
alert("_(Download rate limit must be greater than 0 or disabled.)");
return;
}
}
var up_limit = -1;
if($defined($('up_limit_checkbox').get('checked')) && $('up_limit_checkbox').get('checked')) {
up_limit = $('up_limit_value').get('value');
if(up_limit <= 0) {
alert("_(Upload rate limit must be greater than 0 or disabled.)");
return;
}
}
var max_connec = -1;
if($defined($('max_connec_checkbox').get('checked')) && $('max_connec_checkbox').get('checked')) {
max_connec = $('max_connec_value').get('value');
if(max_connec <= 0) {
alert("_(Maximum number of connections limit must be greater than 0 or disabled.)");
return;
}
}
var max_connec_per_torrent = -1;
if($defined($('max_connec_per_torrent_checkbox').get('checked')) && $('max_connec_per_torrent_checkbox').get('checked')) {
max_connec_per_torrent = $('max_connec_per_torrent_value').get('value');
if(max_connec_per_torrent <= 0) {
alert("_(Maximum number of connections per torrent limit must be greater than 0 or disabled.)");
return;
}
}
var max_uploads_per_torrent = -1;
if($defined($('max_uploads_per_torrent_checkbox').get('checked')) && $('max_uploads_per_torrent_checkbox').get('checked')) {
max_uploads_per_torrent = $('max_uploads_per_torrent_value').get('value');
if(max_uploads_per_torrent <= 0) {
alert("_(Maximum number of upload slots per torrent limit must be greater than 0 or disabled.)");
return;
}
}
// Bittorrent
var dht = 0;
if($defined($('dht_checkbox').get('checked')) && $('dht_checkbox').get('checked'))
dht = 1;
2010-03-22 23:34:12 +03:00
var dhtSameAsBT = 1;
if($defined($('DHTPortDiffThanBT_checkbox').get('checked')) && $('DHTPortDiffThanBT_checkbox').get('checked'))
dhtSameAsBT = 0;
var dht_port = $("DHTPort_txt").get('value').toInt();
var pex = 0;
if($defined($('pex_checkbox').get('checked')) && $('pex_checkbox').get('checked'))
pex = 1;
var lsd = 0;
if($defined($('lsd_checkbox').get('checked')) && $('lsd_checkbox').get('checked'))
lsd = 1;
// Downloads
var save_path = $("savepath_text").get('value');
var temp_path_enabled = 0
if($defined($('temppath_checkbox').get('checked')) && $('temppath_checkbox').get('checked'))
temp_path_enabled = 1;
var temp_path = $('temppath_text').get('value');
2010-03-18 22:25:16 +03:00
var watched_folders = getWatchedFolders();
var exportdir_enabled = 0;
if($defined($('exportdir_checkbox').get('checked')) && $('exportdir_checkbox').get('checked'))
exportdir_enabled = 1;
var exportdir_path = '';
if(exportdir_enabled)
exportdir_path = $('exportdir_text').get('value');
var preallocate_all = 0;
if($defined($('preallocateall_checkbox').get('checked')) && $('preallocateall_checkbox').get('checked'))
preallocate_all = 1;
if(!$('appendexttr').hasClass('invisible')) {
var incomplete_files_ext = 0;
if($defined($('appendext_checkbox').get('checked')) && $('appendext_checkbox').get('checked'))
incomplete_files_ext = 1;
}
var queueing_enabled = 0;
if($defined($('queueing_checkbox').get('checked')) && $('queueing_checkbox').get('checked'))
queueing_enabled = 1;
var max_active_downloads = $('max_active_dl_value').get('value');
var max_active_uploads = $('max_active_up_value').get('value');
var max_active_torrents = $('max_active_to_value').get('value');
var mail_notification_enabled = 0;
if($defined($('mail_notification_checkbox').get('checked')) && $('mail_notification_checkbox').get('checked'))
mail_notification_enabled = 1;
var mail_notification_email = $('dest_email_txt').get('value');
var mail_notification_smtp = $('smtp_server_txt').get('value');
var autorun_enabled = 0;
if($defined($('autorun_checkbox').get('checked')) && $('autorun_checkbox').get('checked'))
autorun_enabled = 1;
var autorun_program = $('autorunProg_txt').get('value');
// IP Filter
var ip_filter_enabled = 0;
if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked'))
ip_filter_enabled = 1;
var ip_filter_path = $('ipfilter_text').get('value');
// Peer Proxy
var proxy_type_str = $('peer_proxy_type_select').get('value');
var proxy_type = -1;
var proxy_auth_enabled = 0;
if(proxy_type_str == "socks5") {
if($defined($('peer_proxy_auth_checkbox').get('checked')) && $('peer_proxy_auth_checkbox').get('checked')) {
proxy_type = 4;
proxy_auth_enabled = 1;
} else {
proxy_type = 2;
}
} else {
if(proxy_type_str == "socks4") {
proxy_type = 5;
} else {
if(proxy_type_str == "http") {
if($defined($('peer_proxy_auth_checkbox').get('checked')) && $('peer_proxy_auth_checkbox').get('checked')) {
proxy_type = 3;
proxy_auth_enabled = 1;
} else {
proxy_type = 1;
}
}
}
}
var proxy_ip = $('peer_proxy_host_text').get('value');
var proxy_port = $('peer_proxy_port_value').get('value');
2011-05-01 16:00:23 +04:00
var proxy_peer_connections = $defined($('use_peer_proxy_checkbox').get('checked')) && $('use_peer_proxy_checkbox').get('checked');
var proxy_username = $('peer_proxy_username_text').get('value');
var proxy_password = $('peer_proxy_password_text').get('value');
// Web UI
var webui_port = $('webui_port_value').get('value').toInt();
if(webui_port <= 1024 || webui_port > 65535) {
alert("_(The port used for the Web UI must be greater than 1024 and less than 65535.)");
return;
}
var webui_username = $('webui_username_text').get('value');
var webui_password = $('webui_password_text').get('value');
// Add some username/password length checking
if(webui_username.length < 3) {
alert("_(The Web UI username must be at least 3 characters long.)");
return;
}
if(webui_password.length < 3) {
alert("_(The Web UI password must be at least 3 characters long.)");
return;
}
var locale = $('locale_select').get('value');
// Send it to qBT
var dict = new Hash();
// Connection
dict.set('listen_port', listen_port);
dict.set('upnp', upnp);
dict.set('up_limit', up_limit);
dict.set('dl_limit', dl_limit);
dict.set('max_connec', max_connec);
dict.set('max_connec_per_torrent', max_connec_per_torrent);
dict.set('max_uploads_per_torrent', max_uploads_per_torrent);
// Bittorrent
dict.set('dht', dht);
2010-03-22 23:34:12 +03:00
dict.set('dhtSameAsBT', dhtSameAsBT);
dict.set('dht_port', dht_port);
dict.set('pex', pex);
dict.set('lsd', lsd);
dict.set('encryption', $('encryption_select').get('value'));
// Downloads
dict.set('save_path', save_path);
dict.set('temp_path_enabled', temp_path_enabled);
dict.set('temp_path', temp_path);
2010-03-18 22:25:16 +03:00
dict.set('scan_dirs', watched_folders[0]);
dict.set('download_in_scan_dirs', watched_folders[1]);
dict.set('export_dir', exportdir_path);
dict.set('preallocate_all', preallocate_all);
if(!$('appendexttr').hasClass('invisible')) {
dict.set('incomplete_files_ext', incomplete_files_ext);
}
dict.set('queueing_enabled', queueing_enabled);
dict.set('max_active_uploads', max_active_uploads);
dict.set('max_active_downloads', max_active_downloads);
dict.set('max_active_torrents', max_active_torrents);
dict.set('mail_notification_enabled', mail_notification_enabled);
dict.set('mail_notification_email', mail_notification_email);
dict.set('mail_notification_smtp', mail_notification_smtp);
dict.set('autorun_enabled', autorun_enabled);
dict.set('autorun_program', autorun_program);
// IP Filter
dict.set('ip_filter_enabled', ip_filter_enabled);
dict.set('ip_filter_path', ip_filter_path);
// Proxy
dict.set('proxy_type', proxy_type);
dict.set('proxy_ip', proxy_ip);
dict.set('proxy_port', proxy_port);
2011-05-01 16:00:23 +04:00
dict.set('proxy_peer_connections', proxy_peer_connections);
dict.set('proxy_auth_enabled', proxy_auth_enabled);
dict.set('proxy_username', proxy_username);
dict.set('proxy_password', proxy_password);
// Web UI
dict.set('web_ui_port', webui_port);
dict.set('web_ui_username', webui_username);
dict.set('web_ui_password', webui_password);
dict.set('locale', locale);
var json_str = JSON.encode(dict);
new Request({url: '/command/setPreferences',
method: 'post',
data: {'json': json_str,
},
onFailure: function() {
alert("_(Unable to save program preferences, qBittorrent is probably unreachable.)");
window.parent.closeWindows();
},
onSuccess: function() {
// Close window
2010-09-25 16:42:19 +04:00
window.parent.location.reload();
window.parent.closeWindows();
}
}).send();
};
updateDlLimitEnabled = function() {
if($defined($('dl_limit_checkbox').get('checked')) && $('dl_limit_checkbox').get('checked')) {
$('dl_limit_value').removeProperty('disabled');
} else {
$('dl_limit_value').set('disabled', 'true');
}
}
updateUpLimitEnabled = function() {
if($defined($('up_limit_checkbox').get('checked')) && $('up_limit_checkbox').get('checked')) {
$('up_limit_value').removeProperty('disabled');
} else {
$('up_limit_value').set('disabled', 'true');
}
}
updateMaxConnecEnabled = function() {
if($defined($('max_connec_checkbox').get('checked')) && $('max_connec_checkbox').get('checked')) {
$('max_connec_value').removeProperty('disabled');
} else {
$('max_connec_value').set('disabled', 'true');
}
}
updateMaxConnecPerTorrentEnabled = function() {
if($defined($('max_connec_per_torrent_checkbox').get('checked')) && $('max_connec_per_torrent_checkbox').get('checked')) {
$('max_connec_per_torrent_value').removeProperty('disabled');
} else {
$('max_connec_per_torrent_value').set('disabled', 'true');
}
}
updateMaxUploadsPerTorrentEnabled = function() {
if($defined($('max_uploads_per_torrent_checkbox').get('checked')) && $('max_uploads_per_torrent_checkbox').get('checked')) {
$('max_uploads_per_torrent_value').removeProperty('disabled');
} else {
$('max_uploads_per_torrent_value').set('disabled', 'true');
}
}
updateTempDirEnabled = function() {
if($defined($('temppath_checkbox').get('checked')) && $('temppath_checkbox').get('checked')) {
$('temppath_text').removeProperty('disabled');
} else {
$('temppath_text').set('disabled', 'true');
}
}
/*updateScanDirEnabled = function() {
if($defined($('scandir_checkbox').get('checked')) && $('scandir_checkbox').get('checked')) {
$('scandir_text').removeProperty('disabled');
} else {
$('scandir_text').set('disabled', 'true');
}
}*/
updateExportDirEnabled = function() {
if($defined($('exportdir_checkbox').get('checked')) && $('exportdir_checkbox').get('checked')) {
$('exportdir_text').removeProperty('disabled');
} else {
$('exportdir_text').set('disabled', 'true');
}
}
updateQueueingSystem = function() {
if($defined($('queueing_checkbox').get('checked')) && $('queueing_checkbox').get('checked')) {
$('max_active_dl_value').removeProperty('disabled');
$('max_active_up_value').removeProperty('disabled');
$('max_active_to_value').removeProperty('disabled');
} else {
$('max_active_dl_value').set('disabled', 'true');
$('max_active_up_value').set('disabled', 'true');
$('max_active_to_value').set('disabled', 'true');
}
}
updateMailNotification = function() {
if($defined($('mail_notification_checkbox').get('checked')) && $('mail_notification_checkbox').get('checked')) {
$('dest_email_txt').removeProperty('disabled');
$('smtp_server_txt').removeProperty('disabled');
} else {
$('dest_email_txt').set('disabled', 'true');
$('smtp_server_txt').set('disabled', 'true');
}
}
updateAutoRun = function() {
if($defined($('autorun_checkbox').get('checked')) && $('autorun_checkbox').get('checked')) {
$('autorunProg_txt').removeProperty('disabled');
} else {
$('autorunProg_txt').set('disabled', 'true');
}
}
updateFilterSettings = function() {
if($defined($('ipfilter_enabled_checkbox').get('checked')) && $('ipfilter_enabled_checkbox').get('checked')) {
$('ipfilter_text').removeProperty('disabled');
} else {
$('ipfilter_text').set('disabled', 'true');
}
}
2010-03-22 23:34:12 +03:00
updateDHTPortSettings = function() {
if($defined($('DHTPortDiffThanBT_checkbox').get('checked')) && $('DHTPortDiffThanBT_checkbox').get('checked')) {
$('DHTPort_txt').removeProperty('disabled');
} else {
$('DHTPort_txt').set('disabled', 'true');
}
}
updatePeerProxySettings = function() {
if($('peer_proxy_type_select').get('value') != "none") {
$('peer_proxy_host_text').removeProperty('disabled');
$('peer_proxy_port_value').removeProperty('disabled');
2011-05-01 16:00:23 +04:00
$('use_peer_proxy_checkbox').removeProperty('disabled');
if($('peer_proxy_type_select').get('value') != "socks5") {
$('peer_proxy_auth_checkbox').removeProperty('checked');
$('peer_proxy_auth_checkbox').set('disabled', 'true');
updatePeerProxyAuthSettings();
} else {
$('peer_proxy_auth_checkbox').removeProperty('disabled');
}
} else {
$('peer_proxy_host_text').set('disabled', 'true');
$('peer_proxy_port_value').set('disabled', 'true');
2011-05-01 16:00:23 +04:00
$('use_peer_proxy_checkbox').set('disabled', 'true');
$('peer_proxy_auth_checkbox').set('disabled', 'true');
$('peer_proxy_auth_checkbox').removeProperty('checked');
updatePeerProxyAuthSettings();
}
}
updatePeerProxyAuthSettings = function() {
if($defined($('peer_proxy_auth_checkbox').get('checked')) && $('peer_proxy_auth_checkbox').get('checked')) {
$('peer_proxy_username_text').removeProperty('disabled');
$('peer_proxy_password_text').removeProperty('disabled');
} else {
$('peer_proxy_username_text').set('disabled', 'true');
$('peer_proxy_password_text').set('disabled', 'true');
}
}
2010-03-18 22:25:16 +03:00
getWatchedFolders = function() {
var nb_folders = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
var folders = Array();
var download_in_place = Array();
for(var i=0; i<nb_folders; i+=1) {
var folder_path = $('text_watch_'+i).get('value').trim();
if(folder_path.length > 0) {
folders[folders.length] = folder_path;
if($defined($("cb_watch_"+i).get('checked')) && $("cb_watch_"+i).get('checked')) {
download_in_place[download_in_place.length] = 1;
} else {
download_in_place[download_in_place.length] = 0;
}
}
}
return [folders, download_in_place];
}
addWatchFolder = function() {
var new_folder = $("new_watch_folder_txt").get('value').trim();
if(new_folder.length <= 0) return;
var download_here = ($defined($("new_watch_folder_dl").get('checked')) && $("new_watch_folder_dl").get('checked'));
var myinput = new Element("input");
var i = $("watched_folders_tab").getChildren("tbody")[0].getChildren("tr").length;
myinput.set('id', 'text_watch_'+i);
myinput.set('type', 'text');
myinput.set('value', new_folder);
var mycb = new Element("input");
mycb.set("type", "checkbox");
mycb.set("id", "cb_watch_"+i);
if(download_here) {
mycb.set("checked", "checked");
} else {
mycb.removeProperty('checked');
}
WatchedFoldersTable.push([myinput, mycb]);
// Clear fields
$("new_watch_folder_txt").set('value', '');
$("new_watch_folder_dl").removeProperty('checked');
}
loadPreferences = function() {
var url = 'json/preferences';
var request = new Request.JSON({
url: url,
method: 'get',
noCache: true,
onFailure: function() {
alert("Could not contact qBittorrent");
},
onSuccess: function(pref) {
if(pref){
// Connection
var listen_port = pref.listen_port.toInt();
$('port_value').set('value', listen_port);
if(pref.upnp) {
$('upnp_checkbox').set('checked', 'checked');
} else {
$('upnp_checkbox').removeProperty('checked');
}
var dl_limit = pref.dl_limit.toInt();
if(dl_limit <= 0) {
$('dl_limit_checkbox').removeProperty('checked');
} else {
$('dl_limit_checkbox').set('checked', 'checked');
$('dl_limit_value').set('value', dl_limit);
}
updateDlLimitEnabled();
var up_limit = pref.up_limit.toInt();
if(up_limit <= 0) {
$('up_limit_checkbox').removeProperty('checked');
} else {
$('up_limit_checkbox').set('checked', 'checked');
$('up_limit_value').set('value', up_limit);
}
updateUpLimitEnabled();
var max_connec = pref.max_connec.toInt();
if(max_connec <= 0) {
$('max_connec_checkbox').removeProperty('checked');
$('max_connec_value').set('value', 500);
} else {
$('max_connec_checkbox').set('checked', 'checked');
$('max_connec_value').set('value', max_connec);
}
updateMaxConnecEnabled();
var max_connec_per_torrent = pref.max_connec_per_torrent.toInt();
if(max_connec_per_torrent <= 0) {
$('max_connec_per_torrent_checkbox').removeProperty('checked');
$('max_connec_per_torrent_value').set('value', 100);
} else {
$('max_connec_per_torrent_checkbox').set('checked', 'checked');
$('max_connec_per_torrent_value').set('value', max_connec_per_torrent);
}
updateMaxConnecPerTorrentEnabled();
var max_uploads_per_torrent = pref.max_uploads_per_torrent.toInt();
if(max_uploads_per_torrent <= 0) {
$('max_uploads_per_torrent_checkbox').removeProperty('checked');
$('max_uploads_per_torrent_value').set('value', 4);
} else {
$('max_uploads_per_torrent_checkbox').set('checked', 'checked');
$('max_uploads_per_torrent_value').set('value', max_uploads_per_torrent);
}
updateMaxUploadsPerTorrentEnabled();
// Bittorrent
var dht = pref.dht; //bool
if(dht) {
$('dht_checkbox').set('checked', 'checked');
} else {
$('dht_checkbox').removeProperty('checked');
}
2010-03-22 23:34:12 +03:00
var dhtSameAsBT = pref.dhtSameAsBT;
if(dhtSameAsBT) {
$('DHTPortDiffThanBT_checkbox').removeProperty('checked');
} else {
$('DHTPortDiffThanBT_checkbox').set('checked', 'checked');
}
$("DHTPort_txt").set("value", pref.dht_port);
updateDHTPortSettings();
var pex = pref.pex; //bool
if(pex) {
$('pex_checkbox').set('checked', 'checked');
} else {
$('pex_checkbox').removeProperty('checked');
}
var lsd = pref.lsd; //bool
if(lsd) {
$('lsd_checkbox').set('checked', 'checked');
} else {
$('lsd_checkbox').removeProperty('checked');
}
var encryption = pref.encryption.toInt();
$('encryption_select').getChildren('option')[encryption].setAttribute('selected', '');
// Downloads
var save_path = pref.save_path;
$("savepath_text").set('value', save_path);
var temp_path_enabled = pref.temp_path_enabled;
if(temp_path_enabled) {
$('temppath_checkbox').set('checked', 'checked');
} else {
$('temppath_checkbox').removeProperty('checked');
}
var temp_path = pref.temp_path;
$('temppath_text').set('value', temp_path);
updateTempDirEnabled();
2010-03-18 22:25:16 +03:00
var i = 0;
for(i=0; i<pref.scan_dirs.length; i+=1) {
var myinput = new Element("input");
myinput.set('id', 'text_watch_'+i);
myinput.set('type', 'text');
myinput.set('value', pref.scan_dirs[i]);
var mycb = new Element("input");
mycb.set("type", "checkbox");
mycb.set("id", "cb_watch_"+i);
if(pref.download_in_scan_dirs[i] == "true" || pref.download_in_scan_dirs[i] == 1) {
mycb.set("checked", "checked");
} else {
mycb.removeProperty('checked');
}
WatchedFoldersTable.push([myinput, mycb]);
}
2010-03-18 22:25:16 +03:00
var export_dir_enabled = pref.export_dir_enabled;
if(export_dir_enabled) {
$('exportdir_text').set('value', pref.export_dir);
$('exportdir_checkbox').set('checked', 'checked');
} else {
$('exportdir_text').set('value', '');
$('exportdir_checkbox').removeProperty('checked');
}
updateExportDirEnabled();
var mail_notification_enabled = pref.mail_notification_enabled;
if(mail_notification_enabled) {
$('mail_notification_checkbox').set('checked', 'checked');
} else {
$('mail_notification_checkbox').removeProperty('checked');
}
$('dest_email_txt').set('value', pref.mail_notification_email);
$('smtp_server_txt').set('value', pref.mail_notification_smtp);
updateMailNotification();
var autorun_enabled = pref.autorun_enabled;
if(autorun_enabled) {
$('autorun_checkbox').set('checked', 'checked');
} else {
$('autorun_checkbox').removeProperty('checked');
}
$('autorunProg_txt').set('value', pref.autorun_program);
updateAutoRun();
if(pref.preallocate_all) {
$('preallocateall_checkbox').set('checked', 'checked');
} else {
$('preallocateall_checkbox').removeProperty('checked');
}
if($defined(pref.incomplete_files_ext)) {
$('appendexttr').removeClass('invisible');
if(pref.incomplete_files_ext) {
$('appendext_checkbox').set('checked', 'checked');
} else {
$('appendext_checkbox').removeProperty('checked');
}
} else {
$('appendexttr').addClass('invisible');
}
if(pref.queueing_enabled) {
$('queueing_checkbox').set('checked', 'checked');
} else {
$('queueing_checkbox').removeProperty('checked');
}
$('max_active_dl_value').set('value', pref.max_active_downloads.toInt());
$('max_active_up_value').set('value', pref.max_active_uploads.toInt());
$('max_active_to_value').set('value', pref.max_active_torrents.toInt());
updateQueueingSystem();
// IP Filter
if(pref.ip_filter_enabled) {
$('ipfilter_enabled_checkbox').set('checked', 'checked');
} else {
$('ipfilter_enabled_checkbox').removeProperty('checked');
}
$('ipfilter_text').set('value', pref.ip_filter_path);
updateFilterSettings();
// PEER Proxy
switch(pref.proxy_type.toInt()) {
case 5: //SOCKS4
$('peer_proxy_type_select').set('value', 'socks4');
break;
case 2: // SOCKS5
case 4: // SOCKS5_PW
$('peer_proxy_type_select').set('value', 'socks5');
break;
case 1: // HTTP
case 3: // HTTP_PW
$('peer_proxy_type_select').set('value', 'http');
break;
default: // NONE
$('peer_proxy_type_select').set('value', 'none');
}
updatePeerProxySettings();
$('peer_proxy_host_text').set('value', pref.proxy_ip);
$('peer_proxy_port_value').set('value', pref.proxy_port);
2011-05-01 16:00:23 +04:00
if(pref.proxy_peer_connections) {
$('use_peer_proxy_checkbox').set('checked', 'checked');
} else {
$('use_peer_proxy_checkbox').removeProperty('checked');
}
if(pref.proxy_auth_enabled) {
$('peer_proxy_auth_checkbox').set('checked', 'checked');
} else {
$('peer_proxy_auth_checkbox').removeProperty('checked');
}
updatePeerProxyAuthSettings();
$('peer_proxy_username_text').set('value', pref.proxy_username);
$('peer_proxy_password_text').set('value', pref.proxy_password);
// Web UI
$('webui_port_value').set('value', pref.web_ui_port);
$('webui_username_text').set('value', pref.web_ui_username);
$('webui_password_text').set('value', pref.web_ui_password);
$('locale_select').set('value', pref.locale);
}
}
}).send();
}
loadPreferences();
2010-03-18 22:25:16 +03:00
</script>