Directory resources with toolbar

Directory resources with toolbar

by Sarah Woods -
Number of replies: 1

I have users who want to print resources and since Word docs appear in a popup with no toolbar, they're SOL.

Near as I can tell, it must be in the Modules/View file somewhere around line 500andsomething:

link_to_popup_window($relativeurl, "resourceedirectory$resource->id", "$file", 450, 600, '');

What would I need to add to this to have the popup have the toolbar, or even better, how do I change things so Directory/File resources show up embedded instead of in popup windows?

Thanks!

Sarah

Average of ratings: -
In reply to Sarah Woods

Re: Directory resources with toolbar

by Ian Usher -

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...