Directory resources with toolbar

Re: Directory resources with toolbar

by Ian Usher -
Number of replies: 0

I think this works...

Edit lib/weblib.php at about line 319 (I'm on v1.4.1, may be a slightly different line number for other versions). It looks like:

function link_to_popup_window ($url, $name="popup", $linkname="click here",
                               $height=400, $width=500, $title="Popup window", $options="none", $return=false) {
/// This will create a HTML link that will work on both
/// Javascript and non-javascript browsers.
/// Relies on the Javascript function openpopup in javascript.php
/// $url must be relative to home page  eg /mod/survey/stuff.php

    global $CFG;

    if ($options == "none") {
        $options = "menubar=0,location=0,scrollbars,resizable,width=$width,height=$height";
    }
    $fullscreen = 0;

    $link = "<a target=\"$name\" title=\"$title\" href=\"$CFG->wwwroot$url\" ".
           "onClick=\"return openpopup('$url', '$name', '$options', $fullscreen);\">$linkname</a>\n";
    if ($return) {
        return $link;
    } else {
        echo $link;
    }
}

you need to change that red highlighted bit to:

    global $CFG;

    if ($options == "none") {
        $options = "menubar=1,location=0,scrollbars,resizable,width=$width,height=$height";
    }
    $fullscreen = 0;

if you want a menu bar (which should allow users to select File > Save or File > Print) and change it to

  global $CFG;

    if ($options == "none") {
        $options = "menubar=1,location=1,scrollbars,resizable,width=$width,height=$height";
    }
    $fullscreen = 0;

if you want the document's address to be displayed in the location bar.

This works on my local instance of Moodle, am just about to try it on my production server...