From: hickert Date: Tue, 26 Jul 2005 09:21:25 +0000 (+0000) Subject: Only show range selector if we've more than one page to present X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=23f6960fb06f436f115f05a1bd586c2c1f6e7520;p=gosa.git Only show range selector if we've more than one page to present git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1007 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/functions.inc b/include/functions.inc index db9cacaf2..20d1d490f 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -464,6 +464,48 @@ function get_lock ($object) } +function get_list2($subtreeACL, $filter, $subsearch= TRUE, $base="", $attrs= array(), $flag= FALSE) +{ + global $config; + + /* Base the search on default base if not set */ + $ldap= $config->get_ldap_link($flag); + if ($base == ""){ + $ldap->cd ($config->current['BASE']); + } else { + $ldap->cd ($base); + } + + /* Perform ONE or SUB scope searches? */ + $ldap->ls ($filter); + + /* Check for size limit exceeded messages for GUI feedback */ + if (preg_match("/size limit/i", $ldap->error)){ + $_SESSION['limit_exceeded']= TRUE; + } else { + $_SESSION['limit_exceeded']= FALSE; + } + $result= array(); + + + /* Crawl through reslut entries and perform the migration to the + result array */ + while($attrs = $ldap->fetch()) { + $dn= preg_replace("/[ ]*,[ ]*/", ",", $ldap->getDN()); + foreach ($subtreeACL as $key => $value){ + if (preg_match("/$key/", $dn)){ + $attrs["dn"]= convert_department_dn($dn); + $result[]= $attrs; + break; + } + } + } + + + return ($result); + +} + function get_list($subtreeACL, $filter, $subsearch= TRUE, $base="", $attrs= array(), $flag= FALSE) { global $config; @@ -700,6 +742,22 @@ function convert_department_dn($dn) return rtrim($dep, "/"); } +function convert_department_dn2($dn) +{ + $dep= ""; + + /* Build a sub-directory style list of the tree level + specified in $dn */ + $tmp = split (",", $dn); + + $dep= preg_replace("%^.*/([^/]+)$%", "\\1", $tmp[0]); + + + /* Return and remove accidently trailing slashes */ + $tmp = rtrim($dep, "/"); + return $tmp; +} + function get_ou($name) { @@ -1133,8 +1191,14 @@ function range_selector($dcnt,$start,$range=25) } $numpages= (($dcnt / $range)); - if(((int)($numpages))!=($numpages)) + + if ((int)$numpages <= 1 ){ + return (""); + } + + if(((int)($numpages))!=($numpages)){ $numpages = (int)$numpages + 1; + } $ppage= (int)(($start / $range) + 0.5);