mirror of
https://github.com/monlor/MIXBOX-ARCHIVE.git
synced 2026-03-21 02:39:01 +00:00
2018-12-31
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"fields": [{
|
||||
"field": "ck",
|
||||
"checkbox": true
|
||||
}, {
|
||||
"field": "name",
|
||||
"width": "100",
|
||||
"editor": {
|
||||
"type": "textbox",
|
||||
"options": {
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}, {
|
||||
"field": "description",
|
||||
"width": "120",
|
||||
"editor": "textbox"
|
||||
}, {
|
||||
"field": "color",
|
||||
"width": "80",
|
||||
"editor": "textbox",
|
||||
"formatter": "color"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<style>
|
||||
.iconfont-big {
|
||||
font-size: 35px;
|
||||
border: 0px;
|
||||
padding: 3px 5px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.iconfont-big:hover {
|
||||
border: 0px;
|
||||
}
|
||||
</style>
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:5px 6px 0px 6px;border:0px;">
|
||||
<div style="width:100%;padding:5px 0 0 0;text-align:center;line-height: 25px;">
|
||||
<img id="logo" src="tr-web-control/style/images/logo.png"/>
|
||||
<div id="dialog-about-tr-version">Transmission</div>
|
||||
<div id="dialog-about-version">Web Control</div>
|
||||
<div>Copyright © 2012-2018 栽培者</div>
|
||||
<div style="padding: 10px 0 5px 0px;">
|
||||
<a href="https://github.com/ronggang/transmission-web-control" target="_blank" class="easyui-linkbutton" data-options="iconCls:'iconfont tr-icon-github'" system-tip-lang="dialog['about']['home']" system-lang="dialog['about']['home']"></a>
|
||||
<a href="https://github.com/ronggang/transmission-web-control/wiki" target="_blank" class="easyui-linkbutton" data-options="iconCls:'iconfont tr-icon-help'" system-tip-lang="dialog['about']['help']" system-lang="dialog['about']['help']"></a>
|
||||
<a href="https://github.com/ronggang/transmission-web-control/releases" target="_blank" class="easyui-linkbutton" data-options="iconCls:'iconfont tr-icon-update'" system-tip-lang="dialog['about']['check-update']" system-lang="dialog['about']['check-update']"></a>
|
||||
<a href="https://github.com/ronggang/PT-Plugin" target="_blank" class="easyui-linkbutton" data-options="iconCls:'iconfont tr-icon-pt-plugin'" system-tip-lang="dialog['about']['pt-plugin']" system-lang="dialog['about']['pt-plugin']"></a>
|
||||
<br/>
|
||||
<a href="https://github.com/ronggang/transmission-web-control/wiki/Donate" target="_blank" class="l-btn iconfont iconfont-big tr-icon-aixinjuanzeng" system-tip-lang="dialog['about']['donate']"></a>
|
||||
</div>
|
||||
<hr/>
|
||||
<div style="padding-top: 5px;">
|
||||
<span>Thanks : </span>
|
||||
<a href="http://www.transmissionbt.com/" target="_blank" title="Transmission" class="easyui-linkbutton" >Transmission</a>
|
||||
<a href="http://jquery.com/" target="_blank" title="jQuery" class="easyui-linkbutton" >jQuery</a>
|
||||
<a href="http://www.jeasyui.com/" target="_blank" title="jQuery EasyUI" class="easyui-linkbutton" >EasyUI</a>
|
||||
<a href="http://iconfont.cn/" target="_blank" title="Alimama Iconfont" class="easyui-linkbutton" >Iconfont</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<a id="dialog-about-button-close" class="easyui-linkbutton" data-options="iconCls:'icon-close',plain:true" href="javascript:void(0);"><span system-lang="dialog['public']['button-close']"></span></a>
|
||||
</div> -->
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
system.resetLangText(thisDialog);
|
||||
|
||||
thisDialog.find("#dialog-about-tr-version").html("Transmission: "+system.serverConfig.version+", RPC: "+system.serverConfig["rpc-version"]);
|
||||
thisDialog.find("#dialog-about-version").html("Web Control: "+system.version+" ("+system.codeupdate+")");
|
||||
|
||||
thisDialog.find("#dialog-about-button-close").click(function()
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
})($("#dialog-about"));
|
||||
</script>
|
||||
@@ -0,0 +1,42 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;">
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td width="100%">
|
||||
<textarea id="folders" style="width:100%;" rows="10"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<a id="button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);"><span system-lang="dialog['public']['button-ok']"></span></a>
|
||||
<a id="button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);"><span system-lang="dialog['public']['button-cancel']"></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
var callback = thisDialog.data("callback");
|
||||
system.resetLangText(thisDialog);
|
||||
// Local setting information
|
||||
thisDialog.find("#folders").val(system.dictionary.folders);
|
||||
|
||||
thisDialog.find("#button-cancel").click(function()
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
// Confirm
|
||||
thisDialog.find("#button-ok").click(function()
|
||||
{
|
||||
system.dictionary.folders = thisDialog.find("#folders").val();
|
||||
system.saveConfig();
|
||||
thisDialog.dialog("close");
|
||||
if (callback)
|
||||
callback();
|
||||
});
|
||||
|
||||
|
||||
})($("#dialog-auto-match-data-folder-dictionary"));
|
||||
</script>
|
||||
@@ -0,0 +1,549 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;">
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td _width="30%" class="title"><span id="dialog-auto-match-data-folder-torrent-count" system-lang="dialog['auto-match-data-folder']['torrent-count']"></span></td>
|
||||
<td _width="50%">
|
||||
<span id="torrent-count"></span>
|
||||
</td>
|
||||
<td _width="20%"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="dialog-auto-match-data-folder-folder-count" system-lang="dialog['auto-match-data-folder']['folder-count']"></span></td>
|
||||
<td>
|
||||
<span id="folder-count"></span>
|
||||
</td>
|
||||
<td>
|
||||
<a id="button-config" class="easyui-linkbutton" data-options="iconCls:'icon-system-config',plain:true" href="javascript:void(0);"><span system-lang="dialog['public']['button-config']"></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="display:none;">
|
||||
<td class="title"><span id="dialog-auto-match-data-folder-time-begin" system-lang="dialog['auto-match-data-folder']['time-begin']"></span></td>
|
||||
<td>
|
||||
<span id="time-begin"></span>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr style="display:none;">
|
||||
<td class="title"><span id="dialog-auto-match-data-folder-time-now" system-lang="dialog['auto-match-data-folder']['time-now']"></span></td>
|
||||
<td>
|
||||
<span id="time-now"></span>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">
|
||||
<span system-lang="dialog['auto-match-data-folder']['work-mode-title']"></span>
|
||||
</td>
|
||||
<td>
|
||||
<select id="work-mode" class="easyui-combobox" data-options="editable:false" style="width:200px;"></select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">
|
||||
<span system-lang="dialog['auto-match-data-folder']['time-interval']"></span>
|
||||
</td>
|
||||
<td>
|
||||
<input id="time-interval" value="3" type="text" class="easyui-numberspinner" style="width:200px;" data-options="min:0.5,precision:1,increment:0.5"/>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title" colspan="3" style="text-align:left;"><span id="dialog-auto-match-data-folder-status" system-lang="dialog['auto-match-data-folder']['status']"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" id="td-status" style="display:none;">
|
||||
<span id="cus-torrent"></span><a id="button-ignore" class="easyui-linkbutton" data-options="iconCls:'icon-ignore',plain:true" href="javascript:void(0);"><span system-lang="dialog['auto-match-data-folder']['ignore']"></span></a><br/>
|
||||
<span id="cus-folder"></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="text-nochange" style="display:none;"></span>
|
||||
<span id="text-count"></span>
|
||||
<a id="button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
var ids = thisDialog.data("ids");
|
||||
var notMatchedTorrents = new Array();
|
||||
var notMatchedFolders = new Array();
|
||||
var torrent = null;
|
||||
var isworking = false;
|
||||
var ignore = false;
|
||||
var timeInterval = parseInt(system.getStorageData("auto-match-data-folder-time-interval",3000));
|
||||
|
||||
if (typeof(ids)=="object")
|
||||
{
|
||||
torrent = transmission.torrents.all[ids[0]];
|
||||
thisDialog.find("#torrent-count").html(ids.length);
|
||||
}
|
||||
else
|
||||
{
|
||||
torrent = transmission.torrents.all[ids];
|
||||
thisDialog.find("#torrent-count").html(1);
|
||||
ids = null;
|
||||
ids = new Array();
|
||||
ids.push(torrent.id);
|
||||
}
|
||||
|
||||
if (!torrent)
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(ids,function(key,value){
|
||||
torrent = transmission.torrents.all[value];
|
||||
if (torrent.status==0&&torrent.percentDone==0)
|
||||
{
|
||||
notMatchedTorrents.push(value);
|
||||
}
|
||||
});
|
||||
|
||||
system.resetLangText(thisDialog);
|
||||
|
||||
var mode = system.lang.dialog["auto-match-data-folder"]["work-mode"];
|
||||
for (var key in mode)
|
||||
{
|
||||
$("<option/>").val(key).attr("selected",(key==system.getStorageData("auto-match-data-folder-work-mode",1)?true:false)).text(mode[key]).appendTo(thisDialog.find("#work-mode"));
|
||||
}
|
||||
thisDialog.find("#time-interval").val(timeInterval/1000);
|
||||
|
||||
$.each("button-ok,button-cancel".split(","), function(i, item){
|
||||
thisDialog.find("#"+item).html(system.lang.dialog["public"][item]);
|
||||
});
|
||||
|
||||
// Cancel
|
||||
thisDialog.find("#button-cancel").click(function()
|
||||
{
|
||||
|
||||
if (isworking)
|
||||
{
|
||||
if (confirm(system.lang.dialog["auto-match-data-folder"]["working-close-confirm"]))
|
||||
{
|
||||
isworking = false;
|
||||
thisDialog.dialog("close");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
});
|
||||
|
||||
// Ignore
|
||||
thisDialog.find("#button-ignore").click(function()
|
||||
{
|
||||
if (isworking&&!ignore)
|
||||
{
|
||||
ignore = true;
|
||||
}
|
||||
});
|
||||
|
||||
// Set up
|
||||
thisDialog.find("#button-config").click(function()
|
||||
{
|
||||
system.openDialogFromTemplate({
|
||||
id: "dialog-auto-match-data-folder-dictionary",
|
||||
options: {
|
||||
title: system.lang.dialog["auto-match-data-folder"]["dictionary"],
|
||||
width: 530,
|
||||
height: 280
|
||||
},
|
||||
datas: {
|
||||
callback: function(){
|
||||
notMatchedFolders = system.dictionary.folders.split("\n");
|
||||
thisDialog.find("#folder-count").html(notMatchedFolders.length);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
if (system.dictionary.folders==null)
|
||||
{
|
||||
thisDialog.find("#button-ok").prop("disabled",true);
|
||||
thisDialog.find("#folder-count").html(0);
|
||||
return;
|
||||
}
|
||||
var notMatchedFolders = system.dictionary.folders.split("\n");
|
||||
var torrentIndex = 0;
|
||||
var folderIndex = 0;
|
||||
thisDialog.find("#folder-count").html(notMatchedFolders.length);
|
||||
|
||||
// Confirm
|
||||
thisDialog.find("#button-ok").click(function()
|
||||
{
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
var button = $(this);
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
isworking = true;
|
||||
thisDialog.find("#td-status").show();
|
||||
var modeType = thisDialog.find("#work-mode").combobox("getValue");
|
||||
timeInterval = thisDialog.find("#time-interval").val()*1000;
|
||||
switch (parseInt(modeType))
|
||||
{
|
||||
// method one
|
||||
case 1:
|
||||
thisDialog.find("#button-ignore").show();
|
||||
thisDialog.find("#cus-torrent").html("-> "+torrent.name + " [" + (torrentIndex+1)+"/"+notMatchedTorrents.length + "] ");
|
||||
var _arrSource = $.map(notMatchedFolders, function(n){return n;});
|
||||
execMatchDataFolderMode1(_arrSource,_arrSource.length,button,icon,notMatchedTorrents[torrentIndex]);
|
||||
_arrSource = null;
|
||||
break;
|
||||
|
||||
// method two
|
||||
case 2:
|
||||
thisDialog.find("#button-ignore").hide();
|
||||
thisDialog.find("#cus-folder").html("-> "+notMatchedFolders[folderIndex] + " [" + (folderIndex+1)+"/"+notMatchedFolders.length + "] ");
|
||||
var _arrSource = $.map(notMatchedTorrents, function(n){return n;});
|
||||
execMatchDataFolderMode3(_arrSource,_arrSource.length,button,icon,notMatchedFolders[folderIndex]);
|
||||
_arrSource = null;
|
||||
break;
|
||||
}
|
||||
|
||||
system.setStorageData("auto-match-data-folder-work-mode",modeType);
|
||||
system.setStorageData("auto-match-data-folder-time-interval",timeInterval);
|
||||
|
||||
});
|
||||
|
||||
// method one
|
||||
function execMatchDataFolderMode1(folders,count,button,icon,id)
|
||||
{
|
||||
if (isworking==false) return;
|
||||
//alert("count:"+count+",ids.length:"+ids.length+",notMatchedTorrents.length:"+notMatchedTorrents.length);
|
||||
//var id = ids;
|
||||
var index = count-folders.length;
|
||||
var dir = folders.shift();
|
||||
var torrent = transmission.torrents.all[id];
|
||||
if (!dir||ignore||torrent.percentDone!=0)
|
||||
{
|
||||
ignore = false;
|
||||
torrentIndex++;
|
||||
if (torrentIndex<notMatchedTorrents.length&&isworking)
|
||||
{
|
||||
system.debug("torrent:",torrent.name);
|
||||
thisDialog.find("#cus-torrent").html("-> "+torrent.name + " [" + (torrentIndex+1)+"/"+notMatchedTorrents.length + "] ");
|
||||
|
||||
var _arrSource = $.map(notMatchedFolders, function(n){return n;});
|
||||
execMatchDataFolderMode1(_arrSource,_arrSource.length,button,icon,notMatchedTorrents[torrentIndex]);
|
||||
_arrSource = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
thisDialog.find("#cus-folder").html("-> "+dir + " [" + (index+1)+"/"+count + "] ");
|
||||
|
||||
if (torrent.downloadDir==dir)
|
||||
{
|
||||
execMatchDataFolderMode1(folders,count,button,icon,id);
|
||||
return;
|
||||
}
|
||||
// Start setting parameters
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-set-location"
|
||||
,arguments:{
|
||||
ids:id
|
||||
,location:dir
|
||||
,move:false
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
torrent.downloadDir = dir;
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-verify"
|
||||
,arguments:{
|
||||
ids:id
|
||||
}
|
||||
}
|
||||
,function(data1){
|
||||
setTimeout(function(){
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-get"
|
||||
,arguments:{
|
||||
ids:id
|
||||
,fields: ["percentDone"]
|
||||
}
|
||||
}
|
||||
,function(data2){
|
||||
if (data2.result=="success")
|
||||
{
|
||||
//
|
||||
if (data2.arguments.torrents[0].percentDone!=0)
|
||||
{
|
||||
torrentIndex++;
|
||||
if (torrentIndex<notMatchedTorrents.length&&isworking)
|
||||
{
|
||||
system.debug("torrent:",torrent.name);
|
||||
thisDialog.find("#cus-torrent").html("-> "+torrent.name + " [" + (torrentIndex+1)+"/"+notMatchedTorrents.length + "] ");
|
||||
|
||||
var _arrSource = $.map(notMatchedFolders, function(n){return n;});
|
||||
execMatchDataFolderMode1(_arrSource,_arrSource.length,button,icon,notMatchedTorrents[torrentIndex]);
|
||||
_arrSource = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
execMatchDataFolderMode1(folders,count,button,icon,id);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
},timeInterval)
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
$.messager.alert("",system.lang.error["data-post-error"]+": "+data.result,'error');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// method two
|
||||
function execMatchDataFolderMode2(ids,count,button,icon,dir)
|
||||
{
|
||||
if (isworking==false) return;
|
||||
//alert("count:"+count+",ids.length:"+ids.length+",notMatchedTorrents.length:"+notMatchedTorrents.length);
|
||||
//var id = ids;
|
||||
var index = count-ids.length;
|
||||
var id = ids.shift();
|
||||
if (!id)
|
||||
{
|
||||
folderIndex++;
|
||||
if (folderIndex<notMatchedFolders.length&&isworking)
|
||||
{
|
||||
setTimeout(function(){
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-get"
|
||||
,arguments:{
|
||||
ids:notMatchedTorrents
|
||||
,fields: ["status","id","percentDone"]
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
notMatchedTorrents = null;
|
||||
notMatchedTorrents = new Array();
|
||||
$.each(data.arguments.torrents,function(key,item){
|
||||
if (item.status==0&&item.percentDone==0)
|
||||
{
|
||||
if (jQuery.inArray(item.id,notMatchedTorrents)==-1)
|
||||
notMatchedTorrents.push(item.id);
|
||||
}
|
||||
});
|
||||
if (notMatchedTorrents.length>0)
|
||||
{
|
||||
thisDialog.find("#cus-folder").html("-> "+notMatchedFolders[folderIndex] + " [" + (folderIndex+1)+"/"+notMatchedFolders.length + "] ");
|
||||
system.debug("folder:",notMatchedFolders[folderIndex]);
|
||||
var _arrSource = $.map(notMatchedTorrents, function(n){return n;});
|
||||
execMatchDataFolderMode2(_arrSource,_arrSource.length,button,icon,notMatchedFolders[folderIndex]);
|
||||
_arrSource = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
);
|
||||
},timeInterval);
|
||||
}
|
||||
else
|
||||
{
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var torrent = transmission.torrents.all[id];
|
||||
|
||||
system.debug("torrent:",torrent.name);
|
||||
thisDialog.find("#cus-torrent").html("-> "+torrent.name + " [" + (index+1)+"/"+count + "] ");
|
||||
|
||||
if (torrent.downloadDir==dir)
|
||||
{
|
||||
if (torrent.percentDone==0&&torrent.status==0)
|
||||
{
|
||||
if (jQuery.inArray(id,notMatchedTorrents)==-1)
|
||||
notMatchedTorrents.push(id);
|
||||
}
|
||||
execMatchDataFolderMode2(ids,count,button,icon,dir);
|
||||
return;
|
||||
}
|
||||
else if (torrent.percentDone!=0)
|
||||
{
|
||||
execMatchDataFolderMode2(ids,count,button,icon,dir);
|
||||
return;
|
||||
}
|
||||
|
||||
// Start setting parameters
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-set-location"
|
||||
,arguments:{
|
||||
ids:id
|
||||
,location:dir
|
||||
,move:false
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
torrent.downloadDir = dir;
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-verify"
|
||||
,arguments:{
|
||||
ids:id
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
execMatchDataFolderMode2(ids,count,button,icon,dir);
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
$.messager.alert("",system.lang.error["data-post-error"]+": "+data.result,'error');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// method two
|
||||
function execMatchDataFolderMode3(ids,count,button,icon,dir)
|
||||
{
|
||||
if (isworking==false) return;
|
||||
|
||||
thisDialog.find("#cus-torrent").html("-> "+count);
|
||||
// Start setting parameters
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-set-location"
|
||||
,arguments:{
|
||||
ids:ids
|
||||
,location:dir
|
||||
,move:false
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
torrent.downloadDir = dir;
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-verify"
|
||||
,arguments:{
|
||||
ids:ids
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
folderIndex++;
|
||||
if (folderIndex<notMatchedFolders.length&&isworking)
|
||||
{
|
||||
setTimeout(function(){
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-get"
|
||||
,arguments:{
|
||||
ids:ids
|
||||
,fields: ["status","id","percentDone"]
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
notMatchedTorrents = null;
|
||||
notMatchedTorrents = new Array();
|
||||
$.each(data.arguments.torrents,function(key,item){
|
||||
if (item.status==0&&item.percentDone==0)
|
||||
{
|
||||
if (jQuery.inArray(item.id,notMatchedTorrents)==-1)
|
||||
notMatchedTorrents.push(item.id);
|
||||
}
|
||||
});
|
||||
if (notMatchedTorrents.length>0)
|
||||
{
|
||||
thisDialog.find("#cus-folder").html("-> "+notMatchedFolders[folderIndex] + " [" + (folderIndex+1)+"/"+notMatchedFolders.length + "] ");
|
||||
system.debug("folder:",notMatchedFolders[folderIndex]);
|
||||
var _arrSource = $.map(notMatchedTorrents, function(n){return n;});
|
||||
execMatchDataFolderMode3(_arrSource,_arrSource.length,button,icon,notMatchedFolders[folderIndex]);
|
||||
_arrSource = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
);
|
||||
},timeInterval);
|
||||
}
|
||||
else
|
||||
{
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
$.messager.alert("",system.lang.error["data-post-error"]+": "+data.result,'error');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
})($("#dialog-auto-match-data-folder"));
|
||||
</script>
|
||||
@@ -0,0 +1,102 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;overflow: hidden;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;height:100%;border-bottom: 1px dotted #ccc;">
|
||||
<div>
|
||||
<input id="chk-export-system" type="checkbox" checked="checked" />
|
||||
<label for="chk-export-system" system-lang="dialog['export-config']['option-system']"></label>
|
||||
</div>
|
||||
<div>
|
||||
<input id="chk-export-dictionary" type="checkbox" checked="checked"/>
|
||||
<label for="chk-export-dictionary" system-lang="dialog['export-config']['option-dictionary']"></label>
|
||||
</div>
|
||||
<div>
|
||||
<input id="chk-export-server" type="checkbox" checked="checked"/>
|
||||
<label for="chk-export-server" system-lang="dialog['export-config']['option-server']"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="text-nochange" style="display:none;"></span>
|
||||
<span id="text-count"></span>
|
||||
<a id="button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);"
|
||||
system-lang="dialog['public']['button-ok']">Ok</a>
|
||||
<a id="button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);"
|
||||
system-lang="dialog['public']['button-cancel']">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function (thisDialog) {
|
||||
var page = {
|
||||
init: function () {
|
||||
system.resetLangText(thisDialog);
|
||||
this.initEvents();
|
||||
},
|
||||
// 初始化事件
|
||||
initEvents: function () {
|
||||
// Cancel
|
||||
$("#button-cancel", thisDialog).click(function () {
|
||||
page.close();
|
||||
});
|
||||
|
||||
$("#button-ok", thisDialog).click(function () {
|
||||
if (page.done()) {
|
||||
page.close();
|
||||
}
|
||||
});
|
||||
},
|
||||
done: function () {
|
||||
var data = {};
|
||||
|
||||
// 系统
|
||||
if ($("#chk-export-system", thisDialog).prop("checked")) {
|
||||
data["system"] = system.config;
|
||||
data["user"] = system.userConfig;
|
||||
}
|
||||
|
||||
// 目录字典
|
||||
if ($("#chk-export-dictionary", thisDialog).prop("checked")) {
|
||||
data["dictionary-folders"] = system.dictionary.folders.split("\n");
|
||||
}
|
||||
|
||||
// 服务器
|
||||
if ($("#chk-export-server", thisDialog).prop("checked")) {
|
||||
data["server"] = $.extend({}, system.serverConfig);
|
||||
|
||||
// 排除一些不需要的参数
|
||||
var except = ["blocklist-size", "config-dir", "rpc-version",
|
||||
"rpc-version-minimum", "version", "session-id", "units",
|
||||
"download-dir-free-space"];
|
||||
|
||||
for (const key in except) {
|
||||
if (except.hasOwnProperty(key)) {
|
||||
const item = except[key];
|
||||
data.server.hasOwnProperty(item) && delete data.server[item];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($.isEmptyObject(data)) {
|
||||
thisDialog.find("#text-nochange").html(system.lang.dialog["export-config"].title).fadeInAndOut();
|
||||
return false;
|
||||
}
|
||||
|
||||
data["configVersion"] = 1;
|
||||
|
||||
var exportData = JSON.parse(JSON.stringify(data));
|
||||
|
||||
saveFileAs("tr-web-contorl-config.json", JSON.stringify(exportData));
|
||||
return true;
|
||||
},
|
||||
close: function () {
|
||||
var source = thisDialog.data("popoverSource");
|
||||
|
||||
if (source) {
|
||||
$(source).webuiPopover("hide");
|
||||
} else {
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
};
|
||||
page.init();
|
||||
})($("#dialog-export-config"));
|
||||
</script>
|
||||
@@ -0,0 +1,119 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;overflow: hidden;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;height:100%;border-bottom: 1px dotted #ccc;">
|
||||
<div id="div-option-system" style="display:none;">
|
||||
<input id="chk-option-system" type="checkbox" />
|
||||
<label for="chk-option-system" system-lang="dialog['export-config']['option-system']"></label>
|
||||
</div>
|
||||
<div id="div-option-dictionary-folders" style="display:none;">
|
||||
<input id="chk-option-dictionary-folders" type="checkbox" />
|
||||
<label for="chk-option-dictionary-folders" system-lang="dialog['export-config']['option-dictionary']"></label>
|
||||
</div>
|
||||
<div id="div-option-server" style="display:none;">
|
||||
<input id="chk-option-server" type="checkbox" />
|
||||
<label for="chk-option-server" system-lang="dialog['export-config']['option-server']"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="text-nochange" style="display:none;"></span>
|
||||
<span id="text-count"></span>
|
||||
<a id="button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);"
|
||||
system-lang="dialog['public']['button-ok']">Ok</a>
|
||||
<a id="button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);"
|
||||
system-lang="dialog['public']['button-cancel']">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function (thisDialog) {
|
||||
var page = {
|
||||
config: thisDialog.data("config"),
|
||||
init: function () {
|
||||
system.resetLangText(thisDialog);
|
||||
this.initEvents();
|
||||
this.initValues();
|
||||
},
|
||||
// 初始化事件
|
||||
initEvents: function () {
|
||||
// Cancel
|
||||
$("#button-cancel", thisDialog).click(function () {
|
||||
page.close();
|
||||
});
|
||||
|
||||
$("#button-ok", thisDialog).click(function () {
|
||||
if (page.done()) {
|
||||
page.close();
|
||||
}
|
||||
});
|
||||
},
|
||||
initValues: function () {
|
||||
for (const key in this.config) {
|
||||
if (this.config.hasOwnProperty(key)) {
|
||||
$("#div-option-" + key, thisDialog).show();
|
||||
$("#chk-option-" + key, thisDialog).prop("checked", true);
|
||||
}
|
||||
}
|
||||
},
|
||||
done: function () {
|
||||
var data = {};
|
||||
|
||||
// 系统
|
||||
if ($("#chk-option-system", thisDialog).prop("checked")) {
|
||||
data["system"] = this.config.system;
|
||||
data["user"] = this.config.user;
|
||||
}
|
||||
|
||||
// 目录字典
|
||||
if ($("#chk-option-dictionary-folders", thisDialog).prop("checked")) {
|
||||
data["dictionary-folders"] = (this.config["dictionary-folders"]).join("\n");
|
||||
}
|
||||
|
||||
// 服务器
|
||||
if ($("#chk-option-server", thisDialog).prop("checked")) {
|
||||
data["server"] = this.config.server;
|
||||
}
|
||||
|
||||
if ($.isEmptyObject(data)) {
|
||||
thisDialog.find("#text-nochange").html(system.lang.dialog["import-config"].title).fadeInAndOut();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (confirm(system.lang.dialog["system-config"]["import-config-confirm"])) {
|
||||
system.config = data["system"] || system.config;
|
||||
system.userConfig = data["user"] || system.userConfig;
|
||||
system.dictionary.folders = data["dictionary-folders"] || system.dictionary.folders;
|
||||
system.saveConfig();
|
||||
system.saveUserConfig();
|
||||
|
||||
if (data["server"]) {
|
||||
this.updateServerConfig(data["server"]);
|
||||
} else {
|
||||
location.href = location.href;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
updateServerConfig: function(config) {
|
||||
// Start setting parameters
|
||||
transmission.exec({
|
||||
method: "session-set",
|
||||
arguments: config
|
||||
}, function (data) {
|
||||
if (data.result == "success") {
|
||||
location.href = location.href;
|
||||
}
|
||||
});
|
||||
},
|
||||
close: function () {
|
||||
var source = thisDialog.data("popoverSource");
|
||||
|
||||
if (source) {
|
||||
$(source).webuiPopover("hide");
|
||||
} else {
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
};
|
||||
page.init();
|
||||
})($("#dialog-import-config"));
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,100 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;">
|
||||
<span id="dialog-system-replaceTracker-tip" class="tip"></span>
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td width="20%" class="title"><span id="dialog-system-replaceTracker-old-tracker"></span></td>
|
||||
<td width="80%">
|
||||
<input type="text" id="old-tracker-url" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="dialog-system-replaceTracker-new-tracker"></span></td>
|
||||
<td>
|
||||
<input type="text" id="new-tracker-url" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2"><hr/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="text-nochange" style="display:none;"></span>
|
||||
<a id="replaceTracker-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="replaceTracker-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
var title = "old-tracker,new-tracker,tip".split(",");
|
||||
var torrent = transmission.torrents.all[system.currentTorrentId];
|
||||
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#dialog-system-replaceTracker-"+item).html(system.lang.dialog["system-replaceTracker"][item]);
|
||||
});
|
||||
|
||||
title = "button-ok,button-cancel".split(",");
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#replaceTracker-"+item).html(system.lang.dialog["public"][item]);
|
||||
});
|
||||
|
||||
thisDialog.find("#text-nochange").html(system.lang["public"]["text-nochange"]);
|
||||
|
||||
// 确认
|
||||
thisDialog.find("#replaceTracker-button-ok").click(function()
|
||||
{
|
||||
var oldValue = thisDialog.find("#old-tracker-url").val();
|
||||
var newValue = thisDialog.find("#new-tracker-url").val();
|
||||
var button = $(this);
|
||||
|
||||
// 如果有指定參數時,開始替換
|
||||
if (oldValue&&newValue&&(oldValue!=newValue))
|
||||
{
|
||||
if (confirm(system.lang["public"]["text-confirm"])==false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
// 开始设置参数
|
||||
transmission.torrents.searchAndReplaceTrackers(
|
||||
oldValue
|
||||
,newValue
|
||||
,function(ids,count){
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
if (count==0)
|
||||
{
|
||||
thisDialog.find("#text-nochange").html(system.lang["public"]["not-found"]).fadeInAndOut();
|
||||
return;
|
||||
}
|
||||
|
||||
if (ids==null)
|
||||
{
|
||||
thisDialog.find("#text-nochange").html(system.lang.dialog["error"]["data-error"]).fadeInAndOut();
|
||||
return;
|
||||
}
|
||||
|
||||
system.reloadTorrentBaseInfos(ids);
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
thisDialog.find("#text-nochange").html(system.lang["public"]["text-nochange"]).fadeInAndOut();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
thisDialog.find("#replaceTracker-button-cancel").click(function()
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
})($("#dialog-system-replaceTracker"));
|
||||
</script>
|
||||
@@ -0,0 +1,227 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:5px 6px 0px 6px;border:0px;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;">
|
||||
<div id="dialog-torrent-add-tip-title" style="border:1px #c0c0c0 solid;background-color: #ffffcc;padding:3px;width:99%;color:black;"></div>
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td width="20%" class="title"><span id="dialog-torrent-add-download-dir"></span></td>
|
||||
<td width="80%">
|
||||
<select id="download-dir" style="width:450px;"></select>
|
||||
<input type="checkbox" id="set-default-download-dir" style="width:20px;"/><label for="set-default-download-dir" id="dialog-torrent-add-set-default-download-dir"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><label id="dialog-torrent-add-upload-file" for="torrent_upload_file"></label></td>
|
||||
<td>
|
||||
<form action="#" method="post" id="torrent_upload_form" enctype="multipart/form-data" target="torrent_upload_frame">
|
||||
<input type="file" name="torrent_files[]" id="torrent_upload_file" multiple="multiple" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="dialog-torrent-add-torrent-url"></span></td>
|
||||
<td>
|
||||
<textarea id="torrent_url" style="height:130px;"></textarea>
|
||||
<span id="dialog-torrent-add-tip-torrent-url"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<hr/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="dialog-torrent-add-autostart"></span></td>
|
||||
<td>
|
||||
<input type="checkbox" id="chkautostart" style="width:20px;"/><label for="chkautostart" id="dialog-torrent-add-tip-autostart"></label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="dialog-torrent-add-nosource" style="display:none;"></span>
|
||||
<span id="dialog-torrent-add-queue" style="display:none;"></span>
|
||||
<a id="torrent-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="torrent-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
var title = "download-dir,torrent-url,tip-torrent-url,autostart,tip-autostart,set-default-download-dir,upload-file,nosource,tip-title".split(",");
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#dialog-torrent-add-"+item).html(system.lang.dialog["torrent-add"][item]);
|
||||
});
|
||||
|
||||
title = "button-ok,button-cancel".split(",");
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#torrent-"+item).html(system.lang.dialog.public[item]);
|
||||
});
|
||||
|
||||
thisDialog.find("#download-dir").val(system.downloadDir);
|
||||
|
||||
var downloadDirs = $.merge([],transmission.downloadDirs);
|
||||
if (system.dictionary.folders != null && system.dictionary.folders != "")
|
||||
{
|
||||
$.merge(downloadDirs,system.dictionary.folders.split("\n"));
|
||||
}
|
||||
downloadDirs = uniq(downloadDirs);
|
||||
if (downloadDirs == null)
|
||||
{
|
||||
$("<option/>").text(system.downloadDir).val(system.downloadDir).attr("selected",true).appendTo(thisDialog.find("#download-dir"));
|
||||
} else {
|
||||
$.each(downloadDirs, function(i, item){
|
||||
$("<option/>").text(item).val(item).attr("selected",(item==system.downloadDir?true:false)).appendTo(thisDialog.find("#download-dir"));
|
||||
});
|
||||
}
|
||||
|
||||
thisDialog.find("#chkautostart").prop("checked", system.serverConfig["start-added-torrents"]);
|
||||
thisDialog.find("#download-dir").combobox();
|
||||
// Confirm
|
||||
thisDialog.find("#torrent-button-ok").click(function()
|
||||
{
|
||||
var dir = thisDialog.find("#download-dir").combobox("getValue");
|
||||
var olddir = system.downloadDir;
|
||||
var isnewdir = system.serverConfig["download-dir"]!=dir;
|
||||
var isupload = thisDialog.find("#torrent_upload_file")[0].value!="";
|
||||
var autostart = thisDialog.find("#chkautostart").prop("checked");
|
||||
|
||||
if (autostart!=system.serverConfig["start-added-torrents"])
|
||||
{
|
||||
system.serverConfig["start-added-torrents"] = autostart;
|
||||
// Start setting parameters
|
||||
transmission.exec(
|
||||
{
|
||||
method:"session-set"
|
||||
,arguments: {
|
||||
"start-added-torrents": autostart
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var button = $(this);
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
|
||||
if (thisDialog.find("#set-default-download-dir").prop("checked")&&isnewdir)
|
||||
{
|
||||
updateDownloadDir(dir,function(){
|
||||
if (isupload)
|
||||
{
|
||||
uploadFile(!autostart,function(){
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
});
|
||||
}
|
||||
var url = thisDialog.find("#torrent_url").val();
|
||||
// When there is a file to upload
|
||||
if (isupload)
|
||||
{
|
||||
// rpc-version 15 stopped using the ../upload interface
|
||||
if (system.serverConfig["rpc-version"]>=15)
|
||||
{
|
||||
var uploaded = 0;
|
||||
system.uploadTorrentFile("torrent_upload_file",dir,!autostart,function(data,count){
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
uploaded++;
|
||||
thisDialog.find("#dialog-torrent-add-queue").html(uploaded+"/"+count).show();
|
||||
if (uploaded==count)
|
||||
{
|
||||
thisDialog.find("#dialog-torrent-add-queue").html("").hide();
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
|
||||
system.reloadData();
|
||||
});
|
||||
return;
|
||||
}
|
||||
// New directory, but no hooks to save when you first save the directory
|
||||
if (isnewdir)
|
||||
{
|
||||
updateDownloadDir(dir,function(){
|
||||
if (isupload)
|
||||
{
|
||||
uploadFile(!autostart,function(){
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
updateDownloadDir(olddir);
|
||||
});
|
||||
//thisDialog.dialog("close");
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
uploadFile(!autostart);
|
||||
//thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
else if (url!="")
|
||||
{
|
||||
var urls = url.split("\n");
|
||||
system.addTorrentsToServer(urls,urls.length,autostart,dir);
|
||||
urls = null;
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
else if(!isupload)
|
||||
{
|
||||
thisDialog.find("#dialog-torrent-add-nosource").fadeInAndOut();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
thisDialog.find("#torrent-button-cancel").click(function()
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
// Save the upload directory
|
||||
function updateDownloadDir(dir,callback)
|
||||
{
|
||||
transmission.exec(
|
||||
{
|
||||
method:"session-set"
|
||||
,arguments:{"download-dir":dir}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
system.downloadDir = dir;
|
||||
system.serverConfig["download-dir"] = dir;
|
||||
if (callback)
|
||||
{
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Upload files
|
||||
function uploadFile(paused,callback){
|
||||
var options = {
|
||||
// The upload should be by TR interface
|
||||
url:"../upload?paused=" + paused
|
||||
,type:"POST"
|
||||
,dataType:"json"
|
||||
,data:{
|
||||
"X-Transmission-Session-Id":transmission.SessionId
|
||||
}
|
||||
,success:function(data){
|
||||
//alert(data);
|
||||
if (callback)
|
||||
callback();
|
||||
thisDialog.dialog("close");
|
||||
system.reloadData();
|
||||
}
|
||||
,error:function(data){
|
||||
//alert("error:"+data);
|
||||
console.log("data:",data);
|
||||
}
|
||||
};
|
||||
$('#torrent_upload_form').ajaxSubmit(options);
|
||||
}
|
||||
})($("#dialog-torrent-add"));
|
||||
</script>
|
||||
@@ -0,0 +1,185 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:5px 6px 0px 6px;border:0px;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;">
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td width="20%" class="title"><span id="dialog-torrent-add-download-dir"></span></td>
|
||||
<td width="80%">
|
||||
<select id="download-dir" style="width:450px;"></select>
|
||||
<input type="checkbox" id="set-default-download-dir" style="width:20px;"/><label for="set-default-download-dir" id="dialog-torrent-add-set-default-download-dir"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><label id="dialog-torrent-add-upload-file" for="torrent_upload_file"></label></td>
|
||||
<td>
|
||||
<select id="torrent_upload_file" style="height:120px;" multiple="multiple"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<hr/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="dialog-torrent-add-autostart"></span></td>
|
||||
<td>
|
||||
<input type="checkbox" id="chkautostart" style="width:20px;"/><label for="chkautostart" id="dialog-torrent-add-tip-autostart"></label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="dialog-torrent-add-queue" style="display:none;"></span>
|
||||
<a id="torrent-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="torrent-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
var title = "download-dir,autostart,tip-autostart,set-default-download-dir,upload-file".split(",");
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#dialog-torrent-add-"+item).html(system.lang.dialog["torrent-add"][item]);
|
||||
});
|
||||
|
||||
title = "button-ok,button-cancel".split(",");
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#torrent-"+item).html(system.lang.dialog.public[item]);
|
||||
});
|
||||
|
||||
thisDialog.find("#download-dir").val(system.downloadDir);
|
||||
|
||||
var downloadDirs = $.merge([],transmission.downloadDirs);
|
||||
if (system.dictionary.folders != null && system.dictionary.folders != "")
|
||||
{
|
||||
$.merge(downloadDirs,system.dictionary.folders.split("\n"));
|
||||
}
|
||||
downloadDirs = uniq(downloadDirs);
|
||||
if (downloadDirs == null)
|
||||
{
|
||||
$("<option/>").text(system.downloadDir).val(system.downloadDir).attr("selected",true).appendTo(thisDialog.find("#download-dir"));
|
||||
} else {
|
||||
$.each(downloadDirs, function(i, item){
|
||||
$("<option/>").text(item).val(item).attr("selected",(item==system.downloadDir?true:false)).appendTo(thisDialog.find("#download-dir"));
|
||||
});
|
||||
}
|
||||
|
||||
thisDialog.find("#download-dir").combobox();
|
||||
$.each(thisDialog.data("files"),function(i,item){
|
||||
$("<option/>").text((i+1)+"."+item.name).appendTo(thisDialog.find("#torrent_upload_file"));
|
||||
});
|
||||
|
||||
thisDialog.find("#chkautostart").prop("checked", system.serverConfig["start-added-torrents"]);
|
||||
|
||||
// Confirm
|
||||
thisDialog.find("#torrent-button-ok").click(function()
|
||||
{
|
||||
var dir = thisDialog.find("#download-dir").combobox("getValue");
|
||||
var olddir = system.downloadDir;
|
||||
var isnewdir = system.serverConfig["download-dir"]!=dir;
|
||||
var autostart = thisDialog.find("#chkautostart").prop("checked");
|
||||
var button = $(this);
|
||||
|
||||
if (dir=="")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (autostart!=system.serverConfig["start-added-torrents"])
|
||||
{
|
||||
system.serverConfig["start-added-torrents"] = autostart;
|
||||
// Start setting parameters
|
||||
transmission.exec(
|
||||
{
|
||||
method:"session-set"
|
||||
,arguments: {
|
||||
"start-added-torrents": autostart
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
button.linkbutton({disabled:true});
|
||||
|
||||
if (thisDialog.find("#set-default-download-dir").prop("checked")&&isnewdir)
|
||||
{
|
||||
updateDownloadDir(dir);
|
||||
}
|
||||
|
||||
var files = thisDialog.data("files");
|
||||
var uploaded = 0;
|
||||
$.each(files,function(i,item){
|
||||
transmission.addTorrentFromFile(item,dir,!autostart,function(){
|
||||
uploaded++;
|
||||
thisDialog.find("#dialog-torrent-add-queue").html(uploaded+"/"+files.length).show();
|
||||
if (uploaded==files.length)
|
||||
{
|
||||
thisDialog.find("#dialog-torrent-add-queue").html("").hide();
|
||||
button.linkbutton({disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
system.reloadData();
|
||||
});
|
||||
});
|
||||
|
||||
//thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
thisDialog.find("#torrent-button-cancel").click(function()
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
// Save the upload directory
|
||||
function updateDownloadDir(dir,callback)
|
||||
{
|
||||
transmission.exec(
|
||||
{
|
||||
method:"session-set"
|
||||
,arguments:{"download-dir":dir}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
system.downloadDir = dir;
|
||||
system.serverConfig["download-dir"] = dir;
|
||||
if (callback)
|
||||
{
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// Upload files
|
||||
// 2013/3/11 failure
|
||||
function uploadFile(paused,callback){
|
||||
var xhr = new XMLHttpRequest();
|
||||
var files = thisDialog.data("files");
|
||||
xhr.open("POST", "../upload?paused=" + paused);
|
||||
|
||||
xhr.onload = function() {
|
||||
if (callback)
|
||||
callback();
|
||||
|
||||
thisDialog.find("#torrent-button-ok").linkbutton({disabled:false});
|
||||
thisDialog.dialog("close");
|
||||
system.reloadData();
|
||||
};
|
||||
|
||||
xhr.onerror = function() {
|
||||
system.debug("this.responseText:",this.responseText);
|
||||
};
|
||||
|
||||
// prepare FormData
|
||||
var formData = new FormData();
|
||||
$.each(files,function(i,item){
|
||||
formData.append("torrent_files[]", item);
|
||||
});
|
||||
|
||||
formData.append("X-Transmission-Session-Id",transmission.SessionId);
|
||||
xhr.send(formData);
|
||||
}
|
||||
})($("#dialog-torrent-addfile"));
|
||||
</script>
|
||||
@@ -0,0 +1,89 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;">
|
||||
<span id="dialog-torrent-attribute-add-tracker-tip" class="tip"></span>
|
||||
<textarea id="txtTrackers" style="width:99%;height:120px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="text-nochange" style="display:none;"></span>
|
||||
<a id="torrent-attribute-add-tracker-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="torrent-attribute-add-tracker-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true"
|
||||
href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function (thisDialog) {
|
||||
var title = "tip".split(",");
|
||||
var torrent = transmission.torrents.all[system.currentTorrentId];
|
||||
|
||||
$.each(title, function (i, item) {
|
||||
thisDialog.find("#dialog-torrent-attribute-add-tracker-" + item).html(system.lang.dialog[
|
||||
"torrent-attribute-add-tracker"][item]);
|
||||
});
|
||||
|
||||
thisDialog.find(".title").css({
|
||||
background: "#e6e6e6"
|
||||
});
|
||||
|
||||
title = "button-ok,button-cancel".split(",");
|
||||
$.each(title, function (i, item) {
|
||||
thisDialog.find("#torrent-attribute-add-tracker-" + item).html(system.lang.dialog["public"][item]);
|
||||
});
|
||||
|
||||
thisDialog.find("#text-nochange").html(system.lang["public"]["text-nochange"]);
|
||||
|
||||
// 确认
|
||||
thisDialog.find("#torrent-attribute-add-tracker-button-ok").click(function () {
|
||||
var urls = thisDialog.find("#txtTrackers").val();
|
||||
var button = $(this);
|
||||
|
||||
if (urls != "") {
|
||||
var newTrackers = [];
|
||||
var items = urls.split("\n");
|
||||
$.each(items, function(index, value) {
|
||||
if (isURL(value) && newTrackers.indexOf(value)==-1) {
|
||||
newTrackers.push(value);
|
||||
}
|
||||
});
|
||||
if (newTrackers.length==0) {
|
||||
thisDialog.find("#text-nochange").html(system.lang["public"]["text-nochange"]).fadeInAndOut();
|
||||
return;
|
||||
}
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({
|
||||
disabled: true,
|
||||
iconCls: "icon-loading"
|
||||
});
|
||||
transmission.exec({
|
||||
method: "torrent-set",
|
||||
arguments: {
|
||||
ids: system.currentTorrentId,
|
||||
trackerAdd: newTrackers
|
||||
}
|
||||
}, function (data) {
|
||||
button.linkbutton({
|
||||
iconCls: icon,
|
||||
disabled: false
|
||||
});
|
||||
|
||||
if (data.result == "success") {
|
||||
system.getTorrentInfos(system.currentTorrentId);
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
thisDialog.find("#text-nochange").html(system.lang["public"]["text-nochange"]).fadeInAndOut();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
thisDialog.find("#torrent-attribute-add-tracker-button-cancel").click(function () {
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
function isURL(v) {
|
||||
return /^[a-zA-z]+:\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?$/.test(v);
|
||||
}
|
||||
})($("#dialog-torrent-attribute-add-tracker"));
|
||||
</script>
|
||||
@@ -0,0 +1,231 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;">
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td width="20%" class="title"><span id="dialog-torrent-changeDownloadDir-old-download-dir"></span></td>
|
||||
<td width="80%">
|
||||
<span id="old-download-dir"></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="dialog-torrent-changeDownloadDir-new-download-dir"></span></td>
|
||||
<td>
|
||||
<select id="download-dir" style="width:400px;"></select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"></td>
|
||||
<td>
|
||||
<input type="checkbox" id="move-data" style="width:20px;"/><label for="move-data" id="dialog-torrent-changeDownloadDir-move-data"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"></td>
|
||||
<td>
|
||||
<input type="checkbox" id="recheck-data" style="width:20px;"/><label for="recheck-data" id="dialog-torrent-changeDownloadDir-recheck-data"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><hr/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="text-nochange" style="display:none;"></span>
|
||||
<span id="text-count"></span>
|
||||
<a id="torrent-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="torrent-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
var title = "old-download-dir,new-download-dir,move-data,recheck-data".split(",");
|
||||
var ids = thisDialog.data("ids");
|
||||
var allIds = new Array();
|
||||
var issimple = false;
|
||||
var torrent = null;
|
||||
var recheck = false;
|
||||
if (typeof(ids)=="object")
|
||||
{
|
||||
torrent = transmission.torrents.all[ids[0]];
|
||||
}
|
||||
else
|
||||
{
|
||||
torrent = transmission.torrents.all[ids];
|
||||
issimple = true;
|
||||
}
|
||||
|
||||
if (!torrent)
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
return;
|
||||
}
|
||||
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#dialog-torrent-changeDownloadDir-"+item).html(system.lang.dialog["torrent-changeDownloadDir"][item]);
|
||||
});
|
||||
|
||||
thisDialog.find("#text-count").text("");
|
||||
|
||||
title = "button-ok,button-cancel".split(",");
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#torrent-"+item).html(system.lang.dialog["public"][item]);
|
||||
});
|
||||
|
||||
thisDialog.find("#text-nochange").html(system.lang.dialog["public"]["text-nochange"]);
|
||||
|
||||
thisDialog.find("#old-download-dir").text(torrent.downloadDir);
|
||||
thisDialog.find("#download-dir").val(torrent.downloadDir);
|
||||
|
||||
$.each(transmission.downloadDirs, function(i, item){
|
||||
$("<option/>").text(item).val(item).attr("selected",(item==torrent.downloadDir?true:false)).appendTo(thisDialog.find("#download-dir"));
|
||||
});
|
||||
if (transmission.downloadDirs.length==0)
|
||||
{
|
||||
$("<option/>").text(torrent.downloadDir).val(torrent.downloadDir).attr("selected",true).appendTo(thisDialog.find("#download-dir"));
|
||||
}
|
||||
thisDialog.find("#download-dir").combobox();
|
||||
|
||||
|
||||
// 确认
|
||||
thisDialog.find("#torrent-button-ok").click(function()
|
||||
{
|
||||
var dir = thisDialog.find("#download-dir").combobox("getValue");
|
||||
var olddir = torrent.downloadDir;
|
||||
var isnewdir =olddir!=dir;
|
||||
var movedata = thisDialog.find("#move-data").prop("checked");
|
||||
var button = $(this);
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
|
||||
recheck = thisDialog.find("#recheck-data").prop("checked");
|
||||
|
||||
// 新目录
|
||||
if (isnewdir)
|
||||
{
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
|
||||
if (issimple)
|
||||
{
|
||||
// 开始设置参数
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-set-location"
|
||||
,arguments:{
|
||||
ids:torrent.id
|
||||
,location:dir
|
||||
,move:movedata
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
if (data.result=="success")
|
||||
{
|
||||
system.getTorrentInfos(torrent.id);
|
||||
torrent.downloadDir = dir;
|
||||
if (recheck)
|
||||
{
|
||||
transmission.exec({
|
||||
method:"torrent-verify"
|
||||
,arguments:{
|
||||
ids:torrent.id
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
system.reloadTorrentBaseInfos();
|
||||
}
|
||||
);
|
||||
}
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
else
|
||||
{
|
||||
$.messager.alert("",system.lang.error["data-post-error"]+": "+data.result,'error');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
doSetFolder(ids,ids.length,button,icon,dir,movedata);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
thisDialog.find("#text-nochange").fadeInAndOut();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function doSetFolder(ids,count,button,icon,dir,movedata)
|
||||
{
|
||||
//var id = ids;
|
||||
var index = count-ids.length;
|
||||
var id = ids.shift();
|
||||
if (!id)
|
||||
{
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
|
||||
if (recheck)
|
||||
{
|
||||
transmission.exec({
|
||||
method:"torrent-verify"
|
||||
,arguments:{
|
||||
ids:allIds
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
system.reloadTorrentBaseInfos();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
thisDialog.dialog("close");
|
||||
return;
|
||||
}
|
||||
allIds.push(id);
|
||||
var torrent = transmission.torrents.all[id];
|
||||
|
||||
thisDialog.find("#text-count").text("-> "+torrent.name + " [" + (index+1)+"/"+count + "] ");
|
||||
|
||||
if (torrent.downloadDir==dir)
|
||||
{
|
||||
doSetFolder(ids,count,button,icon,dir,movedata);
|
||||
return;
|
||||
}
|
||||
// 开始设置参数
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-set-location"
|
||||
,arguments:{
|
||||
ids:id
|
||||
,location:dir
|
||||
,move:movedata
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
doSetFolder(ids,count,button,icon,dir,movedata);
|
||||
torrent.downloadDir = dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
$.messager.alert("",system.lang.error["data-post-error"]+": "+data.result,'error');
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
thisDialog.find("#torrent-button-cancel").click(function()
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
})($("#dialog-torrent-changeDownloadDir"));
|
||||
</script>
|
||||
@@ -0,0 +1,54 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:10px 6px 0px 10px;border:0px;">
|
||||
<div class="messager-icon messager-question"></div>
|
||||
<div id="torrent-remove-confirm-confirm-text" style="width:100%;padding:0px;">
|
||||
</div>
|
||||
<hr/>
|
||||
<input id="remove-data" type="checkbox" style="width:16px;"/><label id="torrent-remove-confirm-remove-data" for="remove-data"></label>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<a id="torrent-remove-confirm-button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<a id="torrent-remove-confirm-button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
var title = "confirm-text,remove-data".split(",");
|
||||
$.each(title, function(i, item){
|
||||
thisDialog.find("#torrent-remove-confirm-"+item).html(system.lang.dialog["torrent-remove"][item]);
|
||||
});
|
||||
|
||||
thisDialog.find("#torrent-remove-ids").val(thisDialog.data);
|
||||
thisDialog.find("#torrent-remove-confirm-button-ok").html(system.lang.dialog.public["button-ok"])
|
||||
.click(function()
|
||||
{
|
||||
if (!thisDialog.data("ids"))
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
return;
|
||||
}
|
||||
var button = $(this);
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
transmission.removeTorrent(thisDialog.data("ids"),thisDialog.find("#remove-data")[0].checked,function(status){
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
if (status=="success")
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
system.reloadTorrentBaseInfos();
|
||||
system.control.torrentlist.datagrid("uncheckAll");
|
||||
}
|
||||
else
|
||||
{
|
||||
$.messager.alert("",system.lang.dialog["torrent-remove"]["remove-error"],'error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
thisDialog.find("#torrent-remove-confirm-button-cancel").html(system.lang.dialog.public["button-cancel"])
|
||||
.click(function()
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
})($("#dialog-torrent-remove-confirm"));
|
||||
</script>
|
||||
@@ -0,0 +1,86 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;">
|
||||
<div id="" class="dialog" style="width:100%;">
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td width="20%" class="title"><span system-lang="dialog['torrent-rename']['oldname']"></span></td>
|
||||
<td width="80%">
|
||||
<span id="oldname" ></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span system-lang="dialog['torrent-rename']['newname']"></span></td>
|
||||
<td>
|
||||
<textarea id="newname" style="width:98%;height:50px;"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><hr/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="text-infos" style="display:none;" system-lang="['public']['text-nochange']"></span>
|
||||
<a id="button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);" system-lang="dialog['public']['button-ok']"></a>
|
||||
<a id="button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);" system-lang="dialog['public']['button-cancel']"></a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog){
|
||||
system.resetLangText(thisDialog);
|
||||
|
||||
var torrent = transmission.torrents.all[thisDialog.data("id")];
|
||||
|
||||
thisDialog.find("#oldname").text(torrent.name);
|
||||
thisDialog.find("#newname").val(torrent.name);
|
||||
|
||||
// 确认
|
||||
thisDialog.find("#button-ok").click(function()
|
||||
{
|
||||
var oldValue = thisDialog.find("#oldname").text();
|
||||
var newValue = thisDialog.find("#newname").val();
|
||||
var button = $(this);
|
||||
|
||||
// 如果有指定參數時,開始替換
|
||||
if (oldValue&&newValue&&(oldValue!=newValue))
|
||||
{
|
||||
if (confirm(system.lang["public"]["text-confirm"])==false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
// 开始设置参数
|
||||
transmission.renameTorrent(
|
||||
torrent.id
|
||||
,""
|
||||
,newValue
|
||||
,function(data){
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
if (data.result!="success")
|
||||
{
|
||||
thisDialog.find("#text-infos").html(system.lang["error"]["rename-error"]).fadeInAndOut();
|
||||
return;
|
||||
}
|
||||
|
||||
system.reloadTorrentBaseInfos(data.arguments.id, ["name"]);
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
thisDialog.find("#text-infos").fadeInAndOut();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
thisDialog.find("#button-cancel").click(function()
|
||||
{
|
||||
thisDialog.dialog("close");
|
||||
});
|
||||
|
||||
})($("#dialog-torrent-rename"));
|
||||
</script>
|
||||
@@ -0,0 +1,123 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;">
|
||||
<div data-options="region:'center'" style="padding:3px;border:0px;overflow: hidden;">
|
||||
<div id="" class="dialog" style="width:100%;padding:0px;height:100%;border-bottom: 1px dotted #ccc;">
|
||||
<div style="position: absolute;width:50%;height: 100%;">
|
||||
<div system-lang="dialog['torrent-setLabels']['available']"></div>
|
||||
<div id="divAvailableList" style="padding-top: 5px;"></div>
|
||||
</div>
|
||||
<div style="position: absolute;left:50%;width:50%;height: 100%;border-left: 1px dotted #ccc;padding-left: 5px;">
|
||||
<div system-lang="dialog['torrent-setLabels']['selected']"></div>
|
||||
<div id="divSelectedList" style="padding-top: 5px;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div data-options="region:'south',border:false" style="text-align:right;padding:6px;">
|
||||
<span id="text-nochange" style="display:none;"></span>
|
||||
<span id="text-count"></span>
|
||||
<a id="button-ok" class="easyui-linkbutton" data-options="iconCls:'icon-ok',plain:true" href="javascript:void(0);" system-lang="dialog['public']['button-ok']">Ok</a>
|
||||
<a id="button-cancel" class="easyui-linkbutton" data-options="iconCls:'icon-cancel',plain:true" href="javascript:void(0);" system-lang="dialog['public']['button-cancel']">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisDialog) {
|
||||
var page = {
|
||||
hashs: thisDialog.data("hashs")||[],
|
||||
divSelectedList: $("#divSelectedList", thisDialog),
|
||||
init: function() {
|
||||
system.resetLangText(thisDialog);
|
||||
this.initEvents();
|
||||
this.initLabels();
|
||||
},
|
||||
// 初始化事件
|
||||
initEvents: function() {
|
||||
// Cancel
|
||||
thisDialog.find("#button-cancel").click(function () {
|
||||
page.close();
|
||||
});
|
||||
|
||||
$("#button-ok", thisDialog).click(function(){
|
||||
page.save();
|
||||
page.close();
|
||||
});
|
||||
},
|
||||
// 初始化标签列表
|
||||
initLabels: function() {
|
||||
var box = $("#divAvailableList", thisDialog);
|
||||
for (var index = 0; index < system.config.labels.length; index++) {
|
||||
var item = system.config.labels[index];
|
||||
if (item) {
|
||||
item.index = index;
|
||||
var label = this.createLabel(item);
|
||||
label.on("click", function(){
|
||||
page.setLabel("#divAvailableList", "#divSelectedList", $(this).data("label"));
|
||||
$(this).remove();
|
||||
}).appendTo(box);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.hashs.length==1) {
|
||||
var labels = system.config.labelMaps[this.hashs[0]];
|
||||
if (labels) {
|
||||
for (var i = 0; i < labels.length; i++) {
|
||||
var index = labels[i];
|
||||
var item = system.config.labels[index];
|
||||
if (item) {
|
||||
this.setLabel("#divAvailableList", "#divSelectedList", item);
|
||||
$(".label-index-"+index, box).remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
createLabel: function(label) {
|
||||
return $("<a href='javascript:void(0);' class='user-label-big label-index-"+label.index+"'/>").data("label", label).html(label.name).css({
|
||||
"background-color": label.color,
|
||||
"color": (getGrayLevel(label.color) > 0.5 ? "#000" : "#fff")
|
||||
});
|
||||
},
|
||||
setLabel: function(from, to, item) {
|
||||
var box = $(to, thisDialog);
|
||||
var label = this.createLabel(item);
|
||||
label.on("click", function(){
|
||||
page.setLabel(to, from, $(this).data("label"));
|
||||
$(this).remove();
|
||||
}).appendTo(box);
|
||||
},
|
||||
save: function() {
|
||||
var items = $(".user-label-big", this.divSelectedList);
|
||||
var labels = [];
|
||||
|
||||
for (var index = 0; index < items.length; index++) {
|
||||
var item = $(items[index]);
|
||||
var label = item.data("label");
|
||||
labels.push(label.index);
|
||||
}
|
||||
|
||||
for (var index = 0; index < this.hashs.length; index++) {
|
||||
var item = this.hashs[index];
|
||||
if (labels.length==0) {
|
||||
delete system.config.labelMaps[item];
|
||||
} else {
|
||||
system.config.labelMaps[item] = labels;
|
||||
}
|
||||
}
|
||||
|
||||
system.saveConfig();
|
||||
|
||||
setTimeout(function(){
|
||||
system.control.torrentlist.refresh();
|
||||
}, 200);
|
||||
},
|
||||
close: function() {
|
||||
var source = thisDialog.data("popoverSource");
|
||||
|
||||
if (source) {
|
||||
$(source).webuiPopover("hide");
|
||||
} else {
|
||||
thisDialog.dialog("close");
|
||||
}
|
||||
}
|
||||
};
|
||||
page.init();
|
||||
})($("#dialog-torrent-setLabels"));
|
||||
</script>
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"config":{
|
||||
"autoRowHeight":"false"
|
||||
,"rownumbers":"true"
|
||||
,"pagination":"true"
|
||||
,"striped":"true"
|
||||
}
|
||||
,"fields":[
|
||||
{"field":"ck","checkbox":"true"}
|
||||
,{"field":"name","width":"300","sortable":"true"}
|
||||
,{"field":"length","width":"80","align":"right","sortable":"true","formatter":"size"}
|
||||
,{"field":"percentDone","width":"70","align":"center","sortable":"true"}
|
||||
,{"field":"bytesCompleted","width":"80","align":"right","sortable":"true","formatter":"size"}
|
||||
,{"field":"wanted","width":"60","align":"center","sortable":"true"}
|
||||
,{"field":"priority","width":"60","align":"left"}
|
||||
,{"field":"index","width":"130","hidden":"true"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"config":{
|
||||
"autoRowHeight":"false"
|
||||
,"rownumbers":"true"
|
||||
,"pagination":"true"
|
||||
,"striped":"true"
|
||||
,"singleSelect":"true"
|
||||
}
|
||||
,"fields":[
|
||||
{"field":"announce","width":"300"}
|
||||
,{"field":"announceState","width":"50"}
|
||||
,{"field":"lastAnnounceResult","width":"180"}
|
||||
,{"field":"downloadCount","width":"70","align":"left"}
|
||||
,{"field":"lastAnnounceSucceeded","width":"60","align":"center"}
|
||||
,{"field":"lastAnnounceTime","width":"120","align":"center"}
|
||||
,{"field":"lastAnnounceTimedOut","width":"60","align":"center"}
|
||||
,{"field":"nextAnnounceTime","width":"120","align":"center"}
|
||||
,{"field":"id","width":"50","hidden":"true"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"config":{
|
||||
"autoRowHeight":"false"
|
||||
,"rownumbers":"true"
|
||||
,"pagination":"true"
|
||||
,"striped":"true"
|
||||
}
|
||||
,"fields":[
|
||||
{"field":"address","width":"260"}
|
||||
,{"field":"clientName","width":"120"}
|
||||
,{"field":"flagStr","width":"60"}
|
||||
,{"field":"progress","width":"70","align":"center"}
|
||||
,{"field":"rateToClient","width":"80","align":"right","formatter":"speed"}
|
||||
,{"field":"rateToPeer","width":"80","align":"right","formatter":"speed"}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,655 @@
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;height:100%;" id="torrent-attribute-layout">
|
||||
<div data-options="region:'center'" style="padding:0px;border:0px;">
|
||||
<div id="torrent-attribute-tabs" class="easyui-tabs" style="width:100%;height:100%;" data-options="fit:true,plain:true,tabPosition:'left',border:0,headerWidth:105">
|
||||
<div title="常规" style="padding:2px;" class="dialog">
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-name"></span></td>
|
||||
<td colspan="3"><span id="torrent-attribute-value-name"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-downloadDir"></span></td>
|
||||
<td colspan="3">
|
||||
<span id="torrent-attribute-value-downloadDir"></span>
|
||||
<a id="torrent-attribute-config-button-changeDownloadDir" class="easyui-linkbutton" data-options="iconCls:'iconfont tr-icon-folder-change',plain:true" href="javascript:void(0);" system-tip-lang="toolbar.tip['change-download-dir']"></a>
|
||||
<a id="torrent-attribute-config-button-copyPath" class="easyui-linkbutton" data-options="iconCls:'iconfont tr-icon-clippy',plain:true" href="javascript:void(0);" data-clipboard-action="copy" data-clipboard-target="#torrent-attribute-value-downloadDir" system-tip-lang="toolbar.tip['copy-path-to-clipboard']"></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-status"></span></td>
|
||||
<td><span id="torrent-attribute-value-status"></span></td>
|
||||
<td class="title"><span id="torrent-attribute-label-hashString"></span></td>
|
||||
<td><span id="torrent-attribute-value-hashString"></span></td>
|
||||
</tr>
|
||||
<tr id="torrent-attribute-tr-error" style="display:none;">
|
||||
<td class="title" style="color:red;"><span id="torrent-attribute-label-errorString"></span></td>
|
||||
<td colspan="3" style="color:red;"><span id="torrent-attribute-value-errorString"></span> (<span id="torrent-attribute-value-error"></span>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="12%" class="title"><span id="torrent-attribute-label-totalSize"></span></td>
|
||||
<td width="38%"><span id="torrent-attribute-value-totalSize"></span></td>
|
||||
<td width="12%" class="title"><span id="torrent-attribute-label-addedDate"></span></td>
|
||||
<td width="38%"><span id="torrent-attribute-value-addedDate"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-leftUntilDone"></span></td>
|
||||
<td><span id="torrent-attribute-value-leftUntilDone"></span> (<span id="torrent-attribute-value-remainingTime"></span>)</td>
|
||||
<td class="title"><span id="torrent-attribute-label-completeSize"></span></td>
|
||||
<td><span id="torrent-attribute-value-completeSize"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-rateDownload"></span></td>
|
||||
<td><span id="torrent-attribute-value-rateDownload"></span></td>
|
||||
<td class="title"><span id="torrent-attribute-label-rateUpload"></span></td>
|
||||
<td><span id="torrent-attribute-value-rateUpload"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-leecherCount"></span></td>
|
||||
<td><span id="torrent-attribute-value-leecherCount"></span></td>
|
||||
<td class="title"><span id="torrent-attribute-label-seederCount"></span></td>
|
||||
<td><span id="torrent-attribute-value-seederCount"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-uploadedEver"></span></td>
|
||||
<td><span id="torrent-attribute-value-uploadedEver"></span></td>
|
||||
<td class="title"><span id="torrent-attribute-label-uploadRatio"></span></td>
|
||||
<td><span id="torrent-attribute-value-uploadRatio"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-creator"></span></td>
|
||||
<td><span id="torrent-attribute-value-creator"></span></td>
|
||||
<td class="title"><span id="torrent-attribute-label-dateCreated"></span></td>
|
||||
<td><span id="torrent-attribute-value-dateCreated"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title"><span id="torrent-attribute-label-comment"></span></td>
|
||||
<td colspan="3"><span id="torrent-attribute-value-comment"></span></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div title="服务器" style="padding:0px;" id="torrent-attribute-servers">
|
||||
|
||||
</div>
|
||||
<div title="文件" style="padding:0px;" id="torrent-attribute-files">
|
||||
|
||||
</div>
|
||||
<div title="用户" style="padding:0px;" id="torrent-attribute-peers">
|
||||
|
||||
</div>
|
||||
<div title="设置" style="padding:0px;" id="torrent-attribute-config" class="dialog">
|
||||
<div class="easyui-layout" data-options="fit:true" style="width:100%;">
|
||||
<div data-options="region:'center'" style="padding:2px;border:0px;">
|
||||
<table style="width:100%;">
|
||||
<tr>
|
||||
<td width="30%" class="title">
|
||||
<input id="downloadLimited" type="checkbox" style="width:16px;"/><label id="torrent-attribute-label-downloadLimited" for="downloadLimited"></label>
|
||||
</td>
|
||||
<td width="20%"><input id="downloadLimit" type="text" class="easyui-numberspinner" enabledof="downloadLimited"/> KB/s</td>
|
||||
<td width="30%" class="title">
|
||||
<input id="seedRatioMode" type="checkbox" style="width:16px;"/><label id="torrent-attribute-label-seedRatioMode" for="seedRatioMode"></label>
|
||||
</td>
|
||||
<td width="20%"><input id="seedRatioLimit" type="text" class="easyui-numberspinner" enabledof="seedRatioMode"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">
|
||||
<input id="uploadLimited" type="checkbox" style="width:16px;"/><label id="torrent-attribute-label-uploadLimited" for="uploadLimited"></label>
|
||||
</td>
|
||||
<td><input id="uploadLimit" type="text" class="easyui-numberspinner" enabledof="uploadLimited"/> KB/s</td>
|
||||
<td class="title">
|
||||
<input id="seedIdleMode" type="checkbox" style="width:16px;"/><label id="torrent-attribute-label-seedIdleMode" for="seedIdleMode"></label>
|
||||
</td>
|
||||
<td><input id="seedIdleLimit" type="text" class="easyui-numberspinner" enabledof="seedIdleMode"/> <span name="system-config-minutes"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">
|
||||
<span id="torrent-attribute-label-peer-limit"></span>
|
||||
</td>
|
||||
<td>
|
||||
<input id="peer-limit" value="" type="text" class="easyui-numberspinner"/>
|
||||
</td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div data-options="region:'south'" style="padding:2px;height:32px;">
|
||||
<a id="torrent-attribute-config-button-save" class="easyui-linkbutton" data-options="iconCls:'icon-save',plain:true" href="javascript:void(0);">Ok</a>
|
||||
<span id="torrent-attribute-config-nochange" style="display:none;"></span>
|
||||
<span id="torrent-attribute-config-saved" style="display:none;"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(thisLayout){
|
||||
var labels = system.lang.torrent.attribute.label;
|
||||
system.resetLangText(thisLayout);
|
||||
var clipboard = new ClipboardJS('#torrent-attribute-config-button-copyPath');
|
||||
|
||||
$.each(labels, function(key, item){
|
||||
thisLayout.find("#torrent-attribute-label-"+key).html(item);
|
||||
});
|
||||
|
||||
thisLayout.find("#torrent-attribute-config-button-save").html(system.lang.dialog["public"]["button-save"]);
|
||||
thisLayout.find("#torrent-attribute-config-nochange").html(system.lang["public"]["text-nochange"]);
|
||||
thisLayout.find("#torrent-attribute-config-saved").html(system.lang["public"]["text-saved"]);
|
||||
|
||||
thisLayout.find(".title").css({
|
||||
// background:"#e6e6e6"
|
||||
"border-bottom": "1px solid #ccc"
|
||||
});
|
||||
|
||||
var tabs = thisLayout.find("#torrent-attribute-tabs");
|
||||
tabs.tabs();
|
||||
|
||||
tabs.tabs("update",{
|
||||
tab:tabs.tabs("getTab",0)
|
||||
,options:{
|
||||
title:system.lang.torrent["attribute"]["tabs"].base
|
||||
}
|
||||
});
|
||||
tabs.tabs("update",{
|
||||
tab:tabs.tabs("getTab",1)
|
||||
,options:{
|
||||
title:system.lang.torrent["attribute"]["tabs"].servers
|
||||
}
|
||||
});
|
||||
tabs.tabs("update",{
|
||||
tab:tabs.tabs("getTab",2)
|
||||
,options:{
|
||||
title:system.lang.torrent["attribute"]["tabs"].files
|
||||
}
|
||||
});
|
||||
tabs.tabs("update",{
|
||||
tab:tabs.tabs("getTab",3)
|
||||
,options:{
|
||||
title:system.lang.torrent["attribute"]["tabs"].users
|
||||
}
|
||||
});
|
||||
tabs.tabs("update",{
|
||||
tab:tabs.tabs("getTab",4)
|
||||
,options:{
|
||||
title:system.lang.torrent["attribute"]["tabs"]["config"]
|
||||
}
|
||||
});
|
||||
tabs.tabs({
|
||||
onSelect:function(title,index){
|
||||
thisLayout.find("#torrent-attribute-tabs").data("selectedIndex",index);
|
||||
switch (index)
|
||||
{
|
||||
// 设置
|
||||
case 4:
|
||||
if (system.currentTorrentId==0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
system.fillTorrentConfig(transmission.torrents.all[system.currentTorrentId]);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var title = ("downloadLimited,seedIdleMode,seedRatioMode,uploadLimited").split(",");
|
||||
$.each(title, function(i, item){
|
||||
thisLayout.find("#"+item)
|
||||
.click(function(){
|
||||
var checked = this.checked;
|
||||
var indeterminate = false;
|
||||
var tag = $(this).data("_tag");
|
||||
// 用作3态
|
||||
switch (tag)
|
||||
{
|
||||
case 0:
|
||||
tag = 1;
|
||||
checked = true;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
tag = 2;
|
||||
checked = false;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tag = 0;
|
||||
indeterminate = true;
|
||||
checked = false;
|
||||
break;
|
||||
}
|
||||
$(this).prop("checked",checked).prop("indeterminate",indeterminate).data("_tag",tag);
|
||||
thisLayout.find("input[enabledof='"+this.id+"']").prop("disabled",!checked);
|
||||
});
|
||||
});
|
||||
|
||||
// 初始化文件显示列表
|
||||
var filelist = $("<table/>").attr("class","torrent-list").attr("id","torrent-files-table").appendTo(thisLayout.find("#torrent-attribute-files"));
|
||||
$.get(system.rootPath+"template/torrent-attribute-files-fields.json?time="+(new Date()),function(data){
|
||||
var fields = data.fields;
|
||||
var config = data.config;
|
||||
|
||||
for (var key in fields)
|
||||
{
|
||||
fields[key].title = system.lang.torrent.attribute["files-fields"][fields[key].field];
|
||||
system.setFieldFormat(fields[key]);
|
||||
}
|
||||
|
||||
config.pageSize = system.config.pageSize;
|
||||
config.columns = [fields];
|
||||
config.fit = true;
|
||||
filelist.datagrid(config);
|
||||
var pager = filelist.datagrid("getPager");
|
||||
var buttons = [{
|
||||
id:"pager-button-allow",
|
||||
iconCls:'icon-allow',
|
||||
title: system.lang.torrent.attribute["tip"]["button-allow"],
|
||||
handler:function(){
|
||||
changeSelectedFilesWanted(true,$(this));
|
||||
}
|
||||
},'-',{
|
||||
id:"pager-button-deny",
|
||||
iconCls:'icon-deny',
|
||||
title: system.lang.torrent.attribute["tip"]["button-deny"],
|
||||
handler:function(){
|
||||
changeSelectedFilesWanted(false,$(this));
|
||||
}
|
||||
},'-',{
|
||||
id:"pager-button-priority",
|
||||
iconCls:'icon-flag-edit',
|
||||
title: system.lang.torrent.attribute["tip"]["button-priority"],
|
||||
handler:function(){
|
||||
priorityMenu.menu("show",$(this).offset());
|
||||
}
|
||||
}];
|
||||
var priorityMenu = $("<div/>").attr("id","priorityMenu").appendTo(thisLayout.find("#torrent-attribute-files"));
|
||||
priorityMenu.menu({
|
||||
onClick:function(item)
|
||||
{
|
||||
changeSelectedFilesPriority(item.id);
|
||||
}
|
||||
});
|
||||
priorityMenu.menu("appendItem",{
|
||||
id: "0",
|
||||
text: system.lang.torrent.attribute["priority"]["0"],
|
||||
iconCls: 'iconlabel icon-flag-0'
|
||||
});
|
||||
priorityMenu.menu("appendItem",{
|
||||
id: "1",
|
||||
text: system.lang.torrent.attribute["priority"]["1"],
|
||||
iconCls: 'iconlabel icon-flag-1'
|
||||
});
|
||||
priorityMenu.menu("appendItem",{
|
||||
id: "-1",
|
||||
text: system.lang.torrent.attribute["priority"]["-1"],
|
||||
iconCls: 'iconlabel icon-flag--1'
|
||||
});
|
||||
|
||||
filelist.data("buttons",buttons);
|
||||
//system.debug("pager",pager);
|
||||
pager.pagination({
|
||||
buttons:buttons
|
||||
});
|
||||
|
||||
// pager.find("#pager-button-allow").attr({"title":system.lang.torrent.attribute["tip"]["button-allow"],"alt":system.lang.torrent.attribute["tip"]["button-allow"]});
|
||||
// pager.find("#pager-button-deny").attr({"title":system.lang.torrent.attribute["tip"]["button-deny"],"alt":system.lang.torrent.attribute["tip"]["button-deny"]});
|
||||
// pager.find("#pager-button-priority").attr({"title":system.lang.torrent.attribute["tip"]["button-priority"],"alt":system.lang.torrent.attribute["tip"]["button-priority"]});
|
||||
},"json");
|
||||
|
||||
// 设置已选中的文件是否下载
|
||||
function changeSelectedFilesWanted(wanted,button)
|
||||
{
|
||||
var rows = filelist.datagrid("getChecked");
|
||||
var files = new Array();
|
||||
var arguments = null;
|
||||
|
||||
for (var i in rows)
|
||||
{
|
||||
files.push(parseInt(rows[i].index));
|
||||
}
|
||||
if (files.length>0)
|
||||
{
|
||||
if (wanted)
|
||||
{
|
||||
arguments = {
|
||||
ids:system.currentTorrentId
|
||||
,"files-wanted":files
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
arguments = {
|
||||
ids:system.currentTorrentId
|
||||
,"files-unwanted":files
|
||||
};
|
||||
}
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
transmission.exec({
|
||||
method:"torrent-set"
|
||||
,arguments:arguments
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
system.getTorrentInfos(system.currentTorrentId);
|
||||
}
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置已选中的文件优先级别
|
||||
function changeSelectedFilesPriority(priority)
|
||||
{
|
||||
var rows = filelist.datagrid("getChecked");
|
||||
var files = new Array();
|
||||
var arguments = null;
|
||||
|
||||
for (var i in rows)
|
||||
{
|
||||
files.push(parseInt(rows[i].index));
|
||||
}
|
||||
if (files.length>0)
|
||||
{
|
||||
switch (priority)
|
||||
{
|
||||
case "0":
|
||||
arguments = {
|
||||
ids:system.currentTorrentId
|
||||
,"priority-normal":files
|
||||
};
|
||||
break;
|
||||
case "1":
|
||||
arguments = {
|
||||
ids:system.currentTorrentId
|
||||
,"priority-high":files
|
||||
};
|
||||
break;
|
||||
case "-1":
|
||||
arguments = {
|
||||
ids:system.currentTorrentId
|
||||
,"priority-low":files
|
||||
};
|
||||
break;
|
||||
}
|
||||
transmission.exec({
|
||||
method:"torrent-set"
|
||||
,arguments:arguments
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
system.getTorrentInfos(system.currentTorrentId);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 服务器列表
|
||||
var serverlist = $("<table/>").attr("class","torrent-list").attr("id","torrent-servers-table").appendTo(thisLayout.find("#torrent-attribute-servers"));
|
||||
$.get(system.rootPath+"template/torrent-attribute-servers-fields.json?time="+(new Date()),function(data){
|
||||
var fields = data.fields;
|
||||
var config = data.config;
|
||||
|
||||
for (var key in fields)
|
||||
{
|
||||
var title = system.lang.torrent.attribute["servers-fields"][fields[key].field];
|
||||
if (!title)
|
||||
title = fields[key].field;
|
||||
fields[key].title = title;
|
||||
system.setFieldFormat(fields[key]);
|
||||
}
|
||||
config.pageSize = system.config.pageSize;
|
||||
config.columns = [fields];
|
||||
config.fit = true;
|
||||
serverlist.datagrid(config);
|
||||
|
||||
var pager = serverlist.datagrid("getPager");
|
||||
var buttons = [{
|
||||
id:"pager-button-trackerAdd",
|
||||
iconCls:'icon-tracker-add',
|
||||
title: system.lang.torrent.attribute["tip"]["button-tracker-add"],
|
||||
handler:function(){
|
||||
addTracker();
|
||||
}
|
||||
},'-',{
|
||||
id:"pager-button-trackerReplace",
|
||||
iconCls:'icon-tracker-edit',
|
||||
title: system.lang.torrent.attribute["tip"]["button-tracker-edit"],
|
||||
handler:function(){
|
||||
changeSelectedTracker($(this));
|
||||
}
|
||||
},'-',{
|
||||
id:"pager-button-trackerRemove",
|
||||
iconCls:'icon-tracker-remove',
|
||||
title: system.lang.torrent.attribute["tip"]["button-tracker-remove"],
|
||||
handler:function(){
|
||||
var tracker = serverlist.datagrid("getSelected");
|
||||
if (tracker)
|
||||
{
|
||||
if (confirm(system.lang.torrent.attribute["other"]["tracker-remove-confim"])==false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var button = $(this);
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
transmission.exec({
|
||||
method:"torrent-set"
|
||||
,arguments:{
|
||||
ids:system.currentTorrentId
|
||||
,trackerRemove:[tracker.id]
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
system.getTorrentInfos(system.currentTorrentId);
|
||||
}
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
serverlist.data("buttons",buttons);
|
||||
//system.debug("pager",pager);
|
||||
pager.pagination({
|
||||
buttons:buttons
|
||||
});
|
||||
},"json");
|
||||
|
||||
// 替换已选中的服务器地址
|
||||
function changeSelectedTracker(button)
|
||||
{
|
||||
var tracker = serverlist.datagrid("getSelected");
|
||||
|
||||
if (tracker)
|
||||
{
|
||||
var URL = prompt("Tracker:",tracker.announce);
|
||||
if (URL!=""&&URL!=tracker.announce)
|
||||
{
|
||||
var icon = button.linkbutton("options").iconCls;
|
||||
button.linkbutton({disabled:true,iconCls:"icon-loading"});
|
||||
transmission.exec({
|
||||
method:"torrent-set"
|
||||
,arguments:{
|
||||
ids:system.currentTorrentId
|
||||
,trackerReplace:[tracker.id,URL]
|
||||
}
|
||||
}
|
||||
,function(data){
|
||||
if (data.result=="success")
|
||||
{
|
||||
system.getTorrentInfos(system.currentTorrentId);
|
||||
}
|
||||
button.linkbutton({iconCls:icon,disabled:false});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加Tracker
|
||||
*/
|
||||
function addTracker() {
|
||||
if (system.currentTorrentId==0) return;
|
||||
|
||||
var dialog = $("#dialog-torrent-attribute-add-tracker");
|
||||
if (dialog.length)
|
||||
{
|
||||
dialog.dialog("open");
|
||||
dialog.data("ids",system.currentTorrentId);
|
||||
dialog.dialog({content:system.templates["dialog-torrent-attribute-add-tracker.html"]});
|
||||
return;
|
||||
}
|
||||
|
||||
$("<div/>").attr("id","dialog-torrent-attribute-add-tracker").appendTo(document.body).dialog({
|
||||
title: system.lang.dialog["torrent-attribute-add-tracker"].title,
|
||||
width: 520,
|
||||
height: 240,
|
||||
resizable: false,
|
||||
cache: true,
|
||||
content:"loading...",
|
||||
modal: true
|
||||
});
|
||||
|
||||
$.get(system.rootPath+"template/dialog-torrent-attribute-add-tracker.html?time="+(new Date()),function(data){
|
||||
system.templates["dialog-torrent-attribute-add-tracker.html"] = data;
|
||||
$("#dialog-torrent-attribute-add-tracker").data("ids",system.currentTorrentId);
|
||||
$("#dialog-torrent-attribute-add-tracker").dialog({content:data});
|
||||
});
|
||||
}
|
||||
|
||||
// 用户列表
|
||||
var peerslist = $("<table/>").attr("class","torrent-list").attr("id","torrent-peers-table").appendTo(thisLayout.find("#torrent-attribute-peers"));
|
||||
$.get(system.rootPath+"template/torrent-attribute-users-fields.json?time="+(new Date()),function(data){
|
||||
var fields = data.fields;
|
||||
var config = data.config;
|
||||
|
||||
for (var key in fields)
|
||||
{
|
||||
var title = system.lang.torrent.attribute["peers-fields"][fields[key].field];
|
||||
if (!title)
|
||||
title = fields[key].field;
|
||||
fields[key].title = title;
|
||||
system.setFieldFormat(fields[key]);
|
||||
}
|
||||
config.pageSize = system.config.pageSize;
|
||||
config.columns = [fields];
|
||||
config.fit = true;
|
||||
peerslist.datagrid(config);
|
||||
},"json");
|
||||
|
||||
// 变更保存目录
|
||||
thisLayout.find("#torrent-attribute-config-button-changeDownloadDir").click(function(){
|
||||
if (system.currentTorrentId==0) return;
|
||||
|
||||
var dialog = $("#dialog-torrent-changeDownloadDir");
|
||||
if (dialog.length)
|
||||
{
|
||||
dialog.dialog("open");
|
||||
dialog.data("ids",system.currentTorrentId);
|
||||
dialog.dialog({content:system.templates["dialog-torrent-changeDownloadDir.html"]});
|
||||
return;
|
||||
}
|
||||
|
||||
$("<div/>").attr("id","dialog-torrent-changeDownloadDir").appendTo(document.body).dialog({
|
||||
title: system.lang.dialog["torrent-changeDownloadDir"].title,
|
||||
width: 600,
|
||||
height: 200,
|
||||
resizable: false,
|
||||
cache: true,
|
||||
content:"loading...",
|
||||
modal: true
|
||||
});
|
||||
|
||||
$.get(system.rootPath+"template/dialog-torrent-changeDownloadDir.html?time="+(new Date()),function(data){
|
||||
system.templates["dialog-torrent-changeDownloadDir.html"] = data;
|
||||
$("#dialog-torrent-changeDownloadDir").data("ids",system.currentTorrentId);
|
||||
$("#dialog-torrent-changeDownloadDir").dialog({content:data});
|
||||
});
|
||||
});
|
||||
|
||||
// 保存参数
|
||||
thisLayout.find("#torrent-attribute-config-button-save").click(function()
|
||||
{
|
||||
if (system.currentTorrentId==0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var torrent = transmission.torrents.all[system.currentTorrentId];
|
||||
var inputs = thisLayout.find("#torrent-attribute-config").find("input");
|
||||
var config = {};
|
||||
var value = null;
|
||||
for (var key in inputs)
|
||||
{
|
||||
var input = inputs[key];
|
||||
value = null;
|
||||
if (input.id!=undefined&&input.id!="")
|
||||
{
|
||||
switch (input.type)
|
||||
{
|
||||
case "checkbox":
|
||||
switch (input.id)
|
||||
{
|
||||
//
|
||||
case "seedIdleMode":
|
||||
case "seedRatioMode":
|
||||
value = $(input).data("_tag");
|
||||
break;
|
||||
default:
|
||||
value = input.checked;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
value = ($.isNumeric(input.value)?parseFloat(input.value):input.value);
|
||||
break;
|
||||
}
|
||||
|
||||
if (value!=torrent[input.id]&&value!=null)
|
||||
{
|
||||
config[input.id] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 如果参数有改变则保存
|
||||
if (!$.isEmptyObject(config))
|
||||
{
|
||||
jQuery.extend(torrent,config);
|
||||
config["ids"] = torrent.id;
|
||||
$(this).linkbutton({text:system.lang.dialog["system-config"].saving,disabled:true});
|
||||
// 开始设置参数
|
||||
transmission.exec(
|
||||
{
|
||||
method:"torrent-set"
|
||||
,arguments:config
|
||||
}
|
||||
,function(data){
|
||||
thisLayout.find("#torrent-attribute-config-button-save").linkbutton({text:system.lang.dialog["public"]["button-save"],disabled:false});
|
||||
if (data.result=="success")
|
||||
{
|
||||
thisLayout.find("#torrent-attribute-config-saved").fadeInAndOut();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
thisLayout.find("#torrent-attribute-config-nochange").fadeInAndOut();
|
||||
}
|
||||
|
||||
//console.log("config:",config);
|
||||
});
|
||||
})($("#torrent-attribute-layout"));
|
||||
</script>
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"fields":[
|
||||
{"field":"ck","checkbox":"true","allowCustom":"false"}
|
||||
,{"field":"name","width":"300","sortable":"true","formatter":"_usename_"}
|
||||
,{"field":"totalSize","width":"80","align":"right","sortable":"true","formatter":"size"}
|
||||
,{"field":"percentDone","width":"70","align":"center","sortable":"true","formatter":"progress"}
|
||||
,{"field":"remainingTime","width":"100","align":"right","sortable":true, "formatter": "remainingTime"}
|
||||
,{"field":"uploadRatio","width":"60","align":"right","sortable":"true","formatter":"ratio"}
|
||||
,{"field":"status","width":"60","align":"center","sortable":"true"}
|
||||
,{"field":"statusCode","hidden":"true","allowCustom":"false"}
|
||||
,{"field":"seederCount","width":"60","align":"left"}
|
||||
,{"field":"leecherCount","width":"60","align":"left"}
|
||||
,{"field":"rateDownload","width":"80","align":"right","sortable":"true","formatter":"speed"}
|
||||
,{"field":"rateUpload","width":"80","align":"right","sortable":"true","formatter":"speed"}
|
||||
,{"field":"completeSize","width":"80","align":"right","sortable":"true","formatter":"size"}
|
||||
,{"field":"uploadedEver","width":"80","align":"right","sortable":"true","formatter":"size"}
|
||||
,{"field":"addedDate","width":"130","align":"center","sortable":"true","formatter":"longtime"}
|
||||
,{"field":"id","width":"30","align":"center","sortable":"true"}
|
||||
,{"field":"queuePosition","width":"30","align":"center","sortable":true}
|
||||
,{"field":"trackers","width":"100","align":"left","sortable":true}
|
||||
,{"field":"downloadDir","width":200,"align":"left","sortable":true}
|
||||
,{"field":"activityDate","width":130,"align":"center","sortable":true,"formatter":"longtime"}
|
||||
,{"field":"labels","width":130,"align":"left", "formatter": "labels"}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user