diff --git a/admin/phpinfo.php b/admin/phpinfo.php index ea44b1fde331f..f28851255401b 100644 --- a/admin/phpinfo.php +++ b/admin/phpinfo.php @@ -8,7 +8,7 @@ echo $OUTPUT->header(); - echo '
'; + echo '
'; ob_start(); phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES + INFO_VARIABLES); diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index d8697d456930d..642131eca427b 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -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); @@ -22,7 +25,8 @@ $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'), @@ -30,7 +34,7 @@ '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' )); diff --git a/admin/settings/grades.php b/admin/settings/grades.php index 90bc811621eb3..bd9ea98cb8b22 100644 --- a/admin/settings/grades.php +++ b/admin/settings/grades.php @@ -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)); diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index 0711b2337dfcc..9223cab3e55b2 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -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); diff --git a/admin/settings/server.php b/admin/settings/server.php index 8ef94a7722e3b..aae21f9adea8c 100644 --- a/admin/settings/server.php +++ b/admin/settings/server.php @@ -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); diff --git a/admin/settings/users.php b/admin/settings/users.php index 6bd0ea16035c6..950c2aa182665 100644 --- a/admin/settings/users.php +++ b/admin/settings/users.php @@ -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)); diff --git a/admin/templates/setting.mustache b/admin/templates/setting.mustache index 33e760d7f1d78..ccdfb0f484846 100644 --- a/admin/templates/setting.mustache +++ b/admin/templates/setting.mustache @@ -36,7 +36,7 @@ {{/error}} {{{element}}} {{#default}} -
{{{default}}}
+
{{{default}}}
{{/default}}
{{{description}}}
diff --git a/admin/templates/setting_configcolourpicker.mustache b/admin/templates/setting_configcolourpicker.mustache index 0ad6ec6599788..438ae9bee5506 100644 --- a/admin/templates/setting_configcolourpicker.mustache +++ b/admin/templates/setting_configcolourpicker.mustache @@ -23,7 +23,7 @@ {{>core/pix_icon}} {{/icon}}
- + {{#haspreviewconfig}} {{/haspreviewconfig}} diff --git a/admin/templates/setting_configduration.mustache b/admin/templates/setting_configduration.mustache index 1d7f3e79013b3..f9738b941f5d1 100644 --- a/admin/templates/setting_configduration.mustache +++ b/admin/templates/setting_configduration.mustache @@ -18,7 +18,7 @@ Setting configduration. }}
- + + {{#showvalidity}} {{#valid}} diff --git a/admin/templates/setting_configtext.mustache b/admin/templates/setting_configtext.mustache index 3d99fc379127e..51c1a19072f74 100644 --- a/admin/templates/setting_configtext.mustache +++ b/admin/templates/setting_configtext.mustache @@ -18,5 +18,5 @@ Setting configtext. }}
- +
diff --git a/admin/templates/setting_configtextarea.mustache b/admin/templates/setting_configtextarea.mustache index 5c620554ccfaf..cdf762e423557 100644 --- a/admin/templates/setting_configtextarea.mustache +++ b/admin/templates/setting_configtextarea.mustache @@ -18,5 +18,5 @@ Setting configtextarea. }}
- +
diff --git a/admin/templates/setting_configtime.mustache b/admin/templates/setting_configtime.mustache index a17aefbfe422e..dc383fdd34d24 100644 --- a/admin/templates/setting_configtime.mustache +++ b/admin/templates/setting_configtime.mustache @@ -17,7 +17,7 @@ {{! Setting configtime. }} -
+
+ - + {{/expressions}} diff --git a/admin/templates/setting_emoticons.mustache b/admin/templates/setting_emoticons.mustache index cdd7a1b61739b..99d4fff741824 100644 --- a/admin/templates/setting_emoticons.mustache +++ b/admin/templates/setting_emoticons.mustache @@ -33,7 +33,7 @@ {{#fields}} - + {{/fields}} diff --git a/admin/tool/task/renderer.php b/admin/tool/task/renderer.php index 93975af5ee4e6..076f092ebebc7 100644 --- a/admin/tool/task/renderer.php +++ b/admin/tool/task/renderer.php @@ -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(); @@ -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'; } diff --git a/admin/tool/task/styles.css b/admin/tool/task/styles.css index cb7cab913495b..2cd8ff9b76c5e 100644 --- a/admin/tool/task/styles.css +++ b/admin/tool/task/styles.css @@ -4,3 +4,8 @@ color: #888; font-size: 0.75em; } + +#page-admin-tool-task-scheduledtasks input[type=text] + /*rtl:ignore*/ + direction: ltr; +} diff --git a/admin/upgrade.txt b/admin/upgrade.txt new file mode 100644 index 0000000000000..4b7b1afa9bb55 --- /dev/null +++ b/admin/upgrade.txt @@ -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. diff --git a/auth/db/config.html b/auth/db/config.html index 8d04d04444bbf..426e101d2a77b 100644 --- a/auth/db/config.html +++ b/auth/db/config.html @@ -55,7 +55,7 @@ - + - + - + - + - + - + - + - + - + @@ -234,7 +234,7 @@ - + - + error_text($err['host_url']); } ?> @@ -174,7 +174,7 @@

- + error_text($err['ldapencoding']); } ?> @@ -186,7 +186,7 @@

- /> + /> error_text($err['pagesize']); } if ($disabled) { @@ -221,7 +221,7 @@

- + error_text($err['bind_dn']); } ?> @@ -233,7 +233,7 @@

- + error_text($err['bind_pw']); } ?> @@ -264,7 +264,7 @@

- + error_text($err['contexts']); } ?> @@ -304,7 +304,7 @@

- + error_text($err['user_attribute']); } ?> @@ -316,7 +316,7 @@

- + error_text($err['suspended_attribute']); } ?> @@ -328,7 +328,7 @@

- + error_text($err['memberattribute']); } ?> @@ -340,7 +340,7 @@

- + error_text($err['memberattribute_isdn']); } ?> @@ -352,7 +352,7 @@

- + error_text($err['objectclass']); } ?> @@ -409,7 +409,7 @@

- + error_text($err['changepasswordurl']); } ?> @@ -443,7 +443,7 @@

- + error_text($err['expiration_warning']); } ?> @@ -455,7 +455,7 @@

- + error_text($err['expireattr']); } ?> @@ -478,7 +478,7 @@

- + error_text($err['graceattr']); } ?> @@ -506,7 +506,7 @@

- + error_text($err['create_context']); } ?> @@ -523,7 +523,7 @@

- + error_text($err['creators']); } ?> @@ -584,7 +584,7 @@

- + @@ -622,7 +622,7 @@

- + error_text($err['ntlmsso_remoteuserformat']); } ?> diff --git a/enrol/ldap/settingslib.php b/enrol/ldap/settingslib.php index c7549d1baec03..79a237fd41f3f 100644 --- a/enrol/ldap/settingslib.php +++ b/enrol/ldap/settingslib.php @@ -71,18 +71,6 @@ public function write_setting($data) { return ($this->config_write($this->name, trim($data)) ? '' : get_string('errorsetting', 'admin')); } - /** - * Return an XHTML string for the setting - * @return string Returns an XHTML string - */ - public function output_html($data, $query='') { - $default = $this->get_defaultsetting(); - $disabled = $this->enabled ? '': ' disabled="disabled"'; - return format_admin_setting($this, $this->visiblename, - '
', - $this->description, true, '', $default, $query); - } - } class admin_setting_ldap_rolemapping extends admin_setting { @@ -169,7 +157,8 @@ public function output_html($data, $query='') { $contextname = $this->get_full_name().'['.$role['id'].'][contexts]'; $return .= html_writer::start_tag('div', array('style' => 'height: 2em;')); $return .= html_writer::label(get_string('role_mapping_context', 'enrol_ldap', $role['name']), $contextid, false, array('class' => 'accesshide')); - $attrs = array('type' => 'text', 'size' => '40', 'id' => $contextid, 'name' => $contextname, 'value' => s($role['contexts'])); + $attrs = array('type' => 'text', 'size' => '40', 'id' => $contextid, 'name' => $contextname, + 'value' => s($role['contexts']), 'class' => 'text-ltr'); $return .= html_writer::empty_tag('input', $attrs); $return .= html_writer::end_tag('div'); } @@ -182,7 +171,8 @@ public function output_html($data, $query='') { $memberattrname = $this->get_full_name().'['.$role['id'].'][memberattribute]'; $return .= html_writer::start_tag('div', array('style' => 'height: 2em;')); $return .= html_writer::label(get_string('role_mapping_attribute', 'enrol_ldap', $role['name']), $memberattrid, false, array('class' => 'accesshide')); - $attrs = array('type' => 'text', 'size' => '15', 'id' => $memberattrid, 'name' => $memberattrname, 'value' => s($role['memberattribute'])); + $attrs = array('type' => 'text', 'size' => '15', 'id' => $memberattrid, 'name' => $memberattrname, + 'value' => s($role['memberattribute']), 'class' => 'text-ltr'); $return .= html_writer::empty_tag('input', $attrs); $return .= html_writer::end_tag('div'); } diff --git a/lib/adminlib.php b/lib/adminlib.php index 1938e70733e5f..6a8de2983c4e7 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -1552,6 +1552,8 @@ abstract class admin_setting { public $affectsmodinfo = false; /** @var array of admin_setting_flag - These are extra checkboxes attached to a setting. */ private $flags = array(); + /** @var bool Whether this field must be forced LTR. */ + protected $forceltr = false; /** * Constructor @@ -1903,6 +1905,30 @@ public function is_related($query) { } return false; } + + /** + * Get whether this should be displayed in LTR mode. + * + * For more information on this setting, please check the documentation + * provided with {@link admin_setting_localisedtext}. + * + * @return bool + */ + public function get_force_ltr() { + return $this->forceltr; + } + + /** + * Set whether to force LTR or not. + * + * For more information on this option, please read the documentation + * provided with the class {@link admin_setting_localisedtext}. + * + * @param bool $value True when forced, else false. + */ + public function set_force_ltr($value) { + $this->forceltr = (bool) $value; + } } /** @@ -2092,7 +2118,13 @@ public function output_html($data, $query='') { /** - * The most flexibly setting, user is typing text + * The most flexible setting, the user enters text. + * + * This type of field should be used for config settings which are using + * English words and are not localised (passwords, database name, list of values, ...). + * + * For localised strings such as a person's name, text to display to the users, etc... + * please refer to {@link admin_setting_localisedtext}. * * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -2102,6 +2134,8 @@ class admin_setting_configtext extends admin_setting { public $paramtype; /** @var int default field size */ public $size; + /** @var bool Whether this field must be forced LTR. */ + protected $forceltr = true; /** * Config text constructor @@ -2184,7 +2218,8 @@ public function output_html($data, $query='') { 'size' => $this->size, 'id' => $this->get_id(), 'name' => $this->get_full_name(), - 'value' => $data + 'value' => $data, + 'forceltr' => $this->forceltr, ]; $element = $OUTPUT->render_from_template('core_admin/setting_configtext', $context); @@ -2192,6 +2227,29 @@ public function output_html($data, $query='') { } } +/** + * Override configtext to provide a localised setting. + * + * The main purpose of this setting is to not force left-to-right as we would + * typically do for configuration settings. In the case of a localised string we + * will let the natural direction of the page act on the field. + * + * Why? Because a database name will always be expressed in English, and thus needs + * to be left-aligned and LTR. But, the name of your site, for instance, should follow + * the language of your site and become right-aligned and RTL if need be. + * + * @copyright 2016 Frédéric Massart - FMCorz.net + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class admin_setting_localisedtext extends admin_setting_configtext { + + public function __construct($name, $visiblename, $description, $defaultsetting, $paramtype = PARAM_RAW, $size = null) { + parent::__construct($name, $visiblename, $description, $defaultsetting, $paramtype, $size); + $this->set_force_ltr(false); + } + +} + /** * Text input with a maximum length constraint. * @@ -2291,7 +2349,8 @@ public function output_html($data, $query='') { 'rows' => $this->rows, 'id' => $this->get_id(), 'name' => $this->get_full_name(), - 'value' => $data + 'value' => $data, + 'forceltr' => $this->forceltr, ]; $element = $OUTPUT->render_from_template('core_admin/setting_configtextarea', $context); @@ -2299,11 +2358,30 @@ public function output_html($data, $query='') { } } +/** + * Override configtextarea to provide a localised setting. + * + * The main purpose of this setting is to not force left-to-right as we would + * typically do for configuration settings. In the case of a localised string we + * will let the natural direction of the page act on the field. + * + * @copyright 2016 Frédéric Massart - FMCorz.net + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class admin_setting_localisedtextarea extends admin_setting_configtextarea { + + public function __construct($name, $visiblename, $description, $defaultsetting, $paramtype = PARAM_RAW, + $cols = '60', $rows = '8') { + parent::__construct($name, $visiblename, $description, $defaultsetting, $paramtype, $cols, $rows); + $this->set_force_ltr(false); + } + +} /** * General text area with html editor. */ -class admin_setting_confightmleditor extends admin_setting_configtextarea { +class admin_setting_confightmleditor extends admin_setting_localisedtextarea { /** * @param string $name @@ -2339,6 +2417,9 @@ public function output_html($data, $query='') { * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ class admin_setting_configpasswordunmask extends admin_setting_configtext { + + protected $forceltr = false; + /** * Constructor * @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting' for ones in config_plugins. @@ -2381,11 +2462,16 @@ public function output_html($data, $query='') { 'id' => $this->get_id(), 'name' => $this->get_full_name(), 'size' => $this->size, - 'value' => $data + 'value' => $data, + 'forceltr' => false, ]; $element = $OUTPUT->render_from_template('core_admin/setting_configpasswordunmask', $context); return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', null, $query); } + + public function set_force_ltr($value) { + throw new coding_exception('This must always be in LTR more.'); + } } /** @@ -2464,7 +2550,8 @@ public function output_html($data, $query='') { 'value' => $data, 'showvalidity' => !empty($data), 'valid' => $data && file_exists($data), - 'readonly' => !empty($CFG->preventexecpath) + 'readonly' => !empty($CFG->preventexecpath), + 'forceltr' => true, ]; if ($context->readonly) { @@ -2494,6 +2581,10 @@ public function write_setting($data) { } return parent::write_setting($data); } + + public function set_force_ltr($value) { + throw new coding_exception('This must always be in LTR more.'); + } } @@ -2523,7 +2614,8 @@ public function output_html($data, $query='') { 'value' => $data, 'showvalidity' => !empty($data), 'valid' => $data && file_exists($data) && !is_dir($data) && file_is_executable($data), - 'readonly' => !empty($CFG->preventexecpath) + 'readonly' => !empty($CFG->preventexecpath), + 'forceltr' => true ]; if (!empty($CFG->preventexecpath)) { @@ -2562,14 +2654,15 @@ public function output_html($data, $query='') { 'value' => $data, 'showvalidity' => !empty($data), 'valid' => $data && file_exists($data) && is_dir($data), - 'readonly' => !empty($CFG->preventexecpath) + 'readonly' => !empty($CFG->preventexecpath), + 'forceltr' => true ]; if (!empty($CFG->preventexecpath)) { $this->visiblename .= '
'.get_string('execpathnotallowed', 'admin').'
'; } - $element = $OUTPUT->render_from_template('core_admin/setting_configexecutable', $context); + $element = $OUTPUT->render_from_template('core_admin/setting_configdirectory', $context); return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $default, $query); } @@ -3994,7 +4087,7 @@ public function write_setting($data) { * * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class admin_setting_sitesettext extends admin_setting_configtext { +class admin_setting_sitesettext extends admin_setting_localisedtext { /** * Return the current setting * @@ -4189,6 +4282,7 @@ public function output_html($data, $query='') { $context = (object) [ 'name' => $this->get_full_name(), 'emoticons' => [], + 'forceltr' => true, ]; $i = 0; @@ -4306,6 +4400,10 @@ protected function process_form_data(array $form) { } return $emoticons; } + + public function set_force_ltr($value) { + throw new coding_exception('This must always be in LTR more.'); + } } @@ -5156,7 +5254,8 @@ public function output_html($data, $query = '') { 'value' => $data, 'attributes' => [ 'maxlength' => 5 - ] + ], + 'forceltr' => $this->forceltr ]; $element = $OUTPUT->render_from_template('core_admin/setting_configtext', $context); @@ -7572,6 +7671,7 @@ function format_admin_setting($setting, $title='', $form='', $description='', $l $context->name = highlightfast($query, $context->name); $context->description = highlight($query, markdown_to_html($description)); $context->element = $form; + $context->forceltr = $setting->get_force_ltr(); return $OUTPUT->render_from_template('core_admin/setting', $context); } @@ -9011,7 +9111,8 @@ public function output_html($data, $query = '') { 'id' => $this->get_id(), 'name' => $this->get_full_name(), 'icon' => $icon->export_for_template($OUTPUT), - 'haspreviewconfig' => !empty($this->previewconfig) + 'haspreviewconfig' => !empty($this->previewconfig), + 'forceltr' => true ]; $element = $OUTPUT->render_from_template('core_admin/setting_configcolourpicker', $context); @@ -9020,6 +9121,10 @@ public function output_html($data, $query = '') { return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $this->get_defaultsetting(), $query); } + + public function set_force_ltr($value) { + throw new coding_exception('This must always be in LTR more.'); + } } @@ -9367,6 +9472,10 @@ protected function process_form_data(array $form) { return $regexes; } + + public function set_force_ltr($value) { + throw new coding_exception('This must always be in LTR more.'); + } } /** diff --git a/mod/assign/settings.php b/mod/assign/settings.php index 5d7d3ce72d30e..ff0b260ed201e 100644 --- a/mod/assign/settings.php +++ b/mod/assign/settings.php @@ -65,10 +65,12 @@ $name = new lang_string('submissionstatement', 'mod_assign'); $description = new lang_string('submissionstatement_help', 'mod_assign'); $default = get_string('submissionstatementdefault', 'mod_assign'); - $settings->add(new admin_setting_configtextarea('assign/submissionstatement', + $setting = new admin_setting_configtextarea('assign/submissionstatement', $name, $description, - $default)); + $default); + $setting->set_force_ltr(false); + $settings->add($setting); $name = new lang_string('maxperpage', 'mod_assign'); $options = array( diff --git a/theme/bootstrapbase/less/moodle/admin.less b/theme/bootstrapbase/less/moodle/admin.less index c38a07cd79226..40d36391dd32b 100644 --- a/theme/bootstrapbase/less/moodle/admin.less +++ b/theme/bootstrapbase/less/moodle/admin.less @@ -396,6 +396,15 @@ img.iconsmall { clear: right; } +.form-description, +.formsettingheading { + pre { + /* Code examples should be left aligned. */ + /*rtl:ignore*/ + direction: ltr; + } +} + .form-item .form-setting .form-htmlarea { width: 640px; display: inline; diff --git a/theme/bootstrapbase/less/moodle/core.less b/theme/bootstrapbase/less/moodle/core.less index 3033840d1435f..5bfbf6c738f9d 100644 --- a/theme/bootstrapbase/less/moodle/core.less +++ b/theme/bootstrapbase/less/moodle/core.less @@ -103,6 +103,12 @@ .mdl-right { text-align: right; } + +/*rtl:ignore*/ +.text-ltr { + direction: ltr !important; +} + #add, #remove, .centerpara, diff --git a/theme/bootstrapbase/less/moodle/debug.less b/theme/bootstrapbase/less/moodle/debug.less index cf438595fa9b1..f7a2d6f3bd34c 100644 --- a/theme/bootstrapbase/less/moodle/debug.less +++ b/theme/bootstrapbase/less/moodle/debug.less @@ -11,7 +11,6 @@ body.behat-site { .phpinfo th, .phpinfo h2 { margin: auto; - text-align: left; } .phpinfo h2 { width: 600px; diff --git a/theme/bootstrapbase/less/moodle/forms.less b/theme/bootstrapbase/less/moodle/forms.less index 66be4de95db2b..5a32b472edb34 100644 --- a/theme/bootstrapbase/less/moodle/forms.less +++ b/theme/bootstrapbase/less/moodle/forms.less @@ -228,59 +228,7 @@ div.backup-section + form, text-align: left; direction: ltr; } -#id_s__pathtodu, -#id_s__aspellpath, -#id_s__pathtodot, -#id_s__supportemail, -#id_s__supportpage, -#id_s__sessioncookie, -#id_s__sessioncookiepath, -#id_s__sessioncookiedomain, -#id_s__proxyhost, -#id_s__proxyuser, -#id_s__proxypassword, -#id_s__proxybypass, -#id_s__jabberhost, -#id_s__jabberserver, -#id_s__jabberusername, -#id_s__jabberpassword, -#id_s__additionalhtmlhead, -#id_s__additionalhtmltopofbody, -#id_s__additionalhtmlfooter, -#id_s__docroot, -#id_s__filter_tex_latexpreamble, -#id_s__filter_tex_latexbackground, -#id_s__filter_tex_pathlatex, -#id_s__filter_tex_pathdvips, -#id_s__filter_tex_pathconvert, -#id_s__blockedip, -#id_s__pathtoclam, -#id_s__quarantinedir, -#id_s__sitepolicy, -#id_s__sitepolicyguest, -#id_s__cronremotepassword, -#id_s__allowedip, -#id_s__blockedip, -#id_s_enrol_meta_nosyncroleids, -#id_s_enrol_ldap_host_url, -#id_s_enrol_ldap_ldapencoding, -#id_s_enrol_ldap_bind_dn, -#id_s_enrol_ldap_bind_pw, -#admin-emoticons .form-text, -#admin-role_mapping input[type=text], -#id_s_enrol_paypal_paypalbusiness, -#id_s_enrol_flatfile_location, -#page-admin-setting-enrolsettingsflatfile input[type=text], -#page-admin-setting-enrolsettingsdatabase input[type=text], -#page-admin-auth-db input[type=text] { - /*rtl:ignore*/ - direction: ltr; -} -/*rtl:ignore*/ -#page-admin-setting-enrolsettingsflatfile .informationbox { - direction: ltr; - text-align: left; -} + #page-grade-edit-outcome-course .courseoutcomes { margin-left: auto; margin-right: auto; diff --git a/theme/bootstrapbase/style/moodle.css b/theme/bootstrapbase/style/moodle.css index f5e0b64bfa960..7116a9275f2cb 100644 --- a/theme/bootstrapbase/style/moodle.css +++ b/theme/bootstrapbase/style/moodle.css @@ -70,6 +70,10 @@ .mdl-right { text-align: right; } +/*rtl:ignore*/ +.text-ltr { + direction: ltr !important; +} #add, #remove, .centerpara, @@ -2919,6 +2923,12 @@ img.iconsmall { .form-description { clear: right; } +.form-description pre, +.formsettingheading pre { + /* Code examples should be left aligned. */ + /*rtl:ignore*/ + direction: ltr; +} .form-item .form-setting .form-htmlarea { width: 640px; display: inline; @@ -13036,59 +13046,6 @@ div.backup-section + form:after, text-align: left; direction: ltr; } -#id_s__pathtodu, -#id_s__aspellpath, -#id_s__pathtodot, -#id_s__supportemail, -#id_s__supportpage, -#id_s__sessioncookie, -#id_s__sessioncookiepath, -#id_s__sessioncookiedomain, -#id_s__proxyhost, -#id_s__proxyuser, -#id_s__proxypassword, -#id_s__proxybypass, -#id_s__jabberhost, -#id_s__jabberserver, -#id_s__jabberusername, -#id_s__jabberpassword, -#id_s__additionalhtmlhead, -#id_s__additionalhtmltopofbody, -#id_s__additionalhtmlfooter, -#id_s__docroot, -#id_s__filter_tex_latexpreamble, -#id_s__filter_tex_latexbackground, -#id_s__filter_tex_pathlatex, -#id_s__filter_tex_pathdvips, -#id_s__filter_tex_pathconvert, -#id_s__blockedip, -#id_s__pathtoclam, -#id_s__quarantinedir, -#id_s__sitepolicy, -#id_s__sitepolicyguest, -#id_s__cronremotepassword, -#id_s__allowedip, -#id_s__blockedip, -#id_s_enrol_meta_nosyncroleids, -#id_s_enrol_ldap_host_url, -#id_s_enrol_ldap_ldapencoding, -#id_s_enrol_ldap_bind_dn, -#id_s_enrol_ldap_bind_pw, -#admin-emoticons .form-text, -#admin-role_mapping input[type=text], -#id_s_enrol_paypal_paypalbusiness, -#id_s_enrol_flatfile_location, -#page-admin-setting-enrolsettingsflatfile input[type=text], -#page-admin-setting-enrolsettingsdatabase input[type=text], -#page-admin-auth-db input[type=text] { - /*rtl:ignore*/ - direction: ltr; -} -/*rtl:ignore*/ -#page-admin-setting-enrolsettingsflatfile .informationbox { - direction: ltr; - text-align: left; -} #page-grade-edit-outcome-course .courseoutcomes { margin-left: auto; margin-right: auto; @@ -17250,7 +17207,6 @@ body.behat-site .navbar-fixed-top { .phpinfo th, .phpinfo h2 { margin: auto; - text-align: left; } .phpinfo h2 { width: 600px; diff --git a/theme/noname/scss/moodle/admin.scss b/theme/noname/scss/moodle/admin.scss index ffbb067bde31f..fe18fc713ded8 100644 --- a/theme/noname/scss/moodle/admin.scss +++ b/theme/noname/scss/moodle/admin.scss @@ -366,6 +366,12 @@ margin-right: 7px; } +.form-description pre, +.formsettingheading pre { + /*rtl:ignore*/ + direction: ltr; +} + .form-item .form-setting .form-htmlarea { display: inline; } diff --git a/theme/noname/scss/moodle/core.scss b/theme/noname/scss/moodle/core.scss index 443fcdc175440..ee6f715b0ff10 100644 --- a/theme/noname/scss/moodle/core.scss +++ b/theme/noname/scss/moodle/core.scss @@ -17,6 +17,12 @@ .mdl-right { text-align: right; } + +/*rtl:ignore*/ +.text-ltr { + direction: ltr !important; +} + #add, #remove, .centerpara, diff --git a/theme/noname/scss/moodle/debug.scss b/theme/noname/scss/moodle/debug.scss index 8604d99d56bf1..75c2de78486dc 100644 --- a/theme/noname/scss/moodle/debug.scss +++ b/theme/noname/scss/moodle/debug.scss @@ -11,7 +11,6 @@ body.behat-site { .phpinfo th, .phpinfo h2 { margin: auto; - text-align: left; } .phpinfo h2 { width: 600px; diff --git a/theme/noname/scss/moodle/forms.scss b/theme/noname/scss/moodle/forms.scss index 1f57e25eddc58..e6c266db4a5e0 100644 --- a/theme/noname/scss/moodle/forms.scss +++ b/theme/noname/scss/moodle/forms.scss @@ -132,59 +132,7 @@ div.backup-section + form, text-align: left; direction: ltr; } -/* rtl:ignore */ -#id_s__pathtodu, -#id_s__aspellpath, -#id_s__pathtodot, -#id_s__supportemail, -#id_s__supportpage, -#id_s__sessioncookie, -#id_s__sessioncookiepath, -#id_s__sessioncookiedomain, -#id_s__proxyhost, -#id_s__proxyuser, -#id_s__proxypassword, -#id_s__proxybypass, -#id_s__jabberhost, -#id_s__jabberserver, -#id_s__jabberusername, -#id_s__jabberpassword, -#id_s__additionalhtmlhead, -#id_s__additionalhtmltopofbody, -#id_s__additionalhtmlfooter, -#id_s__docroot, -#id_s__filter_tex_latexpreamble, -#id_s__filter_tex_latexbackground, -#id_s__filter_tex_pathlatex, -#id_s__filter_tex_pathdvips, -#id_s__filter_tex_pathconvert, -#id_s__blockedip, -#id_s__pathtoclam, -#id_s__quarantinedir, -#id_s__sitepolicy, -#id_s__sitepolicyguest, -#id_s__cronremotepassword, -#id_s__allowedip, -#id_s__blockedip, -#id_s_enrol_meta_nosyncroleids, -#id_s_enrol_ldap_host_url, -#id_s_enrol_ldap_ldapencoding, -#id_s_enrol_ldap_bind_dn, -#id_s_enrol_ldap_bind_pw, -#admin-emoticons .form-text, -#admin-role_mapping input[type=text], -#id_s_enrol_paypal_paypalbusiness, -#id_s_enrol_flatfile_location, -#page-admin-setting-enrolsettingsflatfile input[type=text], -#page-admin-setting-enrolsettingsdatabase input[type=text], -#page-admin-auth-db input[type=text] { - direction: ltr; -} -/* rtl:ignore */ -#page-admin-setting-enrolsettingsflatfile .informationbox { - direction: ltr; - text-align: left; -} + /* rtl:ignore */ #page-admin-grade-edit-scale-edit .error input#id_name { margin-right: 170px; diff --git a/theme/noname/templates/core_admin/setting.mustache b/theme/noname/templates/core_admin/setting.mustache index 4896af7580d52..bcbd735b32b04 100644 --- a/theme/noname/templates/core_admin/setting.mustache +++ b/theme/noname/templates/core_admin/setting.mustache @@ -36,7 +36,7 @@ {{/error}} {{{element}}} {{#default}} -
{{{default}}}
+
{{{default}}}
{{/default}}
{{{description}}}
diff --git a/theme/noname/templates/core_admin/setting_configcolourpicker.mustache b/theme/noname/templates/core_admin/setting_configcolourpicker.mustache index 6eba3e9aa5553..a93872154a179 100644 --- a/theme/noname/templates/core_admin/setting_configcolourpicker.mustache +++ b/theme/noname/templates/core_admin/setting_configcolourpicker.mustache @@ -23,7 +23,7 @@ {{>core/pix_icon}} {{/icon}}
- + {{#haspreviewconfig}} {{/haspreviewconfig}} diff --git a/theme/noname/templates/core_admin/setting_configduration.mustache b/theme/noname/templates/core_admin/setting_configduration.mustache index 548f397e31299..50c355d267f1d 100644 --- a/theme/noname/templates/core_admin/setting_configduration.mustache +++ b/theme/noname/templates/core_admin/setting_configduration.mustache @@ -19,7 +19,7 @@ }}
- + + {{#showvalidity}} {{#valid}} diff --git a/theme/noname/templates/core_admin/setting_configtext.mustache b/theme/noname/templates/core_admin/setting_configtext.mustache index 13cfcc93a10ab..dba4fd7409316 100644 --- a/theme/noname/templates/core_admin/setting_configtext.mustache +++ b/theme/noname/templates/core_admin/setting_configtext.mustache @@ -18,5 +18,5 @@ Setting configtext. }}
- +
diff --git a/theme/noname/templates/core_admin/setting_configtextarea.mustache b/theme/noname/templates/core_admin/setting_configtextarea.mustache index 5bc7e287a2933..f8430b802452e 100644 --- a/theme/noname/templates/core_admin/setting_configtextarea.mustache +++ b/theme/noname/templates/core_admin/setting_configtextarea.mustache @@ -18,5 +18,5 @@ Setting configtextarea. }}
- +
diff --git a/theme/noname/templates/core_admin/setting_configtime.mustache b/theme/noname/templates/core_admin/setting_configtime.mustache index 52fe668cc1330..b8e966649b137 100644 --- a/theme/noname/templates/core_admin/setting_configtime.mustache +++ b/theme/noname/templates/core_admin/setting_configtime.mustache @@ -18,7 +18,7 @@ Setting configtime. }}
-
+
+ {{/fields}} diff --git a/theme/upgrade.txt b/theme/upgrade.txt index 0d554e9e0a886..5d0e8d6e0b1c4 100644 --- a/theme/upgrade.txt +++ b/theme/upgrade.txt @@ -23,6 +23,9 @@ Removed themes: of the tool RTLCSS-PHP for more information: https://github.com/moodlehq/rtlcss-php * The class .dir-ltr should not be used any more. To force LTR styles use the directive to remove the rule when the language is RTL. See RTLCSS-PHP for more information. +* A new class .text-ltr may be used to force the direction to LTR. This is especially useful + for forms fields (numbers, emails, URLs must not be RTL'd), and for displaying code + snippets or configuration samples. * A new callback can be defined to post process the CSS using an object representation of the CSS tree ($THEME->csstreepostprocess). This gives a lot more flexibility than a simplel find and replace. Refer to 'noname' for an example, and to PHP-CSS-Parser