CustomActions : Added hideLabel feature

This commit is contained in:
Benjamin Renard 2012-10-04 14:49:30 +02:00
parent f77741d23c
commit 296e646967
3 changed files with 11 additions and 2 deletions

View file

@ -8,6 +8,7 @@
<![CDATA[$GLOBALS['LSobjects']['[nom du type d'LSobject]']['customActions'] = array ( <![CDATA[$GLOBALS['LSobjects']['[nom du type d'LSobject]']['customActions'] = array (
'action1' => array( 'action1' => array(
'label' => '[label l'action]', 'label' => '[label l'action]',
'hideLabel' => '[booléen]',
'icon' => '[nom de l'icône de l'action]', 'icon' => '[nom de l'icône de l'action]',
'function' => '[fonction à exécuter]', 'function' => '[fonction à exécuter]',
'question_format' => '[LSformat de la question de confirmation]', 'question_format' => '[LSformat de la question de confirmation]',
@ -30,7 +31,14 @@
<varlistentry> <varlistentry>
<term>label</term> <term>label</term>
<listitem> <listitem>
<simpara>Le label de la relation.</simpara> <simpara>Le label de l'action.</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>hideLabel</term>
<listitem>
<simpara>Cache le label dans le bouton de l'action.</simpara>
</listitem> </listitem>
</varlistentry> </varlistentry>

View file

@ -4,7 +4,7 @@
<ul class='LSview-actions'> <ul class='LSview-actions'>
{foreach from=$LSview_actions item=item} {foreach from=$LSview_actions item=item}
{if is_array($item)} {if is_array($item)}
<li class='LSview-actions'><a href='{$item.url}' class='LSview-actions{if $item.class} {$item.class}{/if}' ><img src='{$LS_IMAGES_DIR}/{$item.action}.png' alt='{$item.label}' title='{$item.label}' /> {$item.label}</a></li> <li class='LSview-actions'><a href='{$item.url}' class='LSview-actions{if $item.class} {$item.class}{/if}' ><img src='{$LS_IMAGES_DIR}/{$item.action}.png' alt='{$item.label}' title='{$item.label}' />{if !isset($item.hideLabel) || !$item.hideLabel} {$item.label}{/if}</a></li>
{/if} {/if}
{/foreach} {/foreach}
</ul> </ul>

View file

@ -69,6 +69,7 @@ if(LSsession :: startLSsession()) {
if (LSsession :: canExecuteCustomAction($dn,$LSobject,$name)) { if (LSsession :: canExecuteCustomAction($dn,$LSobject,$name)) {
$LSview_actions[] = array ( $LSview_actions[] = array (
'label' => ((isset($config['label']))?__($config['label']):__($name)), 'label' => ((isset($config['label']))?__($config['label']):__($name)),
'hideLabel' => ((isset($config['hideLabel']))?$config['hideLabel']:False),
'url' => 'custom_action.php?LSobject='.$LSobject.'&amp;dn='.urlencode($dn).'&amp;customAction='.$name, 'url' => 'custom_action.php?LSobject='.$LSobject.'&amp;dn='.urlencode($dn).'&amp;customAction='.$name,
'action' => ((isset($config['icon']))?$config['icon']:'generate'), 'action' => ((isset($config['icon']))?$config['icon']:'generate'),
'class' => 'LScustomActions'.(($config['noConfirmation'])?' LScustomActions_noConfirmation':'') 'class' => 'LScustomActions'.(($config['noConfirmation'])?' LScustomActions_noConfirmation':'')