Moodle

Database: sort URL fields by the displayed text (URL or the provided description) based on autolink setting

Details

  • Affected Branches:
    MOODLE_19_STABLE

Description

I have a user that created a database list of schools. Using autolink, the user enters a schools website and the school name. Since the school name is displayed and the URL field is the default sort order, she was confused when some of her entries were out of order. The reason was that they are being sorted by the URL itself so that http://uofd.org/ comes before http://www.arrupe.org/; however, she expected Arrupe (the entered and displayed text) to come before (Univ. of Detroit). Me thinks the best behavior is to sort on whatever is displayed. If autolink is not provided, then sort by the URL. If autolink is used then sort by the provided text and then the URL (in case of duplicates). Peace - Anthony

Activity

Hide
Anthony Borrow added a comment -

I've given this patch a quick trial run and now things seem to sort based on what is selected. Thanks to good programming, this was remarkably easy to do. I simply created a get_sort_field function for the URL field type and said that if param1 (i.e. autolink) is being used which sets the display to the URL description rather than the actual URL then sort by that. With this patch, the URL field will sort according to what is displayed on the screen. Peace - Anthony

Show
Anthony Borrow added a comment - I've given this patch a quick trial run and now things seem to sort based on what is selected. Thanks to good programming, this was remarkably easy to do. I simply created a get_sort_field function for the URL field type and said that if param1 (i.e. autolink) is being used which sets the display to the URL description rather than the actual URL then sort by that. With this patch, the URL field will sort according to what is displayed on the screen. Peace - Anthony
Hide
Anthony Borrow added a comment -

reassigning to Moodle.com and stable backlog. Peace - Anthony

Show
Anthony Borrow added a comment - reassigning to Moodle.com and stable backlog. Peace - Anthony

People

Vote (2)
Watch (1)

Dates

  • Created:
    Updated: