phuongdev89 / yii2-roxymce

MIT License
12 stars 15 forks source link

I don't understand 'FILES_ROOT' #1

Closed Marcuzzz closed 8 years ago

Marcuzzz commented 8 years ago

Hi,

I'm having trouble understanding 'FILES_ROOT' If I use the default setting: A folder is created at @backend/Users/"username"/"location"/"of"/"project"/backend/media/ (image: http://imgur.com/2aEA9ti) It's a strange location of course but I can upload,delete files to this folder with roxymce But when I try to preview a file for instance or use the widget, files will not view correctly because they need to be in the web folder.

So i've modified some of your code ending up with: $config['FILES_ROOT'] = '/web/media';

and changed this: //RoxyHelper.php public static function getFilesPath() { return FILES_ROOT; }

It now shows me the full contents of the folder media located at the base of the website. But unfortunately preview and widget still don't work correctly because now they are looking at /web/media instead of /media/

I'm a bit stuck, please help. thx!

Marcuzzz commented 8 years ago

I managed to fix this by adding this to main.js:

function getSelectedFile() {
    var ret         = null;
    var pnlFileList = $('#pnlFileList').find('.selected');
    if(pnlFileList.length > 0) {
                // Added .replace('web/','')
        ret = new File(pnlFileList.attr('data-path').replace('web/',''));
    }
    return ret;
}
phuongdev89 commented 8 years ago

Hi Marcuzzz, Thanks for your report. No need to fix main.js, just add a function to check basic or advanced kit & return match url

Marcuzzz commented 8 years ago

Yes, that would do it.