Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Ajax user selector.

Development:Ajax user selector

From MoodleDocs
Revision as of 04:39, 24 October 2008 by Tim Hunt (talk | contribs) (New page: {{Moodle 2.0}}This is a proposal for a new user selector to be used on the assign roles and manage group memebers page, and also in two new reports I am writing for Moodle 2.0 to do with d...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Template:Moodle 2.0This is a proposal for a new user selector to be used on the assign roles and manage group memebers page, and also in two new reports I am writing for Moodle 2.0 to do with displaying a user's roles and permissions.

The aim is to improve usability compared to the existing interface.

New configuration options

There will be an new admin option to control which fields are searched when selecting users, in addition to fullname. Three other options will be available: email, idnumber and username.

I know Petr will disapprove of username appearing on the list, because revealing usernames has security implications. However, I know several institutions that want this functionality, and I think we should supply it rather than making lots of different people hack the code. I will, however add a suitable warning to the description of this option. By default, only email will be selected, as at present.--Tim Hunt

User interface

The selector will be available either as a stand alone HTML control, or as a formslib component.

With JavaScript off

Userselector.png

It will work very much like it does at the moment:

It will be a list box that either lists users, or says that the list is too long and you should search. There will be a search box below with a search button to do the searching.

The list of users may be displayed in opt-groups, depending on where this control appears. For example, on the group members page, users are grouped by role.

There will be a new feature, some controls to to allow you to choose the sort order.

With JavaScript on

The search button will dissappear, and user searching and sorting will be done with Ajax.

HTML element names

Suppose that the developers asks for a user selector with name myuserselector. Then in the list box (<select>) will have name="myuserselector". The search text box will have name="myuserselector_searchtext", the search button name="myuserselector_dosearch" and the sort buttons name="myuserselector_sort_lastname", name="myuserselector_sort_email", etc.

Code architecture

Class based

API

For subclasses

For users

See also