# 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,29 @@ } } -//===== 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 + $resources = get_records('resource', 'type', 'file'); + foreach ($resources as $resource) { + //test if filename end by pdf + if (strcmp(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->options) || $resource->options == 'frame' ) { + //set the 'Show navigation' settings to 'yes, without frame' + $resource->options = 'objectframe'; + //update the resource + update_record('resource',$resource); + } + } + } +} + +//===== 1.9.0 upgrade line ======// return $result; } Index: moodle/mod/resource/version.php --- moodle/mod/resource/version.php Base (1.36.2.1) +++ moodle/mod/resource/version.php Locally Modified (Based On 1.36.2.1) @@ -5,8 +5,8 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2007101509; -$module->requires = 2007101509; // Requires this Moodle version +$module->version = 2007101511; +$module->requires = 2007101511; // Requires this Moodle version $module->cron = 0; ?>