Moodle

popup_form function is not 100% correct

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.9.6
  • Fix Version/s: None
  • Component/s: Files API
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE

Description

As I quickly described in http://moodle.org/mod/forum/discuss.php?d=138323
I feel the function popup_form is not working 100% fine.
Let me explain.

In the frame of the development of the module "newmodule",
write the following code:

$url = $CFG->wwwroot.'/mod/newmodule/view.php?id='.$cm->id; // where $cm is what you think it is
$items = array();
$items[] = 'aa';
$items[] = 'bb';
popup_form($url, $items, 'myformid', '', get_string('choose'), 'myhelpfile', 'myhelptext', false);

The output of this code will be a popup_form equipped with an help button.
The helpbutton is supposed to link the file "myhelpfile.html" stored into $CFG->wwwroot.'/mod/newmodule/lang/xx_utf8/help/newmodule/
The link to that file shoulb be:
$CFG->wwwroot/help.php?module=newmodule&file=issuedays.html&forcelang=
but it is
$CFG->wwwroot/help.php?module=moodle&file=issuedays.html&forcelang=

Whether what I wrote is true, this function can't be used in this way in the frame of the development of a module!!!!

Activity

Hide
Daniele Cordella added a comment -

As far as I can understand the attached patch fixes the problem

Show
Daniele Cordella added a comment - As far as I can understand the attached patch fixes the problem
Hide
Daniele Cordella added a comment -

ok, Eloy, finally I arrived to detect it in even Moodle 2.0.
Infact, the bug exists in Moodle 2.0 too.
If you use the deprecated function popup_form (from /moodle20/lib/deprecatedlib.php) the problem is exactly the same described for moodle 1.9.
If you use the new syntax: $select->set_help_icon($page, $text, $linktext=false); the error doesn't change because the
class moodle_help_icon extends labelled_html_component {
defined in
moodle20/lib/outputcomponents.php
still hard code the value of the public variable $module to 'moodle';

Eloy, do I deserve the commit now? :-P
Ciao my friends.

Show
Daniele Cordella added a comment - ok, Eloy, finally I arrived to detect it in even Moodle 2.0. Infact, the bug exists in Moodle 2.0 too. If you use the deprecated function popup_form (from /moodle20/lib/deprecatedlib.php) the problem is exactly the same described for moodle 1.9. If you use the new syntax: $select->set_help_icon($page, $text, $linktext=false); the error doesn't change because the class moodle_help_icon extends labelled_html_component { defined in moodle20/lib/outputcomponents.php still hard code the value of the public variable $module to 'moodle'; Eloy, do I deserve the commit now? :-P Ciao my friends.
Hide
Petr Škoda (skodak) added a comment -

Hello, we are not planning any more changes except security fixes in 1.9.x, the new code in 2.0dev should work fine, the deprecated functions should not be used at all. Thank you for the report anyway.

Petr Skoda

Show
Petr Škoda (skodak) added a comment - Hello, we are not planning any more changes except security fixes in 1.9.x, the new code in 2.0dev should work fine, the deprecated functions should not be used at all. Thank you for the report anyway. Petr Skoda

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: