Move html output of application and version into the application and version classes
This commit is contained in:
363
appview.php
363
appview.php
@@ -190,368 +190,11 @@ if ($_REQUEST['sub'])
|
||||
if($_REQUEST['appId'])
|
||||
{
|
||||
$oApp = new Application($_REQUEST['appId']);
|
||||
|
||||
/* is this user supposed to view this version? */
|
||||
if(!$_SESSION['current']->canViewApplication($oApp))
|
||||
{
|
||||
errorpage("Something went wrong with the application or version id");
|
||||
exit;
|
||||
}
|
||||
|
||||
// show Vote Menu
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
apidb_sidebar_add("vote_menu");
|
||||
|
||||
// header
|
||||
apidb_header("Viewing App - ".$oApp->sName);
|
||||
|
||||
// cat display
|
||||
display_catpath($oApp->iCatId, $oApp->iAppId);
|
||||
|
||||
// set Vendor
|
||||
$oVendor = new Vendor($oApp->iVendorId);
|
||||
|
||||
// set URL
|
||||
$appLinkURL = ($oApp->sWebpage) ? "<a href=\"".$oApp->sWebpage."\">".substr(stripslashes($oApp->sWebpage),0,30)."</a>": " ";
|
||||
|
||||
// start display application
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<tr><td class=color4 valign=top>\n";
|
||||
echo " <table>\n";
|
||||
echo " <tr><td>\n";
|
||||
|
||||
echo ' <table width="250" border="0" cellpadding="3" cellspacing="1">',"\n";
|
||||
echo " <tr class=color0 valign=top><td width=\"100\"><b>Name</b></td><td width='100%'> ".$oApp->sName." </td>\n";
|
||||
echo " <tr class=\"color1\"><td><b>Vendor</b></td><td> ".
|
||||
" <a href='vendorview.php?vendorId=$oVendor->iVendorId'> ".$oVendor->sName." </a> \n";
|
||||
echo " <tr class=\"color0\"><td><b>Votes</b></td><td> ";
|
||||
echo vote_count_app_total($oApp->iAppId);
|
||||
echo " </td></tr>\n";
|
||||
|
||||
// main URL
|
||||
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
|
||||
$img = get_screenshot_img($oApp->iAppId);
|
||||
echo "<tr><td align=\"center\" colspan=\"2\">$img</td></tr>\n";
|
||||
|
||||
echo " </table>\n"; /* close of name/vendor/bugs/url table */
|
||||
|
||||
echo " </td></tr>\n";
|
||||
echo " <tr><td>\n";
|
||||
|
||||
// Display all supermaintainers maintainers of this application
|
||||
echo " <table class=\"color4\" width=\"250\" border=\"1\">\n";
|
||||
echo " <tr><td align=\"left\"><b>Super maintainers:</b></td></tr>\n";
|
||||
$other_maintainers = getSuperMaintainersUserIdsFromAppId($oApp->iAppId);
|
||||
if($other_maintainers)
|
||||
{
|
||||
echo " <tr><td align=\"left\"><ul>\n";
|
||||
while(list($index, $userIdValue) = each($other_maintainers))
|
||||
{
|
||||
$oUser = new User($userIdValue);
|
||||
echo " <li>".$oUser->sRealname."</li>\n";
|
||||
}
|
||||
echo "</ul></td></tr>\n";
|
||||
} else
|
||||
{
|
||||
echo " <tr><td align=right>No maintainers.Volunteer today!</td></tr>\n";
|
||||
}
|
||||
|
||||
// Display the app maintainer button
|
||||
echo ' <tr><td align="center">';
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
/* are we already a maintainer? */
|
||||
if($_SESSION['current']->isSuperMaintainer($oApp->iAppId)) /* yep */
|
||||
{
|
||||
echo ' <form method="post" name="message" action="maintainerdelete.php"><input type=submit value="Remove yourself as a super maintainer" class="button">';
|
||||
} else /* nope */
|
||||
{
|
||||
echo ' <form method="post" name="message" action="maintainersubmit.php"><input type="submit" value="Be a super maintainer of this app" class="button" title="Click here to know more about super maintainers.">';
|
||||
}
|
||||
|
||||
echo " <input type=\"hidden\" name=\"appId\" value=\"".$oApp->iAppId."\">";
|
||||
echo " <input type=\"hidden\" name=\"superMaintainer\" value=\"1\">"; /* set superMaintainer to 1 because we are at the appFamily level */
|
||||
echo " </form>";
|
||||
|
||||
if($_SESSION['current']->isSuperMaintainer($oApp->iAppId) || $_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
echo ' <form method="post" name="edit" action="admin/editAppFamily.php"><input type="hidden" name="appId" value="'.$_REQUEST['appId'].'"><input type="submit" value="Edit Application" class="button"></form>';
|
||||
}
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
echo '<form method="post" name="message" action="appsubmit.php?appId='.$oApp->iAppId.'&apptype=version&sub=view">';
|
||||
echo '<input type=submit value="Submit new version" class="button">';
|
||||
echo '</form>';
|
||||
}
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
$url = BASE."admin/deleteAny.php?what=appFamily&appId=".$oApp->iAppId."&confirmed=yes";
|
||||
echo " <form method=\"post\" name=\"edit\" action=\"javascript:deleteURL('Are you sure?', '".$url."')\"><input type=\"submit\" value=\"Delete App\" class=\"button\"></form>";
|
||||
echo ' <form method="post" name="edit" action="admin/editBundle.php"><input type="hidden" name="bundleId" value="'.$oApp->iAppId.'"><input type="submit" value="Edit Bundle" class="button"></form>';
|
||||
}
|
||||
} else
|
||||
{
|
||||
echo '<form method="post" action="account.php?cmd=login"><input type="submit" value="Log in to become a super maintainer" class="button"></form>';
|
||||
}
|
||||
echo " </td></tr>\n";
|
||||
echo " </table>\n"; /* close of super maintainers table */
|
||||
echo " </td></tr>\n";
|
||||
echo " </table>\n"; /* close the table that contains the whole left hand side of the upper table */
|
||||
|
||||
// description
|
||||
echo " <td class=color2 valign=top width='100%'>\n";
|
||||
echo " <table width='100%' border=0><tr><td width='100%' valign=top><span class=\"title\">Description</span>\n";
|
||||
echo $oApp->sDescription;
|
||||
echo " </td></tr></table>\n";
|
||||
echo html_frame_end("For more details and user comments, view the versions of this application.");
|
||||
|
||||
// display versions
|
||||
display_approved_versions($oApp->aVersionsIds);
|
||||
|
||||
// display bundle
|
||||
display_bundle($oApp->iAppId);
|
||||
|
||||
// disabled for now
|
||||
//log_application_visit($oApp->iAppId);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* We want to see a particular version.
|
||||
*/
|
||||
else if($_REQUEST['versionId'])
|
||||
$oApp->display();
|
||||
} else if($_REQUEST['versionId']) // We want to see a particular version.
|
||||
{
|
||||
$oVersion = new Version($_REQUEST['versionId']);
|
||||
|
||||
/* is this user supposed to view this version? */
|
||||
if(!$_SESSION['current']->canViewVersion($oVersion))
|
||||
{
|
||||
errorpage("Something went wrong with the application or version id");
|
||||
exit;
|
||||
}
|
||||
|
||||
$oApp = new Application($oVersion->iAppId);
|
||||
if(!$oApp->iAppId)
|
||||
{
|
||||
// Oops! application not found or other error. do something
|
||||
errorpage('Internal Database Access Error. No App found.');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$oVersion->iVersionId)
|
||||
{
|
||||
// Oops! Version not found or other error. do something
|
||||
errorpage('Internal Database Access Error. No Version Found.');
|
||||
exit;
|
||||
}
|
||||
|
||||
// header
|
||||
apidb_header("Viewing App- ".$oApp->sName." Version - ".$oVersion->sName);
|
||||
|
||||
// cat
|
||||
display_catpath($oApp->iCatId, $oApp->iAppId, $oVersion->iVersionId);
|
||||
|
||||
// set URL
|
||||
$appLinkURL = ($oApp->sWebpage) ? "<a href=\"".$oApp->sWebpage."\">".substr(stripslashes($oApp->sWebpage),0,30)."</a>": " ";
|
||||
|
||||
// start version display
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo '<tr><td class="color4" valign="top">',"\n";
|
||||
echo '<table width="250" border="0" cellpadding="3" cellspacing="1">',"\n";
|
||||
echo "<tr class=\"color0\" valign=\"top\"><td width=\"100\"> <b>Name</b></td><td width=\"100%\">".$oApp->sName."</td>\n";
|
||||
echo "<tr class=\"color1\" valign=\"top\"><td><b>Version</b></td><td>".$oVersion->sName."</td></tr>\n";
|
||||
|
||||
// main URL
|
||||
echo " <tr class=\"color1\"><td><b>URL</b></td><td>".$appLinkURL."</td></tr>\n";
|
||||
|
||||
// links
|
||||
$result = query_appdb("SELECT * FROM appData WHERE versionID = ".$oVersion->iVersionId." 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";
|
||||
}
|
||||
|
||||
// rating Area
|
||||
echo "<tr class=\"color1\" valign=\"top\"><td><b>Maintainer Rating</b></td><td>".$oVersion->sTestedRating."</td></tr>\n";
|
||||
echo "<tr class=\"color0\" valign=\"top\"><td><b>Maintainers Version</b></td><td>".$oVersion->sTestedRelease."</td></tr>\n";
|
||||
|
||||
// image
|
||||
$img = get_screenshot_img($oApp->iAppId, $oVersion->iVersionId);
|
||||
echo "<tr><td align=\"center\" colspan=\"2\">$img</td></tr>\n";
|
||||
|
||||
// display all maintainers of this application
|
||||
echo "<tr class=\"color0\"><td align=\"left\" colspan=\"2\"><b>Maintainers of this version:</b>\n";
|
||||
echo "<table width=\"250\" border=\"0\">";
|
||||
$aMaintainers = getMaintainersUserIdsFromAppIdVersionId($oVersion->iVersionId);
|
||||
$aSupermaintainers = getSuperMaintainersUserIdsFromAppId($oVersion->iAppId);
|
||||
$aAllMaintainers = array_merge($aMaintainers,$aSupermaintainers);
|
||||
$aAllMaintainers = array_unique($aAllMaintainers);
|
||||
if(sizeof($aAllMaintainers)>0)
|
||||
{
|
||||
echo "<tr class=\"color0\"><td align=\"left\" colspan=\"2\"><ul>";
|
||||
while(list($index, $userIdValue) = each($aAllMaintainers))
|
||||
{
|
||||
$oUser = new User($userIdValue);
|
||||
echo "<li>".$oUser->sRealname."</li>";
|
||||
}
|
||||
echo "</ul></td></tr>\n";
|
||||
} else
|
||||
{
|
||||
echo "<tr class=color0><td align=right colspan=2>";
|
||||
echo "No maintainers. Volunteer today!</td></tr>\n";
|
||||
}
|
||||
echo "</table></td></tr>";
|
||||
|
||||
// display the app maintainer button
|
||||
echo '<tr><td colspan="2" align="center">';
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
/* is this user a maintainer of this version by virtue of being a super maintainer */
|
||||
/* of this app family? */
|
||||
if($_SESSION['current']->isSuperMaintainer($oApp->iAppId))
|
||||
{
|
||||
echo '<form method="post" name="message" action="maintainerdelete.php">';
|
||||
echo '<input type="submit" value="Remove yourself as a supermaintainer" class="button">';
|
||||
echo '<input type="hidden" name="superMaintainer" value="1">';
|
||||
echo "<input type=hidden name=\"appId\" value=\"".$oApp->iAppId."\">";
|
||||
echo "<input type=hidden name=\"versionId\" value=\"".$oVersion->iVersionId."\">";
|
||||
echo "</form>";
|
||||
} else
|
||||
{
|
||||
/* are we already a maintainer? */
|
||||
if($_SESSION['current']->isMaintainer($oVersion->iVersionId)) /* yep */
|
||||
{
|
||||
echo '<form method="post" name="message" action="maintainerdelete.php">';
|
||||
echo '<input type="submit" value="Remove yourself as a maintainer" class=button>';
|
||||
echo '<input type="hidden" name="superMaintainer" value="0">';
|
||||
echo "<input type=hidden name=\"appId\" value=\"".$oApp->iAppId."\">";
|
||||
echo "<input type=hidden name=\"versionId\" value=\"".$oVersion->iVersionId."\">";
|
||||
echo "</form>";
|
||||
} else /* nope */
|
||||
{
|
||||
echo '<form method="post" name="message" action="maintainersubmit.php">';
|
||||
echo '<input type="submit" value="Be a maintainer for this app" class="button" title="Click here to know more about maintainers.">';
|
||||
echo "<input type=hidden name=\"appId\" value=\"".$oApp->iAppId."\">";
|
||||
echo "<input type=hidden name=\"versionId\" value=\"".$oVersion->iVersionId."\">";
|
||||
echo "</form>";
|
||||
$oMonitor = new Monitor();
|
||||
$oMonitor->find($_SESSION['current']->iUserId,$oApp->iAppId,$oVersion->iVersionId);
|
||||
if(!$oMonitor->iMonitorId)
|
||||
{
|
||||
echo '<form method=post name=message action=appview.php?versionId='.$oVersion->iVersionId.'&appId='.$oApp->iAppId.'>';
|
||||
echo '<input type=hidden name="sub" value="StartMonitoring" />';
|
||||
echo '<input type=submit value="Monitor Version" class="button" />';
|
||||
echo "</form>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
echo '<form method="post" name="message" action="account.php">';
|
||||
echo '<input type="hidden" name="cmd" value="login">';
|
||||
echo '<input type=submit value="Log in to become an app maintainer" class="button">';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
if ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($oVersion->iVersionId) || $_SESSION['current']->isSuperMaintainer($oVersion->iAppId))
|
||||
{
|
||||
echo '<tr><td colspan="2" align="center">';
|
||||
echo '<form method="post" name="message" action="admin/editAppVersion.php">';
|
||||
echo '<input type="hidden" name="appId" value="'.$oApp->iAppId.'" />';
|
||||
echo '<input type="hidden" name="versionId" value="'.$oVersion->iVersionId.'" />';
|
||||
echo '<input type=submit value="Edit Version" class="button" />';
|
||||
echo '</form>';
|
||||
$url = BASE."admin/deleteAny.php?what=appVersion&appId=".$oApp->iAppId."&versionId=".$oVersion->iVersionId."&confirmed=yes";
|
||||
echo "<form method=\"post\" name=\"delete\" action=\"javascript:deleteURL('Are you sure?', '".$url."')\">";
|
||||
echo '<input type=submit value="Delete Version" class="button" />';
|
||||
echo '</form>';
|
||||
echo '<form method="post" name="message" action="admin/addAppNote.php">';
|
||||
echo '<input type="hidden" name="versionId" value="'.$oVersion->iVersionId.'" />';
|
||||
echo '<input type="submit" value="Add Note" class="button" />';
|
||||
echo '</form>';
|
||||
echo '<form method=post name=message action=admin/addAppNote.php?versionId='.$oVersion->iVersionId.'>';
|
||||
echo '<input type=hidden name="noteTitle" value="HOWTO" />';
|
||||
echo '<input type=submit value="Add How To" class="button" />';
|
||||
echo '</form>';
|
||||
echo '<form method=post name=message action=admin/addAppNote.php?versionId='.$oVersion->iVersionId.'>';
|
||||
echo '<input type=hidden name="noteTitle" value="WARNING" />';
|
||||
echo '<input type=submit value="Add Warning" class="button" />';
|
||||
echo '</form>';
|
||||
echo "</td></tr>";
|
||||
}
|
||||
$oMonitor = new Monitor();
|
||||
$oMonitor->find($_SESSION['current']->iUserId,$oApp->iAppId,$oVersion->iVersionId);
|
||||
if($oMonitor->iMonitorId)
|
||||
{
|
||||
|
||||
echo '<tr><td colspan="2" align="center">';
|
||||
echo '</form>';
|
||||
echo '<form method=post name=message action=appview.php?versionId='.$oVersion->iVersionId.'>';
|
||||
echo '<input type=hidden name="sub" value="StopMonitoring" />';
|
||||
echo '<input type=submit value="Stop Monitoring Version" class="button" />';
|
||||
echo '</form>';
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</table><td class=color2 valign=top width='100%'>\n";
|
||||
|
||||
// description
|
||||
echo "<table width='100%' border=0><tr><td width='100%' valign=top> <b>Description</b><br />\n";
|
||||
echo $oVersion->sDescription;
|
||||
|
||||
// Show testing data
|
||||
$oTest = new TestData($_REQUEST['iTestingId']);
|
||||
$iCurrentTest = $oTest->ShowTestResult($oTest->iTestingId,$oVersion->iVersionId);
|
||||
if($iCurrentTest)
|
||||
$oTest->ShowVersionsTestingTable($oVersion->iVersionId,
|
||||
$iCurrentTest,
|
||||
$_SERVER['PHP_SELF']."?versionId=".$oVersion->iVersionId."&iTestingId=",
|
||||
5);
|
||||
echo '<form method=post name=message action=testResults.php?sub=view&iVersionId='.$oVersion->iVersionId.'>';
|
||||
echo '<input type=submit value="Add Testing Data" class="button" />';
|
||||
echo '</form>';
|
||||
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
/* close the table */
|
||||
echo "</table>\n";
|
||||
|
||||
echo html_frame_end();
|
||||
|
||||
view_version_bugs($oVersion->iVersionId, $oVersion->aBuglinkIds);
|
||||
|
||||
$rNotes = query_appdb("SELECT * FROM appNotes WHERE versionId = ".$oVersion->iVersionId);
|
||||
|
||||
while( $oNote = mysql_fetch_object($rNotes) )
|
||||
{
|
||||
echo show_note($oNote->noteTitle,$oNote);
|
||||
}
|
||||
|
||||
// Comments Section
|
||||
view_app_comments($oVersion->iVersionId);
|
||||
|
||||
$oVersion->display();
|
||||
} else
|
||||
{
|
||||
// Oops! Called with no params, bad llamah!
|
||||
|
||||
@@ -502,6 +502,144 @@ class Application {
|
||||
$this->sKeywords = $_REQUEST['appKeywords'];
|
||||
}
|
||||
}
|
||||
|
||||
/* display this application */
|
||||
function display()
|
||||
{
|
||||
/* is this user supposed to view this version? */
|
||||
if(!$_SESSION['current']->canViewApplication($this))
|
||||
{
|
||||
errorpage("Something went wrong with the application or version id");
|
||||
exit;
|
||||
}
|
||||
|
||||
// show Vote Menu
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
apidb_sidebar_add("vote_menu");
|
||||
|
||||
// header
|
||||
apidb_header("Viewing App - ".$this->sName);
|
||||
|
||||
// cat display
|
||||
display_catpath($this->iCatId, $this->iAppId);
|
||||
|
||||
// set Vendor
|
||||
$oVendor = new Vendor($this->iVendorId);
|
||||
|
||||
// set URL
|
||||
$appLinkURL = ($this->sWebpage) ? "<a href=\"".$this->sWebpage."\">".substr(stripslashes($this->sWebpage),0,30)."</a>": " ";
|
||||
|
||||
// start display application
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo "<tr><td class=color4 valign=top>\n";
|
||||
echo " <table>\n";
|
||||
echo " <tr><td>\n";
|
||||
|
||||
echo ' <table width="250" border="0" cellpadding="3" cellspacing="1">',"\n";
|
||||
echo " <tr class=color0 valign=top><td width=\"100\"><b>Name</b></td><td width='100%'> ".$this->sName." </td>\n";
|
||||
echo " <tr class=\"color1\"><td><b>Vendor</b></td><td> ".
|
||||
" <a href='vendorview.php?vendorId=$oVendor->iVendorId'> ".$oVendor->sName." </a> \n";
|
||||
echo " <tr class=\"color0\"><td><b>Votes</b></td><td> ";
|
||||
echo vote_count_app_total($this->iAppId);
|
||||
echo " </td></tr>\n";
|
||||
|
||||
// main URL
|
||||
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
|
||||
$img = get_screenshot_img($this->iAppId);
|
||||
echo "<tr><td align=\"center\" colspan=\"2\">$img</td></tr>\n";
|
||||
|
||||
echo " </table>\n"; /* close of name/vendor/bugs/url table */
|
||||
|
||||
echo " </td></tr>\n";
|
||||
echo " <tr><td>\n";
|
||||
|
||||
// Display all supermaintainers maintainers of this application
|
||||
echo " <table class=\"color4\" width=\"250\" border=\"1\">\n";
|
||||
echo " <tr><td align=\"left\"><b>Super maintainers:</b></td></tr>\n";
|
||||
$other_maintainers = getSuperMaintainersUserIdsFromAppId($this->iAppId);
|
||||
if($other_maintainers)
|
||||
{
|
||||
echo " <tr><td align=\"left\"><ul>\n";
|
||||
while(list($index, $userIdValue) = each($other_maintainers))
|
||||
{
|
||||
$oUser = new User($userIdValue);
|
||||
echo " <li>".$oUser->sRealname."</li>\n";
|
||||
}
|
||||
echo "</ul></td></tr>\n";
|
||||
} else
|
||||
{
|
||||
echo " <tr><td align=right>No maintainers.Volunteer today!</td></tr>\n";
|
||||
}
|
||||
|
||||
// Display the app maintainer button
|
||||
echo ' <tr><td align="center">';
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
/* are we already a maintainer? */
|
||||
if($_SESSION['current']->isSuperMaintainer($this->iAppId)) /* yep */
|
||||
{
|
||||
echo ' <form method="post" name="message" action="maintainerdelete.php"><input type=submit value="Remove yourself as a super maintainer" class="button">';
|
||||
} else /* nope */
|
||||
{
|
||||
echo ' <form method="post" name="message" action="maintainersubmit.php"><input type="submit" value="Be a super maintainer of this app" class="button" title="Click here to know more about super maintainers.">';
|
||||
}
|
||||
|
||||
echo " <input type=\"hidden\" name=\"appId\" value=\"".$this->iAppId."\">";
|
||||
echo " <input type=\"hidden\" name=\"superMaintainer\" value=\"1\">"; /* set superMaintainer to 1 because we are at the appFamily level */
|
||||
echo " </form>";
|
||||
|
||||
if($_SESSION['current']->isSuperMaintainer($this->iAppId) || $_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
echo ' <form method="post" name="edit" action="admin/editAppFamily.php"><input type="hidden" name="appId" value="'.$_REQUEST['appId'].'"><input type="submit" value="Edit Application" class="button"></form>';
|
||||
}
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
echo '<form method="post" name="message" action="appsubmit.php?appId='.$this->iAppId.'&apptype=version&sub=view">';
|
||||
echo '<input type=submit value="Submit new version" class="button">';
|
||||
echo '</form>';
|
||||
}
|
||||
if($_SESSION['current']->hasPriv("admin"))
|
||||
{
|
||||
$url = BASE."admin/deleteAny.php?what=appFamily&appId=".$this->iAppId."&confirmed=yes";
|
||||
echo " <form method=\"post\" name=\"edit\" action=\"javascript:deleteURL('Are you sure?', '".$url."')\"><input type=\"submit\" value=\"Delete App\" class=\"button\"></form>";
|
||||
echo ' <form method="post" name="edit" action="admin/editBundle.php"><input type="hidden" name="bundleId" value="'.$this->iAppId.'"><input type="submit" value="Edit Bundle" class="button"></form>';
|
||||
}
|
||||
} else
|
||||
{
|
||||
echo '<form method="post" action="account.php?cmd=login"><input type="submit" value="Log in to become a super maintainer" class="button"></form>';
|
||||
}
|
||||
echo " </td></tr>\n";
|
||||
echo " </table>\n"; /* close of super maintainers table */
|
||||
echo " </td></tr>\n";
|
||||
echo " </table>\n"; /* close the table that contains the whole left hand side of the upper table */
|
||||
|
||||
// description
|
||||
echo " <td class=color2 valign=top width='100%'>\n";
|
||||
echo " <table width='100%' border=0><tr><td width='100%' valign=top><span class=\"title\">Description</span>\n";
|
||||
echo $this->sDescription;
|
||||
echo " </td></tr></table>\n";
|
||||
echo html_frame_end("For more details and user comments, view the versions of this application.");
|
||||
|
||||
// display versions
|
||||
display_approved_versions($this->aVersionsIds);
|
||||
|
||||
// display bundle
|
||||
display_bundle($this->iAppId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -617,6 +617,225 @@ class Version {
|
||||
$this->sTestedRelease = $_REQUEST['maintainer_release'];
|
||||
}
|
||||
}
|
||||
|
||||
function display()
|
||||
{
|
||||
/* is this user supposed to view this version? */
|
||||
if(!$_SESSION['current']->canViewVersion($this))
|
||||
{
|
||||
errorpage("Something went wrong with the application or version id");
|
||||
exit;
|
||||
}
|
||||
|
||||
$oApp = new Application($this->iAppId);
|
||||
if(!$oApp->iAppId)
|
||||
{
|
||||
// Oops! application not found or other error. do something
|
||||
errorpage('Internal Database Access Error. No App found.');
|
||||
exit;
|
||||
}
|
||||
|
||||
if(!$this->iVersionId)
|
||||
{
|
||||
// Oops! Version not found or other error. do something
|
||||
errorpage('Internal Database Access Error. No Version Found.');
|
||||
exit;
|
||||
}
|
||||
|
||||
// header
|
||||
apidb_header("Viewing App- ".$oApp->sName." Version - ".$this->sName);
|
||||
|
||||
// cat
|
||||
display_catpath($oApp->iCatId, $oApp->iAppId, $this->iVersionId);
|
||||
|
||||
// set URL
|
||||
$appLinkURL = ($oApp->sWebpage) ? "<a href=\"".$oApp->sWebpage."\">".substr(stripslashes($oApp->sWebpage),0,30)."</a>": " ";
|
||||
|
||||
// start version display
|
||||
echo html_frame_start("","98%","",0);
|
||||
echo '<tr><td class="color4" valign="top">',"\n";
|
||||
echo '<table width="250" border="0" cellpadding="3" cellspacing="1">',"\n";
|
||||
echo "<tr class=\"color0\" valign=\"top\"><td width=\"100\"> <b>Name</b></td><td width=\"100%\">".$oApp->sName."</td>\n";
|
||||
echo "<tr class=\"color1\" valign=\"top\"><td><b>Version</b></td><td>".$this->sName."</td></tr>\n";
|
||||
|
||||
// main URL
|
||||
echo " <tr class=\"color1\"><td><b>URL</b></td><td>".$appLinkURL."</td></tr>\n";
|
||||
|
||||
// links
|
||||
$result = query_appdb("SELECT * FROM appData WHERE versionID = ".$this->iVersionId." 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";
|
||||
}
|
||||
|
||||
// rating Area
|
||||
echo "<tr class=\"color1\" valign=\"top\"><td><b>Maintainer Rating</b></td><td>".$this->sTestedRating."</td></tr>\n";
|
||||
echo "<tr class=\"color0\" valign=\"top\"><td><b>Maintainers Version</b></td><td>".$this->sTestedRelease."</td></tr>\n";
|
||||
|
||||
// image
|
||||
$img = get_screenshot_img($oApp->iAppId, $this->iVersionId);
|
||||
echo "<tr><td align=\"center\" colspan=\"2\">$img</td></tr>\n";
|
||||
|
||||
// display all maintainers of this application
|
||||
echo "<tr class=\"color0\"><td align=\"left\" colspan=\"2\"><b>Maintainers of this version:</b>\n";
|
||||
echo "<table width=\"250\" border=\"0\">";
|
||||
$aMaintainers = getMaintainersUserIdsFromAppIdVersionId($this->iVersionId);
|
||||
$aSupermaintainers = getSuperMaintainersUserIdsFromAppId($this->iAppId);
|
||||
$aAllMaintainers = array_merge($aMaintainers,$aSupermaintainers);
|
||||
$aAllMaintainers = array_unique($aAllMaintainers);
|
||||
if(sizeof($aAllMaintainers)>0)
|
||||
{
|
||||
echo "<tr class=\"color0\"><td align=\"left\" colspan=\"2\"><ul>";
|
||||
while(list($index, $userIdValue) = each($aAllMaintainers))
|
||||
{
|
||||
$oUser = new User($userIdValue);
|
||||
echo "<li>".$oUser->sRealname."</li>";
|
||||
}
|
||||
echo "</ul></td></tr>\n";
|
||||
} else
|
||||
{
|
||||
echo "<tr class=color0><td align=right colspan=2>";
|
||||
echo "No maintainers. Volunteer today!</td></tr>\n";
|
||||
}
|
||||
echo "</table></td></tr>";
|
||||
|
||||
// display the app maintainer button
|
||||
echo '<tr><td colspan="2" align="center">';
|
||||
if($_SESSION['current']->isLoggedIn())
|
||||
{
|
||||
/* is this user a maintainer of this version by virtue of being a super maintainer */
|
||||
/* of this app family? */
|
||||
if($_SESSION['current']->isSuperMaintainer($oApp->iAppId))
|
||||
{
|
||||
echo '<form method="post" name="message" action="maintainerdelete.php">';
|
||||
echo '<input type="submit" value="Remove yourself as a supermaintainer" class="button">';
|
||||
echo '<input type="hidden" name="superMaintainer" value="1">';
|
||||
echo "<input type=hidden name=\"appId\" value=\"".$oApp->iAppId."\">";
|
||||
echo "<input type=hidden name=\"versionId\" value=\"".$this->iVersionId."\">";
|
||||
echo "</form>";
|
||||
} else
|
||||
{
|
||||
/* are we already a maintainer? */
|
||||
if($_SESSION['current']->isMaintainer($this->iVersionId)) /* yep */
|
||||
{
|
||||
echo '<form method="post" name="message" action="maintainerdelete.php">';
|
||||
echo '<input type="submit" value="Remove yourself as a maintainer" class=button>';
|
||||
echo '<input type="hidden" name="superMaintainer" value="0">';
|
||||
echo "<input type=hidden name=\"appId\" value=\"".$oApp->iAppId."\">";
|
||||
echo "<input type=hidden name=\"versionId\" value=\"".$this->iVersionId."\">";
|
||||
echo "</form>";
|
||||
} else /* nope */
|
||||
{
|
||||
echo '<form method="post" name="message" action="maintainersubmit.php">';
|
||||
echo '<input type="submit" value="Be a maintainer for this app" class="button" title="Click here to know more about maintainers.">';
|
||||
echo "<input type=hidden name=\"appId\" value=\"".$oApp->iAppId."\">";
|
||||
echo "<input type=hidden name=\"versionId\" value=\"".$this->iVersionId."\">";
|
||||
echo "</form>";
|
||||
$oMonitor = new Monitor();
|
||||
$oMonitor->find($_SESSION['current']->iUserId,
|
||||
$oApp->iAppId,$this->iVersionId);
|
||||
if(!$oMonitor->iMonitorId)
|
||||
{
|
||||
echo '<form method=post name=message action=appview.php?versionId='.$this->iVersionId.'&appId='.$oApp->iAppId.'>';
|
||||
echo '<input type=hidden name="sub" value="StartMonitoring" />';
|
||||
echo '<input type=submit value="Monitor Version" class="button" />';
|
||||
echo "</form>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
{
|
||||
echo '<form method="post" name="message" action="account.php">';
|
||||
echo '<input type="hidden" name="cmd" value="login">';
|
||||
echo '<input type=submit value="Log in to become an app maintainer" class="button">';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
if ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($this->iVersionId) || $_SESSION['current']->isSuperMaintainer($this->iAppId))
|
||||
{
|
||||
echo '<tr><td colspan="2" align="center">';
|
||||
echo '<form method="post" name="message" action="admin/editAppVersion.php">';
|
||||
echo '<input type="hidden" name="appId" value="'.$oApp->iAppId.'" />';
|
||||
echo '<input type="hidden" name="versionId" value="'.$this->iVersionId.'" />';
|
||||
echo '<input type=submit value="Edit Version" class="button" />';
|
||||
echo '</form>';
|
||||
$url = BASE."admin/deleteAny.php?what=appVersion&appId=".$oApp->iAppId."&versionId=".$this->iVersionId."&confirmed=yes";
|
||||
echo "<form method=\"post\" name=\"delete\" action=\"javascript:deleteURL('Are you sure?', '".$url."')\">";
|
||||
echo '<input type=submit value="Delete Version" class="button" />';
|
||||
echo '</form>';
|
||||
echo '<form method="post" name="message" action="admin/addAppNote.php">';
|
||||
echo '<input type="hidden" name="versionId" value="'.$this->iVersionId.'" />';
|
||||
echo '<input type="submit" value="Add Note" class="button" />';
|
||||
echo '</form>';
|
||||
echo '<form method=post name=message action=admin/addAppNote.php?versionId='.$this->iVersionId.'>';
|
||||
echo '<input type=hidden name="noteTitle" value="HOWTO" />';
|
||||
echo '<input type=submit value="Add How To" class="button" />';
|
||||
echo '</form>';
|
||||
echo '<form method=post name=message action=admin/addAppNote.php?versionId='.$this->iVersionId.'>';
|
||||
echo '<input type=hidden name="noteTitle" value="WARNING" />';
|
||||
echo '<input type=submit value="Add Warning" class="button" />';
|
||||
echo '</form>';
|
||||
echo "</td></tr>";
|
||||
}
|
||||
$oMonitor = new Monitor();
|
||||
$oMonitor->find($_SESSION['current']->iUserId, $oApp->iAppId, $this->iVersionId);
|
||||
if($oMonitor->iMonitorId)
|
||||
{
|
||||
echo '<tr><td colspan="2" align="center">';
|
||||
echo '</form>';
|
||||
echo '<form method=post name=message action=appview.php?versionId='.$this->iVersionId.'>';
|
||||
echo '<input type=hidden name="sub" value="StopMonitoring" />';
|
||||
echo '<input type=submit value="Stop Monitoring Version" class="button" />';
|
||||
echo '</form>';
|
||||
echo "</td></tr>";
|
||||
}
|
||||
echo "</table><td class=color2 valign=top width='100%'>\n";
|
||||
|
||||
// description
|
||||
echo "<table width='100%' border=0><tr><td width='100%' valign=top> <b>Description</b><br />\n";
|
||||
echo $this->sDescription;
|
||||
|
||||
// Show testing data
|
||||
$oTest = new TestData($_REQUEST['iTestingId']);
|
||||
$iCurrentTest = $oTest->ShowTestResult($oTest->iTestingId, $this->iVersionId);
|
||||
if($iCurrentTest)
|
||||
{
|
||||
$oTest->ShowVersionsTestingTable($this->iVersionId,
|
||||
$iCurrentTest,
|
||||
$_SERVER['PHP_SELF']."?versionId=".$this->iVersionId."&iTestingId=",
|
||||
5);
|
||||
}
|
||||
echo '<form method=post name=message action=testResults.php?sub=view&iVersionId='.$this->iVersionId.'>';
|
||||
echo '<input type=submit value="Add Testing Data" class="button" />';
|
||||
echo '</form>';
|
||||
|
||||
echo "</td></tr>";
|
||||
|
||||
/* close the table */
|
||||
echo "</table>\n";
|
||||
|
||||
echo html_frame_end();
|
||||
|
||||
view_version_bugs($this->iVersionId, $this->aBuglinkIds);
|
||||
|
||||
$rNotes = query_appdb("SELECT * FROM appNotes WHERE versionId = ".$this->iVersionId);
|
||||
|
||||
while( $oNote = mysql_fetch_object($rNotes) )
|
||||
{
|
||||
echo show_note($oNote->noteTitle,$oNote);
|
||||
}
|
||||
|
||||
// Comments Section
|
||||
view_app_comments($this->iVersionId);
|
||||
}
|
||||
}
|
||||
|
||||
function showVersionList($hResult)
|
||||
|
||||
Reference in New Issue
Block a user