pull/109/head
Mr Chen 7 years ago
parent c87ebc5e64
commit 9cdacaa3a9
  1. 20
      plugins/php/js/php.js
  2. 4
      route/dashboard.py
  3. 94
      static/app/files.js
  4. 50
      static/app/public.js
  5. 0
      static/app/upload.js
  6. 18
      templates/default/files.html

@ -614,3 +614,23 @@ function phpUploadLimit(version, max) {
var LimitCon = '<p class="conf_p"><input class="phpUploadLimit bt-input-text mr5" type="number" value="' + max + '" name="max">MB<button class="btn btn-success btn-sm" onclick="SetPHPMaxSize(\'' + version + '\')" style="margin-left:20px">' + lan.public.save + '</button></p>'; var LimitCon = '<p class="conf_p"><input class="phpUploadLimit bt-input-text mr5" type="number" value="' + max + '" name="max">MB<button class="btn btn-success btn-sm" onclick="SetPHPMaxSize(\'' + version + '\')" style="margin-left:20px">' + lan.public.save + '</button></p>';
$(".soft-man-con").html(LimitCon); $(".soft-man-con").html(LimitCon);
} }
function GetPHPStatus(a) {
if(a == "52") {
layer.msg(lan.bt.php_status_err, {
icon: 2
});
return
}
$.post("/ajax?action=GetPHPStatus", "version=" + a, function(b) {
layer.open({
type: 1,
area: "400",
title: lan.bt.php_status_title,
closeBtn: 2,
shift: 5,
shadeClose: true,
content: "<div style='margin:15px;'><table class='table table-hover table-bordered'> <tr><th>"+lan.bt.php_pool+"</th><td>" + b.pool + "</td></tr> <tr><th>"+lan.bt.php_manager+"</th><td>" + ((b["process manager"] == "dynamic") ? lan.bt.dynamic : lan.bt.static) + "</td></tr> <tr><th>"+lan.bt.php_start+"</th><td>" + b["start time"] + "</td></tr> <tr><th>"+lan.bt.php_accepted+"</th><td>" + b["accepted conn"] + "</td></tr> <tr><th>"+lan.bt.php_queue+"</th><td>" + b["listen queue"] + "</td></tr> <tr><th>"+lan.bt.php_max_queue+"</th><td>" + b["max listen queue"] + "</td></tr> <tr><th>"+lan.bt.php_len_queue+"</th><td>" + b["listen queue len"] + "</td></tr> <tr><th>"+lan.bt.php_idle+"</th><td>" + b["idle processes"] + "</td></tr> <tr><th>"+lan.bt.php_active+"</th><td>" + b["active processes"] + "</td></tr> <tr><th>"+lan.bt.php_total+"</th><td>" + b["total processes"] + "</td></tr> <tr><th>"+lan.bt.php_max_active+"</th><td>" + b["max active processes"] + "</td></tr> <tr><th>"+lan.bt.php_max_children+"</th><td>" + b["max children reached"] + "</td></tr> <tr><th>"+lan.bt.php_slow+"</th><td>" + b["slow requests"] + "</td></tr> </table></div>"
})
})
}

@ -28,8 +28,8 @@ def test():
@dashboard.route("/") @dashboard.route("/")
def index(): def index():
if session.has_key('code'): # if session.has_key('code'):
print session['code'] # print session['code']
return render_template('default/index.html') return render_template('default/index.html')

@ -1,5 +1,7 @@
console.log(lan);
//判断磁盘数量超出宽度 //判断磁盘数量超出宽度
function IsDiskWidth(){ function isDiskWidth(){
var comlistWidth = $("#comlist").width(); var comlistWidth = $("#comlist").width();
var bodyWidth = $(".file-box").width(); var bodyWidth = $(".file-box").width();
if(comlistWidth + 530 > bodyWidth){ if(comlistWidth + 530 > bodyWidth){
@ -11,7 +13,7 @@ function IsDiskWidth(){
} }
//打开回收站 //打开回收站
function Recycle_bin(type){ function recycle_bin(type){
$.post('/files?action=Get_Recycle_bin','',function(rdata){ $.post('/files?action=Get_Recycle_bin','',function(rdata){
var body = '' var body = ''
switch(type){ switch(type){
@ -249,7 +251,7 @@ function getFileName(name){
return text; return text;
} }
//判断图片文件 //判断图片文件
function ReisImage(fileName){ function reisImage(fileName){
var exts = ['jpg','jpeg','png','bmp','gif','tiff','ico']; var exts = ['jpg','jpeg','png','bmp','gif','tiff','ico'];
for(var i=0; i<exts.length; i++){ for(var i=0; i<exts.length; i++){
if(fileName == exts[i]) return true if(fileName == exts[i]) return true
@ -258,7 +260,7 @@ function ReisImage(fileName){
} }
//从回收站恢复文件 //从回收站恢复文件
function ReRecycleBin(path,obj){ function reRecycleBin(path,obj){
layer.confirm(lan.files.recycle_bin_re_msg,{title:lan.files.recycle_bin_re_title,closeBtn:2,icon:3},function(){ layer.confirm(lan.files.recycle_bin_re_msg,{title:lan.files.recycle_bin_re_title,closeBtn:2,icon:3},function(){
var loadT = layer.msg(lan.files.recycle_bin_re_the,{icon:16,time:0,shade: [0.3, '#000']}); var loadT = layer.msg(lan.files.recycle_bin_re_the,{icon:16,time:0,shade: [0.3, '#000']});
$.post('/files?action=Re_Recycle_bin','path='+encodeURIComponent(path),function(rdata){ $.post('/files?action=Re_Recycle_bin','path='+encodeURIComponent(path),function(rdata){
@ -270,7 +272,7 @@ function ReRecycleBin(path,obj){
} }
//从回收站删除 //从回收站删除
function DelRecycleBin(path,obj){ function delRecycleBin(path,obj){
layer.confirm(lan.files.recycle_bin_del_msg,{title:lan.files.recycle_bin_del_title,closeBtn:2,icon:3},function(){ layer.confirm(lan.files.recycle_bin_del_msg,{title:lan.files.recycle_bin_del_title,closeBtn:2,icon:3},function(){
var loadT = layer.msg(lan.files.recycle_bin_del_the,{icon:16,time:0,shade: [0.3, '#000']}); var loadT = layer.msg(lan.files.recycle_bin_del_the,{icon:16,time:0,shade: [0.3, '#000']});
$.post('/files?action=Del_Recycle_bin','path='+encodeURIComponent(path),function(rdata){ $.post('/files?action=Del_Recycle_bin','path='+encodeURIComponent(path),function(rdata){
@ -313,7 +315,7 @@ function Set_Recycle_bin(db){
//取数据 //取数据
function GetFiles(Path) { function getFiles(Path) {
var searchtype = Path; var searchtype = Path;
if(isNaN(Path)){ if(isNaN(Path)){
var p = '1'; var p = '1';
@ -334,7 +336,7 @@ function GetFiles(Path) {
var data = 'path=' + Path; var data = 'path=' + Path;
var loadT = layer.load(); var loadT = layer.load();
var totalSize = 0; var totalSize = 0;
$.post('/files/get_dir?tojs=GetFiles&p=' + p + '&showRow=' + showRow + search, data, function(rdata) { $.post('/files/get_dir?tojs=getFiles&p=' + p + '&showRow=' + showRow + search, data, function(rdata) {
layer.close(loadT); layer.close(loadT);
var rows = ['100','200','500','1000','2000']; var rows = ['100','200','500','1000','2000'];
@ -367,7 +369,7 @@ function GetFiles(Path) {
$("#set_icon").removeClass("active"); $("#set_icon").removeClass("active");
Body += "<tr class='folderBoxTr' data-path='" + rdata.PATH + "/" + fmp[0] + "' filetype='dir'>\ Body += "<tr class='folderBoxTr' data-path='" + rdata.PATH + "/" + fmp[0] + "' filetype='dir'>\
<td><input type='checkbox' name='id' value='"+fmp[0]+"'></td>\ <td><input type='checkbox' name='id' value='"+fmp[0]+"'></td>\
<td class='column-name'><span class='cursor' onclick=\"GetFiles('" + rdata.PATH + "/" + fmp[0] + "')\"><span class='ico ico-folder'></span><a class='text' title='" + fmp[0] + fmp[5] + "'>" + cnametext + "</a></span></td>\ <td class='column-name'><span class='cursor' onclick=\"getFiles('" + rdata.PATH + "/" + fmp[0] + "')\"><span class='ico ico-folder'></span><a class='text' title='" + fmp[0] + fmp[5] + "'>" + cnametext + "</a></span></td>\
<td>"+toSize(fmp[1])+"</td>\ <td>"+toSize(fmp[1])+"</td>\
<td>"+getLocalTime(fmp[2])+"</td>\ <td>"+getLocalTime(fmp[2])+"</td>\
<td>"+fmp[3]+"</td>\ <td>"+fmp[3]+"</td>\
@ -386,8 +388,8 @@ function GetFiles(Path) {
$("#set_list").removeClass("active"); $("#set_list").removeClass("active");
Body += "<div class='file folderBox menufolder' data-path='" + rdata.PATH + "/" + fmp[0] + "' filetype='dir' title='"+lan.files.file_name+":" + fmp[0]+"&#13;"+lan.files.file_size+":" + toSize(fmp[1])+"&#13;"+lan.files.file_etime+":"+getLocalTime(fmp[2])+"&#13;"+lan.files.file_auth+":"+fmp[3]+"&#13;"+lan.files.file_own+":"+fmp[4]+"'>\ Body += "<div class='file folderBox menufolder' data-path='" + rdata.PATH + "/" + fmp[0] + "' filetype='dir' title='"+lan.files.file_name+":" + fmp[0]+"&#13;"+lan.files.file_size+":" + toSize(fmp[1])+"&#13;"+lan.files.file_etime+":"+getLocalTime(fmp[2])+"&#13;"+lan.files.file_auth+":"+fmp[3]+"&#13;"+lan.files.file_own+":"+fmp[4]+"'>\
<input type='checkbox' name='id' value='"+fmp[0]+"'>\ <input type='checkbox' name='id' value='"+fmp[0]+"'>\
<div class='ico ico-folder' ondblclick=\"GetFiles('" + rdata.PATH + "/" + fmp[0] + "')\"></div>\ <div class='ico ico-folder' ondblclick=\"getFiles('" + rdata.PATH + "/" + fmp[0] + "')\"></div>\
<div class='titleBox' onclick=\"GetFiles('" + rdata.PATH + "/" + fmp[0] + "')\"><span class='tname'>" + fmp[0] + "</span></div>\ <div class='titleBox' onclick=\"getFiles('" + rdata.PATH + "/" + fmp[0] + "')\"><span class='tname'>" + fmp[0] + "</span></div>\
</div>"; </div>";
} }
} }
@ -411,12 +413,12 @@ function GetFiles(Path) {
bodyZip = "<a class='btlink' href='javascript:;' onclick=\"UnZip('" + rdata.PATH +"/" +fmp[0] + "'," + displayZip + ")\">"+lan.files.file_menu_unzip+"</a> | "; bodyZip = "<a class='btlink' href='javascript:;' onclick=\"UnZip('" + rdata.PATH +"/" +fmp[0] + "'," + displayZip + ")\">"+lan.files.file_menu_unzip+"</a> | ";
} }
if(isText(fmp[0])){ if(isText(fmp[0])){
bodyZip = "<a class='btlink' href='javascript:;' onclick=\"OnlineEditFile(0,'" + rdata.PATH +"/"+ fmp[0] + "')\">"+lan.files.file_menu_edit+"</a> | "; bodyZip = "<a class='btlink' href='javascript:;' onclick=\"onlineEditFile(0,'" + rdata.PATH +"/"+ fmp[0] + "')\">编辑</a> | ";
} }
if(isImage(fmp[0])){ if(isImage(fmp[0])){
download = "<a class='btlink' href='javascript:;' onclick=\"GetImage('" + rdata.PATH +"/"+ fmp[0] + "')\">"+lan.files.file_menu_img+"</a> | "; download = "<a class='btlink' href='javascript:;' onclick=\"getImage('" + rdata.PATH +"/"+ fmp[0] + "')\">预览</a> | ";
}else{ }else{
download = "<a class='btlink' href='javascript:;' onclick=\"GetFileBytes('" + rdata.PATH +"/"+ fmp[0] + "',"+fmp[1]+")\">"+lan.files.file_menu_down+"</a> | "; download = "<a class='btlink' href='javascript:;' onclick=\"getFileBytes('" + rdata.PATH +"/"+ fmp[0] + "',"+fmp[1]+")\">下载</a> | ";
} }
totalSize += parseInt(fmp[1]); totalSize += parseInt(fmp[1]);
@ -483,7 +485,7 @@ function GetFiles(Path) {
BarTools += ' <button onclick="javascript:BackDir();" class="btn btn-default btn-sm glyphicon glyphicon-arrow-left" title="'+lan.files.return+'"></button>'; BarTools += ' <button onclick="javascript:BackDir();" class="btn btn-default btn-sm glyphicon glyphicon-arrow-left" title="'+lan.files.return+'"></button>';
} }
setCookie('Path',rdata.PATH); setCookie('Path',rdata.PATH);
BarTools += ' <button onclick="javascript:GetFiles(\'' + rdata.PATH + '\');" class="btn btn-default btn-sm glyphicon glyphicon-refresh" title="'+lan.public.fresh+'"></button> <button onclick="ExecShell()" title="'+lan.files.shell+'" type="button" class="btn btn-default btn-sm"><em class="ico-cmd"></em></button>'; BarTools += ' <button onclick="javascript:getFiles(\'' + rdata.PATH + '\');" class="btn btn-default btn-sm glyphicon glyphicon-refresh" title="'+lan.public.fresh+'"></button> <button onclick="ExecShell()" title="'+lan.files.shell+'" type="button" class="btn btn-default btn-sm"><em class="ico-cmd"></em></button>';
var copyName = getCookie('copyFileName'); var copyName = getCookie('copyFileName');
var cutName = getCookie('cutFileName'); var cutName = getCookie('cutFileName');
var isPaste = (copyName == 'null') ? cutName : copyName; var isPaste = (copyName == 'null') ? cutName : copyName;
@ -565,7 +567,7 @@ function GetFiles(Path) {
//每页行数 //每页行数
$(".showRow").change(function(){ $(".showRow").change(function(){
setCookie('showRow',$(this).val()); setCookie('showRow',$(this).val());
GetFiles(p); getFiles(p);
}); });
PathPlaceBtn(rdata.PATH); PathPlaceBtn(rdata.PATH);
},'json'); },'json');
@ -709,7 +711,7 @@ function Batch(type,access){
setTimeout(function(){getSpeed('.myspeed');},1000); setTimeout(function(){getSpeed('.myspeed');},1000);
$.post('files?action=SetBatchData',data,function(rdata){ $.post('files?action=SetBatchData',data,function(rdata){
layer.close(myloadT); layer.close(myloadT);
GetFiles(path); getFiles(path);
layer.msg(rdata.msg,{icon:1}); layer.msg(rdata.msg,{icon:1});
}); });
} }
@ -745,7 +747,7 @@ function BatchPasteTo(data,path){
$.post('files?action=BatchPaste',data,function(rdata){ $.post('files?action=BatchPaste',data,function(rdata){
layer.close(myloadT); layer.close(myloadT);
setCookie('BatchSelected', null); setCookie('BatchSelected', null);
GetFiles(path); getFiles(path);
layer.msg(rdata.msg,{icon:1}); layer.msg(rdata.msg,{icon:1});
}); });
} }
@ -779,15 +781,15 @@ function GetFileName(fileNameFull) {
return pName[pName.length - 1]; return pName[pName.length - 1];
} }
//取磁盘 //取磁盘
function GetDisk() { function getDisk() {
var LBody = ''; var LBody = '';
$.get('/system/disk_info', function(rdata) { $.get('/system/disk_info', function(rdata) {
for (var i = 0; i < rdata.length; i++) { for (var i = 0; i < rdata.length; i++) {
LBody += "<span onclick=\"GetFiles('" + rdata[i].path + "')\"><span class='glyphicon glyphicon-hdd'></span>&nbsp;" + (rdata[i].path=='/'?lan.files.path_root:rdata[i].path) + "(" + rdata[i].size[2] + ")</span>"; LBody += "<span onclick=\"getFiles('" + rdata[i].path + "')\"><span class='glyphicon glyphicon-hdd'></span>&nbsp;" + (rdata[i].path=='/'?lan.files.path_root:rdata[i].path) + "(" + rdata[i].size[2] + ")</span>";
} }
var trash = '<span id="recycle_bin" onclick="Recycle_bin(\'open\')" title="'+lan.files.recycle_bin_title+'" style="position: absolute; border-color: #ccc; right: 77px;"><span class="glyphicon glyphicon-trash"></span>&nbsp;'+lan.files.recycle_bin_title+'</span>'; var trash = '<span id="recycle_bin" onclick="Recycle_bin(\'open\')" title="'+lan.files.recycle_bin_title+'" style="position: absolute; border-color: #ccc; right: 77px;"><span class="glyphicon glyphicon-trash"></span>&nbsp;'+lan.files.recycle_bin_title+'</span>';
$("#comlist").html(LBody+trash); $("#comlist").html(LBody+trash);
IsDiskWidth(); isDiskWidth();
},'json'); },'json');
} }
@ -807,10 +809,10 @@ function BackDir() {
if(back.substr(back.length-1,1) == '/'){ if(back.substr(back.length-1,1) == '/'){
back = back.substr(0,back.length-1); back = back.substr(0,back.length-1);
} }
GetFiles(back); getFiles(back);
} else { } else {
back += Path[0]; back += Path[0];
GetFiles(back); getFiles(back);
} }
setTimeout('PathPlaceBtn(getCookie("Path"));',200); setTimeout('PathPlaceBtn(getCookie("Path"));',200);
} }
@ -828,8 +830,8 @@ function CreateFile(type, path) {
icon: rdata.status ? 1 : 2 icon: rdata.status ? 1 : 2
}); });
if(rdata.status){ if(rdata.status){
GetFiles($("#DirPathPlace input").val()); getFiles($("#DirPathPlace input").val());
OnlineEditFile(0,path + '/' + fileName); onlineEditFile(0,path + '/' + fileName);
} }
}); });
return; return;
@ -867,7 +869,7 @@ function CreateDir(type, path) {
layer.msg(rdata.msg, { layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 2 icon: rdata.status ? 1 : 2
}); });
GetFiles($("#DirPathPlace input").val()); getFiles($("#DirPathPlace input").val());
}); });
return; return;
} }
@ -901,7 +903,7 @@ function DeleteFile(fileName){
layer.msg(rdata.msg, { layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 2 icon: rdata.status ? 1 : 2
}); });
GetFiles($("#DirPathPlace input").val()); getFiles($("#DirPathPlace input").val());
}); });
}); });
} }
@ -915,7 +917,7 @@ function DeleteDir(dirName){
layer.msg(rdata.msg, { layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 2 icon: rdata.status ? 1 : 2
}); });
GetFiles($("#DirPathPlace input").val()); getFiles($("#DirPathPlace input").val());
}); });
}); });
} }
@ -926,7 +928,7 @@ function AllDeleteFileSub(data,path){
setTimeout(function(){getSpeed('.myspeed');},1000); setTimeout(function(){getSpeed('.myspeed');},1000);
$.post('files?action=SetBatchData',data,function(rdata){ $.post('files?action=SetBatchData',data,function(rdata){
layer.closeAll(); layer.closeAll();
GetFiles(path); getFiles(path);
layer.msg(rdata.msg,{icon:1}); layer.msg(rdata.msg,{icon:1});
}); });
}); });
@ -936,7 +938,7 @@ function AllDeleteFileSub(data,path){
function ReloadFiles(){ function ReloadFiles(){
setInterval(function(){ setInterval(function(){
var path = $("#DirPathPlace input").val(); var path = $("#DirPathPlace input").val();
GetFiles(path); getFiles(path);
},3000); },3000);
} }
@ -952,7 +954,7 @@ function DownloadFile(action){
layer.msg(lan.files.down_task,{time:0,icon:16,shade: [0.3, '#000']}); layer.msg(lan.files.down_task,{time:0,icon:16,shade: [0.3, '#000']});
$.post('/files?action=DownloadFile','path='+fpath+'&url='+fUrl+'&filename='+fname,function(rdata){ $.post('/files?action=DownloadFile','path='+fpath+'&url='+fUrl+'&filename='+fname,function(rdata){
layer.closeAll(); layer.closeAll();
GetFiles(fpath); getFiles(fpath);
GetTaskCount(); GetTaskCount();
layer.msg(rdata.msg,{icon:rdata.status?1:2}); layer.msg(rdata.msg,{icon:rdata.status?1:2});
}); });
@ -1060,7 +1062,7 @@ function ReName(type, fileName) {
layer.msg(rdata.msg, { layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 2 icon: rdata.status ? 1 : 2
}); });
GetFiles(path); getFiles(path);
}); });
return; return;
} }
@ -1093,7 +1095,7 @@ function CutFile(fileName) {
icon: 1, icon: 1,
time: 1 time: 1
}); });
GetFiles(path); getFiles(path);
} }
//复制 //复制
function CopyFile(fileName) { function CopyFile(fileName) {
@ -1104,7 +1106,7 @@ function CopyFile(fileName) {
icon: 1, icon: 1,
time: 1 time: 1
}); });
GetFiles(path); getFiles(path);
} }
//粘贴 //粘贴
function PasteFile(fileName) { function PasteFile(fileName) {
@ -1144,7 +1146,7 @@ function PasteTo(path,copyName,cutName,fileName){
layer.msg(rdata.msg, { layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 2 icon: rdata.status ? 1 : 2
}); });
GetFiles(path); getFiles(path);
}); });
setCookie('copyFileName', null); setCookie('copyFileName', null);
setCookie('cutFileName', null); setCookie('cutFileName', null);
@ -1161,7 +1163,7 @@ function PasteTo(path,copyName,cutName,fileName){
layer.msg(rdata.msg, { layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 2 icon: rdata.status ? 1 : 2
}); });
GetFiles(path); getFiles(path);
}); });
setCookie('copyFileName', null); setCookie('copyFileName', null);
setCookie('cutFileName', null); setCookie('cutFileName', null);
@ -1187,12 +1189,12 @@ function Zip(dirName,submits) {
layer.closeAll(); layer.closeAll();
if(rdata == null || rdata == undefined){ if(rdata == null || rdata == undefined){
layer.msg(lan.files.zip_ok,{icon:1}); layer.msg(lan.files.zip_ok,{icon:1});
GetFiles(path) getFiles(path)
ReloadFiles(); ReloadFiles();
return; return;
} }
layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2}); layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2});
if(rdata.status) GetFiles(path); if(rdata.status) getFiles(path);
}); });
return return
} }
@ -1249,7 +1251,7 @@ function UnZip(fileName,type) {
$.post('/files?action=UnZip', 'sfile=' + sfile + '&dfile=' + dfile +'&type=' + type + '&coding=' + coding + '&password=' + password, function(rdata) { $.post('/files?action=UnZip', 'sfile=' + sfile + '&dfile=' + dfile +'&type=' + type + '&coding=' + coding + '&password=' + password, function(rdata) {
layer.closeAll(); layer.closeAll();
layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2}); layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2});
GetFiles(path); getFiles(path);
}); });
return return
} }
@ -1315,8 +1317,8 @@ function isExts(fileName,exts){
} }
//图片预览 //图片预览
function GetImage(fileName){ function getImage(fileName){
var imgUrl = '/download?filename='+fileName; var imgUrl = '/files/download?filename='+fileName;
layer.open({ layer.open({
type:1, type:1,
closeBtn: 2, closeBtn: 2,
@ -1329,8 +1331,8 @@ function GetImage(fileName){
} }
//获取文件数据 //获取文件数据
function GetFileBytes(fileName, fileSize){ function getFileBytes(fileName, fileSize){
window.open('/download?filename='+encodeURIComponent(fileName)); window.open('/files/download?filename='+encodeURIComponent(fileName));
} }
@ -1374,7 +1376,7 @@ function SetChmod(action,fileName){
if(rdata.status) layer.closeAll(); if(rdata.status) layer.closeAll();
layer.msg(rdata.msg,{icon:rdata.status?1:2}); layer.msg(rdata.msg,{icon:rdata.status?1:2});
var path = $("#DirPathPlace input").val(); var path = $("#DirPathPlace input").val();
GetFiles(path) getFiles(path)
}); });
return; return;
} }
@ -1500,7 +1502,7 @@ function RClick(type,path,name){
options.items.push({text: lan.files.file_menu_del, onclick: function() {DeleteDir(path)}}); options.items.push({text: lan.files.file_menu_del, onclick: function() {DeleteDir(path)}});
} }
else if(isText(type)){ else if(isText(type)){
options.items.push({text: lan.files.file_menu_edit, onclick: function() {OnlineEditFile(0,path)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {DeleteFile(path)}}); options.items.push({text: lan.files.file_menu_edit, onclick: function() {onlineEditFile(0,path)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {DeleteFile(path)}});
} }
else if(displayZip != -1){ else if(displayZip != -1){
options.items.push({text: lan.files.file_menu_unzip, onclick: function() {UnZip(path,displayZip)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {DeleteFile(path)}}); options.items.push({text: lan.files.file_menu_unzip, onclick: function() {UnZip(path,displayZip)}},{text: lan.files.file_menu_down, onclick: function() {GetFileBytes(path)}},{text: lan.files.file_menu_del, onclick: function() {DeleteFile(path)}});
@ -1544,7 +1546,7 @@ $("body").not(".def-log").click(function(){
//指定路径 //指定路径
$("#DirPathPlace input").keyup(function(e){ $("#DirPathPlace input").keyup(function(e){
if(e.keyCode == 13) { if(e.keyCode == 13) {
GetFiles($(this).val()); getFiles($(this).val());
} }
}); });
function PathPlaceBtn(path){ function PathPlaceBtn(path){
@ -1571,7 +1573,7 @@ function PathPlaceBtn(path){
Gopath = Gopath.substr(0,Gopath.length-1); Gopath = Gopath.substr(0,Gopath.length-1);
} }
} }
GetFiles(Gopath); getFiles(Gopath);
e.stopPropagation(); e.stopPropagation();
}); });
PathLeft(); PathLeft();

@ -366,7 +366,7 @@ function openPath(a) {
} }
function OnlineEditFile(k, f) { function onlineEditFile(k, f) {
if(k != 0) { if(k != 0) {
var l = $("#PathPlace input").val(); var l = $("#PathPlace input").val();
var h = encodeURIComponent($("#textBody").val()); var h = encodeURIComponent($("#textBody").val());
@ -375,14 +375,14 @@ function OnlineEditFile(k, f) {
icon: 16, icon: 16,
time: 0 time: 0
}); });
$.post("/files?action=SaveFileBody", "data=" + h + "&path=" + encodeURIComponent(f) + "&encoding=" + a, function(m) { $.post("/files/save_body", "data=" + h + "&path=" + encodeURIComponent(f) + "&encoding=" + a, function(m) {
if(k == 1) { if(k == 1) {
layer.close(loadT); layer.close(loadT);
} }
layer.msg(m.msg, { layer.msg(m.msg, {
icon: m.status ? 1 : 2 icon: m.status ? 1 : 2
}); });
}); },'json');
return return
} }
var e = layer.msg(lan.bt.read_file, { var e = layer.msg(lan.bt.read_file, {
@ -456,7 +456,7 @@ function OnlineEditFile(k, f) {
}; };
d = j d = j
} }
$.post("/files?action=GetFileBody", "path=" + encodeURIComponent(f), function(s) { $.post("/files/get_body", "path=" + encodeURIComponent(f), function(s) {
if(s.status === false){ if(s.status === false){
layer.msg(s.msg,{icon:5}); layer.msg(s.msg,{icon:5});
return; return;
@ -478,7 +478,7 @@ function OnlineEditFile(k, f) {
title: lan.bt.edit_title+"[" + f + "]", title: lan.bt.edit_title+"[" + f + "]",
content: '<form class="bt-form pd20 pb70"><div class="line"><p style="color:red;margin-bottom:10px">'+lan.bt.edit_ps+' <select class="bt-input-text" name="encoding" style="width: 74px;position: absolute;top: 31px;right: 19px;height: 22px;z-index: 9999;border-radius: 0;">' + n + '</select></p><textarea class="mCustomScrollbar bt-input-text" id="textBody" style="width:100%;margin:0 auto;line-height: 1.8;position: relative;top: 10px;" value="" /> </div> <div class="bt-form-submit-btn" style="position:absolute; bottom:0; width:100%"> <button type="button" class="btn btn-danger btn-sm btn-editor-close">'+lan.public.close+'</button> <button id="OnlineEditFileBtn" type="button" class="btn btn-success btn-sm">'+lan.public.save+'</button> </div> </form>' content: '<form class="bt-form pd20 pb70"><div class="line"><p style="color:red;margin-bottom:10px">'+lan.bt.edit_ps+' <select class="bt-input-text" name="encoding" style="width: 74px;position: absolute;top: 31px;right: 19px;height: 22px;z-index: 9999;border-radius: 0;">' + n + '</select></p><textarea class="mCustomScrollbar bt-input-text" id="textBody" style="width:100%;margin:0 auto;line-height: 1.8;position: relative;top: 10px;" value="" /> </div> <div class="bt-form-submit-btn" style="position:absolute; bottom:0; width:100%"> <button type="button" class="btn btn-danger btn-sm btn-editor-close">'+lan.public.close+'</button> <button id="OnlineEditFileBtn" type="button" class="btn btn-success btn-sm">'+lan.public.save+'</button> </div> </form>'
}); });
$("#textBody").text(s.data); $("#textBody").text(s.data.data);
var q = $(window).height() * 0.9; var q = $(window).height() * 0.9;
$("#textBody").height(q - 160); $("#textBody").height(q - 160);
var t = CodeMirror.fromTextArea(document.getElementById("textBody"), { var t = CodeMirror.fromTextArea(document.getElementById("textBody"), {
@ -487,7 +487,7 @@ function OnlineEditFile(k, f) {
"Ctrl-H": "replaceAll", "Ctrl-H": "replaceAll",
"Ctrl-S": function() { "Ctrl-S": function() {
$("#textBody").text(t.getValue()); $("#textBody").text(t.getValue());
OnlineEditFile(2, f) onlineEditFile(2, f)
} }
}, },
mode: d, mode: d,
@ -500,46 +500,12 @@ function OnlineEditFile(k, f) {
t.setSize("auto", q - 150); t.setSize("auto", q - 150);
$("#OnlineEditFileBtn").click(function() { $("#OnlineEditFileBtn").click(function() {
$("#textBody").text(t.getValue()); $("#textBody").text(t.getValue());
OnlineEditFile(1, f); onlineEditFile(1, f);
}); });
$(".btn-editor-close").click(function() { $(".btn-editor-close").click(function() {
layer.close(r); layer.close(r);
}); });
}); },'json');
}
function GetPHPStatus(a) {
if(a == "52") {
layer.msg(lan.bt.php_status_err, {
icon: 2
});
return
}
$.post("/ajax?action=GetPHPStatus", "version=" + a, function(b) {
layer.open({
type: 1,
area: "400",
title: lan.bt.php_status_title,
closeBtn: 2,
shift: 5,
shadeClose: true,
content: "<div style='margin:15px;'><table class='table table-hover table-bordered'> <tr><th>"+lan.bt.php_pool+"</th><td>" + b.pool + "</td></tr> <tr><th>"+lan.bt.php_manager+"</th><td>" + ((b["process manager"] == "dynamic") ? lan.bt.dynamic : lan.bt.static) + "</td></tr> <tr><th>"+lan.bt.php_start+"</th><td>" + b["start time"] + "</td></tr> <tr><th>"+lan.bt.php_accepted+"</th><td>" + b["accepted conn"] + "</td></tr> <tr><th>"+lan.bt.php_queue+"</th><td>" + b["listen queue"] + "</td></tr> <tr><th>"+lan.bt.php_max_queue+"</th><td>" + b["max listen queue"] + "</td></tr> <tr><th>"+lan.bt.php_len_queue+"</th><td>" + b["listen queue len"] + "</td></tr> <tr><th>"+lan.bt.php_idle+"</th><td>" + b["idle processes"] + "</td></tr> <tr><th>"+lan.bt.php_active+"</th><td>" + b["active processes"] + "</td></tr> <tr><th>"+lan.bt.php_total+"</th><td>" + b["total processes"] + "</td></tr> <tr><th>"+lan.bt.php_max_active+"</th><td>" + b["max active processes"] + "</td></tr> <tr><th>"+lan.bt.php_max_children+"</th><td>" + b["max children reached"] + "</td></tr> <tr><th>"+lan.bt.php_slow+"</th><td>" + b["slow requests"] + "</td></tr> </table></div>"
})
})
}
function GetNginxStatus() {
$.post("/ajax?action=GetNginxStatus", "", function(a) {
layer.open({
type: 1,
area: "400",
title: lan.bt.nginx_title,
closeBtn: 2,
shift: 5,
shadeClose: true,
content: "<div style='margin:15px;'><table class='table table-hover table-bordered'> <tr><th>"+lan.bt.nginx_active+"</th><td>" + a.active + "</td></tr> <tr><th>"+lan.bt.nginx_accepts+"</th><td>" + a.accepts + "</td></tr> <tr><th>"+lan.bt.nginx_handled+"</th><td>" + a.handled + "</td></tr> <tr><th>"+lan.bt.nginx_requests+"</th><td>" + a.requests + "</td></tr> <tr><th>"+lan.bt.nginx_reading+"</th><td>" + a.Reading + "</td></tr> <tr><th>"+lan.bt.nginx_writing+"</th><td>" + a.Writing + "</td></tr> <tr><th>"+lan.bt.nginx_waiting+"</th><td>" + a.Waiting + "</td></tr> </table></div>"
})
})
} }
function divcenter() { function divcenter() {

@ -1,4 +1,6 @@
{% extends "default/layout.html" %} {% block content %} {% extends "default/layout.html" %}
{% block content %}
<div class="main-content"> <div class="main-content">
<div class="container-fluid" style="padding-bottom:50px"> <div class="container-fluid" style="padding-bottom:50px">
<div class="file-box bgw mtb15" style="position:relative; padding-top:110px"> <div class="file-box bgw mtb15" style="position:relative; padding-top:110px">
@ -54,15 +56,15 @@
</ul> </ul>
<script src="/static/js/jquery-ui.min.js?v={{config.version}}"></script> <script src="/static/js/jquery-ui.min.js?v={{config.version}}"></script>
<script src="/static/js/jquery.contextify.min.js?v={{config.version}}"></script> <script src="/static/js/jquery.contextify.min.js?v={{config.version}}"></script>
<script src="/static/js/files.js?v={{config.version}}"></script> <script src="/static/app/files.js?v={{config.version}}"></script>
<script src="/static/js/upload.js?v={{config.version}}"></script> <script src="/static/app/upload.js?v={{config.version}}"></script>
<script type="text/javascript"> <script type="text/javascript">
setTimeout(function() { setTimeout(function() {
GetDisk(); getDisk();
}, 500); }, 500);
var xPath = getCookie('Path'); var xPath = getCookie('Path');
setTimeout(function() { setTimeout(function() {
GetFiles((xPath != undefined ? xPath : '/www/wwwroot')); getFiles((xPath != undefined ? xPath : '/www/wwwroot'));
}, 800); }, 800);
PathPlaceBtn((xPath != undefined ? xPath : '/www/wwwroot')); PathPlaceBtn((xPath != undefined ? xPath : '/www/wwwroot'));
@ -74,16 +76,16 @@ $("#set_icon").click(function() {
setCookie('rank', 'b'); setCookie('rank', 'b');
$(this).addClass("active"); $(this).addClass("active");
$("#set_list").removeClass("active"); $("#set_list").removeClass("active");
GetFiles(getCookie('Path')); getFiles(getCookie('Path'));
}); });
$("#set_list").click(function() { $("#set_list").click(function() {
setCookie('rank', 'a'); setCookie('rank', 'a');
$(this).addClass("active"); $(this).addClass("active");
$("#set_icon").removeClass("active"); $("#set_icon").removeClass("active");
GetFiles(getCookie('Path')); getFiles(getCookie('Path'));
}) })
$(".refreshBtn").click(function() { $(".refreshBtn").click(function() {
GetFiles(getCookie('Path')); getFiles(getCookie('Path'));
}) })
</script> </script>
{% endblock %} {% endblock %}
Loading…
Cancel
Save