Elfinder: How can I open elfinder in a new window and get selected image path from it?

Created on 20 Sep 2013  Β·  11Comments  Β·  Source: Studio-42/elFinder

I want to open elfinder in a new window, like

window.open('path_to_el_finder', '_blank', 'height=520,width=950')

And if I select some file, I want to get it in my input field.
I think it is possible, but I cannot find the solution.

Most helpful comment

Sorry, already figured out:

$('#elfinder_button').live('click', function() {
            $('<div id="editor" />').dialogelfinder({
                url : '{{ path('ef_connect') }}',
                getFileCallback: function(file) {
                    $('#editor').dialogelfinder('close');
                    $('#editor').closest('.elfinder').val(file.path);
                    console.log($('#editor').closest('.elfinder-input'));
                    console.log(file.url);
                }
            });
        });

All 11 comments

Sorry, already figured out:

$('#elfinder_button').live('click', function() {
            $('<div id="editor" />').dialogelfinder({
                url : '{{ path('ef_connect') }}',
                getFileCallback: function(file) {
                    $('#editor').dialogelfinder('close');
                    $('#editor').closest('.elfinder').val(file.path);
                    console.log($('#editor').closest('.elfinder-input'));
                    console.log(file.url);
                }
            });
        });

try:

         $('<div \>').dialog({modal: true, width: "80%", title: "Select your file", zIndex: 99999,
                create: function(event, ui) {
                    $(this).elfinder({
                        resizable: false,
                        url: "path to connector",
                        commandsOptions: {
                          getfile: {
                            oncomplete: 'destroy' 
                          }
                        },                            
                        getFileCallback: function(file) {
                            document.getElementById('fileurl').value = file; 
                            jQuery('a.ui-dialog-titlebar-close[role="button"]').click();
                        }
                    }).elfinder('instance')
                }
            });

Hi,

Does this code opens elfinder in a modal window ?

Where should I paste this code ?

That would be a good begining for me because i'd like to open elfinder in a modal window using ckeditor.

Thx

I made something so i can put elfinder in a fancybox modal.
Maby the code helps you..

function elFinder()
    {
    elfinderrel = $('#elfinderselect').attr('rel');

    $('#elfinderselect').elfinder(
    {
        lang: 'nl',
        url: 'framework/apps/elfinder/php/connector.php', // connector
        urlUpload: 'framework/apps/elfinder/php/connector.php',
        uiOptions:
            {
            // toolbar configuration
            toolbar:
                [
                    ['back', 'forward'],
                    ['reload'],
                    ['mkdir', 'mkfile', 'upload'],
                    ['open', 'download', 'getfile'],
                    ['info'],
                    ['quicklook'],
                    ['copy', 'cut', 'paste'],
                    ['rm'],
                    ['duplicate', 'rename', 'edit', 'resize'],
                    ['extract', 'archive'],
                    ['search'],
                    ['view']
                ]
            },
            commandsOptions:
            {
            getfile:
            {
                oncomplete: 'destroy'
            }
            },
            getFileCallback: function(file)
            {
            console.log(elfinderrel);

            returnvalue = elfinderrel;
            $('.'+returnvalue).val(file['path']);
            $.fancybox.close();
            }
    }).elfinder('instance');
    }

    $('#elfinder_button').live('click', function()
    {
    thisbutton = $(this);
    thisbuttonrel = $(this).attr('rel');

    $.fancybox({
        content: '<div id="elfinderselect"></div>',
        afterShow: function()
        {
        console.log(thisbuttonrel);
        $('#elfinderselect').attr('rel', $(thisbutton).attr('rel'));
        elFinder();
        },

        closeBtn: false,
        maxWidth: 900,
        maxHeight: 700
    });
    });

is there a way to do this using pure javascript and not by using jQuery?

NAVER - http://www.naver.com/

[email protected] λ‹˜κ»˜ 보내신 메일


λ°›λŠ” μ‚¬λžŒμ΄ νšŒμ›λ‹˜μ˜ 메일을 μˆ˜μ‹ μ°¨λ‹¨ ν•˜μ˜€μŠ΅λ‹ˆλ‹€.


Im sure there is a way to achieve this withouten any Jquery.
I dont know how because i use Jquery all the time.
I dont fancy long JavaScript codes in my projects.

i don't think it will be a long code.. here's an example for the CKFinder

var finder = new CKFinder();
finder.callback = function(api){
api.hideTool('f0');
api.hideTool('f2');
};
finder.selectActionFunction = function(fileUrl){
el.parentElement.children[0].value = fileUrl;
};
finder.popup();

Cool! But i still dont know how to build a modal in pure JS.
It just works with Jquery, you'll have to build it yourself.

it will be fine if it does not using a modal.

NAVER - http://www.naver.com/

[email protected] λ‹˜κ»˜ 보내신 메일


λ°›λŠ” μ‚¬λžŒμ΄ νšŒμ›λ‹˜μ˜ 메일을 μˆ˜μ‹ μ°¨λ‹¨ ν•˜μ˜€μŠ΅λ‹ˆλ‹€.


Was this page helpful?
0 / 5 - 0 ratings

Related issues

dleffler picture dleffler  Β·  11Comments

ioaoue picture ioaoue  Β·  11Comments

flack picture flack  Β·  13Comments

jacceko picture jacceko  Β·  17Comments

hayes-seyah09354085977 picture hayes-seyah09354085977  Β·  17Comments