incubator-stonehenge-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chint...@apache.org
Subject svn commit: r805658 [2/2] - in /incubator/stonehenge/trunk/stocktrader/php/trader_client: account.php config.inc config.php confirmation.php glossary.php home.php index.php login.php portfolio.php quotes.php register.php request_processor.php
Date Wed, 19 Aug 2009 04:13:40 GMT
Modified: incubator/stonehenge/trunk/stocktrader/php/trader_client/home.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/trader_client/home.php?rev=805658&r1=805657&r2=805658&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/php/trader_client/home.php (original)
+++ incubator/stonehenge/trunk/stocktrader/php/trader_client/home.php Wed Aug 19 04:13:40 2009
@@ -1,312 +1,312 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-require_once("request_processor.php");
-
-if(!IsLoggedIn())
-{
-	header("Location: login.php");
-}
-else 
-{
-	/*Market data summary.*/
-	$mktSummary = GetMarketSummary();
-	$tsia = round($mktSummary->getMarketSummaryReturn->TSIA, 2);
-	$gain = round($mktSummary->getMarketSummaryReturn->TSIA - $mktSummary->getMarketSummaryReturn->openTSIA, 2);
-	$volume = $mktSummary->getMarketSummaryReturn->volume;
-	$topGainers = $mktSummary->getMarketSummaryReturn->topGainers;
-	$topLosers = $mktSummary->getMarketSummaryReturn->topLosers;
-
-	/*Account information for the user.*/
-	$accountData = GetAccountData(GetUserFromCookie());
-	$accountDataReturn = $accountData->getAccountDataReturn;
-
-	/*Holding information for a particular user*/	
-	$holdings = GetHoldings(GetUserFromCookie());
-	$holdingInfo = GetHoldingInformation($holdings);
-	$noOfHoldings = $holdingInfo->noOfHoldings;
-	$totalHoldings = $holdingInfo->totalHoldings;
-}
-
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-	<head>
-		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
-		<meta name="generator" content="Adobe GoLive" />
-		<title>Apache Stonehenge - PHP StockTrader - Home</title>
-		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
-	</head>
-
-	<body>
-		<div id="content">
-			<div id="header">
-				<div class="logo"><img src="images/logo.png"></div>
-			</div>
-			<div id="header-links">
-				<table>
-					<tr>
-					<td>
-						<a href="index.php">Welcome</a>
-					</td>
-					<td>
-						<a href="home.php">Home</a>
-					</td>
-					<td>
-						<a href="account.php">Account</a>
-					</td>
-					<td>
-						<a href="portfolio.php">Portfolio</a>
-					</td>
-					<td>
-						<a href="quotes.php">Quotes/Trade</a>
-					</td>
-					<td>
-						<a href="glossary.php">Glossary</a>
-					</td>
-					<td>
-						<a href="config.php">Config</a>
-					</td>
-					<td>
-						<a href="login.php">Login/Logout</a>
-					</td>
-					</tr>
-				</table>
-			</div>
-			<div id="middle">
-
-			<?php
-				print ("<div class=\"main-title\"><h1>Home</h1><script type=\"text/javascript\">var thisdate = new Date();
-					document.writeln(thisdate.toLocaleString());</script></div>");
-				print ("<h3>Welcome ".GetUserFromCookie()."</h3>");
-			?>
-
-				<table>
-				<tr>
-				<td>
-				<div class="left">
-					<table class="normal">
-						<thead><tr><th colspan="2">User Statistics</th></tr></thead>
-
-						<?php
-							if($accountDataReturn)
-							{
-								print ("<tbody>");
-								print ("<tr><td class=\"left\">Account ID:</td>
-									<td>".($accountDataReturn->accountID)."</td></tr>");
-								print ("<tr><td class=\"left\">Account Created:</td>
-									<td>".date("m/d/Y h:i:s A", $accountDataReturn->creationDate)."</td></tr>");
-								print ("<tr><td class=\"left\">Total Logins:</td>
-									<td>".$accountDataReturn->loginCount."</td></tr>");
-								print ("<tr><td class=\"left\">Session Created:</td>
-									<td>".date("m/d/Y h:i:s A", $accountDataReturn->lastLogin)."</td></tr>");
-								print ("</tbody>");
-							}
-						?>
-
-						<thead><tr><th colspan="2">Summary</th></tr></thead>
-						<?php
-							if (!($holdingInfo == NULL) || ($accountDataReturn == NULL))
-							{
-								print ("<tbody>");
-								print ("<tr><td class=\"left\">Cash Balance:</td>
-									<td>".$accountDataReturn->balance."</td></tr>");
-
-								print ("<tr><td class=\"left\">Number of Holdings:</td>
-									<td>".$noOfHoldings."</td></tr>");
-								
-								print ("<tr><td class=\"left\">Total of Holdings:</td><td>");
-								printf("$ %.2f",$totalHoldings);
-								print ("</td></tr>");
-
-								print ("<tr><td class=\"left\">Sum of Cash and Holdings:</td><td>");
-								printf("$ %.2f",($totalHoldings + ($accountDataReturn->balance)));
-								print ("</td></tr>");
-
-								print ("<tr><td class=\"left\">Opening Balance:</td><td>");
-								printf ("$ %.2f", $accountDataReturn->openBalance);
-								print ("</td></tr>");
-
-								print ("<tr><td class=\"left\">Current Gain/(Loss):</td>
-									<td><span class=\"price\">");
-								$gain =  (($totalHoldings + ($accountDataReturn->balance)) - $accountDataReturn->openBalance);
-								if ($gain < 0)
-								{
-									printf("$ (%.2f)", ((-1) * $gain));
-								}
-								else if ($gain >= 0)
-								{
-									printf("$ %.2f", $gain);
-								}
-								$gainPercent = round((($gain/$accountDataReturn->openBalance) * 100), 2);
-								print ("</span></td></tr>");
-
-
-								print ("<tr><td class=\"left\">%Gain/(Loss):</td><td>");
-
-								if ($gainPercent > 0)
-								{
-									print ("<span class=\"price-gain\">".$gainPercent."%</span>");
-								}
-								else if ($gainPercent < 0)
-								{
-									print ("<span class=\"price-loss\">".$gainPercent."%</span>");
-								}
-								else
-								{
-									print ("<span>".$gainPercent."%</span>");
-								}
-								print ("</td></tr>");
-								print("</tbody>");
-							}
-							?>
-							</table>
-						</td>
-
-						<td>
-						<div class="right">
-						<h3>Market Summary</h3>
-							<p><?php print(date("D, F j, Y, g:i a")); ?></p>
-
-							<table class="table-outer" cellspacing="0">
-							<?php
-							if (!($holdingInfo == NULL) || ($accountDataReturn == NULL))
-							{
-								print ("<tr><td class=\"special\">Trade Stock Index (TSIA)</td><td>");
-								print($tsia);
-								print(" ");
-								print("<span");	
-
-								if ($gain > 0)
-								{
-									print (" class=\"price-gain\">$");
-								}
-								else if ($gain < 0)
-								{
-									print (" class=\"price-loss\">$");
-								}
-								else
-								{
-									print(">");
-								}
-								printf("%.2f</span>", $gain);
-								print ("</td></tr>");
-
-								print ("<tr><td class=\"special\">Trading Volume</td><td>");
-
-								print ($volume);
-								print ("</td></tr>");
-
-								print("<tr><td class=\"special\">Top Gainers</td><td>");
-								print ("<table class=\"table-inner\" cellspacing=\"0\">");
-								print("<thead><tr><th>Symbol</th><th>Price</th><th>Change</th></tr></thead>");
-								print("<tbody>");
-
-								$index = 0;
-								$gainer = $topGainers->QuoteDataBean[$index];
-								while($gainer)
-								{
-									print ("<tr><td><form action = \"quotes.php\" method = \"post\">
-										<input type=\"hidden\" name=\"SYMBOLS\" value=\"".$gainer->symbol."\"/>
-										<input type=\"submit\" name=\"GETQUOTE\" value=\"".$gainer->symbol."\"></input></form></td>");
-
-									printf ("<td>$%.2f</td>", $gainer->price);
-									print ("<td><span");
-
-									if (($gainer->change) > 0)
-									{
-										print ("class=\"price-gain\">$");
-									}
-									else if (($gainer->change) < 0)
-									{
-										print ("class=\"price-loss\">$");
-									}
-									else
-									{
-										print(">$");
-									}
-
-									printf ("%.2f", $gainer->change);
-									print ("</span></td>");	
-									print ("</form></tr>");
-
-									$index++;
-									$gainer = $topGainers->QuoteDataBean[$index];
-								}	
-
-								print ("</tbody></table></td></tr>");
-
-								print ("<tr><td class=\"special\">Top Losers</td><td>
-									<table class=\"table-inner\" cellspacing=\"0\"><thead>
-									<tr><th>Symbol</th><th>Price</th><th>Change</th></tr></thead><tbody>");
-
-								$index = 0;
-								$loser = $topLosers->QuoteDataBean[$index];
-								while($loser)
-								{
-									print ("<tr><td><form action = \"quotes.php\" method = \"post\">
-										<input type=\"submit\" name=\"SYMBOLS\" value=\"".
-										$loser->symbol."\"></input></form></td>");
-
-									printf ("<td>$%.2f</td>", $loser->price);
-									print ("<td><span");
-
-									if (($loser->change) > 0)
-									{
-										print (" class=\"price-gain\">$");
-									}
-									else if (($loser->change) < 0)
-									{
-										print (" class=\"price-loss\">$");
-									}
-									else
-									{
-										print(">$");
-									}	
-									printf ("%.2f", $loser->change);
-									print ("</span></td>");	
-									print ("</tr>");
-
-									$index++;
-									$loser = $topLosers->QuoteDataBean[$index];
-								}
-								print("</tbody></table>");
-								print("</td></tr></table>");
-								print("</div>");
-								print("</td></tr></table>");
-							}
-							?>
-
-			<div class="bottom">
-			<form method="post"  action="quotes.php">
-				<input type="text" name="SYMBOLS" size="25"/>
-				<input type="submit" value="Get Quote" name="GETQUOTE" class="button"/>
-			</form>
-			</div>
-			</div>
-			<div id="footer">
-				<div style="float:right;">Powered by 
-				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
-			</div>
-		</div>
-	</body>
-</html>
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once("request_processor.php");
+
+if(!IsLoggedIn())
+{
+	header("Location: login.php");
+}
+else 
+{
+	/*Market data summary.*/
+	$mktSummary = GetMarketSummary();
+	$tsia = round($mktSummary->getMarketSummaryReturn->TSIA, 2);
+	$gain = round($mktSummary->getMarketSummaryReturn->TSIA - $mktSummary->getMarketSummaryReturn->openTSIA, 2);
+	$volume = $mktSummary->getMarketSummaryReturn->volume;
+	$topGainers = $mktSummary->getMarketSummaryReturn->topGainers;
+	$topLosers = $mktSummary->getMarketSummaryReturn->topLosers;
+
+	/*Account information for the user.*/
+	$accountData = GetAccountData(GetUserFromCookie());
+	$accountDataReturn = $accountData->getAccountDataReturn;
+
+	/*Holding information for a particular user*/	
+	$holdings = GetHoldings(GetUserFromCookie());
+	$holdingInfo = GetHoldingInformation($holdings);
+	$noOfHoldings = $holdingInfo->noOfHoldings;
+	$totalHoldings = $holdingInfo->totalHoldings;
+}
+
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>Apache Stonehenge - PHP StockTrader - Home</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+			<div id="header">
+				<div class="logo"><img src="images/logo.png"></div>
+			</div>
+			<div id="header-links">
+				<table>
+					<tr>
+					<td>
+						<a href="index.php">Welcome</a>
+					</td>
+					<td>
+						<a href="home.php">Home</a>
+					</td>
+					<td>
+						<a href="account.php">Account</a>
+					</td>
+					<td>
+						<a href="portfolio.php">Portfolio</a>
+					</td>
+					<td>
+						<a href="quotes.php">Quotes/Trade</a>
+					</td>
+					<td>
+						<a href="glossary.php">Glossary</a>
+					</td>
+					<td>
+						<a href="config.php">Config</a>
+					</td>
+					<td>
+						<a href="login.php">Login/Logout</a>
+					</td>
+					</tr>
+				</table>
+			</div>
+			<div id="middle">
+
+			<?php
+				print ("<div class=\"main-title\"><h1>Home</h1><script type=\"text/javascript\">var thisdate = new Date();
+					document.writeln(thisdate.toLocaleString());</script></div>");
+				print ("<h3>Welcome ".GetUserFromCookie()."</h3>");
+			?>
+
+				<table>
+				<tr>
+				<td>
+				<div class="left">
+					<table class="normal">
+						<thead><tr><th colspan="2">User Statistics</th></tr></thead>
+
+						<?php
+							if($accountDataReturn)
+							{
+								print ("<tbody>");
+								print ("<tr><td class=\"left\">Account ID:</td>
+									<td>".($accountDataReturn->accountID)."</td></tr>");
+								print ("<tr><td class=\"left\">Account Created:</td>
+									<td>".date("m/d/Y h:i:s A", $accountDataReturn->creationDate)."</td></tr>");
+								print ("<tr><td class=\"left\">Total Logins:</td>
+									<td>".$accountDataReturn->loginCount."</td></tr>");
+								print ("<tr><td class=\"left\">Session Created:</td>
+									<td>".date("m/d/Y h:i:s A", $accountDataReturn->lastLogin)."</td></tr>");
+								print ("</tbody>");
+							}
+						?>
+
+						<thead><tr><th colspan="2">Summary</th></tr></thead>
+						<?php
+							if (!($holdingInfo == NULL) || ($accountDataReturn == NULL))
+							{
+								print ("<tbody>");
+								print ("<tr><td class=\"left\">Cash Balance:</td>
+									<td>".$accountDataReturn->balance."</td></tr>");
+
+								print ("<tr><td class=\"left\">Number of Holdings:</td>
+									<td>".$noOfHoldings."</td></tr>");
+								
+								print ("<tr><td class=\"left\">Total of Holdings:</td><td>");
+								printf("$ %.2f",$totalHoldings);
+								print ("</td></tr>");
+
+								print ("<tr><td class=\"left\">Sum of Cash and Holdings:</td><td>");
+								printf("$ %.2f",($totalHoldings + ($accountDataReturn->balance)));
+								print ("</td></tr>");
+
+								print ("<tr><td class=\"left\">Opening Balance:</td><td>");
+								printf ("$ %.2f", $accountDataReturn->openBalance);
+								print ("</td></tr>");
+
+								print ("<tr><td class=\"left\">Current Gain/(Loss):</td>
+									<td><span class=\"price\">");
+								$gain =  (($totalHoldings + ($accountDataReturn->balance)) - $accountDataReturn->openBalance);
+								if ($gain < 0)
+								{
+									printf("$ (%.2f)", ((-1) * $gain));
+								}
+								else if ($gain >= 0)
+								{
+									printf("$ %.2f", $gain);
+								}
+								$gainPercent = round((($gain/$accountDataReturn->openBalance) * 100), 2);
+								print ("</span></td></tr>");
+
+
+								print ("<tr><td class=\"left\">%Gain/(Loss):</td><td>");
+
+								if ($gainPercent > 0)
+								{
+									print ("<span class=\"price-gain\">".$gainPercent."%</span>");
+								}
+								else if ($gainPercent < 0)
+								{
+									print ("<span class=\"price-loss\">".$gainPercent."%</span>");
+								}
+								else
+								{
+									print ("<span>".$gainPercent."%</span>");
+								}
+								print ("</td></tr>");
+								print("</tbody>");
+							}
+							?>
+							</table>
+						</td>
+
+						<td>
+						<div class="right">
+						<h3>Market Summary</h3>
+							<p><?php print(date("D, F j, Y, g:i a")); ?></p>
+
+							<table class="table-outer" cellspacing="0">
+							<?php
+							if (!($holdingInfo == NULL) || ($accountDataReturn == NULL))
+							{
+								print ("<tr><td class=\"special\">Trade Stock Index (TSIA)</td><td>");
+								print($tsia);
+								print(" ");
+								print("<span");	
+
+								if ($gain > 0)
+								{
+									print (" class=\"price-gain\">$");
+								}
+								else if ($gain < 0)
+								{
+									print (" class=\"price-loss\">$");
+								}
+								else
+								{
+									print(">");
+								}
+								printf("%.2f</span>", $gain);
+								print ("</td></tr>");
+
+								print ("<tr><td class=\"special\">Trading Volume</td><td>");
+
+								print ($volume);
+								print ("</td></tr>");
+
+								print("<tr><td class=\"special\">Top Gainers</td><td>");
+								print ("<table class=\"table-inner\" cellspacing=\"0\">");
+								print("<thead><tr><th>Symbol</th><th>Price</th><th>Change</th></tr></thead>");
+								print("<tbody>");
+
+								$index = 0;
+								$gainer = $topGainers->QuoteDataBean[$index];
+								while($gainer)
+								{
+									print ("<tr><td><form action = \"quotes.php\" method = \"post\">
+										<input type=\"hidden\" name=\"SYMBOLS\" value=\"".$gainer->symbol."\"/>
+										<input type=\"submit\" name=\"GETQUOTE\" value=\"".$gainer->symbol."\"></input></form></td>");
+
+									printf ("<td>$%.2f</td>", $gainer->price);
+									print ("<td><span");
+
+									if (($gainer->change) > 0)
+									{
+										print ("class=\"price-gain\">$");
+									}
+									else if (($gainer->change) < 0)
+									{
+										print ("class=\"price-loss\">$");
+									}
+									else
+									{
+										print(">$");
+									}
+
+									printf ("%.2f", $gainer->change);
+									print ("</span></td>");	
+									print ("</form></tr>");
+
+									$index++;
+									$gainer = $topGainers->QuoteDataBean[$index];
+								}	
+
+								print ("</tbody></table></td></tr>");
+
+								print ("<tr><td class=\"special\">Top Losers</td><td>
+									<table class=\"table-inner\" cellspacing=\"0\"><thead>
+									<tr><th>Symbol</th><th>Price</th><th>Change</th></tr></thead><tbody>");
+
+								$index = 0;
+								$loser = $topLosers->QuoteDataBean[$index];
+								while($loser)
+								{
+									print ("<tr><td><form action = \"quotes.php\" method = \"post\">
+										<input type=\"submit\" name=\"SYMBOLS\" value=\"".
+										$loser->symbol."\"></input></form></td>");
+
+									printf ("<td>$%.2f</td>", $loser->price);
+									print ("<td><span");
+
+									if (($loser->change) > 0)
+									{
+										print (" class=\"price-gain\">$");
+									}
+									else if (($loser->change) < 0)
+									{
+										print (" class=\"price-loss\">$");
+									}
+									else
+									{
+										print(">$");
+									}	
+									printf ("%.2f", $loser->change);
+									print ("</span></td>");	
+									print ("</tr>");
+
+									$index++;
+									$loser = $topLosers->QuoteDataBean[$index];
+								}
+								print("</tbody></table>");
+								print("</td></tr></table>");
+								print("</div>");
+								print("</td></tr></table>");
+							}
+							?>
+
+			<div class="bottom">
+			<form method="post"  action="quotes.php">
+				<input type="text" name="SYMBOLS" size="25"/>
+				<input type="submit" value="Get Quote" name="GETQUOTE" class="button"/>
+			</form>
+			</div>
+			</div>
+			<div id="footer">
+				<div style="float:right;">Powered by 
+				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
+			</div>
+		</div>
+	</body>
+</html>

Modified: incubator/stonehenge/trunk/stocktrader/php/trader_client/index.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/trader_client/index.php?rev=805658&r1=805657&r2=805658&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/php/trader_client/index.php (original)
+++ incubator/stonehenge/trunk/stocktrader/php/trader_client/index.php Wed Aug 19 04:13:40 2009
@@ -1,132 +1,132 @@
-<?php 
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-	<head>
-		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
-		<meta name="generator" content="Adobe GoLive" />
-		<title>Apache Stonehenge - PHP StockTrader - Welcome</title>
-		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
-	</head>
-
-	<body>
-		<div id="content">
-		<div id="header">
-			<div class="logo"><img src="images/logo.png"></div>
-		</div>
-		<div id="header-links">
-		<table>
-			<tr>
-			<td>
-			<a href="index.php">Welcome</a>
-			</td>
-			<td>
-			<a href="home.php">Home</a>
-			</td>
-			<td>
-			<a href="account.php">Account</a>
-			</td>
-			<td>
-			<a href="portfolio.php">Portfolio</a>
-			</td>
-			<td>
-			<a href="quotes.php">Quotes/Trade</a>
-			</td>
-			<td>
-			<a href="glossary.php">Glossary</a>
-			</td>
-			<td>
-			<a href="config.php">Config</a>
-			</td>
-			<td>
-			<a href="login.php">Login/Logout</a>
-			</td>
-			</tr>
-		</table>
-		</div>
-		<div id="middle">
-				<div class="main-title">
-		<h1>Welcome!</h1>
-		<script type=\"text/javascript\">
-			var thisdate = new Date();
-			document.writeln(thisdate.toLocaleString());
-		</script>
-		</div>
-		<table>
-		<tr>
-		<td>
-		<div class="left">
-<p>
-This application is an end-to-end sample application for WSO2
-middleware technologies. It is a service-oriented application written
-using PHP that utilize <a href="http://wso2.org/projects/wsf/php">WSO2 WSF/PHP</a>.
-<p>
-
-<p>
-The application also offers a rich set of interoperability options
-with other platforms. This includes interoperability with Java-based
-application servers and <a
-href="https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=trade6">IBM
-WebSphere's Trade 6.1</a> sample application, and <a
-href="http://msdn.microsoft.com/en-us/netframework/bb499684.aspx">Microsoft
-.NET Stocktrader</a> sample application.  The application offers an
-excellent opportunity for developers to learn about WSO2 WSF/PHP and
-building interoperable, service-oriented applications.
-</p>
-
-<p>For more details, check <a
-href="http://incubator.apache.org/stonehenge">Apache Stonehenge home
-page</a>. </p>
-
-		</div>
-		</td>
-		<td>	
-		<div class="right">
-						<h3>Sample of Technologies Demonstrated</h3>
-						<table>
-							<tbody>
-								<tr>
-									<td>
-										<ul>
-											<li>Service-oriented, n-tier design with PHP, Java and .NET</li>
-											<li>Clean separation of UI, business services and DB access</li>
-											<li>WSO2 Web Services Framework For PHP</li>
-											<li>WSO2 Web Services Application Server</li>
-											<li>Interoperability with .NET</li>
-											<li>Loosely-coupled, message-oriented design</li>
-										</ul>
-									</td>
-								</tr>
-							</tbody>
-						</table>
-					</div>
-				</tr>	
-			</table>
-		</div>
-		<div id="footer">
-				<div style="float:right;">Powered by 
-				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
-		</div>
-		</div>
-	</body>
-
-</html>
+<?php 
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>Apache Stonehenge - PHP StockTrader - Welcome</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+		<div id="header">
+			<div class="logo"><img src="images/logo.png"></div>
+		</div>
+		<div id="header-links">
+		<table>
+			<tr>
+			<td>
+			<a href="index.php">Welcome</a>
+			</td>
+			<td>
+			<a href="home.php">Home</a>
+			</td>
+			<td>
+			<a href="account.php">Account</a>
+			</td>
+			<td>
+			<a href="portfolio.php">Portfolio</a>
+			</td>
+			<td>
+			<a href="quotes.php">Quotes/Trade</a>
+			</td>
+			<td>
+			<a href="glossary.php">Glossary</a>
+			</td>
+			<td>
+			<a href="config.php">Config</a>
+			</td>
+			<td>
+			<a href="login.php">Login/Logout</a>
+			</td>
+			</tr>
+		</table>
+		</div>
+		<div id="middle">
+				<div class="main-title">
+		<h1>Welcome!</h1>
+		<script type=\"text/javascript\">
+			var thisdate = new Date();
+			document.writeln(thisdate.toLocaleString());
+		</script>
+		</div>
+		<table>
+		<tr>
+		<td>
+		<div class="left">
+<p>
+This application is an end-to-end sample application for WSO2
+middleware technologies. It is a service-oriented application written
+using PHP that utilize <a href="http://wso2.org/projects/wsf/php">WSO2 WSF/PHP</a>.
+<p>
+
+<p>
+The application also offers a rich set of interoperability options
+with other platforms. This includes interoperability with Java-based
+application servers and <a
+href="https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=trade6">IBM
+WebSphere's Trade 6.1</a> sample application, and <a
+href="http://msdn.microsoft.com/en-us/netframework/bb499684.aspx">Microsoft
+.NET Stocktrader</a> sample application.  The application offers an
+excellent opportunity for developers to learn about WSO2 WSF/PHP and
+building interoperable, service-oriented applications.
+</p>
+
+<p>For more details, check <a
+href="http://incubator.apache.org/stonehenge">Apache Stonehenge home
+page</a>. </p>
+
+		</div>
+		</td>
+		<td>	
+		<div class="right">
+						<h3>Sample of Technologies Demonstrated</h3>
+						<table>
+							<tbody>
+								<tr>
+									<td>
+										<ul>
+											<li>Service-oriented, n-tier design with PHP, Java and .NET</li>
+											<li>Clean separation of UI, business services and DB access</li>
+											<li>WSO2 Web Services Framework For PHP</li>
+											<li>WSO2 Web Services Application Server</li>
+											<li>Interoperability with .NET</li>
+											<li>Loosely-coupled, message-oriented design</li>
+										</ul>
+									</td>
+								</tr>
+							</tbody>
+						</table>
+					</div>
+				</tr>	
+			</table>
+		</div>
+		<div id="footer">
+				<div style="float:right;">Powered by 
+				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
+		</div>
+		</div>
+	</body>
+
+</html>

Modified: incubator/stonehenge/trunk/stocktrader/php/trader_client/login.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/trader_client/login.php?rev=805658&r1=805657&r2=805658&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/php/trader_client/login.php (original)
+++ incubator/stonehenge/trunk/stocktrader/php/trader_client/login.php Wed Aug 19 04:13:40 2009
@@ -1,138 +1,138 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once ("request_processor.php");
-
-if (IsLoggedIn())
-{
-	/*By deleting the cookie the user is logged off*/
-	LogoutUser(GetUserFromCookie());
-	header("Location: login.php");
-}
-
-if (isset ($_POST['LOGINREQUEST']))
-{
-	if (!isset ($_POST['USERNAME']) || !isset($_POST['PASSWORD']))
-	{
-		/*Username or password has left blank*/
-	}
-	else
-	{
-		if(Login($_POST['USERNAME'], $_POST['PASSWORD']))
-		{
-			/*successful login, write the cookie and go to account page.*/
-			WriteCookie($_POST['USERNAME']);
-			header("Location: account.php");
-		}
-		else
-		{
-			/*Unsuccessful login, go to login page.*/
-		}
-	}
-}
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-	<head>
-		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
-		<meta name="generator" content="Adobe GoLive" />
-		<title>Apache Stonehenge - PHP StockTrader - Login</title>
-		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
-	</head>
-
-	<body>
-
-	<div id="content">
-		<div id="header">
-			<div class="logo"><img src="images/logo.png"></div>
-		</div>
-
-		<div id="header-links">
-		<table>
-			<tr>
-			<td>
-			<a href="index.php">Welcome</a>
-			</td>
-			<td>
-			<a href="home.php">Home</a>
-			</td>
-			<td>
-			<a href="account.php">Account</a>
-			</td>
-			<td>
-			<a href="portfolio.php">Portfolio</a>
-			</td>
-			<td>
-			<a href="quotes.php">Quotes/Trade</a>
-			</td>
-			<td>
-			<a href="glossary.php">Glossary</a>
-			</td>
-			<td>
-			<a href="config.php">Config</a>
-			</td>
-			<td>
-			<a href="login.php">Login/Logout</a>
-			</td>
-			</tr>
-		</table>
-		</div>
-
-		<div id="middle">
-	
-			<div class="main-title">
-			<h1>Login</h1>
-			<script type="text/javascript">
-				var thisdate = new Date();
-				document.writeln(thisdate.toLocaleString());
-			</script>
-			</div>
-		
-			<div class="login">
-				<form method="post"  action="login.php">
-					<table>
-					<tr>
-					<td>Username</td>
-					<td><input name = "USERNAME" size = "25"/></td>
-					</tr>
-					<tr>
-					<td>Password</td>
-					<td><input type="password" name = "PASSWORD" size = "25"/></td>
-					</tr>
-					<tr>
-					<td></td>
-					<td><input type = "submit" name = "LOGINREQUEST" value = "Login" class="button"/></td>
-					</tr>
-					</table>
-				</form>
-		
-				<p>Try password "xxx" for user "uid:0" to access the stock trader web application.</p>
-				<p class="new-user">
-				<a href="register.php">First time user?</a>
-				</p>
-			</div>	
-		</div>
-			<div id="footer">
-				<div style="float:right;">Powered by 
-				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
-			</div>
-		</div>
-	
-	</body>
-</html>
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once ("request_processor.php");
+
+if (IsLoggedIn())
+{
+	/*By deleting the cookie the user is logged off*/
+	LogoutUser(GetUserFromCookie());
+	header("Location: login.php");
+}
+
+if (isset ($_POST['LOGINREQUEST']))
+{
+	if (!isset ($_POST['USERNAME']) || !isset($_POST['PASSWORD']))
+	{
+		/*Username or password has left blank*/
+	}
+	else
+	{
+		if(Login($_POST['USERNAME'], $_POST['PASSWORD']))
+		{
+			/*successful login, write the cookie and go to account page.*/
+			WriteCookie($_POST['USERNAME']);
+			header("Location: account.php");
+		}
+		else
+		{
+			/*Unsuccessful login, go to login page.*/
+		}
+	}
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>Apache Stonehenge - PHP StockTrader - Login</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+
+	<div id="content">
+		<div id="header">
+			<div class="logo"><img src="images/logo.png"></div>
+		</div>
+
+		<div id="header-links">
+		<table>
+			<tr>
+			<td>
+			<a href="index.php">Welcome</a>
+			</td>
+			<td>
+			<a href="home.php">Home</a>
+			</td>
+			<td>
+			<a href="account.php">Account</a>
+			</td>
+			<td>
+			<a href="portfolio.php">Portfolio</a>
+			</td>
+			<td>
+			<a href="quotes.php">Quotes/Trade</a>
+			</td>
+			<td>
+			<a href="glossary.php">Glossary</a>
+			</td>
+			<td>
+			<a href="config.php">Config</a>
+			</td>
+			<td>
+			<a href="login.php">Login/Logout</a>
+			</td>
+			</tr>
+		</table>
+		</div>
+
+		<div id="middle">
+	
+			<div class="main-title">
+			<h1>Login</h1>
+			<script type="text/javascript">
+				var thisdate = new Date();
+				document.writeln(thisdate.toLocaleString());
+			</script>
+			</div>
+		
+			<div class="login">
+				<form method="post"  action="login.php">
+					<table>
+					<tr>
+					<td>Username</td>
+					<td><input name = "USERNAME" size = "25"/></td>
+					</tr>
+					<tr>
+					<td>Password</td>
+					<td><input type="password" name = "PASSWORD" size = "25"/></td>
+					</tr>
+					<tr>
+					<td></td>
+					<td><input type = "submit" name = "LOGINREQUEST" value = "Login" class="button"/></td>
+					</tr>
+					</table>
+				</form>
+		
+				<p>Try password "xxx" for user "uid:0" to access the stock trader web application.</p>
+				<p class="new-user">
+				<a href="register.php">First time user?</a>
+				</p>
+			</div>	
+		</div>
+			<div id="footer">
+				<div style="float:right;">Powered by 
+				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
+			</div>
+		</div>
+	
+	</body>
+</html>

Modified: incubator/stonehenge/trunk/stocktrader/php/trader_client/portfolio.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/trader_client/portfolio.php?rev=805658&r1=805657&r2=805658&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/php/trader_client/portfolio.php (original)
+++ incubator/stonehenge/trunk/stocktrader/php/trader_client/portfolio.php Wed Aug 19 04:13:40 2009
@@ -1,202 +1,202 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once("request_processor.php");
-if(!IsLoggedIn())
-{
-	header("Location: login.php");
-}
-else
-{
-	$holdings = GetHoldings(GetUserFromCookie());
-	if ($holdings)
-	{
-		$holdingsReturn = $holdings->getHoldingsReturn;
-	}
-}
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-	<head>
-		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
-		<meta name="generator" content="Adobe GoLive" />
-		<title>Apache Stonehenge - PHP StockTrader - Portfolio</title>
-		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
-	</head>
-
-	<body>
-		<div id="content">
-			<div id="header">
-				<div class="logo"><img src="images/logo.png"></div>
-			</div>
-			<div id="header-links">
-				<table>
-					<tr>
-					<td>
-						<a href="index.php">Welcome</a>
-					</td>
-					<td>
-						<a href="home.php">Home</a>
-					</td>
-					<td>
-						<a href="account.php">Account</a>
-					</td>
-					<td>
-						<a href="portfolio.php">Portfolio</a>
-					</td>
-					<td>
-						<a href="quotes.php">Quotes/Trade</a>
-					</td>
-					<td>
-						<a href="glossary.php">Glossary</a>
-					</td>
-					<td>
-						<a href="config.php">Config</a>
-					</td>
-					<td>
-						<a href="login.php">Login/Logout</a>
-					</td>
-					</tr>
-				</table>
-			</div>
-			<div id="middle">
-
-			<?php
-				$getClosedOrdersReturn = GetClosedOrders();
-				if ($getClosedOrdersReturn)
-				{
-					print ("<p style=\"color: red\" align=\"center\">Trade Alert: The following orders have completed.</p>");
-					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead>
-						<tr><th>Order ID</th><th>Order Status</th><th>Creation Date</th><th>Completion Date</th>
-						<th>Txn Fee</th><th>Type</th><th>Symbol</th><th>Quantity</th></tr></thead><tbody>");
-
-					$index = 0;
-					while ($getClosedOrdersReturn->OrderDataBean[$index])
-					{
-						print ("<tr><td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderID."</td>
-							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderStatus."</td>
-							<td>".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->openDate)."</td>
-							<td>".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->completionDate)."</td>
-							<td>$".$getClosedOrdersReturn->OrderDataBean[$index]->orderFee."</td>
-							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderType."</td>
-							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->symbol."</td>
-							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->quantity."</td></tr>");
-						$index ++;
-					}
-					print("</tbody></table><br/><br/>");
-				}
-
-				if ($holdingsReturn)
-				{
-					print ("<div class=\"main-title\">
-						<h1>Portfolio Information</h1><script type=\"text/javascript\">var thisdate = new Date();
-					document.writeln(thisdate.toLocaleString());</script></div>");
-
-					print ("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\">
-						<thead><tr><th>Holding ID</th><th>Purchase Date</th><th>Symbol</th>
-						<th>Quantity</th><th>Purchase Price</th><th>Current Price</th>
-						<th>Purchase Basis</th><th>Market Value</th><th>Gain(Loss)</th>
-						<th>Trade</th></tr></thead><tbody>");
-
-					$index = 0;
-					$purchaseBasis = 0;
-					$marketValue = 0;
-					$gain = 0;
-
-					while ($holdingsReturn->HoldingDataBean[$index])
-					{
-						$bean = $holdingsReturn->HoldingDataBean[$index];
-
-						if (!$quoteInfo[$bean->quoteID])
-						{
-							$quotes = GetQuote($bean->quoteID);
-							if ($quotes)
-								$quotesReturn = $quotes->getQuoteReturn;
-							$quoteInfo[$bean->quoteID] = $quotesReturn->price;
-						}
-
-						$purchaseBasis = $purchaseBasis + ($bean->purchasePrice) * ($bean->quantity);
-						$marketValue = $marketValue + ($quoteInfo[$bean->quoteID]) * ($bean->quantity); 
-						$gain = ($quoteInfo[$bean->quoteID] - $bean->purchasePrice) * ($bean->quantity);
-
-						print("<tr><td>".$bean->holdingID."</td><td><nobr>".date("m/d/Y h:i:s A", $bean->purchaseDate)."</nobr></td><td>
-							<form action=\"quotes.php\" method=\"post\">
-							<input type=\"hidden\" name=\"SYMBOLS\" value=\"".$bean->quoteID."\"/>	
-							<input type=\"submit\" name=\"GETQUOTE\" value=\"".$bean->quoteID."\"></input>
-							</form></td>
-							<td class=\"currency\">".$bean->quantity."</td><td class=\"currency\">$"
-							.$bean->purchasePrice."</td><td class=\"currency\">$".$quoteInfo[$bean->quoteID]."</td><td class=\"currency\">$".
-							(($bean->purchasePrice) * ($bean->quantity))."</td><td class=\"currency\">$".($quoteInfo[$bean->quoteID] * ($bean->quantity)).
-							"</td><td class=\"currency\">");
-
-						if ($gain > 0)
-						{
-							print ("<span class=\"price-gain\">".$gain."</span>");
-						}
-						else if ($gain < 0)
-						{
-							print ("<span class=\"price-loss\">".$gain."</span>");
-						}
-						else
-						{
-							print ("<span>".$gain."</span>");
-						}
-						print("</td><td class=\"currency\">");
-						print("<form action = \"confirmation.php\" method = \"post\">");
-						print("<input type=\"hidden\" name=\"HOLDINGID\" value=\"".$bean->holdingID."\"></input>");
-						print("<input type=\"hidden\" name=\"QUANTITY\" value=\"".$bean->quantity."\"></input>");
-						print("<input type=\"hidden\" name=\"SYMBOL\" value=\"".$bean->quoteID."\"></input>");
-						print("<input type=\"submit\" value = \"Sell\" name=\"SELL\">");
-						print("</input></td></tr></form>");
-
-						$index ++;
-					}
-					print ("<tr class=\"total\"><td colspan=\"6\">Totals</td><td class=\"currency\">$".$purchaseBasis.
-						"</td><td class=\"currency\">$".$marketValue."</td><td>");
-
-					$gain = $marketValue - $purchaseBasis;
-					if ($gain < 0)
-					{
-						print ("<span class=\"price-loss\">$".$gain."</span></td><td></td></tr>");
-					}
-					else if ($gain > 0)
-					{
-						print ("<span class=\"price-gain\">$".$gain."</span></td><td></td></tr>");
-					}		
-					else
-					{
-						print ("<span>$".$gain."</span></td><td></td></tr>");
-					}
-					print ("</tbody></table>");
-				}
-			?>
-			<div class="bottom">
-			<form action = "quotes.php" method = "post">
-			<input type="text" value="" name="SYMBOLS" id="" size="25"/><input type="submit" name="GETQUOTE" value="Get Quote" class="button"/>
-			</form>
-			</div>
-			</div>
-			<div id="footer">
-				<div style="float:right;">Powered by 
-				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
-			</div>
-		</div>
-	</body>
-</html>
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once("request_processor.php");
+if(!IsLoggedIn())
+{
+	header("Location: login.php");
+}
+else
+{
+	$holdings = GetHoldings(GetUserFromCookie());
+	if ($holdings)
+	{
+		$holdingsReturn = $holdings->getHoldingsReturn;
+	}
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>Apache Stonehenge - PHP StockTrader - Portfolio</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+			<div id="header">
+				<div class="logo"><img src="images/logo.png"></div>
+			</div>
+			<div id="header-links">
+				<table>
+					<tr>
+					<td>
+						<a href="index.php">Welcome</a>
+					</td>
+					<td>
+						<a href="home.php">Home</a>
+					</td>
+					<td>
+						<a href="account.php">Account</a>
+					</td>
+					<td>
+						<a href="portfolio.php">Portfolio</a>
+					</td>
+					<td>
+						<a href="quotes.php">Quotes/Trade</a>
+					</td>
+					<td>
+						<a href="glossary.php">Glossary</a>
+					</td>
+					<td>
+						<a href="config.php">Config</a>
+					</td>
+					<td>
+						<a href="login.php">Login/Logout</a>
+					</td>
+					</tr>
+				</table>
+			</div>
+			<div id="middle">
+
+			<?php
+				$getClosedOrdersReturn = GetClosedOrders();
+				if ($getClosedOrdersReturn)
+				{
+					print ("<p style=\"color: red\" align=\"center\">Trade Alert: The following orders have completed.</p>");
+					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead>
+						<tr><th>Order ID</th><th>Order Status</th><th>Creation Date</th><th>Completion Date</th>
+						<th>Txn Fee</th><th>Type</th><th>Symbol</th><th>Quantity</th></tr></thead><tbody>");
+
+					$index = 0;
+					while ($getClosedOrdersReturn->OrderDataBean[$index])
+					{
+						print ("<tr><td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderID."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderStatus."</td>
+							<td>".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->openDate)."</td>
+							<td>".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->completionDate)."</td>
+							<td>$".$getClosedOrdersReturn->OrderDataBean[$index]->orderFee."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderType."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->symbol."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->quantity."</td></tr>");
+						$index ++;
+					}
+					print("</tbody></table><br/><br/>");
+				}
+
+				if ($holdingsReturn)
+				{
+					print ("<div class=\"main-title\">
+						<h1>Portfolio Information</h1><script type=\"text/javascript\">var thisdate = new Date();
+					document.writeln(thisdate.toLocaleString());</script></div>");
+
+					print ("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\">
+						<thead><tr><th>Holding ID</th><th>Purchase Date</th><th>Symbol</th>
+						<th>Quantity</th><th>Purchase Price</th><th>Current Price</th>
+						<th>Purchase Basis</th><th>Market Value</th><th>Gain(Loss)</th>
+						<th>Trade</th></tr></thead><tbody>");
+
+					$index = 0;
+					$purchaseBasis = 0;
+					$marketValue = 0;
+					$gain = 0;
+
+					while ($holdingsReturn->HoldingDataBean[$index])
+					{
+						$bean = $holdingsReturn->HoldingDataBean[$index];
+
+						if (!$quoteInfo[$bean->quoteID])
+						{
+							$quotes = GetQuote($bean->quoteID);
+							if ($quotes)
+								$quotesReturn = $quotes->getQuoteReturn;
+							$quoteInfo[$bean->quoteID] = $quotesReturn->price;
+						}
+
+						$purchaseBasis = $purchaseBasis + ($bean->purchasePrice) * ($bean->quantity);
+						$marketValue = $marketValue + ($quoteInfo[$bean->quoteID]) * ($bean->quantity); 
+						$gain = ($quoteInfo[$bean->quoteID] - $bean->purchasePrice) * ($bean->quantity);
+
+						print("<tr><td>".$bean->holdingID."</td><td><nobr>".date("m/d/Y h:i:s A", $bean->purchaseDate)."</nobr></td><td>
+							<form action=\"quotes.php\" method=\"post\">
+							<input type=\"hidden\" name=\"SYMBOLS\" value=\"".$bean->quoteID."\"/>	
+							<input type=\"submit\" name=\"GETQUOTE\" value=\"".$bean->quoteID."\"></input>
+							</form></td>
+							<td class=\"currency\">".$bean->quantity."</td><td class=\"currency\">$"
+							.$bean->purchasePrice."</td><td class=\"currency\">$".$quoteInfo[$bean->quoteID]."</td><td class=\"currency\">$".
+							(($bean->purchasePrice) * ($bean->quantity))."</td><td class=\"currency\">$".($quoteInfo[$bean->quoteID] * ($bean->quantity)).
+							"</td><td class=\"currency\">");
+
+						if ($gain > 0)
+						{
+							print ("<span class=\"price-gain\">".$gain."</span>");
+						}
+						else if ($gain < 0)
+						{
+							print ("<span class=\"price-loss\">".$gain."</span>");
+						}
+						else
+						{
+							print ("<span>".$gain."</span>");
+						}
+						print("</td><td class=\"currency\">");
+						print("<form action = \"confirmation.php\" method = \"post\">");
+						print("<input type=\"hidden\" name=\"HOLDINGID\" value=\"".$bean->holdingID."\"></input>");
+						print("<input type=\"hidden\" name=\"QUANTITY\" value=\"".$bean->quantity."\"></input>");
+						print("<input type=\"hidden\" name=\"SYMBOL\" value=\"".$bean->quoteID."\"></input>");
+						print("<input type=\"submit\" value = \"Sell\" name=\"SELL\">");
+						print("</input></td></tr></form>");
+
+						$index ++;
+					}
+					print ("<tr class=\"total\"><td colspan=\"6\">Totals</td><td class=\"currency\">$".$purchaseBasis.
+						"</td><td class=\"currency\">$".$marketValue."</td><td>");
+
+					$gain = $marketValue - $purchaseBasis;
+					if ($gain < 0)
+					{
+						print ("<span class=\"price-loss\">$".$gain."</span></td><td></td></tr>");
+					}
+					else if ($gain > 0)
+					{
+						print ("<span class=\"price-gain\">$".$gain."</span></td><td></td></tr>");
+					}		
+					else
+					{
+						print ("<span>$".$gain."</span></td><td></td></tr>");
+					}
+					print ("</tbody></table>");
+				}
+			?>
+			<div class="bottom">
+			<form action = "quotes.php" method = "post">
+			<input type="text" value="" name="SYMBOLS" id="" size="25"/><input type="submit" name="GETQUOTE" value="Get Quote" class="button"/>
+			</form>
+			</div>
+			</div>
+			<div id="footer">
+				<div style="float:right;">Powered by 
+				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
+			</div>
+		</div>
+	</body>
+</html>

Modified: incubator/stonehenge/trunk/stocktrader/php/trader_client/quotes.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/trader_client/quotes.php?rev=805658&r1=805657&r2=805658&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/php/trader_client/quotes.php (original)
+++ incubator/stonehenge/trunk/stocktrader/php/trader_client/quotes.php Wed Aug 19 04:13:40 2009
@@ -1,306 +1,306 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-require_once("request_processor.php");
-
-if(!IsLoggedIn())
-{
-	header("Location: login.php");
-}
-else if($_POST['GETQUOTE'])
-{
-	/*This is a request to get quote information for a particular symbol*/
-	$symbol = $_POST['SYMBOLS'];
-	if ($symbol)
-	{
-		$quotes = GetQuote($symbol);
-		if ($quotes)
-			$quotesReturn = $quotes->getQuoteReturn;
-	}
-}
-else if ($_POST['BUY'] || $_POST['SELL'])
-{
-	/*This is a buy or sell request*/
-	$quantity = $_POST['QUANTITY'];
-	$userID = GetUserFromCookie();
-	$isBuy = FALSE;
-	$isSell = FALSE;
-
-	if ($_POST['BUY'])
-	{
-		$mode = 0;
-		$isBuy = TRUE;
-		$symbol = $_POST['SYMBOL'];
-		$response = Buy($userID, $symbol, $quantity, $mode);
-		if ($response->buyReturn->orderID)
-		{
-			$buyReturn = $response->buyReturn;
-			$isReply = TRUE;
-		}
-		else
-		{
-			$response = NULL;
-		}
-	}
-	else if($_POST['SELL'])
-	{
-		$isSell = TRUE;
-		$holdingID = $_POST['HOLDINGID'];
-		$response = SellEnhanced($userID, $holdingID, $quantity);
-		if ($response->sellEnhancedReturn->orderID)
-		{
-			$sellEnhancedReturn = $response->sellEnhancedReturn;
-			$isReply = TRUE;
-		}
-		else
-		{
-			$response = NULL;
-		}
-	}
-}
-else
-{
-	/*If not above, the user has just wanted to
-	visit the quote page*/
-	$quotesInitialPage = TRUE;
-}
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-	<head>
-		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
-		<meta name="generator" content="Adobe GoLive" />
-		<title>Apache Stonehenge - PHP StockTrader - Quote</title>
-		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
-	</head>
-
-	<body>
-		<div id="content">
-			<div id="header">
-				<div class="logo"><img src="images/logo.png"></div>
-			</div>
-			<div id="header-links">
-				<table>
-					<tr>
-					<td>
-						<a href="index.php">Welcome</a>
-					</td>
-					<td>
-						<a href="home.php">Home</a>
-					</td>
-					<td>
-						<a href="account.php">Account</a>
-					</td>
-					<td>
-						<a href="portfolio.php">Portfolio</a>
-					</td>
-					<td>
-						<a href="quotes.php">Quotes/Trade</a>
-					</td>
-					<td>
-						<a href="glossary.php">Glossary</a>
-					</td>
-					<td>
-						<a href="config.php">Config</a>
-					</td>
-					<td>
-						<a href="login.php">Login/Logout</a>
-					</td>
-					</tr>
-				</table>
-			</div>
-			<div id="middle">
-
-			<?php
-				$getClosedOrdersReturn = GetClosedOrders();
-				if ($getClosedOrdersReturn)
-				{
-					/*Checking whether there is new status change happened in the 
-					related to a particular order.*/
-					print ("<p style=\"color: red\" align=\"center\">Trade Alert: The following orders have completed.</p>");
-					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead>
-						<tr><th>Order ID</th><th>Order Status</th><th>Creation Date</th><th>Completion Date</th>
-						<th>Txn Fee</th><th>Type</th><th>Symbol</th><th>Quantity</th></tr></thead><tbody>");
-
-					$index = 0;
-					while ($getClosedOrdersReturn->OrderDataBean[$index])
-					{
-						print ("<tr><td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderID."</td>
-							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderStatus."</td>
-							<td>".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->openDate)."</td>
-							<td>".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->completionDate)."</td>
-							<td>$".$getClosedOrdersReturn->OrderDataBean[$index]->orderFee."</td>
-							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderType."</td>
-							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->symbol."</td>
-							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->quantity."</td></tr>");
-						$index ++;
-					}
-					print("</tbody></table><br/><br/>");
-				}
-
-				if ($isReply == TRUE)
-				{
-					/*Check whether the user has requested to buy or sell some quote.*/
-					print ("<div class=\"main-title\"><h1>New Order</h1>
-						<script type=\"text/javascript\">var thisdate = new Date();
-					document.writeln(thisdate.toLocaleString());</script></div>");
-					print ("<p align=\"center\">Order ".$buyReturn->orderID." to 
-						".(($buyReturn->quantity) ? "buy ".($buyReturn->quantity):
-						"sell ".($sellReturn->quantity))." shares of s:0 has been submitted for processing.</p>");
-					print ("<p align=\"center\">Order Details:</p>");
-					print ("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead><tr>
-						<th>Order ID</th><th>Order Status</th><th>Creation Date</th>
-						<th>Completion Date</th><th>Txn Fee</th><th>Type</th><th>Symbol</th>
-							<th>Quantity</th></tr></thead>
-							<tbody>");
-
-					if ($isBuy == TRUE)
-					{
-						print ("<tr><td>".$buyReturn->orderID."</td><td>".$buyReturn->orderStatus.
-							"</td><td>".date("m/d/Y h:i:s A", $buyReturn->openDate)."</td><td>Pending".
-							"</td><td>$".$buyReturn->orderFee."</td><td>".$buyReturn->orderType.
-							"</td><td>".$buyReturn->symbol."</td><td>".$buyReturn->quantity."</td></tr>");
-					}
-					else if ($isSell == TRUE)
-					{
-						print ("<tr><td>".$sellEnhancedReturn->orderID."</td><td>".$sellEnhancedReturn->orderStatus.
-							"</td><td>".date("m/d/Y h:i:s A", $sellEnhancedReturn->openDate)."</td><td>Pending".
-							"</td><td>$".$sellEnhancedReturn->orderFee."</td><td>".$sellEnhancedReturn->orderType.
-							"</td><td>".$sellEnhancedReturn->symbol."</td><td>".$sellEnhancedReturn->quantity."</td></tr>");
-					}
-					print ("</tbody></table>");
-				}
-
-				else if ($_POST['GETQUOTE'])
-				{
-					print("<div class=\"main-title\"><h1>Stock Quotes</h1>");
-					print("<script type=\"text/javascript\">var thisdate = new Date();
-					document.writeln(thisdate.toLocaleString());</script>"); 
-					print("</div>");
-					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead>
-						<tr><th>Symbol</th><th>Company</th><th>Volume</th><th>Price Range</th>
-						<th>Open Price</th><th>Current Price</th><th>Gain(Loss)</th><th>Trade</th></tr></thead><tbody>");
-
-					if ($quotesReturn->symbol)
-					{
-						print ("<tr><td>".$quotesReturn->symbol."</td><td>".$quotesReturn->companyName.
-							"</td><td>".$quotesReturn->volume."</td><td>$".$quotesReturn->low."-$".
-							$quotesReturn->high."</td><td>$".$quotesReturn->open."</td>
-							<td>$".$quotesReturn->price."</td><td>");
-
-						if ($quotesReturn->change > 0)
-						{
-							print ("<span class=\"price-gain\">$".$quotesReturn->change."</span>");
-						}
-						else if ($quotesReturn->change < 0)
-						{
-							print ("<span class=\"price-loss\">$".$quotesReturn->change."</span>");
-						}
-						else
-						{
-							print ("<span>$".$quotesReturn->change."</span>");
-						}
-						print("</td><td><form action=\"confirmation.php\" method=\"post\">
-							<input type=\"hidden\" name=\"QUANTITY\" value=\"".$quotesReturn->volume."\">
-							<input type=\"hidden\" name=\"SYMBOL\" value=\"".$quotesReturn->symbol."\">
-							<input type=\"hidden\" name=\"PRICE\" value=\"".$quotesReturn->price."\">
-							<input type=\"submit\" name=\"BUY\" value=\"Buy\"></input></form></td></tr>");
-					}
-					print("</tbody></table>");
-				}
-				else if($quotesInitialPage == TRUE)
-				{
-					print("<div class=\"main-title\"><h1>Stock Quotes</h1>");
-					print("<script type=\"text/javascript\">var thisdate = new Date();
-					document.writeln(thisdate.toLocaleString());</script>"); 
-					print("</div>");
-					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead>
-						<tr><th>Symbol</th><th>Company</th><th>Volume</th><th>Price Range</th>
-						<th>Open Price</th><th>Current Price</th><th>Gain(Loss)</th><th>Trade</th></tr></thead><tbody>");
-
-					$symbolCount = 0;
-					while($symbolCount < 5)
-					{
-						$quotes = GetQuote("s:".$symbolCount);
-
-						if ($quotes)
-						{
-							$quotesReturn = $quotes->getQuoteReturn;
-
-							if ($quotesReturn->symbol)
-							{
-								print ("<tr><td>".$quotesReturn->symbol."</td><td>".$quotesReturn->companyName.
-									"</td><td>".$quotesReturn->volume."</td><td>$".$quotesReturn->low."-$".
-									$quotesReturn->high."</td><td>$".$quotesReturn->open."</td>
-									<td>$".$quotesReturn->price."</td><td>");
-
-								if ($quotesReturn->change > 0)
-								{
-									print ("<span class=\"price-gain\">$".$quotesReturn->change."</span>");
-								}
-								else if ($quotesReturn->change < 0)
-								{
-									print ("<span class=\"price-loss\">$".$quotesReturn->change."</span>");
-								}
-								else
-								{
-									print ("<span>$".$quotesReturn->change."</span>");
-								}
-								print("</td><td><form action=\"confirmation.php\" method=\"post\">
-									<input type=\"hidden\" name=\"QUANTITY\" value=\"".$quotesReturn->volume."\">
-									<input type=\"hidden\" name=\"SYMBOL\" value=\"".$quotesReturn->symbol."\">
-									<input type=\"hidden\" name=\"PRICE\" value=\"".$quotesReturn->price."\">
-									<input type=\"submit\" name=\"BUY\" value=\"Buy\"></input></form></td></tr>");
-							}
-						}
-						$symbolCount ++;
-					}
-					print("</tbody></table>");
-
-				}
-
-				else
-				{
-					print("<div class=\"main-title\"><h1>Stock Quotes</h1>");
-					print("<script type=\"text/javascript\">var thisdate = new Date();
-					document.writeln(thisdate.toLocaleString());</script>"); 
-					print("</div>");
-				}
-
-			?>
-				
-			<div class="bottom">
-
-			<form method = "post"  action = "quotes.php">
-			<input type="text" value="<?php print ($symbol); ?>" name="SYMBOLS" size="25"/>
-			<input type="submit" value="Get Quote" name="GETQUOTE" class="button"/>
-			</form>
-
-			</div>
-			</div>
-			<div id="footer">
-				<div style="float:right;">Powered by 
-				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
-			</div>
-		</div>
-	</body>
-
-</html>
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+require_once("request_processor.php");
+
+if(!IsLoggedIn())
+{
+	header("Location: login.php");
+}
+else if($_POST['GETQUOTE'])
+{
+	/*This is a request to get quote information for a particular symbol*/
+	$symbol = $_POST['SYMBOLS'];
+	if ($symbol)
+	{
+		$quotes = GetQuote($symbol);
+		if ($quotes)
+			$quotesReturn = $quotes->getQuoteReturn;
+	}
+}
+else if ($_POST['BUY'] || $_POST['SELL'])
+{
+	/*This is a buy or sell request*/
+	$quantity = $_POST['QUANTITY'];
+	$userID = GetUserFromCookie();
+	$isBuy = FALSE;
+	$isSell = FALSE;
+
+	if ($_POST['BUY'])
+	{
+		$mode = 0;
+		$isBuy = TRUE;
+		$symbol = $_POST['SYMBOL'];
+		$response = Buy($userID, $symbol, $quantity, $mode);
+		if ($response->buyReturn->orderID)
+		{
+			$buyReturn = $response->buyReturn;
+			$isReply = TRUE;
+		}
+		else
+		{
+			$response = NULL;
+		}
+	}
+	else if($_POST['SELL'])
+	{
+		$isSell = TRUE;
+		$holdingID = $_POST['HOLDINGID'];
+		$response = SellEnhanced($userID, $holdingID, $quantity);
+		if ($response->sellEnhancedReturn->orderID)
+		{
+			$sellEnhancedReturn = $response->sellEnhancedReturn;
+			$isReply = TRUE;
+		}
+		else
+		{
+			$response = NULL;
+		}
+	}
+}
+else
+{
+	/*If not above, the user has just wanted to
+	visit the quote page*/
+	$quotesInitialPage = TRUE;
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>Apache Stonehenge - PHP StockTrader - Quote</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+			<div id="header">
+				<div class="logo"><img src="images/logo.png"></div>
+			</div>
+			<div id="header-links">
+				<table>
+					<tr>
+					<td>
+						<a href="index.php">Welcome</a>
+					</td>
+					<td>
+						<a href="home.php">Home</a>
+					</td>
+					<td>
+						<a href="account.php">Account</a>
+					</td>
+					<td>
+						<a href="portfolio.php">Portfolio</a>
+					</td>
+					<td>
+						<a href="quotes.php">Quotes/Trade</a>
+					</td>
+					<td>
+						<a href="glossary.php">Glossary</a>
+					</td>
+					<td>
+						<a href="config.php">Config</a>
+					</td>
+					<td>
+						<a href="login.php">Login/Logout</a>
+					</td>
+					</tr>
+				</table>
+			</div>
+			<div id="middle">
+
+			<?php
+				$getClosedOrdersReturn = GetClosedOrders();
+				if ($getClosedOrdersReturn)
+				{
+					/*Checking whether there is new status change happened in the 
+					related to a particular order.*/
+					print ("<p style=\"color: red\" align=\"center\">Trade Alert: The following orders have completed.</p>");
+					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead>
+						<tr><th>Order ID</th><th>Order Status</th><th>Creation Date</th><th>Completion Date</th>
+						<th>Txn Fee</th><th>Type</th><th>Symbol</th><th>Quantity</th></tr></thead><tbody>");
+
+					$index = 0;
+					while ($getClosedOrdersReturn->OrderDataBean[$index])
+					{
+						print ("<tr><td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderID."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderStatus."</td>
+							<td>".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->openDate)."</td>
+							<td>".date("m/d/Y h:i:s A", $getClosedOrdersReturn->OrderDataBean[$index]->completionDate)."</td>
+							<td>$".$getClosedOrdersReturn->OrderDataBean[$index]->orderFee."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderType."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->symbol."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->quantity."</td></tr>");
+						$index ++;
+					}
+					print("</tbody></table><br/><br/>");
+				}
+
+				if ($isReply == TRUE)
+				{
+					/*Check whether the user has requested to buy or sell some quote.*/
+					print ("<div class=\"main-title\"><h1>New Order</h1>
+						<script type=\"text/javascript\">var thisdate = new Date();
+					document.writeln(thisdate.toLocaleString());</script></div>");
+					print ("<p align=\"center\">Order ".$buyReturn->orderID." to 
+						".(($buyReturn->quantity) ? "buy ".($buyReturn->quantity):
+						"sell ".($sellReturn->quantity))." shares of s:0 has been submitted for processing.</p>");
+					print ("<p align=\"center\">Order Details:</p>");
+					print ("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead><tr>
+						<th>Order ID</th><th>Order Status</th><th>Creation Date</th>
+						<th>Completion Date</th><th>Txn Fee</th><th>Type</th><th>Symbol</th>
+							<th>Quantity</th></tr></thead>
+							<tbody>");
+
+					if ($isBuy == TRUE)
+					{
+						print ("<tr><td>".$buyReturn->orderID."</td><td>".$buyReturn->orderStatus.
+							"</td><td>".date("m/d/Y h:i:s A", $buyReturn->openDate)."</td><td>Pending".
+							"</td><td>$".$buyReturn->orderFee."</td><td>".$buyReturn->orderType.
+							"</td><td>".$buyReturn->symbol."</td><td>".$buyReturn->quantity."</td></tr>");
+					}
+					else if ($isSell == TRUE)
+					{
+						print ("<tr><td>".$sellEnhancedReturn->orderID."</td><td>".$sellEnhancedReturn->orderStatus.
+							"</td><td>".date("m/d/Y h:i:s A", $sellEnhancedReturn->openDate)."</td><td>Pending".
+							"</td><td>$".$sellEnhancedReturn->orderFee."</td><td>".$sellEnhancedReturn->orderType.
+							"</td><td>".$sellEnhancedReturn->symbol."</td><td>".$sellEnhancedReturn->quantity."</td></tr>");
+					}
+					print ("</tbody></table>");
+				}
+
+				else if ($_POST['GETQUOTE'])
+				{
+					print("<div class=\"main-title\"><h1>Stock Quotes</h1>");
+					print("<script type=\"text/javascript\">var thisdate = new Date();
+					document.writeln(thisdate.toLocaleString());</script>"); 
+					print("</div>");
+					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead>
+						<tr><th>Symbol</th><th>Company</th><th>Volume</th><th>Price Range</th>
+						<th>Open Price</th><th>Current Price</th><th>Gain(Loss)</th><th>Trade</th></tr></thead><tbody>");
+
+					if ($quotesReturn->symbol)
+					{
+						print ("<tr><td>".$quotesReturn->symbol."</td><td>".$quotesReturn->companyName.
+							"</td><td>".$quotesReturn->volume."</td><td>$".$quotesReturn->low."-$".
+							$quotesReturn->high."</td><td>$".$quotesReturn->open."</td>
+							<td>$".$quotesReturn->price."</td><td>");
+
+						if ($quotesReturn->change > 0)
+						{
+							print ("<span class=\"price-gain\">$".$quotesReturn->change."</span>");
+						}
+						else if ($quotesReturn->change < 0)
+						{
+							print ("<span class=\"price-loss\">$".$quotesReturn->change."</span>");
+						}
+						else
+						{
+							print ("<span>$".$quotesReturn->change."</span>");
+						}
+						print("</td><td><form action=\"confirmation.php\" method=\"post\">
+							<input type=\"hidden\" name=\"QUANTITY\" value=\"".$quotesReturn->volume."\">
+							<input type=\"hidden\" name=\"SYMBOL\" value=\"".$quotesReturn->symbol."\">
+							<input type=\"hidden\" name=\"PRICE\" value=\"".$quotesReturn->price."\">
+							<input type=\"submit\" name=\"BUY\" value=\"Buy\"></input></form></td></tr>");
+					}
+					print("</tbody></table>");
+				}
+				else if($quotesInitialPage == TRUE)
+				{
+					print("<div class=\"main-title\"><h1>Stock Quotes</h1>");
+					print("<script type=\"text/javascript\">var thisdate = new Date();
+					document.writeln(thisdate.toLocaleString());</script>"); 
+					print("</div>");
+					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead>
+						<tr><th>Symbol</th><th>Company</th><th>Volume</th><th>Price Range</th>
+						<th>Open Price</th><th>Current Price</th><th>Gain(Loss)</th><th>Trade</th></tr></thead><tbody>");
+
+					$symbolCount = 0;
+					while($symbolCount < 5)
+					{
+						$quotes = GetQuote("s:".$symbolCount);
+
+						if ($quotes)
+						{
+							$quotesReturn = $quotes->getQuoteReturn;
+
+							if ($quotesReturn->symbol)
+							{
+								print ("<tr><td>".$quotesReturn->symbol."</td><td>".$quotesReturn->companyName.
+									"</td><td>".$quotesReturn->volume."</td><td>$".$quotesReturn->low."-$".
+									$quotesReturn->high."</td><td>$".$quotesReturn->open."</td>
+									<td>$".$quotesReturn->price."</td><td>");
+
+								if ($quotesReturn->change > 0)
+								{
+									print ("<span class=\"price-gain\">$".$quotesReturn->change."</span>");
+								}
+								else if ($quotesReturn->change < 0)
+								{
+									print ("<span class=\"price-loss\">$".$quotesReturn->change."</span>");
+								}
+								else
+								{
+									print ("<span>$".$quotesReturn->change."</span>");
+								}
+								print("</td><td><form action=\"confirmation.php\" method=\"post\">
+									<input type=\"hidden\" name=\"QUANTITY\" value=\"".$quotesReturn->volume."\">
+									<input type=\"hidden\" name=\"SYMBOL\" value=\"".$quotesReturn->symbol."\">
+									<input type=\"hidden\" name=\"PRICE\" value=\"".$quotesReturn->price."\">
+									<input type=\"submit\" name=\"BUY\" value=\"Buy\"></input></form></td></tr>");
+							}
+						}
+						$symbolCount ++;
+					}
+					print("</tbody></table>");
+
+				}
+
+				else
+				{
+					print("<div class=\"main-title\"><h1>Stock Quotes</h1>");
+					print("<script type=\"text/javascript\">var thisdate = new Date();
+					document.writeln(thisdate.toLocaleString());</script>"); 
+					print("</div>");
+				}
+
+			?>
+				
+			<div class="bottom">
+
+			<form method = "post"  action = "quotes.php">
+			<input type="text" value="<?php print ($symbol); ?>" name="SYMBOLS" size="25"/>
+			<input type="submit" value="Get Quote" name="GETQUOTE" class="button"/>
+			</form>
+
+			</div>
+			</div>
+			<div id="footer">
+				<div style="float:right;">Powered by 
+				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
+			</div>
+		</div>
+	</body>
+
+</html>

Modified: incubator/stonehenge/trunk/stocktrader/php/trader_client/register.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/trader_client/register.php?rev=805658&r1=805657&r2=805658&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/php/trader_client/register.php (original)
+++ incubator/stonehenge/trunk/stocktrader/php/trader_client/register.php Wed Aug 19 04:13:40 2009
@@ -1,186 +1,186 @@
-<?php
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-?>
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<?php
-require_once ("request_processor.php");
-
-if ($_POST['REGISTERUSER'])
-{
-	/*New user registration*/
-	$userID = $_POST['REQUESTEDID'];
-	$openBalance = $_POST['OPENBALANCE'];
-	$fullname = $_POST['FULLNAME'];
-	$email = $_POST['EMAIL'];
-	$address = $_POST['ADDRESS'];
-	$password = $_POST['PASSWORD'];
-	$creditcard = $_POST['CREDITCARD'];
-	$confpassword = $_POST['CONFIRMATIONPASSWORD'];
-
-	if ($userID == NULL || $password != $confpassword)
-	{
-		$invalidInformation = TRUE;
-	}
-	else
-	{
-		$response = RegisterUser($userID, $password, $fullname, 
-			$address, $email, $creditcard, $openBalance);
-		if ($response)
-		{
-			$successfulRegistration = TRUE;
-		}
-		else
-		{
-			$invalidInformation = TRUE;
-		}
-	}
-}
-?>
-
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-	<head>
-		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
-		<meta name="generator" content="Adobe GoLive" />
-		<title>Apache Stonehenge - PHP StockTrader - Register</title>
-		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
-	</head>
-
-	<body>
-		<div id="content">
-			<div id="header">
-				<div class="logo"><img src="images/logo.png"></div>
-			</div>
-			<div id="header-links">
-				<table>
-					<tr>
-					<td>
-						<a href="index.php">Welcome</a>
-					</td>
-					<td>
-						<a href="home.php">Home</a>
-					</td>
-					<td>
-						<a href="account.php">Account</a>
-					</td>
-					<td>
-						<a href="portfolio.php">Portfolio</a>
-					</td>
-					<td>
-						<a href="quotes.php">Quotes/Trade</a>
-					</td>
-					<td>
-						<a href="glossary.php">Glossary</a>
-					</td>
-					<td>
-						<a href="config.php">Config</a>
-					</td>
-					<td>
-						<a href="login.php">Login/Logout</a>
-					</td>
-					</tr>
-				</table>
-			</div>
-			<div id="middle">
-				<div class="main-title">
-					<h1>Register</h1>
-					<script type="text/javascript">
-						var thisdate = new Date();
-						document.writeln(thisdate.toLocaleString());
-					</script>
-				</div>
-
-				<?php
-				if ($successfulRegistration)
-				{
-					print("<p style=\"color: red\" align=\"center\">
-						Registration was successful, please <a href =\"login.php\">login</a>.</p>");
-				}
-
-				else
-				{
-					if ($invalidInformation)
-					{
-						print("<p style=\"color: red\" align=\"center\">Please enter valid information.</p>");
-					}
-					print ("<table class=\"profile\" cellspacing=\"0\" width=\"100%\">
-					<thead>
-					<tr>
-					<th>
-					Create Account Profile:
-					</th>
-					</tr>
-					</thead>
-					<tbody>
-					<tr>
-						<td>
-							<form action=\"register.php\" method=\"post\">
-							<table cellspacing=\"0\" align=\"center\">
-								<tr>
-									<td colspan=\"4\" >
-										&nbsp;
-									</td>
-								</tr>
-								<tr>
-									<td>Requested ID:</td>
-									<td><input name=\"REQUESTEDID\" type=\"text\" id=\"\" size=\"25\"/></td>
-									<td>Opening Balance:</td>
-									<td><input type=\"text\" name=\"OPENBALANCE\" value=\"100000\" id=\"\" size=\"25\"/></td>
-								</tr>
-								<tr>
-									<td>Full Name:</td>
-									<td><input type=\"text\" name=\"FULLNAME\" id=\"\" size=\"25\"/></td>
-									<td>Email Address:</td>
-									<td><input type=\"text\" name=\"EMAIL\" id=\"\" size=\"25\"/></td>
-								</tr>
-								<tr>
-									<td>Address:</td>
-									<td><input name=\"ADDRESS\" type=\"text\" id=\"\" size=\"25\"/></td>
-									<td>Password:</td>
-									<td><input name=\"PASSWORD\" type=\"password\" id=\"\" size=\"25\"/></td>
-								</tr>
-								<tr>
-									<td>Credit Card:</td>
-									<td><input name=\"CREDITCARD\" type=\"text\" id=\"\" size=\"25\"/></td>
-									<td>Confirm Password:</td>
-									<td><input name=\"CONFIRMATIONPASSWORD\" type=\"password\" id=\"\" size=\"25\"/></td>
-								</tr>
-								<tr>
-									<td colspan=\"4\" class=\"button\">
-										<input type=\"submit\" name=\"REGISTERUSER\" value=\"Register\" class=\"button\"/>
-									</td>
-								</tr>
-							</table>
-							</form>	
-						</td>
-					</tr>
-					</tbody>
-					</table>");
-				}
-			?>
-			</div>
-			<div id="footer">
-				<div style="float:right;">Powered by 
-				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
-			</div>
-		</div>
-	</body>
-
-</html>
+<?php
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<?php
+require_once ("request_processor.php");
+
+if ($_POST['REGISTERUSER'])
+{
+	/*New user registration*/
+	$userID = $_POST['REQUESTEDID'];
+	$openBalance = $_POST['OPENBALANCE'];
+	$fullname = $_POST['FULLNAME'];
+	$email = $_POST['EMAIL'];
+	$address = $_POST['ADDRESS'];
+	$password = $_POST['PASSWORD'];
+	$creditcard = $_POST['CREDITCARD'];
+	$confpassword = $_POST['CONFIRMATIONPASSWORD'];
+
+	if ($userID == NULL || $password != $confpassword)
+	{
+		$invalidInformation = TRUE;
+	}
+	else
+	{
+		$response = RegisterUser($userID, $password, $fullname, 
+			$address, $email, $creditcard, $openBalance);
+		if ($response)
+		{
+			$successfulRegistration = TRUE;
+		}
+		else
+		{
+			$invalidInformation = TRUE;
+		}
+	}
+}
+?>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>Apache Stonehenge - PHP StockTrader - Register</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+			<div id="header">
+				<div class="logo"><img src="images/logo.png"></div>
+			</div>
+			<div id="header-links">
+				<table>
+					<tr>
+					<td>
+						<a href="index.php">Welcome</a>
+					</td>
+					<td>
+						<a href="home.php">Home</a>
+					</td>
+					<td>
+						<a href="account.php">Account</a>
+					</td>
+					<td>
+						<a href="portfolio.php">Portfolio</a>
+					</td>
+					<td>
+						<a href="quotes.php">Quotes/Trade</a>
+					</td>
+					<td>
+						<a href="glossary.php">Glossary</a>
+					</td>
+					<td>
+						<a href="config.php">Config</a>
+					</td>
+					<td>
+						<a href="login.php">Login/Logout</a>
+					</td>
+					</tr>
+				</table>
+			</div>
+			<div id="middle">
+				<div class="main-title">
+					<h1>Register</h1>
+					<script type="text/javascript">
+						var thisdate = new Date();
+						document.writeln(thisdate.toLocaleString());
+					</script>
+				</div>
+
+				<?php
+				if ($successfulRegistration)
+				{
+					print("<p style=\"color: red\" align=\"center\">
+						Registration was successful, please <a href =\"login.php\">login</a>.</p>");
+				}
+
+				else
+				{
+					if ($invalidInformation)
+					{
+						print("<p style=\"color: red\" align=\"center\">Please enter valid information.</p>");
+					}
+					print ("<table class=\"profile\" cellspacing=\"0\" width=\"100%\">
+					<thead>
+					<tr>
+					<th>
+					Create Account Profile:
+					</th>
+					</tr>
+					</thead>
+					<tbody>
+					<tr>
+						<td>
+							<form action=\"register.php\" method=\"post\">
+							<table cellspacing=\"0\" align=\"center\">
+								<tr>
+									<td colspan=\"4\" >
+										&nbsp;
+									</td>
+								</tr>
+								<tr>
+									<td>Requested ID:</td>
+									<td><input name=\"REQUESTEDID\" type=\"text\" id=\"\" size=\"25\"/></td>
+									<td>Opening Balance:</td>
+									<td><input type=\"text\" name=\"OPENBALANCE\" value=\"100000\" id=\"\" size=\"25\"/></td>
+								</tr>
+								<tr>
+									<td>Full Name:</td>
+									<td><input type=\"text\" name=\"FULLNAME\" id=\"\" size=\"25\"/></td>
+									<td>Email Address:</td>
+									<td><input type=\"text\" name=\"EMAIL\" id=\"\" size=\"25\"/></td>
+								</tr>
+								<tr>
+									<td>Address:</td>
+									<td><input name=\"ADDRESS\" type=\"text\" id=\"\" size=\"25\"/></td>
+									<td>Password:</td>
+									<td><input name=\"PASSWORD\" type=\"password\" id=\"\" size=\"25\"/></td>
+								</tr>
+								<tr>
+									<td>Credit Card:</td>
+									<td><input name=\"CREDITCARD\" type=\"text\" id=\"\" size=\"25\"/></td>
+									<td>Confirm Password:</td>
+									<td><input name=\"CONFIRMATIONPASSWORD\" type=\"password\" id=\"\" size=\"25\"/></td>
+								</tr>
+								<tr>
+									<td colspan=\"4\" class=\"button\">
+										<input type=\"submit\" name=\"REGISTERUSER\" value=\"Register\" class=\"button\"/>
+									</td>
+								</tr>
+							</table>
+							</form>	
+						</td>
+					</tr>
+					</tbody>
+					</table>");
+				}
+			?>
+			</div>
+			<div id="footer">
+				<div style="float:right;">Powered by 
+				<a href="http://wso2.org/projects/wsf/php"><img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></a></div>
+			</div>
+		</div>
+	</body>
+
+</html>

Modified: incubator/stonehenge/trunk/stocktrader/php/trader_client/request_processor.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/php/trader_client/request_processor.php?rev=805658&r1=805657&r2=805658&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/php/trader_client/request_processor.php (original)
+++ incubator/stonehenge/trunk/stocktrader/php/trader_client/request_processor.php Wed Aug 19 04:13:40 2009
@@ -758,7 +758,7 @@
 
 function GetEndpoint()
 {
-	return ($_COOKIE[COOKIE_ENDPOINT]);
+	// return ($_COOKIE[COOKIE_ENDPOINT]);
 }
 
 /**



Mime
View raw message