diff --git a/config-templates/config.php b/config-templates/config.php index 87963d66bae81f30047003029f6dce26fa083d79..3e8809c56b3ae57dbe24ba6bdf3123418a6d6921 100644 --- a/config-templates/config.php +++ b/config-templates/config.php @@ -217,9 +217,10 @@ $config = array ( 'session.phpsession.httponly' => FALSE, /* - * Languages available and what language is default + * Languages available, RTL languages, and what language is default */ 'language.available' => array('en', 'no', 'nn', 'se', 'da', 'de', 'sv', 'fi', 'es', 'fr', 'it', 'nl', 'lb', 'cs', 'sl', 'lt', 'hr', 'hu', 'pl', 'pt', 'pt-BR', 'tr', 'ja', 'zh-tw', 'ru'), + 'language.rtl' => array('ar','dv','fa','ur','he'), 'language.default' => 'en', /* diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index 03fe5e2867267c627fb65882ecc403b560501354..6a01396f5433264e994ab53354a0b0857b442c14 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -176,6 +176,18 @@ class SimpleSAML_XHTML_Template { return $lang; } + /** + * Return TRUE if language is Right-to-Left. + */ + private function isLanguageRTL() { + $rtlLanguages = $this->configuration->getArray('language.rtl', array()); + $thisLang = $this->getLanguage(); + if (in_array($thisLang, $rtlLanguages)) { + return TRUE; + } + return FALSE; + } + /** * Includs a file relative to the template base directory. * This function can be used to include headers and footers etc. diff --git a/modules/InfoCard/templates/temp-getcardform.php b/modules/InfoCard/templates/temp-getcardform.php index fecc40ff3c74b15b8b103a83667d19760f1b321f..f2bcf4031cb94d94d1628b7a63370ce67b9410d8 100644 --- a/modules/InfoCard/templates/temp-getcardform.php +++ b/modules/InfoCard/templates/temp-getcardform.php @@ -8,7 +8,7 @@ $this->includeAtTemplateBase('includes/header.php'); if (isset($this->data['error'])) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" style="float: left; margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> <h2><?php echo $this->t('error_header'); ?></h2> <p><?php echo $this->t($this->data['error']); ?> </p> diff --git a/modules/InfoCard/templates/temp-login.php b/modules/InfoCard/templates/temp-login.php index 346986331bd4bc3b499bca2187b9806e275c44f4..099e61a9429e5141b61cbaedda9ed1228c824852 100644 --- a/modules/InfoCard/templates/temp-login.php +++ b/modules/InfoCard/templates/temp-login.php @@ -8,7 +8,7 @@ $this->includeAtTemplateBase('includes/header.php'); if (isset($this->data['error'])) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" style="float: left; margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> <h2><?php echo $this->t('error_header'); ?></h2> <p><?php echo $this->t($this->data['error']); ?> </p> diff --git a/modules/authX509/templates/X509error.php b/modules/authX509/templates/X509error.php index 00168ba012eeb07d385d774b1f921c1a2755b74d..96b93046c9365f6cb9409f16f4a0b5c926901985 100644 --- a/modules/authX509/templates/X509error.php +++ b/modules/authX509/templates/X509error.php @@ -9,7 +9,7 @@ $this->includeAtTemplateBase('includes/header.php'); if ($this->data['errorcode'] !== NULL) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" style="float: left; margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> <h2><?php echo $this->t('{login:error_header}'); ?></h2> <p><b><?php echo $this->t('{errors:title_' . $this->data['errorcode'] . '}'); ?></b></p> <p><?php echo $this->t('{errors:descr_' . $this->data['errorcode'] . '}'); ?></p> diff --git a/modules/authYubiKey/templates/yubikeylogin.php b/modules/authYubiKey/templates/yubikeylogin.php index 4158d275306b6ebae6b4158b61eb23847c7243c2..eb3dce691c4cc7ffca6c417e4a5933ab12a77f0d 100644 --- a/modules/authYubiKey/templates/yubikeylogin.php +++ b/modules/authYubiKey/templates/yubikeylogin.php @@ -10,7 +10,7 @@ $this->includeAtTemplateBase('includes/header.php'); if ($this->data['errorcode'] !== NULL) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" style="float: left; margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> <h2><?php echo $this->t('{login:error_header}'); ?></h2> <p><b><?php echo $this->t('{errors:title_' . $this->data['errorcode'] . '}'); ?></b></p> <p><?php echo $this->t('{errors:descr_' . $this->data['errorcode'] . '}'); ?></p> diff --git a/modules/core/templates/frontpage_auth.tpl.php b/modules/core/templates/frontpage_auth.tpl.php index 3b9aae74bdc0e4d804f3d8fa358007c8e60a6921..b5976246b66a026c34c6e9b0b179d65bb979c0d6 100644 --- a/modules/core/templates/frontpage_auth.tpl.php +++ b/modules/core/templates/frontpage_auth.tpl.php @@ -7,9 +7,9 @@ $this->includeAtTemplateBase('includes/header.php'); <?php if ($this->data['isadmin']) { - echo '<p style="float: right">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; } else { - echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; } ?> diff --git a/modules/core/templates/frontpage_config.tpl.php b/modules/core/templates/frontpage_config.tpl.php index 9e7d1fdc6d8ad4c0770f60d99a4f4cd3e0876c77..9fb3bf97612a1713d761fd4f5f0b40fd1cebafef 100644 --- a/modules/core/templates/frontpage_config.tpl.php +++ b/modules/core/templates/frontpage_config.tpl.php @@ -15,9 +15,9 @@ $this->includeAtTemplateBase('includes/header.php'); </ul> --> <?php if ($this->data['isadmin']) { - echo '<p style="float: right">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; } else { - echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; } ?> diff --git a/modules/core/templates/frontpage_federation.tpl.php b/modules/core/templates/frontpage_federation.tpl.php index 08af6b5845775b062c59cd6162163d1c4f79a9e5..3fe0b9eb3af1993959aa9041c4b9b9b5f63b7f16 100644 --- a/modules/core/templates/frontpage_federation.tpl.php +++ b/modules/core/templates/frontpage_federation.tpl.php @@ -15,9 +15,9 @@ $this->includeAtTemplateBase('includes/header.php'); </ul> --> <?php if ($this->data['isadmin']) { - echo '<p style="float: right">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; } else { - echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; } ?> diff --git a/modules/core/templates/frontpage_welcome.tpl.php b/modules/core/templates/frontpage_welcome.tpl.php index 1809a676d5610fb242c50026f1689478ccdf59a7..dcde4f21b5f381eeaa44c3f2a094775ebb5f3e0c 100644 --- a/modules/core/templates/frontpage_welcome.tpl.php +++ b/modules/core/templates/frontpage_welcome.tpl.php @@ -8,9 +8,9 @@ $this->includeAtTemplateBase('includes/header.php'); <?php if ($this->data['isadmin']) { - echo '<p style="float: right">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; + echo '<p class="float-r">' . $this->t('{core:frontpage:loggedin_as_admin}') . '</p>'; } else { - echo '<p style="float: right"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; + echo '<p class="float-r"><a href="' . $this->data['loginurl'] . '">' . $this->t('{core:frontpage:login_as_admin}') . '</a></p>'; } ?> diff --git a/modules/core/templates/loginuserpass.php b/modules/core/templates/loginuserpass.php index cff340c999b828a290985ca10326eccdc58536da..e2657cd674dac252daff12189938af14dd46e340 100644 --- a/modules/core/templates/loginuserpass.php +++ b/modules/core/templates/loginuserpass.php @@ -14,7 +14,7 @@ $this->includeAtTemplateBase('includes/header.php'); if ($this->data['errorcode'] !== NULL) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" style="float: left; margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> <h2><?php echo $this->t('{login:error_header}'); ?></h2> <p><b><?php echo $this->t('{errors:title_' . $this->data['errorcode'] . '}'); ?></b></p> <p><?php echo $this->t('{errors:descr_' . $this->data['errorcode'] . '}'); ?></p> diff --git a/modules/sanitycheck/templates/check-tpl.php b/modules/sanitycheck/templates/check-tpl.php index afb84a69d1db05a351d432657acfa0657f024a6b..4d6200115d12cf4b8b1d24aa7e65281156c90188 100644 --- a/modules/sanitycheck/templates/check-tpl.php +++ b/modules/sanitycheck/templates/check-tpl.php @@ -10,7 +10,7 @@ $this->includeAtTemplateBase('includes/header.php'); if (count($this->data['errors']) > 0) { ?> <div style="border: 1px solid #800; background: #caa; margin: 1em; padding: .5em"> -<p><?php echo '<img style="float: right" src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/delete.png" alt="Failed" />'; ?> +<p><?php echo '<img class="float-r" src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/delete.png" alt="Failed" />'; ?> These checks failed:</p> <?php @@ -28,7 +28,7 @@ echo '</div>'; if (count($this->data['info']) > 0) { ?> <div style="border: 1px solid #ccc; background: #eee; margin: 1em; padding: .5em"> -<p><?php echo '<img style="float: right" src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/accept.png" alt="OK" />'; ?> +<p><?php echo '<img class="float-r" src="/' . $this->data['baseurlpath'] . 'resources/icons/silk/accept.png" alt="OK" />'; ?> These checks succeeded:</p> <?php echo '<ul>'; diff --git a/templates/includes/header.php b/templates/includes/header.php index 2a802919d1efcbe8d951c190843cebcfff02cd56..dcf0dd5485b3509ab5addbbd7444a8bb09ca0fbf 100644 --- a/templates/includes/header.php +++ b/templates/includes/header.php @@ -88,6 +88,11 @@ if(!empty($this->data['htmlinject']['htmlContentHead'])) { +if ($this->isLanguageRTL()) { +?> + <link rel="stylesheet" type="text/css" href="/<?php echo $this->data['baseurlpath']; ?>resources/default-rtl.css" /> +<?php +} ?> @@ -165,6 +170,10 @@ if($onLoad !== '') { 'el' => 'ελληνικά', 'ja' => '日本語', 'zh-tw' => 'ä¸ć–‡', + 'ar' => 'العربية', // Arabic + 'fa' => 'پارسی', // Persian + 'ur' => 'اردŮ', // Urdu + 'he' => 'עִבְרִית', // Hebrew ); $textarray = array(); diff --git a/templates/login-ldapmulti.php b/templates/login-ldapmulti.php index f8c045a2d31686f811dfc566df899680a2a3984c..61a01ab865d26fc2f235df000f34a1bf4cf83f9a 100644 --- a/templates/login-ldapmulti.php +++ b/templates/login-ldapmulti.php @@ -5,7 +5,7 @@ <?php if (isset($this->data['error'])) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" style="float: left; margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> <h2><?php echo $this->t('error_header'); ?></h2> <p><?php echo htmlspecialchars($this->data['error']); ?> </p> diff --git a/templates/login.php b/templates/login.php index 9f2982ca8a93b3c8f212740aaa1e29d80d6ced20..5cdab55c16a6f8e9e0af41a4f14596baaad9786a 100644 --- a/templates/login.php +++ b/templates/login.php @@ -7,7 +7,7 @@ <?php if (isset($this->data['error'])) { ?> <div style="border-left: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; background: #f5f5f5"> - <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" style="float: left; margin: 15px " /> + <img src="/<?php echo $this->data['baseurlpath']; ?>resources/icons/experience/gtk-dialog-error.48x48.png" class="float-l" style="margin: 15px " /> <h2><?php echo $this->t('error_header'); ?></h2> <p><?php echo $this->t($this->data['error']); ?> </p> diff --git a/templates/selectidp-links.php b/templates/selectidp-links.php index 1153a84c1835c4805bccec8e7c95b0039b64fa83..85aa3ca8bc57c7cf54c12cfb07238f01133756d7 100644 --- a/templates/selectidp-links.php +++ b/templates/selectidp-links.php @@ -43,11 +43,11 @@ foreach ($this->data['idplist'] AS $idpentry) { if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $this->data['idplist'])) { $idpentry = $this->data['idplist'][$this->data['preferredidp']]; echo '<div class="preferredidp">'; - echo ' <img src="/' . $this->data['baseurlpath'] .'resources/icons/experience/gtk-about.64x64.png" style="float: right" alt="'.$this->t('icon_prefered_idp').'" />'; + echo ' <img src="/' . $this->data['baseurlpath'] .'resources/icons/experience/gtk-about.64x64.png" class="float-r" alt="'.$this->t('icon_prefered_idp').'" />'; if(array_key_exists('icon', $idpentry) && $idpentry['icon'] !== NULL) { $iconUrl = SimpleSAML_Utilities::resolveURL($idpentry['icon']); - echo '<img style="float: left; margin: 1em; padding: 3px; border: 1px solid #999" src="' . htmlspecialchars($iconUrl) . '" />'; + echo '<img class="float-l" style="margin: 1em; padding: 3px; border: 1px solid #999" src="' . htmlspecialchars($iconUrl) . '" />'; } echo "\n" . ' <h3 style="margin-top: 8px">' . htmlspecialchars($this->t('idpname_' . $idpentry['entityid'])) . '</h3>'; @@ -66,7 +66,7 @@ foreach ($this->data['idplist'] AS $idpentry) { if(array_key_exists('icon', $idpentry) && $idpentry['icon'] !== NULL) { $iconUrl = SimpleSAML_Utilities::resolveURL($idpentry['icon']); - echo '<img style="clear: both; float: left; margin: 1em; padding: 3px; border: 1px solid #999" src="' . htmlspecialchars($iconUrl) . '" />'; + echo '<img class="float-l" style="clear: both; margin: 1em; padding: 3px; border: 1px solid #999" src="' . htmlspecialchars($iconUrl) . '" />'; } echo "\n" . ' <h3 style="margin-top: 8px">' . htmlspecialchars($this->t('idpname_' . $idpentry['entityid'])) . '</h3>'; diff --git a/www/resources/default-rtl.css b/www/resources/default-rtl.css new file mode 100644 index 0000000000000000000000000000000000000000..0113f82f1059079f5ec98d560e8843968ed850b4 --- /dev/null +++ b/www/resources/default-rtl.css @@ -0,0 +1,70 @@ +/* these styles are in the head of this page because this is a unique page */ + +/* THE BIG GUYS */ +html { + direction: rtl; +} + +/* LISTS */ +ul { + margin: .3em 2em 1.5em 0; +} + +li { + margin-right: 2em; +} + +#wrap { + text-align: right; +} + +/* TYPOGRAPHY */ +dl dd { + margin-right: 3em; +} + +.efieldlist { + border-right: 1px solid #e6e6e6; +} + +div.caution { + padding: .2em 60px .2em .2em; + background-position: right; +} + +th.rowtitle { + text-align: right; +} +.enablebox table { + margin-right: 1em; +} +.enablebox.mini table { + float: left; +} +.enablebox tr td { + padding: .5px .5em 1px 1em; +} + +/* Attribute presentation in example page */ +table.attributes td.attrname { + text-align: left; +} + +fieldset.fancyfieldset { + margin: 2em 0px 1em 1em; +} +fieldset.fancyfieldset legend { + margin-right: 2em; +} + +.ui-tabs .ui-tabs-nav li { + float: right; +} + +/* Reverse Float Left <-> Right */ +.float-r { + float: left; +} +.float-l { + float: right; +} diff --git a/www/resources/default.css b/www/resources/default.css index 984304fed3ddf28a0f800ea40822cd20440a1b65..958a86f701121b4f4660c1da29fd0bd0f7462f19 100644 --- a/www/resources/default.css +++ b/www/resources/default.css @@ -340,3 +340,12 @@ div#confirmation { caption { display: none; } + +/* Left-to-Right CSS for RTL (Right to Left Support) */ +.float-r { + float: right; +} +.float-l { + float: left; +} +