Skip to content

Commit

Permalink
MDL-51948 core: Patch core areas for LTR forms
Browse files Browse the repository at this point in the history
Part of MDL-55071
  • Loading branch information
Frederic Massart authored and danpoltawski committed Sep 23, 2016
1 parent fc7f69e commit 525ef9c
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 65 deletions.
1 change: 1 addition & 0 deletions admin/registration/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
5 changes: 5 additions & 0 deletions admin/tool/uploaduser/user_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions cache/stores/memcache/addinstanceform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));

Expand Down
1 change: 1 addition & 0 deletions cache/stores/memcached/addinstanceform.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions calendar/managesubscriptions_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions grade/edit/tree/calculation_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 11 additions & 11 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,34 +435,34 @@

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

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

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

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

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

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

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

Expand Down Expand Up @@ -572,15 +572,15 @@

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

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

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

if (!file_exists("$CFG->dirroot/admin/environment.xml")) {
echo '<div class="fitem"><div class="fitemtitle"><label for="id_admin">'.$paths['admindir'].'</label></div>';
echo '<div class="fitemelement"><input id="id_admin" name="admin" type="text" value="'.s($config->admin).'" size="10" /></div>';
echo '<div class="fitemelement"><input id="id_admin" name="admin" type="text" class="text-ltr" value="'.s($config->admin).'" size="10" /></div>';
if ($hint_admindir !== '') {
echo '<div class="alert alert-error">'.$hint_admindir.'</div>';
}
Expand Down
4 changes: 4 additions & 0 deletions install/css.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
padding: 4px;
}
.text-ltr {
direction: ltr !important;
}
.headermain {
margin: 15px;
}
Expand Down
2 changes: 2 additions & 0 deletions login/signup_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions mod/lti/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions mod/lti/mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions notes/edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
29 changes: 1 addition & 28 deletions theme/bootstrapbase/less/moodle/forms.less
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,7 @@ form {
.singleselect label {
margin-right: .3em;
}
input#id_externalurl {
/*rtl:ignore*/
direction: ltr;
}

#portfolio-add-button {
display: inline;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down
26 changes: 0 additions & 26 deletions theme/bootstrapbase/style/moodle.css
Original file line number Diff line number Diff line change
Expand Up @@ -12899,10 +12899,6 @@ form {
.singleselect label {
margin-right: .3em;
}
input#id_externalurl {
/*rtl:ignore*/
direction: ltr;
}
#portfolio-add-button {
display: inline;
}
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
7 changes: 7 additions & 0 deletions user/editlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand All @@ -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'));
Expand Down

0 comments on commit 525ef9c

Please sign in to comment.