复制 , 批量复制,剪贴【FIX】。
pull/109/head
midoks 3 years ago
parent 9f9af8e7c8
commit 570792196c
  1. 7
      class/core/files_api.py
  2. 18
      route/static/app/files.js

@ -525,14 +525,17 @@ done
sfile = request.form.get('sfile', '')
dfile = request.form.get('dfile', '')
if sfile == dfile:
return mw.returnJson(False, '源与目的一致!')
if not os.path.exists(sfile):
return mw.returnJson(False, '指定文件不存在!')
if os.path.isdir(sfile):
return self.copyDir(sfile, dfile)
import shutil
try:
import shutil
shutil.copyfile(sfile, dfile)
msg = mw.getInfo('复制文件[{1}]到[{2}]成功!', (sfile, dfile,))
mw.writeLog('文件管理', msg)
@ -564,7 +567,7 @@ done
# 检查敏感目录
def checkDir(self, path):
path = str(path, encoding='utf-8')
# path = str(path, encoding='utf-8')
path = path.replace('//', '/')
if path[-1:] == '/':
path = path[:-1]

@ -217,7 +217,7 @@ function recycleBin(type){
//去扩展名不处理
function getFileName(name){
var text = name.split(".");
var text = name.split("/");
var n = text.length-1;
text = text[n];
return text;
@ -464,6 +464,8 @@ function getFiles(Path) {
var copyName = getCookie('copyFileName');
var cutName = getCookie('cutFileName');
var isPaste = (copyName == 'null') ? cutName : copyName;
console.log('isPaste:',isPaste);
//---
if (isPaste != 'null' && isPaste != undefined) {
BarTools += ' <button onclick="javascript:pasteFile(\'' + (getFileName(isPaste)) + '\');" class="btn btn-Warning btn-sm">粘贴</button>';
}
@ -1062,7 +1064,7 @@ function pasteFile(fileName) {
safeMessage('即将覆盖以下文件',mbody,function(){
pasteTo(path,copyName,cutName,fileName);
});
}else{
} else {
pasteTo(path,copyName,cutName,fileName);
}
},'json');
@ -1075,6 +1077,12 @@ function pasteTo(path,copyName,cutName,fileName){
icon: 16,
time: 0,shade: [0.3, '#000']
});
//同目录下
if (copyName == path +'/'+ fileName){
fileName = '__copy__'+ fileName;
}
$.post('/files/copy_file', 'sfile=' + encodeURIComponent(copyName) + '&dfile=' + encodeURIComponent(path +'/'+ fileName), function(rdata) {
layer.closeAll();
layer.msg(rdata.msg, {
@ -1094,11 +1102,9 @@ function pasteTo(path,copyName,cutName,fileName){
});
$.post('/files/mv_file', 'sfile=' + encodeURIComponent(cutName) + '&dfile=' + encodeURIComponent(path + '/'+fileName), function(rdata) {
layer.closeAll();
layer.msg(rdata.msg, {
icon: rdata.status ? 1 : 2
});
layer.msg(rdata.msg, {icon: rdata.status ? 1 : 2});
getFiles(path);
});
},'json');
setCookie('copyFileName', null);
setCookie('cutFileName', null);
}

Loading…
Cancel
Save