From 3819e818671054782fde63ab0ba0802968d59c05 Mon Sep 17 00:00:00 2001
From: llaffont <llaffont@afi-sa.fr>
Date: Fri, 16 Dec 2016 17:21:24 +0100
Subject: [PATCH] dev #50182 reporting : RT comments

---
 VERSIONS_WIP/50182                            |  2 +-
 .../admin/controllers/SystemeController.php   |  2 +-
 library/Class/AdminVar.php                    |  7 ------
 library/Class/Systeme/Report.php              | 19 ++++++++-------
 library/Class/WebService/Redmine.php          |  2 +-
 .../ZendAfi/View/Helper/Status/Abstract.php   |  9 +++++++
 public/admin/skins/retro/global.css           |  9 +++++++
 .../ZendAfi/View/Helper/Status/JsonTest.php   | 24 +------------------
 8 files changed, 32 insertions(+), 42 deletions(-)

diff --git a/VERSIONS_WIP/50182 b/VERSIONS_WIP/50182
index e08c1484ab9..e61d1ba23a3 100644
--- a/VERSIONS_WIP/50182
+++ b/VERSIONS_WIP/50182
@@ -1 +1 @@
- - ticket #50182 : 10/55 Seaside : meilleur reporting poker 1 : génération du rapport HTML dans Bokeh + JSON
\ No newline at end of file
+ - ticket #50182 : ajout d'un rapport html + json sur l'état du portail: intégrations, connecteurs, communication SIGB
\ No newline at end of file
diff --git a/application/modules/admin/controllers/SystemeController.php b/application/modules/admin/controllers/SystemeController.php
index 0490ec34a6a..e5089697706 100644
--- a/application/modules/admin/controllers/SystemeController.php
+++ b/application/modules/admin/controllers/SystemeController.php
@@ -303,7 +303,7 @@ class Admin_SystemeController extends Zend_Controller_Action {
 
 
   public function statusAction() {
-    $this->view->titre = $this->_('Vue d\'ensemble');
+    $this->view->titre = $this->_('Etat du système');
   }
 }
 ?>
\ No newline at end of file
diff --git a/library/Class/AdminVar.php b/library/Class/AdminVar.php
index 2a9d6f7acce..322ebeedbdb 100644
--- a/library/Class/AdminVar.php
+++ b/library/Class/AdminVar.php
@@ -22,9 +22,6 @@
 
 class Class_AdminVarLoader extends Storm_Model_Loader {
   use Trait_Translator;
-  const HARVEST = "HARVEST";
-  const SSO = "SSO";
-
 
   /** @var array */
   protected $all_vars;
@@ -665,10 +662,6 @@ class Class_AdminVarLoader extends Storm_Model_Loader {
   }
 
 
-  public function isHarvested($numeric_resource_name) {
-    return (class_exists('Class_WebService_BibNumerique_'.$numeric_resource_name));
-  }
-
   /**
    * @return bool
    */
diff --git a/library/Class/Systeme/Report.php b/library/Class/Systeme/Report.php
index 0d15562a709..adb13dd86ac 100644
--- a/library/Class/Systeme/Report.php
+++ b/library/Class/Systeme/Report.php
@@ -163,8 +163,8 @@ class Class_Systeme_Report_Ils extends Class_Systeme_Report_Abstract {
 
 class Class_Systeme_Report_DigitalConnectors extends Class_Systeme_Report_Abstract {
   public function acceptVisitor($visitor) {
-    $visitor->visitRecordHeader(['label' => $this->_('Label'),
-                                 'enabled' => $this->_('Activation'),
+    $visitor->visitRecordHeader(['label' => $this->_('Libellé'),
+                                 'enabled' => $this->_('Activé'),
                                  'features' =>  $this->_('Fonctionnalités'),
                                  'album_count' => $this->_('Nombre d\'albums')]);
 
@@ -174,15 +174,16 @@ class Class_Systeme_Report_DigitalConnectors extends Class_Systeme_Report_Abstra
 
 
   protected function _reportConnector($visitor, $description) {
-    $album_count = 0;
+    $record = ['code' => $description['code'],
+               'label' => $description['label'],
+               'enabled' => $description['enabled'] ? '1' : '0',
+               'features' => $description['features']];
+
     if ($description['doctype_id'] && in_array('HARVEST', $description['features']))
-      $album_count = Class_Album::countBy(['type_doc_id' => $description['doctype_id']]);
+      $record['album_count'] = Class_Album::countBy(['type_doc_id' => $description['doctype_id']]);
 
-    if ($description['enabled'] || $album_count)
-      $visitor->visitRecordValues(['label' => $description['label'],
-                                   'enabled' => $description['enabled'] ? '1' : '0',
-                                   'features' => $description['features'],
-                                   'album_count' => $album_count]);
+    if ($description['enabled'] || isset($record['album_count']))
+      $visitor->visitRecordValues($record);
   }
 }
 
diff --git a/library/Class/WebService/Redmine.php b/library/Class/WebService/Redmine.php
index 02413d22508..daa11a004ac 100644
--- a/library/Class/WebService/Redmine.php
+++ b/library/Class/WebService/Redmine.php
@@ -19,7 +19,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
  */
 
- class Class_WebService_Redmine extends Class_WebService_Abstract {
+class Class_WebService_Redmine extends Class_WebService_Abstract {
    use Trait_Translator;
 
    const CUSTOM_PRIORITY_ID = 5;
diff --git a/library/ZendAfi/View/Helper/Status/Abstract.php b/library/ZendAfi/View/Helper/Status/Abstract.php
index 079aa0add6d..5aea83504b7 100644
--- a/library/ZendAfi/View/Helper/Status/Abstract.php
+++ b/library/ZendAfi/View/Helper/Status/Abstract.php
@@ -23,5 +23,14 @@
 abstract class ZendAfi_View_Helper_Status_Abstract extends ZendAfi_View_Helper_BaseHelper {
   use Trait_TimeSource;
 
+  abstract public function visitSection($id, $label, $section);
+  abstract public function visitData($id, $label, $value);
+  abstract public function visitDatetime($id, $label, $value);
+  abstract public function visitDataArray($id, $label, $values);
+  abstract public function visitAlert($id, $label, $unit, $value);
+  abstract public function visitCounter($id, $label, $count);
+  abstract public function visitRecordHeader($headers);
+  abstract public function visitRecordValues($values);
+
 }
 ?>
\ No newline at end of file
diff --git a/public/admin/skins/retro/global.css b/public/admin/skins/retro/global.css
index 5dbd764f409..8e5639fac05 100755
--- a/public/admin/skins/retro/global.css
+++ b/public/admin/skins/retro/global.css
@@ -498,6 +498,15 @@ div.boutons .bouton {
     padding-left: 1em;
 }
 
+
+.modules .digital_connectors div.enabled {
+    background-color: #59e625;
+    width: 200px;
+    padding: 5px;
+    text-align: center;
+}
+
+
 .pager {
     text-align: center;
     margin-top: 5px;
diff --git a/tests/library/ZendAfi/View/Helper/Status/JsonTest.php b/tests/library/ZendAfi/View/Helper/Status/JsonTest.php
index 4b6919382b3..87a988ca5ff 100644
--- a/tests/library/ZendAfi/View/Helper/Status/JsonTest.php
+++ b/tests/library/ZendAfi/View/Helper/Status/JsonTest.php
@@ -366,29 +366,7 @@ class ZendAfi_View_Helper_Status_JsonTest extends ZendAfi_View_Helper_Status_Tes
                            "label"  =>  "SoundCloud",
                            "enabled" => false,
                            "features" => ["HARVEST"],
-                         ],
-                        $this->_report['digital_connectors']);
-  }
-
-
-  /** @test */
-  public function BabelioShouldBeDisabled() {
-    $this->assertContains(["code" => "BABELIO",
-                         "label"  =>  "Babelthèque",
-                         "enabled" => false,
-                         "features" => ["EMBEDED"],
-                         ],
-                        $this->_report['digital_connectors']);
-  }
-
-
-
-  /** @test */
-  public function EuropressShouldBeDisabled() {
-    $this->assertContains(["code" => "EUROPRESSE",
-                         "label"  =>  "Europresse",
-                         "enabled" => '',
-                         "features" => [],
+                           "album_count" => 0
                          ],
                         $this->_report['digital_connectors']);
   }
-- 
GitLab