459 Commits

Author SHA1 Message Date
Marina Glancy
b4eb5f0212 MDL-34859 forms: new element defaultcustom 2017-03-20 14:59:45 +08:00
Damyon Wiese
663640f5b3 MDL-40759 icons: convert uses of pix_url to pix_icon
Also change filepicker to use scaled svgs instead of sets of custom pngs. The svgs are taken from font-awesome.
2017-03-17 15:52:17 +08:00
Damyon Wiese
a26ce2482a MDL-40759 themes: font awesome support
We add a new theme config so the theme can say it supports font-awesome.
If this is true, the pix_icon renderer will call a mapping function to map
from the moodle style t/edit to a font-awesome style fa-cog icon name. Then the renderer
will either render an image tag for old icons - or an accessible font-awesome <i> tag.

This mostly works - but there are some places where we don't use the pix icon renderer, and
we directly create image tags with pix_url image sources. These will need updating (Atto icons,
drag and drop move icons, editpdf icons).
2017-03-17 15:51:28 +08:00
Frederic Massart
547801a411 MDL-57273 form: Persistent form automatically setType on some fields 2017-01-20 12:56:19 +08:00
godric
4c4b966a92 MDL-40132 lib: Using compare rule results in fatal error.
In getValidationScript function variable $element can be an array or object.
Function attempt get non-existing attributes.
To avoid this we should check before accessing.
2017-01-07 09:40:27 +03:00
Dan Poltawski
2fa2ed50eb MDL-57471 forms: deprecate init_javascript_enhancement()
This was half-finished and only used for the smartselect enhancement. That
enhancement doesn't work with theme_boost and is better replaced just
using the searchableselector element.
2016-12-22 12:19:51 +00:00
Daniel Thee Roperto
518eb19337 MDL-56233 forms library: Fixed form identifier when mocking a form.
If the plugin is using namespaces instead of frankenstyle class name,
get_called_class() will return 'type\name' instead of 'type_name'.

Added code to replace backslashes to underscores and fix that issue.
2016-12-05 11:27:05 +11:00
Eloy Lafuente (stronk7)
0d80f6984b Merge branch 'MDL-56250-32-formvalidation' of https://github.com/roperto/moodle 2016-10-25 20:23:12 +02:00
Andrew Nicols
ac157b0bbe MDL-53048 forms: Deprecate prevent_form_autofill_password 2016-10-24 08:19:44 +08:00
Daniel Thee Roperto
8b9ca065d8 MDL-56250 forms library: Changed form to validate once per object.
If two instances of moodleforms are validated in the same run, most
likely a phpunit test run, it would store the first validation result.
Now it stores the validation result per instance, not for all instances.
2016-10-21 10:43:03 +11:00
Damyon Wiese
e584e6ae46 MDL-55071 theme/output: PHPCS fixes for new theme branch
Part of MDL-55071
2016-09-23 10:57:36 +01:00
Frederic Massart
8a40bc36a6 MDL-51948 admin: Guess RTL compatibility of settings using PARAM_ types
Part of MDL-55071
2016-09-23 10:57:35 +01:00
Frederic Massart
3264bf5b56 MDL-55593 form: Wrap skip validation variable in script tag
Part of MDL-55071
2016-09-23 10:55:18 +01:00
Damyon Wiese
63e4df60f6 MDL-55839 behat: Behat fixes for theme_noname
This is a squash of many small fixes.
The list of changes are:

Initial set of behat selectors overrides required for new theme.

set core behat selectors if not overridden by theme

Remove pause

Fix for checkboxes not saving properly

Custom override for click in the user menu

Fix for behat guessing the field type.

Behat fix for guessing the correct field type.

Fix for missing closeElementBefore mforms mess.

Fix for textareas not displaying their contents.

Fix availability form element

Fix action menu selectors for activities in a course page

Fix textareas not retaining their values

Fix selector for blocks

I had to change the single select template to use an input instead of a button because of a
behat bug we have not tracked down yet.

Fix for frozen attribute in form elements

Use input instead of button while behat is still broken

Fix for navigation selector override

Behat selector fixes and multi-select fixes for templated select

Fix for configure blocks selector + booleans for autocomplete

Fixes for course_summary behat tests

Allow optgroups in single_select

Behat fixes for block_navigation

Fixes for url form element and activity chooser selectors

blocks_social - fix specific selector for behat

Fix export_for_template for selectgroups element.

Dont set empty id on the form

Fix direct call to behat_navigation in backup context

Checkbox empty value fix

Fix for assign grading panel popouts

file picker overrides to find a file manager in the page

Fix chat tests to use element name

Make selectors in mod_data behat less specific

MDL-55839: recent activity behat test relies on time()

SQUASH Honour mform element "class" attribute on the container

SQUASH Fixes for behat in mod_forum

SQUASH search form template showing value as text next to the button

SQUASH undo double selectgroup fix

SQUASH - The slightly different structure to action menus breaks course drag and drop

SQUASH Wrap loading icon in a span so the selector still works.

SQUASH Fix fragile javascript in report_loglive

SQUASH Fix tabtree, and selectgroups for mod_feedback

Also - do-not enhance the action menu - we are dropping support for this.

SQUASH Fix filemanager selector and pix_icon template for mod_forum tests.

SQUASH Fixes to breadcrumb and add formid to single select (fixes mod_glossary tests)

SQUASH lesson behat fixes. 95% of lesson styles were rubbish so they were disgarded.

SQUASH Fix lti behat tests - they were cheating and using a context step from quiz

SQUASH Behat fixes for quiz with new theme

SQUASH behat fixes for mod_wiki

SQUASH Workshop behat fixes

SQUASH Frozen form elements cannot use a readonly form element because it screws with the form JS "disabledIf" stuff.

SQUASH Fixes for grades behat tests

SQUASH behat fixes for groups

SQUASH blacklist action menu tests

SQUASH Fix for tag form element missing "manage standard tags" link

SQUASH Incomplete fixes for course behat tests

SQUASH behat fixes for badges

SQUASH Tags fixes for behat

SQUASH filepicker fixes for behat

SQUASH Abort guessing field type when we hit 'html'

SQUASH Fix for admin/tool/behat tests

SQUASH fix for admin tool behat tests

SQUASH fix for availabilty conditions hiding "aria-hidden" elements

SQUASH give the blocks more room. We get behat files because nav tree nodes are not in view

SQUASH Blocks fixed

Fix behaviour of unchecked checkboxes

SQUASH Remove incorrect step in user test

SQUASH behat fixes for course tests

Part of MDL-55071
2016-09-23 10:55:16 +01:00
Frederic Massart
df07fead55 MDL-55829 form: Define 'skipClientValidation' as a global JS var
Part of MDL-55071
2016-09-23 10:55:16 +01:00
Frederic Massart
fc7f69e7e8 MDL-51948 formslib: Support forcing LTR on form elements
Part of MDL-55071
2016-09-23 10:54:49 +01:00
Damyon Wiese
d6f2ce1486 MDL-55656 theme_noname: Include advanced and required field markup
The new form elements were not including the markup for advanced
and required fields. I used an <abbr> tag in the label to give
and accessible indication of the advanced and required fields.

Part of MDL-55071
2016-09-23 10:53:56 +01:00
Damyon Wiese
91bda4cd45 MDL-55417 forms: Render form elements with a template
This change allows form elements to be overridden with a mustache template.
The template can even listen for form validation errors and supply the JS to
change the look of the form element when there is/isn't a validation error.

Initial support is for all core form elements including:

text, select, selectyesno and checkboxes, groups, dateselector, datetimeselector,
autocomplete, modvisible, advcheckbox, button, duration, filemanager, filepicker, editor, static, grading,
warning, textarea, password, url, submit, questioncategory, recaptcha.

Part of MDL-55071
2016-09-23 10:53:30 +01:00
Rajesh Taneja
9b9afffe5b
MDL-55288 forms: Set data attribute to form fields 2016-09-05 14:10:24 +08:00
Dan Poltawski
5d84a61419 Merge branch 'MDL-54633-master-tinymce' of git://github.com/mudrd8mz/moodle 2016-05-19 13:00:34 +01:00
David Mudrák
929727e3ef MDL-54633 tinymce: Sync editors' iframe to textarea on form submit
The previous commit "Automatically sync editor with its textarea" was
found a not good solution as the onchange event is triggered way less
often than needed for our needs. So this reverts commit 34321d49.

Instead, we add a hack to the formslib so that when there are some
TinyMCE editors used at the page, we explicitly save them before
triggering the form validation. This simply calls save() on all editors
on the page - see the API reference:
http://archive.tinymce.com/wiki.php/API3:method.tinymce.triggerSave

Having TinyMCE hardcoded like this on this core level does not make me
happy. But it seems to be most effective solution for now (and
definitely more efficient than the previous solution). Plus there is a
precedence - we already use window.tinyMCE in formchangechecker.js YUI
module, for example.
2016-05-19 13:44:41 +02:00
Mark Nelson
40d5651302 MDL-53883 core_form: updated the group elements ID 2016-05-17 17:53:17 +08:00
Rajesh Taneja
45fb8b5983 MDL-53701 core_lib: use date_format_string for utf8
So when language is different say Hebrew then
it would pic codepage-1255. As  is json_encoded
we need to ensure we get utf8 string. so use
date_format_string instead
2016-05-05 16:34:41 +08:00
Marina Glancy
cf28c515f3 MDL-53638 forms: allow all elements to have css class 2016-04-27 13:27:12 +08:00
Damyon Wiese
6853cd5ed4 MDL-52954 assign: Fix the reasonable cibot warnings. 2016-03-30 14:07:28 +08:00
Damyon Wiese
bb690849c9 MDL-52954 assign: Rebuild the assignment single grade page. 2016-03-30 13:47:21 +08:00
Damyon Wiese
84a32f156e MDL-52954 forms: Allow form submission via ajax (ignoring GET and POST) 2016-03-30 11:48:40 +08:00
Eloy Lafuente (stronk7)
197f99a808 Merge branch 'MDL-52978_master' of git://github.com/markn86/moodle 2016-03-21 23:07:16 +01:00
Grigory Baleevskiy
53754839d2 MDL-52978 core_lib: fixed wrong days showing for dates in datepicker 2016-03-18 12:29:58 +08:00
John Okely
67cdf4efae MDL-52952 forms: Fix chrome autofilling passwords again
In MDL-45772 a hack was introduced to some forms to stop browsers from
putting the user's password into password fields in forms unrelated to
logging in.

Chrome now no longer fills the user's password in the first password
field in the page. There now needs to be a plain text input above it
for the username too.
2016-03-11 10:26:50 +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
Rajesh Taneja
2aacd415e1 MDL-50484 mod_lesson: Use group to add multiple radio inputs
https://docs.moodle.org/dev/lib/formslib.php_Form_Definition#radio
Radio input should be added in group and not individual, so
that each element created has unique id and template
2016-02-19 14:00:03 +08:00
David Monllao
3e51b0ad7e MDL-52826 forms: Using id attr
Switch from custom id references to the element's id attribute.

Extra fix to get rid of an unnecessary call to getValidationScript().
2016-01-29 10:15:25 +08:00
David Monllao
2edb12ec30 MDL-52826 forms: Move global functions to self-contained 2016-01-22 15:43:08 +08:00
Dan Poltawski
99436d38ff Merge branch 'MDL-52451-master' of git://github.com/marinaglancy/moodle 2015-12-14 10:46:29 +00:00
Marina Glancy
e6ee56a0e4 MDL-52451 forms: replace deprecated function 2015-12-14 12:43:03 +08:00
Marina Glancy
32fada5cb2 MDL-52081 forms: indicate usage of grandparent constructor 2015-12-10 13:38:04 +08:00
Marina Glancy
1a0df5535e MDL-52081 forms: Use __construct() for constructors 2015-12-10 13:38:01 +08:00
Andrew Nicols
690e23e69d Merge branch 'MDL-51651-master' of git://github.com/danpoltawski/moodle 2015-10-16 09:21:45 +08:00
Dan Poltawski
f655414669 MDL-51651 lang: add consitency for application of firstdayofweek
1) Set the site-wide default based on language pack
2) Use the site/user preference for js popups, like we do in /calendar/
2015-10-15 10:15:05 +01:00
Damyon Wiese
60a1ea56d9 MDL-51247 forms: All new aria-pimped autocomplete mform element.
Supports static list of options - or options fetched via ajax.
Has options for single,multi and tags support.
2015-10-14 16:22:44 +01:00
Jun Pataleta
36e0030ffe MDL-50852 formslib: Fixed client-side form validation problem.
This patch fixes the problem of client validation being broken when
shortforms is not enabled. This issue is caused by moodle-core-event
module not being loaded and the broadcast parameter in the
Y.Global.publish set to 2 instead of true.
2015-09-09 15:35:01 +08:00
Marina Glancy
a3c9174b3d MDL-50791 forms: make server validation errors accessible 2015-08-12 13:23:08 +08:00
John Okely
380001929a MDL-45772 admin: Stop browsers from autofilling passwords incorrectly 2015-08-04 09:54:34 +08:00
Martin Mastny
9cf1b21127 MDL-50186 forms: Removed special characters from id attribute 2015-05-28 11:41:51 +08:00
Martin Mastny
eaec9cfec7 MDL-49783 forms: Collapsed form section is opened on error 2015-05-07 08:57:30 +08:00
Tim Hunt
b3d388c234 MDL-49284 formslib: fix strict validation of HTML. 2015-02-25 17:39:36 +00:00
Brian Barnes
bbb0733297 MDL-45955 forms: replaced labels in static text elements 2014-12-10 17:28:09 +13:00
Paul Holden
68ef378b1b MDL-44657 forms: Form identifiers should only contain basic characters 2014-11-13 16:20:28 +08:00
Marina Glancy
bf8542ce3a MDL-30358 forms: strict validation is too strict 2014-10-15 11:57:01 +08:00