FrozenNode / Laravel-Administrator

An administrative interface package for Laravel
http://administrator.frozennode.com/
MIT License
1.94k stars 503 forks source link

Filemanager for CKEditor - a real must-have #667

Open frzsombor opened 9 years ago

frzsombor commented 9 years ago

The only thing I really, really miss from the wysiwyg editor (CKEditor) is the ability to upload, browse pictures, files, etc. It's a must-have for creating nice articles for end-users. But the official CKFinder costs $$ for CKEditor.

How about moving to TinyMCE which has pretty awesome Responsive Filemanager (github)

Or maybe port the above filemanager to get it work with CKEditor? (anyone has the skills for CKEditor?)

Or use the built-in FileBrowser plugin (which is only the JS part) and create the custom upload.php, browser.php for it (anyone in the mood?)

Or use any of the two mentionable free CKFinder alternatives (how about security?): KCFinder (github) Roxy Fileman (no github)

I'm currently working on a project that really needs this feature within a reasonable time, so if you guys just put your vote on any of the options above, I will try my best to do it, and will submit a PR that you can tweak, edit until it fully satisfies your needs, and then you can merge it into the project

frzsombor commented 9 years ago

After a long consideration, I thought the easiest and best way is to use KCFinder. It works beautifully with CKEditor and also supports integration, so this is an other great feature here.

After I finished creating the integration file for KCFinder here is how to use it in an example model config:

<?php 

/* Example model config */

return array(

    'title' => 'Example',
    'single' => 'example',
    'model' => 'Example',

    'columns' => array(
        //...
    ),

    'edit_fields' => array(
        //...
        'content' => array(
            'title' => 'Content',
            'type' => 'wysiwyg',
            'kcfinder' => array(
                /**
                * You can find all the default and configurable
                * options here: http://kcfinder.sunhater.com/install
                * in the Configuration -> Dynamic Settings paragraph
                **/
                'disabled' => false,   //this is the default way to enable, but
                //'enabled' => true,   //you can also use enabled => true 
                'uploadURL' => '../../../../../uploads',   //this is the default 'public/uploads' folder
                'uploadPath' => public_path(). '/uploads', //this is the default 'public/uploads' folder
                //etc...
            ),
        ),
        //...
    ),

    //...
);

@janhartigan: I worked a few days full time to figure out this integration and create the integration file for KCFinder and LA. Please, if you have some time, take a look into this (I mean the laravel part), and let me know if you like it or not. I'm ready to make any changes, then submit a PR to KCFinder, then a PR here.

janhartigan commented 9 years ago

@frzsombor in principle this looks fine. Is there a PR open for this or some Administrator-side code that I could take a look at?

frzsombor commented 9 years ago

Yes of course, you can take a look at the kcfinder branch of my fork

janhartigan commented 9 years ago

If KCFinder has a composer.json, should it really be included in the Administrator public js repo? Any way we can avoid managing that dependency on our own?

frzsombor commented 9 years ago

@janhartigan Well, that's what I also thought, but then I saw that ckeditor is also included in Administrators repo, even if it is up on packagist.org. (And even if ckeditor is included in the repo I've also found ckeditor in Administrators composer.json and that's why I don't really understand what's goning on and what should I do). I just put KCFinder in my fork just the way I saw CKEditor. But of course, as you wish, tell me what should I do. :)

janhartigan commented 9 years ago

@frzsombor it appears that ckeditor was never removed from the public directory after this commit. If you'd like, you can bundle that change in with this one. The composer method is the preferable way to go.

frzsombor commented 9 years ago

Ok, I've submitted a PR to the KCFinder project with the integration file. Once it gets merged, I will update my branch, remove KCFinder, and CKEditor, and include them in the composer.json. I hope I can submit a PR soon.

frzsombor commented 9 years ago

My PR has been merged to KCFinder. Currently I'm working on solving #382, and as it is related to CKEditor, first I would like to fix that, before submitting anything related to CKEditor. Also if you have some time, I would really appreciate a little help.

centiveo commented 9 years ago

So, what's the easiest solution to integrate a filebrowser now? Will it be available in a future Administrator update?

frzsombor commented 9 years ago

I hope it will be. But first I would like to solve issue 382 as I wrote above as it's also related to ckeditor. Until then feel free to clone the kcfinder branch of my fork. I think I've finished it, and it's working 100%, but please use it on your own risk. I didn't have time to create docs for it, but you can find all the informations you need in this comment.

miroc commented 9 years ago

Any update on this? Will KCFinder be included in some future? Thanks!