Jeremy Newman : cleanup and bootstrapify

Jeremy Newman jnewman at winehq.org
Mon Nov 28 12:02:01 CST 2016


Module: appdb
Branch: master
Commit: 48307f36d1bf58997027da4fe206e8ef2e63723f
URL:    http://source.winehq.org/git/appdb.git/?a=commit;h=48307f36d1bf58997027da4fe206e8ef2e63723f

Author: Jeremy Newman <jnewman at codeweavers.com>
Date:   Mon Nov 28 12:01:37 2016 -0600

cleanup and bootstrapify

---

 viewbugs.php | 116 +++++++++++++++++++++++++----------------------------------
 1 file changed, 49 insertions(+), 67 deletions(-)

diff --git a/viewbugs.php b/viewbugs.php
index 517dd35..f9646da 100644
--- a/viewbugs.php
+++ b/viewbugs.php
@@ -4,87 +4,69 @@
  *
  * Mandatory parameters:
  *  - iBugId, bug identifier
- * 
- * TODO:
- *  - replace the check is_numeric($aClean['iBugId']) with an is_empty check when filtering is in place
  */
 
 // application environment
 require("path.php");
 require(BASE."include/incl.php");
 
-/* code to View versions affected by a Bug */
+apidb_header("Applications Affected by Bug #{$aClean['iBugId']}");
 
-if(!is_numeric($aClean['iBugId']))
-    util_show_error_page_and_exit("Something went wrong with the bug ID");
+echo '<h1 class="whq-app-title">Applications Affected by Bug #'.$aClean['iBugId'].'</h1>',"\n";
 
-    apidb_header("Applications affected by Bug #".$aClean['iBugId']);
-    echo '<form method=post action="viewbugs.php?iBugId='.$aClean['iBugId'].'">',"\n";
+echo '<form method=post action="viewbugs.php?iBugId='.$aClean['iBugId'].'">',"\n";
+echo '<input type="text" name="iBugId" value="'.$aClean['iBugId'].'" class="form-control form-control-inline" size="10">',"\n";
+echo '<button type="submit" class="btn btn-default">Search</button>',"\n";
+echo '</form>',"\n";
 
-    echo '<table width=100% border=0 cellpadding=3 cellspacing=1>',"\n";
-    echo '<tr class=color4>',"\n";
-    echo '    <td width=80>Application Name</td>',"\n";
-    echo '    <td>Description</td>',"\n";
-    echo '    <td width=80>version</td>',"\n";
-    echo '    <td>Downloads</td>',"\n";
-    echo '</tr>',"\n";
-
-
-    $hResult = query_parameters("SELECT appFamily.description as appDescription,
-                           appFamily.appName as appName,
-                           appVersion.*, buglinks.versionId as versionId
-                           FROM appFamily, appVersion, buglinks
-                           WHERE appFamily.appId = appVersion.appId 
-                           and buglinks.versionId = appVersion.versionId
-                           AND buglinks.bug_id = '?'
-                           ORDER BY versionName", $aClean['iBugId']);
-    $c = 0;
+$hResult = query_parameters("SELECT appFamily.description as appDescription,
+                       appFamily.appName as appName,
+                       appVersion.*, buglinks.versionId as versionId
+                       FROM appFamily, appVersion, buglinks
+                       WHERE appFamily.appId = appVersion.appId 
+                       and buglinks.versionId = appVersion.versionId
+                       AND buglinks.bug_id = '?'
+                       ORDER BY versionName", $aClean['iBugId']);
 
-    if($hResult)
+if(query_num_rows($hResult))
+{
+    echo '<table class="whq-table whq-table-full">',"\n";
+    echo '<thead><tr>',"\n";
+    echo '    <td width="30%">Application Name</td>',"\n";
+    echo '    <td width="50%">Description</td>',"\n";
+    echo '    <td>version</td>',"\n";
+    echo '    <td>Downloads</td>',"\n";
+    echo '</tr></thead><tbody>',"\n";
+    while($oRow = query_fetch_object($hResult))
     {
-        while($oRow = query_fetch_object($hResult))
+        $oApp = new application($oRow->appId);
+        $oVersion = new version($oRow->versionId);
+        $sDownloadUrls = "";
+        if($hDownloadUrls = appData::getData($oRow->versionId, "downloadurl"))
         {
-            $oApp = new application($oRow->appId);
-            $oVersion = new version($oRow->versionId);
-            $sDownloadUrls = "";
-            if($hDownloadUrls = appData::getData($oRow->versionId, "downloadurl"))
-            {
-                while($oDownloadUrl = query_fetch_object($hDownloadUrls))
-                    $sDownloadUrls .= "<a href=\"$oDownloadUrl->url\">".
-                            "$oDownloadUrl->description</a><br>";
-            }
-
-            // set row color
-            $bgcolor = ($c % 2 == 0) ? "color0" : "color1";
-            echo '<tr class='.$bgcolor.'>',"\n";
-            echo '    <td>',"\n";
-            echo "    ".$oApp->objectMakeLink()."\n";
-            echo '    </td>',"\n";
-            echo '    <td>'.$oRow->appDescription.'</td>',"\n";
-            echo '    <td>',"\n";
-            echo "    ".$oVersion->objectMakeLink()."\n";
-            echo '    </td>',"\n";
-            echo "    <td>$sDownloadUrls</td>\n";
-            echo '</tr>',"\n";
+            while($oDownloadUrl = query_fetch_object($hDownloadUrls))
+                $sDownloadUrls .= "<a href=\"$oDownloadUrl->url\">".
+                        "$oDownloadUrl->description</a><br>";
         }
-    }
-
-    // allow users to search for other apps
-    echo '<tr class=color2>',"\n";
-    echo '    <td align=center colspan=5> </td>',"\n";
-    echo '</tr>',"\n";
 
-    echo '<tr class=color4>',"\n";
-    echo '    <td colspan=4 >  Bug #</td>',"\n";
-    echo '</tr>',"\n";
-
-    echo '<tr class=color3>',"\n";
-    echo '    <td align=center>',"\n";
-    echo '    <input type="text" name="iBugId" value="'.$aClean['iBugId'].'" size="8"></td>',"\n";
-    echo '    <td colspan=3><input type="submit" name="sSub" value="Search"></td>',"\n";
-    echo '</tr>',"\n";
+        echo '<tr>',"\n";
+        echo '    <td>',"\n";
+        echo "    ".$oApp->objectMakeLink()."\n";
+        echo '    </td>',"\n";
+        echo '    <td>'.$oRow->appDescription.'</td>',"\n";
+        echo '    <td>',"\n";
+        echo "    ".$oVersion->objectMakeLink()."\n";
+        echo '    </td>',"\n";
+        echo "    <td>$sDownloadUrls</td>\n";
+        echo '</tr>',"\n";
+    }
+    echo '</tbody></table>',"\n";
+}
+else
+{
+    echo html_note("No Applications Found for Bug #{$aClean['iBugId']}","","","warning");
+}
 
-    echo '</table>',"\n";
-    apidb_footer();
+apidb_footer();
 
 ?>




More information about the wine-cvs mailing list