Embedded PDFs don't display to logged-out users

Bug #1221001 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Aaron Wells

Bug Description

I thought I was having problems with embedded PDFs not displaying properly in Chromium and FF, but it turns out the problem was that I was viewing them while logged in (since I was editing the page) in FF, and then to save time I was viewing them while logged out in my other browsers.

To replicate:

1. Create a page that has an embedded PDF.
2. Make the page viewable by Public
3. Log out
4. View the page (while logged out)

Expected result: You should be able to see the embedded PDF
Actual result: You see only the embedded PDF block's title (in FF and Chromium) or the title and a grayed-out scrollbar (in IE).

So it looks like the problem may be that some of the JS is not getting included into the page when a logged-out user views it.

Tags: embed pdf
Revision history for this message
Aaron Wells (u-aaronw) wrote :

The iframe page is erroring out with this error when accessed by a logged-out user:

[Thu Sep 05 15:34:49 2013] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://vegas.wgtn.cat-it.co.nz/mahara/htdocs/view/view.php?id=6
[Thu Sep 05 15:34:49 2013] [error] [client 127.0.0.1] PHP 1. {main}() /home/aaronw/www/mahara/htdocs/artefact/file/blocktype/pdf/viewer.php:0, referer: http://vegas.wgtn.cat-it.co.nz/mahara/htdocs/view/view.php?id=6
[Thu Sep 05 15:34:49 2013] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function artefact_instance_from_id() in /home/aaronw/www/mahara/htdocs/artefact/file/blocktype/pdf/viewer.php on line 47, referer: http://vegas.wgtn.cat-it.co.nz/mahara/htdocs/view/view.php?id=6

So, it looks like the problem is that it relies on certain library files being included in the page load. They must be getting loaded in by other parts of the process for a logged-in user, but not for a logged-out user.

Revision history for this message
Aaron Wells (u-aaronw) wrote :

Turns out there were two problems. The lack of artefact/lib.php, and the lack of a "view" parameter on the file download link (embedded PDF just downloads the PDF into your browser and displays it with JS).

https://reviews.mahara.org/2475

Changed in mahara:
status: Triaged → Confirmed
assignee: nobody → Aaron Wells (u-aaronw)
milestone: none → 1.8.0rc1
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/2475
Committed: http://gitorious.org/mahara/mahara/commit/cc1a2812db289e42d10544c19d392ef091406335
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit cc1a2812db289e42d10544c19d392ef091406335
Author: Aaron Wells <email address hidden>
Date: Thu Sep 5 15:46:17 2013 +1200

Make Embedded PDF work for logged-out users

Bug 1221001. Needed artefact/lib.php (which apparently gets included by init.php if you're logged in),
and it needed to add &view= to the file download URL so that Mahara could tell which view was giving
you access to the PDF file.

Change-Id: If7c0a6a843588075104819f7ea1e53e392cc4959

Aaron Wells (u-aaronw)
Changed in mahara:
status: Confirmed → Fix Committed
Aaron Wells (u-aaronw)
Changed in mahara:
milestone: 1.8rc1 → 1.8.0
Aaron Wells (u-aaronw)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.