# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: moodle/mod/resource/db/upgrade.php --- moodle/mod/resource/db/upgrade.php Base (1.5.2.1) +++ moodle/mod/resource/db/upgrade.php Locally Modified (Based On 1.5.2.1) @@ -63,8 +63,33 @@ } } -//===== 1.9.0 upgrade line ======// +//Set 'Show navigation' setting to "Yes, without frame" for PDF file resources +//Explanation: due to MDL-20320 bug, PDF can now be displayed as 'No', 'Yes, with frame' and 'Yes, without frame'. +//The default being 'no', PDF resources on previous installations need to be set back to 'Yes, without frame' +if ($result && $oldversion < 2007101511) { + //retrieve all file resources + if ($rs = get_recordset('resource', 'type', 'file','','id, reference, popup, options')) { + while ($resource = rs_fetch_next_record($rs)) { + //test if filename end by pdf + if (strcmp(strtolower(substr($resource->reference, strlen($resource->reference)-4, 4)), '.pdf')===0) { + //check that the 'Show navigation setting' is set to 'no' or 'yes, with frame' + //(it could be set to forcedownload, and we don't want to change it in this case) + if (empty($resource->popup) && (empty($resource->options) || $resource->options == 'frame' )) { + //set the resource 'options field 'Keep navigation settings' to yes, without frame + unset($resource->reference); + unset($resource->popup); + $resource->options = 'objectframe'; + $resource = addslashes_recursive($resource); + //update the resource + update_record('resource',$resource); + } + } + } + rs_close($rs); + } +} +//===== 1.9.0 upgrade line ======// return $result; }