Skip to content
Snippets Groups Projects
Commit 222244d8 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #79082 : add pager to table

parent ab3a7a4d
Branches
Tags
6 merge requests!2890Master,!2889Master,!2888Master,!2887Master,!2878Dev#79082 explo amelioration du force https,!2873Dev#79082 explo amelioration du force https
<?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']);
......@@ -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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment