mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-20 07:23:47 +01:00
- LSview / LSselect :
-> Ajout d'une fonctionnalité de trie par colonne -> template/code : modification du principe de tr.bis -> LSselect.js : correction d'un bug dans la méthode oncheckboxChange() - LSsession : -> Ajout d'une méthode isSubDnLSobject() -> Correction d'un bug dans la méthode getSortSubDnLdapServer()
This commit is contained in:
parent
582ac60fe9
commit
a8931db30d
9 changed files with 191 additions and 35 deletions
|
@ -620,6 +620,9 @@ class LSsession {
|
||||||
return $_SESSION['LSsession']['LSview_subDnLdapServer'];
|
return $_SESSION['LSsession']['LSview_subDnLdapServer'];
|
||||||
}
|
}
|
||||||
$subDnLdapServer = $this -> getSubDnLdapServer();
|
$subDnLdapServer = $this -> getSubDnLdapServer();
|
||||||
|
if (!$subDnLdapServer) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
uksort($subDnLdapServer,"compareDn");
|
uksort($subDnLdapServer,"compareDn");
|
||||||
$_SESSION['LSsession']['LSview_subDnLdapServer']=$subDnLdapServer;
|
$_SESSION['LSsession']['LSview_subDnLdapServer']=$subDnLdapServer;
|
||||||
return $subDnLdapServer;
|
return $subDnLdapServer;
|
||||||
|
@ -1283,6 +1286,25 @@ class LSsession {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* L'objet est t-il utilisé pour listé les subDnS
|
||||||
|
*
|
||||||
|
* @param[in] $type string Le type d'objet
|
||||||
|
*
|
||||||
|
* @return boolean true si le type d'objet est un subDnObject, false sinon
|
||||||
|
*/
|
||||||
|
function isSubDnLSobject($type) {
|
||||||
|
debug('seach : '.$type);
|
||||||
|
$result = false;
|
||||||
|
if (is_array($this -> ldapServer['subDn']['LSobject'])) {
|
||||||
|
foreach($this -> ldapServer['subDn']['LSobject'] as $key => $value) {
|
||||||
|
if ($key==$type) {
|
||||||
|
$result=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -29,6 +29,14 @@ var LSselect = new Class({
|
||||||
$$('a.LSobject-list-page').each(function(el) {
|
$$('a.LSobject-list-page').each(function(el) {
|
||||||
el.addEvent('click',this.onChangePageClick.bindWithEvent(this,el));
|
el.addEvent('click',this.onChangePageClick.bindWithEvent(this,el));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
$$('.sortBy_displayValue').each(function(el) {
|
||||||
|
el.addEvent('click',this.sortBy.bind(this,'displayValue'));
|
||||||
|
}, this);
|
||||||
|
|
||||||
|
$$('.sortBy_subDn').each(function(el) {
|
||||||
|
el.addEvent('click',this.sortBy.bind(this,'subDn'));
|
||||||
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
oncheckboxChange: function(checkbox){
|
oncheckboxChange: function(checkbox){
|
||||||
|
@ -114,5 +122,16 @@ var LSselect = new Class({
|
||||||
input.setProperty('type','hidden');
|
input.setProperty('type','hidden');
|
||||||
input.injectInside(this.LSselect_search_form);
|
input.injectInside(this.LSselect_search_form);
|
||||||
this.submitSearchForm();
|
this.submitSearchForm();
|
||||||
|
input.remove();
|
||||||
|
},
|
||||||
|
|
||||||
|
sortBy: function(value) {
|
||||||
|
var input = new Element('input');
|
||||||
|
input.setProperty('name','orderby');
|
||||||
|
input.setProperty('type','hidden');
|
||||||
|
input.setProperty('value',value);
|
||||||
|
input.injectInside(this.LSselect_search_form);
|
||||||
|
this.submitSearchForm();
|
||||||
|
input.remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,6 +36,8 @@ if($LSsession -> startLSsession()) {
|
||||||
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
|
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
|
||||||
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
|
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
|
||||||
|
|
||||||
|
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
|
||||||
|
|
||||||
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) {
|
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) {
|
||||||
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
|
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
|
||||||
if (isCompatibleDNs($_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'],$GLOBALS['LSsession'] -> topDn)) {
|
if (isCompatibleDNs($_SESSION['LSsession']['LSsearch'][$LSobject]['topDn'],$GLOBALS['LSsession'] -> topDn)) {
|
||||||
|
@ -51,6 +53,9 @@ if($LSsession -> startLSsession()) {
|
||||||
$recur = $_SESSION['LSsession']['LSsearch'][$LSobject]['recur'];
|
$recur = $_SESSION['LSsession']['LSsearch'][$LSobject]['recur'];
|
||||||
$approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx'];
|
$approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx'];
|
||||||
$selectedTopDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['selectedTopDn'];
|
$selectedTopDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['selectedTopDn'];
|
||||||
|
$orderby = $_SESSION['LSsession']['LSsearch'][$LSobject]['orderby'];
|
||||||
|
$ordersense = $_SESSION['LSsession']['LSsearch'][$LSobject]['ordersense'];
|
||||||
|
$doSubDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['doSubDn'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$filter = NULL;
|
$filter = NULL;
|
||||||
|
@ -60,6 +65,9 @@ if($LSsession -> startLSsession()) {
|
||||||
$recur = false;
|
$recur = false;
|
||||||
$approx = false;
|
$approx = false;
|
||||||
$selectedTopDn = $GLOBALS['LSsession'] -> topDn;
|
$selectedTopDn = $GLOBALS['LSsession'] -> topDn;
|
||||||
|
$orderby = false;
|
||||||
|
$ordersense = 'ASC';
|
||||||
|
$doSubDn = (($subDnLdapServer)&&(!$GLOBALS['LSsession']->isSubDnLSobject($LSobject)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['LSview_search_submit'])) {
|
if (isset($_REQUEST['LSview_search_submit'])) {
|
||||||
|
@ -113,6 +121,23 @@ if($LSsession -> startLSsession()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sort=false;
|
||||||
|
if ((isset($_REQUEST['orderby']))) {
|
||||||
|
$possible_values= array('displayValue','subDn');
|
||||||
|
if (in_array($_REQUEST['orderby'],$possible_values)) {
|
||||||
|
$sort=true;
|
||||||
|
if ($orderby==$_REQUEST['orderby']) {
|
||||||
|
$ordersense = ($ordersense=='ASC')?'DESC':'ASC';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ordersense = 'ASC';
|
||||||
|
}
|
||||||
|
$orderby=$_REQUEST['orderby'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$GLOBALS['Smarty']->assign('LSobject_list_subDn',$doSubDn);
|
||||||
|
|
||||||
// Sauvegarde en Session
|
// Sauvegarde en Session
|
||||||
$_SESSION['LSsession']['LSsearch'][$LSobject] = array(
|
$_SESSION['LSsession']['LSsearch'][$LSobject] = array(
|
||||||
'filter' => $filter,
|
'filter' => $filter,
|
||||||
|
@ -121,7 +146,10 @@ if($LSsession -> startLSsession()) {
|
||||||
'pattern' => $pattern,
|
'pattern' => $pattern,
|
||||||
'recur' => $recur,
|
'recur' => $recur,
|
||||||
'approx' => $approx,
|
'approx' => $approx,
|
||||||
'selectedTopDn' => $selectedTopDn
|
'selectedTopDn' => $selectedTopDn,
|
||||||
|
'orderby' => $orderby,
|
||||||
|
'ordersense' => $ordersense,
|
||||||
|
'doSubDn' => $doSubDn
|
||||||
);
|
);
|
||||||
|
|
||||||
$GLOBALS['Smarty']->assign('LSview_search_pattern',$pattern);
|
$GLOBALS['Smarty']->assign('LSview_search_pattern',$pattern);
|
||||||
|
@ -175,7 +203,6 @@ if($LSsession -> startLSsession()) {
|
||||||
|
|
||||||
$c=0;
|
$c=0;
|
||||||
|
|
||||||
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
|
|
||||||
foreach($list as $thisObject) {
|
foreach($list as $thisObject) {
|
||||||
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$thisObject->getValue('dn'))) {
|
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$thisObject->getValue('dn'))) {
|
||||||
|
|
||||||
|
@ -183,10 +210,12 @@ if($LSsession -> startLSsession()) {
|
||||||
unset($actions);
|
unset($actions);
|
||||||
|
|
||||||
$subDn_name=false;
|
$subDn_name=false;
|
||||||
reset($subDnLdapServer);
|
if ($doSubDn) {
|
||||||
while (!$subDn_name && next($subDnLdapServer)) {
|
reset($subDnLdapServer);
|
||||||
if (isCompatibleDNs(key($subDnLdapServer),$thisObject -> getValue('dn'))) {
|
while (!$subDn_name && next($subDnLdapServer)) {
|
||||||
$subDn_name=current($subDnLdapServer);
|
if (isCompatibleDNs(key($subDnLdapServer),$thisObject -> getValue('dn'))) {
|
||||||
|
$subDn_name=current($subDnLdapServer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,6 +237,34 @@ if($LSsession -> startLSsession()) {
|
||||||
}
|
}
|
||||||
$GLOBALS['Smarty']->assign('LSobject_list_nbresult',$searchData['LSobject_list_nbresult']);
|
$GLOBALS['Smarty']->assign('LSobject_list_nbresult',$searchData['LSobject_list_nbresult']);
|
||||||
|
|
||||||
|
// Order by if $sort
|
||||||
|
if ($sort) {
|
||||||
|
function sortBy($a,$b) {
|
||||||
|
global $ordersense;
|
||||||
|
global $orderby;
|
||||||
|
|
||||||
|
if ($ordersense=='ASC') {
|
||||||
|
$sense = -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sense = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($a == $b) return 0;
|
||||||
|
$sort = array($a[$orderby],$b[$orderby]);
|
||||||
|
sort($sort);
|
||||||
|
if ($sort[0]==$a[$orderby])
|
||||||
|
return 1*$sense;
|
||||||
|
return -1*$sense;
|
||||||
|
}
|
||||||
|
if (!uasort($searchData['objectList'],'sortBy')) {
|
||||||
|
debug('Erreur durant le trie.');
|
||||||
|
}
|
||||||
|
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
|
||||||
|
}
|
||||||
|
$GLOBALS['Smarty']->assign('LSobject_list_orderby',$orderby);
|
||||||
|
$GLOBALS['Smarty']->assign('LSobject_list_ordersense',$ordersense);
|
||||||
|
|
||||||
// Pagination
|
// Pagination
|
||||||
if ($searchData['LSobject_list_nbresult'] > NB_LSOBJECT_LIST) {
|
if ($searchData['LSobject_list_nbresult'] > NB_LSOBJECT_LIST) {
|
||||||
if (isset($_REQUEST['page'])) {
|
if (isset($_REQUEST['page'])) {
|
||||||
|
@ -223,16 +280,8 @@ if($LSsession -> startLSsession()) {
|
||||||
$GLOBALS['Smarty']->assign('LSobject_list_nbpage',$searchData['LSobject_list_nbpage']);
|
$GLOBALS['Smarty']->assign('LSobject_list_nbpage',$searchData['LSobject_list_nbpage']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bis/Pas Bis + Select/Pas Select
|
// Select/Pas Select
|
||||||
for($i=0;$i<count($searchData['objectList']);$i++) {
|
for($i=0;$i<count($searchData['objectList']);$i++) {
|
||||||
if ($i%2==0) {
|
|
||||||
$tr='bis';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$tr='';
|
|
||||||
}
|
|
||||||
$searchData['objectList'][$i]['tr']=$tr;
|
|
||||||
|
|
||||||
if (is_array($_SESSION['LSselect'][$LSobject])) {
|
if (is_array($_SESSION['LSselect'][$LSobject])) {
|
||||||
if(in_array($searchData['objectList'][$i]['dn'],$_SESSION['LSselect'][$LSobject])) {
|
if(in_array($searchData['objectList'][$i]['dn'],$_SESSION['LSselect'][$LSobject])) {
|
||||||
$select = true;
|
$select = true;
|
||||||
|
|
|
@ -117,7 +117,11 @@ th.LSobject-list {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
td.LSobject-list-subdn {
|
a th.LSobject-list {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
th.LSobject-list-subdn {
|
||||||
width: 15em;
|
width: 15em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,6 +274,10 @@ div.LSobject-select {
|
||||||
width: 570px;
|
width: 570px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sortBy_displayValue, .sortBy_subDn {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
.LSobject-select-check {
|
.LSobject-select-check {
|
||||||
width: 10px;
|
width: 10px;
|
||||||
}
|
}
|
||||||
|
@ -298,3 +306,12 @@ img.LSrelation-btn {
|
||||||
margin: 0.5em;
|
margin: 0.5em;
|
||||||
margin-bottom: 0em;
|
margin-bottom: 0em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img.LSobject-list-ordersense {
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
th.LSobject-list a {
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
BIN
trunk/templates/images/ASC.png
Normal file
BIN
trunk/templates/images/ASC.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 224 B |
BIN
trunk/templates/images/DESC.png
Normal file
BIN
trunk/templates/images/DESC.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 267 B |
|
@ -1,14 +1,15 @@
|
||||||
<table class='LSobject-list' id='LSselect-object' caption='{$LSobject_list_objecttype}'>
|
<table class='LSobject-list' id='LSselect-object' caption='{$LSobject_list_objecttype}'>
|
||||||
<tr class='LSobject-list'>
|
<tr class='LSobject-list'>
|
||||||
<th class='LSobject-list LSobject-select-check'></th>
|
<th class='LSobject-list LSobject-select-check'></th>
|
||||||
<th class='LSobject-list'>{$LSobject_list_objectname}</th>
|
<th class='LSobject-list sortBy_displayValue'>{if $LSobject_list_orderby == 'displayValue'}<strong>{$LSobject_list_objectname}</strong><img src='templates/images/{$LSobject_list_ordersense}.png' class='LSobject-list-ordersense' alt='{$LSobject_list_ordersense}'/>{else}{$LSobject_list_objectname}{/if}</th>
|
||||||
{if $label_level}<th class='LSobject-list'>{$label_level}</th>{/if}
|
{if $LSobject_list_subDn}<th class='LSobject-list LSobject-list-subdn sortBy_subDn'>{if $LSobject_list_orderby == 'subDn'}<strong>{$label_level}</strong><img src='templates/images/{$LSobject_list_ordersense}.png' class='LSobject-list-ordersense' alt='{$LSobject_list_ordersense}'/>{else}{$label_level}{/if}</th>{/if}
|
||||||
</tr>
|
</tr>
|
||||||
|
{assign var='bis' value=false}
|
||||||
{foreach from=$LSobject_list item=object}
|
{foreach from=$LSobject_list item=object}
|
||||||
<tr class='LSobject-list{if $object.tr=='bis'} LSobject-list-bis{/if}'>
|
<tr class='LSobject-list{if $bis} LSobject-list-bis{assign var='bis' value=false}{else}{assign var='bis' value=true}{/if}'>
|
||||||
<td class='LSobject-list LSobject-select-check'><input type='checkbox' name='LSobjects_selected[]' value='{$object.dn}' {if $object.select}checked{/if} class='LSobject-select' /></td>
|
<td class='LSobject-list LSobject-select-check'><input type='checkbox' name='LSobjects_selected[]' value='{$object.dn}' {if $object.select}checked{/if} class='LSobject-select' /></td>
|
||||||
<td class='LSobject-list LSobject-select-names'>{$object.displayValue}</td>
|
<td class='LSobject-list LSobject-select-names'>{$object.displayValue}</td>
|
||||||
{if $label_level}<td class='LSobject-list LSobject-select-level'>{$object.subDn}</td>{/if}
|
{if $LSobject_list_subDn}<td class='LSobject-list LSobject-select-level'>{$object.subDn}</td>{/if}
|
||||||
</tr>
|
</tr>
|
||||||
{foreachelse}
|
{foreachelse}
|
||||||
<tr class='LSobject-list'>
|
<tr class='LSobject-list'>
|
||||||
|
|
|
@ -24,14 +24,15 @@
|
||||||
|
|
||||||
<table class='LSobject-list'>
|
<table class='LSobject-list'>
|
||||||
<tr class='LSobject-list'>
|
<tr class='LSobject-list'>
|
||||||
<th class='LSobject-list'>{$LSobject_list_objectname}</th>
|
<th class='LSobject-list'><a href='view.php?LSobject={$LSobject_list_objecttype}&orderby=displayValue'>{if $LSobject_list_orderby == 'displayValue'}<strong>{$LSobject_list_objectname}</strong><img src='templates/images/{$LSobject_list_ordersense}.png' class='LSobject-list-ordersense' alt='{$LSobject_list_ordersense}'/>{else}{$LSobject_list_objectname}{/if}</a></th>
|
||||||
{if $label_level}<th class='LSobject-list'>{$label_level}</th>{/if}
|
{if $LSobject_list_subDn}<th class='LSobject-list LSobject-list-subdn'><a href='view.php?LSobject={$LSobject_list_objecttype}&orderby=subDn'>{if $LSobject_list_orderby == 'subDn'}<strong>{$label_level}</strong><img src='templates/images/{$LSobject_list_ordersense}.png' class='LSobject-list-ordersense' alt='{$LSobject_list_ordersense}'/>{else}{$label_level}{/if}</a></th>{/if}
|
||||||
<th class='LSobject-list'>{$_Actions}</th>
|
<th class='LSobject-list'>{$_Actions}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
{assign var='bis' value=false}
|
||||||
{foreach from=$LSobject_list item=object}
|
{foreach from=$LSobject_list item=object}
|
||||||
<tr class='LSobject-list{if $object.tr=='bis'} LSobject-list-bis{/if}'>
|
<tr class='LSobject-list{if $bis} LSobject-list-bis{assign var='bis' value=false}{else}{assign var='bis' value=true}{/if}'>
|
||||||
<td class='LSobject-list LSobject-list-names'><a href='view.php?LSobject={$LSobject_list_objecttype}&dn={$object.dn}' class='LSobject-list'>{$object.displayValue}</a> </td>
|
<td class='LSobject-list LSobject-list-names'><a href='view.php?LSobject={$LSobject_list_objecttype}&dn={$object.dn}' class='LSobject-list'>{$object.displayValue}</a> </td>
|
||||||
{if $label_level}<td class='LSobject-list LSobject-list-subdn'>{$object.subDn}</td>{/if}
|
{if $LSobject_list_subDn}<td class='LSobject-list'>{$object.subDn}</td>{/if}
|
||||||
<td class='LSobject-list LSobject-list-actions'>
|
<td class='LSobject-list LSobject-list-actions'>
|
||||||
{if $object.actions!=''}
|
{if $object.actions!=''}
|
||||||
{foreach from=$object.actions item=item}
|
{foreach from=$object.actions item=item}
|
||||||
|
|
|
@ -145,6 +145,8 @@ if($LSsession -> startLSsession()) {
|
||||||
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
|
$GLOBALS['Smarty']->assign('pagetitle',$object -> getLabel());
|
||||||
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
|
$GLOBALS['Smarty']->assign('LSobject_list_objectname',$object -> getLabel());
|
||||||
|
|
||||||
|
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
|
||||||
|
|
||||||
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) {
|
if (isset($_SESSION['LSsession']['LSsearch'][$LSobject])) {
|
||||||
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
|
$filter = $_SESSION['LSsession']['LSsearch'][$LSobject]['filter'];
|
||||||
$params = $_SESSION['LSsession']['LSsearch'][$LSobject]['params'];
|
$params = $_SESSION['LSsession']['LSsearch'][$LSobject]['params'];
|
||||||
|
@ -157,6 +159,9 @@ if($LSsession -> startLSsession()) {
|
||||||
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn;
|
$topDn = $object -> config['container_dn'].','.$GLOBALS['LSsession'] -> topDn;
|
||||||
}
|
}
|
||||||
$approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx'];
|
$approx = $_SESSION['LSsession']['LSsearch'][$LSobject]['approx'];
|
||||||
|
$orderby = $_SESSION['LSsession']['LSsearch'][$LSobject]['orderby'];
|
||||||
|
$ordersense = $_SESSION['LSsession']['LSsearch'][$LSobject]['ordersense'];
|
||||||
|
$doSubDn = $_SESSION['LSsession']['LSsearch'][$LSobject]['doSubDn'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$filter = NULL;
|
$filter = NULL;
|
||||||
|
@ -165,6 +170,9 @@ if($LSsession -> startLSsession()) {
|
||||||
$pattern = false;
|
$pattern = false;
|
||||||
$recur = false;
|
$recur = false;
|
||||||
$approx = false;
|
$approx = false;
|
||||||
|
$orderby = false;
|
||||||
|
$ordersense = 'ASC';
|
||||||
|
$doSubDn = (($subDnLdapServer)&&(!$GLOBALS['LSsession']->isSubDnLSobject($LSobject)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($_REQUEST['LSview_search_submit'])) {
|
if (isset($_REQUEST['LSview_search_submit'])) {
|
||||||
|
@ -204,6 +212,23 @@ if($LSsession -> startLSsession()) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sort=false;
|
||||||
|
if ((isset($_REQUEST['orderby']))) {
|
||||||
|
$possible_values= array('displayValue','subDn');
|
||||||
|
if (in_array($_REQUEST['orderby'],$possible_values)) {
|
||||||
|
$sort=true;
|
||||||
|
if ($orderby==$_REQUEST['orderby']) {
|
||||||
|
$ordersense = ($ordersense=='ASC')?'DESC':'ASC';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ordersense = 'ASC';
|
||||||
|
}
|
||||||
|
$orderby=$_REQUEST['orderby'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$GLOBALS['Smarty']->assign('LSobject_list_subDn',$doSubDn);
|
||||||
|
|
||||||
// Sauvegarde en Session
|
// Sauvegarde en Session
|
||||||
$_SESSION['LSsession']['LSsearch'][$LSobject] = array(
|
$_SESSION['LSsession']['LSsearch'][$LSobject] = array(
|
||||||
'filter' => $filter,
|
'filter' => $filter,
|
||||||
|
@ -211,7 +236,10 @@ if($LSsession -> startLSsession()) {
|
||||||
'params' => $params,
|
'params' => $params,
|
||||||
'pattern' => $pattern,
|
'pattern' => $pattern,
|
||||||
'recur' => $recur,
|
'recur' => $recur,
|
||||||
'approx' => $approx
|
'approx' => $approx,
|
||||||
|
'orderby' => $orderby,
|
||||||
|
'ordersense' => $ordersense,
|
||||||
|
'doSubDn' => $doSubDn
|
||||||
);
|
);
|
||||||
|
|
||||||
$GLOBALS['Smarty']->assign('LSview_search_pattern',$pattern);
|
$GLOBALS['Smarty']->assign('LSview_search_pattern',$pattern);
|
||||||
|
@ -269,11 +297,10 @@ if($LSsession -> startLSsession()) {
|
||||||
|
|
||||||
$c=0;
|
$c=0;
|
||||||
|
|
||||||
$subDnLdapServer = $GLOBALS['LSsession'] -> getSortSubDnLdapServer();
|
|
||||||
foreach($list as $thisObject) {
|
foreach($list as $thisObject) {
|
||||||
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$thisObject->getValue('dn'))) {
|
if ($GLOBALS['LSsession'] -> canAccess($LSobject,$thisObject->getValue('dn'))) {
|
||||||
$subDn_name=false;
|
$subDn_name=false;
|
||||||
if ($subDnLdapServer) {
|
if ($doSubDn) {
|
||||||
reset($subDnLdapServer);
|
reset($subDnLdapServer);
|
||||||
while (!$subDn_name && next($subDnLdapServer)) {
|
while (!$subDn_name && next($subDnLdapServer)) {
|
||||||
if (isCompatibleDNs(key($subDnLdapServer),$thisObject -> getValue('dn'))) {
|
if (isCompatibleDNs(key($subDnLdapServer),$thisObject -> getValue('dn'))) {
|
||||||
|
@ -314,18 +341,10 @@ if($LSsession -> startLSsession()) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($objectList)%2==0) {
|
|
||||||
$tr='bis';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$tr='';
|
|
||||||
}
|
|
||||||
|
|
||||||
$objectList[]=array(
|
$objectList[]=array(
|
||||||
'dn' => $thisObject->getValue('dn'),
|
'dn' => $thisObject->getValue('dn'),
|
||||||
'displayValue' => $thisObject->getDisplayValue(),
|
'displayValue' => $thisObject->getDisplayValue(),
|
||||||
'actions' => $actions,
|
'actions' => $actions,
|
||||||
'tr' => $tr,
|
|
||||||
'subDn' => $subDn_name
|
'subDn' => $subDn_name
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -342,6 +361,34 @@ if($LSsession -> startLSsession()) {
|
||||||
|
|
||||||
$GLOBALS['Smarty']->assign('LSobject_list_nbresult',$searchData['LSobject_list_nbresult']);
|
$GLOBALS['Smarty']->assign('LSobject_list_nbresult',$searchData['LSobject_list_nbresult']);
|
||||||
|
|
||||||
|
// Order by if $sort
|
||||||
|
if ($sort) {
|
||||||
|
function sortBy($a,$b) {
|
||||||
|
global $ordersense;
|
||||||
|
global $orderby;
|
||||||
|
|
||||||
|
if ($ordersense=='ASC') {
|
||||||
|
$sense = -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sense = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($a == $b) return 0;
|
||||||
|
$sort = array($a[$orderby],$b[$orderby]);
|
||||||
|
sort($sort);
|
||||||
|
if ($sort[0]==$a[$orderby])
|
||||||
|
return 1*$sense;
|
||||||
|
return -1*$sense;
|
||||||
|
}
|
||||||
|
if (!uasort($searchData['objectList'],'sortBy')) {
|
||||||
|
debug('Erreur durant le trie.');
|
||||||
|
}
|
||||||
|
$_SESSION['LSsession']['LSsearch'][$hash]=$searchData;
|
||||||
|
}
|
||||||
|
$GLOBALS['Smarty']->assign('LSobject_list_orderby',$orderby);
|
||||||
|
$GLOBALS['Smarty']->assign('LSobject_list_ordersense',$ordersense);
|
||||||
|
|
||||||
// Pagination
|
// Pagination
|
||||||
if ($searchData['LSobject_list_nbresult'] > NB_LSOBJECT_LIST) {
|
if ($searchData['LSobject_list_nbresult'] > NB_LSOBJECT_LIST) {
|
||||||
if (isset($_REQUEST['page'])) {
|
if (isset($_REQUEST['page'])) {
|
||||||
|
|
Loading…
Reference in a new issue