Clean up application and version classes. Move class related functions into the class as static member functions

This commit is contained in:
Chris Morgan
2006-06-29 16:07:19 +00:00
committed by WineHQ
parent 245a6b993e
commit 034ea689bc
17 changed files with 138 additions and 138 deletions

View File

@@ -73,8 +73,8 @@ if (!$aClean['id'])
echo $oUser->sRealname; echo $oUser->sRealname;
echo $oUser->sEmail ? "</a>":""; echo $oUser->sEmail ? "</a>":"";
echo "</td>\n"; echo "</td>\n";
echo "<td>".lookup_app_name($ob->appId)."</td>\n"; echo "<td>".Application::lookup_name($ob->appId)."</td>\n";
echo "<td>".lookup_version_name($ob->versionId)."</td>\n"; echo "<td>".Version::lookup_name($ob->versionId)."</td>\n";
echo "<td>".$ob->type."</td>\n"; echo "<td>".$ob->type."</td>\n";
echo "<td align=\"center\">[<a href='adminAppDataQueue.php?id=$ob->id'>process</a>]</td>\n"; echo "<td align=\"center\">[<a href='adminAppDataQueue.php?id=$ob->id'>process</a>]</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";
@@ -105,11 +105,11 @@ if (!$aClean['id'])
// app name // app name
echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n"; echo '<tr valign=top><td class=color0><b>App Name</b></td>',"\n";
echo "<td>".lookup_app_name($obj_row->appId)."</td></tr>\n"; echo "<td>".Application::lookup_name($obj_row->appId)."</td></tr>\n";
// version // version
echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n"; echo '<tr valign=top><td class=color0><b>App Version</b></td>',"\n";
echo "<td>".lookup_version_name($obj_row->versionId)."</td></tr>\n"; echo "<td>".Version::lookup_name($obj_row->versionId)."</td></tr>\n";
//dataDescription //dataDescription
echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n"; echo '<tr valign=top><td class=color0><b>Description</b></td>',"\n";
@@ -185,7 +185,7 @@ if (!$aClean['id'])
if ($oUser->sEmail) if ($oUser->sEmail)
{ {
$sSubject = "Application Data Request Report"; $sSubject = "Application Data Request Report";
$sMsg = "Your submission of an application data for ".lookup_app_name($obj_row->appId).lookup_version_name($obj_row->versionId)." has been accepted. "; $sMsg = "Your submission of an application data for ".Application::lookup_name($obj_row->appId).Version::lookup_name($obj_row->versionId)." has been accepted. ";
$sMsg .= $aClean['replyText']; $sMsg .= $aClean['replyText'];
$sMsg .= "We appreciate your help in making the Application Database better for all users.\r\n"; $sMsg .= "We appreciate your help in making the Application Database better for all users.\r\n";
@@ -207,7 +207,7 @@ if (!$aClean['id'])
if ($oUser->sEmail) if ($oUser->sEmail)
{ {
$sSubject = "Application Data Request Report"; $sSubject = "Application Data Request Report";
$sMsg = "Your submission of an application data for ".lookup_app_name($obj_row->appId).lookup_version_name($obj_row->versionId)." was rejected. "; $sMsg = "Your submission of an application data for ".Application::lookup_name($obj_row->appId).Version::lookup_name($obj_row->versionId)." was rejected. ";
$sMsg .= $aClean['replyText']; $sMsg .= $aClean['replyText'];
mail_appdb($oUser->sEmail, $sSubject ,$sMsg); mail_appdb($oUser->sEmail, $sSubject ,$sMsg);
} }

View File

@@ -115,7 +115,7 @@ function display_move_test_to_versions_table($aVersionsIds,$icurrentVersionId)
echo "<tr class=$bgcolor>\n"; echo "<tr class=$bgcolor>\n";
echo " <td>".html_ahref($oVersion->sName,"adminAppQueue.php?sub=movetest&apptype=version&versionId=".$icurrentVersionId."&versionIdMergeTo=".$oVersion->iVersionId)."</td>\n"; echo " <td>".html_ahref($oVersion->sName,"adminAppQueue.php?sub=movetest&apptype=version&versionId=".$icurrentVersionId."&versionIdMergeTo=".$oVersion->iVersionId)."</td>\n";
echo " <td>".trim_description($oVersion->sDescription)."</td>\n"; echo " <td>".util_trim_description($oVersion->sDescription)."</td>\n";
echo " <td align=center>".$oVersion->sTestedRating."</td>\n"; echo " <td align=center>".$oVersion->sTestedRating."</td>\n";
echo " <td align=center>".$oVersion->sTestedRelease."</td>\n"; echo " <td align=center>".$oVersion->sTestedRelease."</td>\n";
echo " <td align=center>".sizeof($oVersion->aCommentsIds)."</td>\n"; echo " <td align=center>".sizeof($oVersion->aCommentsIds)."</td>\n";
@@ -302,7 +302,7 @@ if ($aClean['sub'])
{ {
echo html_frame_start("Potential duplicate versions in the database","90%","",0); echo html_frame_start("Potential duplicate versions in the database","90%","",0);
$oAppForVersion = new Application($oVersion->iAppId); $oAppForVersion = new Application($oVersion->iAppId);
display_approved_versions($oAppForVersion->aVersionsIds); Version::display_approved($oAppForVersion->aVersionsIds);
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
echo html_frame_start("Move test to version","90%","",0); echo html_frame_start("Move test to version","90%","",0);
@@ -456,7 +456,7 @@ else /* if ($aClean['sub']) is not defined, display the main app queue page */
echo "</td></tr></table></div>\n\n"; echo "</td></tr></table></div>\n\n";
//show applist //show applist
showAppList($hResult); Application::showList($hResult);
} }
@@ -482,7 +482,7 @@ else /* if ($aClean['sub']) is not defined, display the main app queue page */
echo "</td></tr></table></div>\n\n"; echo "</td></tr></table></div>\n\n";
//show version list //show version list
showVersionList($hResult); Version::showList($hResult);
} }
} }

View File

@@ -115,12 +115,12 @@ if ($aClean['sub'])
echo " <td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n"; echo " <td><a href=\"mailto:".$oUser->sEmail."\">".$oUser->sRealname."</a></td>\n";
if($ob->superMaintainer) if($ob->superMaintainer)
{ {
echo " <td><a href='".BASE."appview.php?appId=$ob->appId'>".lookup_app_name($ob->appId)."</a></td>\n"; echo " <td><a href='".BASE."appview.php?appId=$ob->appId'>".Application::lookup_name($ob->appId)."</a></td>\n";
echo " <td>*</td>\n"; echo " <td>*</td>\n";
} else } else
{ {
echo " <td><a href='".BASE."appview.php?appId=$ob->appId'>".lookup_app_name($ob->appId)."</a></td>\n"; echo " <td><a href='".BASE."appview.php?appId=$ob->appId'>".Application::lookup_name($ob->appId)."</a></td>\n";
echo " <td><a href='".BASE."appview.php?versionId=$ob->versionId'>".lookup_version_name($ob->versionId)."</a>&nbsp;</td>\n"; echo " <td><a href='".BASE."appview.php?versionId=$ob->versionId'>".Version::lookup_name($ob->versionId)."</a>&nbsp;</td>\n";
} }
echo " <td align=\"center\">[<a href='adminMaintainers.php?sub=delete&maintainerId=$ob->maintainerId'>delete</a>]</td>\n"; echo " <td align=\"center\">[<a href='adminMaintainers.php?sub=delete&maintainerId=$ob->maintainerId'>delete</a>]</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";

View File

@@ -115,7 +115,7 @@ if($apps)
$bgcolor = ($i % 2) ? "color0" : "color1"; $bgcolor = ($i % 2) ? "color0" : "color1";
//format desc //format desc
$desc = trim_description($oApp->sDescription); $desc = util_trim_description($oApp->sDescription);
//display row //display row
echo "<tr class=$bgcolor>\n"; echo "<tr class=$bgcolor>\n";

View File

@@ -317,7 +317,7 @@ if ($aClean['sub'])
{ {
$oAppForVersion = new Application($oVersion->iAppId); $oAppForVersion = new Application($oVersion->iAppId);
echo html_frame_start("Potential duplicate versions in the database for application: ".$oAppForVersion->sName,"90%","",0); echo html_frame_start("Potential duplicate versions in the database for application: ".$oAppForVersion->sName,"90%","",0);
display_approved_versions($oAppForVersion->aVersionsIds); Version::display_approved($oAppForVersion->aVersionsIds);
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
//help //help
@@ -421,7 +421,7 @@ else // if ($aClean['sub']) is not defined, display the main app queue page
echo "</td></tr></table></div>\n\n"; echo "</td></tr></table></div>\n\n";
//show applist //show applist
showAppList($hResult); Application::showList($hResult);
} }
// get queued versions (only versions where application are not queued already) // get queued versions (only versions where application are not queued already)

View File

@@ -72,7 +72,7 @@ function display_bundle($iAppId)
//display row //display row
echo "<tr class=\"$bgcolor\">\n"; echo "<tr class=\"$bgcolor\">\n";
echo " <td><a href=\"appview.php?appId=$ob->appId\">".stripslashes($ob->appName)."</a></td>\n"; echo " <td><a href=\"appview.php?appId=$ob->appId\">".stripslashes($ob->appName)."</a></td>\n";
echo " <td>".trim_description($oApp->sDescription)."</td>\n"; echo " <td>".util_trim_description($oApp->sDescription)."</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";
$c++; $c++;

View File

@@ -657,31 +657,13 @@ class Application {
echo html_frame_end("For more details and user comments, view the versions of this application."); echo html_frame_end("For more details and user comments, view the versions of this application.");
// display versions // display versions
display_approved_versions($this->aVersionsIds); Version::display_approved($this->aVersionsIds);
// display bundle // display bundle
display_bundle($this->iAppId); display_bundle($this->iAppId);
} }
}
function lookup_name($appId)
/*
* Application functions that are not part of the class
*/
function lookup_version_name($versionId)
{
if(!$versionId) return null;
$result = query_parameters("SELECT versionName FROM appVersion WHERE versionId = '?'",
$versionId);
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
return $ob->versionName;
}
function lookup_app_name($appId)
{ {
if(!$appId) return null; if(!$appId) return null;
$result = query_parameters("SELECT appName FROM appFamily WHERE appId = '?'", $result = query_parameters("SELECT appName FROM appFamily WHERE appId = '?'",
@@ -692,29 +674,7 @@ function lookup_app_name($appId)
return $ob->appName; return $ob->appName;
} }
function showList($hResult)
/**
* Remove html formatting from description and extract the first part of the description only.
* This is to be used for search results, application summary tables, etc.
*/
function trim_description($sDescription)
{
// 1) let's take the first line of the description:
$aDesc = explode("\n",trim($sDescription),2);
// 2) maybe it's an html description and lines are separated with <br> or </p><p>
$aDesc = explode("<br>",$aDesc[0],2);
$aDesc = explode("<br />",$aDesc[0],2);
$aDesc = explode("</p><p>",$aDesc[0],2);
$aDesc = explode("</p><p /><p>",$aDesc[0],2);
return trim(strip_tags($aDesc[0]));
}
function GetDefaultApplicationDescription()
{
return "<p>Enter a description of the application here</p>";
}
function showAppList($hResult)
{ {
//show applist //show applist
echo html_frame_start("","90%","",0); echo html_frame_start("","90%","",0);
@@ -757,4 +717,6 @@ function showAppList($hResult)
echo "</table>\n\n"; echo "</table>\n\n";
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
} }
}
?> ?>

View File

@@ -198,14 +198,15 @@ class Bug {
if($this->iSubmitterId) if($this->iSubmitterId)
{ {
$oSubmitter = new User($this->iSubmitterId); $oSubmitter = new User($this->iSubmitterId);
$sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
if(!$bRejected) if(!$bRejected)
{ {
$sSubject = "Submitted Bug Link accepted"; $sSubject = "Submitted Bug Link accepted";
$sMsg = "The Bug Link you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been accepted."; $sMsg = "The Bug Link you submitted for ".$sAppName." has been accepted.";
} else } else
{ {
$sSubject = "Submitted Bug Link rejected"; $sSubject = "Submitted Bug Link rejected";
$sMsg = "The Bug Link you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been rejected."; $sMsg = "The Bug Link you submitted for ".$sAppName." has been rejected.";
} }
$sMsg .= $aClean['replyText']."\n"; $sMsg .= $aClean['replyText']."\n";
$sMsg .= "We appreciate your help in making the Application Database better for all users."; $sMsg .= "We appreciate your help in making the Application Database better for all users.";
@@ -217,11 +218,12 @@ class Bug {
function SendNotificationMail($bDeleted=false) function SendNotificationMail($bDeleted=false)
{ {
$sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
if(!$bDeleted) if(!$bDeleted)
{ {
if(!$this->bQueued) if(!$this->bQueued)
{ {
$sSubject = "Link between Bug ".$this->iBug_id." and ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname; $sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
if($this->iSubmitterId) if($this->iSubmitterId)
{ {
@@ -232,7 +234,7 @@ class Bug {
addmsg("The Bug Link was successfully added into the database.", "green"); addmsg("The Bug Link was successfully added into the database.", "green");
} else // Bug Link queued. } else // Bug Link queued.
{ {
$sSubject = "Link between Bug ".$this->iBug_id." and ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." submitted by ".$_SESSION['current']->sRealname; $sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." submitted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
$sMsg .= "This Bug Link has been queued."; $sMsg .= "This Bug Link has been queued.";
$sMsg .= "\n"; $sMsg .= "\n";
@@ -240,7 +242,7 @@ class Bug {
} }
} else // Bug Link deleted. } else // Bug Link deleted.
{ {
$sSubject = "Link between Bug ".$this->iBug_id." and ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname; $sSubject = "Link between Bug ".$this->iBug_id." and ".$sAppName." deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("Bug Link deleted.", "green"); addmsg("Bug Link deleted.", "green");
} }

View File

@@ -84,7 +84,7 @@ class Comment {
$sEmail.="$value "; $sEmail.="$value ";
} }
$sSubject = "Comment for '".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)."' added by ".$_SESSION['current']->sRealname; $sSubject = "Comment for '".Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId)."' added by ".$_SESSION['current']->sRealname;
$sMsg = "To reply to this email please use the link provided below.\n"; $sMsg = "To reply to this email please use the link provided below.\n";
$sMsg .= "DO NOT reply via your email client as it will not reach the person who wrote the comment\n"; $sMsg .= "DO NOT reply via your email client as it will not reach the person who wrote the comment\n";
$sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."&mode=nested#Comment-".$this->iCommentId."\n"; $sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."&mode=nested#Comment-".$this->iCommentId."\n";
@@ -165,7 +165,7 @@ class Comment {
$sEmail .= $this->oOwner->sEmail; $sEmail .= $this->oOwner->sEmail;
if($sEmail) if($sEmail)
{ {
$sSubject = "Comment for '".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)."' deleted by ".$_SESSION['current']->sRealname; $sSubject = "Comment for '".Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId)."' deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
$sMsg .= "\n"; $sMsg .= "\n";
$sMsg .= "This comment was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n"; $sMsg .= "This comment was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n";

View File

@@ -93,19 +93,25 @@ class Monitor {
function SendNotificationMail($sAction="add",$sMsg=null) function SendNotificationMail($sAction="add",$sMsg=null)
{ {
/* set $aAppName appropriately */
if(isset($this->iVersionId))
$sAppName = Application::lookup_name($oVersion->iAppId)." ".Version::lookup_name($this->iVersionId);
else
$sAppName = Application::lookup_name($oVersion->iAppId);
switch($sAction) switch($sAction)
{ {
case "add": case "add":
if (isset($this->iVersionId)) if (isset($this->iVersionId))
{ {
$oVersion = new Version($this->iVersionId); $oVersion = new Version($this->iVersionId);
$sSubject = "Monitor for ".lookup_app_name($oVersion->iAppId)." ".lookup_version_name($this->iVersionId); $sSubject = "Monitor for ".$sAppName;
$sSubject .= " added: ".$_SESSION['current']->sRealname; $sSubject .= " added: ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("You will now recieve an email whenever changes are made to this Application version.", "green"); addmsg("You will now recieve an email whenever changes are made to this Application version.", "green");
} else } else
{ {
$sSubject = "Monitor for ".lookup_app_name($this->iAppId)." added: ".$_SESSION['current']->sRealname; $sSubject = "Monitor for ".$sAppName." added: ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?appId=".$this->iAppid."\n"; $sMsg .= APPDB_ROOT."appview.php?appId=".$this->iAppid."\n";
addmsg("You will now recieve an email whenever changes are made to this Application.", "green"); addmsg("You will now recieve an email whenever changes are made to this Application.", "green");
} }
@@ -114,13 +120,13 @@ class Monitor {
if (isset($this->iVersionId)) if (isset($this->iVersionId))
{ {
$oVersion = new Version($this->iVersionId); $oVersion = new Version($this->iVersionId);
$sSubject = "Monitor for ".lookup_app_name($oVersion->iAppId)." ".lookup_version_name($this->iVersionId); $sSubject = "Monitor for ".$sAppName;
$sSubject .= " removed: ".$_SESSION['current']->sRealname; $sSubject .= " removed: ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("You will no longer recieve an email whenever changes are made to this Application version.", "green"); addmsg("You will no longer recieve an email whenever changes are made to this Application version.", "green");
} else } else
{ {
$sSubject = "Monitor for ".lookup_app_name($this->iAppId)." removed: ".$_SESSION['current']->sRealname; $sSubject = "Monitor for ".$sAppName." removed: ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?appId=".$this->iAppid."\n"; $sMsg .= APPDB_ROOT."appview.php?appId=".$this->iAppid."\n";
addmsg("You will no longer recieve an email whenever changes are made to this Application.", "green"); addmsg("You will no longer recieve an email whenever changes are made to this Application.", "green");
} }

View File

@@ -125,19 +125,20 @@ class Note {
function SendNotificationMail($sAction="add",$sMsg=null) function SendNotificationMail($sAction="add",$sMsg=null)
{ {
$sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
switch($sAction) switch($sAction)
{ {
case "add": case "add":
$sSubject = "Note ".$this->sTitle." for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname; $sSubject = "Note ".$this->sTitle." for ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg .= APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("The note was successfully added into the database.", "green"); addmsg("The note was successfully added into the database.", "green");
break; break;
case "edit": case "edit":
$sSubject = "Note ".$this->sTitle." for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been modified by ".$_SESSION['current']->sRealname; $sSubject = "Note ".$this->sTitle." for ".$sAppName." has been modified by ".$_SESSION['current']->sRealname;
addmsg("Note modified.", "green"); addmsg("Note modified.", "green");
break; break;
case "delete": case "delete":
$sSubject = "Note ".$this->sTitle." for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been deleted by ".$_SESSION['current']->sRealname; $sSubject = "Note ".$this->sTitle." for ".$sAppName." has been deleted by ".$_SESSION['current']->sRealname;
$sMsg .= "This note was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n"; $sMsg .= "This note was made on ".substr($this->sDateCreated,0,10)." by ".$this->oOwner->sRealname."\n";
$sMsg .= "\n"; $sMsg .= "\n";
$sMsg .= "Subject: ".$this->sTitle."\n"; $sMsg .= "Subject: ".$this->sTitle."\n";

View File

@@ -240,15 +240,16 @@ class Screenshot {
if($this->iSubmitterId) if($this->iSubmitterId)
{ {
$sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
$oSubmitter = new User($this->iSubmitterId); $oSubmitter = new User($this->iSubmitterId);
if(!$bRejected) if(!$bRejected)
{ {
$sSubject = "Submitted screenshot accepted"; $sSubject = "Submitted screenshot accepted";
$sMsg = "The screenshot you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been accepted."; $sMsg = "The screenshot you submitted for ".$sAppName." has been accepted.";
} else } else
{ {
$sSubject = "Submitted screenshot rejected"; $sSubject = "Submitted screenshot rejected";
$sMsg = "The screenshot you submitted for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." has been rejected."; $sMsg = "The screenshot you submitted for ".$sAppName." has been rejected.";
} }
$sMsg .= $aClean['replyText']."\n"; $sMsg .= $aClean['replyText']."\n";
$sMsg .= "We appreciate your help in making the Application Database better for all users."; $sMsg .= "We appreciate your help in making the Application Database better for all users.";
@@ -260,11 +261,12 @@ class Screenshot {
function mailMaintainers($bDeleted=false) function mailMaintainers($bDeleted=false)
{ {
$sAppName = Application::lookup_name($this->iAppId)." ".Version::lookup_name($this->iVersionId);
if(!$bDeleted) if(!$bDeleted)
{ {
if(!$this->bQueued) if(!$this->bQueued)
{ {
$sSubject = "Screenshot for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname; $sSubject = "Screenshot for ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
if($this->iSubmitterId) if($this->iSubmitterId)
{ {
@@ -275,7 +277,7 @@ class Screenshot {
addmsg("The screenshot was successfully added into the database.", "green"); addmsg("The screenshot was successfully added into the database.", "green");
} else // Screenshot queued. } else // Screenshot queued.
{ {
$sSubject = "Screenshot for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." submitted by ".$_SESSION['current']->sRealname; $sSubject = "Screenshot for ".$sAppName." submitted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
$sMsg .= "This screenshot has been queued."; $sMsg .= "This screenshot has been queued.";
$sMsg .= "\n"; $sMsg .= "\n";
@@ -283,7 +285,7 @@ class Screenshot {
} }
} else // Screenshot deleted. } else // Screenshot deleted.
{ {
$sSubject = "Screenshot for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname; $sSubject = "Screenshot for ".$sAppName." deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("Screenshot deleted.", "green"); addmsg("Screenshot deleted.", "green");
} }

View File

@@ -27,9 +27,9 @@ function global_sidebar_login() {
while(list($index, list($appId, $versionId, $superMaintainer)) = each($apps_user_maintains)) while(list($index, list($appId, $versionId, $superMaintainer)) = each($apps_user_maintains))
{ {
if($superMaintainer) if($superMaintainer)
$g->addmisc("<a href='".BASE."appview.php?appId=$appId'>".lookup_app_name($appId)."*</a>", "center"); $g->addmisc("<a href='".BASE."appview.php?appId=$appId'>".Application::lookup_name($appId)."*</a>", "center");
else else
$g->addmisc("<a href='".BASE."appview.php?versionId=$versionId'>".lookup_app_name($appId)." ".lookup_version_name($versionId)."</a>", "center"); $g->addmisc("<a href='".BASE."appview.php?versionId=$versionId'>".Application::lookup_name($appId)." ".Version::lookup_name($versionId)."</a>", "center");
} }
} }
$appsRejected = $_SESSION['current']->getAllRejectedApps(); $appsRejected = $_SESSION['current']->getAllRejectedApps();

View File

@@ -185,15 +185,16 @@ class Url {
$aClean['replyText'] = makeSafe($_REQUEST['replyText']); $aClean['replyText'] = makeSafe($_REQUEST['replyText']);
if($this->iSubmitterId) if($this->iSubmitterId)
{ {
$sAppName = Application::lookup_name($this->appId)." ".Version::lookup_name($this->versionId);
$oSubmitter = new User($this->iSubmitterId); $oSubmitter = new User($this->iSubmitterId);
if(!$bRejected) if(!$bRejected)
{ {
$sSubject = "Submitted url accepted"; $sSubject = "Submitted url accepted";
$sMsg = "The url you submitted for ".lookup_app_name($this->appId)." ".lookup_version_name($this->versionId)." has been accepted."; $sMsg = "The url you submitted for ".$sAppName." has been accepted.";
} else } else
{ {
$sSubject = "Submitted url rejected"; $sSubject = "Submitted url rejected";
$sMsg = "The url you submitted for ".lookup_app_name($this->appId)." ".lookup_version_name($this->versionId)." has been rejected."; $sMsg = "The url you submitted for ".$sAppName." has been rejected.";
} }
$sMsg .= $aClean['replyText']."\n"; $sMsg .= $aClean['replyText']."\n";
$sMsg .= "We appreciate your help in making the Application Database better for all users."; $sMsg .= "We appreciate your help in making the Application Database better for all users.";
@@ -205,11 +206,12 @@ class Url {
function SendNotificationMail($bDeleted=false) function SendNotificationMail($bDeleted=false)
{ {
$sAppName = Application::lookup_name($this->appId)." ".Version::lookup_name($this->versionId);
if(!$bDeleted) if(!$bDeleted)
{ {
if(!$this->bQueued) if(!$this->bQueued)
{ {
$sSubject = "Url for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." added by ".$_SESSION['current']->sRealname; $sSubject = "Url for ".$sAppName." added by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
if($this->iSubmitterId) if($this->iSubmitterId)
{ {
@@ -220,7 +222,7 @@ class Url {
addmsg("The url was successfully added into the database.", "green"); addmsg("The url was successfully added into the database.", "green");
} else // Url queued. } else // Url queued.
{ {
$sSubject = "Url for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." submitted by ".$_SESSION['current']->sRealname; $sSubject = "Url for ".$sAppName." submitted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
$sMsg .= "This url has been queued."; $sMsg .= "This url has been queued.";
$sMsg .= "\n"; $sMsg .= "\n";
@@ -228,7 +230,7 @@ class Url {
} }
} else // Url deleted. } else // Url deleted.
{ {
$sSubject = "Url for ".lookup_app_name($this->iAppId)." ".lookup_version_name($this->iVersionId)." deleted by ".$_SESSION['current']->sRealname; $sSubject = "Url for ".$sAppName." deleted by ".$_SESSION['current']->sRealname;
$sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n"; $sMsg = APPDB_ROOT."appview.php?versionId=".$this->iVersionId."\n";
addmsg("Url deleted.", "green"); addmsg("Url deleted.", "green");
} }

View File

@@ -271,7 +271,7 @@ function outputTopXRow($oRow)
echo ' echo '
<tr class="white"> <tr class="white">
<td class="app_name"><a href="appview.php?versionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td> <td class="app_name"><a href="appview.php?versionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td>
<td>'.trim_description($oApp->sDescription).'</td> <td>'.util_trim_description($oApp->sDescription).'</td>
<td><center>'.$img.'</center></td> <td><center>'.$img.'</center></td>
</tr>'; </tr>';
} }
@@ -542,7 +542,7 @@ function outputSearchTableForhResult($search_words, $hResult)
//display row //display row
echo "<tr class=$bgcolor>\n"; echo "<tr class=$bgcolor>\n";
echo " <td>".html_ahref($oRow->appName,BASE."appview.php?appId=$oRow->appId")."</td>\n"; echo " <td>".html_ahref($oRow->appName,BASE."appview.php?appId=$oRow->appId")."</td>\n";
echo " <td>".trim_description($oRow->description)."</td>\n"; echo " <td>".util_trim_description($oRow->description)."</td>\n";
echo " <td>$y->versions &nbsp;</td>\n"; echo " <td>$y->versions &nbsp;</td>\n";
echo "</tr>\n\n"; echo "</tr>\n\n";
@@ -981,4 +981,20 @@ function HtmlAreaLoaderScript($aTextareas)
$outputIndex++; /* increment the output index */ $outputIndex++; /* increment the output index */
} }
/**
* Remove html formatting from description and extract the first part of the description only.
* This is to be used for search results, application summary tables, etc.
*/
function util_trim_description($sDescription)
{
// 1) let's take the first line of the description:
$aDesc = explode("\n",trim($sDescription),2);
// 2) maybe it's an html description and lines are separated with <br> or </p><p>
$aDesc = explode("<br>",$aDesc[0],2);
$aDesc = explode("<br />",$aDesc[0],2);
$aDesc = explode("</p><p>",$aDesc[0],2);
$aDesc = explode("</p><p /><p>",$aDesc[0],2);
return trim(strip_tags($aDesc[0]));
}
?> ?>

View File

@@ -838,9 +838,19 @@ class Version {
// Comments Section // Comments Section
view_app_comments($this->iVersionId); view_app_comments($this->iVersionId);
} }
function lookup_name($versionId)
{
if(!$versionId) return null;
$result = query_parameters("SELECT versionName FROM appVersion WHERE versionId = '?'",
$versionId);
if(!$result || mysql_num_rows($result) != 1)
return null;
$ob = mysql_fetch_object($result);
return $ob->versionName;
} }
function showVersionList($hResult) function showList($hResult)
{ {
//show applist //show applist
echo html_frame_start("","90%","",0); echo html_frame_start("","90%","",0);
@@ -879,12 +889,10 @@ function showVersionList($hResult)
} }
echo "</table>\n\n"; echo "</table>\n\n";
echo html_frame_end("&nbsp;"); echo html_frame_end("&nbsp;");
} }
// display the versions // display the versions
// Used in appview.php appsubmit.php and adminAppQueue.php function display_approved($aVersionsIds)
function display_approved_versions($aVersionsIds)
{ {
if ($aVersionsIds) if ($aVersionsIds)
{ {
@@ -911,7 +919,7 @@ function display_approved_versions($aVersionsIds)
//display row //display row
echo "<tr class=$bgcolor>\n"; echo "<tr class=$bgcolor>\n";
echo " <td><a href=\"".BASE."appview.php?versionId=".$iVersionId."\">".$oVersion->sName."</a></td>\n"; echo " <td><a href=\"".BASE."appview.php?versionId=".$iVersionId."\">".$oVersion->sName."</a></td>\n";
echo " <td>".trim_description($oVersion->sDescription)."</td>\n"; echo " <td>".util_trim_description($oVersion->sDescription)."</td>\n";
echo " <td align=center>".$oVersion->sTestedRating."</td>\n"; echo " <td align=center>".$oVersion->sTestedRating."</td>\n";
echo " <td align=center>".$oVersion->sTestedRelease."</td>\n"; echo " <td align=center>".$oVersion->sTestedRelease."</td>\n";
echo " <td align=center>".sizeof($oVersion->aCommentsIds)."</td>\n"; echo " <td align=center>".sizeof($oVersion->aCommentsIds)."</td>\n";
@@ -924,5 +932,6 @@ function display_approved_versions($aVersionsIds)
echo html_frame_end("Click the Version Name to view the details of that Version"); echo html_frame_end("Click the Version Name to view the details of that Version");
} }
} }
}
?> ?>

View File

@@ -126,8 +126,8 @@ function vote_menu()
{ {
if(isset($votes[$i])) if(isset($votes[$i]))
{ {
$appName = lookup_app_name($votes[$i]->appId); $sAppName = Application::lookup_name($votes[$i]->appId);
$str = "<a href='appview.php?appId=".$votes[$i]->appId."'> $appName</a>"; $str = "<a href='appview.php?appId=".$votes[$i]->appId."'> $sAppName</a>";
$m->add("<input type=radio name=slot value='$i'> ".$str); $m->add("<input type=radio name=slot value='$i'> ".$str);
} }
else else