From 222244d8146bf21433fae60fb8f0e008397035f6 Mon Sep 17 00:00:00 2001 From: gloas <gloas@afi-sa.fr> Date: Thu, 8 Nov 2018 10:11:21 +0100 Subject: [PATCH] dev #79082 : add pager to table --- .../views/scripts/url-manager/index.phtml | 108 ++++-------------- library/Class/UrlManager/Description.php | 3 + 2 files changed, 25 insertions(+), 86 deletions(-) diff --git a/application/modules/admin/views/scripts/url-manager/index.phtml b/application/modules/admin/views/scripts/url-manager/index.phtml index c657fd36892..358fbe69903 100644 --- a/application/modules/admin/views/scripts/url-manager/index.phtml +++ b/application/modules/admin/views/scripts/url-manager/index.phtml @@ -1,98 +1,34 @@ <?php Class_ScriptLoader::getInstance() - ->addScript(Class_Url::absolute('public/admin/js/url-manager/url-manager.js')) - ->addJqueryReady('$("#url-manager-wrapper").url_manager()'); + ->addScript(Class_Url::absolute('public/admin/js/url-manager/url-manager.js')) + ->addJqueryReady('$("#url-manager-wrapper").url_manager()'); -$html = [$this->renderForm($this->searchform), - BR, - $this->button((new Class_Entity(['Text' => $this->_('Tester les URL affichées'), - 'Attribs' => ['onclick' => '', - 'id' => 'test_all_http_protocol']]))), +$html = + [ + $this->renderForm($this->searchform), - $this->button((new Class_Entity(['Text' => $this->_('Sélectionner les URL acceptant le HTTPS'), - 'Attribs' => ['onclick' => '', - 'id' => 'select_all_https_protocol']]))), + BR, - $this->button((new Class_Entity(['Text' => $this->_('Mettre à jour les URL selectionnées en HTTPS dans les contenus'), - 'Attribs' => ['onclick' => '', - 'id' => 'convert_all_http_to_https']]))), - BR, - $this->renderTable((new Class_UrlManager_Description)->getDescription($this), - $this->urls)]; + $this->button((new Class_Entity(['Text' => $this->_('Tester les URL affichées'), + 'Attribs' => ['onclick' => '', + 'id' => 'test_all_http_protocol']]))), -echo $this->tag('div', implode($html), ['id' => 'url-manager-wrapper']); -$active = Class_Admin_Skin::current() - ->renderActionIconOn('active', - $this, - ['alt' => '']) . ' ' . $this->_('Https'); + $this->button((new Class_Entity(['Text' => $this->_('Sélectionner les URL acceptant le HTTPS'), + 'Attribs' => ['onclick' => '', + 'id' => 'select_all_https_protocol']]))), -$inactive = Class_Admin_Skin::current() - ->renderActionIconOn('inactive', - $this, - ['alt' => '']) . ' ' . $this->_('Https'); -return; -?> -<script> - function selectHttps(id) { - var sel = '#idselected'+id; - if ($(sel).hasClass('httpsselected')) { - $(sel+' a').html('<?php echo $inactive; ?>'); - return $(sel).removeClass('httpsselected'); - } - $(sel+' a').html('<?php echo $active; ?>'); - $(sel).addClass("httpsselected"); - } + $this->button((new Class_Entity(['Text' => $this->_('Mettre à jour les URL selectionnées en HTTPS dans les contenus'), + 'Attribs' => ['onclick' => '', + 'id' => 'convert_all_http_to_https']]))), + BR, - function convertHttps() { - $( ".httpsselected" ).each(function() { + $this->renderTable((new Class_UrlManager_Description)->getDescription($this), + $this->urls) + ]; - convertHttpToHttps($(this).attr('data-url'),$(this).attr('id')); - }); - } - - - function getUrlHttps(url,id) { - var idhttps = '#idhttps'+id; - $.ajax({ - url : "<?php echo BASE_URL; ?>/admin/ajax/test-url-https", - type : "GET", - data : "url="+url, - dataType : "html", - success : function(code_html, statut) { - if (code_html.indexOf('error') < 0) { - selectHttps(id); - } - return $(idhttps).append(code_html); - } - }); - } - - - function getUrlHttp(url,id) { - $.ajax({ - url : "<?php echo BASE_URL; ?>/admin/ajax/test-url", - type : "GET", - data : "url="+url, - dataType : "html", - success : function(code_html, statut) { - return $(id).append(code_html); - } - }); - } - - - function convertHttpToHttps(url,id) { - $.ajax({ - url : "<?php echo BASE_URL; ?>/admin/ajax/force-https", - type : "GET", - data : "url="+encodeURIComponent(url), - dataType : "html", - success : function(code_html, statut) { - return $('#'+id).html('OK'); - } - }); - } -</script> +echo $this->tag('div', + implode($html), + ['id' => 'url-manager-wrapper']); diff --git a/library/Class/UrlManager/Description.php b/library/Class/UrlManager/Description.php index ab63f3141ba..5155a059b0b 100644 --- a/library/Class/UrlManager/Description.php +++ b/library/Class/UrlManager/Description.php @@ -27,6 +27,9 @@ class Class_UrlManager_Description { public function getDescription($view) { return (new Class_TableDescription('urls')) + + ->setPager(true) + ->addColumn($this->_('URL'), function($instances) use ($view) { $instance = current($instances); -- GitLab