Update access page design

This commit is contained in:
Xavier Rousset
2018-10-19 19:09:52 +02:00
parent 61782f5596
commit a8ebe5fc43
8 changed files with 239 additions and 211 deletions

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\Cache; namespace Alchemy\Phrasea\Cache;
use Doctrine\Common\Cache\WincacheCache as DoctrineWinCache; use Doctrine\Common\Cache\WinCacheCache as DoctrineWinCache;
class WinCacheCache extends DoctrineWinCache implements Cache class WinCacheCache extends DoctrineWinCache implements Cache
{ {

View File

@@ -201,6 +201,7 @@ class AccountController extends Controller
*/ */
public function accountAccess() public function accountAccess()
{ {
//var_dump($this->getRegistrationManager()->getRegistrationSummary($this->getAuthenticatedUser()));die;
return $this->render('account/access.html.twig', [ return $this->render('account/access.html.twig', [
'inscriptions' => $this->getRegistrationManager()->getRegistrationSummary($this->getAuthenticatedUser()) 'inscriptions' => $this->getRegistrationManager()->getRegistrationSummary($this->getAuthenticatedUser())
]); ]);

View File

@@ -176,7 +176,7 @@ class RegistrationManager
} }
if ($isTimeLimited && $isOutDated && $isPending) { if ($isTimeLimited && $isOutDated && $isPending) {
$userRegistration['type'] = 'out-time'; $userRegistration['type'] = 'out-dated';
return $userRegistration; return $userRegistration;
} }

View File

@@ -12,7 +12,7 @@
namespace Alchemy\Phrasea\TaskManager; namespace Alchemy\Phrasea\TaskManager;
use Alchemy\Phrasea\Exception\RuntimeException; use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\Model\Entities\Task; use Alchemy\Phrasea\Model\Entities\Task as liveTask;
class LiveInformation class LiveInformation
{ {
@@ -43,10 +43,11 @@ class LiveInformation
/** /**
* Returns live informations about the given task. * Returns live informations about the given task.
* * @param liveTask $task
* @param boolean $throwException
* @return array * @return array
*/ */
public function getTask(Task $task, $throwException = false) public function getTask(liveTask $task, $throwException = false)
{ {
$data = $this->query($throwException); $data = $this->query($throwException);
@@ -56,7 +57,7 @@ class LiveInformation
/** /**
* Returns live informations about some tasks. * Returns live informations about some tasks.
* *
* @param Task[] $tasks * @param liveTask[] $tasks
* @param boolean $throwException * @param boolean $throwException
* *
* @return array * @return array
@@ -73,13 +74,13 @@ class LiveInformation
return $ret; return $ret;
} }
private function formatTask(Task $task, $data) private function formatTask(liveTask $task, $data)
{ {
$taskData = (isset($data['jobs']) && isset($data['jobs'][$task->getId()])) ? $data['jobs'][$task->getId()] : []; $taskData = (isset($data['jobs']) && isset($data['jobs'][$task->getId()])) ? $data['jobs'][$task->getId()] : [];
return [ return [
'configuration' => $task->getStatus(), 'configuration' => $task->getStatus(),
'actual' => isset($taskData['status']) ? $taskData['status'] : Task::STATUS_STOPPED, 'actual' => isset($taskData['status']) ? $taskData['status'] : liveTask::STATUS_STOPPED,
'process-id' => isset($taskData['process-id']) ? $taskData['process-id'] : null, 'process-id' => isset($taskData['process-id']) ? $taskData['process-id'] : null,
]; ];
} }

View File

@@ -300,8 +300,8 @@ blockquote {
page-break-inside: avoid; page-break-inside: avoid;
background: #f9f9f9; background: #f9f9f9;
border-left: 10px solid #ccc; border-left: 10px solid #ccc;
margin: 1.5em 10px; margin: 1.5rem 10px;
padding: 0.5em 10px; padding: 0.5rem 10px;
quotes: "\201C""\201D""\2018""\2019"; quotes: "\201C""\201D""\2018""\2019";
color: #333; color: #333;
} }
@@ -1056,6 +1056,170 @@ h1, h2, h3, h4 {
line-height: 20px; line-height: 20px;
} }
#updatingDemand .icon-box {
display: inline-block;
width:2%;
height: 29px;
}
#updatingDemand .icon-box input {
position: relative;
bottom: 0.4rem;
}
#updatingDemand .coll-name {
width:48%;
padding-left:2%;
display: inline-block;
line-height: 1.8rem;
height: 100%;
}
#updatingDemand h3 {
border: 1px solid whitesmoke;
margin: 2rem 0;
text-align: center;
}
#updatingDemand .coll-name span{
font-size:initial;
}
#updatingDemand .cgu-block {
margin:1.6rem auto;
}
#updatingDemand .base-block {
font-size: 0;
}
#updatingDemand .status {
font-size:initial;
padding-left: 0.6rem;
}
#updatingDemand .status-box {
display: inline-block;
width:48%;
line-height: 1.2rem;
}
#updatingDemand .registration {
width:100%;
display: inline-block;
position:relative;
line-height: 0.8rem;
border: 1px solid #333333;
height: 30px;
}
#updatingDemand h3:after {
content: "";
font-family: FontAwesome;
font-weight: 400;
font-style: normal;
text-decoration: inherit;
-webkit-font-smoothing: antialiased;
display: inline;
width: auto;
height: auto;
line-height: normal;
vertical-align: baseline;
background-image: none;
background-position: 0 0;
background-repeat: repeat;
margin-top: 0;
font-size:2.3rem;
color:#a1a1a1;
float: right;
position: relative;
right: 10px;
-webkit-transition:-webkit-transform .5s;
-moz-transition:-moz-transform .5s;
-o-transition:-o-transform .5s;
-ms-transition:-ms-transform .5s;
transition:transform .5s;
-ms-transform: rotate(270deg);
-webkit-transform: rotate(270deg);
transform: rotate(270deg);
top: 2px;
}
#updatingDemand h3.toggled:after {
-ms-transform: rotate(180deg); /* IE 9 */
-webkit-transform: rotate(180deg); /* Chrome, Safari, Opera */
transform: rotate(180deg);
}
#updatingDemand .icon {
width: 20px;
height:20px;
border-radius:10px;
display:inline-block;
position: relative;
top: 0.35rem;
}
#updatingDemand .icon.active {
background-color:#61BD4F;
}
#updatingDemand .status.active {
color: #61BD4F;
}
#updatingDemand .icon.registrable {
background-color:#F2D600;
}
#updatingDemand .status.registrable {
color: #F2D600;
}
#updatingDemand .icon.in-time {
background-color:#0079BF;
}
#updatingDemand .status.in-time {
color: #0079BF;
}
#updatingDemand .icon.out-dated {
background-color:#EB5A46;
}
#updatingDemand .status.out-dated {
color: #EB5A46;
}
#updatingDemand .icon.pending {
background-color:#FFAB4A;
}
#updatingDemand .status.pending {
color: #FFAB4A;
}
#updatingDemand .icon.rejected {
background-color:red;
}
#updatingDemand .status.rejected {
color: red;
}
#updatingDemand .icon.accepted {
background-color:#61BD4F;
}
#updatingDemand .status.accepted {
color: #61BD4F;
}
#updatingDemand .registration:nth-of-type(even) {
background: #333;
}
form[name="changeEmail"] .control-label { form[name="changeEmail"] .control-label {
width: 200px; width: 200px;
} }

View File

@@ -368,9 +368,6 @@ div.switch_right.unchecked {
.board_section { .board_section {
margin: 0 0 30px; margin: 0 0 30px;
} }
.board_section ul {
margin: 0 0 20px 15px;
}
.board_section div[class="section"] { .board_section div[class="section"] {
height: auto; height: auto;
} }

View File

@@ -8,206 +8,71 @@
{% block content_account %} {% block content_account %}
<form name="updatingDemand" id="updatingDemand" action="{{ path("submit_update_account") }}" method="post"> <form name="updatingDemand" id="updatingDemand" action="{{ path("submit_update_account") }}" method="post">
<table style="table-layout: fixed; width:100%;"> <div class="base-block">
<tr> {% for sbasId, baseInfo in inscriptions if baseInfo["display"] %}
<td style="width: 180px; text-align: right">&nbsp;</td>
<td width="15px" style="width: 15px">&nbsp;</td>
<td style="width: 180px;">&nbsp;</td>
</tr>
{% for sbasId, baseInfo in inscriptions %}
{% set sbasName = sbasId | sbas_labels(app) %} {% set sbasName = sbasId | sbas_labels(app) %}
{% set private = 0 %} <h3 onclick="$( this ).toggleClass('toggled');$( this ).next('div').slideToggle();">{{ sbasName }}</h3>
<div class="block">
{% if baseInfo["registrations"]["by-type"]["accepted"]|length > 0 %} {% if attribute(baseInfo["cgu"], app['locale']) is defined %}
<tr> {% set TOU = attribute(baseInfo["cgu"], app['locale']) %}
<td colspan="3" style="text-align: center;"> {% if(TOU['value'] != '') %}
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Allowed access to the following collections" | trans }}
</th>
</tr>
{% for base in baseInfo["registrations"]["by-type"]["accepted"] %}
<tr>
<td colspan="3" style="text-align:center;">
<span style="color: lightgreen;">
<b>{{ base["coll-name"] }}</b>
</span>
(<a class="inscriptlink" style="font-size: 10px" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">
{{ "login::register::CGU: lire les CGU" | trans }}
</a>)
</td>
</tr>
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% elseif baseInfo["registrations"]["by-type"]["rejected"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Rejected access to the following collections" | trans }}
</th>
</tr>
{% for base in baseInfo["registrations"]["by-type"]["rejected"] %}
<tr>
<td colspan="3" style="text-align:center;">
<span style="color: red;">
<b>{{ base["coll-name"] }}</b>
(<a class="inscriptlink" style="font-size: 10px" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">
{{ "login::register::CGU: lire les CGU" | trans }}
</a>)
</span>
</td>
</tr>
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% elseif baseInfo["registrations"]["by-type"]["pending"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Pending access to the following collections" | trans }}
</th>
</tr>
{% for base in baseInfo["registrations"]["by-type"]["pending"] %}
<tr>
<td colspan="3" style="text-align:center;">
<span style="color: #ffff00;"><b>{{ base["coll-name"] }}</b></span>
(<a class="inscriptlink" style="font-size: 10px" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">
{{ "login::register::CGU: lire les CGU" | trans }}
</a>)
</td>
</tr>
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% elseif baseInfo["registrations"]["by-type"]["in-time"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Temporary access to the following collections" | trans }}
</th>
</tr>
{% for base in baseInfo["registrations"]["by-type"]["in-time"] %}
<tr>
<td colspan="3" style="text-align:center;">
<span style="color: lightskyblue;"><b>{{ base["coll-name"] }}</b></span>
(<a class="inscriptlink" style="font-size: 10px" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">
{{ "login::register::CGU: lire les CGU" | trans }}
</a>)
</td>
</tr>
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% elseif baseInfo["registrations"]["by-type"]["out-dated"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Outdated access to the following collections" | trans }}
</th>
</tr>
{% for base in baseInfo["registrations"]["by-type"]["out-dated"] %}
<tr>
<td colspan="3" style="text-align:center;">
<span style="color:darkred;"><b>{{ base["coll-name"] }}</b></span>
(<a class="inscriptlink" style="font-size: 10px" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">
{{ "login::register::CGU: lire les CGU" | trans }}
</a>)
</td>
</tr>
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% elseif baseInfo["registrations"]["by-type"]["inactive"]|length > 0 %}
<tr>
<td colspan="3" style="text-align: center;">
<h3 style="background: #191919;border: 1px solid #333333;color:#eee">{{ sbasName }}</h3>
</td>
</tr>
<tr>
<th colspan="3" style="text-align: center">
{{ "Suspended access to the following collections" | trans }}
</th>
</tr>
{% for base in baseInfo["registrations"]["by-type"]["inactive"] %}
<tr>
<td colspan="3" style="text-align:center;">
<span style="color:orangered;"><b>{{ base["coll-name"] }}</b></span>
(<a class="inscriptlink" style="font-size: 10px" href="{{ path('get_tou', {'to_display[]' : sbasId}) }}">
{{ "login::register::CGU: lire les CGU" | trans }}
</a>)
</td>
</tr>
{% endfor %}
<tr style="height: 5px;">
<td>
</td>
</tr>
{% else %}
{% set private = 1 %}
{% endif %}
{% if attribute(baseInfo["config"]["cgu"], app['locale']) is defined and private == 0 %}
{% set TOU = attribute(baseInfo["config"]["cgu"], app['locale']) %}
<tr>
<td colspan="3" style="text-align: center;">
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
<h4>{{ "Access to the above bases constitutes acceptance of the following Terms of Use (TOU)." | trans }}</h4> <h4>{{ "Access to the above bases constitutes acceptance of the following Terms of Use (TOU)." | trans }}</h4>
</td> <div class="cgu-block">
</tr> <blockquote>{{ TOU['value']|raw }}</blockquote>
<tr> </div>
<td colspan="3" style="text-align: center;"><blockquote class="cgu" style="width: 90%; height: 120px; text-align: left; overflow: auto;">{{ TOU['value']|raw }}</blockquote></td> {% endif %}
</tr>
{% endif %}
{% for collInfo in baseInfo["config"]["collections"] if (collInfo['registration'] is none and collInfo['can-register']) %}
{% if collInfo["cgu"] is not none and private == 0 %}
<tr>
<td colspan="3" style="text-align: center;">{{ "login::register: L\'acces aux bases ci-dessous implique l\'acceptation des Conditions Generales d\'Utilisation (CGU) suivantes" | trans }}</td>
</tr>
<tr>
<td colspan="3" style="text-align: center;"><div style="width: 90%; height: 120px; text-align: left; overflow: auto;">{{ baseInsc["CGU"] }}</div></td>
</tr>
{% endif %} {% endif %}
<tr> {% for baseId, collInfo in baseInfo["collections"] %}
<td style="text-align: right;">{{ collInfo["coll-name"] }}</td> {% set type = collInfo['type'] %}
<td></td> {% if type == 'inactive' and collInfo['can-register'] %}
<td class="TD_R" style="width: 200px;"> {% set type = 'registrable' %}
<input style="width: 15px;" class="checkbox" type="checkbox" name="registrations[]" value="{{ baseId }}" /> {% endif %}
<span>{{ "login::register: Faire une demande d\'acces" | trans }}</span> {% set show = false %}
</td> {% if type == 'active' or type == 'registrable' or type == 'in-time' or type == 'out-dated'
</tr> or type == 'pending' or type == 'rejected' or type == 'accepted' %}
{% endfor %} {% set show = true %}
{% endif %}
{% if show == true %}
<div class="registration">
<div class="coll-name">
<span>
{{ collInfo["coll-name"] }}
</span>
</div>
<div class="icon-box">
{% if type == 'registrable' %}
<input class="checkbox" type="checkbox" name="registrations[]" value="{{ baseId }}" />
{% else %}
<span class="icon {{ type }}"></span>
{% endif %}
</div>
<div class="status-box">
<span class="status {{ type }}" >
{% if type == 'active' %}
{{ "registration:collection.active" | trans }}
{% elseif type == 'registrable' %}
{{ "registration:collection.registrable" | trans }}
{% elseif type == 'in-time' %}
{{ "registration:collection.in-time" | trans }}
{% elseif type == 'out-dated' %}
{{ "registration:collection.out-dated" | trans }}
{% elseif type == 'pending' %}
{{ "registration:collection.pending" | trans }}
{% elseif type == 'rejected' %}
{{ "registration:collection.rejected" | trans }}
{% elseif type == 'accepted' %}
{{ "registration:collection.accepted" | trans }}
{% endif %}
</span>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %} {% endfor %}
</table> </div>
<div class="form-actions">
<input type="submit" class="btn btn-info" value="{{ "boutton::valider" | trans }}">
</div>
</form> </form>
{% endblock %} {% endblock %}

View File

@@ -168,7 +168,7 @@ class RegistrationManagerTest extends \PhraseanetTestCase
] ]
] ]
], ],
'out-time', 'out-dated',
1 1
]; ];