与tinymce预览路径错误的Roxy文件管理器

时间:2017-07-12 14:56:58

标签: javascript jquery tinymce roxy-fileman

我已经设置了这样的roxy文件管理器 - 来自app root的目录结构:

roxy文件目录 /公共/管理/ JS / FILEMAN

上传目录 /上传/ user_uploads

Roxy配置:

{
"FILES_ROOT":          "uploads/user_uploads",
"RETURN_URL_PREFIX":   "http://xyz.dev",
"SESSION_PATH_KEY":    "",
"THUMBS_VIEW_WIDTH":   "140",
"THUMBS_VIEW_HEIGHT":  "120",
"PREVIEW_THUMB_WIDTH": "100",
"PREVIEW_THUMB_HEIGHT":"100",
"MAX_IMAGE_WIDTH":     "1000",
"MAX_IMAGE_HEIGHT":    "1000",
"INTEGRATION":         "tinymce4",
"DIRLIST":             "php/dirtree.php",
"CREATEDIR":           "php/createdir.php",
"DELETEDIR":           "php/deletedir.php",
"MOVEDIR":             "php/movedir.php",
"COPYDIR":             "php/copydir.php",
"RENAMEDIR":           "php/renamedir.php",
"FILESLIST":           "php/fileslist.php",
"UPLOAD":              "php/upload.php",
"DOWNLOAD":            "php/download.php",
"DOWNLOADDIR":         "php/downloaddir.php",
"DELETEFILE":          "php/deletefile.php",
"MOVEFILE":            "php/movefile.php",
"COPYFILE":            "php/copyfile.php",
"RENAMEFILE":          "php/renamefile.php",
"GENERATETHUMB":       "php/thumb.php",
"DEFAULTVIEW":         "list",
"FORBIDDEN_UPLOADS":   "zip js jsp jsb mhtml mht xhtml xht php phtml php3 php4 php5 phps shtml jhtml pl sh py cgi exe application gadget hta cpl msc jar vb jse ws wsf wsc wsh ps1 ps2 psc1 psc2 msh msh1 msh2 inf reg scf msp scr dll msi vbs bat com pif cmd vxd cpl htpasswd htaccess",
"ALLOWED_UPLOADS":     "",
"FILEPERMISSIONS":     "0644",
"DIRPERMISSIONS":      "0755",
"LANG":                "auto",
"DATEFORMAT":          "dd/MM/yyyy HH:mm",
"OPEN_LAST_DIR":       "yes"
}

JS初始化代码:

$(function() {
        tinymce.init({
            selector: 'textarea',
            menubar: false,
            plugins: 'link image',
            toolbar: "link | image",
            file_browser_callback: RoxyFileBrowser
        });
    });

    function RoxyFileBrowser(field_name, url, type, win) {
        var roxyFileman = '/public/admin/js/fileman/index.html';
        if (roxyFileman.indexOf("?") < 0) {
            roxyFileman += "?type=" + type;
        }
        else {
            roxyFileman += "&type=" + type;
        }
        roxyFileman += '&input=' + field_name + '&value=' + win.document.getElementById(field_name).value;
        if(tinyMCE.activeEditor.settings.language){
            roxyFileman += '&langCode=' + tinyMCE.activeEditor.settings.language;
        }
        tinyMCE.activeEditor.windowManager.open({
            file: roxyFileman,
            title: 'Roxy Fileman',
            width: 850,
            height: 650,
            resizable: "yes",
            plugins: "media",
            inline: "yes",
            close_previous: "no"
        }, {     window: win,     input: field_name    });
        return false;
    }

上传工作和内容中文件的路径正确返回,但是当我在文件浏览器中单击预览文件时,它会从roxy文件目录开始转到错误的URL。它转到:

http://xyz.dev/public/admin/js/fileman/uploads/user_uploads/file.jpg

而不是:

http://xyz.dev/uploads/user_uploads/file.jpg

我做错了吗?我发现将roxy文件移到根目录之外是非常困惑的,并且所有指令都假设它将在root中。但我不希望这些文件存在于根目录中。

1 个答案:

答案 0 :(得分:-1)

尝试此代码您的问题将解决,

&#34; FILES_ROOT&#34;:&#34; / uploads / user_uploads&#34;