Merge pull request #736 from midoks/dev

文件管理-右键菜单优化
This commit is contained in:
Mr Chen 2025-05-16 04:19:14 +08:00 committed by GitHub
commit 73a67ebdd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 141 additions and 27 deletions

View File

@ -3504,6 +3504,11 @@ def doFullSyncUser(version=''):
return False
time_s = time.time()
ssl_mode = '--ssl-mode=DISABLED'
if pk_version.parse(version) > pk_version.parse("8.0"):
ssl_mode = '--ssl-mode=REQUIRED'
if not os.path.exists(bak_file):
dmp_option += ' '
if mw.inArray(mdb8,version):
@ -3513,7 +3518,7 @@ def doFullSyncUser(version=''):
dmp_option += " --master-data=1 --apply-slave-statements --include-master-host-port --compress "
dump_sql_data = getServerDir() + "/bin/mysqldump --single-transaction --default-character-set=utf8mb4 -q " + dmp_option + " -h" + ip + " -P" + \
port + " -u" + user + " -p'" + apass + "' --ssl-mode=DISABLED " + sync_db + " > " + bak_file
port + " -u" + user + " -p'" + apass + "' " + ssl_mode + " " + sync_db + " > " + bak_file
print(dump_sql_data)
time_s = time.time()
r = mw.execShell(dump_sql_data)

View File

@ -676,17 +676,9 @@ function getFiles(Path) {
});
$(".folderBox,.folderBoxTr").mousedown(function(e){
// console.log(e);
var count = totalFile();
if(e.which == 3) {
if(count <= 1){
var a = $(this);
var option = rightMenuClick(a.attr("filetype"),a.attr("data-path"),a.find("input").val());
a.contextify(option);
} else{
rightMenuClickAll(e);
}
}
var box = $(this);
var option = rightMenuClick(box.attr("filetype"),box.attr("data-path"),box.find("input").val());
box.contextify(option);
});
//每页行数
@ -733,7 +725,7 @@ function bindselect(){
$(".ui-selectee").find("input").prop("checked", false);
$(".ui-selecting").find("input").prop("checked", true);
showSeclect();
$("#rmenu").hide()
$("#rmenu").hide();
}
});
$("#filesBody,#fileCon").selectable("refresh");
@ -1739,6 +1731,9 @@ function onAccess(){
}
}
function forcePpageRefresh(){
location.reload(true);
}
//右键菜单
function rightMenuClick(type,path,name){
@ -1755,8 +1750,7 @@ function rightMenuClick(type,path,name){
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() {
@ -1764,8 +1758,7 @@ function rightMenuClick(type,path,name){
}},{ 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() {
@ -1773,8 +1766,7 @@ function rightMenuClick(type,path,name){
}},{text: lan.files.file_menu_del, onclick: function() {
deleteFile(path);
}});
}
else if(isImage(type)){
} else if(isImage(type)){
options.items.push({text: lan.files.file_menu_img, onclick: function() {
getImage(path);
}},{text: lan.files.file_menu_down, onclick: function() {
@ -1782,14 +1774,17 @@ function rightMenuClick(type,path,name){
}},{text: lan.files.file_menu_del, onclick: function() {
deleteFile(path);
}});
}
else{
} else {
options.items.push({text: lan.files.file_menu_down, onclick: function() {
getFileBytes(path);
}},{text: lan.files.file_menu_del, onclick: function() {
deleteFile(path);
}});
}
options.items.push({text: '强制刷新页面', onclick: function() {
forcePpageRefresh();
}});
return options;
}
@ -1820,7 +1815,7 @@ function getPathSize(){
}
$("body").not(".def-log").click(function(){
$("#rmenu").hide()
$("#rmenu").hide();
});
//指定路径

View File

@ -1,6 +1,120 @@
/*!
* jQuery Contextify v1.0.7 (http://contextify.js.org)
* Copyright (c) 2016 Adam Bouqdib
* Licensed under GPL-2.0 (http://abemedia.co.uk/license)
*/
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{factory(jQuery,window)}}(function($,window){var pluginName="contextify",defaults={items:[],action:"contextmenu",menuId:"contextify-menu",menuClass:"dropdown-menu",headerClass:"dropdown-header",dividerClass:"divider",before:false},contextifyId=0;function Plugin(element,options){this.element=element;this.options=$.extend({},defaults,options);this._defaults=defaults;this._name=pluginName;this.init()}Plugin.prototype.init=function(){var options=$.extend({},this.options,$(this.element).data()),that=$(this);options.id=contextifyId;$(this.element).attr("data-contextify-id",options.id).on("contextmenu",function(e){e.preventDefault();if(typeof(options.before)==="function"){options.before(this,options)}var menu=$('<ul class="'+options.menuClass+'" role="menu" id="'+options.menuId+'" data-contextify-id="'+options.id+'"/>');menu.data(options);var l=options.items.length;var i;for(i=0;i<l;i++){var item=options.items[i];var el=$("<li/>");if(item.divider){el.addClass(options.dividerClass)}else{if(item.header){el.addClass(options.headerClass);el.html(item.header)}else{el.append("<a/>");var a=el.find("a");if(item.href){a.attr("href",item.href)}if(item.onclick){a.on("click",options,item.onclick);a.css("cursor","pointer")}if(item.data){for(var data in item.data){menu.attr("data-"+data,item.data[data])}a.data(item.data)}a.html(item.text)}}menu.append(el)}var currentMenu=$("#"+options.menuId);if(currentMenu.length>0){if(currentMenu!==menu){currentMenu.replaceWith(menu)}}else{$("body").append(menu)}var clientTop=$(window).scrollTop()+e.clientY,x=(menu.width()+e.clientX<$(window).width())?e.clientX:e.clientX-menu.width(),y=(menu.height()+e.clientY<$(window).height())?clientTop:clientTop-menu.height();menu.css("top",y).css("left",x).css("position","fixed").show();$(document).one("click",function(e){$("#"+options.menuId).hide();e.preventDefault()})}).one("click",function(e){$("#"+options.menuId).hide();e.preventDefault()});contextifyId++};Plugin.prototype.destroy=function(){var el=$(this.element),options=$.extend({},this.options,el.data()),menu=$("#"+options.menuId);el.removeAttr("data-contextify-id").off("contextmenu").parents().off("mouseup",function(){menu.hide()});menu.remove()};$.fn[pluginName]=function(options){return this.each(function(){if($.data(this,"plugin_"+pluginName)&&Object.prototype.toString.call(options)==="[object String]"){$.data(this,"plugin_"+pluginName)[options]()}else{if(!$.data(this,"plugin_"+pluginName)){$.data(this,"plugin_"+pluginName,new Plugin(this,options))}}})}}));
* jQuery Contextify v1.0.7 (http://contextify.js.org)
* Copyright (c) 2016 Adam Bouqdib
* Licensed under GPL-2.0 (http://abemedia.co.uk/license)
*/
(function (factory) {
if (typeof define === "function" && define.amd) {
define(["jquery"], factory)
} else {
factory(jQuery, window)
}
}(function ($, window) {
var pluginName = "contextify",
defaults = {
items: [],
action: "contextmenu",
menuId: "contextify-menu",
menuClass: "dropdown-menu",
headerClass: "dropdown-header",
dividerClass: "divider",
before: false
},
contextifyId = 0;
function Plugin(element, options) {
this.element = element;
this.options = $.extend({}, defaults, options);
this._defaults = defaults;
this._name = pluginName;
this.init()
}
Plugin.prototype.init = function () {
var options = $.extend({}, this.options, $(this.element).data()),
that = $(this);
options.id = contextifyId;
$(this.element).attr("data-contextify-id", options.id).on("contextmenu", function (e) {
e.preventDefault();
if (typeof (options.before) === "function") {
options.before(this, options)
}
var menu = $('<ul class="' + options.menuClass + '" role="menu" id="' + options.menuId +
'" data-contextify-id="' + options.id + '"/>');
menu.data(options);
var l = options.items.length;
var i;
for (i = 0; i < l; i++) {
var item = options.items[i];
var el = $("<li/>");
if (item.divider) {
el.addClass(options.dividerClass)
} else {
if (item.header) {
el.addClass(options.headerClass);
el.html(item.header)
} else {
el.append("<a/>");
var a = el.find("a");
if (item.href) {
a.attr("href", item.href)
}
if (item.onclick) {
a.on("click", options, item.onclick);
a.css("cursor", "pointer")
}
if (item.data) {
for (var data in item.data) {
menu.attr("data-" + data, item.data[data])
}
a.data(item.data)
}
a.html(item.text)
}
}
menu.append(el)
}
var currentMenu = $("#" + options.menuId);
if (currentMenu.length > 0) {
if (currentMenu !== menu) {
currentMenu.replaceWith(menu)
}
} else {
$("body").append(menu)
}
var clientTop = e.clientY,
x = (menu.width() + e.clientX < $(window).width()) ? e.clientX : e.clientX - menu.width(),
y = (menu.height() + e.clientY < $(window).height()) ? clientTop : clientTop - menu
.height();
menu.css("top", y).css("left", x).css("position", "fixed").show();
$(document).one("click", function (e) {
$("#" + options.menuId).hide();
e.preventDefault()
})
}).one("click", function (e) {
$("#" + options.menuId).hide();
e.preventDefault()
});
contextifyId++
};
Plugin.prototype.destroy = function () {
var el = $(this.element),
options = $.extend({}, this.options, el.data()),
menu = $("#" + options.menuId);
el.removeAttr("data-contextify-id").off("contextmenu").parents().off("mouseup", function () {
menu.hide()
});
menu.remove()
};
$.fn[pluginName] = function (options) {
return this.each(function () {
if ($.data(this, "plugin_" + pluginName) && Object.prototype.toString.call(options) ===
"[object String]") {
$.data(this, "plugin_" + pluginName)[options]()
} else {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Plugin(this, options))
}
}
})
}
}));