When clicking on the links in the search results, if the link is to an image in a second level unselected subfolder, nothing happens and a JavaScript error is triggered:

"Uncaught TypeError: Cannot read property 'li' of undefined"

For example, with the "images" folder currently selected and the search results displaying something like the following, files in the nested folders cannot be navigated to.

FAIL: images/promos/nested/image.jpg
WORKS: images/promos/another_image.jpg

Comments

inversed’s picture

Issue summary: View changes
DaveH1234’s picture

Subscribing

eyilmaz’s picture

Subscribing

eyilmaz’s picture

Status: Active » Needs review
StatusFileSize
new2.77 KB

Here is a patch.
Works for me.
Please review and apply if it's ok.

eyilmaz’s picture

added one more line :)

eyilmaz’s picture

After deliberation, i think adding ajaxStop() after every navigation is not correct.
This event should be added on document.ready once or we should replace it with jquery.one('ajaxStop')..correct?

eyilmaz’s picture

replaced ajaxStop event with "one".
using list hook to highlight the file.

cammchugh’s picture

@eyilmaz I had been working on a patch that took a slightly different approach. A single ajax callback was issued for the directory containing the selected file (if not already cached), and the intermediate directories (if any) were inserted using imce.dirSubdirs prior to activating the target directory. It's a bit faster than ajax'ing all the intermediate directories, but functionally it's very similar. Just food for thought, otherwise your patch works for me.

eyilmaz’s picture

Hi @cammchugh

I think your way is elegant and more better than requesting ajax for every directory. In my case only one user uses this function. So the way I solve this issue is ok. But for a site with heavier use of this function it's simply an overhead to load every directory. Can you upload your patch?

cammchugh’s picture

Here you go. @eyilmaz, I used some of your patch as there were a few things you did that I liked. The big differences are:

  1. insert empty intermediate directories instead of actually loading them. Clicking an "empty" directory still ajaxes in the contents when needed
  2. used the 'navigate' hook instead of 'list' as its invoked every time the directory changes instead of the first time a directory's contents are loaded
  3. fixed another bug where clicking a result in the root directory failed
cammchugh’s picture

Oops. Here's the file.

eyilmaz’s picture

Nice, thank you. Sorry for the delayed answer. I will test your patch soon and write my feedback. Generally it looks clean and simple.. much better :)

eyilmaz’s picture

I've tested the patch, works as expected and fine.

There is only one unneeded trailing comma in object literal (line 87 of 90 of the patch).. I think this makes problem with IE8 and earlier?

cammchugh’s picture

Ah, yes, IE8 is still a thing isn't it ;) New patch without trailing comma, thanks for the catch.

rossb89’s picture

Also encountered this issue today.

Patch applies cleanly, and solves the issue as far as I can see.

eyilmaz’s picture

Status: Needs review » Reviewed & tested by the community

Changing status to reviewed.

ladybug_3777’s picture

Confirming this patch works

philipnorton42’s picture

I too can confirm this works.

  • brunoric committed b99d2f4 on 7.x-1.x
    Issue #2332261 by eyilmaz, cammchugh: IMCE Search results links to...
brunoric’s picture

Assigned: Unassigned » brunoric
Status: Reviewed & tested by the community » Fixed

Patch applied in version 7.x-1.3 and pushed to 7.x-1.x-dev release. Since I don't have permissions to make available the new release under the tag 7.x-1.3, please use the 7.x-1.x-dev version if you want this fix.

brunoric’s picture

Status: Fixed » Closed (fixed)
brunoric’s picture

brunoric’s picture

brunoric’s picture

Priority: Normal » Major

Just updating metadata information about the issue to better categorize it.