|
Martin Dougiamas made changes - 21/Sep/09 10:05 AM
Martin Dougiamas made changes - 21/Sep/09 10:06 AM
Martin Dougiamas made changes - 21/Sep/09 10:11 AM
Same behavior as before the fix of
I guess it's just a wording error, the option should be named: "Keep page navigation visible on the same page for html file" Here is the situation:
mod/resource/type/file/resource.class.php:
The The resource code has been refactored in HEAD.
If there is no mandatory needs to have mp3, pdf, displaying no menu or a frame, I'm really for doing no change, and just fixing the wording. Thanks Jerome!
I'd really like to see all those types behaving as described in the current menu items ASAP. People should be able to use frames when they want to (as long as it is explicitly described so they know the pitfalls wrt accessibility). I think fixing this is pretty simple, just removing the $embedded = true from those items in the switch statement to make those media types act like HTML and undefined media types do. The main problem is going to be the change of behaviour in 1.9 stable. 1) Sites already in 1.9 are going to see slight changes in how courses are displaying. I'd like to see some community testing of all the upgrade permutations to make sure that we aren't going to introduce any major regressions here before we make these changes in 1.9. no worries
it is not as simple as it, remove embedded = true will display the OS media player for MP3 file for example, we will lose all specific tags to the different extension, I need to refactor a bit the code...
just a reminder to update: http://docs.moodle.org/en/File_or_website_link#Keep_page_navigation_visible_on_the_same_page
I attached a patch. We still need to edit resource db/upgrade.php in order to manage different 1.9 config upgrade. I'll do it later however you can test the patch now.
Jerome Mouneyrac made changes - 22/Sep/09 09:58 AM
I tested it quickly... The original issue was about showing pdf files like html pages - not the other embedded files - but even after this patch PDF (Keep page navigation visible on the same page - Yes, without frame) does not look "correct" (whole width and height) if $embedded is true for pdf because resource.class.php will skip over
if (empty($frameset) and !$embedded and !$inpopup and ($resource->options == "frame" || $resource->options == "objectframe") and empty($USER->screenreader)) {...} and source code will have something like <div class="resourcepdf"><object data="http://127.0.0.1/moodle/file.php?file=%2F3%2FTest_Page.pdf" type="application/pdf"><param name="src" value="http://127.0.0.1/moodle/file.php?file=%2F3%2FTest_Page.pdf" />To open this document, click on this link: <a href="http://127.0.0.1/moodle/file.php?file=%2F3%2FTest_Page.pdf">PDF - Same Window - Nav no Frame</a></object></div> If $embedded is false result seems to be more correct and moodle will use Yahoo javascript libaries for updating embedded object size with source code <p><object id="embeddedhtml" data="http://127.0.0.1/moodle/file.php?file=%2F3%2FTest_Page.pdf" type="application/pdf" width="800" height="600"> Should not default value for $embedded for pdf be false like Jon in Jon's demo? If javascript is disabled result is of course different...
Jerome Mouneyrac made changes - 22/Sep/09 05:44 PM
Jerome Mouneyrac made changes - 22/Sep/09 05:45 PM
I attached a fix only PDF patch
Jerome Mouneyrac made changes - 23/Sep/09 09:24 AM
If we decide to fix only PDF, as a dev I'm happy there will be less potential bug. However "Keep navigation" still need some rewording explaining that it doesn't work with some specific files (MP3,...). Some suggestions?
http://docs.moodle.org/en/File_or_website_link#Keep_page_navigation_visible_on_the_same_page
"Note that this option is normally not necessary for media types such as movies, audio files and flash files, as without this option turned on they will be embedded within a navigable page." so we probably should only fix PDF (at this moment PDF, ZIP and image are also considered as media). OK, after discussion .... we might create more issues if we tinker too much with how 1.9.x works.
So let's do this for 1.9.6: 1) Remove the embedded=true setting for PDFs Attached another patch:
1. Fixed PDF only 2. Added comment under the setting saying that some media file ignore this setting 3. Renamed 'Keep navigation visible on the same page' into 'Show navigation'
Jerome Mouneyrac made changes - 23/Sep/09 11:53 AM
Jerome Mouneyrac committed 2 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 24/Sep/09 10:30 AM
committed into 1.9
Thank you.
Jerome Mouneyrac made changes - 24/Sep/09 10:34 AM
We should set the option to "yes, without frame" for people upgrading otherwise they will have to change all their PDF resource settings... fixing it
Jerome Mouneyrac made changes - 29/Sep/09 04:02 PM
Hi Eloy,
can you review the upgrade database patch and commit it? Explantion of this issue and the two patches: Now PDF files can be displayed into a frame ('Yes, with frame'), into an object tag ('Yes, without frame') or just displayed without navigation ('No'). We need a DB upgrade patch because on previous installation, PDF were always displayed as 'Yes, without frame'. The default being 'No', they will be displayed without navigation now. We need to update all PDF entries into the database to put them back to 'Yes, without frame'. Thanks a lot
Jerome Mouneyrac made changes - 29/Sep/09 08:34 PM
The patch looks ok but:
1) Instead of getting all records with all columns, I'd get only those needed (id, type, reference, popup, options). And perhaps I'd use a recordset (I can imagine one site with zillions of pdfs). 2) As it's only a matter of updating one field, perhaps set_field() is better than update_record (far less to write). 3) IMO, you also need to check that popup is empty, because resources being showed in new window must not be updated to "objectframe". So condition must be: if (empty($resource->popup && (empty($resource->options) || $resource->options == 'frame' )) {
4) Finally, IMO this should ALSO be merged into 2.0 resources (before the split into new modules happen). Please confirm this with Petr. 5) Edited: ".PDF" files aren't processed. Need to support them too. 2.0 has a branch new code that should not have any problem like this, of course if there is any need for DB upgrades the existing migration code should be updated.
Looking at the code the update_record('resource',$resource); is a SQL injection - there would have to be addslashes_recursive(). I agree with Eloy, this would definitely run out of memory on most sites - you have to use recordsets and specify the fetched fields. About 2.0 Petr, is it a matter of "cloning" the upgrade block in 2.0 mod/resource (before the migration happens, of course). Or is it a matter of changing the migration itself to fix those resources ?
Jerome, just noticed another minor thing: ".PDF" (uppercase) isn't fixed by the patch. I looks like this new upgrade step could be implemented as some extra ifs during migration of both 'url' and 'resource' module.
Hi all,
thanks for the reviews I tested that popup were not impacted but I'll add the test for security to a new patch. The new patch will be committed today after review, then the weekly build (on hold at this moment) will be rebuild and released. Thanks quickly add a new patch for Martin
Jerome Mouneyrac made changes - 30/Sep/09 11:11 AM
Hi I'm on my iPhone at the hospital. I've just tested the patch I attached before to get my cab, it works well, ready for reviewing and being committed hopefully. Thanks Martin
A new optimized patch for site with Zillion of PDF
Jerome Mouneyrac made changes - 30/Sep/09 03:39 PM
+1 here
I think you could have saved the 2nd loop by doing all in the 1st one but your solution should work fine too (I hope nobody will have really zillions of resources or that $resources array will boom too, hehe). Ciao Petr came back with the best solution, attached what I hope to be the last patch
Jerome Mouneyrac made changes - 30/Sep/09 04:38 PM
hehe, this ain't gonna work for bloody oracle, remember that ugly one space hack for empty strings there
another patch to review
Jerome Mouneyrac made changes - 30/Sep/09 05:09 PM
+1
Also, from HQ Chat: [11:18:20] <Eloy> btw.. that transformation should also be applied somewhere in the 1.9 => 2.0 migration (uhm... although it's destructive, replacing empties by "objectframe" twice. Uhm) Ciao
Jerome Mouneyrac committed 2 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 30/Sep/09 05:21 PM
Resolving thanks everybody
Jerome Mouneyrac made changes - 30/Sep/09 05:22 PM
good evolution! Tested all combinations seems to work.
Eloy Lafuente (stronk7) made changes - 30/Sep/09 05:50 PM
Jerome Mouneyrac made changes - 30/Sep/09 05:50 PM
Tim Hunt made changes - 30/Sep/09 06:48 PM
tjhunt committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 30/Sep/09 06:49 PM
Tim Hunt made changes - 30/Sep/09 06:50 PM
Re-rolled ! Thanks Tim, I missed that point!
Martin Dougiamas made changes - 30/Sep/09 11:15 PM
martignoni committed 1 file to 'Lang CVS' - 01/Oct/09 03:42 AM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MDL-10021is the bug where these settings were last looked at