diff --git a/doc/conf/LSobject/LSsearch.docbook b/doc/conf/LSobject/LSsearch.docbook index 92ac00fd..563108ba 100644 --- a/doc/conf/LSobject/LSsearch.docbook +++ b/doc/conf/LSobject/LSsearch.docbook @@ -34,6 +34,7 @@ configuration des &LSobjects;, dans la variable LSsearch // Paramètre d'affichage 'displayFormat' => [LSformat], 'nbObjectsByPage' => [integer], + 'nbObjectsByPageChoices' => array([integer], [integer], ...), 'nbPageLinkByPage' => [integer], 'validPatternRegex' => '[regex]' ), @@ -234,6 +235,14 @@ contexte dans lequel cette recherche est effectuée. + + nbObjectsByPageChoices + + Tableau des choix proposés à l'utilisateur pour le nombre d'objets maximum affichés dans une page + de résultat de la recherche. + + + nbPageLinkByPage diff --git a/public_html/conf/LSobjects/config.LSobjects.LSpeople.php b/public_html/conf/LSobjects/config.LSobjects.LSpeople.php index 8cb1ddd0..7284d6d0 100644 --- a/public_html/conf/LSobjects/config.LSobjects.LSpeople.php +++ b/public_html/conf/LSobjects/config.LSobjects.LSpeople.php @@ -181,6 +181,8 @@ $GLOBALS['LSobjects']['LSpeople'] = array ( ), 'params' => array ( 'recursive' => true, + 'nbObjectsByPage' => 5, + 'nbObjectsByPageChoices' => array(5, 10, 15), ), 'predefinedFilters' => array ( '(jpegPhoto=*)' => 'With photo', diff --git a/public_html/css/default/base.css b/public_html/css/default/base.css index 983f3116..6172f3f5 100644 --- a/public_html/css/default/base.css +++ b/public_html/css/default/base.css @@ -236,27 +236,34 @@ td.LSobject-list-names { */ p.LSobject-list-page { text-align: center; - margin: 0.5em; + margin: auto; + margin-top: 0.5em; + max-width: 20em; } -a.LSobject-list-page { +a.LSobject-list-page, a.LSobject-list-nb-by-page { color: #0072b8; text-decoration: none; } -a.LSobject-list-page:hover { +a.LSobject-list-page:hover, a.LSobject-list-nb-by-page:hover { color: #0072b8; } -strong.LSobject-list-page { +strong.LSobject-list-page, strong.LSobject-list-nb-by-page { color: #0072b8; } +#LSobject_list_nbresult, p.LSobject-list-nb-by-page { + float: right; + clear: both; + color: #333; + font-style: italic; + margin: 0; + margin-right: 20px; +} + #LSobject_list_nbresult { - float: right; - color: #333; - font-style: italic; - margin-right: 20px; text-transform: lowercase; } diff --git a/public_html/includes/class/class.LSsearch.php b/public_html/includes/class/class.LSsearch.php index d429ba90..6c5c9c30 100644 --- a/public_html/includes/class/class.LSsearch.php +++ b/public_html/includes/class/class.LSsearch.php @@ -58,6 +58,7 @@ class LSsearch { 'displaySubDn' => NULL, 'displayFormat' => NULL, 'nbObjectsByPage' => NB_LSOBJECT_LIST, + 'nbObjectsByPageChoices' => array(25, 50, 75, 100), 'nbPageLinkByPage' => 10, 'customInfos' => array(), 'withoutCache' => false, @@ -333,6 +334,34 @@ class LSsearch { $OK=false; } } + + // nbObjectsByPageChoices + if (isset($params['nbObjectsByPageChoices'])) { + if (is_array($params['nbObjectsByPageChoices'])) { + $choices = array(); + $choiceError = false; + foreach($params['nbObjectsByPageChoices'] as $choice) { + if (is_int($choice) && !in_array($choice, $choices)) { + $choices[] = $choice; + } + else { + $choiceError = true; + break; + } + } + if (!empty($choices) && !$choiceError) { + $this -> params['nbObjectsByPageChoices'] = $choices; + } + else { + LSerror :: addErrorCode('LSsearch_03','nbObjectsByPageChoices'); + $OK = false; + } + } + else { + LSerror :: addErrorCode('LSsearch_03','nbObjectsByPageChoices'); + $OK = false; + } + } // Sort Limit if (isset($params['sortlimit'])) { diff --git a/public_html/templates/default/viewSearch.tpl b/public_html/templates/default/viewSearch.tpl index 4a680047..68da34d5 100644 --- a/public_html/templates/default/viewSearch.tpl +++ b/public_html/templates/default/viewSearch.tpl @@ -113,7 +113,21 @@ {/foreach} + {$LSsearch->label_total|escape:"htmlall"} +{if !empty($page.list)} +

+ {tr msg='Nb / page :'} + {foreach from=$LSsearch->getParam('nbObjectsByPageChoices') item=choice} + {if $LSsearch->getParam('nbObjectsByPage') == $choice} + {$choice} + {else} + {$choice} + {/if} + {/foreach} +

+{/if} + {if $page.nbPages > 1}