When using the section type Files and Folders, I would like the image files to open in Colorbox and not open in the same browser window, forcing the user to use the browser back button to return to the site.

Is there a way to make image files on the whole site open default to open in Colorbox? I have been trying to set the Admin>structure>file type> image to colorbox, but still some images are opening in the same browser window not the colorbox.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mpotter’s picture

Sorry, but not sure that's going to happen. The Files widget is intended for actual files (doc, pdf, etc) where you want to render the entire file in the browser and not in a popup, more like a doc mgt solution such as Sharepoint or Alfresco. And making is work differently depending on the file type would be tricky and a poor user experience.

There are other Views and widgets in Atrium that use the Colorbox popup. Check out the Media Gallery paragraph type for adding images to the document rather than attaching it in the File Attachment field.

Also, the Files/Folder widget is a very specialized app written using Angular JS for a specific use-case. For a more Drupal-standard widget, try using the "Group Menu" that was previously used on News sections (it has the +/- icons to open a folder). Since it uses normal Drupal menu calls, it might respect the file-type modes more.

But also, if you change the file type settings you will likely have Overridden Features that might get reverted when you upgrade Atrium. And I've found those file type settings to be tricky to get un-overridden in the past.

mpotter’s picture

Category: Support request » Feature request
rschaeffler’s picture

Thank you for the reply, I see, how about instead of the colorbox, when you select a file in a folder it opens in a new browser window instead of the same window replacing the Open Atrium site? I'm just trying to prevent users that are previewing files in folds from moving off the site.

mpotter’s picture

Assigned: rschaeffler » Unassigned

Only assign issues to yourself if you have a patch or something that you are working on.

davadoo’s picture

Thank for god work on OA2.
I have the same question. I want file section to open files in separate browser window instead of the same window preventing the users to navigate from OA original window. It's any way to do this?

Thanks in advance.

msizec’s picture

Same here.
Seems legitimate ...

Maybe adding a checkbox in the 'files & folders' widget configuration. If checked, all files (and documents ?) would be opened in a new tab or window

joep.hendrix’s picture

+1 for me.
All files (image, pdf's docx etc.) are categorised by the documentation app. In my opinion, that is the way how files should be added to a space.
End users keep closing the main window when opening a file which is annoying.
It would be nice if this could be configured as a setting.

mpotter’s picture

This issue is actually bigger than Open Atrium. Different browsers handle "tabs" differently. For example, entering a URL into the address bar in Chrome re-uses the same tab, while doing this in Firefox creates a new tab.

People who use Chrome and are used to the tab being re-used won't want files to be opened in new tabs...they are trying to reduce their number of tabs. Firefox users will want a new tab to be created since that's what they are used to.

There is a good blog on this subject here: https://css-tricks.com/use-target_blank/

Drupal and Atrium have lots of links to pages and files and other assets. I don't plan to add the "target=_blank" option for all of these and make assumptions about different users. Users should be instructed how to open files/pages in a new tab when designed (typically right-clicking in a browser will have an option to open a link in a new tab).

joep.hendrix’s picture

The problem here is with the file app. Since all links are fully controled by javascript, there is no right-mouse option available.
So, the issue is not bigger than Open Atrium, actually it is just the file app.

joep.hendrix’s picture

I tried to get this done by customising oa-files.tpl.php but was not successful. Maybe somebody has a hint how to get this done?

Duplicate of: #2626314: Setting for opening file in new window

joep.hendrix’s picture

Title: Opening file and folder image in colorbox » Opening file and folder image in colorbox or new window
joep.hendrix’s picture

Is there any news on this?
I am afraid the lack of support for opening files in a new window is such an usability issue that is going to be a show stopper.

Any hints on how to fix #9 and/or #10 will be greatly appreciated!

Argus’s picture

The File and Folder widget seems aimed at document files like .doc and .pdf. Images can best be added as a Paragraph like mpotter suggested.

As a workaround for images: on the file page there is an option Show page instead of file? If checked, show the node detail page (Drupal default behavior). If unchecked, show the first file attachment.. This will open the "Metadata" page for the file. At least now the user isn't lost. You could do with the Document page whatever suits your case best; add info about the file, add the image in a smaller preview and a "full size" for download in the sidebar etc.

You could also create your own view containing the files, then you have all the control you want.

mpotter’s picture

Status: Active » Closed (won't fix)

Argus is correct...The Files/Folders widget is optimized for Files, not for image preview. You can create your own Section Type (Gallery?) and then add your own view to show documents/images in a grid however you want. That's the flexibility of Atrium for creating custom sections and pages!

No plans to change the Files/Folder widget, so marking this as Won't-fix.

joep.hendrix’s picture

The problem is not images, it is for all files
Could you please have a look at #9 and #10?

Cheers,
Joep

mpotter’s picture

Title: Opening file and folder image in colorbox or new window » Opening files in a new window
Status: Closed (won't fix) » Active

Right, I talked about that in #8. It's a browser-dependant behavior whether to open new tabs or not. Let me rename this issue to reflect the actual request since the later comments focused on the colorbox stuff. But somebody will need to post a patch for this as it's going to be low on the priority list.

joep.hendrix’s picture

The part in #8 where you stated that users can open the file in a new tab if they want to is not correct.

With the current Javascript implementation in stead of a html href link, it is not possible to open in a new tab in any browser.

joep.hendrix’s picture

Version: 7.x-2.33 » 7.x-2.64
FileSize
73.61 KB
58.17 KB

Bumping to 2.64.
See screenshots below to compare the right mouse button context menus between regular <a> links en the javascript file widget links.
It is impossible to open a file in a new window, a real usability drawback IMHO.

Regular link context menu

File widget context menu

DDM486’s picture

I have to agree with joep.hendrix here. Would really love to see the ability to open files in a new tab/window added as an option.

DDM486’s picture

I ended up playing around with this a little more and was able to modify the oa_files_treeview.js file to get the files opening in a new tab. I'm currently on version 2.68 of Open Atrium. Of course, this is a blanket fix that affects all files in the media browser, but it's exactly what we were looking for, so here it is for anyone interested:

On line 381 of the oa_files_treeview.js file inside the showSelected function, find the line

window.location.href = Drupal.settings.basePath + node.url;

and replace it with

window.open(Drupal.settings.basePath + node.url);

Window.location.href always opens links in the same window while window.open() opens them in a new window/tab (Shout out to Stack Overflow for the tip: http://stackoverflow.com/questions/7077770/window-location-href-and-wind...).

Hope this helps with anybody still looking for an answer!