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

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

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

@ -101,7 +101,7 @@ class Item
* @ORM\Column(name="badgeurl", type="string", length=250, nullable=true)
*/
private $badgeurl;
/**
* @var string
*
@ -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

@ -122,7 +122,7 @@ class ItemType extends AbstractType
'label' => "Badge URL",
'required' => false,
])
->add('essential', CheckboxType::class, [
"label" => "Item essentiel ?",
"required" => false

View File

@ -11,164 +11,50 @@
<a href="{{ path('cadoles_portal_config_alert_submit') }}" class="btn btn-success">Ajouter une Annonce</a>
<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 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 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="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>
<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>
<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

@ -50,7 +50,7 @@
{{ form_row(form.essential) }}
{{ form_row(form.content) }}
{{ form_row(form.badgeurl) }}
{{ form_row(form.protected) }}
{{ form_row(form.protected) }}
</div>

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>