Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not select file #56

Open
artsim opened this issue Jul 17, 2013 · 7 comments
Open

Can not select file #56

artsim opened this issue Jul 17, 2013 · 7 comments

Comments

@artsim
Copy link

artsim commented Jul 17, 2013

filebrowser

I do not have a way of selecting and inserting the file.

Running on Django 1.5 and the pull request #55 from @chielteuben

The admin section is running on django-admin-bootstrapped.

@caa
Copy link

caa commented Oct 26, 2013

I just started using https://github.com/jose-lpa/django-filebrowser-no-grappelli and his branch looks good except for the "select file" issue. I just wasted like ten hours on this trying to get this working right with TinyMCE.

If you put this in your project's settings file, you'll be able to link to all the file types listed in filebrowser/settings.py EXTENSIONS dictionary. The image, file, and media keys in the following dictionary are used when you click on the image, link, and media icons in TinyMCE's toolbar respectively.

screenshot 2013-10-26 00 27 30

The following settings are for django-tinymce.

FILEBROWSER_SELECT_FORMATS = {
    # image is used when you click on "Insert/edit image" icon
    'image': ['Image'],
    # file is used when you click on "Insert/edit link" icon
    'file': ['Folder','Image','Video','Document','Audio','Code'],
    # media is probably used when you click on "Insert/edit media" icon
    'media': ['Video','Audio'],
}

FYI These are the extensions in filebrowser's settings.py, which you can override.

EXTENSIONS = getattr(settings, "FILEBROWSER_EXTENSIONS", {
    'Folder': [''],
    'Image': ['.jpg','.jpeg','.gif','.png','.tif','.tiff'],
    'Video': ['.mov','.wmv','.mpeg','.mpg','.avi','.rm'],
    'Document': ['.pdf','.doc','.rtf','.txt','.xls','.csv'],
    'Audio': ['.mp3','.mp4','.wav','.aiff','.midi','.m4p'],
    'Code': ['.html','.py','.js','.css']
})

@gauravnagia
Copy link

Hi,

I am facing the same problem (not seeing the Select Buttons at all). It seems like django-filebrowser-no-grapelli is working fine, but I am making some mistakes in integrating with django-tinymce.
I added the 2 variables in settings.py of filebrowser-
URL_TINYMCE = getattr(settings, "FILEBROWSER_URL_TINYMCE", DEFAULT_URL_TINYMCE)
PATH_TINYMCE = getattr(settings, "FILEBROWSER_PATH_TINYMCE", DEFAULT_PATH_TINYMCE)

Please suggest what extra settings are required.
I installed the below using pip and used with admin site-
Django==1.5.4
django-tinymce==1.5.2
Pillow==2.3.0
django-filebrowser-no-grappelli==3.1.1

I am new to django frameworks, so would be grateful if you could elaborate the further steps required.
Thanks in advance.

Regards,
Gaurav

@caa
Copy link

caa commented Feb 19, 2014

Try using this branch of django-tinymce https://github.com/aljosa/django-tinymce. django-tinymce 1.5.2 is really old. You should use maintained versions of both django-tinymce & django-filebrowser. You shouldn't have to monkey with any apps' settings.py file.

Wardi's branch of django-filebrowser also has issues. He's not merging the fixes that other people have completed. I recommend this branch https://github.com/jose-lpa/django-filebrowser-no-grappelli.

Make sure you have the following in your project's settings.py file (not filebrowser's).

FILEBROWSER_SELECT_FORMATS = {
    # image is used when you click on "Insert/edit image" icon
    'image': ['Image'],
    # file is used when you click on "Insert/edit link" icon
    'file': ['Folder','Image','Video','Document','Audio','Code'],
    # media is probably used when you click on "Insert/edit media" icon
    'media': ['Video','Audio'],
}

I hope you can get it working soon. Good luck.

@gauravnagia
Copy link

Hi,

I am still facing issues in getting it working. Here is my new Requirements file-
django==1.5.1
Pillow==2.3.0
https://github.com/jose-lpa/django-filebrowser-no-grappelli/zipball/master#egg=filebrowser
https://github.com/aljosa/django-tinymce/zipball/master#egg=tinymce

I reverted all the changes except adding 'FILEBROWSER_SELECT_FORMATS' in settings.py file of my project.

But still getting the same result, Not seeing the select buttons. for any of the filetype.
qa_viewer

Please suggest if I am missing something.
Regards,
Gaurav

@wardi
Copy link
Owner

wardi commented Feb 19, 2014

@caa thank you for pointing that out. I've merged jose-lpa's branch

@caa
Copy link

caa commented Feb 20, 2014

@wardi that's great news! Thank you for having a branch of django-filebrowser. It helped me out a lot.

@gauravnagia I noticed there isn't a column for selections. It might be because nothing is selectable. Have you overridden any of filebrowser's templates by any chance?

Here's my other settings in settings.py. Sorry I forgot to include them. PROJECT_PATH is your full project path. This config assumes the static & media folders are in your project directory. You'll probably have to change the paths to suit your project. Hope this helps. I'm using Django 1.6 here.

MEDIA_URL = '/media/'
STATIC_URL = '/static/'

# Django Tinymce app settings
TINYMCE_JS_URL = '/static/tiny_mce/tiny_mce.js'
TINYMCE_JS_ROOT = PROJECT_PATH + 'tiny_mce'
TINYMCE_DEFAULT_CONFIG = {
    'theme' : "advanced",
    'plugins' : "inlinepopups, paste, media, table, fullscreen",
    # Fix Url, Js behaviors
    'convert_urls' : False,
    'relative_urls' : False,
    'valid_elements' : "*[*]",
    # Theme options
    'theme_advanced_buttons1_add' : "|,fullscreen",
    'theme_advanced_buttons3_add' : "media,|,pastetext,pasteword,|,tablecontrols",
    'theme_advanced_toolbar_location' : "top",
    'theme_advanced_toolbar_align' : "left",
    'theme_advanced_statusbar_location' : "bottom",
    'theme_advanced_resizing' : True,
    # STYLING
    'width' : '85%', 'height' : '500px',
}

FILEBROWSER_DIRECTORY = ''
FILEBROWSER_URL_FILEBROWSER_MEDIA = '/static/filebrowser/'
FILEBROWSER_PATH_FILEBROWSER_MEDIA =  PROJECT_PATH + FILEBROWSER_URL_FILEBROWSER_MEDIA
FILEBROWSER_DEFAULT_SORTING_BY = 'filename_lower'
FILEBROWSER_DEFAULT_SORTING_ORDER = 'asc'
FILEBROWSER_MAX_UPLOAD_SIZE = 1024*1024*100

Here's a screenshot. My settings make even folders selectable.
screenshot 2014-02-19 15 25 36

If this doesn't work maybe we can do a Google Hangout, Skype or Facetime.

@gauravnagia
Copy link

Hi,
Sorry for bothering you again. :)
I changed the settings exactly how you mentioned but I am still not able to see the 'Select' Buttons. Also I am not overriding any of filebrowser's template. Could you please contact me on my email id ([email protected])?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants