Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Google Sign In with OpenID

In admin: add wysiwyg to textarea and create yes/no select list

2

Comments

  • Thanks.

  • Re: multi-image upload: it doesn't display the thumbnail if the file name contains spaces.

  • Seems to show them fine for me. I uploaded a file named iOS Simulator Screen shot 2012-06-08 7.41.46 PM.png through drag and drop in the filemanager/util/multi-image uploader and it displays in the list and in the modal dialog too. What's the full name of the file that won't show?

  • edited March 2013

    It was something like image 7.jpg. I think it was missing on the edit screen; not sure about the add screen. However, I am having some trouble with editing so I'm having trouble checking right now. I will get back to this once I figure out the editing issue. (It's related to the site search (int) question.)

  • Hmm -- it's working fine for me, too. Not sure what the problem was. Probably PEBCAK.

  • I am trying to integrate the file manager with the add/edit handlers and views.

    If the user removes an image from the multi-image chooser, my handler deletes the file. I'm using php unlink and then calling Filemanager::prop_delete. Is there a Filemanager function that will do both?

    If they rename their property, my handler moves the images from /files/properties/old-property-id/ to /files/properties/new-property-id/ How do I update the filemanager descriptions stored in the db?

  • I couldn't figure out a good way to integrate captions into the admin edit screen with the multi-image preview, so I added it to the front end (if they are logged in):

    http://postimage.org/image/tbjo4kydr/

  • The biggest clunker so far is having to open the chooser dialog multiple times to choose images for the multi-image field. I'm not sure it's a deal-breaker, but it's close. It's got me racking my brains for workarounds. Uploads are so slick that they make this seem terribly antiquated.

    I guess one option would be to drop the multi-image field altogether and just have them do everything through the file manager.

  • I found an image file that doesn't display. It's not spaces that are the problem but url-encoded spaces, ie %20. I saved a web page from firefox, which url encoded the image names, and then when I uploaded them they didn't display. The original names were e.g. image 1 2008.jpg; firefox saved them as image%201%202008.jpg

  • I just finished adding drag and drop support to the multi-file and multi-image helpers, but multiple file selection in the dialog window will take longer to implement at this point I'm afraid.

    And it looks like it's a browser issue trying to render files with %20 in their names. Pasting this directly into an html file doesn't render the file:

    <img src="/files/foo%20bar.png">
    

    Although, encoding the % as %25 does work:

    <img src="/files/foo%2520bar.png">
    

    Of course, if I encode the value, which also contains the /files/, it would end up as %2Ffiles%2Ffoo%2520bar.png which also wouldn't render. So I think you may just need to rename the file :)

  • I think you're right about renaming the file. :)

    I'm having trouble with the drag and drop. It seems to work, but then the image disappears instead of taking its new place in the lineup. Firefox 19.0.2

  • Ah yes, from the jQuery forum they're saying it's a confirmed bug with Firefox, but adding helper: 'clone' to the sortable options seems to fix it :)

  • Re: selecting multiple -- would it be possible to capture if ctrl or shift were held while clicking and react accordingly?

  • That may be a possibility. What I was thinking was adding a 'Select' button to the dialog when a multiple option is set to true, and changing it so that clicking the images/files would highlight them as selected and only return them all once the Select button is clicked.

  • Would ctrl/shift be easier? It's a convention that's pretty widely used. (For instance, it works in the multi-file uploader.)

  • But after you've ctrl+clicked a few of the images, I guess you'll still need a 'Select' button to say "I'm done picking" and have the dialog return them to the callback function... Unless there's a way around that, I'm not sure I get how the ctrl+click might work on its own.

  • You're right, you'd need an "Insert" button or similar either way. For some reason I thought you said something about checkboxes.

  • Do you have any thoughts about how to integrate the app's admin screen with the file manager's properties dialog or about my posts here and here?

  • At the moment, there's no unified FileManager API at the PHP level. I've got it on my to-do list to refactor the REST API into a separate PHP class and REST service on top of that, that way you'll be able to say FileManager::move ($file, $to) and having it take care of everything behind the scenes. Unfortunately, that's still a bit messy in PHP.

    As for editing the description/caption alongside the file uploads, I'm afraid that would take creating a custom UI. The multi-image helper is too limited, but could be cloned and then customized from there to add caption fields.

    Sorry that's not much help...

  • No worries. So at the moment, should I do something like FileManager::prop_delete ($old_file, $prop) and then FileManager::prop_add ($new_file, $prop)? (Not looking at the code right now to see the actual function names or parameters.)

  • You can just use FileManager::prop_rename ($old_file, $new_file) after renaming a file, and the properties will all be updated.

  • Thanks.

  • I notice that if I hit "Enter" anywhere on the edit screen, the single image chooser pops up instead of the form submitting. I'm using code based on the code that you linked to, ie

        $('#browse-image').click (function () {
            $.filebrowser ({
                thumbs: true,
                title: '{"Choose an image"}',
                set_value: '#main_image',
                path: 'properties/{{id|Property::clean_image_name}}',
                callback: function (file) {
                    $('#main_image-preview').attr ('src', file);
                }
            });
            return false;
        });
    

    Did you build a single image function into the multi_image handler, by any chance?

  • I wonder if adding a tabindex="0" to the #browse-image button would solve that?

    And I'm not sure what you mean by a single image function in the multi_image handler...

  • Just being lazy -- this code is shorter. :)

        $.multi_image ({
            field: '#images',
            preview: '#images-preview',
            path: 'properties/{{id|Property::clean_image_name}}'
        });
    

    I'll try tabindex.

  • More importantly, it doesn't pop the chooser up when I hit enter.

  • tabindex="0" doesn't seem to change the behavior. I'm not sure why $('#browse-image').click causes it to pop up when I hit enter.

  • I think it might just be the way browsers behave:

    http://stackoverflow.com/questions/1963245/multiple-submit-buttons-specifying-default-button

    Looks like the first submit button on the page gets triggered on Enter.

  • I think you're right. In fact, I used to know that and have used floats to deal with the issue before. Maybe I'll just put a submit button at the top of the page, too.

Sign In or Register to comment.