[projects/pld-ftp-admin] html/qa: refactor, use functions

glen glen at pld-linux.org
Sat Mar 19 17:05:47 CET 2016


commit 8e5b91b1d241c9af5af1a6c154a4425f54f1d288
Author: Elan Ruusamäe <glen at pld-linux.org>
Date:   Sat Mar 19 18:05:33 2016 +0200

    html/qa: refactor, use functions

 html/qa.php | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/html/qa.php b/html/qa.php
index bd8d661..cdc8dd5 100644
--- a/html/qa.php
+++ b/html/qa.php
@@ -39,14 +39,16 @@ $reports = array(
 	"lint-ready" => "rpmlint: ready",
 );
 
-echo "Select report:";
-echo "<select id=q name=q>\n";
-foreach ($reports as $q => $title) {
-	printf("<option value=%s %s>%s</option>\n", $q, $q == $report ? 'selected' :'',  $title);
+function reports_selection($reports) {
+	echo "Select report:";
+	echo "<select id=q name=q>\n";
+	foreach ($reports as $q => $title) {
+		printf("<option value=%s %s>%s</option>\n", $q, $q == $report ? 'selected' :'',  $title);
+	}
+	echo "</select>\n";
 }
-echo "</select>\n";
 
-if (isset($reports[$report])) {
+function format_report($report) {
 	echo "<a href=$report.txt>raw</a><br/>\n";
 	$file = "$report.txt";
 	$giturl = 'http://git.pld-linux.org/gitweb.cgi?p=packages/%1$s.git;f=%1$s.spec;h=HEAD;a=shortlog';
@@ -62,6 +64,11 @@ if (isset($reports[$report])) {
 	echo '</ol>';
 }
 
+reports_selection($reports);
+if (isset($reports[$report])) {
+	format_report($report);
+}
+
 ?>
 </body>
 </html>
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/8e5b91b1d241c9af5af1a6c154a4425f54f1d288



More information about the pld-cvs-commit mailing list