diff --git a/include/appData.php b/include/appData.php
index 6165235..a310ad9 100644
--- a/include/appData.php
+++ b/include/appData.php
@@ -39,22 +39,17 @@ class appData
function listSubmittedBy($iUserId, $bQueued = true)
{
- $hResult = query_parameters("SELECT appData.TYPE, appData.appId,
- appData.versionId, appData.description, appData.submitTime,
- appFamily.appName, appVersion.versionName FROM appData,
- appFamily, appVersion
- WHERE (appFamily.appId = appData.appId OR
- (appData.versionId = appVersion.versionId AND appFamily.appId =
- appVersion.appId)) AND (appFamily.queued = '?' OR
- appVersion.queued = '?') AND appData.submitterId = '?' AND
+ $hResult = query_parameters("SELECT * FROM appData WHERE
+ appData.submitterId = '?'
+ AND
appData.queued = '?'
ORDER BY appData.id",
- "false", "false", $iUserId, $bQueued ? "true" : "false");
+ $iUserId, $bQueued ? "true" : "false");
if(!$hResult || !mysql_num_rows($hResult))
return false;
- $sReturn .= html_table_begin("width=\"100%\" align=\"center\"");
+ $sReturn = html_table_begin("width=\"100%\" align=\"center\"");
$sReturn .= html_tr(array(
"Version",
"Type",
@@ -64,13 +59,19 @@ class appData
for($i = 1; $oRow = mysql_fetch_object($hResult); $i++)
{
+ if($oRow->versionId)
+ {
+ $oVersion = new version($oRow->versionId);
+ $sLink = "objectMakeUrl()."\">".
+ $oVersion->fullName($oVersion->iVersionId)."";
+ } else
+ {
+ $oApp = new application($this->appId);
+ $sLink = $oApp->objectMakeLink();
+ }
$sReturn .= html_tr(array(
- $oRow->versionId ?
- "versionId\">".
- "$oRow->appName: $oRow->versionName" :
- "appId\">".
- "$oRow->appName",
- $oRow->TYPE,
+ $sLink,
+ $oRow->type,
$oRow->description,
print_date(mysqltimestamp_to_unixtimestamp($oRow->submitTime))),
($i % 2) ? "color0" : "color1");
@@ -79,6 +80,7 @@ class appData
$sReturn .= html_table_end("");
return $sReturn;
+
}
/* Get appData for a given version/application, optionally filter by type */
diff --git a/include/version.php b/include/version.php
index 10c8850..11738b9 100644
--- a/include/version.php
+++ b/include/version.php
@@ -1133,9 +1133,14 @@ class Version {
return FALSE;
}
+ function objectMakeUrl()
+ {
+ return BASE."appview.php?iVersionId=$this->iVersionId";
+ }
+
function objectMakeLink()
{
- $sLink = "iVersionId\">".
+ $sLink = "objectMakeUrl()."\">".
$this->sName."";
return $sLink;
}
diff --git a/unit_test/run_tests.php b/unit_test/run_tests.php
index 8b681bc..0536822 100644
--- a/unit_test/run_tests.php
+++ b/unit_test/run_tests.php
@@ -26,4 +26,6 @@ echo "\n";
include_once("test_url.php");
echo "\n";
include_once("test_om_objects.php");
+echo "\n";
+include_once("test_appData.php");
?>
diff --git a/unit_test/test_appData.php b/unit_test/test_appData.php
new file mode 100644
index 0000000..1cbf535
--- /dev/null
+++ b/unit_test/test_appData.php
@@ -0,0 +1,51 @@
+sUrl = "http://www.microsoft.com/windowsmedia";
+ $oDownloadUrl->sDescription = "Download Meida Player";
+ $oDownloadUrl->iVersionId = 1;
+
+ $oDownloadUrl->create();
+
+ $shReturn = appData::listSubmittedBy($oUser->iUserId, true);
+
+ /* There should be two lines; one header and one for the downloadurl */
+ $iExpected = 2;
+ $iReceived = substr_count($shReturn, "");
+ if($iExpected != $iReceived)
+ {
+ echo "Got $iReceived rows instead of $iExpected.\n";
+ return FALSE;
+ }
+
+ /* Clean up */
+ $oDownloadUrl->delete();
+ $oUser->delete();
+
+ return TRUE;
+}
+
+if(!test_appData_listSubmittedBy())
+ echo "test_appData_listSubmittedBy() failed!\n";
+else
+ echo "test_appData_listSubmittedBy() passed\n";
+
+?>