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,73 +21,76 @@ function build_app_list()
|
|||||||
echo "</select>\n";
|
echo "</select>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($_REQUEST['cmd'])
|
||||||
if($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)
|
if($hResult)
|
||||||
addmsg("App deleted from bundle", "green");
|
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)
|
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");
|
$c = 1;
|
||||||
|
while($oRow = mysql_fetch_object($hResult))
|
||||||
$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);
|
//set row color
|
||||||
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
|
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
|
||||||
|
|
||||||
echo "<tr class=color4>\n";
|
$delete_link = "[<a href='editBundle.php?cmd=delete&bundleId=".$_REQUEST['bundleId']."&appId=$oRow->appId'>delete</a>]";
|
||||||
echo " <td><font color=white> Application Name </font></td>\n";
|
|
||||||
echo " <td><font color=white> Delete </font></td>\n";
|
echo "<tr class=$bgcolor>\n";
|
||||||
|
echo " <td>$oRow->appName </td>\n";
|
||||||
|
echo " <td>$delete_link </td>\n";
|
||||||
echo "</tr>\n\n";
|
echo "</tr>\n\n";
|
||||||
|
|
||||||
$c = 1;
|
$c++;
|
||||||
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>]";
|
|
||||||
|
|
||||||
echo "<tr class=$bgcolor>\n";
|
|
||||||
echo " <td>$oRow->appName </td>\n";
|
|
||||||
echo " <td>$delete_link </td>\n";
|
|
||||||
echo "</tr>\n\n";
|
|
||||||
|
|
||||||
$c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</table>\n\n";
|
|
||||||
echo html_frame_end();
|
|
||||||
}
|
}
|
||||||
|
} else if($hResult && !mysql_num_rows($hResult))
|
||||||
echo "<form method=post action=editBundle.php>\n";
|
{
|
||||||
|
/* indicate to the user that there are no apps in this bundle at the moment */
|
||||||
echo html_frame_start("Application List (double click to add)","",'',2);
|
echo "<tr>\n";
|
||||||
build_app_list();
|
echo " <td colspan=2 align=center><b>No applications in this bundle</b></td>\n";
|
||||||
echo html_frame_end();
|
echo "</tr>\n";
|
||||||
|
|
||||||
echo "<input type=hidden name=bundleId value=$bundleId>\n";
|
|
||||||
echo "<input type=hidden name=cmd value=add>\n";
|
|
||||||
echo "</form>\n";
|
|
||||||
|
|
||||||
apidb_footer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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