elFinder-从用户输入动态加载路径


elFinder - load path dynamically from user input

我已经在本地xampp服务器上安装了elFinder v2.1文件管理器。一切似乎都很顺利。下面是我的connector.php;

function access($attr, $path, $data, $volume) {
return strpos(basename($path), '.') === 0
    ? !($attr == 'read' || $attr == 'write')
    :  null;}
$emp_id = 'sm_dir_name';
$opts = array(
    'bind' => array(
    'mkdir mkfile rename duplicate upload rm paste' => array($myLogger, 'log'),
       ),
       'roots' => array(
          array(
             'driver'         => 'LocalFileSystem',
             'path'           => '../../lib/lib_emp/'.$emp_id,
             'URL'            => dirname($_SERVER['PHP_SELF']) . '/../../lib/lib_emp/'.$emp_id, 
             'accessControl'  => 'access',             
             'uploadOverwrite'=> false,
        'debug'               => false,
        'arc'                 => '7za',
        'fileURL'             => true,
etc...;

这是我初始化elFinder的index.php文件;

$(document).ready(function() {
var elf = $('#elfinder').elfinder({
           url             : 'css/connector.php',
           commandsOptions : {
              edit            : {
                        mimes : ['text/plain', 'text/html', 'text/javascript', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'], //types to edit
              editors: [{
                        mimes : ['text/plain', 'text/html', 'text/javascript', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
          load: function(textarea) {
            $(textarea).ckeditor();
          },
          close: function(textarea, instance) {
            CKEDITOR.instances[textarea.id].destroy();
          },
          save: function(textarea, editor) {
            textarea.value = $(textarea).val();
            }
          }
        ]
      }
   }
 }).elfinder('instance');
});

我有以下几个问题;

  1. 如何在页面加载时禁用elFinder自动加载
  2. 如何初始化elfinder以使用所选的目录名称加载(客户端应该像$post方法一样向服务器发送值)我想我们可以将customData : {token : '42', test : 'test'},与elfinder initiate一起使用。我不知道如何从connector.php中检索这些值。每次用户点击load_emp按钮时,elFinder都应该刷新并指向所选的目录

一个月以来,我一直在搜索这个以及更多关于elFinder的信息。elFinder开发团队的文档和支持非常差。

我恳请你回答这个问题,以及今后的问题。

谨致问候,

Supun

如何在页面加载时禁用elFinder自动加载?

客户端配置"rememberLastDir"(https://github.com/Studio-42/elFinder/wiki/Client-configuration-options-2.1#rememberLastDir)

如何启动elfinder以加载选定的目录名

连接器配置"startPath"(https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1#startPath)

使用URL散列

ex)

  • hypweb.net/elFinder nighty/demo/2.1/#elf_l2_Lw
  • hypweb.net/elFinder ninighty/demo/2.1/#elf_l1_V2VsY29tZQ