- Send email to Maintainers/Administrators when app added to database.

- Send email to submitter when app is rejected (delete).
- Moved delete to where we view the app
- Added email text to allow administrators to add comment to submitter email
- Show the Application Queue after adding/deleting Application.
This commit is contained in:
Tony Lambregts
2004-11-17 23:04:43 +00:00
committed by Jeremy Newman
parent fad6d49ae1
commit a57c6ecd48

View File

@@ -5,6 +5,7 @@
include("path.php"); include("path.php");
require(BASE."include/"."incl.php"); require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php"); require(BASE."include/"."tableve.php");
require(BASE."include/"."application.php");
//deny access if not logged in //deny access if not logged in
if(!loggedin()) if(!loggedin())
@@ -18,8 +19,6 @@ else if (!havepriv("admin"))
exit; exit;
} }
apidb_header("Admin App Queue");
echo '<form name="qform" action="adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
if ($sub) if ($sub)
{ {
@@ -34,16 +33,22 @@ if ($sub)
else else
{ {
//error no Id! //error no Id!
echo html_frame_start("Error","300"); addmsg("Application Not Found!", "red");
echo '<p><b>Application Not Found!</b></p>',"\n"; redirect(apidb_fullurl("admin/adminAppQueue.php"));
echo html_frame_end("&nbsp;"); exit;
} }
//process according to sub flag //process according to sub flag
if ($sub == 'view' && $queueId) if ($sub == 'view' && $queueId)
{ {
$x = new TableVE("view"); $x = new TableVE("view");
If ($ob->queueCatId == -1) apidb_header("Admin App Queue");
echo '<form name="qform" action="adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
echo '<input type=hidden name="sub" value="add">',"\n";
echo '<input type=hidden name="queueId" value="'.$queueId.'">',"\n";
If ($ob->queueCatId == -1) //app version
{ {
//help //help
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n"; echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
@@ -52,6 +57,8 @@ if ($sub)
echo "an email will be sent to the author of the submission.<p>\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 " <b>App Version</b> This type of application will be nested under the selected application parent.\n";
echo "<p>Click delete to remove the selected item from the queue. An email will automatically be sent to the\n";
echo "submitter to let them know the item was deleted.</p>\n\n";
echo "</td></tr></table></div>\n\n"; echo "</td></tr></table></div>\n\n";
echo '<input type=hidden name=type value="ver">',"\n"; echo '<input type=hidden name=type value="ver">',"\n";
@@ -68,23 +75,6 @@ if ($sub)
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n"; 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"; 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";
//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";
} }
else else
{ {
@@ -103,6 +93,8 @@ if ($sub)
echo " If the vendor does not exist, leave the vendor drop down unset, and the field will be used.</li><p>\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 " <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 " The category, name, and vendor fields will be ignored.</li>\n";
echo "<p>Click delete to remove the selected item from the queue. An email will automatically be sent to the\n";
echo "submitter to let them know the item was deleted.</p>\n\n";
echo "</td></tr></table></div>\n\n"; echo "</td></tr></table></div>\n\n";
//view application details //view application details
@@ -142,7 +134,8 @@ if ($sub)
//version //version
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n"; 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"; echo '<td><input type=text name="queueVersion" value="'.stripslashes($ob->queueVersion).'" size=20></td>',"\n";
echo '</tr>',"\n";
//vendor/alt vendor fields //vendor/alt vendor fields
// try for an exact match // try for an exact match
@@ -173,7 +166,8 @@ if ($sub)
//vendor field //vendor field
echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n"; 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 '<td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td>',"\n";
echo '</tr>',"\n";
echo '<tr valign=top><td class=color0>&nbsp;</td><td>',"\n"; echo '<tr valign=top><td class=color0>&nbsp;</td><td>',"\n";
$x->make_option_list("altvendor", $checkvendor ,"vendor","vendorId","vendorName"); $x->make_option_list("altvendor", $checkvendor ,"vendor","vendorId","vendorName");
@@ -182,14 +176,14 @@ if ($sub)
{ {
//vendor field //vendor field
echo '<tr valign=top><td class=color0><b>App Vendor</b></td>',"\n"; 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 '<td><input type=text name="queueVendor" value="'.stripslashes($ob->queueVendor).'" size=20></td>',"\n";
echo '</tr>',"\n";
echo '<tr valign=top><td class=color0>&nbsp;</td><td>',"\n"; echo '<tr valign=top><td class=color0>&nbsp;</td><td>',"\n";
$x->make_option_list("altvendor","","vendor","vendorId","vendorName"); $x->make_option_list("altvendor","","vendor","vendorId","vendorName");
echo '</td></tr>',"\n"; echo '</td></tr>',"\n";
} }
}
//url //url
echo '<tr valign=top><td class=color0><b>App URL</b></td>',"\n"; 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"; echo '<td><input type=text name="queueURL" value="'.stripslashes($ob->queueURL).'" size=20></td></tr>',"\n";
@@ -198,17 +192,16 @@ if ($sub)
echo '<tr valign=top><td class=color0><b>App Desc</b></td>',"\n"; 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 '<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"; //email message text
//echo '<td><input type=text name="queueEmail" value="'.$ob->queueEmail.'" size=20></td></tr>',"\n"; if ($ob->queueEmail)
//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=color0><b>email Text</b></td>',"\n";
echo '<td><textarea name="emailtext" rows=10 cols=35></textarea></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 '<tr valign=top><td class=color3 align=center colspan=2>' ,"\n";
echo '<input type=hidden name="queueId" value="'.$queueId.'">',"\n"; echo '<input type=submit value=" Submit App Into Database " class=button>&nbsp',"\n";
echo '<input name="sub" type=submit value="Delete" class=button> </td></tr>',"\n";
echo '</table>',"\n";
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminAppQueue.php'); echo html_back_link(1,'adminAppQueue.php');
@@ -237,7 +230,6 @@ if ($sub)
{ {
//get the id of the app just added //get the id of the app just added
$appParent = mysql_insert_id(); $appParent = mysql_insert_id();
//delete queue item //delete queue item
mysql_query("DELETE from appQueue where queueId = $queueId;"); mysql_query("DELETE from appQueue where queueId = $queueId;");
@@ -256,7 +248,8 @@ if ($sub)
if (mysql_query($verQuery)) if (mysql_query($verQuery))
{ {
//successful //successful
$statusMessage = "<p>The application $queueName was successfully added into the database</p>\n"; $appVersion = mysql_insert_id();
addmsg("The application $queueName was successfully added into the database", "green");
$goodtogo = 1; $goodtogo = 1;
} }
else else
@@ -264,6 +257,7 @@ if ($sub)
//error //error
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n"; $statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
$statusMessage .= "<p><b>Note:</b> The application family was successfully added.</p>\n"; $statusMessage .= "<p><b>Note:</b> The application family was successfully added.</p>\n";
addmsg($statusMessage, "red");
} }
} }
@@ -271,6 +265,7 @@ if ($sub)
{ {
//error //error
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n"; $statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
addmsg($statusMessage, "red");
} }
} }
else if ($type == 'ver') else if ($type == 'ver')
@@ -286,7 +281,9 @@ if ($sub)
if (mysql_query($query)) if (mysql_query($query))
{ {
//successful //successful
$appVersion = mysql_insert_id();
$statusMessage = "<p>The application $queueName was successfully added into the database</p>\n"; $statusMessage = "<p>The application $queueName was successfully added into the database</p>\n";
addmsg($statusMessage,Green);
mysql_query("DELETE from appQueue where queueId = $queueId;"); mysql_query("DELETE from appQueue where queueId = $queueId;");
$goodtogo = 1; $goodtogo = 1;
@@ -295,11 +292,15 @@ if ($sub)
{ {
//error //error
$statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n"; $statusMessage = "<p><b>Database Error!<br>".mysql_error()."</b></p>\n";
addmsg($statusMessage,red);
} }
} }
else else
{ {
$statusMessage = "<p><b>Error<br>You did not pick an application Parent!</b></p>\n"; addmsg("You did not pick an application Parent!",red);
redirect(apidb_fullurl("admin/adminAppQueue.php?cat=view&queueId=$queueId"));
exit;
} }
} }
@@ -307,51 +308,96 @@ if ($sub)
//Send Status Email //Send Status Email
if ($ob->queueEmail && $goodtogo) if ($ob->queueEmail && $goodtogo)
{ {
$fullAppName = lookupAppName($appParent)." Version: ".lookupVersionName($appParent, $appVersion);
$ms = "Application Database Status Report\n"; $ms = "Application Database Status Report\n";
$ms .= "----------------------------------\n\n"; $ms .= "----------------------------------\n\n";
$ms .= "Your application ".stripslashes($ob->queueName)." has been entered "; $ms .= "Your application: ".$fullAppName." has been entered ";
$ms .= "into the application database.\n\n"; $ms .= "into the application database.\n\n";
$ms .= "Thanks!\n"; $ms .= APPDB_ROOT."appView.php?appId=$appParent&versionId=$appVersion"."\n\n";
$ms .= "Thanks!\n\n";
$ms .= $emailtext;
mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms); mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms);
} }
if ($goodtogo)
{
$email = getNotifyEmailAddressList($appParent, $appVersion);
if($email)
{
$fullAppName = "Application: ".lookupAppName($appParent).
" Version: ".lookupVersionName($appParent, $appVersion);
$ms = APPDB_ROOT."appview.php?appId=$appParent&versionId=$appVersion"."\n\n";
$ms .= "New Application added to database:\n\n";
$ms .= $fullAppName."\n\n";
$ms .= STANDARD_NOTIFY_FOOTER;
//done mail(stripslashes($email), "[AppDB] NEW ".$fullAppName ,$ms);
echo html_frame_start("Submit Application","300");
echo "<p><b>$statusMessage</b></p>\n"; } else
echo html_frame_end("&nbsp;"); {
echo html_back_link(1,'adminAppQueue.php'); $email = "no one";
} }
else if ($sub == 'delete' && $queueId) addmsg("mesage sent to: ".$email, green);
}
//done
addmsg("<a href=".apidb_fullurl("appview.php")."?appId=".$appParent."&versionId=".$appVersion.">Veiw App</a>", "green");
redirect(apidb_fullurl("admin/adminAppQueue.php"));
exit;
}
else if ($sub == 'Delete' && $queueId)
{ {
//delete main item //delete main item
$query = "DELETE from appQueue where queueId = $queueId;"; $query = "DELETE from appQueue where queueId = $queueId;";
$result = mysql_query($query); $result = mysql_query($query);
echo html_frame_start("Delete Application: $ob->queueName",400,"",0);
if(!$result) if(!$result)
{ {
//error //error
echo "<p>Internal Error: unable to delete selected application!</p>\n"; addmsg("Internal Error: unable to delete selected application!", "red");
redirect(apidb_fullurl("admin/adminAppQueue.php?appId=$appId&versionId=$versionId"));
} }
else else
{ {
//success //Send Status Email
echo "<p>Application was successfully deleted from the Queue.</p>\n"; if ($ob->queueEmail)
{
if($ob->queueCatId == -1) //app version
{
$fullAppName = lookupAppName($appParent)." Version: ".$ob->queueVersion;
} else
{
$fullAppName = $ob->queueName." Version: ".$ob->queueVersion;
}
$ms = "Application Database Status Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your application: ".$fullAppName." has not been entered ";
$ms .= "into the application database.\n\n";
$ms .= "Sorry!\n\n";
$ms .= $emailtext;
mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms);
}
//success
addmsg("Application was successfully deleted from the Queue.", "green");
redirect(apidb_fullurl("admin/adminAppQueue.php?appId=$appId&versionId=$versionId"));
} }
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminAppQueue.php');
} }
else else
{ {
//error no sub! //error no sub!
echo html_frame_start("Error","300"); addmsg("Internal Routine Not Found!!", "red");
echo '<p><b>Internal Routine Not Found!</b></p>',"\n"; redirect(apidb_fullurl("admin/adminAppQueue.php"));
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminAppQueue.php');
} }
exit;
} }
else else
{ {
apidb_header("Admin App Queue");
echo '<form name="qform" action="admin/adminAppQueue.php" method="post" enctype="multipart/form-data">',"\n";
//get available apps //get available apps
$query = "SELECT queueId, queueName, queueVendor,". $query = "SELECT queueId, queueName, queueVendor,".
"queueVersion, queueEmail, queueCatId,". "queueVersion, queueEmail, queueCatId,".
@@ -372,9 +418,8 @@ else
//help //help
echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n"; echo "<div align=center><table width='90%' border=0 cellpadding=3 cellspacing=0><tr><td>\n\n";
echo "<p>This is the list of applications waiting for your approval, or to be annihilated from existence.</p>\n"; echo "<p>This is the list of applications waiting for your approval, or to be annihilated from existence.</p>\n";
echo "<p>To view a submission, click on its name. From that page you can edit, and approve it into the AppDB.<br>\n"; echo "<p>To view a submission, click on its name. From that page you can edit, delete or approve it into \n";
echo "Click the delete link to remove the selected item from the queue. An email will automatically be sent to the\n"; echo "the AppDB .<br>\n";
echo "submitter to let them know the item was deleted.</p>\n";
echo "</td></tr></table></div>\n\n"; echo "</td></tr></table></div>\n\n";
//show applist //show applist
@@ -415,18 +460,16 @@ else
echo " <td>".stripslashes($ob->queueVersion)." &nbsp;</td>\n"; echo " <td>".stripslashes($ob->queueVersion)." &nbsp;</td>\n";
echo " <td>".stripslashes($ob->queueVendor)." &nbsp;</td>\n"; echo " <td>".stripslashes($ob->queueVendor)." &nbsp;</td>\n";
echo " <td>".stripslashes($ob->queueEmail)." &nbsp;</td>\n"; echo " <td>".stripslashes($ob->queueEmail)." &nbsp;</td>\n";
echo " <td>[<a href='adminAppQueue.php?sub=delete&queueId=$ob->queueId'>delete</a>]</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";
$c++; $c++;
} }
echo "</table>\n\n"; echo "</table>\n\n";
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
}
} }
echo "</form>"; echo "</form>";
apidb_footer(); apidb_footer();
}
?> ?>