Clean up link editing code

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-01-20 03:49:41 +00:00
committed by WineHQ
parent 4f44475b6f
commit 6a92f95a6d
4 changed files with 196 additions and 184 deletions

View File

@@ -18,6 +18,7 @@ if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isSuperMain
if(!empty($aClean['sSubmit']))
{
process_app_version_changes(false);
url::processForm($aClean);
util_redirect_and_exit(apidb_fullurl("appview.php?iAppId={$aClean['iAppId']}"));
}
else
@@ -48,51 +49,8 @@ else
echo "<p>";
// url edit form
echo '<form enctype="multipart/form-data" action="editAppFamily.php" method="post">',"\n";
echo '<input type="hidden" name="iAppId" value="'.$oApp->iAppId.'" />';
echo html_frame_start("Edit URL","90%","",0);
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
$i = 0;
$hResult = query_parameters("SELECT * FROM appData WHERE appId = '?' AND type = 'url' AND versionId = 0",
$oApp->iAppId);
if($hResult && mysql_num_rows($hResult) > 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($oRow = mysql_fetch_object($hResult))
{
$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($oRow->description).'"</td>',"\n";
echo '<td class=color3><input size=45% type="text" name="'.$temp2.'" value="'.$oRow->url.'"></td></tr>',"\n";
echo '<input type="hidden" name="'.$temp3.'" value="'.$oRow->id.'" />';
echo '<input type=hidden name="'.$temp4.'" value="'.stripslashes($oRow->description).'">';
echo '<input type=hidden name="'.$temp5.'" value="'.$oRow->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='iRows' value='$i'>";
echo '<tr><td class=color1>New</td><td class=color1><input size=45% type="text" name="sUrlDesc"></td>',"\n";
echo '<td class=color1><input size=45% name="sUrl" type="text"></td></tr>',"\n";
echo '<tr><td colspan=3 align=center class=color3><input type="submit" name=sSubmit value="Update URL"></td></tr>',"\n";
echo '</table>',"\n";
echo html_frame_end();
echo "</form>";
// URL editor
echo url::outputEditor("editAppFamily.php", NULL, $oApp);
echo html_back_link(1,BASE."appview.php?iAppId=$oApp->iAppId");
}

View File

@@ -17,6 +17,7 @@ if(!empty($aClean['sSubmit']))
{
process_app_version_changes(true);
downloadurl::processForm($aClean);
url::processForm($aClean);
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
} else /* or display the webform for making changes */
{
@@ -40,51 +41,8 @@ if(!empty($aClean['sSubmit']))
echo "<br/><br/>\n";
// url edit form
echo '<form enctype="multipart/form-data" action="editAppVersion.php" method="post">',"\n";
echo '<input type="hidden" name="iAppId" value="'.$oVersion->iAppId.'" />';
echo '<input type="hidden" name="iVersionId" value="'.$oVersion->iVersionId.'" />';
echo html_frame_start("Edit URL","90%","",0);
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
$i = 0;
$hResult = query_parameters("SELECT * FROM appData WHERE versionId = '?' AND type = 'url'",
$oVersion->iVersionId);
if($hResult && mysql_num_rows($hResult) > 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($oRow = mysql_fetch_object($hResult))
{
$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($oRow->description).'"</td>',"\n";
echo '<td class=color3><input size="45" type="text" name="'.$temp2.'" value="'.$oRow->url.'"></td></tr>',"\n";
echo '<input type="hidden" name="'.$temp3.'" value="'.$oRow->id.'" />';
echo '<input type="hidden" name="'.$temp4.'" value="'.stripslashes($oRow->description).'" />';
echo '<input type="hidden" name="'.$temp5.'" value="'.$oRow->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='iRows' value='$i'>";
echo '<tr><td class=color1>New</td><td class=color1><input size="45" type="text" name="sUrlDesc"></td>',"\n";
echo '<td class=color1><input size=45% name="sUrl" type="text"></td></tr>',"\n";
echo '<tr><td colspan=3 align=center class="color3"><input type="submit" name="sSubmit" value="Update URL"></td></tr>',"\n";
echo '</table>',"\n";
echo html_frame_end();
echo "</form>";
/* URL editor */
echo url::outputEditor("editAppVersion.php", $oVersion);
/* Download URL editor */
echo downloadurl::outputEditor($oVersion, "editAppVersion.php");