Question

right now I am trying to use the code, to have a list of images to be used and displayed to be selected, that i can later display on my tinymce enabled field.

the tinymce init block is something like:

 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'
    });

And my 'surveyImageBrowser' Function for the file_browser_callback is given as :

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;

        }

The issue is i dont want to give the URLs the permission to be seen globally (htaccess), but rather get the list of images from a perl script, and then use the list . the perl script looks something like :

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);

Can someone please suggest what changes i need to make to the function imageSurveyBrowser for it to work without providing htaccess

Was it helpful?

Solution

I would like to suggest that you need to be a bit more patient to make it work. But the best thing to do is follow this tiny_mce entry to the end. Don't give up in between. I did that mistake and paid with a couple of days of frustration

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top