diff --git a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php
index a6706424aa..d327e860c5 100644
--- a/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php
+++ b/lib/Alchemy/Phrasea/Controller/Prod/QueryController.php
@@ -341,10 +341,20 @@ class QueryController extends Controller
if ($result->getTotal() === 0) {
$template = 'prod/results/help.html.twig';
- } else {
+ }
+ else {
$template = 'prod/results/records.html.twig';
}
- $json['results'] = $this->render($template, ['results'=> $result]);
+
+ /** @var \Closure $filter */
+ $filter = $this->app['plugin.filter_by_authorization'];
+
+ $plugins = [
+ 'workzone' => $filter('workzone'),
+ 'actionbar' => $filter('actionbar'),
+ ];
+
+ $json['results'] = $this->render($template, ['results'=> $result, 'plugins'=>$plugins]);
// add technical fields
diff --git a/templates/web/prod/results/grid.html.twig b/templates/web/prod/results/grid.html.twig
index e797c96481..035cc1f182 100644
--- a/templates/web/prod/results/grid.html.twig
+++ b/templates/web/prod/results/grid.html.twig
@@ -1,4 +1,5 @@
{% include 'prod/results/record.html.twig' with {
'record': record,
- 'settings': settings
+ 'settings': settings,
+ 'plugins': plugins
} %}
diff --git a/templates/web/prod/results/list.html.twig b/templates/web/prod/results/list.html.twig
index ca45b67914..051622bb4d 100644
--- a/templates/web/prod/results/list.html.twig
+++ b/templates/web/prod/results/list.html.twig
@@ -7,7 +7,8 @@
{% include 'prod/results/record.html.twig' with {
'record': record,
- 'settings': settings
+ 'settings': settings,
+ 'plugins': plugins
} %}
|
diff --git a/templates/web/prod/results/record.html.twig b/templates/web/prod/results/record.html.twig
index f6e2d899c5..61088ea939 100644
--- a/templates/web/prod/results/record.html.twig
+++ b/templates/web/prod/results/record.html.twig
@@ -155,6 +155,29 @@
{% endif %}
{% endif %}
+
+ {# add plugins entries #}
+ {% for plugin in plugins.actionbar|default([]) %}
+ {% set menu = plugin.ActionBar['_context_']|default([]) %}
+ {% for k, action in menu %}
+ {% if plugin.isContextMenuOptionAvailable(k, record) %}
+
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+
|
diff --git a/templates/web/prod/results/records.html.twig b/templates/web/prod/results/records.html.twig
index 6b3dedc8cc..d64039a26c 100644
--- a/templates/web/prod/results/records.html.twig
+++ b/templates/web/prod/results/records.html.twig
@@ -31,7 +31,8 @@
'doctype_display': doctype_display,
'handle_dblclick' : true,
'show_context_menu': true
- }
+ },
+ 'plugins': plugins
} %}
{% endblock %}
{% endfor %}
diff --git a/templates/web/prod/toolbar.html.twig b/templates/web/prod/toolbar.html.twig
index 9f169906ea..32f931326f 100644
--- a/templates/web/prod/toolbar.html.twig
+++ b/templates/web/prod/toolbar.html.twig
@@ -44,270 +44,153 @@
-
-
-
-
-
-
-
+ {% set menus = {
+ 'export': [
+ {
+ 'class':'TOOL_disktt_btn',
+ 'icon':'/assets/common/images/icons/disktt_history.png',
+ 'label':'action : exporter' | trans },
+ {
+ 'class':'TOOL_print_btn',
+ 'icon':'/assets/common/images/icons/print_history.png',
+ 'label':'action : print' | trans }
+ ],
+ 'edit': [],
+ 'push': [],
+ 'tools': [],
+ 'delete': []
+ } %}
- {% set actions = {} %}
+ {# menu "edit" #}
+ {% set m = [] %}
{% if acl.has_right(constant('\\ACL::CANMODIFRECORD')) %}
- {% set label %}
- {{ 'action : editer' | trans }}
- {% endset %}
- {% set actions = actions|merge( { 'edit' : {'icon': "/assets/common/images/icons/ppen_history.png", 'class':'TOOL_ppen_btn', 'label' : label} }) %}
- {% set label %}
- {{ 'prod::toolbar : video editor' | trans }}
- {% endset %}
- {% set actions = actions|merge( { 'video' : {'icon': "/assets/common/images/icons/icon-video-editor.png", 'class':'TOOL_videoeditor_btn', 'label' : label} }) %}
+ {% set m = m|merge([
+ {
+ 'class':'TOOL_ppen_btn',
+ 'icon':'/assets/common/images/icons/edit-pen.png',
+ 'label':'action : editer' | trans }
+ ]) %}
{% endif %}
- {% if acl.has_right(constant('\\ACL::CHGSTATUS')) %}
- {% set label %}
- {{ 'action : status' | trans }}
- {% endset %}
- {% set actions = actions|merge( { 'status' : {'icon': "/assets/common/images/icons/chgstatus_history.png", 'class':'TOOL_chgstatus_btn', 'label' : label} }) %}
+ {% if acl.has_right(constant('\\\ACL::CHGSTATUS')) %}
+ {% set m = m|merge([
+ {
+ 'class':'TOOL_chgstatus_btn',
+ 'icon':'/assets/common/images/icons/chgstatus_history.png',
+ 'label':'action : status' | trans }
+ ]) %}
{% endif %}
{% if acl.has_right(constant('\\ACL::CANDELETERECORD')) and acl.has_right(constant('\\ACL::CANADDRECORD')) %}
- {% set label %}
- {{ 'action : collection' | trans }}
- {% endset %}
- {% set actions = actions|merge( { 'move' : {'icon': "/assets/common/images/icons/chgcoll_history.png", 'class':'TOOL_chgcoll_btn', 'label' : label} }) %}
+ {% set m = m|merge([
+ {
+ 'class':'TOOL_chgcoll_btn',
+ 'icon':'/assets/common/images/icons/chgcoll_history.png',
+ 'label':'action : collection' | trans }
+ ]) %}
+ {% endif %}
+ {% set menus = menus|merge({'edit' : m}) %}
+
+ {# menu "push" #}
+ {% set m = [] %}
+ {% if acl.has_right(constant('\\ACL::CANPUSH')) %}
+ {% set m = m|merge([
+ {
+ 'class':'TOOL_pushdoc_btn',
+ 'icon':'/assets/common/images/icons/push-icon.png',
+ 'label':'action : push' | trans },
+ {
+ 'class':'TOOL_feedback_btn',
+ 'icon':'/assets/common/images/icons/feedback-icon.png',
+ 'label':'Feedback' | trans }
+ ]) %}
+ {% endif %}
+ {% if acl.has_right(constant('\\ACL::BAS_CHUPUB')) %}
+ {% set m = m|merge([
+ {
+ 'class':'TOOL_publish_btn',
+ 'icon':'/assets/common/images/icons/rss-publish.png',
+ 'label':'action : publier' | trans }
+ ]) %}
+ {% endif %}
+ {% set menus = menus|merge({'push' : m}) %}
+
+ {# menu "tools" #}
+ {% if acl.has_right(constant('\\ACL::IMGTOOLS')) %}
+ {% set menus = menus|merge({'tools' : [
+ {
+ 'class':'TOOL_imgtools_btn',
+ 'icon':'/assets/common/images/icons/imgtools_history.png',
+ 'label':'action : outils' | trans }
+ ]}) %}
{% endif %}
- {% set n_actions = actions|length %}
- {% if n_actions > 1 %}
-
-
- {% for action in actions %}
- {% if loop.first %}
-
- {% endif %}
+ {# menu "delete" #}
+ {% if acl.has_right(constant('\\ACL::CANDELETERECORD')) %}
+ {% set menus = menus|merge({'delete' : [
+ {
+ 'class':'TOOL_trash_btn',
+ 'icon':'/assets/common/images/icons/delete.png',
+ 'label':'action : supprimer' | trans }
+ ]}) %}
+ {% endif %}
+
+ {# add plugins entries #}
+ {% if plugins.actionbar is not empty %}
+ {% for plugin in plugins.actionbar %}
+ {% for k, menu in plugin.getActionBar() %}
+ {% set m = menus[k]|default([]) %}
+ {% for action in menu %}
+ {% set m = m|merge([{
+ 'class':action.classes|default(''),
+ 'icon':plugin_asset(plugin.PluginName, action.icon),
+ 'label':action.label|trans({}, plugin.PluginLocale) }])
+ %}
{% endfor %}
-
-
-
-
- {% elseif n_actions == 1 %}
-
-
- {% for action in actions %}
-
+
+ {% endif %}
+ {% endfor %}
- {% if acl.has_right(constant('\\ACL::IMGTOOLS')) %}
-
-
-
-
{{ 'action : outils' | trans }}
-
-
-
- {% endif %}
- {% if acl.has_right(constant('\\ACL::CANDELETERECORD')) %}
-
-
-
-
{{ 'action : supprimer' | trans }}
-
-
-
- {% endif %}
{% endblock %}
{% block toolbarJS %}
{% if plugins.actionbar is not empty %}
- {% for plugin in plugins.actionbar %}
-{{ (plugin.JS|default(''))|raw }}
- {% endfor %}
+ {% for pluginId, plugin in plugins.actionbar %}
+ {% if plugin.getActionBarTemplate is defined %}
+ {% set template = plugin.getActionBarTemplate() %}
+ {% if template %}
+ {% include template with {'app': app, 'plugin_id': pluginId, 'plugin': plugin} only %}
+ {% endif %}
+ {% endif %}
+ {% endfor %}
{% endif %}
{% endblock %}
\ No newline at end of file