我正在與elfinder一起定製共享按鈕,有關於如何自定義右鍵菜單的教程,並且我已經實現了它。不過,也有一些規則,我想申請菜單自定義elfinder的右鍵菜單(一個jquery文件管理器插件)
1) For folder only, exclude the button for file
2) For root level only, exclude the button for sub level folder
3) For single folder only, if select more than one folder will exclude the button
下面是當前的代碼,現在有分享按鈕,但不符合上述規則:
elFinder.prototype.i18.zh_TW.messages['cmdsharefolder'] = 'Share';
elFinder.prototype._options.commands.push('sharefolder');
elFinder.prototype.commands.sharefolder = function() {
this.exec = function (hashes) {
//open share menu
}
this.getstate = function() {
return 0;
}
}
而且elfinder例如:
var elfinder = $('#elfinder').elfinder({
url: '<?= $connector; ?>',
soundPath: '<?= site_url('assets/plugins/elFinder/sounds/rm.wav'); ?>',
height: 700,
lang: 'zh_TW',
uiOptions: {
// toolbar configuration
toolbar: [
['back', 'forward'],
['reload'],
['mkdir', 'upload'],
['copy', 'cut', 'paste', 'rm'],
['rename'],
['view', 'sort']
]
},
contextmenu: {
navbar: ['open', '|', 'copy', 'cut', 'paste', 'duplicate', '|', 'rm', '|', 'info'],
cwd: ['reload', 'back', '|', 'upload', 'mkdir', 'paste', '|', 'info'],
files: [
'open', 'quicklook', 'sharefolder', '|', 'download', '|', 'copy', 'cut', 'paste', 'rm', '|', 'rename', '|', 'info'
]
},
ui: ['toolbar', 'tree', 'stat']
}).elfinder('instance');
的問題是:
1)如何應用這些規則AB奧雅納? (如果規則不適用,可以通過檢查和彈出警告框來解決,請建議檢查的方式,謝謝)
2)有沒有什麼方法可以捕獲選擇哪個文件夾,例如:完整的文件夾路徑等等
這是我所研究的文檔,樣本情況下是用於一般用途: https://github.com/Studio-42/elFinder/wiki/Custom-context-menu-command
非常感謝幫助。
我想你需要玩.getstate() 必須有'這',其中包含'文件',所以我會分析它,並基於'將返回-1 | 0;' – faster
文件夾具有分配的「目錄」類,也許你可以根據類的存在破解按鈕?不確定根...這個相似的主題可能會比我更多的光:http://stackoverflow.com/questions/28926500/how-to-get-current-directory-in-elfinder – LordNeo