76 Commits

Author SHA1 Message Date
Marina Glancy
eb97811bee MDL-52760 forms: notify form changes in autocomplete element 2016-03-18 08:16:55 +08:00
Damyon Wiese
6f326bd204 MDL-27628 enrol_meta: Use new multi-course selector
Allows adding multiple instances of the meta enrol plugin at once.

I had to add support to the autocomplete element for filling the field from behat
when it was not using tags. I also had to make the shortnames more easily searchable
and unique in the behat feature file.
2016-03-09 13:32:08 +08:00
Damyon Wiese
91ab264cf5 MDL-51324 forms: fix autocomplete element double selection bug
Incorrect types were preventing the currently selected values from
being removed from the new values returned via ajax.

Also fix a selection bug with autocomplete+ajax+singleselect.
2016-03-09 13:30:27 +08:00
Damyon Wiese
235ef57a3d MDL-51324 forms: Add a new course selector
This is a squashed commit containing a number of changes:

This is an ajax driven course selector that has searching etc. It can select single, or multiple courses.
Make course selector accept a list of courses to exclude
courseselector - lookup coursename on setValue
Use the get_course_display_name_in_list function to generate the course names
Add a throttle to auto-complete to reduce spamming the server
Do a single query to fetch all the courses in the mform element when validation fails
Fix core course search function to return results when there are less than 2 chars in the query.
Handle setData with an empty array in new course selector
2016-03-09 13:30:18 +08:00
Andrew Nicols
889b92c1c0 Merge branch 'MDL-53291_ajax_fix' of https://github.com/BenKelada/moodle 2016-03-08 07:43:31 +08:00
Andrew Nicols
c1cb65d470 MDL-30811 javascript: alert JS should be in template
By moving the JS required for an alert to the JavaScript we make it
possible for themers to use frameworks other than bootstrap if they so
wish.
2016-03-03 15:09:17 +08:00
Andrew Nicols
11a67b211b MDL-30811 javascript: Lazily load core dependencies
To prevent possible race conditions, we lazily load the templates, and ajax
dependencies.
2016-03-03 14:47:07 +08:00
Ben Kelada
023d6a6756 MDL-53291 javascript: fix jquery ajax requests when data contains ??
jQuery ajax requests containing multiple '?' get replaced with a
string similar to jQuery152330039032_1231231, this is because it
is processing a stringified data object as jsonp and thinks its a url.
 workaround is to add contenttype
see https://github.com/jquery/jquery/issues/1799
2016-03-03 09:15:24 +11:00
Eloy Lafuente (stronk7)
df190d18a1 MDL-52136 mod_forum: fix some out-of-sync stuff
Thanks CIs!
2016-03-02 05:42:29 +01:00
Eloy Lafuente (stronk7)
ce878562f3 Merge branch 'MDL-52136-master' of git://github.com/andrewnicols/moodle 2016-03-02 05:25:57 +01:00
Andrew Nicols
0b4bff8ca9 MDL-52136 core: Add support for quoting variables in mustache helpers
This is required for when helpers include json-encoded variables as arguments.
As an example, imagine a template with content:

{{# str }} somekey, someidentifier, { "fullname": "{{ fullname }}" } {{/ str }}

If the fullname variable were to include the double-quote character (e.g.
John "Trevor" Doe) because of the way in which mustache renders content, it
would become:

{{# str }} somekey, someidentifier, { "fullname": "John "Trevor" Doe" } {{/ str }}

This results in an invalid JSON structure.

To work around this issue, the quote characters in the passed variable
must be escaped:

{{# str }} somekey, someidentifier, { "fullname": "John \"Trevor\" Doe" } {{/ str }}

Unfortunately, Mustache provides no way of doing so natively.

With this function, we can quote the text as appropriate:

{{# str }} somekey, someidentifier, { "fullname": {{# quote }}{{ fullname }}{{/ quote }} } {{/ str }}

This also handles the case where the quoted content includes the Mustache
delimeter ({{ or }}).

For example:
fullname = 'John "}}Trevor{{" Doe'

Ordinarily this would be rendered as:
{{# str }} somekey, someidentifier, { "fullname": "John "}}Trevor{{" Doe" } {{/ str }}

This rendering is both a JSON error, and also a mustache syntax error because of the mustache delimeters.

The quote helper also escapes these by wrapping them in change delimeter
tags:

{{# str }} somekey, someidentifier, { "fullname": "John "{{=<% %>=}}}}<%={{ }}=%>Trevor{{=<% %>=}}{{{{=<% %>=}}" Doe" } {{/ str }}
2016-03-02 08:48:46 +08:00
Eloy Lafuente (stronk7)
d9dfc410ad Merge branch 'wip-MDL-53172-master' of https://github.com/marinaglancy/moodle 2016-03-01 01:59:31 +01:00
Andrew Nicols
0346323cec MDL-30811 output: Add support for session notifications 2016-02-29 09:05:56 +08:00
Andrew Nicols
490934a4ed MDL-53172 javascript: Fix coding style violations 2016-02-27 11:29:27 +08:00
Andrew Nicols
38cf8b6661 MDL-53172 javascript: Stop requiring body manipulation on load 2016-02-27 11:29:27 +08:00
Marina Glancy
8de48ad0ae MDL-53172 core: toggle and select in inplace_editable 2016-02-27 11:29:24 +08:00
David Monllao
69d66020ce MDL-31989 search: get_config method to search areas
Also content_to_text moved to weblib.
2016-02-23 10:47:59 +00:00
David Monllao
db48207e1a MDL-31989 search: Search API and search engine API
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.
2016-02-23 10:47:58 +00:00
Marina Glancy
cdc5f9785b MDL-51802 core: new template for quick editing a title
convert editing tag name to use new template
2016-02-13 11:07:42 +08:00
Dan Poltawski
96c69429e5 Merge branch 'wip-MDL-52715-master-additional' of git://github.com/abgreeve/moodle 2016-02-03 09:44:27 +00:00
Adrian Greeve
a2161d57a4 MDL-52715 lib: Clean up of comments and variable names. 2016-02-03 10:07:08 +08:00
Marina Glancy
e11d7380c2 MDL-51283 core_tag: change tagtype to isstandard
Change 'official' to 'standard' in UI
2016-02-02 17:31:14 +08:00
David Monllao
d23bf21b0a MDL-52715 js: Merge M.str and clean memory 2016-02-01 14:29:09 +08:00
Adrian Greeve
cc73ea075e MDL-52715 lib: Addition of new requirements class.
This adds a fragment requirements class to allow plugins
to register JavaScript to be used in an mform.
2016-02-01 14:29:09 +08:00
David Monllao
ed654d4aa8 MDL-35590 block_navigation: Set attribute on node creation
Otherwise we would need to unescape href and title.
2016-01-29 13:01:26 +08:00
John Okely
a057ba5924 MDL-35590 navigation: Remove link from admin node if you have javascript
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
2016-01-29 11:28:08 +08:00
Ryan Wyllie
5697de1832 MDL-35590 block_navigation: fix keyboard nav
Fixed up the left/right keyboard navigation to match
the aria specification. Also stopped the root node from
being collapsible.
2016-01-29 10:15:26 +08:00
David Monllao
6c3def94fa Merge branch 'MDL-35590-master' of git://github.com/lameze/moodle 2016-01-29 10:15:15 +08:00
Simey Lameze
6759dc35fe MDL-35590 block_navigation: fix remaining issues 2016-01-22 18:48:04 +08:00
John Okely
f889544657 MDL-35590 block_navigation: Add aria roles to navigation block tree 2016-01-21 10:18:22 +08:00
Dan Poltawski
0ff8d34f2f Merge branch 'MDL-52486-master' of git://github.com/cameron1729/moodle 2016-01-18 11:19:55 +00:00
Cameron Ball
035247e0f2 MDL-52486 JavaScript: Make sure lang codes use underscores.
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.
2016-01-11 15:23:29 +08:00
Marina Glancy
c026a28d59 MDL-50851 core_tag: introduce tag collections 2016-01-10 15:25:43 +08:00
Dan Poltawski
f992dcf6e8 MDL-52204 js: fix 'used before defined' errors
Newer versions of jshint detect this coding error, we fix it
by simply reordering the definition of methods.
2015-12-04 11:43:10 +00:00
Ryan Wyllie
e1db2b4112 MDL-52042 autocomplete: close suggestion box
Close the suggestion box when the input loses focus for more
than half a second.
2015-11-09 07:32:56 +00:00
Damyon Wiese
861c1dea98 MDL-51970 autocomplete: Fix for a regression in MDL-51964
This was causing the suggestions list to never open.
Picked up in testing for MDL-51970.
2015-11-04 16:29:47 +08:00
Damyon Wiese
273b255673 MDL-51970 autocomplete: Small refactor because too many options
Each function was taking 8-10 args - combine them all in state and options
objects and pass those around instead.
2015-11-02 10:22:53 +08:00
Damyon Wiese
97d2ea7f87 MDL-51970 autocomplete: Add an option to hide the suggestions
This is used by tags when official tags are disabled.
2015-11-02 10:21:57 +08:00
Damyon Wiese
be9b036a33 MDL-51964 autocomplete: IE11 fires spurious "input" events
We need to check for "real" changes to the input value because
ie11 is just firing events willy nilly.
2015-11-02 10:11:13 +08:00
Andrew Nicols
63a03a8b05 Merge branch 'wip-MDL-51966-master' of https://github.com/marinaglancy/moodle 2015-10-30 07:31:28 +08:00
Marina Glancy
ecbc2a2f25 MDL-51966 forms: case-insensitive search in autocomplete 2015-10-29 15:10:20 +08:00
Dan Poltawski
de342562cc Merge branch 'wip-MDL-51919-master' of git://github.com/abgreeve/moodle 2015-10-28 12:48:18 +00:00
Dan Poltawski
b2aaab60f3 Merge branch 'MDL-51838-master' of git://github.com/damyon/moodle 2015-10-28 11:53:53 +00:00
Adrian Greeve
527bde6e0f MDL-51919 forms lib: Autocomplete doesn't hide prematurely.
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.
2015-10-28 14:15:26 +08:00
Adrian Greeve
d304952b43 MDL-51840 forms lib: keyboard navigation with ajax works.
Ajax autocomplete forms can now be navigated properly with
the keyboard.
2015-10-26 15:03:42 +08:00
Adrian Greeve
adebc069bd MDL-51841 forms lib: Autocomplete fields work with spaces. 2015-10-26 15:02:52 +08:00
Damyon Wiese
81c471e2a9 MDL-51821 forms: Be more explicit in autocomplete if no suggestions 2015-10-26 14:20:25 +08:00
Damyon Wiese
bdd60287e5 MDL-51821 forms: Better handling for deselecting items in autocomplete
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.
2015-10-26 14:20:25 +08:00
Damyon Wiese
32f3de567f MDL-51838 autocomplete: Scroll the suggestions list
Keep the active item "visible" when using keyboard nav on a long list of suggestions.
2015-10-26 12:20:33 +08:00
Dan Poltawski
319310a57c MDL-51792 js: grunt built 2015-10-19 16:48:33 +01:00