TinyMCE& MoxieManager:来自MoxieManager的url不会被传递给TinyMCE

时间:2014-06-25 16:10:49

标签: javascript php jquery tinymce mcimagemanager

我正在与MoxieManager 1.3.3一起运行TinyMCE 4.0b。

当我使用TinyMCE中的“插入文件”按钮直接打开Moxiemanager时,我将成功插入图像。 当我使用'链接'/'图像'/'媒体'对话框我在MoxieManager中选择正确的图像时,api.php-response显示正确的图像网址,但在TinyMCE对话框中显示当前的网址页面是可见的(而不是图像网址!)

我已经尝试更改rootpath,path,file_和image_template,relative_urls,但似乎没有任何帮助。 有没有人知道为什么TinyMCE无法收到正确的图片网址?

从MoxieManager API收到的网址路径: URL path as received from MoxieManager API

图像/文件对话框中的URL路径 URL path in image / file dialog box

初始化代码:

tinymce.init({
height                  : 380,
width                   : '100%',

mode                    : "textareas",
editor_selector         : "mceEditor",
language                : "nl",
invalid_elements        : "textarea",

fix_list_elements       : true,

remove_script_host      : true,
media_use_script        : true,
entity_encoding         : "numeric",
paste_auto_cleanup_on_paste     : true,

skin                    : 'bp',
menubar                 : false,
statusbar               : false,

image_advtab            :true,

plugins                 : "moxiemanager,advlist,autolink,lists,link,textcolor,image,charmap,print,preview,anchor,searchreplace,visualblocks,code,fullscreen,insertdatetime,media,table,wordcount,contextmenu,paste,autosave,colorpicker",

relative_urls           : false,
toolbar                 : "insertfile image media | formatselect styleselect | bold italic underline forecolor | alignleft aligncenter alignright alignjustify | paste searchreplace | bullist numlist | removeformat hr charmap | link unlink anchor | fullscreen code table",

contextmenu             : "link image inserttable | cell row column tableprops deletetable",

link_list               :   window.location.protocol + '//'+location.hostname+'/javascript/tinymce4/jscripts/tiny_mce/plugins/link/myexternallist.php',

moxiemanager_image_settings :   {
                                    view: 'thumbs',
                                    path: '/gfx',
                                    exclude_directory_pattern: '/^(mcith|.svn|export)$/i',
                                    title: 'Image management',
                                    extensions: 'jpg,JPG,jpeg,JPEG,gif,GIF,png,PNG'
                                },
moxiemanager_file_settings  :   {
                                    view: 'files',
                                    path: '',
                                    exclude_directory_pattern: '/^(mcith|.svn|gfx|export)$/i',
                                    title: 'File Management',
                                    extensions: 'swf,SWF,pdf,PDF,doc,DOC,docx,DOCX,zip,ZIP,xls,XLS,xlsx,XLSX,csv,CSV,avi,AVI,mov,MOV,mp4,MP4,flv,FLV,m4v,M4V'
                                },
moxiemanager_media_settings :   {
                                    view: 'files',
                                    path: '/media',
                                    exclude_directory_pattern: '/^(mcith|.svn|gfx|export)$/i',
                                    title: 'Media Management',
                                    extensions: 'swf,SWF,avi,AVI,mov,MOV,mp4,MP4,flv,FLV,m4v,M4V'
                                },
//moxiemanager_view         :   'thumbs',
moxiemanager_leftpanel      :   false,
moxiemanager_image_template :   '<img src="https://url.ext/user/{$path}" width="{$meta.width}" height="{$meta.height}" />',
moxiemanager_file_template  :   '<a href="https://url.ext/user/<?= $site['name']; ?>{$path}" target="_blank">{$name}</a>',
moxiemanager_user           :   '<?= $_SESSION['username'] ?>', 

style_formats       : [
    { title : 'Paragraph', block : 'p', classes : '', styles : { } },
    { title : 'Header 1', block : 'h1', classes : '', styles : { } },
    { title : 'Header 2', block : 'h2', classes : '', styles : { } },
    { title : 'Header 3', block : 'h3', classes : '', styles : { } },
    { title : 'Header 4', block : 'h4', classes : '', styles : { } },
    { title : 'Header 5', block : 'h5', classes : '', styles : { } },
    { title : 'Header 6', block : 'h6', classes : '', styles : { } },
]
});

Moxiemanager配置:

<?php
//includes de config om toegang te verkrijgen tot de SESSION. Dit is nodig omdat hier bepaald moet worden wat de username is van de gebruiker om zo het rootpath aan te wijzen.
include($_SERVER['DOCUMENT_ROOT'].'/include/init.php');

$langUrl = JAVASCRIPT. 'tinymce4/jscripts/tiny_mce/plugins/moxiemanager/langs/moxman_nl_NL.js';
$sUsername = $_SESSION['username'];
//     if ($sUsername == '' || $sUsername == 'undefined') die('ERROR: Attempted to load the moxiemanager without being logged into app, this should never happen.');

// General
$moxieManagerConfig['general.license']          =   'XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX-XXXX';
$moxieManagerConfig['general.hidden_tools']     =   '';
$moxieManagerConfig['general.disabled_tools']   =   '';
//$moxieManagerConfig['general.plugins']            =   'History,Uploaded,Quota';
$moxieManagerConfig['general.plugins']          =   'History,Uploaded';
$moxieManagerConfig['general.demo']             =   false;
$moxieManagerConfig['general.debug']            =   false;
$moxieManagerConfig['general.language']         =   'nl_NL';
$moxieManagerConfig['general.temp_dir']         =   "https://url.ext/user/moxietmp"; 
$moxieManagerConfig['general.allow_override']   =   'hidden_tools,disabled_tools';

// !!dit stuk in de config is nodig, ook al set de 'browse' functie deze dmv setFileManager in main.js, die functie wordt aangeroepen in afbeeldingenList.php en downloadsList.php
// (let op, NIET tinyMce.php met de 'bestand invoegen' knoppen)

// Filesystem
//lib.js writes a cookie containing the latest window.location. We use this as a workaround to the fact that the relevant data from $_REQUEST['URI'] is not available in an ajax request in
//this context and $_REQUEST['HTTP_REFERER] is not reliable in older versions of IE
$moxieManagerConfig['filesystem.rootpath']                      =   "https://url.ext/user/".$sUsername."/";

$moxieManagerConfig['filesystem.include_directory_pattern']     =   '';
$moxieManagerConfig['filesystem.exclude_directory_pattern']     =   '/^(.svn|export)$/i';
$moxieManagerConfig['filesystem.include_file_pattern']          =   '';
$moxieManagerConfig['filesystem.exclude_file_pattern']          =   '';
$moxieManagerConfig['filesystem.extensions']                    =   'jpg,jpeg,png,gif,html,txt,docx,doc,zip,pdf,xls,xlsx,csv,avi,mov,mp4,flv,m4v';
$moxieManagerConfig['filesystem.readable']                      =   true;
$moxieManagerConfig['filesystem.writable']                      =   true;
$moxieManagerConfig['filesystem.allow_override']                =   '*';

// Createdir
$moxieManagerConfig['createdir.templates']                      =   '';
$moxieManagerConfig['createdir.include_directory_pattern']      =   '';
$moxieManagerConfig['createdir.exclude_directory_pattern']      =   '';
$moxieManagerConfig['createdir.allow_override']                 =   '*';

// Createdoc
$moxieManagerConfig['createdoc.templates']                      =   '';
$moxieManagerConfig['createdoc.fields']                         =   'Document title=title';
$moxieManagerConfig['createdoc.include_file_pattern']           =   '';
$moxieManagerConfig['createdoc.exclude_file_pattern']           =   '';
$moxieManagerConfig['createdoc.extensions']                     =   '*';
$moxieManagerConfig['createdoc.allow_override']                 =   '*';

// Upload
$moxieManagerConfig['upload.include_file_pattern']              =   '';
$moxieManagerConfig['upload.exclude_file_pattern']              =   '';
$moxieManagerConfig['upload.extensions']                        =   '*';
$moxieManagerConfig['upload.maxsize']                           =   '100MB';
$moxieManagerConfig['upload.overwrite']                         =   false;
$moxieManagerConfig['upload.autoresize']                        =   false;
$moxieManagerConfig['upload.autoresize_jpeg_quality']           =   90;
$moxieManagerConfig['upload.max_width']                         =   800;
$moxieManagerConfig['upload.max_height']                        =   600;
$moxieManagerConfig['upload.chunk_size']                        =   '5mb';
$moxieManagerConfig['upload.allow_override']                    =   '*';

// Rename
$moxieManagerConfig['rename.include_file_pattern']              =   '';
$moxieManagerConfig['rename.exclude_file_pattern']              =   '';
$moxieManagerConfig['rename.include_directory_pattern']         =   '';
$moxieManagerConfig['rename.exclude_directory_pattern']         =   '';
$moxieManagerConfig['rename.extensions']                        =   '*';
$moxieManagerConfig['rename.allow_override']                    =   '*';

// Edit
$moxieManagerConfig['edit.include_file_pattern']                =   '';
$moxieManagerConfig['edit.exclude_file_pattern']                =   '';
$moxieManagerConfig['edit.extensions']                          =   'jpg,jpeg,png,gif,html,htm,txt';
$moxieManagerConfig['edit.jpeg_quality']                        =   90;
$moxieManagerConfig['edit.allow_override']                      =   '*';

// View
$moxieManagerConfig['view.include_file_pattern']                =   '';
$moxieManagerConfig['view.exclude_file_pattern']                =   '';
$moxieManagerConfig['view.extensions']                          =   'jpg,jpeg,png,gif,html,htm,txt,pdf';
$moxieManagerConfig['view.allow_override']                      =   '*';

// Download
$moxieManagerConfig['download.include_file_pattern']            =   '';
$moxieManagerConfig['download.exclude_file_pattern']            =   '';
$moxieManagerConfig['download.extensions']                      =   '*';
$moxieManagerConfig['download.allow_override']                  =   '*';

// Thumbnail
$moxieManagerConfig['thumbnail.enabled']                        =   true;
$moxieManagerConfig['thumbnail.auto_generate']                  =   true;
$moxieManagerConfig['thumbnail.use_exif']                       =   true;
$moxieManagerConfig['thumbnail.width']                          =   90;
$moxieManagerConfig['thumbnail.height']                         =   90;
$moxieManagerConfig['thumbnail.mode']                           =   "resize";
$moxieManagerConfig['thumbnail.folder']                         =   'mcith';
$moxieManagerConfig['thumbnail.prefix']                         =   'mcith_';
$moxieManagerConfig['thumbnail.delete']                         =   true;
$moxieManagerConfig['thumbnail.jpeg_quality']                   =   75;
$moxieManagerConfig['thumbnail.allow_override']                 =   '*';

// Authentication
$moxieManagerConfig['authenticator']                            =   '';
$moxieManagerConfig['authenticator.login_page']                 =   '';


// IpAuthenticator
$moxieManagerConfig['IpAuthenticator.ip_numbers']               =   '127.0.0.1';

// ExternalAuthenticator
$moxieManagerConfig['ExternalAuthenticator.external_auth_url']  =   '';
$moxieManagerConfig['ExternalAuthenticator.secret_key']         =   '';

// Local filesystem
$moxieManagerConfig['filesystem.local.wwwroot']                 =   '';
$moxieManagerConfig['filesystem.local.urlprefix']               =   '';
$moxieManagerConfig['filesystem.local.urlsuffix']               =   '';
$moxieManagerConfig['filesystem.local.access_file_name']        =   'mc_access';
$moxieManagerConfig['filesystem.local.cache']                   =   false;
$moxieManagerConfig['filesystem.local.allow_override']          =   '*';

// Log
$moxieManagerConfig['log.enabled']                              =   false;
$moxieManagerConfig['log.level']                                =   'error';
$moxieManagerConfig['log.path']                                 =   'data/logs';
$moxieManagerConfig['log.filename']                             =   '{level}.log';
$moxieManagerConfig['log.format']                               =   '[{time}] [{level}] {message}';
$moxieManagerConfig['log.max_size']                             =   '100k';
$moxieManagerConfig['log.max_files']                            =   '10';
$moxieManagerConfig['log.filter']                               =   '';

// Cache
$moxieManagerConfig['cache.connection']                         =   "sqlite:./data/storage/cache.s3db";

// Storage
$moxieManagerConfig['storage.engine']                           =   'json';
$moxieManagerConfig['storage.path']                             =   './data/storage';

// AutoFormat plugin
$moxieManagerConfig['autoformat.rules']                         =   '';
$moxieManagerConfig['autoformat.jpeg_quality']                  =   90;
$moxieManagerConfig['autoformat.delete_format_images']          =   true;

// AutoRename, remember to include it in your plugin config.
$moxieManagerConfig['autorename.enabled']                       =   false;
$moxieManagerConfig['autorename.spacechar']                     =   "_";
$moxieManagerConfig['autorename.lowercase']                     =   false;

// BasicAuthenticator plugin
$moxieManagerConfig['basicauthenticator.users']                 =   array(
                                                                        array("username" => "xxx", "password" => "xxxx", "groups" => array("administrator"))
                                                                    );

// GoogleDrive
$moxieManagerConfig['googledrive.client_id']                    =   '';

// DropBox
$moxieManagerConfig['dropbox.app_id']                           =   '';

// Amazon S3 plugin
$moxieManagerConfig['amazons3.buckets']                         =   array(
                                                                    'bucketname' =>     
                                                                        array(
                                                                            'publickey' => '',
                                                                            'secretkey' => ''
                                                                        )
                                                                    );

// Ftp plugin
$moxieManagerConfig['ftp.accounts']                             =   array(
                                                                    'ftpname' => 
                                                                        array(
                                                                            'host' => '',
                                                                            'user' => '',
                                                                            'password' => '',
                                                                            'rootpath' => '/',
                                                                            'wwwroot' => '/',
                                                                            'passive' => true
                                                                        )
                                                                    );

// Favorites plugin
$moxieManagerConfig['favorites.max']                            =   0;

// History plugin
$moxieManagerConfig['history.max']                              =   0;

// Quota plugin
$moxieManagerConfig['quota.max_size']                           =   ( is_numeric( $_SESSION['moxManQuota'] ) ) ? $_SESSION['moxManQuota']."m" : "10m";
?>

1 个答案:

答案 0 :(得分:2)

这是一个非常晚的答案,但定义正确的wwwroot设置足以解决它。我的工作参数指向我的Web根目录,看起来像$moxieManagerConfig['filesystem.local.wwwroot'] = realpath(dirname(__FILE__) . '/../../../../..');