Restore the ability to add a url to an app family

This commit is contained in:
Tony Lambregts
2005-02-06 22:50:08 +00:00
committed by WineHQ
parent fa43f93810
commit 33eebe727e
3 changed files with 144 additions and 0 deletions

View File

@@ -125,6 +125,93 @@ if(isset($_REQUEST['submit']))
} }
} }
} }
else if($_REQUEST['submit'] == "Update URL")
{
$sWhatChanged = "";
$bAppChanged = false;
if (!empty($_REQUEST['url_desc']) && !empty($_REQUEST['url']) )
{
// process added URL
if($_SESSION['current']->showDebuggingInfos()) { echo "<p align=center><b>{$_REQUEST['url']}:</b> {$_REQUEST['url_desc']} </p>"; }
$aInsert = compile_insert_string( array( 'appId' => $_REQUEST['appId'],
'type' => 'url',
'description' => $_REQUEST['url_desc'],
'url' => $_REQUEST['url']));
$sQuery = "INSERT INTO appData ({$aInsert['FIELDS']}) VALUES ({$aInsert['VALUES']})";
if($_SESSION['current']->showDebuggingInfos()) { echo "<p align=center><b>query:</b> $sQuery </p>"; }
if (query_appdb($sQuery))
{
addmsg("The URL was successfully added into the database", "green");
$sWhatChanged .= " Added Url: Description: ".stripslashes($_REQUEST['url_desc'])."\n";
$sWhatChanged .= " Url: ".stripslashes($_REQUEST['url'])."\n";
$bAppChanged = true;
}
}
// Process changed URLs
for($i = 0; $i < $_REQUEST['rows']; $i++)
{
if($_SESSION['current']->showDebuggingInfos()) { echo "<p align=center><b>{$_REQUEST['adescription'][$i]}:</b> {$_REQUEST['aURL'][$i]}: {$_REQUEST['adelete'][$i]} : {$_REQUEST['aId'][$i]} : .{$_REQUEST['aOldDesc'][$i]}. : {$_REQUEST['aOldURL'][$i]}</p>"; }
if ($_REQUEST['adelete'][$i] == "on")
{
$hResult = query_appdb("DELETE FROM appData WHERE id = '{$_REQUEST['aId'][$i]}'");
if($hResult)
{
addmsg("<p><b>Successfully deleted URL ".$_REQUEST['aOldDesc'][$i]." (".$_REQUEST['aOldURL'][$i].")</b></p>\n",'green');
$sWhatChanged .= "Deleted Url: Description: ".stripslashes($_REQUEST['aOldDesc'][$i])."\n";
$sWhatChanged .= " url: ".stripslashes($_REQUEST['aOldURL'][$i])."\n";
$bAppChanged = true;
}
}
else if( $_REQUEST['aURL'][$i] != $_REQUEST['aOldURL'][$i] || $_REQUEST['adescription'][$i] != $_REQUEST['aOldDesc'][$i])
{
if(empty($_REQUEST['aURL'][$i]) || empty($_REQUEST['adescription'][$i]))
addmsg("The URL or description was blank. URL not changed in the database", "red");
else
{
$sUpdate = compile_update_string( array( 'description' => $_REQUEST['adescription'][$i],
'url' => $_REQUEST['aURL'][$i]));
if (query_appdb("UPDATE appData SET $sUpdate WHERE id = '{$_REQUEST['aId'][$i]}'"))
{
addmsg("<p><b>Successfully updated ".$_REQUEST['aOldDesc'][$i]." (".$_REQUEST['aOldURL'][$i].")</b></p>\n",'green');
$sWhatChanged .= "Changed Url: Old Description: ".stripslashes($_REQUEST['aOldDesc'][$i])."\n";
$sWhatChanged .= " Old Url: ".stripslashes($_REQUEST['aOldURL'][$i])."\n";
$sWhatChanged .= " New Description: ".stripslashes($_REQUEST['adescription'][$i])."\n";
$sWhatChanged .= " New url: ".stripslashes($_REQUEST['aURL'][$i])."\n";
$bAppChanged = true;
}
}
}
}
if ($bAppChanged)
{
$sEmail = get_notify_email_address_list($_REQUEST['appId']);
if($sEmail)
{
$sFullAppName = "Links for ".lookup_app_name($_REQUEST['appId'])." have been updated";
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\r\n";
$sMsg .= "\n";
$sMsg .= $_SESSION['current']->sRealname." updated links for ".$sFullAppName." \r\n";
$sMsg .= "\n";
$sMsg .= $sWhatChanged."\n";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
}
redirect(apidb_fullurl("appview.php?appId={$_REQUEST['appId']}"));
exit;
}
} }
else else
// Show the form for editing the Application Family // Show the form for editing the Application Family
@@ -175,6 +262,50 @@ else
echo html_frame_end(); echo html_frame_end();
echo "</form>"; echo "</form>";
// url edit form
echo '<form enctype="multipart/form-data" action="editAppFamily.php" method="post">',"\n";
echo '<input type=hidden name="appId" value='.$ob->appId.'>';
echo html_frame_start("Edit URL","90%","",0);
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
$i = 0;
$result = query_appdb("SELECT * FROM appData WHERE appId = $ob->appId AND type = 'url' AND versionId = 0");
if($result && mysql_num_rows($result) > 0)
{
echo '<tr><td class=color1><b>Delete</b></td><td class=color1>',"\n";
echo '<b>Description</b></td><td class=color1><b>URL</b></td></tr>',"\n";
while($ob = mysql_fetch_object($result))
{
$temp0 = "adelete[".$i."]";
$temp1 = "adescription[".$i."]";
$temp2 = "aURL[".$i."]";
$temp3 = "aId[".$i."]";
$temp4 = "aOldDesc[".$i."]";
$temp5 = "aOldURL[".$i."]";
echo '<tr><td class=color3><input type="checkbox" name="'.$temp0.'"></td>',"\n";
echo '<td class=color3><input size=45% type="text" name="'.$temp1.'" value ="'.stripslashes($ob->description).'"</td>',"\n";
echo '<td class=color3><input size=45% type="text" name="'.$temp2.'" value="'.$ob->url.'"></td></tr>',"\n";
echo '<input type=hidden name="'.$temp3.'" value='.$ob->id.'>';
echo '<input type=hidden name="'.$temp4.'" value="'.stripslashes($ob->description).'">';
echo '<input type=hidden name="'.$temp5.'" value="'.$ob->url.'">',"\n";
$i++;
}
} else
{
echo '<tr><td class=color1></td><td class=color1><b>Description</b></td>',"\n";
echo '<td class=color1><b>URL</b></td></tr>',"\n";
}
echo "</td></tr>\n";
echo "<input type=hidden name='rows' value='$i'>";
echo '<tr><td class=color1>New</td><td class=color1><input size=45% type="text" name="url_desc"></td>',"\n";
echo '<td class=color1><input size=45% name="url" type="text"></td></tr>',"\n";
echo '<tr><td colspan=3 align=center class=color3><input type="submit" name=submit value="Update URL"></td></tr>',"\n";
echo '</table>',"\n";
echo html_frame_end();
echo "</form>";
echo html_back_link(1,BASE."appview.php?appId=$ob->appId"); echo html_back_link(1,BASE."appview.php?appId=$ob->appId");
} }

View File

@@ -220,6 +220,18 @@ if($_REQUEST['appId'])
// main URL // main URL
echo " <tr class=\"color1\"><td><b>URL</b></td><td>".$appLinkURL."</td></tr>\n"; echo " <tr class=\"color1\"><td><b>URL</b></td><td>".$appLinkURL."</td></tr>\n";
// optional links
$result = query_appdb("SELECT * FROM appData WHERE appId = ".$_REQUEST['appId']." AND versionID = 0 AND type = 'url'");
if($result && mysql_num_rows($result) > 0)
{
echo " <tr class=\"color1\"><td> <b>Links</b></td><td>\n";
while($ob = mysql_fetch_object($result))
{
echo " <a href='$ob->url'>".substr(stripslashes($ob->description),0,30)."</a> <br />\n";
}
echo " </td></tr>\n";
}
// image // image
$img = get_screenshot_img($oApp->iAppId); $img = get_screenshot_img($oApp->iAppId);
echo "<tr><td align=center colspan=2>$img</td></tr>\n"; echo "<tr><td align=center colspan=2>$img</td></tr>\n";

View File

@@ -154,6 +154,7 @@ create table appComments (
*/ */
create table appData ( create table appData (
id int not null auto_increment, id int not null auto_increment,
appId int not null,
versionId int default 0, versionId int default 0,
type enum('image', 'url', 'bug'), type enum('image', 'url', 'bug'),
description text, description text,