LSselect : Added feature to filter object selection that can't be modified by user

This commit is contained in:
Benjamin Renard 2009-11-11 19:58:28 +00:00
parent fda14d5930
commit 216fae6b7f
3 changed files with 21 additions and 1 deletions

View file

@ -82,6 +82,10 @@ class LSselect {
LSerror :: addErrorCode('LSsession_12'); LSerror :: addErrorCode('LSsession_12');
} }
} }
public static function selectablly($obj,$args) {
return (LSsession::canEdit($obj->type,$obj->dn,$args))?1:0;
}
} }
?> ?>

View file

@ -35,12 +35,27 @@ if(LSsession :: startLSsession()) {
$LSsearch -> setParamsFormPostData(); $LSsearch -> setParamsFormPostData();
$LSsearch -> setParam('nbObjectsByPage',NB_LSOBJECT_LIST_SELECT); $LSsearch -> setParam('nbObjectsByPage',NB_LSOBJECT_LIST_SELECT);
$selectablly=((isset($_REQUEST['selectablly']))?$_REQUEST['selectablly']:0);
if (is_string($_REQUEST['editableAttr'])) {
$LSsearch -> setParam(
'customInfos',
array (
'selectablly' => array (
'function' => array('LSselect','selectablly'),
'args' => $_REQUEST['editableAttr']
)
)
);
$selectablly=1;
}
$multiple = ((isset($_REQUEST['multiple']))?1:0); $multiple = ((isset($_REQUEST['multiple']))?1:0);
$searchForm = array ( $searchForm = array (
'action' => $_SERVER['PHP_SELF'], 'action' => $_SERVER['PHP_SELF'],
'recursive' => (! LSsession :: isSubDnLSobject($LSobject) && LSsession :: subDnIsEnabled() ), 'recursive' => (! LSsession :: isSubDnLSobject($LSobject) && LSsession :: subDnIsEnabled() ),
'multiple' => $multiple, 'multiple' => $multiple,
'selectablly' => $selectablly,
'labels' => array ( 'labels' => array (
'submit' => _('Search'), 'submit' => _('Search'),
'approx' => _('Approximative search'), 'approx' => _('Approximative search'),
@ -60,6 +75,7 @@ if(LSsession :: startLSsession()) {
$LSsearch -> getHiddenFieldForm(), $LSsearch -> getHiddenFieldForm(),
array( array(
'ajax' => 1, 'ajax' => 1,
'selectablly' => $selectablly,
'multiple' => $multiple 'multiple' => $multiple
) )
) )

View file

@ -26,7 +26,7 @@
</tr> </tr>
{foreach from=$page.list item=object} {foreach from=$page.list item=object}
<tr class='{cycle values="LSobject-list,LSobject-list LSobject-list-bis"}'> <tr class='{cycle values="LSobject-list,LSobject-list LSobject-list-bis"}'>
<td class='LSobject-list LSobject-select-check'><input type='{if $searchForm.multiple}checkbox{else}radio{/if}' name='LSobjects_selected[]' value='{$object->dn}' {if $object->LSselect}checked="true"{/if} class='LSobject-select' /></td> <td class='LSobject-list LSobject-select-check'><input type='{if $searchForm.multiple}checkbox{else}radio{/if}' name='LSobjects_selected[]' value='{$object->dn}' {if $object->LSselect}checked="true"{/if}{if $searchForm.selectablly}{if !$object->selectablly} disabled{/if}{/if} class='LSobject-select' /></td>
<td class='LSobject-list LSobject-select-names'>{$object->displayName}</td> <td class='LSobject-list LSobject-select-names'>{$object->displayName}</td>
{if $LSsearch->displaySubDn} {if $LSsearch->displaySubDn}
<td class='LSobject-list LSobject-select-level'>{$object->subDn}</td> <td class='LSobject-list LSobject-select-level'>{$object->subDn}</td>