ajout système de badge sur les items + init badge sur l'item roundcube (fixes #32115)

This commit is contained in:
afornerot 2021-06-10 16:18:03 +02:00
parent e4cb40fae8
commit 16eb147e5b
14 changed files with 124 additions and 200 deletions

View File

@ -13,6 +13,7 @@
<file filelist="ninegate" name="/var/www/html/ninegate/app/config/template.yml" source="ninegate-template.yml" rm="True"/>
<file filelist="ninegate" name="/var/www/html/ninegate/scripts/ninegate-postservice-00.sh" source="ninegate-postservice-00.sh" rm="True" mode="700" />
<file filelist="ninegate" name="/var/www/html/ninegate/src/Cadoles/CoreBundle/Command/data/core-init-01.sql" source="ninegate-init-01.sql" rm="True"/>
<file filelist="ninegate" name="/var/www/html/ninegate/web/imap-unread.php" source="ninegate-unread.php" rm="True"/>
<file filelist='ninegate' name='/etc/cron.d/ninegate' source='ninegate.cron' rm='True'/>
<file filelist='ninegate-migration' name='/var/www/html/envole-migration/config/config-db-ninegate.php' source='ninegate-migration.php' mkdir='True'/>
@ -76,8 +77,6 @@
<variable name='ninegate_test_sonde' type='oui/non' hidden='True'/>
<variable name='ninegate_test_conf_cadolesldap' type='oui/non' hidden='True'/>
<variable name='ninegate_test_conf_ldap' type='oui/non' hidden='True'/>
<variable name="ninegate_widead_port" type='port' description="Port d'accès EAD personnalisé" hidden='True'><value>4200</value></variable>
<variable type='oui/non' name='activer_ninegate' description='Activer Ninegate'><value>oui</value></variable>
@ -213,7 +212,6 @@
<variable type="oui/non" name='ninegate_activate_widead' description='Activer EAD' mandatory='True'>
<value>non</value>
</variable>
<variable type='string' name='ninegate_widead_url' description='URL complète de votre EAD' mandatory='True' />
<!-- EOE -->
<variable type="oui/non" name='ninegate_activate_wideoe' description='Activer EOE' mandatory='True'>
@ -919,28 +917,6 @@
<param name='default_mismatch'>non</param>
</fill>
<condition name='hidden_if_in' source='ninegate_activate_widead'>
<param>non</param>
<target type='variable'>ninegate_widead_url</target>
</condition>
<fill name='calc_multi_condition' target='ninegate_widead_port'>
<param>oui</param>
<param type='eole' name='condition_1' hidden='False'>activer_ead_reverseproxy</param>
<param type='eole' name='match' hidden='False'>port_ead_reverseproxy</param>
<param name='mismatch'>4200</param>
<param name='default_match'>4200</param>
</fill>
<fill name='concat' target='ninegate_widead_url'>
<param>https://</param>
<param type='eole'>web_url</param>
<param>:</param>
<param type='eole'>ninegate_widead_port</param>
<param>/connect/?server=1</param>
</fill>
<!-- AFFICHAGE EN FONCTION DU WIDGET EOE -->
<fill name='calc_multi_condition' target='ninegate_activate_wideoe'>
<param>oui</param>

View File

@ -1,7 +1,5 @@
#!/bin/bash
export HTTP_PROXY="192.168.57.160:8080"
export HTTPS_PROXY="192.168.57.160:8080"
cd /var/www/html/ninegate

View File

@ -960,6 +960,7 @@ class InitDataCommand extends ContainerAwareCommand
$entityItem->addGroup($groupall);
}
$entityItem->setUrl($widroundcube_url);
$entityItem->setBadgeurl("/ninegate/imap-unread.php");
$em->persist($entityItem);
}

View File

@ -63,7 +63,7 @@ class Alert
/**
* @ORM\Column(name="fghideable", type="boolean")
*/
private $fghideable=true;
private $fghideable;
/**
* @var string
@ -149,7 +149,7 @@ class Alert
{
$today = new \DateTime();
if (null === $this->unpublishedat) {
return false;
return true;
}
if ($this->unpublishedat->getTimestamp() < $today->getTimestamp()) {
return true;

View File

@ -659,13 +659,13 @@ class Item
}
/**
* Set badgeurl
* Set badgeurl.
*
* @param string $badgeurl
* @param string|null $badgeurl
*
* @return Item
*/
public function setBadgeurl($badgeurl)
public function setBadgeurl($badgeurl = null)
{
$this->badgeurl = $badgeurl;
@ -673,9 +673,9 @@ class Item
}
/**
* Get badgeurl
* Get badgeurl.
*
* @return string
* @return string|null
*/
public function getBadgeurl()
{

View File

@ -119,14 +119,12 @@ class AlertType extends AbstractType
->add('publishedat', DateType::class, [
'label' => 'Publier du',
'input' => 'datetime',
'widget' => 'single_text'
])
->add('unpublishedat', DateType::class, [
'label' => 'Jusqu\'au',
'input' => 'datetime',
'required' => false,
'widget' => 'single_text',
'years' => range(date('Y'), date('Y')+10)
]);

View File

@ -12,163 +12,49 @@
<a href="{{ path('cadoles_portal_config_alertcategory_submit') }}" class="btn btn-success">Ajouter une Catégorie</a>
</p>
<div id="listpending" class="panel panel-default">
<div class="panel-heading">
<h3 style="margin:0px">En Attente Publication</h2>
</div>
<div id="list" class="panel-group">
{% for alert in alerts %}
<div
class="
panel
list-item
alertcategory-{{ alert.alertcategory.id }}
{{ alert.isOnline ? "alertstatut-online" : ""}}
{{ alert.isPending ? "alertstatut-pending" : ""}}
{{ alert.isArchived ? "alertstatut-archived" : ""}}
{% for group in alert.groups %}{{ ' group-' ~ group.id }}{% endfor %}
{% for role in alert.roles %}{{ ' role-' ~ role }}{% endfor %}
"
data-alert-category-id="{{ alert.alertcategory.id }}"
data-alert-id="{{ alert.id }}"
style="background: {{ alert.alertcategory.color ? '#'~alert.alertcategory.color : '#'~color['main'] }};"
>
<div class="panel-heading" role="tab">
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}" class="panel-heading-icon pull-left">
{% if alert.alertcategory.icon %}
<img height="25" src="/{{ alias }}/{{ alert.alertcategory.icon.label }}">
{% else %}
<img height="25" src="/{{ alias }}/uploads/icon/icon_megaphone.png">
{% endif %}
</a>
<div class="panel-body">
<div class="list panel-group">
{% for alert in alerts if alert.isPending %}
<div
class="
panel
list-item
alertcategory-{{ alert.alertcategory.id }}
{{ alert.isOnline ? "alertstatut-online" : ""}}
{{ alert.isPending ? "alertstatut-pending" : ""}}
{{ alert.isArchived ? "alertstatut-archived" : ""}}
{% for group in alert.groups %}{{ ' group-' ~ group.id }}{% endfor %}
{% for role in alert.roles %}{{ ' role-' ~ role }}{% endfor %}
"
data-alert-category-id="{{ alert.alertcategory.id }}"
data-alert-id="{{ alert.id }}"
style="background: {{ alert.alertcategory.color ? '#'~alert.alertcategory.color : '#'~color['main'] }};"
>
<div class="panel-heading" role="tab">
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}" class="panel-heading-icon pull-left">
{% if alert.alertcategory.icon %}
<img height="25" src="/{{ alias }}/{{ alert.alertcategory.icon.label }}">
{% else %}
<img height="25" src="/{{ alias }}/uploads/icon/icon_megaphone.png">
{% endif %}
</a>
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}">
<i class="fa fa-arrows-v" style="color: rgba(255,255,255,.5);"></i>
{{ alert.title }}
</a>
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}">
<i class="fa fa-arrows-v" style="color: rgba(255,255,255,.5);"></i>
{{ alert.title }}
</a>
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#alert-{{ alert.id }}" aria-expanded="true" aria-controls="collapseOne" class="panel-heading-chevron pull-right">
<i class="fa fa-chevron-down"></i>
</a>
</div>
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#alert-{{ alert.id }}" aria-expanded="true" aria-controls="collapseOne" class="panel-heading-chevron pull-right">
<i class="fa fa-chevron-down"></i>
</a>
</div>
<div id="alert-{{ alert.id }}" class="panel-body panel-collapse collapse">
{{ alert.content|raw }}
</div>
<div id="alert-{{ alert.id }}" class="panel-body panel-collapse collapse">
{{ alert.content|raw }}
</div>
<input type="hidden" name="alert_item[id][]" value="{{ alert.id }}" />
</div>
{% endfor %}
<input type="hidden" name="alert_item[id][]" value="{{ alert.id }}" />
</div>
</div>
</div>
<div id="listonline" class="panel panel-default">
<div class="panel-heading">
<h3 style="margin:0px">En Ligne</h2>
</div>
<div class="panel-body">
<div id="listonline" class="list panel-group">
{% for alert in alerts if alert.isOnline %}
<div
class="
panel
list-item
alertcategory-{{ alert.alertcategory.id }}
{{ alert.isOnline ? "alertstatut-online" : ""}}
{{ alert.isPending ? "alertstatut-pending" : ""}}
{{ alert.isArchived ? "alertstatut-archived" : ""}}
{% for group in alert.groups %}{{ ' group-' ~ group.id }}{% endfor %}
{% for role in alert.roles %}{{ ' role-' ~ role }}{% endfor %}
"
data-alert-category-id="{{ alert.alertcategory.id }}"
data-alert-id="{{ alert.id }}"
style="background: {{ alert.alertcategory.color ? '#'~alert.alertcategory.color : '#'~color['main'] }};"
>
<div class="panel-heading" role="tab">
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}" class="panel-heading-icon pull-left">
{% if alert.alertcategory.icon %}
<img height="25" src="/{{ alias }}/{{ alert.alertcategory.icon.label }}">
{% else %}
<img height="25" src="/{{ alias }}/uploads/icon/icon_megaphone.png">
{% endif %}
</a>
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}">
<i class="fa fa-arrows-v" style="color: rgba(255,255,255,.5);"></i>
{{ alert.title }}
</a>
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#alert-{{ alert.id }}" aria-expanded="true" aria-controls="collapseOne" class="panel-heading-chevron pull-right">
<i class="fa fa-chevron-down"></i>
</a>
</div>
<div id="alert-{{ alert.id }}" class="panel-body panel-collapse collapse">
{{ alert.content|raw }}
</div>
<input type="hidden" name="alert_item[id][]" value="{{ alert.id }}" />
</div>
{% endfor %}
</div>
</div>
</div>
<div id="listarchived" class="panel panel-default">
<div class="panel-heading">
<h3 style="margin:0px">Archivées</h2>
</div>
<div class="panel-body">
<div id="listarchived" class="list panel-group">
{% for alert in alerts if alert.isArchived %}
<div
class="
panel
list-item
alertcategory-{{ alert.alertcategory.id }}
{{ alert.isOnline ? "alertstatut-online" : ""}}
{{ alert.isPending ? "alertstatut-pending" : ""}}
{{ alert.isArchived ? "alertstatut-archived" : ""}}
{% for group in alert.groups %}{{ ' group-' ~ group.id }}{% endfor %}
{% for role in alert.roles %}{{ ' role-' ~ role }}{% endfor %}
"
data-alert-category-id="{{ alert.alertcategory.id }}"
data-alert-id="{{ alert.id }}"
style="background: {{ alert.alertcategory.color ? '#'~alert.alertcategory.color : '#'~color['main'] }};"
>
<div class="panel-heading" role="tab">
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}" class="panel-heading-icon pull-left">
{% if alert.alertcategory.icon %}
<img height="25" src="/{{ alias }}/{{ alert.alertcategory.icon.label }}">
{% else %}
<img height="25" src="/{{ alias }}/uploads/icon/icon_megaphone.png">
{% endif %}
</a>
<a href="{{ path('cadoles_portal_config_alert_update', { id: alert.id }) }}">
<i class="fa fa-arrows-v" style="color: rgba(255,255,255,.5);"></i>
{{ alert.title }}
</a>
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#alert-{{ alert.id }}" aria-expanded="true" aria-controls="collapseOne" class="panel-heading-chevron pull-right">
<i class="fa fa-chevron-down"></i>
</a>
</div>
<div id="alert-{{ alert.id }}" class="panel-body panel-collapse collapse">
{{ alert.content|raw }}
</div>
<input type="hidden" name="alert_item[id][]" value="{{ alert.id }}" />
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
@ -333,11 +219,7 @@
});
}
if($(".alertstatut-pending").length==0) $("#listpending").hide();
if($(".alertstatut-online").length==0) $("#listonline").hide();
if($(".alertstatut-archived").length==0) $("#listarchived").hide();
$( ".list" ).sortable({
$( "#list" ).sortable({
axis: "y",
placeholder: "list-item placeholder",
update: updateItems

View File

@ -263,6 +263,18 @@
}
});
// badgeurl item
$(".itembadgeurl").each(function() {
mybadge=$(this);
$.ajax({
method: "GET",
url: $(this).data("url"),
success: function(data) {
mybadge.append(data);
}
});
});
// Création des slick
slick();

View File

@ -203,6 +203,9 @@
<div class="grid-item-title">
<h2>{{ bookmark.item.title }}</h2>
{% if not bookmark.item.badgeurl is empty %}
<div class="itembadgeurl badge badge-pill" data-url="{{bookmark.item.badgeurl}}" style="background-color: #449d44;"></div>
{% endif %}
<span>{{ bookmark.item.subtitle|nl2br }}</<span>
</div>
</div>
@ -256,6 +259,9 @@
<div class="grid-item-title">
<h2>{{ bookmark.item.title }}</h2>
{% if not bookmark.item.badgeurl is empty %}
<div class="itembadgeurl badge badge-pill" data-url="{{bookmark.item.badgeurl}}" style="background-color: #449d44;"></div>
{% endif %}
<span>{{ bookmark.item.subtitle|nl2br }}</<span>
</div>
</div>
@ -402,6 +408,9 @@
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
{% if not item.badgeurl is empty %}
<div class="itembadgeurl badge badge-pill" data-url="{{item.badgeurl}}" style="background-color: #449d44;"></div>
{% endif %}
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>

View File

@ -102,6 +102,9 @@
{% endif %}
<div class="item-link clearfix">
{% if not bookmark.item.badgeurl is empty %}
<span class="badge badge-primary">3</span>
{% endif %}
<div class="grid-item-logo" title="{{ bookmark.item.subtitle|nl2br }}">
{% if bookmark.item.icon %}
<img class="grid-item-img" src="/{{ alias }}/{{ bookmark.item.icon.label }}">
@ -112,6 +115,9 @@
<div class="grid-item-title">
<h2>{{ bookmark.item.title }}</h2>
{% if not bookmark.item.badgeurl is empty %}
<div class="itembadgeurl badge badge-pill" data-url="{{bookmark.item.badgeurl}}" style="background-color: #449d44;"></div>
{% endif %}
<span>{{ bookmark.item.subtitle|nl2br }}</<span>
</div>
</div>
@ -197,6 +203,9 @@
<div class="grid-item-title">
<h2>{{ item.title }}</h2>
{% if not item.badgeurl is empty %}
<div class="itembadgeurl badge badge-pill" data-url="{{item.badgeurl}}" style="background-color: #449d44;"></div>
{% endif %}
<span>{{ item.subtitle|nl2br }}</<span>
</div>
</div>

View File

@ -300,7 +300,11 @@ parameters:
%if %%getVar("ninegate_activate_widead", 'non') == "oui"
activate_widead: true
widead_url: %%ninegate_widead_url
%if %%getVar("activer_ead_reverseproxy", 'non') == "oui"
widead_url: https://%%web_url:%%port_ead_reverseproxy/connect/?server=1
%else
widead_url: https://%%web_url:4200/connect/?server=1
%end if
%else
activate_widead: false
%end if

35
tmpl/ninegate-unread.php Normal file
View File

@ -0,0 +1,35 @@
<?php
%if %%is_defined('adresse_imap') or %%is_defined('adresse_ip_mail')
require_once('/var/www/html/ninegate/vendor/jasig/phpcas/CAS.php');
require_once('configCAS/cas.inc.php');
// try to configure the phpCAS client
session_name("imapunread");
session_start();
if (__CAS_DEBUG){
phpCAS::setDebug("/var/log/phpcas/phpcas-imap.log");
}
$c= phpCAS::proxy(__CAS_VERSION, __CAS_SERVER, __CAS_PORT, __CAS_FOLDER, false);
phpCAS::setNoClearTicketsFromUrl();
phpCAS::setNoCasServerValidation();
phpCAS::forceAuthentication();
if (__CAS_LOGOUT){
if(method_exists('phpCAS','EoleLogoutRequests')) phpCAS::EoleLogoutRequests(false);
}
%if %%is_defined('adresse_imap')
$a = phpCAS::serviceMail("{%%adresse_imap:993/imap/ssl/novalidate-cert}","imap://%%adresse_imap",0, $errc,$err, phpCAS::retrievePT('imap://%%adresse_imap',$t,$f));
$unseen = imap_status($a, "{%%adresse_imap:993/imap/ssl/novalidate-cert}INBOX", SA_UNSEEN);
%else
$a = phpCAS::serviceMail("{%%adresse_ip_mail:993/imap/ssl/novalidate-cert}","imap://%%adresse_ip_mail",0, $errc,$err, phpCAS::retrievePT('imap://%%adresse_ip_mail',$t,$f));
$unseen = imap_status($a, "{%%adresse_ip_mail:993/imap/ssl/novalidate-cert}INBOX", SA_UNSEEN);
%end if
$count=$unseen->unseen;
echo $count;
%end if
?>