Skip to content

Commit

Permalink
MDL-51948 admin: Make admin settings RTL friendly
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 a47e73f commit 113efed
Show file tree
Hide file tree
Showing 41 changed files with 287 additions and 252 deletions.
2 changes: 1 addition & 1 deletion admin/phpinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

echo $OUTPUT->header();

echo '<div class="phpinfo">';
echo '<div class="phpinfo text-ltr">';

ob_start();
phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES + INFO_VARIABLES);
Expand Down
10 changes: 7 additions & 3 deletions admin/settings/appearance.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
$ADMIN->add('appearance', new admin_category('themes', new lang_string('themes')));
// "themesettings" settingpage
$temp = new admin_settingpage('themesettings', new lang_string('themesettings', 'admin'));
$temp->add(new admin_setting_configtext('themelist', new lang_string('themelist', 'admin'), new lang_string('configthemelist','admin'), '', PARAM_NOTAGS));
$setting = new admin_setting_configtext('themelist', new lang_string('themelist', 'admin'),
new lang_string('configthemelist','admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configcheckbox('themedesignermode', new lang_string('themedesignermode', 'admin'), new lang_string('configthemedesignermode', 'admin'), 0);
$setting->set_updatedcallback('theme_reset_all_caches');
$temp->add($setting);
Expand All @@ -22,15 +25,16 @@
$temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'), new lang_string('configallowthemechangeonurl', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), new lang_string('configallowuserblockhiding', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('allowblockstodock', new lang_string('allowblockstodock', 'admin'), new lang_string('configallowblockstodock', 'admin'), 1));
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'), new lang_string('configcustommenuitems', 'admin'), '', PARAM_TEXT, '50', '10'));
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'),
new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10'));
$temp->add(new admin_setting_configtextarea(
'customusermenuitems',
new lang_string('customusermenuitems', 'admin'),
new lang_string('configcustomusermenuitems', 'admin'),
'grades,grades|/grade/report/mygrades.php|grades
messages,message|/message/index.php|message
preferences,moodle|/user/preferences.php|preferences',
PARAM_TEXT,
PARAM_RAW,
'50',
'10'
));
Expand Down
15 changes: 12 additions & 3 deletions admin/settings/grades.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,18 @@
GRADE_NAVMETHOD_TABS => new lang_string('tabs', 'grades'),
GRADE_NAVMETHOD_COMBO => new lang_string('combo', 'grades'))));

$temp->add(new admin_setting_configtext('grade_export_userprofilefields', new lang_string('gradeexportuserprofilefields', 'grades'), new lang_string('gradeexportuserprofilefields_desc', 'grades'), 'firstname,lastname,idnumber,institution,department,email', PARAM_TEXT));

$temp->add(new admin_setting_configtext('grade_export_customprofilefields', new lang_string('gradeexportcustomprofilefields', 'grades'), new lang_string('gradeexportcustomprofilefields_desc', 'grades'), '', PARAM_TEXT));
$setting = new admin_setting_configtext('grade_export_userprofilefields',
new lang_string('gradeexportuserprofilefields', 'grades'),
new lang_string('gradeexportuserprofilefields_desc', 'grades'),
'firstname,lastname,idnumber,institution,department,email', PARAM_TEXT);
$setting->set_force_ltr(true);
$temp->add($setting);

$setting = new admin_setting_configtext('grade_export_customprofilefields',
new lang_string('gradeexportcustomprofilefields', 'grades'),
new lang_string('gradeexportcustomprofilefields_desc', 'grades'), '', PARAM_TEXT);
$setting->set_force_ltr(true);
$temp->add($setting);

$temp->add(new admin_setting_configcheckbox('recovergradesdefault', new lang_string('recovergradesdefault', 'grades'), new lang_string('recovergradesdefault_help', 'grades'), 0));

Expand Down
18 changes: 14 additions & 4 deletions admin/settings/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,22 @@
new lang_string('forgottenpassword', 'auth'), ''));
$temp->add(new admin_setting_confightmleditor('auth_instructions', new lang_string('instructions', 'auth'),
new lang_string('authinstructions', 'auth'), ''));
$temp->add(new admin_setting_configtext('allowemailaddresses', new lang_string('allowemailaddresses', 'admin'), new lang_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('denyemailaddresses', new lang_string('denyemailaddresses', 'admin'), new lang_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS));
$setting = new admin_setting_configtext('allowemailaddresses', new lang_string('allowemailaddresses', 'admin'),
new lang_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configtext('denyemailaddresses', new lang_string('denyemailaddresses', 'admin'),
new lang_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configcheckbox('verifychangedemail', new lang_string('verifychangedemail', 'admin'), new lang_string('configverifychangedemail', 'admin'), 1));

$temp->add(new admin_setting_configtext('recaptchapublickey', new lang_string('recaptchapublickey', 'admin'), new lang_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('recaptchaprivatekey', new lang_string('recaptchaprivatekey', 'admin'), new lang_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS));
$setting = new admin_setting_configtext('recaptchapublickey', new lang_string('recaptchapublickey', 'admin'), new lang_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$setting = new admin_setting_configtext('recaptchaprivatekey', new lang_string('recaptchaprivatekey', 'admin'), new lang_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$ADMIN->add('authsettings', $temp);

$temp = new admin_externalpage('authtestsettings', get_string('testsettings', 'core_auth'), new moodle_url("/auth/test_settings.php"), 'moodle/site:config', true);
Expand Down
8 changes: 6 additions & 2 deletions admin/settings/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
$primaryadminemail = NULL;
$primaryadminname = NULL;
}
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'), new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'), new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'),
new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
$setting = new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'),
new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'), new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
$ADMIN->add('server', $temp);

Expand Down
5 changes: 4 additions & 1 deletion admin/settings/users.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@
'department' => new lang_string('department'),
'institution' => new lang_string('institution'),
)));
$temp->add(new admin_setting_configtext('fullnamedisplay', new lang_string('fullnamedisplay', 'admin'), new lang_string('configfullnamedisplay', 'admin'), 'language', PARAM_TEXT, 50));
$setting = new admin_setting_configtext('fullnamedisplay', new lang_string('fullnamedisplay', 'admin'),
new lang_string('configfullnamedisplay', 'admin'), 'language', PARAM_TEXT, 50);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configtext('alternativefullnameformat', new lang_string('alternativefullnameformat', 'admin'),
new lang_string('alternativefullnameformat_desc', 'admin'),
'language', PARAM_RAW, 50));
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/setting.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{{/error}}
{{{element}}}
{{#default}}
<div class="form-defaultinfo">{{{default}}}</div>
<div class="form-defaultinfo {{#forceltr}}text-ltr{{/forceltr}}">{{{default}}}</div>
{{/default}}
</div>
<div class="form-description">{{{description}}}</div>
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/setting_configcolourpicker.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{>core/pix_icon}}
{{/icon}}
</div>
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12">
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12" class="text-ltr">
{{#haspreviewconfig}}
<input type="button" id="{{id}}_preview" value={{#quote}}{{#str}}preview{{/str}}{{/quote}} class="admin_colourpicker_preview">
{{/haspreviewconfig}}
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/setting_configduration.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Setting configduration.
}}
<div class="form-duration defaultsnext">
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}">
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="text-ltr">
<label class="accesshide" for="{{id}}u">{{#str}}durationunits, admin{{/str}}</label>
<select id="{{id}}u" name="{{name}}[u]">
{{#options}}
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/setting_configfile.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Setting configfile.
}}
<div class="form-file defaultsnext">
<input type="text" name="{{name}}" id="{{id}}" size="{{size}}" value="{{value}}" {{#readonly}}readonly{{/readonly}}>
<input type="text" name="{{name}}" id="{{id}}" size="{{size}}" value="{{value}}" class="text-ltr" {{#readonly}}readonly{{/readonly}}>
{{#showvalidity}}
{{#valid}}
<span class="pathok">&#x2714;</span>
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/setting_configtext.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
Setting configtext.
}}
<div class="form-text defaultsnext">
<input type="text" name="{{name}}" value="{{value}}" size="{{size}}" id="{{id}}" {{#attributes}} {{name}}="{{value}}"{{/attributes}}>
<input type="text" name="{{name}}" value="{{value}}" size="{{size}}" id="{{id}}" class="{{#forceltr}}text-ltr{{/forceltr}}" {{#attributes}} {{name}}="{{value}}"{{/attributes}}>
</div>
2 changes: 1 addition & 1 deletion admin/templates/setting_configtextarea.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
Setting configtextarea.
}}
<div class="form-textarea">
<textarea rows="{{rows}}" cols="{{cols}}" id="{{id}}" name="{{name}}" spellcheck="true">{{value}}</textarea>
<textarea rows="{{rows}}" cols="{{cols}}" id="{{id}}" name="{{name}}" spellcheck="true" class="{{#forceltr}}text-ltr{{/forceltr}}">{{value}}</textarea>
</div>
2 changes: 1 addition & 1 deletion admin/templates/setting_configtime.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{{!
Setting configtime.
}}
<div class="form-time defaultsnext">
<div class="form-time defaultsnext text-ltr">
<label class="accesshide" for="{{id}}h">{{#str}}hours{{/str}}</label>
<select id="{{id}}h" name="{{name}}[h]">
{{#hours}}
Expand Down
4 changes: 2 additions & 2 deletions admin/templates/setting_devicedetectregex.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
{{#expressions}}
<tr>
<td class="c{{index}}">
<input type="text" name="{{name}}[expression{{index}}]" class="form-text" value="{{expression}}">
<input type="text" name="{{name}}[expression{{index}}]" class="form-text text-ltr" value="{{expression}}">
</td>
<td class="c{{index}}">
<input type="text" name="{{name}}[value{{index}}]" class="form-text" value="{{value}}">
<input type="text" name="{{name}}[value{{index}}]" class="form-text text-ltr" value="{{value}}">
</td>
</tr>
{{/expressions}}
Expand Down
2 changes: 1 addition & 1 deletion admin/templates/setting_emoticons.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<tr>
{{#fields}}
<td class="c{{index}}">
<input type="text" name="{{name}}[{{field}}]" class="form-text" value="{{value}}">
<input type="text" name="{{name}}[{{field}}]" class="form-text text-ltr" value="{{value}}">
</td>
{{/fields}}
<td>
Expand Down
10 changes: 9 additions & 1 deletion admin/tool/task/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public function scheduled_tasks_table($tasks) {
$editlink = $this->render(new pix_icon('t/locked', get_string('scheduledtaskchangesdisabled', 'tool_task')));
}

$namecell = new html_table_cell($task->get_name() . "\n" . html_writer::tag('span', '\\'.get_class($task), array('class' => 'task-class')));
$namecell = new html_table_cell($task->get_name() . "\n" . html_writer::tag('span', '\\'.get_class($task),
array('class' => 'task-class text-ltr')));
$namecell->header = true;

$component = $task->get_component();
Expand Down Expand Up @@ -117,6 +118,13 @@ public function scheduled_tasks_table($tasks) {
new html_table_cell($task->get_fail_delay()),
new html_table_cell($customised)));

// Cron-style values must always be LTR.
$row->cells[5]->attributes['class'] = 'text-ltr';
$row->cells[6]->attributes['class'] = 'text-ltr';
$row->cells[7]->attributes['class'] = 'text-ltr';
$row->cells[8]->attributes['class'] = 'text-ltr';
$row->cells[9]->attributes['class'] = 'text-ltr';

if ($disabled) {
$row->attributes['class'] = 'disabled';
}
Expand Down
5 changes: 5 additions & 0 deletions admin/tool/task/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
color: #888;
font-size: 0.75em;
}

#page-admin-tool-task-scheduledtasks input[type=text]
/*rtl:ignore*/
direction: ltr;
}
11 changes: 11 additions & 0 deletions admin/upgrade.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This files describes API changes in /admin/*.

=== 3.2 ===

* Admin settings have been refined to better support right-to-left languages. In RTL,
most fields should not have their direction flipped, a URL, a path to a file, ...
are always displayed LTR. Most of the admin_setting classes will now prefer LTR.
If you must not force left-to-right, here are a few options:
* Call admin_setting::set_force_ltr(false) on your setting;
* Use the class admin_setting_localisedtext for text inputs;
* Use the class admin_setting_localisedtextarea for larger text inputs.
20 changes: 10 additions & 10 deletions auth/db/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<tr valign="top" class="required">
<td align="right"><label for="host"><?php print_string("auth_dbhost_key", "auth_db") ?></label></td>
<td>
<input id="host" name="host" type="text" size="30" value="<?php echo $config->host?>" />
<input id="host" name="host" type="text" class="text-ltr" size="30" value="<?php echo $config->host?>" />
<?php

if (isset($err["host"])) {
Expand Down Expand Up @@ -94,7 +94,7 @@
<tr valign="top" class="required">
<td align="right"><label for="name"><?php print_string("auth_dbname_key", "auth_db") ?></label></td>
<td>
<input id="name" name="name" type="text" size="30" value="<?php echo $config->name?>" />
<input id="name" name="name" type="text" class="text-ltr" size="30" value="<?php echo $config->name?>" />
<?php

if (isset($err["name"])) {
Expand All @@ -109,7 +109,7 @@
<tr valign="top" class="required">
<td align="right"><label for="user"><?php print_string("auth_dbuser_key", "auth_db") ?></label></td>
<td>
<input id="user" name="user" type="text" size="30" value="<?php echo $config->user?>" />
<input id="user" name="user" type="text" class="text-ltr" size="30" value="<?php echo $config->user?>" />
<?php

if (isset($err["user"])) {
Expand All @@ -124,7 +124,7 @@
<tr valign="top" class="required">
<td align="right"><label for="pass"><?php print_string("auth_dbpass_key", "auth_db") ?></label></td>
<td>
<input id="pass" name="pass" type="password" size="30" value="<?php p($config->pass)?>" autocomplete="off"/>
<input id="pass" name="pass" type="password" class="text-ltr" size="30" value="<?php p($config->pass)?>" autocomplete="off"/>
<?php

if (isset($err["pass"])) {
Expand All @@ -141,7 +141,7 @@
<tr valign="top" class="required">
<td align="right"><label for="table"><?php print_string("auth_dbtable_key", "auth_db") ?></label></td>
<td>
<input id="table" name="table" type="text" size="30" value="<?php echo $config->table?>" />
<input id="table" name="table" type="text" class="text-ltr" size="30" value="<?php echo $config->table?>" />
<?php

if (isset($err["table"])) {
Expand All @@ -156,7 +156,7 @@
<tr valign="top" class="required">
<td align="right"><label for="fielduser"><?php print_string("auth_dbfielduser_key", "auth_db") ?></label></td>
<td>
<input id="fielduser" name="fielduser" type="text" size="30" value="<?php echo $config->fielduser?>" />
<input id="fielduser" name="fielduser" type="text" class="text-ltr" size="30" value="<?php echo $config->fielduser?>" />
<?php

if (isset($err["fielduser"])) {
Expand All @@ -171,7 +171,7 @@
<tr valign="top" class="required">
<td align="right"><label for="fieldpass"><?php print_string("auth_dbfieldpass_key", "auth_db") ?></label></td>
<td>
<input id="fieldpass" name="fieldpass" type="text" size="30" value="<?php echo $config->fieldpass?>" />
<input id="fieldpass" name="fieldpass" type="text" class="text-ltr" size="30" value="<?php echo $config->fieldpass?>" />
<?php

if (isset($err["fieldpass"])) {
Expand Down Expand Up @@ -203,7 +203,7 @@
<tr valign="top" class="required">
<td align="right"><label for="extencoding"><?php print_string("auth_dbextencoding", "auth_db") ?></label></td>
<td>
<input id="extencoding" name="extencoding" type="text" value="<?php echo $config->extencoding ?>" />
<input id="extencoding" name="extencoding" type="text" class="text-ltr" value="<?php echo $config->extencoding ?>" />
<?php

if (isset($err['extencoding'])) {
Expand All @@ -218,7 +218,7 @@
<tr valign="top">
<td align="right"><label for="setupsql"><?php print_string("auth_dbsetupsql", "auth_db") ?></label></td>
<td>
<input id="setupsql" name="setupsql" type="text" value="<?php echo $config->setupsql ?>" />
<input id="setupsql" name="setupsql" type="text" class="text-ltr" value="<?php echo $config->setupsql ?>" />
</td>
<td><?php print_string('auth_dbsetupsqlhelp', 'auth_db') ?></td>
</tr>
Expand All @@ -234,7 +234,7 @@
<tr valign="top">
<td align="right"><label for="changepasswordurl"><?php print_string("auth_dbchangepasswordurl_key", "auth_db") ?></label></td>
<td>
<input id="changepasswordurl" name="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
<input id="changepasswordurl" name="changepasswordurl" type="text" class="text-ltr" value="<?php echo $config->changepasswordurl ?>" />
<?php

if (isset($err['changepasswordurl'])) {
Expand Down
Loading

0 comments on commit 113efed

Please sign in to comment.