Skip to content
Snippets Groups Projects
Commit 3e767667 authored by llaffont's avatar llaffont
Browse files

Ajout d'un heartbeat quand loggé côté admin pour ne pas perdre la session

parent 688d8f88
Branches
Tags
No related merge requests found
......@@ -3636,6 +3636,7 @@ tests/application/modules/admin/controllers/FormationControllerTest.php -text
tests/application/modules/admin/controllers/FrbrLinktypeControllerTest.php -text
tests/application/modules/admin/controllers/HarvestControllerTest.php -text
tests/application/modules/admin/controllers/I18nControllerTest.php -text
tests/application/modules/admin/controllers/IndexControllerTest.php -text
tests/application/modules/admin/controllers/IndexControllerTranslationTest.php -text
tests/application/modules/admin/controllers/LieuControllerTest.php -text
tests/application/modules/admin/controllers/MenusControllerTest.php -text
......
......@@ -183,4 +183,9 @@ class Admin_IndexController extends Zend_Controller_Action {
return $help[$name];
}
public function heartbeatAction() {
$this->getHelper('ViewRenderer')->setNoRender();
}
}
\ No newline at end of file
......@@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title><?php echo $this->getTitre(); ?></title>
<?php
$head_scripts = Class_ScriptLoader::newInstance()
->addStyleSheet(URL_ADMIN_JS.'jquery_ui/css/jquery.ui.afi.theme')
......@@ -25,4 +26,9 @@
echo $this->headScript();
echo $this->headLink();
?>
<script>
(function heartbeat() {
$.get('<?php echo BASE_URL ?>/admin/index/heartbeat', function() {setTimeout(heartbeat, 60000);});
})();
</script>
</head>
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
* AFI-OPAC 2.0 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).
*
* AFI-OPAC 2.0 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 AFI-OPAC 2.0; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
require_once 'AdminAbstractControllerTestCase.php';
class IndexControllerHeartBeatTest extends Admin_AbstractControllerTestCase {
/** @test */
public function adminPageShouldContainsHeartbeatScript() {
$this->dispatch('/admin/index/index', true);
$this->assertXPathContentContains('//script', '/admin/index/heartbeat');
}
/** @test */
public function responseShouldBeEmpty() {
$this->dispatch('/admin/index/heartbeat', true);
$this->assertEquals('', $this->_response->getBody());
}
}
?>
\ No newline at end of file
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