Introducing both APIs in moodle along with:
- search_box widget to add a tiny search box
- admin settings with setup steps helper
- cache for search results
- template for a search result
- php unit stuff
Many thanks to Tomasz Muras, Prateek Sachan and Daniel Neis for their contributions, for starting this development
and for pushing for it to be completed. Also thanks to other contributors: Jonathan Harker and eugeneventer.
Also:
* In behat, ensure nav node exists before checking attribute (Credit to
Rajesh Taneja)
* Remove some unused JS constants
* Fix debugging notice for users without settings block
In some cases, underscores in lang codes get replaced with dashes
which causes some JavaScript to be unhappy. This patch simply reverse
the underscore to dash replacement on the JS side.
Quickly navigating via the keyboard to an autocomplete
element and hitting down would result in the selections
being displayed and then quickly removed. This has now
been fixed.
Fixes 3 problems with deselecting items in an autocomplete field:
1. Keep track of whether items were in the offical suggestion list, or are newly created
tags and remove the "newly created tags" from the suggestion list when they are
deselected
2. Change the aria-role for the selected items list when items cannot be deselected (and
do not treat it like a multiselect list).
3. When leaving and returning focus to the selected items list, remember the last
active-descendant.
Stopped the keyboard navigation from completely deleting
list options when being deselected using keyboard navigation.
They are now returned to the list of available options to be
reselected.
Also remove the cross from the selected element when it is
a single select box.
When nodes are added to the dom, they may need to be re-processed by a JS based
filter. To do this we need to trigger the legacy YUI event filter-content-updated.
To make this easier I added some wrappers to template that will insert the node, run any
JS and trigger the event.
I also changed existing yui code to call the amd function to trigger the event. This way
all jquery and yui listeners will always be notified.
Now the db/service.php array can contain these extra keys to provide information
on how a webservice may be called:
'ajax' => true (Default is false)
Replaces the xx_is_allowed_from_ajax callback.
'loginrequired' => false (Default is true)
Means that this webservice can be called through lib/ajax/service-nosession.php
which sets NO_MOODLE_COOKIES to true (faster). This is only safe for webservices returning
static public data (e.g. get_string).
The first ajax load fetches the template and puts it in localstorage + a js var
The second load gets it from local storage, but does not put it in the js var.
The pix_icon helper expects it to be in the js var always.