2005-01-12 16:22:55 +00:00
|
|
|
<?php
|
2004-12-11 22:33:01 +00:00
|
|
|
/*******************************************************************/
|
2005-01-10 22:15:44 +00:00
|
|
|
/* this script expects appId and optionally versionId as arguments */
|
2004-12-11 22:33:01 +00:00
|
|
|
/* OR */
|
|
|
|
|
/* cmd and imageId */
|
|
|
|
|
/*******************************************************************/
|
|
|
|
|
|
2004-12-25 20:08:00 +00:00
|
|
|
/*
|
2004-12-27 23:54:55 +00:00
|
|
|
* application environment
|
2004-12-25 20:08:00 +00:00
|
|
|
*/
|
2004-03-15 16:22:00 +00:00
|
|
|
include("path.php");
|
2005-01-30 00:57:34 +00:00
|
|
|
require(BASE."include/incl.php");
|
|
|
|
|
require(BASE."include/screenshot.php");
|
|
|
|
|
require(BASE."include/application.php");
|
|
|
|
|
require(BASE."include/mail.php");
|
|
|
|
|
|
2004-12-25 20:08:00 +00:00
|
|
|
|
2005-02-04 02:55:50 +00:00
|
|
|
/*
|
|
|
|
|
* We issued a command.
|
|
|
|
|
*/
|
2004-12-14 02:26:38 +00:00
|
|
|
if($_REQUEST['cmd'])
|
2004-03-15 16:22:00 +00:00
|
|
|
{
|
2005-02-04 02:55:50 +00:00
|
|
|
// process screenshot upload
|
2004-12-14 02:26:38 +00:00
|
|
|
if($_REQUEST['cmd'] == "screenshot_upload")
|
2004-12-18 06:06:46 +00:00
|
|
|
{
|
2005-02-04 02:55:50 +00:00
|
|
|
$oScreenshot = new Screenshot();
|
|
|
|
|
$oScreenshot->create($_REQUEST['versionId'], $_REQUEST['screenshot_desc'], $_FILES['imagefile']);
|
2005-01-27 15:42:53 +00:00
|
|
|
$oScreenshot->free();
|
2005-02-04 02:55:50 +00:00
|
|
|
} elseif($_REQUEST['cmd'] == "delete" && is_numeric($_REQUEST['imageId'])) // process screenshot deletion
|
2004-12-11 22:33:01 +00:00
|
|
|
{
|
2005-02-04 02:55:50 +00:00
|
|
|
$oScreenshot = new Screenshot($_REQUEST['imageId']);
|
|
|
|
|
$oScreenshot->delete();
|
|
|
|
|
$oScreenshot->free();
|
2004-12-18 06:06:46 +00:00
|
|
|
}
|
2005-02-04 02:55:50 +00:00
|
|
|
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
|
2004-03-15 16:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
2005-02-04 02:55:50 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* We didn't issued any command.
|
|
|
|
|
*/
|
|
|
|
|
$hResult = get_screenshots($_REQUEST['appId'], $_REQUEST['versionId']);
|
2004-12-18 06:06:46 +00:00
|
|
|
apidb_header("Screenshots");
|
2005-02-07 23:21:33 +00:00
|
|
|
$oApp = new Application($_REQUEST['appId']);
|
|
|
|
|
$oVersion = new Version($_REQUEST['versionId']);
|
|
|
|
|
|
2005-02-04 02:55:50 +00:00
|
|
|
if($hResult && mysql_num_rows($hResult))
|
2004-03-15 16:22:00 +00:00
|
|
|
{
|
2005-02-07 23:21:33 +00:00
|
|
|
echo html_frame_start("Screenshot Gallery for ".$oApp->sName." ".$oVersion->sName,500);
|
2004-11-17 22:57:20 +00:00
|
|
|
|
2004-12-18 06:06:46 +00:00
|
|
|
// display thumbnails
|
|
|
|
|
$c = 1;
|
|
|
|
|
echo "<div align=center><table><tr>\n";
|
2005-02-04 02:55:50 +00:00
|
|
|
while($oRow = mysql_fetch_object($hResult))
|
2004-12-18 06:06:46 +00:00
|
|
|
{
|
2005-02-04 02:55:50 +00:00
|
|
|
if(!$_REQUEST['versionId'] && $oRow->versionId != $currentVersionId)
|
2004-11-17 22:57:20 +00:00
|
|
|
{
|
2004-12-18 06:06:46 +00:00
|
|
|
if($currentVersionId)
|
2004-12-11 22:33:01 +00:00
|
|
|
{
|
2004-12-18 06:06:46 +00:00
|
|
|
echo "</tr></table></div>\n";
|
|
|
|
|
echo html_frame_end();
|
|
|
|
|
$c=1;
|
2004-12-11 22:33:01 +00:00
|
|
|
}
|
2005-02-04 02:55:50 +00:00
|
|
|
$currentVersionId=$oRow->versionId;
|
|
|
|
|
echo html_frame_start("Version ".lookup_version_name($currentVersionId));
|
2004-12-18 06:06:46 +00:00
|
|
|
echo "<div align=center><table><tr>\n";
|
|
|
|
|
}
|
2005-02-04 02:55:50 +00:00
|
|
|
$oScreenshot = new Screenshot($oRow->id);
|
2004-12-18 06:06:46 +00:00
|
|
|
// generate random tag for popup window
|
|
|
|
|
$randName = generate_passwd(5);
|
2005-01-27 15:42:53 +00:00
|
|
|
// set img tag
|
2005-02-04 02:55:50 +00:00
|
|
|
$imgSRC = '<img src="appimage.php?thumbnail=true&id='.$oRow->id.'" alt="'.$oScreenshot->description.'" width="'.$oScreenshot->oThumnailImage->width.'" height="'.$oScreenshot->oThumnailImage->height.'">';
|
2004-12-11 22:33:01 +00:00
|
|
|
|
2004-12-18 06:06:46 +00:00
|
|
|
// set image link based on user pref
|
2005-06-28 02:07:06 +00:00
|
|
|
$img = '<a href="appimage.php?id='.$oRow->id.'" onclick="javascript:openWin(\'appimage.php?id='.$oRow->id.'\',\''.$randName.'\','.$oScreenshot->oScreenshotImage->width.','.($oScreenshot->oScreenshotImage->height+4).');return false;">'.$imgSRC.'</a>';
|
2005-01-30 23:12:48 +00:00
|
|
|
if ($_SESSION['current']->isLoggedIn())
|
2004-12-18 06:06:46 +00:00
|
|
|
{
|
|
|
|
|
if ($_SESSION['current']->getpref("window:screenshot") == "no")
|
2004-12-11 22:33:01 +00:00
|
|
|
{
|
2005-02-04 02:55:50 +00:00
|
|
|
$img = '<a href="appimage.php?imageId='.$oRow->id.'">'.$imgSRC.'</a>';
|
2004-12-11 22:33:01 +00:00
|
|
|
}
|
2004-12-18 06:06:46 +00:00
|
|
|
}
|
2004-12-11 22:33:01 +00:00
|
|
|
|
2004-12-18 06:06:46 +00:00
|
|
|
// display image
|
|
|
|
|
echo "<td>\n";
|
|
|
|
|
echo $img;
|
2005-02-04 02:55:50 +00:00
|
|
|
echo "<div align=center>". substr($oRow->description,0,20). "\n";
|
2005-01-30 22:38:44 +00:00
|
|
|
|
2004-12-18 06:06:46 +00:00
|
|
|
//show admin delete link
|
2005-01-30 23:12:48 +00:00
|
|
|
if($_SESSION['current']->isLoggedIn() && ($_SESSION['current']->hasPriv("admin") ||
|
2005-02-04 02:55:50 +00:00
|
|
|
$_SESSION['current']->isMaintainer($_REQUEST['versionId'])))
|
2004-12-18 06:06:46 +00:00
|
|
|
{
|
2005-02-04 02:55:50 +00:00
|
|
|
echo "<br />[<a href='screenshots.php?cmd=delete&imageId=$oRow->id&appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."'>Delete Image</a>]";
|
2004-12-18 06:06:46 +00:00
|
|
|
}
|
2004-12-11 22:33:01 +00:00
|
|
|
|
2005-01-30 22:38:44 +00:00
|
|
|
echo "</div></td>\n";
|
2004-12-11 22:33:01 +00:00
|
|
|
|
2004-12-18 06:06:46 +00:00
|
|
|
// end row if counter of 3
|
|
|
|
|
if ($c % 3 == 0) echo "</tr><tr>\n";
|
2004-03-15 16:22:00 +00:00
|
|
|
|
2004-12-18 06:06:46 +00:00
|
|
|
$c++;
|
2004-11-17 22:57:20 +00:00
|
|
|
}
|
2004-12-29 20:21:31 +00:00
|
|
|
echo "</tr></table></div><br />\n";
|
2004-12-18 06:06:46 +00:00
|
|
|
|
|
|
|
|
echo html_frame_end("Click thumbnail to view image in new window.");
|
|
|
|
|
} else {
|
|
|
|
|
echo "<p align=\"center\">There are currently no screenshot for the selected version of this application.";
|
|
|
|
|
echo "<br />Please consider submitting a screenshot for the selected version yourself.</p>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($_REQUEST['versionId'])
|
|
|
|
|
{
|
|
|
|
|
//image upload box
|
2005-02-04 02:55:50 +00:00
|
|
|
echo '<form enctype="multipart/form-data" action="screenshots.php" name="imageForm" method="post">',"\n";
|
2004-12-18 06:06:46 +00:00
|
|
|
echo html_frame_start("Upload Screenshot","400","",0);
|
|
|
|
|
echo '<table border=0 cellpadding=6 cellspacing=0 width="100%">',"\n";
|
2004-11-17 22:57:20 +00:00
|
|
|
|
2005-01-31 01:42:08 +00:00
|
|
|
echo '<tr><td class=color1>Image</td><td class=color0><input name="imagefile" type="file" size="24"></td></tr>',"\n";
|
|
|
|
|
echo '<tr><td class="color1">Description</td><td class="color0"><input type="text" name="screenshot_desc" maxlength="20" size="24"></td></tr>',"\n";
|
2004-11-17 22:57:20 +00:00
|
|
|
|
2004-12-18 06:06:46 +00:00
|
|
|
echo '<tr><td colspan=2 align=center class=color3><input type="submit" value="Send File"></td></tr>',"\n";
|
2004-11-17 22:57:20 +00:00
|
|
|
|
2004-12-18 06:06:46 +00:00
|
|
|
echo '</table>',"\n";
|
|
|
|
|
echo html_frame_end();
|
|
|
|
|
echo '<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />',"\n";
|
|
|
|
|
echo '<input type="hidden" name="cmd" value="screenshot_upload" />',"\n";
|
|
|
|
|
echo '<input type="hidden" name="versionId" value="'.$_REQUEST['versionId'].'"></form />',"\n";
|
2004-03-15 16:22:00 +00:00
|
|
|
}
|
2004-12-18 06:06:46 +00:00
|
|
|
echo html_back_link(1);
|
|
|
|
|
apidb_footer();
|
2004-03-15 16:22:00 +00:00
|
|
|
?>
|