mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
update
This commit is contained in:
@@ -8,6 +8,7 @@ import public
|
||||
import re
|
||||
import json
|
||||
import pwd
|
||||
import shutil
|
||||
|
||||
from flask import request
|
||||
from flask import send_file, send_from_directory
|
||||
@@ -220,6 +221,30 @@ class files_api:
|
||||
public.writeLog('文件管理', msg)
|
||||
return public.returnJson(True, msg)
|
||||
|
||||
# 获取进度
|
||||
def getSpeedApi(self):
|
||||
data = public.getSpeed()
|
||||
print data
|
||||
return public.returnJson(True, '已清空回收站!', data)
|
||||
|
||||
def closeRecycleBinApi(self):
|
||||
rPath = self.rPath
|
||||
os.system('which chattr && chattr -R -i ' + rPath)
|
||||
rlist = os.listdir(rPath)
|
||||
i = 0
|
||||
l = len(rlist)
|
||||
for name in rlist:
|
||||
i += 1
|
||||
path = rPath + name
|
||||
public.writeSpeed(name, i, l)
|
||||
if os.path.isdir(path):
|
||||
shutil.rmtree(path)
|
||||
else:
|
||||
os.remove(path)
|
||||
public.writeSpeed(None, 0, 0)
|
||||
public.writeLog('文件管理', '已清空回收站!')
|
||||
return public.returnJson(True, '已清空回收站!')
|
||||
|
||||
def deleteDirApi(self):
|
||||
path = request.form.get('path', '').encode('utf-8')
|
||||
if not os.path.exists(path):
|
||||
|
||||
+8
-5
@@ -84,11 +84,14 @@ def isLogined():
|
||||
|
||||
def publicObject(toObject, func, action=None, get=None):
|
||||
name = funConvert(func) + 'Api'
|
||||
if hasattr(toObject, name):
|
||||
efunc = 'toObject.' + name + '()'
|
||||
data = eval(efunc)
|
||||
return data
|
||||
return public.retFail('访问异常!')
|
||||
try:
|
||||
if hasattr(toObject, name):
|
||||
efunc = 'toObject.' + name + '()'
|
||||
data = eval(efunc)
|
||||
return data
|
||||
except Exception as e:
|
||||
data = {'msg': '访问异常:' + str(e) + '!', "status": False}
|
||||
return public.getInfo(data)
|
||||
|
||||
|
||||
@app.route("/test")
|
||||
|
||||
@@ -262,7 +262,7 @@ function closeRecycleBin(){
|
||||
setTimeout(function(){
|
||||
getSpeed('.myspeed');
|
||||
},1000);
|
||||
$.post('/files?action=Close_Recycle_bin','',function(rdata){
|
||||
$.post('/files/close_recycle_bin', '', function(rdata){
|
||||
layer.close(loadT);
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:5});
|
||||
$("#RecycleBody").html('');
|
||||
@@ -286,18 +286,15 @@ function setRecycleBin(db){
|
||||
|
||||
//取数据
|
||||
function getFiles(Path) {
|
||||
console.log(Path);
|
||||
var searchtype = Path;
|
||||
if(isNaN(Path)){
|
||||
var p = '1';
|
||||
var p = 1;
|
||||
Path = encodeURIComponent(Path);
|
||||
console.log(1,Path);
|
||||
} else {
|
||||
var p = '1';
|
||||
var p = Path;
|
||||
Path = getCookie('open_dir_path');
|
||||
console.log(2,Path);
|
||||
Path = encodeURIComponent(Path);
|
||||
}
|
||||
console.log(Path);
|
||||
|
||||
var search = '';
|
||||
var searchV = $("#SearchValue").val();
|
||||
@@ -461,7 +458,7 @@ function getFiles(Path) {
|
||||
if (rdata.PATH != '/') {
|
||||
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('open_dir_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>';
|
||||
var copyName = getCookie('copyFileName');
|
||||
var cutName = getCookie('cutFileName');
|
||||
@@ -548,8 +545,10 @@ function getFiles(Path) {
|
||||
});
|
||||
PathPlaceBtn(rdata.PATH);
|
||||
},'json');
|
||||
//setTimeout(function(){getCookie('path');},200);
|
||||
setTimeout(function(){getCookie('open_dir_path');},200);
|
||||
}
|
||||
|
||||
|
||||
//统计选择数量
|
||||
function totalFile(){
|
||||
var el = $("input[name='id']");
|
||||
|
||||
@@ -926,14 +926,18 @@ function bindPaneldel(id){
|
||||
}
|
||||
|
||||
function getSpeed(sele){
|
||||
if(!$(sele)) return;
|
||||
$.get('/ajax?action=GetSpeed',function(speed){
|
||||
if(speed.title === null) return;
|
||||
mspeed = '';
|
||||
if(speed.speed > 0){
|
||||
mspeed = '<span class="pull-right">'+ToSize(speed.speed)+'/s</span>';
|
||||
if(!$(sele)) {
|
||||
return;
|
||||
}
|
||||
$.get('/files/get_speed',function(speed){
|
||||
if(speed.title === null){
|
||||
return;
|
||||
}
|
||||
body = '<p>'+speed.title+' <img src="/static/img/ing.gif"></p>\
|
||||
var mspeed = '';
|
||||
if(speed.speed > 0){
|
||||
mspeed = '<span class="pull-right">'+toSize(speed.speed)+'/s</span>';
|
||||
}
|
||||
var body = '<p>'+speed.title+' <img src="/static/img/ing.gif"></p>\
|
||||
<div class="bt-progress"><div class="bt-progress-bar" style="width:'+speed.progress+'%"><span class="bt-progress-text">'+speed.progress+'%</span></div></div>\
|
||||
<p class="f12 c9"><span class="pull-left">'+speed.used+'/'+speed.total+'</span>'+mspeed+'</p>';
|
||||
$(sele).prev().hide();
|
||||
@@ -944,7 +948,7 @@ function getSpeed(sele){
|
||||
setTimeout(function(){
|
||||
getSpeed(sele);
|
||||
},1000);
|
||||
});
|
||||
},'json');
|
||||
}
|
||||
//消息盒子
|
||||
function messageBox() {
|
||||
|
||||
Reference in New Issue
Block a user