diff --git a/modules/consentAdmin/templates/consentadmin.php b/modules/consentAdmin/templates/consentadmin.php index ad304345ffe5bac24799559890f55afd7c919996..b0a5b21bd5bdcb84961e9316b09c6748a6d00363 100644 --- a/modules/consentAdmin/templates/consentadmin.php +++ b/modules/consentAdmin/templates/consentadmin.php @@ -5,7 +5,6 @@ // default theme $this->includeAtTemplateBase('includes/header.php'); ?> - <!-- <h2><?php if (isset($this->data['header'])) { echo $this->t($this->data['header']); } else { echo "Some error occurred"; } ?></h2> --> <h2><?php echo $this->t('{consentAdmin:consentadmin:consentadmin_header}') ?></h2> <p> <?php echo $this->t('{consentAdmin:consentadmin:consentadmin_description1}') ?> </p> diff --git a/modules/consentAdmin/templates/consentadminajax.php b/modules/consentAdmin/templates/consentadminajax.php index 6055428960b6ee18ab6ebab76a6d426957d16ea4..f6d54c72dba3b5641842f0798d8cdd967714430c 100644 --- a/modules/consentAdmin/templates/consentadminajax.php +++ b/modules/consentAdmin/templates/consentadminajax.php @@ -1,2 +1,2 @@ <?php -print $this->t($this->data['res']); +echo $res; diff --git a/modules/consentAdmin/templates/consentadminajax.twig b/modules/consentAdmin/templates/consentadminajax.twig index 1ffd174b65a7e036475f7c2ff6c06adfae6167fe..4ba950f5a1efa3c708f6d43608c07388cdce84a3 100644 --- a/modules/consentAdmin/templates/consentadminajax.twig +++ b/modules/consentAdmin/templates/consentadminajax.twig @@ -1,3 +1,3 @@ {% block content} -{{ res|trans }} +{{ res }} {% endblock %} diff --git a/modules/consentAdmin/www/consentAdmin.php b/modules/consentAdmin/www/consentAdmin.php index c00c54c45486bae79e4cfb450081a9b9524ea0d6..26ef3198b16dea02f1b423a271d374f706e45340 100644 --- a/modules/consentAdmin/www/consentAdmin.php +++ b/modules/consentAdmin/www/consentAdmin.php @@ -167,6 +167,9 @@ $hashed_user_id = \SimpleSAML\Module\consent\Auth\Process\Consent::getHashedUser // If a checkbox have been clicked if ($action !== null && $sp_entityid !== null) { + // init template to enable translation of status messages + $template = new \SimpleSAML\XHTML\Template($config, 'consentAdmin:consentadminajax.php', 'consentAdmin:consentadmin'); + // Get SP metadata $sp_metadata = $metadata->getMetaData($sp_entityid, 'saml20-sp-remote'); @@ -178,9 +181,9 @@ if ($action !== null && $sp_entityid !== null) { if ($action == 'true') { $isStored = $consent_storage->saveConsent($hashed_user_id, $targeted_id, $attribute_hash); if ($isStored) { - $res = "added"; + $res = $translator->t("added"); } else { - $res = "updated"; + $res = $translator->t("updated"); } // Remove consent } else { @@ -188,16 +191,14 @@ if ($action !== null && $sp_entityid !== null) { // Got consent, so this is a request to remove it $rowcount = $consent_storage->deleteConsent($hashed_user_id, $targeted_id); if ($rowcount > 0) { - $res = "removed"; + $res = $translator->t("removed"); } // Unknown action (should not happen) } else { \SimpleSAML\Logger::info('consentAdmin: unknown action'); - $res = "unknown"; + $res = $translator->t("unknown"); } } - // init template to enable translation of status messages - $template = new \SimpleSAML\XHTML\Template($config, 'consentAdmin:consentadminajax.php', 'consentAdmin:consentadmin'); $template->data['res'] = $res; $template->show(); exit; diff --git a/modules/discopower/templates/disco.tpl.php b/modules/discopower/templates/disco.tpl.php index 396b1527353b128604cd5e76b97dc41b1b080a0e..1ae62cabdf4ea088f853057a4ed52ce161cda85d 100644 --- a/modules/discopower/templates/disco.tpl.php +++ b/modules/discopower/templates/disco.tpl.php @@ -1,9 +1,6 @@ <?php -if(!array_key_exists('header', $this->data)) { - $this->data['header'] = 'selectidp'; -} -$this->data['header'] = $this->t($this->data['header']); +$this->data['header'] = $this->t('selectidp'); $this->data['jquery'] = array('core' => TRUE, 'ui' => TRUE, 'css' => TRUE); $this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . SimpleSAML\Module::getModuleUrl('discopower/style.css') . '" />';