Browse Source

Merge branch 'CM/pagination' into constantMurphy

Christophe HENRY 7 years ago
parent
commit
bac22d339d
2 changed files with 10 additions and 5 deletions
  1. 9 3
      index.php
  2. 1 2
      install.php

+ 9 - 3
index.php

@@ -142,12 +142,18 @@ switch($action){
 $tpl->assign('pages',$pages);
 $tpl->assign('page',$page);
 
-for($i=($page-PAGINATION_SCALE<=0?1:$page-PAGINATION_SCALE);$i<($page+PAGINATION_SCALE>$pages+1?$pages+1:$page+PAGINATION_SCALE);$i++){
+$paginationScale = $configurationManager->get('paginationScale');
+if (empty($paginationScale)) {
+    $configurationManager->put('paginationScale', 5);
+    $paginationScale = $configurationManager->get('paginationScale');
+}
+
+for($i=($page-$paginationScale<=0?1:$page-$paginationScale);$i<($page+$paginationScale>$pages+1?$pages+1:$page+$paginationScale);$i++){
     $pagesArray[]=$i;
 }
 $tpl->assign('pagesArray',$pagesArray);
-$tpl->assign('previousPages',($page-PAGINATION_SCALE<0?-1:$page-PAGINATION_SCALE-1));
-$tpl->assign('nextPages',($page+PAGINATION_SCALE>$pages+1?-1:$page+PAGINATION_SCALE));
+$tpl->assign('previousPages',($page-$paginationScale<0?-1:$page-$paginationScale-1));
+$tpl->assign('nextPages',($page+$paginationScale>$pages+1?-1:$page+$paginationScale));
 
 
 Plugin::callHook("index_post_treatment", array(&$events));

+ 1 - 2
install.php

@@ -126,8 +126,6 @@ if (isset($_['installButton']) && empty($test[$lib_errors])) { // Pas d'erreur,
     define('MYSQL_PREFIX','{$mysqlPrefix}');
     //Theme graphique
     define('DEFAULT_THEME','marigolds');
-    //Nombre de pages affichées dans la barre de pagination
-    define('PAGINATION_SCALE',5);
     //Nombre de flux mis à jour lors de la synchronisation graduée
     define('SYNC_GRAD_COUNT',10);
 ?>";
@@ -199,6 +197,7 @@ if (isset($_['installButton']) && empty($test[$lib_errors])) { // Pas d'erreur,
     $configurationManager->add('feedMaxEvents','50');
     $configurationManager->add('language', $_POST['install_changeLngLeed']);
     $configurationManager->add('optionFeedIsVerbose',1);
+    $configurationManager->add('paginationScale',5);
     $configurationManager->add('synchronisationCode',$synchronisationCode);
     $configurationManager->add('synchronisationEnableCache','0');
     $configurationManager->add('synchronisationForceFeed','0');