distroquery.php: improve pagination

This commit is contained in:
Silvan Calarco 2024-11-03 19:00:49 +01:00
parent 9a2ee1f552
commit 47228e6a74
4 changed files with 168 additions and 127 deletions

View File

@ -96,6 +96,7 @@ $url_prefix = home_url() . "/rpms/";
if ($q != "") echo _r("Results for:") . " <strong>" . $q . "</strong> - ";
// Pagination
$pagination = "";
if ($j["query"]["pages"]) {
$query_append = "";
if ($q != "") $query_append .= "&q=" . urlencode($q);
@ -109,30 +110,42 @@ $url_prefix = home_url() . "/rpms/";
$from_page = $to_page - 20;
if ($from_page < 1) $from_page = 1;
}
echo "" . $j["query"]["total"] . " " . _r("result(s) found") . " - " .
$pagination .= "" . $j["query"]["total"] . " " . _r("result(s) found") . " - " .
_r("Showing page") . " " . $page . " " . _r("of") . " " . $pages . " [ ";
if ($from_page > 1) {
$back_page = $from_page - 10;
if ($back_page < 1) $back_page = 1;
echo "<a href=\"" . $url_prefix . "/" . $repo . "?page=" . $back_page . $query_append . "\">&lt;</a>&nbsp;";
$pagination .= "<a href=\"" . $url_prefix . "/" . $repo . "?page=" . $back_page . $query_append . "\">&lt;</a>&nbsp;";
}
$prev_page = "";
$next_page = "";
for ($i = $from_page; $i <= $to_page; $i++) {
if ($i != $j["query"]["page"]) {
echo "<a href=\"" . $url_prefix . "/" . $repo . "?page=" . $i . $query_append . "\">" . $i . "</a>&nbsp;";
$pagination .= "<a href=\"" . $url_prefix . "/" . $repo . "?page=" . $i . $query_append . "\">" . $i . "</a>&nbsp;";
if ($i == $j["query"]["page"]+1) $next_page = $i;
} else {
echo "<strong>" . $i . "</strong>&nbsp";
if ($i >= 2 && $prev_page == "") $prev_page = $i - 1;
$pagination .= "<strong>" . $i . "</strong>&nbsp";
}
}
if ($to_page < $pages) {
$next_page = $to_page + 10;
if ($next_page > $pages) $next_page = $pages;
if ($next_page < 1) $next_page = 1;
echo "<a href=\"" . $url_prefix . "/" . $repo . "?page=" . $next_page . $query_append . "\">&gt;</a>&nbsp;";
$curr_next_page = $to_page + 10;
if ($curr_next_page > $pages) $curr_next_page = $pages;
if ($curr_next_page < 1) $curr_next_page = 1;
$pagination .= "<a href=\"" . $url_prefix . "/" . $repo . "?page=" . $curr_next_page . $query_append . "\">&gt;</a>&nbsp;";
}
echo "]</br>";
$pagination .= "]<div style=\"float:right\">";
if ($prev_page != "") {
$pagination .= "<a href=\"" . $url_prefix . "/" . $repo . "?page=" . $prev_page . $query_append . "\">&lt; " . _r("Prev") . "</a>&nbsp;";
}
if ($next_page != "") {
$pagination .= "&nbsp;&nbsp;<a href=\"" . $url_prefix . "/" . $repo . "?page=" . $next_page . $query_append . "\">" . _r("Next") . " &gt;</a>&nbsp;";
}
$pagination .= "</div>";
} else {
echo "0 " . _r("result(s) found");
$pagination .= "0 " . _r("result(s) found");
}
echo $pagination;
echo "<table class=\"pkgpage\"><tr><th>" .
_r("Arch") . "</th><th>" .
@ -151,6 +164,8 @@ $url_prefix = home_url() . "/rpms/";
}
echo "</table>";
echo $pagination;
echo "</form>";
}

Binary file not shown.

View File

@ -1,13 +1,13 @@
# openmamba child theme translations.
# Copyright (C) 2014 Silvan Calarco
# Copyright (C) 2024 Silvan Calarco
# This file is distributed under the same license as the PACKAGE package.
# Silvan Calarco <silvan.calarco@mambasoft.it>, 2014.
# Silvan Calarco <silvan.calarco@mambasoft.it>, 2024.
#
msgid ""
msgstr ""
"Project-Id-Version: Responsive Theme\n"
"Report-Msgid-Bugs-To: bugs@openmamba.org\n"
"POT-Creation-Date: 2024-11-03 12:23+0100\n"
"POT-Creation-Date: 2024-11-03 18:56+0100\n"
"PO-Revision-Date: 2014-12-08 16:25+0100\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
"Language-Team: Italian, Italy\n"
@ -26,7 +26,8 @@ msgstr "Leggi di più &#8250;"
msgid "Pages:"
msgstr "Pagine:"
#: ../distroquery.php:50 ../distroquery.php:162 ../distroquery.php:264
#: ../distroquery.php:50 ../distroquery.php:177 ../distroquery.php:279
#: ../functions.php:81
msgid "Repositories"
msgstr "Repository"
@ -50,155 +51,163 @@ msgstr "Cerca qui"
msgid "Results for:"
msgstr "Risultati per:"
#: ../distroquery.php:112 ../distroquery.php:134
#: ../distroquery.php:113 ../distroquery.php:146
msgid "result(s) found"
msgstr "risultati trovati"
#: ../distroquery.php:113
#: ../distroquery.php:114
msgid "Showing page"
msgstr "Mostro la pagina"
#: ../distroquery.php:113
#: ../distroquery.php:114
msgid "of"
msgstr "di"
#: ../distroquery.php:138
#: ../distroquery.php:139
msgid "Prev"
msgstr "Prec"
#: ../distroquery.php:142
msgid "Next"
msgstr "Succ"
#: ../distroquery.php:151
msgid "Arch"
msgstr "Architettura"
#: ../distroquery.php:139 ../distroquery.php:194 ../distroquery.php:296
#: ../distroquery.php:152 ../distroquery.php:209 ../distroquery.php:311
msgid "Name"
msgstr "Nome"
#: ../distroquery.php:140
#: ../distroquery.php:153
msgid "Version"
msgstr "Versione"
#: ../distroquery.php:141
#: ../distroquery.php:154
msgid "Summary"
msgstr "Descrizione"
#: ../distroquery.php:142
#: ../distroquery.php:155
msgid "Last update"
msgstr "Ultimo aggiornamento"
#: ../distroquery.php:173 ../distroquery.php:275
#: ../distroquery.php:188 ../distroquery.php:290
msgid "ERROR"
msgstr "ERRORE"
#: ../distroquery.php:180 ../distroquery.php:282
#: ../distroquery.php:195 ../distroquery.php:297
msgid "Resources"
msgstr "Risorse"
#: ../distroquery.php:181 ../distroquery.php:283
#: ../distroquery.php:196 ../distroquery.php:298
msgid "Source files"
msgstr "File sorgenti"
#: ../distroquery.php:182 ../distroquery.php:284
#: ../distroquery.php:197 ../distroquery.php:299
msgid "Changes"
msgstr "Modifiche"
#: ../distroquery.php:183 ../distroquery.php:285
#: ../distroquery.php:198 ../distroquery.php:300
msgid "Issues"
msgstr "Problemi"
#: ../distroquery.php:184 ../distroquery.php:286
#: ../distroquery.php:199 ../distroquery.php:301
msgid "Add a new issue"
msgstr "Segnala un problema"
#: ../distroquery.php:185 ../distroquery.php:287
#: ../distroquery.php:200 ../distroquery.php:302
msgid "Download"
msgstr "Scarica"
#: ../distroquery.php:195 ../distroquery.php:247 ../distroquery.php:297
#: ../distroquery.php:210 ../distroquery.php:262 ../distroquery.php:312
msgid "Release"
msgstr "Versione"
#: ../distroquery.php:198 ../distroquery.php:301
#: ../distroquery.php:213 ../distroquery.php:316
msgid "Group"
msgstr "Gruppo"
#: ../distroquery.php:199
#: ../distroquery.php:214
msgid "Maintainer"
msgstr "Manutentore"
#: ../distroquery.php:200
#: ../distroquery.php:215
msgid "License"
msgstr "Licenza"
#: ../distroquery.php:201 ../distroquery.php:302
#: ../distroquery.php:216 ../distroquery.php:317
msgid "Size"
msgstr "Dimensione"
#: ../distroquery.php:202 ../distroquery.php:303
#: ../distroquery.php:217 ../distroquery.php:318
msgid "Upstream URL"
msgstr "URL di origine"
#: ../distroquery.php:203
#: ../distroquery.php:218
msgid "Build time"
msgstr "Data di compilazione"
#: ../distroquery.php:208
#: ../distroquery.php:223
msgid "Binary packages and requirements"
msgstr "Pacchetti binari e dipendenze"
#: ../distroquery.php:214
#: ../distroquery.php:229
msgid "Built RPMS"
msgstr "RPM creati"
#: ../distroquery.php:223
#: ../distroquery.php:238
msgid "Build requirements"
msgstr "Dipendenze di compilazione"
#: ../distroquery.php:237 ../distroquery.php:353 ../distroquery.php:371
#: ../distroquery.php:252 ../distroquery.php:368 ../distroquery.php:386
msgid "unresolved"
msgstr "non risolto"
#: ../distroquery.php:245
#: ../distroquery.php:260
msgid "History of changes"
msgstr "Cronologia delle modifiche"
#: ../distroquery.php:246 ../functions.php:129
#: ../distroquery.php:261 ../functions.php:144
msgid "Date"
msgstr "Data"
#: ../distroquery.php:247
#: ../distroquery.php:262
msgid "Packager"
msgstr "Packager"
#: ../distroquery.php:248
#: ../distroquery.php:263
msgid "Description"
msgstr "Descrizione"
#: ../distroquery.php:300
#: ../distroquery.php:315
msgid "Architecture"
msgstr "Architettura"
#: ../distroquery.php:304
#: ../distroquery.php:319 ../functions.php:75
msgid "Source RPM"
msgstr "RPM sorgente"
#: ../distroquery.php:313
#: ../distroquery.php:328
msgid "Brothers"
msgstr "Collegati"
#: ../distroquery.php:313
#: ../distroquery.php:328
msgid "Provides"
msgstr "Fornisce"
#: ../distroquery.php:314
#: ../distroquery.php:329
msgid "Obsoletes"
msgstr "Rende obsoleti"
#: ../distroquery.php:314
#: ../distroquery.php:329
msgid "Requires"
msgstr "Richiede"
#: ../distroquery.php:315
#: ../distroquery.php:330
msgid "Recommends"
msgstr "Raccomanda"
#: ../distroquery.php:379
#: ../distroquery.php:394
msgid "Provided files"
msgstr "File forniti"
@ -206,15 +215,19 @@ msgstr "File forniti"
msgid "&uarr;"
msgstr "&uarr;"
#: ../functions.php:126 ../functions.php:137
#: ../functions.php:79
msgid "Repository"
msgstr "Repository"
#: ../functions.php:141 ../functions.php:152
msgid "for"
msgstr "per"
#: ../functions.php:128
#: ../functions.php:143
msgid "File size:"
msgstr "Dimensione file:"
#: ../functions.php:139
#: ../functions.php:154
msgid ""
"Sorry, download is temporary unavailable. If the problem persists please "
"report the problem."
@ -222,43 +235,43 @@ msgstr ""
"Il download non è temporaneamente disponibile. Se il problema persiste ti "
"ringraziamo se ci puoi segnalare il problema."
#: ../functions.php:221
#: ../functions.php:236
msgid "More languages..."
msgstr "Altre lingue..."
#: ../functions.php:224
#: ../functions.php:239
msgid "Features"
msgstr "Caratteristiche"
#: ../functions.php:228
#: ../functions.php:243
msgid "Requirements"
msgstr "Requisiti"
#: ../functions.php:232
#: ../functions.php:247
msgid "Preparation"
msgstr "Preparazione"
#: ../functions.php:272 ../functions.php:317
#: ../functions.php:287 ../functions.php:332
msgid "Loading, please wait..."
msgstr "Caricamento in corso, attendi..."
#: ../functions.php:296 ../functions.php:320 ../functions.php:338
#: ../functions.php:311 ../functions.php:335 ../functions.php:353
msgid "Invalid request."
msgstr "Richiesta non valida."
#: ../functions.php:352
#: ../functions.php:367
msgid "Starting download of"
msgstr "Avvio dello scaricamento di"
#: ../functions.php:352
#: ../functions.php:367
msgid "please wait..."
msgstr "attendere prego..."
#: ../functions.php:385
#: ../functions.php:400
msgid "I Understand"
msgstr "Ho capito"
#: ../functions.php:386
#: ../functions.php:401
msgid "Cookie policy"
msgstr "Informativa sui cookie"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: openmamba 1.0\n"
"Report-Msgid-Bugs-To: bugs@openmamba.org\n"
"POT-Creation-Date: 2024-11-03 12:23+0100\n"
"POT-Creation-Date: 2024-11-03 18:56+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -27,7 +27,8 @@ msgstr ""
msgid "Pages:"
msgstr ""
#: ../distroquery.php:50 ../distroquery.php:162 ../distroquery.php:264
#: ../distroquery.php:50 ../distroquery.php:177 ../distroquery.php:279
#: ../functions.php:81
msgid "Repositories"
msgstr ""
@ -51,155 +52,163 @@ msgstr ""
msgid "Results for:"
msgstr ""
#: ../distroquery.php:112 ../distroquery.php:134
#: ../distroquery.php:113 ../distroquery.php:146
msgid "result(s) found"
msgstr ""
#: ../distroquery.php:113
#: ../distroquery.php:114
msgid "Showing page"
msgstr ""
#: ../distroquery.php:113
#: ../distroquery.php:114
msgid "of"
msgstr ""
#: ../distroquery.php:138
msgid "Arch"
msgstr ""
#: ../distroquery.php:139 ../distroquery.php:194 ../distroquery.php:296
msgid "Name"
msgstr ""
#: ../distroquery.php:140
msgid "Version"
msgstr ""
#: ../distroquery.php:141
msgid "Summary"
#: ../distroquery.php:139
msgid "Prev"
msgstr ""
#: ../distroquery.php:142
msgid "Next"
msgstr ""
#: ../distroquery.php:151
msgid "Arch"
msgstr ""
#: ../distroquery.php:152 ../distroquery.php:209 ../distroquery.php:311
msgid "Name"
msgstr ""
#: ../distroquery.php:153
msgid "Version"
msgstr ""
#: ../distroquery.php:154
msgid "Summary"
msgstr ""
#: ../distroquery.php:155
msgid "Last update"
msgstr ""
#: ../distroquery.php:173 ../distroquery.php:275
#: ../distroquery.php:188 ../distroquery.php:290
msgid "ERROR"
msgstr ""
#: ../distroquery.php:180 ../distroquery.php:282
#: ../distroquery.php:195 ../distroquery.php:297
msgid "Resources"
msgstr ""
#: ../distroquery.php:181 ../distroquery.php:283
#: ../distroquery.php:196 ../distroquery.php:298
msgid "Source files"
msgstr ""
#: ../distroquery.php:182 ../distroquery.php:284
#: ../distroquery.php:197 ../distroquery.php:299
msgid "Changes"
msgstr ""
#: ../distroquery.php:183 ../distroquery.php:285
#: ../distroquery.php:198 ../distroquery.php:300
msgid "Issues"
msgstr ""
#: ../distroquery.php:184 ../distroquery.php:286
#: ../distroquery.php:199 ../distroquery.php:301
msgid "Add a new issue"
msgstr ""
#: ../distroquery.php:185 ../distroquery.php:287
#: ../distroquery.php:200 ../distroquery.php:302
msgid "Download"
msgstr ""
#: ../distroquery.php:195 ../distroquery.php:247 ../distroquery.php:297
#: ../distroquery.php:210 ../distroquery.php:262 ../distroquery.php:312
msgid "Release"
msgstr ""
#: ../distroquery.php:198 ../distroquery.php:301
#: ../distroquery.php:213 ../distroquery.php:316
msgid "Group"
msgstr ""
#: ../distroquery.php:199
#: ../distroquery.php:214
msgid "Maintainer"
msgstr ""
#: ../distroquery.php:200
#: ../distroquery.php:215
msgid "License"
msgstr ""
#: ../distroquery.php:201 ../distroquery.php:302
#: ../distroquery.php:216 ../distroquery.php:317
msgid "Size"
msgstr ""
#: ../distroquery.php:202 ../distroquery.php:303
#: ../distroquery.php:217 ../distroquery.php:318
msgid "Upstream URL"
msgstr ""
#: ../distroquery.php:203
#: ../distroquery.php:218
msgid "Build time"
msgstr ""
#: ../distroquery.php:208
#: ../distroquery.php:223
msgid "Binary packages and requirements"
msgstr ""
#: ../distroquery.php:214
#: ../distroquery.php:229
msgid "Built RPMS"
msgstr ""
#: ../distroquery.php:223
#: ../distroquery.php:238
msgid "Build requirements"
msgstr ""
#: ../distroquery.php:237 ../distroquery.php:353 ../distroquery.php:371
#: ../distroquery.php:252 ../distroquery.php:368 ../distroquery.php:386
msgid "unresolved"
msgstr ""
#: ../distroquery.php:245
#: ../distroquery.php:260
msgid "History of changes"
msgstr ""
#: ../distroquery.php:246 ../functions.php:129
#: ../distroquery.php:261 ../functions.php:144
msgid "Date"
msgstr ""
#: ../distroquery.php:247
#: ../distroquery.php:262
msgid "Packager"
msgstr ""
#: ../distroquery.php:248
#: ../distroquery.php:263
msgid "Description"
msgstr ""
#: ../distroquery.php:300
#: ../distroquery.php:315
msgid "Architecture"
msgstr ""
#: ../distroquery.php:304
#: ../distroquery.php:319 ../functions.php:75
msgid "Source RPM"
msgstr ""
#: ../distroquery.php:313
#: ../distroquery.php:328
msgid "Brothers"
msgstr ""
#: ../distroquery.php:313
#: ../distroquery.php:328
msgid "Provides"
msgstr ""
#: ../distroquery.php:314
#: ../distroquery.php:329
msgid "Obsoletes"
msgstr ""
#: ../distroquery.php:314
#: ../distroquery.php:329
msgid "Requires"
msgstr ""
#: ../distroquery.php:315
#: ../distroquery.php:330
msgid "Recommends"
msgstr ""
#: ../distroquery.php:379
#: ../distroquery.php:394
msgid "Provided files"
msgstr ""
@ -207,57 +216,61 @@ msgstr ""
msgid "&uarr;"
msgstr ""
#: ../functions.php:126 ../functions.php:137
#: ../functions.php:79
msgid "Repository"
msgstr ""
#: ../functions.php:141 ../functions.php:152
msgid "for"
msgstr ""
#: ../functions.php:128
#: ../functions.php:143
msgid "File size:"
msgstr ""
#: ../functions.php:139
#: ../functions.php:154
msgid ""
"Sorry, download is temporary unavailable. If the problem persists please "
"report the problem."
msgstr ""
#: ../functions.php:221
#: ../functions.php:236
msgid "More languages..."
msgstr ""
#: ../functions.php:224
#: ../functions.php:239
msgid "Features"
msgstr ""
#: ../functions.php:228
#: ../functions.php:243
msgid "Requirements"
msgstr ""
#: ../functions.php:232
#: ../functions.php:247
msgid "Preparation"
msgstr ""
#: ../functions.php:272 ../functions.php:317
#: ../functions.php:287 ../functions.php:332
msgid "Loading, please wait..."
msgstr ""
#: ../functions.php:296 ../functions.php:320 ../functions.php:338
#: ../functions.php:311 ../functions.php:335 ../functions.php:353
msgid "Invalid request."
msgstr ""
#: ../functions.php:352
#: ../functions.php:367
msgid "Starting download of"
msgstr ""
#: ../functions.php:352
#: ../functions.php:367
msgid "please wait..."
msgstr ""
#: ../functions.php:385
#: ../functions.php:400
msgid "I Understand"
msgstr ""
#: ../functions.php:386
#: ../functions.php:401
msgid "Cookie policy"
msgstr ""