Forums | Mahara Community

Developers /
Files to open in a new window


anonymous profile picture
Deleted user
Posts: 2

07 September 2009, 11:49 PM

Hi there,

 I noticed that when I open a "file to download" it opens in the same window. Making it a bit confusing. Is there a way to change that so everytime someone clicks on an item it opens in a new window?
That often results in accidently closing the mahara session by closing a file.

 -----------------------------------------------------

One more question: Is there a way to when you click on an item it opens directly the file instead of opening the window with "Type, description, owner, created, etc..." then having to click a second time on the file name to open the file? Just thinking about single click access instead of two clicks.

 Hope someone can help,

 Tuki 

 

anonymous profile picture
Deleted user
Posts: 1643

09 September 2009, 8:04 PM

Hi - yeah the behaviour is a little bit strange. Would probably be better if the default behaviour was that you clicked on the name to download it, and there was a "details" link. I might have a go at changing it.

In any event, you can click on the icon to download it straight away at the moment - though that link will happen in the same window. 

anonymous profile picture
Deleted user
Posts: 117

10 September 2009, 1:55 AM

To make the file open in a new window, it's a pretty easy fix.

Open /artefact/file/blocktype/lib.php and find the line that says:

$result .= '<div class="fl"><a href="' . hsc($downloadurl) . '">';

and change it to:

$result .= '<div class="fl"><a href="' . hsc($downloadurl) . '" target="_blank">';

and then open /artefact/file/js/file.js and find:

parentattribs.href = self.downloadscript + '?file=' + r.id;

and after it add:

parentattribs.target = '_blank';

That should do it, I think.  As for the file details thing, I haven't changed that yet, but it shouldn't be too difficult to change.

3 results