Moodle

"Search for web page" button in Resource module does nothing

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8
  • Fix Version/s: 2.0
  • Component/s: Resource
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

Using the March 31, 2007 version of 1.8, when creating a new resource using "Link to a file or website" the "Search for web page..." button does nothing.

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

Works fine for me in latest 1.8+ in FF, Konqueror, IE and Opera.

Show
Petr Škoda (skodak) added a comment - Works fine for me in latest 1.8+ in FF, Konqueror, IE and Opera.
Hide
Thomas Robb added a comment -

It doesn't work for me on Firefox Mac or Win using the most recent versions of each.

Show
Thomas Robb added a comment - It doesn't work for me on Firefox Mac or Win using the most recent versions of each.
Hide
Petr Škoda (skodak) added a comment -

Could you please try other PC and other Moodle server, I need to replicate it in order to fix it

Show
Petr Škoda (skodak) added a comment - Could you please try other PC and other Moodle server, I need to replicate it in order to fix it
Hide
Martyn J Compton added a comment -

I'm getting the same problem, click on the button and absolutely nothing happens, no pop-up blockers are enabled or anything, using MS IE 7.0.5730.11... doesnt seem to work in FF either. Haven't checked other browsers.

Say if you need more info, am watching this case.

Show
Martyn J Compton added a comment - I'm getting the same problem, click on the button and absolutely nothing happens, no pop-up blockers are enabled or anything, using MS IE 7.0.5730.11... doesnt seem to work in FF either. Haven't checked other browsers. Say if you need more info, am watching this case.
Hide
Martyn J Compton added a comment - - edited

Linked MDL-10278, Exactly the same issue.

Show
Martyn J Compton added a comment - - edited Linked MDL-10278, Exactly the same issue.
Hide
Petr Škoda (skodak) added a comment -

I need a way to reproduce it on my computer, it works fine here in FF, sorry
Did you check your browser extensions and personal firewall? It might be silently blocking opening of new windows...

Show
Petr Škoda (skodak) added a comment - I need a way to reproduce it on my computer, it works fine here in FF, sorry Did you check your browser extensions and personal firewall? It might be silently blocking opening of new windows...
Hide
Martyn J Compton added a comment -

It's happening on every computer in our college, I'll see if I can get you some kind of remote access so you can have a look.

Show
Martyn J Compton added a comment - It's happening on every computer in our college, I'll see if I can get you some kind of remote access so you can have a look.
Hide
Ralph Peterson added a comment -

The function 'setup_elements' in /mod/resource/type/file/resource.class.php is broken IMHO.

$searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource').'...');
$buttonattributes = array('title'=>get_string('searchweb', 'resource'),'onclick'=>"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');");
$searchbutton->updateAttributes($buttonattributes);

I don't know enough about Moodle's OOP to track the error.... The third line does not appear to add the Title or Onclick to the searchbutton object.

Ralph

p.s. There is a 'typo' on the second line (1.8.2+) *fixed above. Places the wrong title 'localfilechoose' ... a moot point since the popup script is never attached to the button.

Show
Ralph Peterson added a comment - The function 'setup_elements' in /mod/resource/type/file/resource.class.php is broken IMHO. $searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource').'...'); $buttonattributes = array('title'=>get_string('searchweb', 'resource'),'onclick'=>"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');"); $searchbutton->updateAttributes($buttonattributes); I don't know enough about Moodle's OOP to track the error.... The third line does not appear to add the Title or Onclick to the searchbutton object. Ralph p.s. There is a 'typo' on the second line (1.8.2+) *fixed above. Places the wrong title 'localfilechoose' ... a moot point since the popup script is never attached to the button.
Hide
Eric Bollens added a comment -

This is a strange problem for two reasons:

1) It occurs on some Moodle servers and not on others. I've got two instance of Moodle running out of the same repository, one of them remotely and the other one locally. The server settings differ slightly, but for some reason, on the local instance I do not get the error but on the remote instance I do.

2) Also strange because the "Choose or upload a file..." button gets generated exactly the same way ( addElement() -> updateAttributes($buttonattributes) ) yet it works just fine while the websearch one does not.

However, neither generate by the method I personally prefer, the one that gets used in course/edit_form.php, where it feeds the attributes directly into the addElement() parameter rather than assigning them after-the-fact. As I knew this method operated as expected, I switched the way the addElement on line 631 worked to the latter method - it now works as intended.

Replace lines 630 - 634:

if (!empty($CFG->resource_websearch)) { $searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource').'...'); $buttonattributes = array('title'=>get_string('localfilechoose', 'resource'), 'onclick'=>"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');"); $searchbutton->updateAttributes($buttonattributes); }

With these lines:

if (!empty($CFG->resource_websearch)) { $searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource'), array('title'=>get_string('searchweb', 'resource'), 'onclick'=>"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');")); }

In the long run, it might be worth it to consider if this button really adds any functionality. It seems mostly superfluous, especially as it doesn't provide a means of capturing a URL without having to do copy + paste. Moodle also doesn't present admins with the ability to change the search engine used, counterintuitive to the rest of the way the system seems to operate.

Show
Eric Bollens added a comment - This is a strange problem for two reasons: 1) It occurs on some Moodle servers and not on others. I've got two instance of Moodle running out of the same repository, one of them remotely and the other one locally. The server settings differ slightly, but for some reason, on the local instance I do not get the error but on the remote instance I do. 2) Also strange because the "Choose or upload a file..." button gets generated exactly the same way ( addElement() -> updateAttributes($buttonattributes) ) yet it works just fine while the websearch one does not. However, neither generate by the method I personally prefer, the one that gets used in course/edit_form.php, where it feeds the attributes directly into the addElement() parameter rather than assigning them after-the-fact. As I knew this method operated as expected, I switched the way the addElement on line 631 worked to the latter method - it now works as intended. Replace lines 630 - 634: if (!empty($CFG->resource_websearch)) { $searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource').'...'); $buttonattributes = array('title'=>get_string('localfilechoose', 'resource'), 'onclick'=>"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');"); $searchbutton->updateAttributes($buttonattributes); } With these lines: if (!empty($CFG->resource_websearch)) { $searchbutton = $mform->addElement('button', 'searchbutton', get_string('searchweb', 'resource'), array('title'=>get_string('searchweb', 'resource'), 'onclick'=>"return window.open('$CFG->resource_websearch', 'websearch', 'menubar=1,location=1,directories=1,toolbar=1,scrollbars,resizable,width=800,height=600');")); } In the long run, it might be worth it to consider if this button really adds any functionality. It seems mostly superfluous, especially as it doesn't provide a means of capturing a URL without having to do copy + paste. Moodle also doesn't present admins with the ability to change the search engine used, counterintuitive to the rest of the way the system seems to operate.
Hide
Jason Hardin added a comment -

I was able to verify that the attributes that Moodle assigns in /mod/resource/type/file/resource.class.php are being passed to the Pear library correctly. It seems to be a problem with the printing out of the buttons not the input of data. I have yet to figure out where the form gets printed. For me the problem happens on our PHP 4 server, but the code is generated correctly on my local copy running PHP 5.

My guess is that this probably has something then with Pear's object oriented code or Moodle's object oriented code that is different between the two versions of php.

Show
Jason Hardin added a comment - I was able to verify that the attributes that Moodle assigns in /mod/resource/type/file/resource.class.php are being passed to the Pear library correctly. It seems to be a problem with the printing out of the buttons not the input of data. I have yet to figure out where the form gets printed. For me the problem happens on our PHP 4 server, but the code is generated correctly on my local copy running PHP 5. My guess is that this probably has something then with Pear's object oriented code or Moodle's object oriented code that is different between the two versions of php.
Hide
Leang Chumsoben added a comment -

Yes, Jason is right.

I can also verify that, the problem occurs in my local server running with PHP 4.3.10 while it run just fine in my other server with PHP 5.2.0.

Show
Leang Chumsoben added a comment - Yes, Jason is right. I can also verify that, the problem occurs in my local server running with PHP 4.3.10 while it run just fine in my other server with PHP 5.2.0.
Hide
Petr Škoda (skodak) added a comment -

Hello,
the resource module was rewritten in 2.0. Please file new issues if necessary.

Petr Škoda

Show
Petr Škoda (skodak) added a comment - Hello, the resource module was rewritten in 2.0. Please file new issues if necessary. Petr Škoda

Dates

  • Created:
    Updated:
    Resolved: