From 9cdacaa3a9b3faa6065d91bc67d20fe07a8f5163 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 5 Dec 2018 17:04:20 +0800 Subject: [PATCH] u --- plugins/php/js/php.js | 20 +++++++ route/dashboard.py | 4 +- static/app/files.js | 102 ++++++++++++++++++----------------- static/app/public.js | 50 +++-------------- static/{js => app}/upload.js | 0 templates/default/files.html | 18 ++++--- 6 files changed, 92 insertions(+), 102 deletions(-) rename static/{js => app}/upload.js (100%) diff --git a/plugins/php/js/php.js b/plugins/php/js/php.js index f2e5e39ae..d805c29ab 100755 --- a/plugins/php/js/php.js +++ b/plugins/php/js/php.js @@ -614,3 +614,23 @@ function phpUploadLimit(version, max) { var LimitCon = '

MB

'; $(".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: "
"+lan.bt.php_pool+"" + b.pool + "
"+lan.bt.php_manager+"" + ((b["process manager"] == "dynamic") ? lan.bt.dynamic : lan.bt.static) + "
"+lan.bt.php_start+"" + b["start time"] + "
"+lan.bt.php_accepted+"" + b["accepted conn"] + "
"+lan.bt.php_queue+"" + b["listen queue"] + "
"+lan.bt.php_max_queue+"" + b["max listen queue"] + "
"+lan.bt.php_len_queue+"" + b["listen queue len"] + "
"+lan.bt.php_idle+"" + b["idle processes"] + "
"+lan.bt.php_active+"" + b["active processes"] + "
"+lan.bt.php_total+"" + b["total processes"] + "
"+lan.bt.php_max_active+"" + b["max active processes"] + "
"+lan.bt.php_max_children+"" + b["max children reached"] + "
"+lan.bt.php_slow+"" + b["slow requests"] + "
" + }) + }) +} diff --git a/route/dashboard.py b/route/dashboard.py index 3f364950b..242ced1b1 100644 --- a/route/dashboard.py +++ b/route/dashboard.py @@ -28,8 +28,8 @@ def test(): @dashboard.route("/") def index(): - if session.has_key('code'): - print session['code'] + # if session.has_key('code'): + # print session['code'] return render_template('default/index.html') diff --git a/static/app/files.js b/static/app/files.js index 56e75a980..96d501787 100755 --- a/static/app/files.js +++ b/static/app/files.js @@ -1,5 +1,7 @@ +console.log(lan); + //判断磁盘数量超出宽度 -function IsDiskWidth(){ +function isDiskWidth(){ var comlistWidth = $("#comlist").width(); var bodyWidth = $(".file-box").width(); 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){ var body = '' switch(type){ @@ -249,7 +251,7 @@ function getFileName(name){ return text; } //判断图片文件 -function ReisImage(fileName){ +function reisImage(fileName){ var exts = ['jpg','jpeg','png','bmp','gif','tiff','ico']; for(var i=0; i\ \ - " + cnametext + "\ + " + cnametext + "\ "+toSize(fmp[1])+"\ "+getLocalTime(fmp[2])+"\ "+fmp[3]+"\ @@ -386,8 +388,8 @@ function GetFiles(Path) { $("#set_list").removeClass("active"); Body += ""; } } @@ -411,12 +413,12 @@ function GetFiles(Path) { bodyZip = ""+lan.files.file_menu_unzip+" | "; } if(isText(fmp[0])){ - bodyZip = ""+lan.files.file_menu_edit+" | "; + bodyZip = "编辑 | "; } if(isImage(fmp[0])){ - download = ""+lan.files.file_menu_img+" | "; + download = "预览 | "; }else{ - download = ""+lan.files.file_menu_down+" | "; + download = "下载 | "; } totalSize += parseInt(fmp[1]); @@ -483,7 +485,7 @@ function GetFiles(Path) { BarTools += ' '; } setCookie('Path',rdata.PATH); - BarTools += ' '; + BarTools += ' '; var copyName = getCookie('copyFileName'); var cutName = getCookie('cutFileName'); var isPaste = (copyName == 'null') ? cutName : copyName; @@ -565,7 +567,7 @@ function GetFiles(Path) { //每页行数 $(".showRow").change(function(){ setCookie('showRow',$(this).val()); - GetFiles(p); + getFiles(p); }); PathPlaceBtn(rdata.PATH); },'json'); @@ -622,10 +624,10 @@ function showSeclect(){ var BatchTools = ''; if(count > 1){ BatchTools = '\ - \ - \ - \ - ' + \ + \ + \ + ' $("#Batch").html(BatchTools); }else{ $("#Batch").html(BatchTools); @@ -709,7 +711,7 @@ function Batch(type,access){ setTimeout(function(){getSpeed('.myspeed');},1000); $.post('files?action=SetBatchData',data,function(rdata){ layer.close(myloadT); - GetFiles(path); + getFiles(path); layer.msg(rdata.msg,{icon:1}); }); } @@ -745,7 +747,7 @@ function BatchPasteTo(data,path){ $.post('files?action=BatchPaste',data,function(rdata){ layer.close(myloadT); setCookie('BatchSelected', null); - GetFiles(path); + getFiles(path); layer.msg(rdata.msg,{icon:1}); }); } @@ -779,15 +781,15 @@ function GetFileName(fileNameFull) { return pName[pName.length - 1]; } //取磁盘 -function GetDisk() { +function getDisk() { var LBody = ''; $.get('/system/disk_info', function(rdata) { for (var i = 0; i < rdata.length; i++) { - LBody += " " + (rdata[i].path=='/'?lan.files.path_root:rdata[i].path) + "(" + rdata[i].size[2] + ")"; + LBody += " " + (rdata[i].path=='/'?lan.files.path_root:rdata[i].path) + "(" + rdata[i].size[2] + ")"; } var trash = ' '+lan.files.recycle_bin_title+''; $("#comlist").html(LBody+trash); - IsDiskWidth(); + isDiskWidth(); },'json'); } @@ -807,10 +809,10 @@ function BackDir() { if(back.substr(back.length-1,1) == '/'){ back = back.substr(0,back.length-1); } - GetFiles(back); + getFiles(back); } else { back += Path[0]; - GetFiles(back); + getFiles(back); } setTimeout('PathPlaceBtn(getCookie("Path"));',200); } @@ -828,8 +830,8 @@ function CreateFile(type, path) { icon: rdata.status ? 1 : 2 }); if(rdata.status){ - GetFiles($("#DirPathPlace input").val()); - OnlineEditFile(0,path + '/' + fileName); + getFiles($("#DirPathPlace input").val()); + onlineEditFile(0,path + '/' + fileName); } }); return; @@ -867,7 +869,7 @@ function CreateDir(type, path) { layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - GetFiles($("#DirPathPlace input").val()); + getFiles($("#DirPathPlace input").val()); }); return; } @@ -901,7 +903,7 @@ function DeleteFile(fileName){ layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - GetFiles($("#DirPathPlace input").val()); + getFiles($("#DirPathPlace input").val()); }); }); } @@ -915,7 +917,7 @@ function DeleteDir(dirName){ layer.msg(rdata.msg, { 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); $.post('files?action=SetBatchData',data,function(rdata){ layer.closeAll(); - GetFiles(path); + getFiles(path); layer.msg(rdata.msg,{icon:1}); }); }); @@ -936,7 +938,7 @@ function AllDeleteFileSub(data,path){ function ReloadFiles(){ setInterval(function(){ var path = $("#DirPathPlace input").val(); - GetFiles(path); + getFiles(path); },3000); } @@ -952,7 +954,7 @@ function DownloadFile(action){ 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){ layer.closeAll(); - GetFiles(fpath); + getFiles(fpath); GetTaskCount(); layer.msg(rdata.msg,{icon:rdata.status?1:2}); }); @@ -1060,7 +1062,7 @@ function ReName(type, fileName) { layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - GetFiles(path); + getFiles(path); }); return; } @@ -1093,7 +1095,7 @@ function CutFile(fileName) { icon: 1, time: 1 }); - GetFiles(path); + getFiles(path); } //复制 function CopyFile(fileName) { @@ -1104,7 +1106,7 @@ function CopyFile(fileName) { icon: 1, time: 1 }); - GetFiles(path); + getFiles(path); } //粘贴 function PasteFile(fileName) { @@ -1144,7 +1146,7 @@ function PasteTo(path,copyName,cutName,fileName){ layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - GetFiles(path); + getFiles(path); }); setCookie('copyFileName', null); setCookie('cutFileName', null); @@ -1161,7 +1163,7 @@ function PasteTo(path,copyName,cutName,fileName){ layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 }); - GetFiles(path); + getFiles(path); }); setCookie('copyFileName', null); setCookie('cutFileName', null); @@ -1187,12 +1189,12 @@ function Zip(dirName,submits) { layer.closeAll(); if(rdata == null || rdata == undefined){ layer.msg(lan.files.zip_ok,{icon:1}); - GetFiles(path) + getFiles(path) ReloadFiles(); return; } layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2}); - if(rdata.status) GetFiles(path); + if(rdata.status) getFiles(path); }); 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) { layer.closeAll(); layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2}); - GetFiles(path); + getFiles(path); }); return } @@ -1315,8 +1317,8 @@ function isExts(fileName,exts){ } //图片预览 -function GetImage(fileName){ - var imgUrl = '/download?filename='+fileName; +function getImage(fileName){ + var imgUrl = '/files/download?filename='+fileName; layer.open({ type:1, closeBtn: 2, @@ -1329,8 +1331,8 @@ function GetImage(fileName){ } //获取文件数据 -function GetFileBytes(fileName, fileSize){ - window.open('/download?filename='+encodeURIComponent(fileName)); +function getFileBytes(fileName, fileSize){ + window.open('/files/download?filename='+encodeURIComponent(fileName)); } @@ -1374,7 +1376,7 @@ function SetChmod(action,fileName){ if(rdata.status) layer.closeAll(); layer.msg(rdata.msg,{icon:rdata.status?1:2}); var path = $("#DirPathPlace input").val(); - GetFiles(path) + getFiles(path) }); return; } @@ -1500,7 +1502,7 @@ function RClick(type,path,name){ options.items.push({text: lan.files.file_menu_del, onclick: function() {DeleteDir(path)}}); } 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){ 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){ if(e.keyCode == 13) { - GetFiles($(this).val()); + getFiles($(this).val()); } }); function PathPlaceBtn(path){ @@ -1571,7 +1573,7 @@ function PathPlaceBtn(path){ Gopath = Gopath.substr(0,Gopath.length-1); } } - GetFiles(Gopath); + getFiles(Gopath); e.stopPropagation(); }); PathLeft(); diff --git a/static/app/public.js b/static/app/public.js index d7accce02..dd3440dc0 100755 --- a/static/app/public.js +++ b/static/app/public.js @@ -366,7 +366,7 @@ function openPath(a) { } -function OnlineEditFile(k, f) { +function onlineEditFile(k, f) { if(k != 0) { var l = $("#PathPlace input").val(); var h = encodeURIComponent($("#textBody").val()); @@ -375,14 +375,14 @@ function OnlineEditFile(k, f) { icon: 16, 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) { layer.close(loadT); } layer.msg(m.msg, { icon: m.status ? 1 : 2 }); - }); + },'json'); return } var e = layer.msg(lan.bt.read_file, { @@ -456,7 +456,7 @@ function OnlineEditFile(k, f) { }; d = j } - $.post("/files?action=GetFileBody", "path=" + encodeURIComponent(f), function(s) { + $.post("/files/get_body", "path=" + encodeURIComponent(f), function(s) { if(s.status === false){ layer.msg(s.msg,{icon:5}); return; @@ -478,7 +478,7 @@ function OnlineEditFile(k, f) { title: lan.bt.edit_title+"[" + f + "]", content: '

'+lan.bt.edit_ps+'