- improve application and related classes
- use application/version/vendor class in scripts - don't use a full table for queued appication but only one field in the application and version tables - simplify the code in many places
This commit is contained in:
@@ -20,97 +20,11 @@ if(!($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintaine
|
||||
|
||||
if(isset($_REQUEST['submit1']))
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
if($_REQUEST['submit1'] == "Update Database")
|
||||
{
|
||||
$statusMessage = '';
|
||||
// Get the old values from the database
|
||||
$query = "SELECT * FROM appVersion WHERE appId = ".$_REQUEST['appId']." and versionId = ".$_REQUEST['versionId'];
|
||||
$result = query_appdb($query);
|
||||
$ob = mysql_fetch_object($result);
|
||||
$old_versionName = $ob->versionName;
|
||||
$old_description = $ob->description;
|
||||
$old_rating = $ob->maintainer_rating;
|
||||
$old_release = $ob->maintainer_release;
|
||||
|
||||
$versionName = $_REQUEST['versionName'];
|
||||
$description = $_REQUEST['description'];
|
||||
$maintainer_rating = $_REQUEST['maintainer_rating'];
|
||||
$maintainer_release = $_REQUEST['maintainer_release'];
|
||||
|
||||
|
||||
$VersionChanged = false;
|
||||
if ($old_versionName <> $versionName)
|
||||
{
|
||||
$WhatChanged .= "Version name: Old Value: ".stripslashes($old_versionName)."\n";
|
||||
$WhatChanged .= " New Value: ".$versionName."\n";
|
||||
$VersionChanged = true;
|
||||
}
|
||||
if ($old_description <> $description)
|
||||
{
|
||||
$WhatChanged .= " Description: Old Value:\n";
|
||||
$WhatChanged .= "-----------------------:\n";
|
||||
$WhatChanged .= stripslashes($old_description)."\n";
|
||||
$WhatChanged .= "-----------------------:\n";
|
||||
$WhatChanged .= " Description: New Value:\n";
|
||||
$WhatChanged .= "-----------------------:\n";
|
||||
$WhatChanged .= stripslashes($description)."\n";
|
||||
$WhatChanged .= "-----------------------:\n";
|
||||
$VersionChanged = true;
|
||||
}
|
||||
if ($old_rating <> $maintainer_rating)
|
||||
{
|
||||
$WhatChanged .= " Release: Old Value: ".stripslashes($old_rating)."\n";
|
||||
$WhatChanged .= " New Value: ".$maintainer_rating."\n";
|
||||
$VersionChanged = true;
|
||||
}
|
||||
|
||||
if ($old_release <> $maintainer_release)
|
||||
{
|
||||
$WhatChanged .= " Release: Old Value: ".stripslashes($old_release)."\n";
|
||||
$WhatChanged .= " New Value: ".$maintainer_release."\n";
|
||||
$VersionChanged = true;
|
||||
}
|
||||
|
||||
//did anything change?
|
||||
if ($VersionChanged)
|
||||
{
|
||||
$sUpdate = compile_update_string( array('versionName' => $versionName,
|
||||
'description' => $description,
|
||||
'maintainer_rating' => $maintainer_rating,
|
||||
'maintainer_release' => $maintainer_release));
|
||||
|
||||
$sQuery = "UPDATE appVersion
|
||||
SET $sUpdate
|
||||
WHERE appId = '".$_REQUEST['appId']."'
|
||||
AND versionId = '".$_REQUEST['versionId']."'";
|
||||
// success
|
||||
if (query_appdb($sQuery))
|
||||
{
|
||||
$sEmail = get_notify_email_address_list($_REQUEST['appId'], $_REQUEST['versionId']);
|
||||
if($sEmail)
|
||||
{
|
||||
$sSubject = lookup_app_name($_REQUEST['appId'])." ".lookup_version_name($_REQUEST['versionId'])." has been modified by ".$_SESSION['current']->sRealname;
|
||||
$sMsg .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= "The following changes have been made:";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= $WhatChanged."\n";
|
||||
$sMsg .= "\n";
|
||||
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
addmsg("The version was successfully updated in the database", "green");
|
||||
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
|
||||
} else
|
||||
{
|
||||
//error
|
||||
redirect(apidb_fullurl("admin/editAppVersion.php?versionId=".$_REQUEST['versionId']));
|
||||
}
|
||||
} else
|
||||
{
|
||||
addmsg("Nothing changed", "red");
|
||||
redirect(apidb_fullurl("admin/editAppVersion.php?versionId=".$_REQUEST['versionId']));
|
||||
}
|
||||
$oVersion->update($_REQUEST['versionName'], $_REQUEST['description'], $_REQUEST['maintainer_release'], $_REQUEST['maintainer_rating']);
|
||||
}
|
||||
else if($_REQUEST['submit1'] == "Update URL")
|
||||
{
|
||||
@@ -174,21 +88,21 @@ if(isset($_REQUEST['submit1']))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($bAppChanged)
|
||||
{
|
||||
$sEmail = get_notify_email_address_list($_REQUEST['appId']);
|
||||
if($sEmail)
|
||||
if ($bAppChanged)
|
||||
{
|
||||
$sSubject = "Links for ".lookup_app_name($_REQUEST['appId'])." ".lookup_app_name($_REQUEST['versionId'])." have been updated by ".$_SESSION['current']->sRealname;
|
||||
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\n";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= "The following changes have been made:";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= $sWhatChanged."\n";
|
||||
$sMsg .= "\n";
|
||||
$sEmail = get_notify_email_address_list($_REQUEST['appId']);
|
||||
if($sEmail)
|
||||
{
|
||||
$sSubject = "Links for ".$oApp->sName." ".$oVersion->sName." have been updated by ".$_SESSION['current']->sRealname;
|
||||
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\n";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= "The following changes have been made:";
|
||||
$sMsg .= "\n";
|
||||
$sMsg .= $sWhatChanged."\n";
|
||||
$sMsg .= "\n";
|
||||
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
mail_appdb($sEmail, $sSubject ,$sMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
|
||||
@@ -199,26 +113,23 @@ if(isset($_REQUEST['submit1']))
|
||||
<!-- load HTMLArea -->
|
||||
<script type="text/javascript" src="../htmlarea/htmlarea_loader.js"></script>
|
||||
<?php
|
||||
$sQuery = "SELECT *
|
||||
FROM appVersion
|
||||
WHERE versionId = '".$_REQUEST['versionId']."'";
|
||||
$hResult = query_appdb($sQuery);
|
||||
$oRow = mysql_fetch_object($hResult);
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
|
||||
apidb_header("Edit Application Version");
|
||||
|
||||
echo "<form method=post action='editAppVersion.php'>\n";
|
||||
echo html_frame_start("Data for Application ID: ".$_REQUEST['appId']." Version ID: ".$_REQUEST['versionId'], "90%","",0);
|
||||
echo html_frame_start("Data for Application ID: ".$oVersion->iAppId." Version ID: ".$oVersion->iVersionId, "90%","",0);
|
||||
echo html_table_begin("width='100%' border=0 align=left cellpadding=6 cellspacing=0 class='box-body'");
|
||||
echo '<input type="hidden" name="appId" value='.$_REQUEST['appId'].' />';
|
||||
echo '<input type="hidden" name="versionId" value='.$_REQUEST['versionId'].' />';
|
||||
echo '<tr><td class=color1>Name</td><td class=color0>'.lookup_app_name($_REQUEST['appId']).'</td></tr>',"\n";
|
||||
echo '<tr><td class=color4>Version</td><td class=color0><input size=80% type="text" name="versionName" type="text" value="'.$oRow->versionName.'" /></td></tr>',"\n";
|
||||
echo '<input type="hidden" name="appId" value='.$oVersion->iAppId.' />';
|
||||
echo '<input type="hidden" name="versionId" value='.$oVersion->iVersionId.' />';
|
||||
echo '<tr><td class=color1>Name</td><td class=color0>'.lookup_app_name($oVersion->iAppId).'</td></tr>',"\n";
|
||||
echo '<tr><td class=color4>Version</td><td class=color0><input size=80% type="text" name="versionName" type="text" value="'.$oVersion->sName.'" /></td></tr>',"\n";
|
||||
echo '<tr><td class="color4">Version specific description</td><td class="color0">', "\n";
|
||||
if(trim(strip_tags($oRow->description))=="")
|
||||
// FIXME: put templates in config file or somewhere else.
|
||||
if(trim(strip_tags($oVersion->sDescription))=="")
|
||||
{
|
||||
$oRow->description = "<p>This is a template; enter version-specific description here</p>";
|
||||
$oRow->description .= "<p>
|
||||
$oVersion->sDescription = "<p>This is a template; enter version-specific description here</p>";
|
||||
$oVersion->sDescription .= "<p>
|
||||
<span class=\"title\">Wine compatibility</span><br />
|
||||
<span class=\"subtitle\">What works:</span><br />
|
||||
- settings<br />
|
||||
@@ -228,7 +139,7 @@ if(isset($_REQUEST['submit1']))
|
||||
<br /><span class=\"subtitle\">What was not tested:</span><br />
|
||||
- burning<br />
|
||||
</p>";
|
||||
$oRow->description .= "<p><span class=\"title\">Tested versions</span><br /><table class=\"historyTable\" width=\"90%\" border=\"1\">
|
||||
$oVersion->sDescription .= "<p><span class=\"title\">Tested versions</span><br /><table class=\"historyTable\" width=\"90%\" border=\"1\">
|
||||
<thead class=\"historyHeader\"><tr>
|
||||
<td>App. version</td><td>Wine version</td><td>Installs?</td><td>Runs?</td><td>Rating</td>
|
||||
</tr></thead>
|
||||
@@ -241,13 +152,13 @@ if(isset($_REQUEST['submit1']))
|
||||
</tr></tbody></table></p><p> <br /> </p>";
|
||||
}
|
||||
echo '<p style="width:700px">', "\n";
|
||||
echo '<textarea cols="80" rows="30" id="editor" name="description">'.$oRow->description.'</textarea></td></tr>',"\n";
|
||||
echo '<textarea cols="80" rows="30" id="editor" name="description">'.$oVersion->sDescription.'</textarea></td></tr>',"\n";
|
||||
echo '</p>';
|
||||
echo '<tr><td class="color4">Rating</td><td class="color0">',"\n";
|
||||
make_maintainer_rating_list("maintainer_rating", $oRow->maintainer_rating);
|
||||
make_maintainer_rating_list("maintainer_rating", $oVersion->sTestedRating);
|
||||
echo '</td></tr>',"\n";
|
||||
echo '<tr><td class=color1>Release</td><td class=color0>',"\n";
|
||||
make_bugzilla_version_list("maintainer_release", $oRow->maintainer_release);
|
||||
make_bugzilla_version_list("maintainer_release", $oVersion->sTestedRelease);
|
||||
echo '</td></tr>',"\n";
|
||||
|
||||
echo '<tr><td colspan=2 align=center class=color3><input type="submit" name="submit1" value="Update Database" /></td></tr>',"\n";
|
||||
@@ -258,13 +169,13 @@ if(isset($_REQUEST['submit1']))
|
||||
|
||||
// url edit form
|
||||
echo '<form enctype="multipart/form-data" action="editAppVersion.php" method="post">',"\n";
|
||||
echo '<input type=hidden name="appId" value='.$_REQUEST['appId'].'>';
|
||||
echo '<input type=hidden name="versionId" value='.$_REQUEST['versionId'].'>';
|
||||
echo '<input type=hidden name="appId" value='.$oVersion->iAppId.'>';
|
||||
echo '<input type=hidden name="versionId" value='.$oVersion->iVersionId.'>';
|
||||
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 versionId = ".$_REQUEST['versionId']." AND type = 'url'");
|
||||
$result = query_appdb("SELECT * FROM appData WHERE versionId = ".$oVersion->iVersionId." AND type = 'url'");
|
||||
if($result && mysql_num_rows($result) > 0)
|
||||
{
|
||||
echo '<tr><td class=color1><b>Delete</b></td><td class=color1>',"\n";
|
||||
@@ -287,7 +198,7 @@ if(isset($_REQUEST['submit1']))
|
||||
}
|
||||
} else
|
||||
{
|
||||
echo '<tr><td class=color1></td><td class="color1"><b>Description</b></td>',"\n";
|
||||
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";
|
||||
@@ -300,7 +211,7 @@ if(isset($_REQUEST['submit1']))
|
||||
echo '</table>',"\n";
|
||||
echo html_frame_end();
|
||||
echo "</form>";
|
||||
echo html_back_link(1,BASE."appview.php?versionId=".$_REQUEST['versionId']);
|
||||
echo html_back_link(1,BASE."appview.php?versionId=".$oVersion->iVersionId);
|
||||
apidb_footer();
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user