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

dev #79082 : fix rt comments

parent b8be00fd
Branches
Tags
6 merge requests!2890Master,!2889Master,!2888Master,!2887Master,!2878Dev#79082 explo amelioration du force https,!2873Dev#79082 explo amelioration du force https
Pipeline #5258 failed with stage
in 30 minutes and 4 seconds
......@@ -31,9 +31,8 @@ class Admin_UrlManagerController extends ZendAfi_Controller_Action {
$this->_request->getPost())));
$this->view->titre = $this->_('Contrôle des URL');
$this->view->urls = (new Class_UrlManager)->findAll(['protocol' => $this->_getParam('protocol', 'no'),
'term' => $this->_getParam('term'),
'group_by' => $this->_getParam('group_by')]);
$this->view->urls = (new Class_UrlManager)->findAll(['protocol' => $this->_getParam('protocol', 'http'),
'term' => $this->_getParam('term')]);
$this->view->searchform = $this->_searchForm();
}
......@@ -89,10 +88,8 @@ class Admin_UrlManagerController extends ZendAfi_Controller_Action {
return $this->_redirectClose($this->view->url(['action' => 'index']));
}
$this->view->titre = $this->_('Liste des documents qui contiennent "%s"',$url);
$urls = ( new Class_UrlManager)->findAll(['group_by' => 'no',
'protocol' => 'no',
'term' => $url]
);
$urls = ( new Class_UrlManager)->findAll(['protocol' => 'no',
'term' => $url]);
$this->view->models = [];
foreach ($urls as $instances)
......@@ -142,17 +139,9 @@ class Admin_UrlManagerController extends ZendAfi_Controller_Action {
'multioptions' => ['no' => $this->_('Aucun'),
'http' => $this->_('http'),
'https' => $this->_('https')],
'value' => $this->_getParam('protocol', 'no')])
->addElement('radio',
'group_by',
['label' => $this->_('Regrouper par'),
'multioptions' => ['domain' => $this->_('Domaine'),
'no' => $this->_('Aucun')],
'value' => $this->_getParam('group_by', 'no')])
'value' => $this->_getParam('protocol', 'http')])
->addUniqDisplayGroup('search', ['legend' => $this->_('Filtrer les URL')]);
}
......
......@@ -5,6 +5,10 @@ Class_ScriptLoader::getInstance()
$html =
[
$this->tag('p', $this->_('Cet outil collecte les URL dans les articles, les lettres d\'information et les domaines.')),
$this->tag('p', $this->_('Pour chaque URL collectée, vous pouvez convertir son protocole en HTTPS ainsi qu\'explorer les contenus qui l\'utilise.')),
$this->renderForm($this->searchform),
BR,
......
......@@ -34,9 +34,7 @@ class Class_UrlManager extends Class_Entity {
? 'http'
: $params['protocol'];
$search_pattern = ('domain' == $params['group_by'])
? '[\w\.\-\%\+]'
: '[\w\/\.\-\%\+]';
$search_pattern = '[\w\/\.\-\%\+]';
$preg = '@(' . $protocol . '://'. $search_pattern.'+)[\b\s]?@i';
......@@ -75,7 +73,6 @@ class Class_UrlManager extends Class_Entity {
return $result;
$urls = $this->findAll(['protocol' => 'no',
'group_by' => 'no',
'term' => $url]);
$success = true;
......
......@@ -35,9 +35,7 @@ class Class_UrlManager_Description {
$instance = current($instances);
$url = $instance->getUrl();
return $view->tagAnchor($url,
(strlen($url) > 40)
? substr($url, 0, 40) . '...'
: $instance->getUrl(),
$instance->getUrl(),
['title' => $url]);
})
......@@ -83,32 +81,44 @@ class Class_UrlManager_Description {
$instance = current($instances);
$id = $instance->getId();
$url = $instance->getUrl();
$https_url = str_replace('http://',
'https://', $url);
$url_request = urlencode($url);
$convert_url = Class_Url::absolute(['module' => 'admin',
'controller' => 'url-manager',
'action' =>'update-url-in-models',
'url' => $url_request,
'by' => urlencode(str_replace('http://',
'https://', $url))],null,true);
'by' => urlencode($https_url)]
, null, true);
$actions = [$view->tagAnchor('#',
Class_Admin_Skin::current()
->renderActionIconOn('inactive',
$view,
['alt' => $this->_('Sélectioner ou déselectionner l\'URL.')]),
['data-id' => $id,
['alt' => '']),
['title' => $this->_('Sélectioner ou déselectionner l\'URL.'),
'data-id' => $id,
'data-url' => $url,
'data-convert' => $convert_url,
'data-image-selected' => Class_Admin_Skin::current()->getIconUrl('actions', 'active'),
'data-image-not-selected' => Class_Admin_Skin::current()->getIconUrl('actions', 'inactive'),
'data-selected-status' => $instance->getSelectedStatus()]),
$view->tagAnchor('#',
Class_Admin_Skin::current()
->renderActionIconOn('help',
$view,
['alt' => '']),
['data-test-row' => 1,
'title' => $this->_('Tester l\'URL')]),
$view->tagAnchor($convert_url,
Class_Admin_Skin::current()
->renderActionIconOn('test',
$view,
['alt' => $this->_('Mettre à jour l\'URL sélectionnée en HTTPS dans les contenus')]),
['data-popup' => 'true']),
['alt' => '']),
['data-popup' => 'true',
'title' => $this->_('Mettre à jour l\'URL sélectionnée en HTTPS dans les contenus')]),
$view->tagAnchor($view->url(['controller' => 'url-manager',
'action' =>'url-details',
......@@ -116,8 +126,9 @@ class Class_UrlManager_Description {
Class_Admin_Skin::current()
->renderActionIconOn('loupe',
$view,
['alt' => $this->_('Voir les contenus fournissant cette URL')]),
['data-popup' => 'true']),
['alt' => '']),
['data-popup' => 'true',
'title' => $this->_('Voir les contenus fournissant cette URL')]),
$view->tagAnchor($view->url(['controller' => 'url-manager',
'action' =>'edit-url',
......@@ -125,11 +136,14 @@ class Class_UrlManager_Description {
Class_Admin_Skin::current()
->renderActionIconOn('edit',
$view,
['alt' => $this->_('Modifier l\'adresse URL')]),
['data-popup' => 'true'])
['alt' => '']),
['data-popup' => 'true',
'title' => $this->_('Modifier l\'adresse URL')])
];
return implode($actions);
return $view->tag('div',
implode($actions),
['style' => 'width: 120px']);
});
}
}
\ No newline at end of file
......@@ -26,6 +26,11 @@
testProtocolOnAllLinks();
});
html.find('[data-test-row]').click(function(event) {
event.preventDefault();
testProtocolOnRow($(event.target).closest('tr'));
});
html.find('#select_all_https_protocol').click(function(event) {
event.preventDefault();
selectAllHttpsProtocol();
......@@ -84,6 +89,25 @@
});
}
function testProtocolOnRow(row) {
row.find('div[data-protocol^="http"]').each(function() {
var element = $(this);
var url = element.attr('data-test-url');
var id = element.attr('data-id');
$.ajax({
url : url,
type : "GET",
dataType : "html",
success : function(data) {
if ('error' != $(data).attr('class'))
element.attr('data-selectable', true);
element.html(data);
}});
});
}
function selectAllHttpsProtocol() {
html.find('[data-selected-status]').each(function() {
......
......@@ -139,6 +139,12 @@ class UrlManagerControllerIndexDispatchWithURLFilteredTest extends UrlManagerTes
}
/** @test */
public function testRowActionShouldBePresent() {
$this->assertXPath('//td//a[@data-test-row]');
}
/** @test */
public function detailsActionShouldBePresent() {
$this->assertXPath('//td//a[contains(@href, "/admin/url-manager/url-details/url/")]');
......
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