Skip to content

Commit

Permalink
MDL-9198: Embedded PDF now works fine in FF 1.5, FF 2, IE5, IE6, IE7 …
Browse files Browse the repository at this point in the history
…and Opera, and degrades beautifully in non-supported browsers (or when plugin is missing).
  • Loading branch information
nicolasconnault committed Apr 5, 2007
1 parent 89d6849 commit 3836cfd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
18 changes: 12 additions & 6 deletions mod/resource/type/file/resource.class.php
Expand Up @@ -216,7 +216,6 @@ function display() {
$formatoptions->noclean = true;

if ($resource->options == "frame") { // TODO nicolasconnault 14-03-07: This option should be renamed "embed"

if (in_array($mimetype, array('image/gif','image/jpeg','image/png'))) { // It's an image
$resourcetype = "image";
$embedded = true;
Expand All @@ -243,7 +242,10 @@ function display() {

} else if ($mimetype == "text/html") { // It's a web page
$resourcetype = "html";
}
} else if ($mimetype == 'application/pdf' || $mimetype = 'application/x-pdf') {
$resourcetype = "pdf";
$embedded = true;
}
}

$isteamspeak = (stripos($resource->reference, 'teamspeak://') === 0);
Expand Down Expand Up @@ -325,7 +327,6 @@ function display() {


/// Check whether this is supposed to be a popup, but was called directly

if ($resource->popup and !$inpopup) { /// Make a page and a pop-up window

print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm));
Expand Down Expand Up @@ -385,6 +386,7 @@ function display() {
/// If we are in a frameset, just print the top of it

if (!empty( $frameset ) and ($frameset == "top") ) {

print_header($pagetitle, $course->fullname, "$this->navigation ".format_string($resource->name), "", "", true, update_module_button($cm->id, $course->id, $this->strresource), navmenu($course, $cm, "parent"));

$options = new object();
Expand All @@ -401,7 +403,6 @@ function display() {


/// Display the actual resource

if ($embedded) { // Display resource embedded in page
$strdirectlink = get_string("directlink", "resource");

Expand Down Expand Up @@ -518,8 +519,7 @@ function display() {
echo '<a href="' . $fullurl . '">' . $fullurl . '</a>';
echo '</object>';
echo '</div>';
} else if ($resourcetype == "flash") {

} else if ($resourcetype == "flash") {
echo '<div class="resourcecontent resourceswf">';
echo '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
echo "<param name=\"movie\" value=\"$fullurl\" />";
Expand All @@ -540,6 +540,12 @@ function display() {
echo '<!--<![endif]-->';
echo '</object>';
echo '</div>';
} elseif ($resourcetype == 'pdf') {
echo '<div class="resourcepdf">';
echo '<object data="' . $fullurl . '" type="application/pdf">';
echo get_string('clicktoopen', 'resource') . '<a href="' . $fullurl . '">' . $resource->summary . '</a>';
echo '</object>';
echo '</div>';
}

if (trim($resource->summary)) {
Expand Down
11 changes: 11 additions & 0 deletions theme/standard/styles_layout.css
Expand Up @@ -3174,11 +3174,22 @@ body#question-preview .quemodname, body#question-preview .controls {
margin:20px;
}

#mod-resource-view .resourcepdf {
width: 100%;
padding-top: 15px;
text-align: center
}

.resourcecontent object {
height:480px;
width:600px;
}

.resourcepdf object{
height: 800px;
width: 800px;
}

.mod-resource .modified {
text-align:center;
}
Expand Down

0 comments on commit 3836cfd

Please sign in to comment.