From e10fe18471f2c48ef4bb1c21ea710df156b0b437 Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Wed, 2 May 2018 14:46:32 +0200
Subject: [PATCH] hotline #74731 change anchor to pre to avoid miss click and
 improve rendering

---
 .../View/Helper/DigitalResource/Dashboard.php | 20 +++++++++++--------
 library/digital_resources/Skilleos/Config.php |  8 ++------
 .../Skilleos/tests/SkilleosTest.php           |  4 ++--
 public/admin/css/global.css                   |  7 +++++++
 public/admin/skins/bokeh74/global.css         |  1 +
 public/admin/skins/retro/global.css           |  7 +++++++
 6 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/library/ZendAfi/View/Helper/DigitalResource/Dashboard.php b/library/ZendAfi/View/Helper/DigitalResource/Dashboard.php
index 603f351205f..f555dc312ec 100644
--- a/library/ZendAfi/View/Helper/DigitalResource/Dashboard.php
+++ b/library/ZendAfi/View/Helper/DigitalResource/Dashboard.php
@@ -238,7 +238,14 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard extends ZendAfi_View_Helper_
     $html [] = $this->_tag('h4', $this->_('URL SSO générée par /modules/%s pour l\'utilisateur "%s"',
                                           $this->_config->getSsoAction(),
                                           $user->getLogin()))
-      . $this->view->tagAnchor($url, $url, ['target' => '_blank']);
+      . $this->_tag('pre', $url)
+      . $this->view->button((new Class_Entity)
+                            ->setUrl($this->view->url(['action' => 'try-sso']))
+                            ->setText($this->_('Essayer le SSO'))
+                            ->setAttribs(['title' =>
+                                          $this->_('Essayez de vous connecter en SSO à la plateforme "%s" avec l\'utilisateur "%s"',
+                                                   $this->_config->getName(),
+                                                   $user->getLogin())]));
 
     if(!$this->_config->getSsoValidateUrl()) {
       $html [] = $this->_tag('p', $this->_('Cette ressource ne prend pas en charge la validation du ticket de connexion SSO'), ['class' => 'error']) ;
@@ -248,7 +255,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard extends ZendAfi_View_Helper_
       $url = $this->_config->validateUrlFor($user);
       $html [] = $this->_tag('h4', $this->_('URL de validation du ticket de connexion générée pour l\'utilisateur "%s"',
                                             $user->getLogin()))
-        . $this->view->tagAnchor($url, $url, ['target' => '_blank']);
+        . $this->_tag('pre', $url);
     }
 
 
@@ -337,9 +344,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard extends ZendAfi_View_Helper_
     $html [] = ($url = $this->_config->getHarvestUrl())
       ? ($this->_tag('h4',
                     $this->_('URL de moissonnage générée pour la première page'))
-         . $this->view->tagAnchor($url,
-                                  $url,
-                                  ['target' => '_blank']))
+         . $this->_tag('pre', $url))
       : $this->_config->renderHarvestDiagOn($this->view);
 
     $html [] = $this->_tag('h4',
@@ -370,9 +375,8 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard extends ZendAfi_View_Helper_
     $html [] = $count
       ? ($this->_tag('h4',
                      $this->_('Tentative de vignettage de l\'album "%s" : ', $first_album->getTitre()))
-         . $this->view->tagAnchor($first_album->getPoster(),
-                             $this->_('Image source : %s', $first_album->getPoster()),
-                             ['target' => '_blank'])
+         . $this->_tag('pre',
+                       $this->_('Image source : %s', $first_album->getPoster()))
          . $this->_renderThumbnailerLog($first_album))
       : $this->_tag('p', $this->_('Le vignettage n\'est pas testable sans album'), ['class' => 'error']);
 
diff --git a/library/digital_resources/Skilleos/Config.php b/library/digital_resources/Skilleos/Config.php
index fc4c4649a38..3f7274d0d5e 100644
--- a/library/digital_resources/Skilleos/Config.php
+++ b/library/digital_resources/Skilleos/Config.php
@@ -86,15 +86,11 @@ class Skilleos_Config extends Class_DigitalResource_Config {
 
     $html = [$view->tag('p', $this->_('Ce moissonnage se compose de deux étapes:')),
              $view->tag('h4', $this->_('Première étape: La récupération du token OAUTH à l\'adresse:')),
-             $view->tagAnchor($token_url,
-                              $token_url,
-                              ['targer' => 'blank']),
+             $view->tag('pre', $token_url),
              $view->tag('p', $this->_('Réponse reçue à la demande de token :')),
              $view->tag('pre', $service->httpGet($token_url)),
              $view->tag('h4', $this->_('Deuxième étape: La récupération du catalogue à l\'adresse:')),
-             $view->tagAnchor($catalogue_url,
-                              $catalogue_url,
-                              ['targer' => 'blank']),
+             $view->tag('pre', $catalogue_url),
              $view->tag('p', $this->_('Réponse reçue à la demande du catalogue:')),
              $view->tag('pre', $service->httpGetCatalogue()),
     ];
diff --git a/library/digital_resources/Skilleos/tests/SkilleosTest.php b/library/digital_resources/Skilleos/tests/SkilleosTest.php
index 720444bf25b..6de1e0edd7e 100644
--- a/library/digital_resources/Skilleos/tests/SkilleosTest.php
+++ b/library/digital_resources/Skilleos/tests/SkilleosTest.php
@@ -379,12 +379,12 @@ class SkilleosDashboardTest extends SkilleosServiceTestCase {
 
   /** @test */
   public function getTokenUrlShouldBePresent() {
-    $this->assertXPath('//a[@href="http://moncompte.skilleos.com/oauth/v2/token?grant_type=client_credentials&client_id=id&client_secret=secret"]');
+    $this->assertXPathContentContains('//pre', 'http://moncompte.skilleos.com/oauth/v2/token?grant_type=client_credentials');
   }
 
 
   /** @test */
   public function getCatalogueUrlShouldBePresent() {
-    $this->assertXPath('//a[@href="http://moncompte.skilleos.com/rest/api/trainings"]');
+    $this->assertXPathContentContains('//pre', 'http://moncompte.skilleos.com/rest/api/trainings');
   }
 }
\ No newline at end of file
diff --git a/public/admin/css/global.css b/public/admin/css/global.css
index fa14ee1bb39..cc30c1dabde 100644
--- a/public/admin/css/global.css
+++ b/public/admin/css/global.css
@@ -1649,3 +1649,10 @@ table#logs img {
 #learn_more:hover {
   background-color:var(--bokeh-event-highlight);
 }
+
+.modules pre {
+    margin: 1ex 1em;
+    padding: 1ex 1em;
+    overflow: auto;
+    max-height: 300px;
+}
\ No newline at end of file
diff --git a/public/admin/skins/bokeh74/global.css b/public/admin/skins/bokeh74/global.css
index ed171cda6b3..f2563311e61 100755
--- a/public/admin/skins/bokeh74/global.css
+++ b/public/admin/skins/bokeh74/global.css
@@ -1019,6 +1019,7 @@ table#logs img {
     margin: 1ex 1em;
     padding: 1ex 1em;
     overflow: auto;
+    max-height: 300px;
 }
 
 #learn_more > * {
diff --git a/public/admin/skins/retro/global.css b/public/admin/skins/retro/global.css
index c97c2f85477..5fc005922b5 100755
--- a/public/admin/skins/retro/global.css
+++ b/public/admin/skins/retro/global.css
@@ -884,4 +884,11 @@ body .error * {
 
 #learn_more:hover {
   background-color:var(--bokeh-event-highlight);
+}
+
+.modules pre {
+    margin: 1ex 1em;
+    padding: 1ex 1em;
+    overflow: auto;
+    max-height: 300px;
 }
\ No newline at end of file
-- 
GitLab