From 9e8fb2e7ab376ca03d59eb9f62c6ea35c21c0b9d Mon Sep 17 00:00:00 2001
From: gloas <gloas@afi-sa.fr>
Date: Tue, 30 Oct 2018 10:10:41 +0100
Subject: [PATCH] dev #78660 improve dashboard to handle no sso config

---
 library/ZendAfi/View/Helper/BaseHelper.php    | 11 +++++--
 .../DigitalResource/Dashboard/Harvest.php     |  7 ++---
 .../Helper/DigitalResource/Dashboard/SSO.php  |  2 +-
 library/ZendAfi/View/Helper/TagPre.php        | 29 +++++++++++++++++++
 .../EntrepotNumeriqueMelun/Config.php         |  7 ++++-
 5 files changed, 47 insertions(+), 9 deletions(-)
 create mode 100644 library/ZendAfi/View/Helper/TagPre.php

diff --git a/library/ZendAfi/View/Helper/BaseHelper.php b/library/ZendAfi/View/Helper/BaseHelper.php
index c03ffb0280c..884a7eb2e02 100644
--- a/library/ZendAfi/View/Helper/BaseHelper.php
+++ b/library/ZendAfi/View/Helper/BaseHelper.php
@@ -53,17 +53,22 @@ class ZendAfi_View_Helper_BaseHelper extends Zend_View_Helper_HtmlElement {
   }
 
 
+  protected function _tagPre() {
+    return call_user_func_array([$this->view, 'tagPre'], func_get_args());
+  }
+
+
   protected function _tagError($message) {
-    return $this->view->tagError($message);
+    return call_user_func_array([$this->view, 'tagError'], func_get_args());
   }
 
 
   protected function _tagNotice($message) {
-    return $this->view->tagNotice($message);
+    return call_user_func_array([$this->view, 'tagNotice'], func_get_args());
   }
 
 
   protected function _tagWarning($message) {
-    return $this->view->tagWarning($message);
+    return call_user_func_array([$this->view, 'tagWarning'], func_get_args());
   }
 }
\ No newline at end of file
diff --git a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php
index 25954619dda..7d84ca80fea 100644
--- a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php
+++ b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/Harvest.php
@@ -59,7 +59,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Harvest extends ZendAfi_View
       return $this->_tag('p', $this->_('Vignette de l\'album : '
                                        . $this->view->tagImg(Class_Url::absolute($album->getThumbnailUrl()))));
 
-    return $this->_tag('p', implode(BR, $errors), ['class' => 'error']);
+    return $this->_tagError(implode(BR, $errors));
   }
 
 
@@ -146,7 +146,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Harvest extends ZendAfi_View
     return ($url = $config->getHarvestUrl())
       ? ($this->_tag('h4',
                      $this->_('URL de moissonnage générée pour la première page'))
-         . $this->_tag('pre', $url))
+         . $this->_tagPre($url))
       : $this->_tagNotice($this->_('Cette ressource ne prend pas en charge l\'affichage de l\'url de moissonnage'));
   }
 
@@ -170,8 +170,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_Harvest extends ZendAfi_View
                     $albums_link,
                     $this->_tag('h4',
                                 $this->_('Tentative de vignettage de l\'album "%s" : ', $first_album->getTitre())),
-                    $this->_tag('pre',
-                                $this->_('Image source : %s', $first_album->getPoster())),
+                    $this->_tagPre($this->_('Image source : %s', $first_album->getPoster())),
                     $this->_renderThumbnailerLog($first_album)]);
   }
 
diff --git a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
index 097e80aec6c..92e7ec14541 100644
--- a/library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
+++ b/library/ZendAfi/View/Helper/DigitalResource/Dashboard/SSO.php
@@ -25,7 +25,7 @@ class ZendAfi_View_Helper_DigitalResource_Dashboard_SSO extends ZendAfi_View_Hel
     $html = [$this->_tag('h3', $this->_('Diagnostic SSO'))];
 
     if(!$config->getSsoAction()) {
-      $html [] = $this->_tag('p', $this->_('Cette ressource ne prend pas en charge la connexion SSO'), ['class' => 'error']) ;
+      $html [] = $this->_tagNotice($this->_('Cette ressource ne prend pas en charge la connexion SSO')) ;
       return implode($html);
     }
 
diff --git a/library/ZendAfi/View/Helper/TagPre.php b/library/ZendAfi/View/Helper/TagPre.php
new file mode 100644
index 00000000000..7283ba18515
--- /dev/null
+++ b/library/ZendAfi/View/Helper/TagPre.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * Copyright (c) 2012-2017, Agence Française Informatique (AFI). All rights reserved.
+ *
+ * BOKEH is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
+ * the Free Software Foundation.
+ *
+ * There are special exceptions to the terms and conditions of the AGPL as it
+ * is applied to this software (see README file).
+ *
+ * BOKEH is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * along with BOKEH; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+ */
+
+
+class ZendAfi_View_Helper_TagPre extends ZendAfi_View_Helper_BaseHelper {
+  public function tagPre($content, $attribs = []) {
+    return $this->_tag('pre',
+                       $this->view->escape($content),
+                       $attribs);
+  }
+}
\ No newline at end of file
diff --git a/library/digital_resources/EntrepotNumeriqueMelun/Config.php b/library/digital_resources/EntrepotNumeriqueMelun/Config.php
index 9aed79f4375..5fae0a2d9c4 100644
--- a/library/digital_resources/EntrepotNumeriqueMelun/Config.php
+++ b/library/digital_resources/EntrepotNumeriqueMelun/Config.php
@@ -44,7 +44,7 @@ class EntrepotNumeriqueMelun_Config extends Class_DigitalResource_Config {
             'AdminVars' => ['Harvest_Url' => Class_AdminVar_Meta::newDefault($this->_('URL du service OAI de l\'entrepôt numérique de Melun'),
                                                                          ['value' => 'http://melun.preprod-osiros.decalog.net/oai/'])->bePrivate(),
 
-                            'OAI_metadataPrefix' => Class_AdminVar_Meta::newDefault($this->_('MetadataPrefix du service OAI de l\'entrepôt numérique de Melun. Exemples de metada prefix : oai_dc, oai_numel.'),
+                            'OAI_metadataPrefix' => Class_AdminVar_Meta::newDefault($this->_('MetadataPrefix du service OAI de l\'entrepôt numérique de Melun.'),
                                                                                     ['value' => 'oai_numel'])->bePrivate(),
                             $this->getName() => Class_AdminVar_Meta::newOnOff($this->_('Activer / Désactiver l\'intégration de l\'entrepôt numérique de Melun'))->bePrivate()
             ]
@@ -68,4 +68,9 @@ class EntrepotNumeriqueMelun_Config extends Class_DigitalResource_Config {
       ? $this->newOAIClient()->getRecordsUrl()
       : '';
   }
+
+
+  public function getSsoAction() {
+    return;
+  }
 }
\ No newline at end of file
-- 
GitLab