globalSearch: defaulty display extraDisplayedColumns

The new globalSearch_extraDisplayedColumns parameter permit to control 
it for each LSobject types.
This commit is contained in:
Benjamin Renard 2023-05-24 18:18:23 +02:00
parent 341f555e0c
commit 4003fdfcfc
Signed by: bn8
GPG key ID: 3E2E1CE1907115BC
3 changed files with 38 additions and 0 deletions

View file

@ -69,6 +69,7 @@
), // fin LSsearch
'globalSearch' => [booleen],
'globalSearch_extraDisplayedColumns' => [booleen],
// ioFormat
'ioFormat' => array (
@ -274,6 +275,16 @@
</listitem>
</varlistentry>
<varlistentry>
<term>globalSearch_extraDisplayedColumns</term>
<listitem>
<simpara>Afficher ou non les colonnes supplémentaires pour ce type d'objet dans le résultat des
recherches globales (Par défaut : <literal>True</literal>). Pour plus de détails les colonnes
supplémentaires, <link linkend="config-LSobject-LSsearch">voir la section dédiée</link>.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>ioFormat</term>
<listitem>

View file

@ -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();

View file

@ -34,12 +34,35 @@
{/if}
</th>
{/if}
{if $LSsearch->extraDisplayedColumns}
{foreach from=$LSsearch->visibleExtraDisplayedColumns item=conf key=cid}
<th class='LSobject-list'{if isset($conf.cssStyle) && $conf.cssStyle} style='{$conf.cssStyle|escape:"htmlall"}'{/if}>
{if $LSsearch->sort}
<a href='object/{$LSsearch->LSobject|escape:"url"}?sortBy={$cid|escape:"url"}&amp;nocache={$smarty.now}'>
{if $LSsearch->sortBy == $cid}
<strong>{tr msg=$conf.label|escape:"htmlall"}</strong>
<img src='{img name=$LSsearch->sortDirection}' class='LSobject-list-ordersense' alt='{$LSsearch->sortDirection}'/>
{else}
{tr msg=$conf.label}
{/if}
</a>
{else}
{tr msg=$conf.label}
{/if}
</th>
{/foreach}
{/if}
<th class='LSobject-list'>{$LSsearch->label_actions}</th>
</tr>
{foreach from=$page.list item=object}
<tr class='{cycle values="LSobject-list,LSobject-list LSobject-list-bis"}'>
<td class='LSobject-list LSobject-list-names'><a href='object/{$LSsearch->LSobject|escape:'url'}/{$object->dn|escape:'url'}' class='LSobject-list'>{$object->displayName|escape:'htmlall'}</a> </td>
{if $LSsearch->displaySubDn}<td class='LSobject-list'>{$object->subDn|escape:'htmlall'}</td>{/if}
{if $LSsearch->extraDisplayedColumns}
{foreach from=$LSsearch->visibleExtraDisplayedColumns item=conf key=cid}
<td class='LSobject-list'{if isset($conf.cssStyle) && $conf.cssStyle} style='{$conf.cssStyle|escape:"htmlall"}'{/if}>{if !isset($conf.escape) || $conf.escape}{$object->$cid|escape:"htmlall"}{else}{$object->$cid}{/if}</td>
{/foreach}
{/if}
<td class='LSobject-list LSobject-list-actions'>
{foreach from=$object->actions item=item}
<a href='{$item.url|escape:'quotes'}' class='LSobject-list-actions'><img src='{img name=$item.action|escape:'url'}' alt='{$item.label|escape:'quotes'}' title='{$item.label|escape:'quotes'}'/></a>