Replace lines 19 to 24 ...

/*$(li).click(function () { 
  file = fullpath.substr(fullpath.lastIndexOf('/') + 1);
  dir = fullpath.substr(0, fullpath.lastIndexOf('/'));
  imce.dirActivate(dir);
  imce.highlight(file);
});*/

With :

$(li).click(function () {
  fullpath_split = fullpath.split('/');
  if(fullpath_split.length == 4)
    dir = '.';
  else
    dir = fullpath_split[fullpath_split.length - 2];
  file = fullpath_split[fullpath_split.length - 1];
  if(dir != imce.conf.dir)
    imce.navigate(dir);
  imce.highlight(file);
});

Comments

tekante’s picture

Status: Needs review » Needs work

@appolonet - thank you for the patch, I've found the following issues and wondered if you might have some insight:

The navigation to the located directory only works for directories which are the initial descendent of the current directory. For example, if in directory A with a subdirectory of A/B/C then a file located in C is not displayed when selected. I've done some work to iterate and descend into the directories but there is an issue because each child must be loaded before continuing down the directory tree and there doesn't seem to be a way to hook into the loading processing to know when to continue.

petrica.martinescu’s picture

Status: Needs work » Needs review
StatusFileSize
new8.37 KB

Attached patch:

  • Displays search results as icons with thumbnail preview for images
  • Clickable search results - will navigate to selected file and highlight it
  • Disabled search in current directory - search in all files - to search only in current selected directory uncomment line 27 and comment line 28 in imce_search.module
  • Limit search results to 50 results - to remove limitation see line 39 in imce_search.module
soulfroys’s picture

StatusFileSize
new32.7 KB
new8.89 KB

@petrica.martinescu

Unfortunately it didn't apply clean here, so I generated a new diff for someone who has the same problem. To apply the patch, copy the file to the module root (/imce_tools), then use "patch -p1 < imce-search-preview-image-1216028-03.patch". Use "patch -p1 -R < imce-search-image-preview-1216028-03.patch" to revert.

It worked almost fine, except for a few issues:

  1. "data.files.length" is returning "undefined results found."
  2. Sometimes you click on the image and it navigates to it, sometimes not.
  3. Even making changes in line 27 and 28, the search continues returning results from subdirectories.

Despite these issues, I tested it with some users here and they liked it a lot.

Thank you for the patch!

IMCE search preview

globallog’s picture

Hello,
Could you please share how to apply this #3 patch on 7.x version?

soulfroys’s picture

Hi

Unfortunately, this patch is for Drupal 6 only...