Skip to content

Commit 525ef9c

Browse files
Frederic Massartdanpoltawski
Frederic Massart
authored andcommitted
MDL-51948 core: Patch core areas for LTR forms
Part of MDL-55071
1 parent fc7f69e commit 525ef9c

File tree

15 files changed

+41
-65
lines changed

15 files changed

+41
-65
lines changed

admin/registration/forms.php

+1
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ public function definition() {
329329
array('class' => 'registration_textfield'));
330330
$mform->setType('contactphone', PARAM_TEXT);
331331
$mform->addHelpButton('contactphone', 'sitephone', 'hub');
332+
$mform->setForceLtr('contactphone');
332333

333334
$mform->addElement('text', 'contactemail', get_string('siteemail', 'hub'),
334335
array('class' => 'registration_textfield'));

admin/tool/uploaduser/user_form.php

+5
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,13 @@ function definition () {
211211
$mform->addRule('username', get_string('requiredtemplate', 'tool_uploaduser'), 'required', null, 'client');
212212
$mform->disabledIf('username', 'uutype', 'eq', UU_USER_ADD_UPDATE);
213213
$mform->disabledIf('username', 'uutype', 'eq', UU_USER_UPDATE);
214+
$mform->setForceLtr('username');
214215

215216
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
216217
$mform->setType('email', PARAM_RAW); // No cleaning here. The process verifies it later.
217218
$mform->disabledIf('email', 'uutype', 'eq', UU_USER_ADD_UPDATE);
218219
$mform->disabledIf('email', 'uutype', 'eq', UU_USER_UPDATE);
220+
$mform->setForceLtr('email');
219221

220222
// only enabled and known to work plugins
221223
$choices = uu_supported_auths();
@@ -281,6 +283,7 @@ function definition () {
281283

282284
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
283285
$mform->setType('idnumber', PARAM_NOTAGS);
286+
$mform->setForceLtr('idnumber');
284287

285288
$mform->addElement('text', 'institution', get_string('institution'), 'maxlength="255" size="25"');
286289
$mform->setType('institution', PARAM_TEXT);
@@ -293,10 +296,12 @@ function definition () {
293296
$mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"');
294297
$mform->setType('phone1', PARAM_NOTAGS);
295298
$mform->setAdvanced('phone1');
299+
$mform->setForceLtr('phone1');
296300

297301
$mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
298302
$mform->setType('phone2', PARAM_NOTAGS);
299303
$mform->setAdvanced('phone2');
304+
$mform->setForceLtr('phone2');
300305

301306
$mform->addElement('text', 'address', get_string('address'), 'maxlength="255" size="25"');
302307
$mform->setType('address', PARAM_TEXT);

cache/stores/memcache/addinstanceform.php

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ protected function configuration_definition() {
5252
$form->setType('prefix', PARAM_TEXT); // We set to text but we have a rule to limit to alphanumext.
5353
$form->setDefault('prefix', 'mdl_');
5454
$form->addRule('prefix', get_string('prefixinvalid', 'cachestore_memcache'), 'regex', '#^[a-zA-Z0-9\-_]+$#');
55+
$form->setForceLtr('prefix');
5556

5657
$form->addElement('header', 'clusteredheader', get_string('clustered', 'cachestore_memcache'));
5758

cache/stores/memcached/addinstanceform.php

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ protected function configuration_definition() {
7373
$form->setType('prefix', PARAM_TEXT); // We set to text but we have a rule to limit to alphanumext.
7474
$form->addHelpButton('prefix', 'prefix', 'cachestore_memcached');
7575
$form->addRule('prefix', get_string('prefixinvalid', 'cachestore_memcached'), 'regex', '#^[a-zA-Z0-9\-_]+$#');
76+
$form->setForceLtr('prefix');
7677

7778
$hashoptions = cachestore_memcached::config_get_hash_options();
7879
$form->addElement('select', 'hash', get_string('hash', 'cachestore_memcached'), $hashoptions);

calendar/managesubscriptions_form.php

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function definition() {
6060
$mform->addElement('text', 'url', get_string('importfromurl', 'calendar'), array('maxsize' => '255', 'size' => '50'));
6161
// Cannot set as PARAM_URL since we need to allow webcal:// protocol.
6262
$mform->setType('url', PARAM_RAW);
63+
$mform->setForceLtr('url');
6364

6465
// Poll interval
6566
$choices = calendar_get_pollinterval_choices();

grade/edit/tree/calculation_form.php

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function definition() {
5959
$mform->addElement('static', 'itemname', get_string('itemname', 'grades'));
6060
$mform->addElement('textarea', 'calculation', get_string('calculation', 'grades'), 'cols="60" rows="5"');
6161
$mform->addHelpButton('calculation', 'calculation', 'grades');
62+
$mform->setForceLtr('calculation');
6263

6364
/// hidden params
6465
$mform->addElement('hidden', 'id', 0);

install.php

+11-11
Original file line numberDiff line numberDiff line change
@@ -435,34 +435,34 @@
435435

436436
$disabled = empty($distro->dbhost) ? '' : 'disabled="disabled';
437437
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbhost">'.$strdbhost.'</label></div>';
438-
echo '<div class="fitemelement"><input id="id_dbhost" name="dbhost" '.$disabled.' type="text" value="'.s($config->dbhost).'" size="50" /></div>';
438+
echo '<div class="fitemelement"><input id="id_dbhost" name="dbhost" '.$disabled.' type="text" class="text-ltr" value="'.s($config->dbhost).'" size="50" /></div>';
439439
echo '</div>';
440440

441441
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbname">'.$strdbname.'</label></div>';
442-
echo '<div class="fitemelement"><input id="id_dbname" name="dbname" type="text" value="'.s($config->dbname).'" size="50" /></div>';
442+
echo '<div class="fitemelement"><input id="id_dbname" name="dbname" type="text" class="text-ltr" value="'.s($config->dbname).'" size="50" /></div>';
443443
echo '</div>';
444444

445445
$disabled = empty($distro->dbuser) ? '' : 'disabled="disabled';
446446
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbuser">'.$strdbuser.'</label></div>';
447-
echo '<div class="fitemelement"><input id="id_dbuser" name="dbuser" '.$disabled.' type="text" value="'.s($config->dbuser).'" size="50" /></div>';
447+
echo '<div class="fitemelement"><input id="id_dbuser" name="dbuser" '.$disabled.' type="text" class="text-ltr" value="'.s($config->dbuser).'" size="50" /></div>';
448448
echo '</div>';
449449

450450
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbpass">'.$strdbpass.'</label></div>';
451451
// no password field here, the password may be visible in config.php if we can not write it to disk
452-
echo '<div class="fitemelement"><input id="id_dbpass" name="dbpass" type="text" value="'.s($config->dbpass).'" size="50" /></div>';
452+
echo '<div class="fitemelement"><input id="id_dbpass" name="dbpass" type="text" class="text-ltr" value="'.s($config->dbpass).'" size="50" /></div>';
453453
echo '</div>';
454454

455455
echo '<div class="fitem"><div class="fitemtitle"><label for="id_prefix">'.$strprefix.'</label></div>';
456-
echo '<div class="fitemelement"><input id="id_prefix" name="prefix" type="text" value="'.s($config->prefix).'" size="10" /></div>';
456+
echo '<div class="fitemelement"><input id="id_prefix" name="prefix" type="text" class="text-ltr" value="'.s($config->prefix).'" size="10" /></div>';
457457
echo '</div>';
458458

459459
echo '<div class="fitem"><div class="fitemtitle"><label for="id_prefix">'.$strdbport.'</label></div>';
460-
echo '<div class="fitemelement"><input id="id_dbport" name="dbport" type="text" value="'.s($config->dbport).'" size="10" /></div>';
460+
echo '<div class="fitemelement"><input id="id_dbport" name="dbport" type="text" class="text-ltr" value="'.s($config->dbport).'" size="10" /></div>';
461461
echo '</div>';
462462

463463
if (!(stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin'))) {
464464
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dbsocket">'.$strdbsocket.'</label></div>';
465-
echo '<div class="fitemelement"><input id="id_dbsocket" name="dbsocket" type="text" value="'.s($config->dbsocket).'" size="50" /></div>';
465+
echo '<div class="fitemelement"><input id="id_dbsocket" name="dbsocket" type="text" class="text-ltr" value="'.s($config->dbsocket).'" size="50" /></div>';
466466
echo '</div>';
467467
}
468468

@@ -572,15 +572,15 @@
572572

573573
echo '<div class="userinput">';
574574
echo '<div class="fitem"><div class="fitemtitle"><label for="id_wwwroot">'.$paths['wwwroot'].'</label></div>';
575-
echo '<div class="fitemelement"><input id="id_wwwroot" name="wwwroot" type="text" value="'.s($CFG->wwwroot).'" disabled="disabled" size="70" /></div>';
575+
echo '<div class="fitemelement"><input id="id_wwwroot" name="wwwroot" type="text" class="text-ltr" value="'.s($CFG->wwwroot).'" disabled="disabled" size="70" /></div>';
576576
echo '</div>';
577577

578578
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dirroot">'.$paths['dirroot'].'</label></div>';
579-
echo '<div class="fitemelement"><input id="id_dirroot" name="dirroot" type="text" value="'.s($CFG->dirroot).'" disabled="disabled" size="70" /></div>';
579+
echo '<div class="fitemelement"><input id="id_dirroot" name="dirroot" type="text" class="text-ltr" value="'.s($CFG->dirroot).'" disabled="disabled" size="70" /></div>';
580580
echo '</div>';
581581

582582
echo '<div class="fitem"><div class="fitemtitle"><label for="id_dataroot">'.$paths['dataroot'].'</label></div>';
583-
echo '<div class="fitemelement"><input id="id_dataroot" name="dataroot" type="text" value="'.s($config->dataroot).'" size="70" /></div>';
583+
echo '<div class="fitemelement"><input id="id_dataroot" name="dataroot" type="text" class="text-ltr" value="'.s($config->dataroot).'" size="70" /></div>';
584584
if ($hint_dataroot !== '') {
585585
echo '<div class="alert alert-error">'.$hint_dataroot.'</div>';
586586
}
@@ -589,7 +589,7 @@
589589

590590
if (!file_exists("$CFG->dirroot/admin/environment.xml")) {
591591
echo '<div class="fitem"><div class="fitemtitle"><label for="id_admin">'.$paths['admindir'].'</label></div>';
592-
echo '<div class="fitemelement"><input id="id_admin" name="admin" type="text" value="'.s($config->admin).'" size="10" /></div>';
592+
echo '<div class="fitemelement"><input id="id_admin" name="admin" type="text" class="text-ltr" value="'.s($config->admin).'" size="10" /></div>';
593593
if ($hint_admindir !== '') {
594594
echo '<div class="alert alert-error">'.$hint_admindir.'</div>';
595595
}

install/css.php

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
padding: 4px;
4848
}
4949
50+
.text-ltr {
51+
direction: ltr !important;
52+
}
53+
5054
.headermain {
5155
margin: 15px;
5256
}

login/signup_form.php

+2
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@ function definition() {
5555
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="25"');
5656
$mform->setType('email', core_user::get_property_type('email'));
5757
$mform->addRule('email', get_string('missingemail'), 'required', null, 'client');
58+
$mform->setForceLtr('email');
5859

5960
$mform->addElement('text', 'email2', get_string('emailagain'), 'maxlength="100" size="25"');
6061
$mform->setType('email2', core_user::get_property_type('email'));
6162
$mform->addRule('email2', get_string('missingemail'), 'required', null, 'client');
63+
$mform->setForceLtr('email2');
6264

6365
$namefields = useredit_get_required_name_fields();
6466
foreach ($namefields as $field) {

mod/lti/edit_form.php

+3
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public function definition() {
8585
$mform->addElement('text', 'lti_resourcekey', get_string('resourcekey_admin', 'lti'));
8686
$mform->setType('lti_resourcekey', PARAM_TEXT);
8787
$mform->addHelpButton('lti_resourcekey', 'resourcekey_admin', 'lti');
88+
$mform->setForceLtr('lti_resourcekey');
8889

8990
$mform->addElement('passwordunmask', 'lti_password', get_string('password_admin', 'lti'));
9091
$mform->setType('lti_password', PARAM_TEXT);
@@ -96,11 +97,13 @@ public function definition() {
9697
$mform->setType('lti_parameters', PARAM_TEXT);
9798
$mform->addHelpButton('lti_parameters', 'parameter', 'lti');
9899
$mform->disabledIf('lti_parameters', null);
100+
$mform->setForceLtr('lti_parameters');
99101
}
100102

101103
$mform->addElement('textarea', 'lti_customparameters', get_string('custom', 'lti'), array('rows' => 4, 'cols' => 60));
102104
$mform->setType('lti_customparameters', PARAM_TEXT);
103105
$mform->addHelpButton('lti_customparameters', 'custom', 'lti');
106+
$mform->setForceLtr('lti_customparameters');
104107

105108
if (!empty($this->_customdata->isadmin)) {
106109
$options = array(

mod/lti/mod_form.php

+2
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ public function definition() {
158158
$mform->setAdvanced('resourcekey');
159159
$mform->addHelpButton('resourcekey', 'resourcekey', 'lti');
160160
$mform->disabledIf('resourcekey', 'typeid', 'neq', '0');
161+
$mform->setForceLtr('resourcekey');
161162

162163
$mform->addElement('passwordunmask', 'password', get_string('password', 'lti'));
163164
$mform->setType('password', PARAM_TEXT);
@@ -169,6 +170,7 @@ public function definition() {
169170
$mform->setType('instructorcustomparameters', PARAM_TEXT);
170171
$mform->setAdvanced('instructorcustomparameters');
171172
$mform->addHelpButton('instructorcustomparameters', 'custom', 'lti');
173+
$mform->setForceLtr('instructorcustomparameters');
172174

173175
$mform->addElement('text', 'icon', get_string('icon_url', 'lti'), array('size' => '64'));
174176
$mform->setType('icon', PARAM_URL);

notes/edit_form.php

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ public function definition() {
3232
$mform->addElement('textarea', 'content', get_string('content', 'notes'), array('rows' => 15, 'cols' => 40));
3333
$mform->setType('content', PARAM_RAW);
3434
$mform->addRule('content', get_string('nocontent', 'notes'), 'required', null, 'client');
35+
$mform->setForceLtr('content', false);
3536

3637
$mform->addElement('select', 'publishstate', get_string('publishstate', 'notes'), note_get_state_names());
3738
$mform->setDefault('publishstate', NOTES_STATE_PUBLIC);

theme/bootstrapbase/less/moodle/forms.less

+1-28
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,7 @@ form {
121121
.singleselect label {
122122
margin-right: .3em;
123123
}
124-
input#id_externalurl {
125-
/*rtl:ignore*/
126-
direction: ltr;
127-
}
124+
128125
#portfolio-add-button {
129126
display: inline;
130127
}
@@ -216,18 +213,6 @@ div.backup-section + form,
216213
color: @textColor;
217214
text-decoration: none;
218215
}
219-
// I think this could be avoided (or at least tidied up) ifr
220-
// we used HTML5 input types like url, phone, email, number etc.
221-
/*rtl:ignore*/
222-
.mform .fitem .felement input[name=email],
223-
.mform .fitem .felement input[name=email2],
224-
.mform .fitem .felement input[name=url],
225-
.mform .fitem .felement input[name=idnumber],
226-
.mform .fitem .felement input[name=phone1],
227-
.mform .fitem .felement input[name=phone2] {
228-
text-align: left;
229-
direction: ltr;
230-
}
231216

232217
#page-grade-edit-outcome-course .courseoutcomes {
233218
margin-left: auto;
@@ -237,18 +222,6 @@ div.backup-section + form,
237222
#page-grade-edit-outcome-course .courseoutcomes td {
238223
text-align: center;
239224
}
240-
/* Install Process' text fields Forms, should always be justified to the left */
241-
/*rtl:ignore*/
242-
#installform #id_wwwroot,
243-
#installform #id_dirroot,
244-
#installform #id_dataroot,
245-
#installform #id_dbhost,
246-
#installform #id_dbname,
247-
#installform #id_dbuser,
248-
#installform #id_dbpass,
249-
#installform #id_prefix {
250-
direction: ltr;
251-
}
252225

253226
.mdl-right > label {
254227
// Workaround for repository pop-up because the : are outside the label,

theme/bootstrapbase/style/moodle.css

-26
Original file line numberDiff line numberDiff line change
@@ -12899,10 +12899,6 @@ form {
1289912899
.singleselect label {
1290012900
margin-right: .3em;
1290112901
}
12902-
input#id_externalurl {
12903-
/*rtl:ignore*/
12904-
direction: ltr;
12905-
}
1290612902
#portfolio-add-button {
1290712903
display: inline;
1290812904
}
@@ -13036,16 +13032,6 @@ div.backup-section + form:after,
1303613032
color: #333;
1303713033
text-decoration: none;
1303813034
}
13039-
/*rtl:ignore*/
13040-
.mform .fitem .felement input[name=email],
13041-
.mform .fitem .felement input[name=email2],
13042-
.mform .fitem .felement input[name=url],
13043-
.mform .fitem .felement input[name=idnumber],
13044-
.mform .fitem .felement input[name=phone1],
13045-
.mform .fitem .felement input[name=phone2] {
13046-
text-align: left;
13047-
direction: ltr;
13048-
}
1304913035
#page-grade-edit-outcome-course .courseoutcomes {
1305013036
margin-left: auto;
1305113037
margin-right: auto;
@@ -13054,18 +13040,6 @@ div.backup-section + form:after,
1305413040
#page-grade-edit-outcome-course .courseoutcomes td {
1305513041
text-align: center;
1305613042
}
13057-
/* Install Process' text fields Forms, should always be justified to the left */
13058-
/*rtl:ignore*/
13059-
#installform #id_wwwroot,
13060-
#installform #id_dirroot,
13061-
#installform #id_dataroot,
13062-
#installform #id_dbhost,
13063-
#installform #id_dbname,
13064-
#installform #id_dbuser,
13065-
#installform #id_dbpass,
13066-
#installform #id_prefix {
13067-
direction: ltr;
13068-
}
1306913043
.mdl-right > label {
1307013044
display: inline-block;
1307113045
}

user/editlib.php

+7
Original file line numberDiff line numberDiff line change
@@ -366,18 +366,23 @@ function useredit_shared_definition(&$mform, $editoroptions, $filemanageroptions
366366

367367
$mform->addElement('text', 'icq', get_string('icqnumber'), 'maxlength="15" size="25"');
368368
$mform->setType('icq', core_user::get_property_type('icq'));
369+
$mform->setForceLtr('icq');
369370

370371
$mform->addElement('text', 'skype', get_string('skypeid'), 'maxlength="50" size="25"');
371372
$mform->setType('skype', core_user::get_property_type('skype'));
373+
$mform->setForceLtr('skype');
372374

373375
$mform->addElement('text', 'aim', get_string('aimid'), 'maxlength="50" size="25"');
374376
$mform->setType('aim', core_user::get_property_type('aim'));
377+
$mform->setForceLtr('aim');
375378

376379
$mform->addElement('text', 'yahoo', get_string('yahooid'), 'maxlength="50" size="25"');
377380
$mform->setType('yahoo', core_user::get_property_type('yahoo'));
381+
$mform->setForceLtr('yahoo');
378382

379383
$mform->addElement('text', 'msn', get_string('msnid'), 'maxlength="50" size="25"');
380384
$mform->setType('msn', core_user::get_property_type('msn'));
385+
$mform->setForceLtr('msn');
381386

382387
$mform->addElement('text', 'idnumber', get_string('idnumber'), 'maxlength="255" size="25"');
383388
$mform->setType('idnumber', core_user::get_property_type('idnumber'));
@@ -390,9 +395,11 @@ function useredit_shared_definition(&$mform, $editoroptions, $filemanageroptions
390395

391396
$mform->addElement('text', 'phone1', get_string('phone1'), 'maxlength="20" size="25"');
392397
$mform->setType('phone1', core_user::get_property_type('phone1'));
398+
$mform->setForceLtr('phone1');
393399

394400
$mform->addElement('text', 'phone2', get_string('phone2'), 'maxlength="20" size="25"');
395401
$mform->setType('phone2', core_user::get_property_type('phone2'));
402+
$mform->setForceLtr('phone2');
396403

397404
$mform->addElement('text', 'address', get_string('address'), 'maxlength="255" size="25"');
398405
$mform->setType('address', core_user::get_property_type('address'));

0 commit comments

Comments
 (0)