forked from aaPanel/BaoTa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathftp.html
173 lines (169 loc) · 7.08 KB
/
ftp.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
{% extends "layout.html" %}
{% block content %}
<div class="main-content pb55">
<div class="container-fluid">
<div class="pos-box bgw mtb15">
<div class="position f14 c9 pull-left">
<a class="plr10 c4" href="/">{{data['lan']['H1']}}</a>/<span class="plr10 c4">{{data['lan']['H2']}}</span>
</div>
<div class="search pull-right">
<form target="hid" onsubmit='ftp.get_list(1,$("#SearchValue").prop("value"))'>
<input type="text" id="SearchValue" class="ser-text pull-left" placeholder="{{data['lan']['SEARCH']}}" />
<button type="button" class="ser-sub pull-left" onclick='ftp.get_list(1,$("#SearchValue").prop("value"))'></button>
</form>
<iframe name='hid' id="hid" style="display:none"></iframe>
</div>
</div>
<div class="safe bgw mtb15 pd15">
<div class="info-title-tips">
<p><span class="glyphicon glyphicon-alert" style="color: #f39c12; margin-right: 10px;"></span>{{data['lan']['PS']}} ftp://{{session['address']}}:{{session['port']}}</p>
</div>
<button onclick="ftp.add_user()" class="btn btn-success btn-sm" type="button">{{data['lan']['BTN1']}}</button>
<button onclick="ftp.set_port()" class="btn btn-default btn-sm" type="button" style="margin-left:5px">{{data['lan']['BTN2']}}</button>
<span style="float:right">
<button batch="true" style="float: right;display: none;margin-left:10px;" onclick="ftp.batch_ftp('del');" class="btn btn-default btn-sm">{{data['lan']['BTN3']}}</button>
</span>
<div class="divtable mtb10">
<div class="tablescroll">
<table id="ftpData" class="table table-hover" style="min-width: 900px;border: 0 none;">
</table>
</div>
<div class="dataTables_paginate paging_bootstrap page">
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script type="text/javascript">
var ftp = {
get_list:function(page,search){
if(page==undefined) page=1;
bt.ftp.get_list(page,search,function(rdata){
$('.dataTables_paginate').html(rdata.page);
var _tab = bt.render({
table:'#ftpData',
columns:[
{ field:'id',type:'checkbox',width:30},
{ field: 'name', title: '用户名',width:'20%'},
{ field: 'password',width:'15%', title: '密码',templet : function(item){
var _html = '<span class="password" data-pw="'+item.password+'">**********</span>';
_html += '<span onclick="bt.pub.show_hide_pass(this)" class="glyphicon glyphicon-eye-open cursor pw-ico" style="margin-left:10px"></span>';
_html += '<span class="ico-copy cursor btcopy" style="margin-left:10px" title="复制密码" data-pw="'+item.password+'" onclick="bt.pub.copy_pass(\''+item.password+'\')"></span>';
return _html;
}},
{ field: 'status', title: '状态',templet:function(item){
var _status = '<a href="javascript:;" title="FTP帐户" ';
if(item.status=='1'){
_status+=' onclick="ftp.stop_user('+item.id+',\''+item.name+'\') " >';
_status+='<span style="color:#5CB85C">已启用 </span><span style="color:#5CB85C" class="glyphicon glyphicon-play"></span>';
}
else{
_status+=' onclick="ftp.start_user('+item.id+',\''+item.name+'\')"';
_status+='<span style="color:red">已停用 </span><span style="color:red" class="glyphicon glyphicon-pause"></span>';
}
return _status;
},sort:function(){
ftp.get_list();
}},
{ field: 'path', title: '根目录',templet:function(item){
var _path = bt.format_path(item.path);
return '<a class="btlink" title="打开目录" href="javascript:openPath(\''+_path+'\');">'+_path+'</a>';
}},
{ field: 'ps', title: '备注',templet : function(item){
return "<span class='c9 input-edit' onclick=\"bt.pub.set_data_by_key('ftps','ps',this)\">"+item.ps+ "</span>";
}},
{ field: 'opt',width:130, title: '操作',align:'right',templet:function(item){
var option = "<a href=\"javascript:;\" class=\"btlink\" onclick=\"ftp.set_password("+item.id+",'"+item.name+"','"+item.password+"')\" title=\"修改FTP密码\">改密</a> | ";
option += "<a href=\"javascript:;\" class=\"btlink\" onclick=\"ftp.del("+item.id+",'"+item.name+"')\" title=\"删除FTP\">删除</a>";
return option;
}},
],
data:rdata.data
})
})
},
batch_ftp:function(type,arr,result){
if(arr == undefined){
arr = [];
result = {count:0,error_list:[]};
$('input[type="checkbox"].check:checked').each(function(){
var _val = $(this).val();
if(!isNaN(_val)) arr.push($(this).parents('tr').data('item'));
})
bt.show_confirm(lan.ftp.del_all,"<a style='color:red;'>"+lan.get('del_all_ftp',[arr.length])+"</a>",function(){
bt.closeAll();
ftp.batch_ftp(type,arr,result);
});
return;
}
var item = arr[0];
switch(type){
case 'del':
if(arr.length<1){
ftp.get_list();
bt.msg({msg:lan.get('del_all_ftp_ok',[result.count]),icon:1,time:5000});
return;
}
bt.ftp.del(item.id,item.name,function(rdata){
if(rdata.status){
result.count+=1;
}else{
result.error_list.push({name:item.item,err_msg:rdata.msg});
}
arr.splice(0,1)
ftp.batch_ftp(type,arr,result);
})
break;
}
},
del:function(id,ftp_username){
bt.show_confirm(lan.public.del+"["+ftp_username+"]",lan.get('confirm_del',[ftp_username]),function(){
bt.ftp.del(id,ftp_username,function(rdata){
if(rdata.status) ftp.get_list();
bt.msg(rdata);
})
})
},
add_user:function(){
bt.ftp.add(function(rdata){
if(rdata.status) ftp.get_list();
})
},
set_password:function(id,name,password){
var bs = bt.ftp.set_password(function(rdata){
if(rdata.status) ftp.get_list();
})
$('.id'+bs).val(id);
$('.ftp_username'+bs).val(name);
$('.new_password'+bs).val(password);
},
set_port:function(){
var bs = bt.ftp.set_port(function(rdata){
if(rdata.status) ftp.get_list();
})
$('.port'+bs).val('{{session["port"]}}');
},
stop_user:function(id,username){
bt.confirm({msg:lan.ftp.stop_confirm.replace('{1}',username),title:lan.ftp.stop_title},function(index){
bt.ftp.set_status(id,username,0,function(rdata){
if(rdata.status) ftp.get_list();
})
})
},
start_user:function(id,username){
bt.ftp.set_status(id,username,1,function(rdata){
if(rdata.status) ftp.get_list();
})
}
}
bt.set_cookie('sites_path',"{{session['config']['sites_path']}}");
{% if not data['isSetup'] %}
layer.msg('{{data["lan"]["JS1"]}}<a href="/soft" style="color:#20a53a; float: right;">{{data["lan"]["JS2"]}}</a>',{icon:7,time:0,shade: [0.3, '#000']});
$(".layui-layer-shade").css("margin-left", "180px");
{% else %}
ftp.get_list();
{% endif %}
</script>
{% endblock %}