TinyMCE folder_browser_callback生成列表

时间:2014-05-14 17:27:35

标签: javascript perl tinymce

现在我正在尝试使用代码,以便使用和显示要选择的图像列表,以后我可以在启用了tinymce的字段上显示。

tinymce init块类似于:

 tinyMCE.init({
'theme' : "advanced",
'mode' : "textareas",
'theme_advanced_toolbar_location' : "top",
'content_css' : "/skins.css",
'editor_selector' : "mceEditor",
'plugins' : "autolink,lists,spellchecker,pagebreak,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras",
   file_browser_callback : 'surveyImageBrowser', 
   'theme_advanced_toolbar_align' : "left",
    'theme_advanced_resizing' : true,
    'theme_advanced_statusbar_location' :'bottom'
    });

我的调查图像浏览器' file_browser_callback的函数如下:

function surveyImageBrowser(field_name,url,type,win){

var cmsURL       = '/local_image_folder'; 
var searchString = window.location.search;
if (searchString.length < 1) {
searchString = "?";
}

tinyMCE.activeEditor.windowManager.open({

file            : cmsURL,
title           : 'My File Browser',
width           : 420,  
height          : 400,
resizable       : "yes",
inline          : "yes",  
close_previous          : "no"

}, {
window  : win,
input   : field_name

});

var win     = tinyMCEPopup.getWindowArg("window");
var input   = tinyMCEPopup.getWindowArg("input");
var res     = tinyMCEPopup.getWindowArg("resizable");
var inline  = tinyMCEPopup.getWindowArg("inline");


return false;

        }

问题是我不想给URL提供全局(htaccess)的权限,而是从perl脚本获取图像列表,然后使用列表。 perl脚本看起来像:

my $dir = '/local_images_folder';


    opendir(DIR, $dir) or die $!;

    while (my $file = readdir(DIR)) {

        # Use a regular expression to ignore files beginning with a period
        next if ($file =~ m/^\./);

        print "$file\n";

    }

    closedir(DIR);

有人可以建议我需要对函数imageSurveyBrowser进行哪些更改才能在不提供htaccess的情况下工作

1 个答案:

答案 0 :(得分:0)

我想建议您需要更耐心才能使其发挥作用。但最好的办法是遵循这个tiny_mce条目到最后。不要放弃它们。我犯了那个错误并付出了几天的挫折感

http://www.tinymce.com/wiki.php/TinyMCE3x:How-to_implement_a_custom_file_browser