AppDB: when submitting app allow people to choose the type
Tony Lambregts
tony_lambregts at telusplanet.net
Fri Nov 5 00:10:22 CST 2004
This change allows the people who ar submitting the app to choose
whether they ar submitting a new app or a new version. This should
make it easier on the administrators.
Change Log: Allow people to choose the type when submitting app.
Files Changed: appsubmit.php admin/adminAppQueue.php
-------------- next part --------------
===================================================================
RCS file: /home/wine/appdb/appsubmit.php,v
retrieving revision 1.6
diff -u -r1.6 appsubmit.php
--- appsubmit.php 12 Oct 2004 21:11:59 -0000 1.6
+++ appsubmit.php 5 Nov 2004 05:59:30 -0000
@@ -35,7 +35,9 @@
}
// Not empty and an invalid e-mail address
- if ( !empty( $fields['queueEmail']) AND !preg_match('/^[A-Za-z0-9\._-]+[@][A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)+[A-Za-z]$/',$fields['queueEmail']) )
+ if ( !empty( $fields['queueEmail'])
+ AND !preg_match('/^[A-Za-z0-9\._-]+[@][A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)+[A-Za-z]$/',
+ $fields['queueEmail']) )
{
$errors .= "<li>Please enter a valid e-mail address.</li>\n";
}
@@ -107,7 +109,7 @@
echo "soon about the status of your submission</p>\n";
}
}
-else
+else if ($_REQUEST['apptype'])
{
// set email field if logged in
if ($current && loggedin())
@@ -133,38 +135,107 @@
echo "<p>To submit screenshots, please email them to ";
echo "<a href='mailto:appdb at winehq.org'>appdb at winehq.org</a></p>\n";
+ if ($apptype == 1)
+ {
echo html_frame_start("New Application Form",400,"",0);
+ echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
+
+ echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
+ echo '<td><input type=text name="queueName" value="" size=20></td></tr>',"\n";
+
+
+ echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
+ echo '<td><input type=text name="queueVersion" value="" size=20></td></tr>',"\n";
+
+ // app Category
+ $w = new TableVE("view");
+ echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
+ $w->make_option_list("queueCatId","","appCategory","catId","catName");
+ echo '</td></tr>',"\n";
+
+
+ echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n";
+ echo '<td><input type=text name="queueVendor" value="" size=20></td></tr>',"\n";
+
+
+ //alt vendor
+ $x = new TableVE("view");
+ echo '<tr valign=top><td class=color0> </td><td>',"\n";
+ $x->make_option_list("altvendor","","vendor","vendorId","vendorName");
+ echo '</td></tr>',"\n";
+
+ echo '<tr valign=top><td class=color0><b>App URL</b></td>',"\n";
+ echo '<td><input type=text name="queueURL" value="" size=20></td></tr>',"\n";
+
+ echo '<tr valign=top><td class=color0><b>App Desc</b></td>',"\n";
+ echo '<td><textarea name="queueDesc" rows=10 cols=35></textarea></td></tr>',"\n";
+
+ echo '<tr valign=top><td class=color0><b>Email</b></td>',"\n";
+ echo '<td><input type=text name="queueEmail" value="'.$email.'" size=20></td></tr>',"\n";
+
+ echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
+ echo '<input type=submit value=" Submit New Application " class=button> </td></tr>',"\n";
+ echo '</table>',"\n";
+
+ echo html_frame_end();
+
+ echo "</form>";
+ }
+ else
+ {
+ echo html_frame_start("New Version Form",400,"",0);
echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
- echo '<tr valign=top><td class=color0><b>App Name</b></td><td><input type=text name="queueName" value="" size=20></td></tr>',"\n";
- echo '<tr valign=top><td class=color0><b>App Version</b></td><td><input type=text name="queueVersion" value="" size=20></td></tr>',"\n";
- // app Category
- $w = new TableVE("view");
- echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
- $w->make_option_list("queueCatId","","appCategory","catId","catName");
- echo '</td></tr>',"\n";
+ //app parent
+ $x = new TableVE("view");
+ echo '<tr valign=top><td class=color0><b>App Parent</b></td><td>',"\n";
+ $x->make_option_list("queueName","","appFamily","appId","appName");
+ echo '</td></tr>',"\n";
+ echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
+ echo '<td><input type=text name="queueVersion" value="" size=20></td></tr>',"\n";
- echo '<tr valign=top><td class=color0><b>App Vendor</b></td><td><input type=text name="queueVendor" value="" size=20></td></tr>',"\n";
+ echo '<tr valign=top><td class=color0><b>App URL</b></td>',"\n";
+ echo '<td><input type=text name="queueURL" value="" size=20></td></tr>',"\n";
+ echo '<tr valign=top><td class=color0><b>App Desc</b></td>',"\n";
+ echo '<td><textarea name="queueDesc" rows=10 cols=35></textarea></td></tr>',"\n";
- //alt vendor
- $x = new TableVE("view");
- echo '<tr valign=top><td class=color0> </td><td>',"\n";
- $x->make_option_list("altvendor","","vendor","vendorId","vendorName");
- echo '</td></tr>',"\n";
+ echo '<tr valign=top><td class=color0><b>Email</b></td>',"\n";
+ echo '<td><input type=text name="queueEmail" value="'.$email.'" size=20></td></tr>',"\n";
- echo '<tr valign=top><td class=color0><b>App URL</b></td><td><input type=text name="queueURL" value="" size=20></td></tr>',"\n";
- echo '<tr valign=top><td class=color0><b>App Desc</b></td><td><textarea name="queueDesc" rows=10 cols=35></textarea></td></tr>',"\n";
- echo '<tr valign=top><td class=color0><b>Email</b></td><td><input type=text name="queueEmail" value="'.$email.'" size=20></td></tr>',"\n";
- echo '<tr valign=top><td class=color3 align=center colspan=2> <input type=submit value=" Submit New Application " class=button> </td></tr>',"\n";
+ echo '<input type=hidden name="queueVendor" value="">',"\n";
+ echo '<input type=hidden name="queueCatId" value=-1>',"\n";
+
+
+ echo '<tr valign=top><td class=color3 align=center colspan=2>',"\n";
+ echo '<input type=submit value=" Submit New Version" class=button> </td></tr>',"\n";
echo '</table>',"\n";
echo html_frame_end();
- echo "</form>";
+ echo "</form>";
+ }
}
+else
+{
+ // choose type of app
+ apidb_header("Choose Application Type");
+
+ echo '<form name="ChooseApp" >',"\n";
+ echo "Please search through the database first. If you cannot find your application in the database select ","\n";
+ echo "<b>New Application</b>.","\n";
+ echo "If you have found your application but have not found your version then choose <b>New Version</b>.","\n";
+ echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
+ echo "<tr valign=top><td class=color0 align=center><a href='appsubmit.php?apptype=1'>New Application</a></td>","\n";
+ echo "<td class=color0 align=center><a href='appsubmit.php?apptype=2'>New Version</a></td></tr>","\n";
+ echo '</table>',"\n";
+
+
+ echo "</form>";
+}
+
apidb_footer();
Index: admin/adminAppQueue.php
===================================================================
RCS file: /home/wine/appdb/admin/adminAppQueue.php,v
retrieving revision 1.4
diff -u -r1.4 adminAppQueue.php
--- admin/adminAppQueue.php 12 Oct 2004 21:11:59 -0000 1.4
+++ admin/adminAppQueue.php 5 Nov 2004 05:59:31 -0000
@@ -43,125 +43,170 @@
if ($sub == 'view' && $queueId)
{
$x = new TableVE("view");
-
- //help
- echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
- echo "<p>This is the full view of the application waiting to be approved. \n";
- echo "You need to pick a category before submitting \n";
- echo "it into the database. If you approve this application,\n";
- echo "an email will be sent to the author of the submission.<p>\n";
- echo "<p>There are two kinds of applications in this database:</p>\n";
- echo "<ol>\n";
- echo " <li><b>App Family</b> This is a parent group application, that will have multiple versions under it.<br>\n";
- echo " To add this submission as a Family, choose 'Application' from the type drop down. Then set the category.\n";
- echo " The version and app parent fields will be ignored in this type.<br>\n";
- echo " If the vendor does not exist, leave the vendor drop down unset, and the field will be used.</li><p>\n";
- echo " <li><b>App Version</b> This type of application will be nested under the selected application parent.\n";
- echo " The category, name, and vendor fields will be ignored.</li>\n";
- echo "</td></tr></table></div>\n\n";
-
- //view application details
- echo html_frame_start("New Application Form",400,"",0);
- echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
+ If ($ob->queueCatId == -1)
+ {
+ //help
+ echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
+ echo "<p>This is the full view of the application waiting to be approved. \n";
+ echo "If you approve this application,\n";
+ echo "an email will be sent to the author of the submission.<p>\n";
+
+ echo " <b>App Version</b> This type of application will be nested under the selected application parent.\n";
+ echo "</td></tr></table></div>\n\n";
+
+ echo '<input type=hidden name=type value="ver">',"\n";
+
+ echo html_frame_start("New Application Form",400,"",0);
+ echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
+
+ //app parent
+ echo '<tr valign=top><td class=color0><b>App Parent</b></td><td>',"\n";
+ $x->make_option_list("appParent",stripslashes($ob->queueName),"appFamily","appId","appName");
+ echo '</td></tr>',"\n";
+
+ //version
+ echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
+ echo '<td><input type=text name="queueVersion" value="'.stripslashes($ob->queueVersion).'" size=20></td></tr>',"\n";
+
+ //url
+ echo '<tr valign=top><td class=color0><b>App URL</b></td>',"\n";
+ echo '<td><input type=text name="queueURL" value="'.stripslashes($ob->queueURL).'" size=20></td></tr>',"\n";
- //type
- echo '<tr valign=top><td class=color0><b>Type</b></td><td>',"\n";
- echo '<select name=type><option value=app>Application</option><option value=ver>Version</option></select>',"\n";
- echo '</td></tr>',"\n";
+ //desc
+ echo '<tr valign=top><td class=color0><b>App Desc</b></td>',"\n";
+ echo '<td><textarea name="queueDesc" rows=10 cols=35>'.stripslashes($ob->queueDesc).'</textarea></td></tr>',"\n";
- //category
+ //echo '<tr valign=top><td bgcolor=class=color0><b>Email</b></td>,"\n";
+ //echo '<td><input type=text name="queueEmail" value="'.$ob->queueEmail.'" size=20></td></tr>',"\n";
+ //echo '<tr valign=top><td bgcolor=class=color0><b>Image</b></td>,"\n";
+ //echo '<td><input type=file name="queueImage" value="'.$ob->.'" size=15></td></tr>',"\n";
- $query = "select * from appCategory where catId = '$ob->queueCatId';";
- $result = mysql_query($query);
- if($result)
- {
-
- $ob2 = mysql_fetch_object($result);
+ echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
+ echo '<input type=submit value=" Submit App Into Database " class=button> </td></tr>',"\n";
+ echo '</table>',"\n";
+
+ }
+ else
+ {
+
+ //help
+ echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
+ echo "<p>This is the full view of the application waiting to be approved. \n";
+ echo "You need to pick a category before submitting \n";
+ echo "it into the database. If you approve this application,\n";
+ echo "an email will be sent to the author of the submission.<p>\n";
+ echo "<p>There are two kinds of applications in this database:</p>\n";
+ echo "<ol>\n";
+ echo " <li><b>App Family</b> This is a parent group application, that will have multiple versions under it.<br>\n";
+ echo " To add this submission as a Family, choose 'Application' from the type drop down. Then set the category.\n";
+ echo " The version and app parent fields will be ignored in this type.<br>\n";
+ echo " If the vendor does not exist, leave the vendor drop down unset, and the field will be used.</li><p>\n";
+ echo " <li><b>App Version</b> This type of application will be nested under the selected application parent.\n";
+ echo " The category, name, and vendor fields will be ignored.</li>\n";
+ echo "</td></tr></table></div>\n\n";
+
+ //view application details
+ echo html_frame_start("New Application Form",400,"",0);
+ echo "<table width='100%' border=0 cellpadding=2 cellspacing=0>\n";
+
+ //type
+ echo '<tr valign=top><td class=color0><b>Type</b></td><td>',"\n";
+ echo '<select name=type><option value=app>Application</option><option value=ver>Version</option></select>',"\n";
+ echo '</td></tr>',"\n";
+
+ //category
+
+ $query = "select * from appCategory where catId = '$ob->queueCatId';";
+ $result = mysql_query($query);
+ if($result)
+ {
+ $ob2 = mysql_fetch_object($result);
- echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
- $x->make_option_list("cat",stripslashes($ob2->catId),"appCategory","catId","catName");
- echo '</td></tr>',"\n";
- } else
- {
- echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
- $x->make_option_list("cat","","appCategory","catId","catName");
+ echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
+ $x->make_option_list("cat",stripslashes($ob2->catId),"appCategory","catId","catName");
+ echo '</td></tr>',"\n";
+ } else
+ {
+ echo '<tr valign=top><td class=color0><b>Category</b></td><td>',"\n";
+ $x->make_option_list("cat","","appCategory","catId","catName");
+ echo '</td></tr>',"\n";
+ }
+ //app parent
+ echo '<tr valign=top><td class=color0><b>App Parent</b></td><td>',"\n";
+ $x->make_option_list("appParent","","appFamily","appId","appName");
echo '</td></tr>',"\n";
- }
- //app parent
- echo '<tr valign=top><td class=color0><b>App Parent</b></td><td>',"\n";
- $x->make_option_list("appParent","","appFamily","appId","appName");
- echo '</td></tr>',"\n";
- //name
- echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
- echo '<td><input type=text name="queueName" value="'.stripslashes($ob->queueName).'" size=20></td></tr>',"\n";
-
- //version
- echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
- echo '<td><input type=text name="queueVersion" value="'.stripslashes($ob->queueVersion).'" size=20></td></tr>',"\n";
+ //name
+ echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
+ echo '<td><input type=text name="queueName" value="'.stripslashes($ob->queueName).'" size=20></td></tr>',"\n";
+
+ //version
+ echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
+ echo '<td><input type=text name="queueVersion" value="'.stripslashes($ob->queueVersion).'" size=20></td></tr>',"\n";
- //vendor/alt vendor fields
- // try for an exact match
- // Use the first match if we found one and clear out the vendor field,
- // otherwise don't pick a vendor
- $query = "select * from vendor where vendorname = '$ob->queueVendor';";
- $result = mysql_query($query);
- $checkvendor = 0;
- if($result)
- {
- $ob2 = mysql_fetch_object($result);
- $checkvendor = $ob2->vendorId;
- }
- if(!$checkvendor)
- {
- // try for a partial match
- $query = "select * from vendor where vendorname like '%$ob->queueVendor%';";
+ //vendor/alt vendor fields
+ // try for an exact match
+ // Use the first match if we found one and clear out the vendor field,
+ // otherwise don't pick a vendor
+ $query = "select * from vendor where vendorname = '$ob->queueVendor';";
$result = mysql_query($query);
+ $checkvendor = 0;
if($result)
{
$ob2 = mysql_fetch_object($result);
$checkvendor = $ob2->vendorId;
}
- }
- if(checkvendor)
- {
- $ob->queueVendor = '';
+ if(!$checkvendor)
+ {
+ // try for a partial match
+ $query = "select * from vendor where vendorname like '%$ob->queueVendor%';";
+ $result = mysql_query($query);
+ if($result)
+ {
+ $ob2 = mysql_fetch_object($result);
+ $checkvendor = $ob2->vendorId;
+ }
+ }
+ if(checkvendor)
+ {
+ $ob->queueVendor = '';
- //vendor field
- echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n";
- echo '<td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td></tr>',"\n";
+ //vendor field
+ echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n";
+ echo '<td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td></tr>',"\n";
- echo '<tr valign=top><td class=color0> </td><td>',"\n";
- $x->make_option_list("altvendor", $checkvendor ,"vendor","vendorId","vendorName");
- echo '</td></tr>',"\n";
- } else
- {
- //vendor field
- echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n";
- echo '<td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td></tr>',"\n";
+ echo '<tr valign=top><td class=color0> </td><td>',"\n";
+ $x->make_option_list("altvendor", $checkvendor ,"vendor","vendorId","vendorName");
+ echo '</td></tr>',"\n";
+ } else
+ {
+ //vendor field
+ echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n";
+ echo '<td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td></tr>',"\n";
- echo '<tr valign=top><td class=color0> </td><td>',"\n";
- $x->make_option_list("altvendor","","vendor","vendorId","vendorName");
- echo '</td></tr>',"\n";
- }
+ echo '<tr valign=top><td class=color0> </td><td>',"\n";
+ $x->make_option_list("altvendor","","vendor","vendorId","vendorName");
+ echo '</td></tr>',"\n";
+ }
- //url
- echo '<tr valign=top><td class=color0><b>App URL</b></td>',"\n";
- echo '<td><input type=text name="queueURL" value="'.stripslashes($ob->queueURL).'" size=20></td></tr>',"\n";
+ //url
+ echo '<tr valign=top><td class=color0><b>App URL</b></td>',"\n";
+ echo '<td><input type=text name="queueURL" value="'.stripslashes($ob->queueURL).'" size=20></td></tr>',"\n";
- //desc
- echo '<tr valign=top><td class=color0><b>App Desc</b></td>',"\n";
- echo '<td><textarea name="queueDesc" rows=10 cols=35>'.stripslashes($ob->queueDesc).'</textarea></td></tr>',"\n";
+ //desc
+ echo '<tr valign=top><td class=color0><b>App Desc</b></td>',"\n";
+ echo '<td><textarea name="queueDesc" rows=10 cols=35>'.stripslashes($ob->queueDesc).'</textarea></td></tr>',"\n";
- //echo '<tr valign=top><td bgcolor=class=color0><b>Email</b></td>,"\n";
- //echo '<td><input type=text name="queueEmail" value="'.$ob->queueEmail.'" size=20></td></tr>',"\n";
- //echo '<tr valign=top><td bgcolor=class=color0><b>Image</b></td>,"\n";
- //echo '<td><input type=file name="queueImage" value="'.$ob->.'" size=15></td></tr>',"\n";
-
- echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
- echo '<input type=submit value=" Submit App Into Database " class=button> </td></tr>',"\n";
- echo '</table>',"\n";
+ //echo '<tr valign=top><td bgcolor=class=color0><b>Email</b></td>,"\n";
+ //echo '<td><input type=text name="queueEmail" value="'.$ob->queueEmail.'" size=20></td></tr>',"\n";
+ //echo '<tr valign=top><td bgcolor=class=color0><b>Image</b></td>,"\n";
+ //echo '<td><input type=file name="queueImage" value="'.$ob->.'" size=15></td></tr>',"\n";
+
+ echo '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
+ echo '<input type=submit value=" Submit App Into Database " class=button> </td></tr>',"\n";
+ echo '</table>',"\n";
+ }
echo '<input type=hidden name="sub" value="add">',"\n";
echo '<input type=hidden name="queueId" value="'.$queueId.'">',"\n";
@@ -309,7 +354,7 @@
{
//get available apps
$query = "SELECT queueId, queueName, queueVendor,".
- "queueVersion, queueEmail,".
+ "queueVersion, queueEmail, queueCatId,".
"UNIX_TIMESTAMP(submitTime) as submitTime ".
"from appQueue;";
$result = mysql_query($query);
@@ -351,7 +396,22 @@
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n";
echo " <td>".date("Y-n-t h:i:sa", $ob->submitTime)." </td>\n";
- echo " <td><a href='adminAppQueue.php?sub=view&queueId=$ob->queueId'>$ob->queueName</a></td>\n";
+ if ($ob->queueCatId == -1)
+ {
+ $query2 = "select * from appFamily where appId = '$ob->queueName';";
+ $result2 = mysql_query($query2);
+ if($result2)
+ {
+ $ob2 = mysql_fetch_object($result2);
+ echo " <td><a href='adminAppQueue.php?sub=view&queueId=$ob->queueId'>$ob2->appName</a></td>\n";
+ } else
+ {
+ echo " <td><a href='adminAppQueue.php?sub=view&queueId=$ob->queueId'>App not found</a></td>\n";
+ }
+ } else
+ {
+ echo " <td><a href='adminAppQueue.php?sub=view&queueId=$ob->queueId'>$ob->queueName</a></td>\n";
+ }
echo " <td>".stripslashes($ob->queueVersion)." </td>\n";
echo " <td>".stripslashes($ob->queueVendor)." </td>\n";
echo " <td>".stripslashes($ob->queueEmail)." </td>\n";
More information about the wine-patches
mailing list