]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
html/qa: refactor, use functions
authorElan Ruusamäe <glen@pld-linux.org>
Sat, 19 Mar 2016 16:05:33 +0000 (18:05 +0200)
committerElan Ruusamäe <glen@pld-linux.org>
Sat, 19 Mar 2016 16:05:33 +0000 (18:05 +0200)
html/qa.php

index bd8d66163de9bc3bfe91c8736fcfbac4b247718a..cdc8dd514ad768c9b09a3ebd8e8a71fdc2450b59 100644 (file)
@@ -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>
This page took 0.129552 seconds and 4 git commands to generate.