From 4003fdfcfcf0ae051677a5765cf7fa37ed8d969b Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 24 May 2023 18:18:23 +0200 Subject: [PATCH] globalSearch: defaulty display extraDisplayedColumns The new globalSearch_extraDisplayedColumns parameter permit to control it for each LSobject types. --- doc/conf/LSobject.docbook | 11 +++++++++ src/includes/routes.php | 4 ++++ .../default/global_search_one_page.tpl | 23 +++++++++++++++++++ 3 files changed, 38 insertions(+) diff --git a/doc/conf/LSobject.docbook b/doc/conf/LSobject.docbook index 76550380..75b719ae 100644 --- a/doc/conf/LSobject.docbook +++ b/doc/conf/LSobject.docbook @@ -69,6 +69,7 @@ ), // fin LSsearch 'globalSearch' => [booleen], + 'globalSearch_extraDisplayedColumns' => [booleen], // ioFormat 'ioFormat' => array ( @@ -274,6 +275,16 @@ + + globalSearch_extraDisplayedColumns + + Afficher ou non les colonnes supplémentaires pour ce type d'objet dans le résultat des + recherches globales (Par défaut : True). Pour plus de détails les colonnes + supplémentaires, voir la section dédiée. + + + + ioFormat diff --git a/src/includes/routes.php b/src/includes/routes.php index fbff8d77..35be006b 100644 --- a/src/includes/routes.php +++ b/src/includes/routes.php @@ -177,6 +177,10 @@ function handle_global_search($request) { LStemplate :: assign('pagetitle', $object -> getLabel()); $LSsearch = new LSsearch($LSobject, 'LSview'); + $LSsearch -> setParam( + 'extraDisplayedColumns', + LSconfig::get("LSobjects.$LSobject.globalSearch_extraDisplayedColumns", true, 'bool') + ); $LSsearch -> setParamsFromRequest(); $LSsearch -> run(); diff --git a/src/templates/default/global_search_one_page.tpl b/src/templates/default/global_search_one_page.tpl index 0ca90cfe..fd97c699 100644 --- a/src/templates/default/global_search_one_page.tpl +++ b/src/templates/default/global_search_one_page.tpl @@ -34,12 +34,35 @@ {/if} {/if} + {if $LSsearch->extraDisplayedColumns} + {foreach from=$LSsearch->visibleExtraDisplayedColumns item=conf key=cid} + + {if $LSsearch->sort} + + {if $LSsearch->sortBy == $cid} + {tr msg=$conf.label|escape:"htmlall"} + {$LSsearch->sortDirection} + {else} + {tr msg=$conf.label} + {/if} + + {else} + {tr msg=$conf.label} + {/if} + + {/foreach} + {/if} {$LSsearch->label_actions} {foreach from=$page.list item=object} dn|escape:'url'}' class='LSobject-list'>{$object->displayName|escape:'htmlall'} {if $LSsearch->displaySubDn}{$object->subDn|escape:'htmlall'}{/if} + {if $LSsearch->extraDisplayedColumns} + {foreach from=$LSsearch->visibleExtraDisplayedColumns item=conf key=cid} + {if !isset($conf.escape) || $conf.escape}{$object->$cid|escape:"htmlall"}{else}{$object->$cid}{/if} + {/foreach} + {/if} {foreach from=$object->actions item=item} {$item.label|escape: