appdb/ include/sidebar.php ./browse_downloadab ...

WineHQ wineowner at wine.codeweavers.com
Mon Jan 8 22:29:51 CST 2007


ChangeSet ID:	30869
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/01/08 22:29:51

Modified files:
	include        : sidebar.php 
Added files:
	.              : browse_downloadable.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Add a page to browse downloadable applications

Patch: http://cvs.winehq.org/patch.py?id=30869

Old revision  New revision  Changes     Path
 Added         1.1           +0 -0       appdb/browse_downloadable.php
 1.25          1.26          +1 -0       appdb/include/sidebar.php

Index: appdb/browse_downloadable.php
diff -u -p /dev/null appdb/browse_downloadable.php:1.1
--- /dev/null	9 Jan 2007  4:29:51 -0000
+++ appdb/browse_downloadable.php	9 Jan 2007  4:29:51 -0000
@@ -0,0 +1,98 @@
+<?php
+
+/**
+*  Browse downloadable applications
+*/
+
+require("path.php");
+require(BASE."include/incl.php");
+
+apidb_header("Browse Downloadable Applications");
+
+/* Set default values */
+if(!$aClean['iNumVersions'] || $aClean['iNumVersions'] > 200 || $aClean['iNumVersions'] < 0)
+    $aClean['iNumVersions'] = 25;
+
+if(!$aClean['iPage'])
+    $aClean['iPage'] = 1;
+
+/* Count the possible matches */
+$hResult = query_parameters("SELECT DISTINCT appFamily.appName,
+    appVersion.versionName, appVersion.versionId, appFamily.description
+        FROM appFamily, appVersion, appData
+            WHERE appData.type = '?' AND appData.versionId = appVersion.versionId
+            AND appFamily.appId = appVersion.appId",
+                    "downloadurl");
+
+if($hResult && mysql_num_rows($hResult))
+    $num = mysql_num_rows($hResult);
+
+$iNumPages = ceil($num / $aClean['iNumVersions']);
+
+/* Check page logic */
+$aClean['iPage'] = min($aClean['iPage'], $iNumPages);
+
+/* Calculate values for the LIMIT clause */
+$iLimitLower = ($aClean['iPage'] - 1) * $aClean['iNumVersions'];
+
+/* Page selection */
+echo "<div align=\"center\">\n";
+echo "<b>Page ".$aClean['iPage']." of $iNumPages</b><br />\n";
+display_page_range($aClean['iPage'], $iPageRange, $iNumPages,
+    $_SERVER['PHP_SELF']."?iNumVersions=".$aClean['iNumVersions']);
+
+/* Selector for how many versions to display */
+echo "<form method=\"get\" action=\"".$_SERVER['PHP_SELF']."\">\n";
+echo "<b>How many versions to display:</b>\n";
+echo "<select name=\"iNumVersions\">\n";
+
+$numVersionsArray = array(1, 25, 50, 100, 200);
+
+foreach($numVersionsArray as $i)
+{
+    if($i == $aClean['iNumVersions'])
+        echo "<option selected=\"selected\">$i</option>\n";
+    else
+        echo "<option>$i</option>\n";
+}
+
+echo "</select>\n";
+
+echo " <input type=\"submit\" value=\"Refresh\" />\n";
+echo "</form></div>\n<br />\n";
+
+$hResult = query_parameters("SELECT DISTINCT appFamily.appName,
+    appVersion.versionName, appVersion.versionId, appFamily.description
+        FROM appFamily, appVersion, appData
+            WHERE appData.type = '?' AND appData.versionId = appVersion.versionId
+            AND appFamily.appId = appVersion.appId
+                ORDER BY appFamily.appName LIMIT ?, ?",
+                    "downloadurl", $iLimitLower, $aClean['iNumVersions']);
+
+if($hResult && mysql_num_rows($hResult))
+{
+    echo html_frame_start("", "90%");
+    echo html_table_begin("width=\"100%\" align=\"center\"");
+    echo html_tr(array(
+        "<b>Name</b>",
+        "<b>Description</b>"),
+        "color4");
+
+    for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
+    {
+        echo html_tr_highlight_clickable(
+            "appview.php?iVersionId=$oRow->versionId",
+            ($i % 2) ? "color1" : "color0",
+            ($i % 2) ? "color1" : "color0",
+            ($i % 2) ? "color1" : "color0");
+        echo "<td><a href=\"appview.php?iVersionId=$oRow->versionId\">".
+             "$oRow->appName $oRow->versionName</a></td>\n";
+        echo "<td>$oRow->description</td>\n";
+        echo "</tr>\n";
+    }
+
+    echo html_table_end();
+    echo html_frame_end("&nbsp;");
+}
+
+?>
Index: appdb/include/sidebar.php
diff -u -p appdb/include/sidebar.php:1.25 appdb/include/sidebar.php:1.26
--- appdb/include/sidebar.php:1.25	9 Jan 2007  4:29:51 -0000
+++ appdb/include/sidebar.php	9 Jan 2007  4:29:51 -0000
@@ -22,6 +22,7 @@ function global_sidebar_menu()
     $g->add("Screenshots", BASE."viewScreenshots.php");
     $g->add("Browse Apps", BASE."appbrowse.php");
     $g->add("Browse Newest Apps", BASE."browse_newest_apps.php");
+    $g->add("Downloadable Apps", BASE."browse_downloadable.php");
     $g->add("Browse Apps by Rating", BASE."browse_by_rating.php");
     $g->add("Top 25", BASE."votestats.php");
     $g->add("Submit Application", BASE."appsubmit.php?sSub=view&sAppType=application");



More information about the wine-cvs mailing list