Moodle

Link to a file or web site should require location field to be filled in

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.5
  • Fix Version/s: 2.0
  • Component/s: Resource
  • Labels:
    None
  • Environment:
    All
  • Affected Branches:
    MOODLE_15_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

When adding a 'Link to a file or web site' resource, it's possible to save changes without filling in the location field.

To ensure that the location field is filled in, the following code could be added to course/mod.php at approx line 40

if ($mod->reference == 'http://' // $mod->reference == '') { error('Please select a file or webpage to add', view.php?id=$course->id); }

This redirects the user to the course page. Would it be possible to redirect back to the page containing the form?

Activity

Hide
Martin Dougiamas added a comment -

From Martin Dougiamas (martin at moodle.com) Sunday, 19 June 2005, 02:01 PM:

Must be fixed, but I think we can do it with Javascript as well (before submitting the page!)

From wild girl (helen.foster at altoncollege.ac.uk) Tuesday, 21 June 2005, 05:27 PM:

If my suggested code is added at approx line 40 then it also prevents users from deleting resources! Instead, it needs to be placed within the add and update sections of the switch block.

You're right about the javascript - which file should it go in?

From wild girl (helen.foster at altoncollege.ac.uk) Tuesday, 21 June 2005, 11:14 PM:

Sorry for not testing my suggestion enough previously - just amended the code to make it more specific!

if ($mod->type == 'file' && ($mod->reference == 'http://' // $mod->reference == '')) { error('Please select a file or webpage to add', view.php?id=$course->id); }

Show
Martin Dougiamas added a comment - From Martin Dougiamas (martin at moodle.com) Sunday, 19 June 2005, 02:01 PM: Must be fixed, but I think we can do it with Javascript as well (before submitting the page!) From wild girl (helen.foster at altoncollege.ac.uk) Tuesday, 21 June 2005, 05:27 PM: If my suggested code is added at approx line 40 then it also prevents users from deleting resources! Instead, it needs to be placed within the add and update sections of the switch block. You're right about the javascript - which file should it go in? From wild girl (helen.foster at altoncollege.ac.uk) Tuesday, 21 June 2005, 11:14 PM: Sorry for not testing my suggestion enough previously - just amended the code to make it more specific! if ($mod->type == 'file' && ($mod->reference == 'http://' // $mod->reference == '')) { error('Please select a file or webpage to add', view.php?id=$course->id); }
Hide
Petr Škoda (skodak) added a comment -

The old mod/resource was split into several independent modules, please test and fine new issue if necessary. Thanks for the report!

Petr

Show
Petr Škoda (skodak) added a comment - The old mod/resource was split into several independent modules, please test and fine new issue if necessary. Thanks for the report! Petr

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: