[AppDB] Implement maintainer ratings.
tony_lambregts at telusplanet.net
tony_lambregts at telusplanet.net
Tue Jan 4 13:31:23 CST 2005
This patch allows maintainers of versions to rate thier apps (Gold, Silver,
Bronze or Garbage).
Change log: Implement Maintainer ratings.
Files Changed: tables/appdb_tables.sql include/util.php admin/editAppVersion.php
Jeremy needs to run the following befor this can be applied.
alter table appVersion add maintainer_rating text after rating_fake;
alter table appVersion add maintainer_release text after maintainer_rating;
Jeremy: could you let Chris and me know when this is done.
-------------- next part --------------
Index: tables/appdb_tables.sql
===================================================================
RCS file: /home/wine/appdb/tables/appdb_tables.sql,v
retrieving revision 1.12
diff -u -r1.12 appdb_tables.sql
--- tables/appdb_tables.sql 31 Dec 2004 00:30:00 -0000 1.12
+++ tables/appdb_tables.sql 4 Jan 2005 19:22:40 -0000
@@ -52,14 +52,16 @@
* a version of an application
*/
create table appVersion (
- versionId int not null auto_increment,
- appId int not null,
- versionName varchar(100) not null,
- keywords text,
- description text,
- webPage varchar(100),
- rating_windows float default 0.0,
- rating_fake float default 0.0,
+ versionId int not null auto_increment,
+ appId int not null,
+ versionName varchar(100) not null,
+ keywords text,
+ description text,
+ webPage varchar(100),
+ rating_windows float default 0.0,
+ rating_fake float default 0.0,
+ maintainer_rating text,
+ maintainer_release text,
key(versionId)
);
@@ -181,7 +183,7 @@
id int not null auto_increment,
appId int not null,
versionId int default 0,
- type enum('image', 'url'),
+ type enum('image', 'url', 'bug'),
description text,
url varchar(255),
key(id),
Index: include/util.php
===================================================================
RCS file: /home/wine/appdb/include/util.php,v
retrieving revision 1.11
diff -u -r1.11 util.php
--- include/util.php 29 Dec 2004 03:44:17 -0000 1.11
+++ include/util.php 4 Jan 2005 19:22:40 -0000
@@ -220,13 +220,31 @@
echo "<option value=0>Choose ...</option>\n";
while(list($value) = mysql_fetch_row($result))
{
- if($id == $cvalue)
+ if($value == $cvalue)
echo "<option value=$value selected>$value\n";
else
echo "<option value=$value>$value\n";
}
echo "</select>\n";
closebugzilladb();
+}
+
+function make_maintainer_rating_list($varname, $cvalue)
+{
+
+ echo "<select name='$varname'>\n";
+ echo "<option value=0>Choose ...</option>\n";
+ $aRating = array("Gold", "Silver", "Bronze", "Garbage");
+ $iMax = count($aRating);
+
+ for($i=0; $i < $iMax; $i++)
+ {
+ if($aRating[$i] == $cvalue)
+ echo "<option value=$aRating[$i] selected>$aRating[$i]\n";
+ else
+ echo "<option value=$aRating[$i]>$aRating[$i]\n";
+ }
+ echo "</select>\n";
}
/* get the number of applications in the appQueue table */
Index: admin/editAppVersion.php
===================================================================
RCS file: /home/wine/appdb/admin/editAppVersion.php,v
retrieving revision 1.7
diff -u -r1.7 editAppVersion.php
--- admin/editAppVersion.php 19 Dec 2004 19:30:28 -0000 1.7
+++ admin/editAppVersion.php 4 Jan 2005 19:22:40 -0000
@@ -29,10 +29,17 @@
$old_keywords = $ob->keywords;
$old_description = $ob->description;
$old_webPage = $ob->webPage;
+ $old_rating = $ob->maintainer_rating;
+ $old_release = $ob->maintainer_release;
- $versionName = addslashes($_REQUEST['versionName']);
- $description = addslashes($_REQUEST['description']);
- $webPage = addslashes($_REQUEST['webPage']);
+ $versionName = addslashes($_REQUEST['versionName']);
+ $keywords = $_REQUEST['keywords'];
+ $description = addslashes($_REQUEST['description']);
+ $webPage = addslashes($_REQUEST['webPage']);
+ $maintainer_rating = $_REQUEST['maintainer_rating'];
+ $maintainer_release = $_REQUEST['maintainer_release'];
+
+
$VersionChanged = false;
if ($old_versionName <> $versionName)
{
@@ -40,7 +47,7 @@
$WhatChanged .= " New Value: ".stripslashes($versionName)."\n";
$VersionChanged = true;
}
- if ($old_keywords <> $_REQUEST['keywords'])
+ if ($old_keywords <> $keywords)
{
$WhatChanged .= " Key Words: Old Value: ".stripslashes($old_keywords)."\n";
$WhatChanged .= " New Value: ".stripslashes($keywords)."\n";
@@ -64,13 +71,29 @@
$WhatChanged .= "-----------------------:\n";
$VersionChanged = true;
}
+ if ($old_rating <> $maintainer_rating)
+ {
+ $WhatChanged .= " Release: Old Value: ".stripslashes($old_rating)."\n";
+ $WhatChanged .= " New Value: ".stripslashes($maintainer_rating)."\n";
+ $VersionChanged = true;
+ }
+
+ if ($old_release <> $maintainer_release)
+ {
+ $WhatChanged .= " Release: Old Value: ".stripslashes($old_release)."\n";
+ $WhatChanged .= " New Value: ".stripslashes($maintainer_release)."\n";
+ $VersionChanged = true;
+ }
+
//did anything change?
if ($VersionChanged)
{
$query = "UPDATE appVersion SET versionName = '".$versionName."', ".
"keywords = '".$_REQUEST['keywords']."', ".
"description = '".$description."', ".
- "webPage = '".$webPage."'".
+ "webPage = '".$webPage."',".
+ "maintainer_rating = '".$maintainer_rating."',".
+ "maintainer_release = '".$maintainer_release."'".
" WHERE appId = ".$_REQUEST['appId']." and versionId = ".$_REQUEST['versionId'];
if (mysql_query($query))
{
@@ -116,12 +139,12 @@
} else
{
$query = "SELECT versionName, keywords, ".
- "description, webPage from appVersion WHERE ".
+ "description, webPage, maintainer_rating, maintainer_release from appVersion WHERE ".
"appId = '".$_REQUEST['appId']."' and versionId = '".$_REQUEST['versionId']."'";
if(debugging()) { echo "<p align=center><b>query:</b> $query </p>"; }
$result = mysql_query($query);
- list($versionName, $keywords, $description, $webPage) = mysql_fetch_row($result);
+ list($versionName, $keywords, $description, $webPage, $maintainer_rating, $maintainer_release) = mysql_fetch_row($result);
apidb_header("Edit Application Version");
@@ -138,6 +161,12 @@
echo '<tr><td class=color4>Description</td><td class=color0>', "\n";
echo '<textarea cols=$80 rows=$30 name="description">'.stripslashes($description).'</textarea></td></tr>',"\n";
echo '<tr><td class=color1>Web Page</td><td class=color0><input size=80% type="text" name="webPage" value="'.$webPage.'" /></td></tr>',"\n";
+ echo '<tr><td class=color4>Rating</td><td class=color0>',"\n";
+ make_maintainer_rating_list("maintainer_rating", $maintainer_rating);
+ echo '</td></tr>',"\n";
+ echo '<tr><td class=color1>Release</td><td class=color0>',"\n";
+ make_bugzilla_version_list("maintainer_release", $maintainer_release);
+ echo '</td></tr>',"\n";
echo '<tr><td colspan=2 align=center class=color3><input type="submit" name=submit1 value="Update Database" /></td></tr>',"\n";
More information about the wine-patches
mailing list