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/lib/classes/databox.php b/lib/classes/databox.php
index c961f1e58c..3377695e39 100644
--- a/lib/classes/databox.php
+++ b/lib/classes/databox.php
@@ -463,8 +463,8 @@ class databox extends base implements ThumbnailedElement
->set_type($type)
->set_tbranch(isset($field['tbranch']) ? (string) $field['tbranch'] : '')
->set_generate_cterms((isset($field['generate_cterms']) && (string) $field['generate_cterms'] == 1))
- ->set_gui_editable((isset($field['gui_editable']) && (string) $field['gui_editable'] == 1))
- ->set_gui_visible((isset($field['gui_editable']) && (string) $field['gui_visible'] == 1))
+ ->set_gui_editable((!isset($field['gui_editable']) || (isset($field['gui_editable']) && (string) $field['gui_editable'] == 1)))
+ ->set_gui_visible((!isset($field['gui_visible']) || (isset($field['gui_visible']) && (string) $field['gui_visible'] == 1)))
->set_thumbtitle(isset($field['thumbtitle']) ? (string) $field['thumbtitle'] : (isset($field['thumbTitle']) ? $field['thumbTitle'] : '0'))
->set_report(isset($field['report']) ? (string) $field['report'] : '1')
->save();
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..68edc289c5 100644
--- a/templates/web/prod/toolbar.html.twig
+++ b/templates/web/prod/toolbar.html.twig
@@ -44,270 +44,159 @@
-
-
-
- {{ 'action : exporter' | trans }}
-
-
-
-
-
-
+ {% 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/ppen_history.png',
+ 'label':'action : editer' | trans },
+ {
+ 'class':'TOOL_videoeditor_btn',
+ 'icon':'/assets/common/images/icons/icon-video-editor.png',
+ 'label':'prod::toolbar : video editor' | 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/push16.png',
+ 'label':'action : push' | trans },
+ {
+ 'class':'TOOL_feedback_btn',
+ 'icon':'/assets/common/images/icons/feedback16.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/rss16.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 %}
-
- {{ action.label }}
-
- {% endif %}
- {% endfor %}
-
-
-
-
- {% elseif n_actions == 1 %}
-
-
- {% for action in actions %}
-
- {{ action.label }}
-
- {% endfor %}
-
-
+ {% set menus = menus|merge({(k) : m}) %}
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
{% endif %}
- {% if acl.has_right(constant('\\ACL::CANPUSH')) and acl.has_right(constant('\\ACL::BAS_CHUPUB')) %}
-
-
-
- {{ 'action : push' | trans }}
-
-
-
-
-
- {% elseif acl.has_right(constant('\\ACL::CANPUSH')) %}
-
-
-
- {{ 'action : push' | trans }}
-
-
-
-
-
- {% elseif acl.has_right(constant('\\ACL::BAS_CHUPUB')) %}
-
-
- {#
#}
- {# {{ 'action : bridge' | trans }}#}
- {# #}
-
-
- {{ 'action : publier' | trans }}
-
-
- {% if plugins.actionbar is not empty %}
+ {# print #}
+ {% for menu_entries in menus %}
+ {% if menu_entries|length > 0 %}
+
+
+ {% set menu_entry = menu_entries[0] %}
+
+ {% set menu_entries = menu_entries|slice(1) %}
+ {% if menu_entries|length > 0 %}
-
- {% endif %}
-
-
- {% elseif plugins.actionbar is not empty %}
-
-
-
- {% endif %}
+
+
+ {% 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