PHRAS-350 Deprecate client

This commit is contained in:
Nicolas Le Goff
2015-01-12 15:10:46 +01:00
parent 56c6133693
commit b3d50619c5
7 changed files with 49 additions and 78 deletions

View File

@@ -27,6 +27,17 @@ class Root implements ControllerProviderInterface
$controllers = $app['controllers_factory'];
$controllers->before(function (Request $request) use ($app) {
/**
* /!\/!\/!\/!\/!\/!\/!\/!\/!\
*
* Client is not longer used
*
* Redirect to production with a nice message
*/
$app['session']->getFlashBag()->add('client_deprecated');
return $app->redirectPath('prod');
if (!$app['authentication']->isAuthenticated() && null !== $request->query->get('nolog')) {
return $app->redirectPath('login_authenticate_as_guest', array('redirect' => 'client'));
}

View File

@@ -8,29 +8,11 @@
</li>
{% if module != "lightbox" and app['authentication'].isAuthenticated() %}
<li>
{% if module == "prod" %}
<a target="_self" href="{{ path('get_client') }}">
<span class="">
{% trans 'admin::monitor: Ancienne version (client)' %}
</span>
</a>
{% else %}
{% if app['browser'].isNewGeneration %}
{% if module == "client" %}
<a target="_self" href="{{ path('prod') }}">
<span class="">
{% trans 'admin::monitor: Nouvelle version (prod)' %}
</span>
</a>
{% else %}
<a target="_blank" href="{{ path('prod') }}">
<span class="">
{% trans 'admin::monitor: production' %}
</span>
</a>
{% endif %}
{% endif %}
{% endif %}
</li>
{% if app['browser'].isNewGeneration and app['phraseanet.registry'].get('GV_thesaurus') == true and app['authentication'].getUser().ACL.has_access_to_module('thesaurus') %}
@@ -95,7 +77,7 @@
{% endif %}
{# MODULE #}
{% if module == "prod" or module == "client" %}
{% if module == "prod" %}
<li>
<a href="#" onclick="getHome('PUBLI');" >
<span>
@@ -122,7 +104,7 @@
<div class="PNB" style="left:auto;overflow:hidden;">
<ol>
{% if app['authentication'].isAuthenticated() and (module == "client" or module == "prod") %}
{% if app['authentication'].isAuthenticated() and module == "prod" %}
<li id="notification_trigger">
<a href="#" style="font-weight:bold;text-decoration:none;">
<span>
@@ -192,7 +174,7 @@
</div>
</div>
{% if app['authentication'].isAuthenticated() and (module == "client" or module == "prod") %}
{% if app['authentication'].isAuthenticated() and module == "prod" %}
<div style="display:none;z-index:30000;" id="notification_box">
{% set notifications = app['events-manager'].get_notifications %}
{% include 'prod/notifications.html.twig' %}

View File

@@ -119,6 +119,20 @@
</div>
<div id="desktop" class="PNB" style="overflow:hidden;">
{% if app.flash('client_deprecated') %}
<div id="clientModal" class="modal hide fade" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3>{{ 'Client application is deprecated'|trans }}</h3>
</div>
<div class="modal-body">
<p>{{ 'You have been redirected to production application.'|trans }}</p>
</div>
</div>
<script type="text/javascript">
$('#clientModal').modal();
</script>
{% endif %}
{% set ratio = app['authentication'].getUser().getPrefs('search_window') %}
{% if ratio == 0 %}
{% set ratio = '0.333' %}

View File

@@ -2,8 +2,6 @@
namespace Alchemy\Tests\Phrasea\Controller\Client;
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
protected $client;
@@ -25,57 +23,6 @@ class RootTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
$this->authenticate(self::$DI['app']);
self::$DI['client']->request("GET", "/client/");
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
}
/**
* @covers Alchemy\Phrasea\Controller\Client\Root::getClientLanguage
*/
public function testGetLanguage()
{
self::$DI['client']->request("GET", "/client/language/");
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
}
/**
* @covers Alchemy\Phrasea\Controller\Client\Root::getClientPublications
*/
public function testGetPublications()
{
self::$DI['client']->request("GET", "/client/publications/");
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
}
/**
* @covers Alchemy\Phrasea\Controller\Client\Root::getClientHelp
*/
public function testGetClientHelp()
{
self::$DI['client']->request("GET", "/client/help/");
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
}
/**
* @covers Alchemy\Phrasea\Controller\Client\Root::query
* @covers Alchemy\Phrasea\Controller\Client\Root::buildQueryFromRequest
*/
public function testExecuteQuery()
{
$queryParameters = array();
$queryParameters["mod"] = self::$DI['user']->getPrefs('client_view') ? : '3X6';
$queryParameters["bas"] = array_keys(self::$DI['user']->ACL()->get_granted_base());
$queryParameters["qry"] = self::$DI['user']->getPrefs('start_page_query') ? : 'all';
$queryParameters["pag"] = 0;
$queryParameters["search_type"] = SearchEngineOptions::RECORD_RECORD;
$queryParameters["qryAdv"] = '';
$queryParameters["opAdv"] = array();
$queryParameters["status"] = array();
$queryParameters["recordtype"] = SearchEngineOptions::TYPE_ALL;
$queryParameters["sort"] = self::$DI['app']['phraseanet.registry']->get('GV_phrasea_sort', '');
$queryParameters["infield"] = array();
$queryParameters["ord"] = SearchEngineOptions::SORT_MODE_DESC;
self::$DI['client']->request("POST", "/client/query/", $queryParameters);
$this->assertTrue(self::$DI['client']->getResponse()->isOk());
$this->assertTrue(self::$DI['client']->getResponse()->isRedirect());
}
}

View File

@@ -4253,3 +4253,11 @@ ui-dialog-titlebar {
position: relative;
float: left;
}
#clientModal, #clientModal .modal-footer {
background-color: #404040;
}
#clientModal .close {
color: #fff;
}

View File

@@ -4376,3 +4376,12 @@ ui-dialog-titlebar {
position: relative;
float: left;
}
#clientModal, #clientModal .modal-footer {
background-color: #999999;
color: #fff;
}
#clientModal .close {
color: #404040;
}