appdb/ include/sidebar.php include/util.php ./ ...

WineHQ wineowner at wine.codeweavers.com
Sun Nov 26 21:14:58 CST 2006


ChangeSet ID:	30029
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2006/11/26 21:14:58

Modified files:
	include        : sidebar.php util.php 
Added files:
	.              : browse_newest_apps.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Add the page and sidebar entry for a 'Browse newest applications' page

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

Old revision  New revision  Changes     Path
 Added         1.1           +0 -0       appdb/browse_newest_apps.php
 1.23          1.24          +1 -0       appdb/include/sidebar.php
 1.76          1.77          +7 -3       appdb/include/util.php

Index: appdb/browse_newest_apps.php
diff -u -p /dev/null appdb/browse_newest_apps.php:1.1
--- /dev/null	27 Nov 2006  3:14:58 -0000
+++ appdb/browse_newest_apps.php	27 Nov 2006  3:14:58 -0000
@@ -0,0 +1,69 @@
+<?php
+/**
+ * Browse newest versions
+ *
+ */
+
+require("path.php");
+require(BASE."include/incl.php");
+require(BASE."include/filter.php");
+
+// set default value
+if(empty($aClean['iNumVersions']) || $aClean['iNumVersions'] > 200 || $aClean['iNumVersions'] < 0)
+    $aClean['iNumVersions'] = 25;
+
+apidb_header("Browse Newest Applications");
+
+/* selector for how many versions to view */
+echo "<form method=\"post\" name=\"sMessage\" action=\"".$_SERVER['PHP_SELF']."\">";
+echo "<b>How many versions to display:</b>";
+echo "<select name='iNumVersions'>";
+
+$numVersionsArray = array(25, 50, 100, 200);
+
+foreach($numVersionsArray as $i => $value)
+{
+    if($numVersionsArray[$i] == $aClean['iNumVersions'])
+        echo "<option selected=\"selected\">$numVersionsArray[$i]</option>";
+    else
+        echo "<option>$numVersionsArray[$i]</option>";
+}
+echo "</select>";
+
+echo ' <input type="submit" value="Refresh" />';
+echo '</form>';
+echo '<br />';
+
+/* Query the database for the n newest versions */
+$hResult = query_parameters("SELECT appId, appName, description, submitTime FROM appFamily WHERE
+                            queued = 'false' ORDER BY appId DESC LIMIT ?",
+                            $aClean['iNumVersions']);
+
+if($hResult)
+{
+    echo html_frame_start("", "90%", '', 0);
+    echo html_table_begin("width=\"100%\" align=\"center\"");
+    echo "<tr class=\"color4\">\n";
+    echo "<td><font color=\"white\">Submission Date</font></td>\n";
+    echo "<td><font color=\"white\">Application</font></td>\n";
+    echo "<td><font color=\"white\">Description</font></td></td>\n";
+    
+    $c = 1;
+    while($row = mysql_fetch_object($hResult))
+    {
+        $bgcolor = ($c % 2) ? "color0" : "color1";
+        $link = "<a href=\"appview.php?iAppId=$row->appId\"> $row->appName </a>";
+        echo "<tr class=\"$bgcolor\">";
+        echo "<td width=\"20%\">".print_short_date(mysqltimestamp_to_unixtimestamp($oApp->sSubmitTime))."</td>\n";
+        echo "<td>$link </td>\n";
+        echo "<td>$row->description </td></tr>\n";
+        $c++;
+    }
+
+    echo html_table_end();
+    echo html_frame_end();
+}
+
+apidb_footer();
+
+?>
Index: appdb/include/sidebar.php
diff -u -p appdb/include/sidebar.php:1.23 appdb/include/sidebar.php:1.24
--- appdb/include/sidebar.php:1.23	27 Nov 2006  3:14:58 -0000
+++ appdb/include/sidebar.php	27 Nov 2006  3:14:58 -0000
@@ -23,6 +23,7 @@ function global_sidebar_menu() {
     $g->add("AppDB Home", BASE);
     $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("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");
Index: appdb/include/util.php
diff -u -p appdb/include/util.php:1.76 appdb/include/util.php:1.77
--- appdb/include/util.php:1.76	27 Nov 2006  3:14:58 -0000
+++ appdb/include/util.php	27 Nov 2006  3:14:58 -0000
@@ -63,14 +63,18 @@ function values($arr)
 }
 
 
-/*
- * format date
- */
+// print the month, day, year, hour, minute, second
 function print_date($sTimestamp)
 {
     return date("F d Y  H:i:s", $sTimestamp);
 }
 
+// print the month, day and year
+function print_short_date($sTimestamp)
+{
+    return date("F d Y", $sTimestamp);
+}
+
 function mysqltimestamp_to_unixtimestamp($sTimestamp)
 {
   $d = substr($sTimestamp,6,2); // day



More information about the wine-cvs mailing list