From 525ef9c8b497a25a5c49b638bd2c57e2d620c804 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Fri, 19 Aug 2016 16:44:48 +0800 Subject: [PATCH] MDL-51948 core: Patch core areas for LTR forms Part of MDL-55071 --- admin/registration/forms.php | 1 + admin/tool/uploaduser/user_form.php | 5 ++++ cache/stores/memcache/addinstanceform.php | 1 + cache/stores/memcached/addinstanceform.php | 1 + calendar/managesubscriptions_form.php | 1 + grade/edit/tree/calculation_form.php | 1 + install.php | 22 ++++++++-------- install/css.php | 4 +++ login/signup_form.php | 2 ++ mod/lti/edit_form.php | 3 +++ mod/lti/mod_form.php | 2 ++ notes/edit_form.php | 1 + theme/bootstrapbase/less/moodle/forms.less | 29 +--------------------- theme/bootstrapbase/style/moodle.css | 26 ------------------- user/editlib.php | 7 ++++++ 15 files changed, 41 insertions(+), 65 deletions(-) diff --git a/admin/registration/forms.php b/admin/registration/forms.php index 8eff8411bb428..5f89d0c0d9b40 100644 --- a/admin/registration/forms.php +++ b/admin/registration/forms.php @@ -329,6 +329,7 @@ public function definition() { array('class' => 'registration_textfield')); $mform->setType('contactphone', PARAM_TEXT); $mform->addHelpButton('contactphone', 'sitephone', 'hub'); + $mform->setForceLtr('contactphone'); $mform->addElement('text', 'contactemail', get_string('siteemail', 'hub'), array('class' => 'registration_textfield')); diff --git a/admin/tool/uploaduser/user_form.php b/admin/tool/uploaduser/user_form.php index dfd212372cd17..29cfec03e978e 100644 --- a/admin/tool/uploaduser/user_form.php +++ b/admin/tool/uploaduser/user_form.php @@ -211,11 +211,13 @@ function definition () { $mform->addRule('username', get_string('requiredtemplate', 'tool_uploaduser'), 'required', null, 'client'); $mform->disabledIf('username', 'uutype', 'eq', UU_USER_ADD_UPDATE); $mform->disabledIf('username', 'uutype', 'eq', UU_USER_UPDATE); + $mform->setForceLtr('username'); $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"'); $mform->setType('email', PARAM_RAW); // No cleaning here. The process verifies it later. $mform->disabledIf('email', 'uutype', 'eq', UU_USER_ADD_UPDATE); $mform->disabledIf('email', 'uutype', 'eq', UU_USER_UPDATE); + $mform->setForceLtr('email'); // only enabled and known to work plugins $choices = uu_supported_auths(); @@ -281,6 +283,7 @@ function definition () { $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"'); $mform->setType('idnumber', PARAM_NOTAGS); + $mform->setForceLtr('idnumber'); $mform->addElement('text', 'institution', get_string('institution'), 'maxlength="255" size="25"'); $mform->setType('institution', PARAM_TEXT); @@ -293,10 +296,12 @@ function definition () { $mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"'); $mform->setType('phone1', PARAM_NOTAGS); $mform->setAdvanced('phone1'); + $mform->setForceLtr('phone1'); $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"'); $mform->setType('phone2', PARAM_NOTAGS); $mform->setAdvanced('phone2'); + $mform->setForceLtr('phone2'); $mform->addElement('text', 'address', get_string('address'), 'maxlength="255" size="25"'); $mform->setType('address', PARAM_TEXT); diff --git a/cache/stores/memcache/addinstanceform.php b/cache/stores/memcache/addinstanceform.php index 5a90f392b6ba7..27135ef3fc2e5 100644 --- a/cache/stores/memcache/addinstanceform.php +++ b/cache/stores/memcache/addinstanceform.php @@ -52,6 +52,7 @@ protected function configuration_definition() { $form->setType('prefix', PARAM_TEXT); // We set to text but we have a rule to limit to alphanumext. $form->setDefault('prefix', 'mdl_'); $form->addRule('prefix', get_string('prefixinvalid', 'cachestore_memcache'), 'regex', '#^[a-zA-Z0-9\-_]+$#'); + $form->setForceLtr('prefix'); $form->addElement('header', 'clusteredheader', get_string('clustered', 'cachestore_memcache')); diff --git a/cache/stores/memcached/addinstanceform.php b/cache/stores/memcached/addinstanceform.php index 004063aedd44b..d455b397562dc 100644 --- a/cache/stores/memcached/addinstanceform.php +++ b/cache/stores/memcached/addinstanceform.php @@ -73,6 +73,7 @@ protected function configuration_definition() { $form->setType('prefix', PARAM_TEXT); // We set to text but we have a rule to limit to alphanumext. $form->addHelpButton('prefix', 'prefix', 'cachestore_memcached'); $form->addRule('prefix', get_string('prefixinvalid', 'cachestore_memcached'), 'regex', '#^[a-zA-Z0-9\-_]+$#'); + $form->setForceLtr('prefix'); $hashoptions = cachestore_memcached::config_get_hash_options(); $form->addElement('select', 'hash', get_string('hash', 'cachestore_memcached'), $hashoptions); diff --git a/calendar/managesubscriptions_form.php b/calendar/managesubscriptions_form.php index 769a5b5408ca0..12ab3ac5b740e 100644 --- a/calendar/managesubscriptions_form.php +++ b/calendar/managesubscriptions_form.php @@ -60,6 +60,7 @@ public function definition() { $mform->addElement('text', 'url', get_string('importfromurl', 'calendar'), array('maxsize' => '255', 'size' => '50')); // Cannot set as PARAM_URL since we need to allow webcal:// protocol. $mform->setType('url', PARAM_RAW); + $mform->setForceLtr('url'); // Poll interval $choices = calendar_get_pollinterval_choices(); diff --git a/grade/edit/tree/calculation_form.php b/grade/edit/tree/calculation_form.php index fc5e08809d3f9..e6491995f74f0 100644 --- a/grade/edit/tree/calculation_form.php +++ b/grade/edit/tree/calculation_form.php @@ -59,6 +59,7 @@ function definition() { $mform->addElement('static', 'itemname', get_string('itemname', 'grades')); $mform->addElement('textarea', 'calculation', get_string('calculation', 'grades'), 'cols="60" rows="5"'); $mform->addHelpButton('calculation', 'calculation', 'grades'); + $mform->setForceLtr('calculation'); /// hidden params $mform->addElement('hidden', 'id', 0); diff --git a/install.php b/install.php index 4bdcf4113b4cd..5d1e8fcd8355b 100644 --- a/install.php +++ b/install.php @@ -435,34 +435,34 @@ $disabled = empty($distro->dbhost) ? '' : 'disabled="disabled'; echo '
'; - echo '
'; + echo '
'; echo '
'; echo '
'; - echo '
'; + echo '
'; echo '
'; $disabled = empty($distro->dbuser) ? '' : 'disabled="disabled'; echo '
'; - echo '
'; + echo '
'; echo '
'; echo '
'; // no password field here, the password may be visible in config.php if we can not write it to disk - echo '
'; + echo '
'; echo '
'; echo '
'; - echo '
'; + echo '
'; echo '
'; echo '
'; - echo '
'; + echo '
'; echo '
'; if (!(stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin'))) { echo '
'; - echo '
'; + echo '
'; echo '
'; } @@ -572,15 +572,15 @@ echo '
'; echo '
'; - echo '
'; + echo '
'; echo '
'; echo '
'; - echo '
'; + echo '
'; echo '
'; echo '
'; - echo '
'; + echo '
'; if ($hint_dataroot !== '') { echo '
'.$hint_dataroot.'
'; } @@ -589,7 +589,7 @@ if (!file_exists("$CFG->dirroot/admin/environment.xml")) { echo '
'; - echo '
'; + echo '
'; if ($hint_admindir !== '') { echo '
'.$hint_admindir.'
'; } diff --git a/install/css.php b/install/css.php index ae6e96daf6fa2..f23e728f27ce1 100644 --- a/install/css.php +++ b/install/css.php @@ -47,6 +47,10 @@ padding: 4px; } +.text-ltr { + direction: ltr !important; +} + .headermain { margin: 15px; } diff --git a/login/signup_form.php b/login/signup_form.php index 047efd7e0e75e..9cbee53463c22 100644 --- a/login/signup_form.php +++ b/login/signup_form.php @@ -55,10 +55,12 @@ function definition() { $mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="25"'); $mform->setType('email', core_user::get_property_type('email')); $mform->addRule('email', get_string('missingemail'), 'required', null, 'client'); + $mform->setForceLtr('email'); $mform->addElement('text', 'email2', get_string('emailagain'), 'maxlength="100" size="25"'); $mform->setType('email2', core_user::get_property_type('email')); $mform->addRule('email2', get_string('missingemail'), 'required', null, 'client'); + $mform->setForceLtr('email2'); $namefields = useredit_get_required_name_fields(); foreach ($namefields as $field) { diff --git a/mod/lti/edit_form.php b/mod/lti/edit_form.php index 754608daa9cbb..b667e2dd010b5 100644 --- a/mod/lti/edit_form.php +++ b/mod/lti/edit_form.php @@ -85,6 +85,7 @@ public function definition() { $mform->addElement('text', 'lti_resourcekey', get_string('resourcekey_admin', 'lti')); $mform->setType('lti_resourcekey', PARAM_TEXT); $mform->addHelpButton('lti_resourcekey', 'resourcekey_admin', 'lti'); + $mform->setForceLtr('lti_resourcekey'); $mform->addElement('passwordunmask', 'lti_password', get_string('password_admin', 'lti')); $mform->setType('lti_password', PARAM_TEXT); @@ -96,11 +97,13 @@ public function definition() { $mform->setType('lti_parameters', PARAM_TEXT); $mform->addHelpButton('lti_parameters', 'parameter', 'lti'); $mform->disabledIf('lti_parameters', null); + $mform->setForceLtr('lti_parameters'); } $mform->addElement('textarea', 'lti_customparameters', get_string('custom', 'lti'), array('rows' => 4, 'cols' => 60)); $mform->setType('lti_customparameters', PARAM_TEXT); $mform->addHelpButton('lti_customparameters', 'custom', 'lti'); + $mform->setForceLtr('lti_customparameters'); if (!empty($this->_customdata->isadmin)) { $options = array( diff --git a/mod/lti/mod_form.php b/mod/lti/mod_form.php index 87819d4e728cf..91c55f19713af 100644 --- a/mod/lti/mod_form.php +++ b/mod/lti/mod_form.php @@ -158,6 +158,7 @@ public function definition() { $mform->setAdvanced('resourcekey'); $mform->addHelpButton('resourcekey', 'resourcekey', 'lti'); $mform->disabledIf('resourcekey', 'typeid', 'neq', '0'); + $mform->setForceLtr('resourcekey'); $mform->addElement('passwordunmask', 'password', get_string('password', 'lti')); $mform->setType('password', PARAM_TEXT); @@ -169,6 +170,7 @@ public function definition() { $mform->setType('instructorcustomparameters', PARAM_TEXT); $mform->setAdvanced('instructorcustomparameters'); $mform->addHelpButton('instructorcustomparameters', 'custom', 'lti'); + $mform->setForceLtr('instructorcustomparameters'); $mform->addElement('text', 'icon', get_string('icon_url', 'lti'), array('size' => '64')); $mform->setType('icon', PARAM_URL); diff --git a/notes/edit_form.php b/notes/edit_form.php index 5494a5e87ca8a..b124a6314775c 100644 --- a/notes/edit_form.php +++ b/notes/edit_form.php @@ -32,6 +32,7 @@ public function definition() { $mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows' => 15, 'cols' => 40)); $mform->setType('content', PARAM_RAW); $mform->addRule('content', get_string('nocontent', 'notes'), 'required', null, 'client'); + $mform->setForceLtr('content', false); $mform->addElement('select', 'publishstate', get_string('publishstate', 'notes'), note_get_state_names()); $mform->setDefault('publishstate', NOTES_STATE_PUBLIC); diff --git a/theme/bootstrapbase/less/moodle/forms.less b/theme/bootstrapbase/less/moodle/forms.less index 5a32b472edb34..9d0e8c6a6daca 100644 --- a/theme/bootstrapbase/less/moodle/forms.less +++ b/theme/bootstrapbase/less/moodle/forms.less @@ -121,10 +121,7 @@ form { .singleselect label { margin-right: .3em; } -input#id_externalurl { - /*rtl:ignore*/ - direction: ltr; -} + #portfolio-add-button { display: inline; } @@ -216,18 +213,6 @@ div.backup-section + form, color: @textColor; text-decoration: none; } -// I think this could be avoided (or at least tidied up) ifr -// we used HTML5 input types like url, phone, email, number etc. -/*rtl:ignore*/ -.mform .fitem .felement input[name=email], -.mform .fitem .felement input[name=email2], -.mform .fitem .felement input[name=url], -.mform .fitem .felement input[name=idnumber], -.mform .fitem .felement input[name=phone1], -.mform .fitem .felement input[name=phone2] { - text-align: left; - direction: ltr; -} #page-grade-edit-outcome-course .courseoutcomes { margin-left: auto; @@ -237,18 +222,6 @@ div.backup-section + form, #page-grade-edit-outcome-course .courseoutcomes td { text-align: center; } -/* Install Process' text fields Forms, should always be justified to the left */ -/*rtl:ignore*/ -#installform #id_wwwroot, -#installform #id_dirroot, -#installform #id_dataroot, -#installform #id_dbhost, -#installform #id_dbname, -#installform #id_dbuser, -#installform #id_dbpass, -#installform #id_prefix { - direction: ltr; -} .mdl-right > label { // Workaround for repository pop-up because the : are outside the label, diff --git a/theme/bootstrapbase/style/moodle.css b/theme/bootstrapbase/style/moodle.css index 7116a9275f2cb..6acfa14f19448 100644 --- a/theme/bootstrapbase/style/moodle.css +++ b/theme/bootstrapbase/style/moodle.css @@ -12899,10 +12899,6 @@ form { .singleselect label { margin-right: .3em; } -input#id_externalurl { - /*rtl:ignore*/ - direction: ltr; -} #portfolio-add-button { display: inline; } @@ -13036,16 +13032,6 @@ div.backup-section + form:after, color: #333; text-decoration: none; } -/*rtl:ignore*/ -.mform .fitem .felement input[name=email], -.mform .fitem .felement input[name=email2], -.mform .fitem .felement input[name=url], -.mform .fitem .felement input[name=idnumber], -.mform .fitem .felement input[name=phone1], -.mform .fitem .felement input[name=phone2] { - text-align: left; - direction: ltr; -} #page-grade-edit-outcome-course .courseoutcomes { margin-left: auto; margin-right: auto; @@ -13054,18 +13040,6 @@ div.backup-section + form:after, #page-grade-edit-outcome-course .courseoutcomes td { text-align: center; } -/* Install Process' text fields Forms, should always be justified to the left */ -/*rtl:ignore*/ -#installform #id_wwwroot, -#installform #id_dirroot, -#installform #id_dataroot, -#installform #id_dbhost, -#installform #id_dbname, -#installform #id_dbuser, -#installform #id_dbpass, -#installform #id_prefix { - direction: ltr; -} .mdl-right > label { display: inline-block; } diff --git a/user/editlib.php b/user/editlib.php index 67f2f4a38740b..e09935b52c4a5 100644 --- a/user/editlib.php +++ b/user/editlib.php @@ -366,18 +366,23 @@ function useredit_shared_definition(&$mform, $editoroptions, $filemanageroptions $mform->addElement('text', 'icq', get_string('icqnumber'), 'maxlength="15" size="25"'); $mform->setType('icq', core_user::get_property_type('icq')); + $mform->setForceLtr('icq'); $mform->addElement('text', 'skype', get_string('skypeid'), 'maxlength="50" size="25"'); $mform->setType('skype', core_user::get_property_type('skype')); + $mform->setForceLtr('skype'); $mform->addElement('text', 'aim', get_string('aimid'), 'maxlength="50" size="25"'); $mform->setType('aim', core_user::get_property_type('aim')); + $mform->setForceLtr('aim'); $mform->addElement('text', 'yahoo', get_string('yahooid'), 'maxlength="50" size="25"'); $mform->setType('yahoo', core_user::get_property_type('yahoo')); + $mform->setForceLtr('yahoo'); $mform->addElement('text', 'msn', get_string('msnid'), 'maxlength="50" size="25"'); $mform->setType('msn', core_user::get_property_type('msn')); + $mform->setForceLtr('msn'); $mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"'); $mform->setType('idnumber', core_user::get_property_type('idnumber')); @@ -390,9 +395,11 @@ function useredit_shared_definition(&$mform, $editoroptions, $filemanageroptions $mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"'); $mform->setType('phone1', core_user::get_property_type('phone1')); + $mform->setForceLtr('phone1'); $mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"'); $mform->setType('phone2', core_user::get_property_type('phone2')); + $mform->setForceLtr('phone2'); $mform->addElement('text', 'address', get_string('address'), 'maxlength="255" size="25"'); $mform->setType('address', core_user::get_property_type('address'));