Fix editing bundles, they've been broken since appdb was imported into cvs and we haven't noticed, ha
This commit is contained in:
@@ -21,48 +21,47 @@ function build_app_list()
|
||||
echo "</select>\n";
|
||||
}
|
||||
|
||||
|
||||
if($cmd)
|
||||
if($_REQUEST['cmd'])
|
||||
{
|
||||
if($cmd == "delete")
|
||||
if($_REQUEST['cmd'] == "delete")
|
||||
{
|
||||
$hResult = query_appdb("DELETE FROM appBundle WHERE appId = $appId AND bundleId = $bundleId");
|
||||
$hResult = query_appdb("DELETE FROM appBundle WHERE appId =".$_REQUEST['appId']." AND bundleId =".$_REQUEST['bundleId']);
|
||||
if($hResult)
|
||||
addmsg("App deleted from bundle", "green");
|
||||
else
|
||||
addmsg("Failed to delete app from bundle!", "red");
|
||||
}
|
||||
if($cmd == "add")
|
||||
if($_REQUEST['cmd'] == "add")
|
||||
{
|
||||
$hResult = query_appdb("INSERT INTO appBundle VALUES ($bundleId, $appId)");
|
||||
$hResult = query_appdb("INSERT INTO appBundle VALUES (".$_REQUEST['bundleId'].", ".$_REQUEST['appId'].")");
|
||||
if($hResult)
|
||||
addmsg("App $appId added to Bundle $bundleId", "green");
|
||||
addmsg("App $appId added to Bundle".$_REQUEST['bundleId'], "green");
|
||||
}
|
||||
redirectref();
|
||||
exit;
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
apidb_header("Edit Application Bundle");
|
||||
|
||||
$hResult = query_appdb("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
|
||||
"WHERE bundleId = ".$_REQUEST['bundleId']." AND appFamily.appId = appBundle.appId");
|
||||
|
||||
echo html_frame_start("Apps in this Bundle","300",'',0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td><font color=white> Application Name </font></td>\n";
|
||||
echo " <td><font color=white> Delete </font></td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
if($hResult && mysql_num_rows($hResult))
|
||||
{
|
||||
apidb_header("Edit Application Bundle");
|
||||
|
||||
$hResult = query_appdb("SELECT bundleId, appBundle.appId, appName FROM appBundle, appFamily ".
|
||||
"WHERE bundleId = $bundleId AND appFamily.appId = appBundle.appId");
|
||||
|
||||
if($hResult && mysql_num_rows($hResult))
|
||||
{
|
||||
echo html_frame_start("Apps in this Bundle","300",'',0);
|
||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
||||
|
||||
echo "<tr class=color4>\n";
|
||||
echo " <td><font color=white> Application Name </font></td>\n";
|
||||
echo " <td><font color=white> Delete </font></td>\n";
|
||||
echo "</tr>\n\n";
|
||||
|
||||
$c = 1;
|
||||
while($oRow = mysql_fetch_object($hResult))
|
||||
{
|
||||
//set row color
|
||||
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
||||
|
||||
$delete_link = "[<a href='editBundle.php?cmd=delete&bundleId=$bundleId&appId=$oRow->appId'>delete</a>]";
|
||||
$delete_link = "[<a href='editBundle.php?cmd=delete&bundleId=".$_REQUEST['bundleId']."&appId=$oRow->appId'>delete</a>]";
|
||||
|
||||
echo "<tr class=$bgcolor>\n";
|
||||
echo " <td>$oRow->appName </td>\n";
|
||||
@@ -71,23 +70,27 @@ else
|
||||
|
||||
$c++;
|
||||
}
|
||||
|
||||
echo "</table>\n\n";
|
||||
echo html_frame_end();
|
||||
}
|
||||
|
||||
echo "<form method=post action=editBundle.php>\n";
|
||||
|
||||
echo html_frame_start("Application List (double click to add)","",'',2);
|
||||
build_app_list();
|
||||
echo html_frame_end();
|
||||
|
||||
echo "<input type=hidden name=bundleId value=$bundleId>\n";
|
||||
echo "<input type=hidden name=cmd value=add>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
apidb_footer();
|
||||
} else if($hResult && !mysql_num_rows($hResult))
|
||||
{
|
||||
/* indicate to the user that there are no apps in this bundle at the moment */
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=2 align=center><b>No applications in this bundle</b></td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
echo "</table>\n\n";
|
||||
echo html_frame_end();
|
||||
|
||||
echo "<form method=post action=editBundle.php>\n";
|
||||
|
||||
echo html_frame_start("Application List (double click to add)","",'',2);
|
||||
build_app_list();
|
||||
echo html_frame_end();
|
||||
|
||||
echo "<input type=\"hidden\" name=\"bundleId\" value=\"".$_REQUEST['bundleId']."\">\n";
|
||||
echo "<input type=\"hidden\" name=\"cmd\" value=\"add\">\n";
|
||||
echo "</form>\n";
|
||||
|
||||
apidb_footer();
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user