Filter:   InfoImg
download CommonFunctions.inc
Language: NonCode
LOC: 0
Project Info
PHP Genetic Algorithm Class(phpga)
Server: SourceForge
Type: cvs
...\phpga\phpga\PhpGa\include\
   BitString.inc
   CommonFunctions.inc
   FormChek.js
   PhpGa.inc
   PhpGaLimits.inc
   PhpGaStylesheet.css
   select_algorithms_thesis.C

<?  // -*-Mode: c++;-*-

/*  
	PhpGa - PHP Genetic Algorithm Class Library
  Copyright (C) 2000 Bill C. White

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

/****************************************************************************
 * CommonFunctions.inc - Bill White - 7/8/00
 *	
 * Script functions common to PhpGa
 ***************************************************************************/

// define interface colors
define(PHPGA_BG_COLOR,      "#ffffff");

// define(PHPGA_TEXT_BG_COLOR, "#000000");
// define(PHPGA_TEXT_BG_COLOR, "#e0e0e0");
define(PHPGA_TEXT_BG_COLOR, "#ffffff");

// define(PHPGA_TITLE_COLOR,   "#c2d6ec");
define(PHPGA_TITLE_COLOR,   "#e0e0e0");
// define(PHPGA_TITLE_COLOR,   "#ffffff");

// define(PHPGA_MENU_COLOR,    "#c2d6ec");
define(PHPGA_MENU_COLOR,    "#e0e0e0");
// define(PHPGA_MENU_COLOR,    "#ffffff");

define(PHPGA_FOOTER_COLOR,  "#ffffff");
// define(PHPGA_FOOTER_COLOR,  "#c2d6ec");

define(PHPGA_TEXTBOX_TITLE_BG_COLOR,  "#c2d6ec");
define(PHPGA_TEXTBOX_TEXT_BG_COLOR,  "#ffffff");

// define the colors for the alternating table rows; ie, like the old greenbar paper
define(GREEN_BAR_1, "#f5f5ff");
define(GREEN_BAR_2, "#d2d6ec");

/*
	##!
	### NAME: DebugPrint
	### PURPOSE: Print a debug message in the browser window
	### DATE: 7/9/00
	###	LAST MODIFIED: 7/9/00
	###	NOTES: none
	###	EXPECTS: $msg=message to print
	###	RETURNS: nothing
	##!
*/
function DebugPrint($msg)
{
	echo "$msg<br>\n";
	flush();
}

/*
	##!
	### NAME: EmitPageHeader
	### PURPOSE: Emit HTML page header (title and menu)
	### DATE: 7/9/00
	###	LAST MODIFIED: 7/30/00
	###	NOTES: assume user wil subsequently "print" into a table cell defined here
	###	EXPECTS: nothing
	###	RETURNS: nothing
	##!
*/
function EmitPageHeader($title="PhpGa", $useJSValidationLib=0)
{
	echo "<html>\n";

	// emit HTML header
	echo "<head>\n";
	echo"	  <title>$title</title>\n";
	echo "  <meta name=\"keywords\" content=\"PHP, genetic algorithms, GA, GAs, PHP3, PHP4, dynamic\">\n";
	echo "  <meta name=\"Author\" content=\"Bill White\">\n";
	echo "  <link rel=\"stylesheet\" href=\"/include/PhpGaStylesheet.css\" type=\"text/css\">\n";
	if($useJSValidationLib) {
		echo "  <script language=\"JavaScript\" src=\"/include/FormChek.js\"></script>\n";
	}
	echo "</head>\n";

	// emit HTML body up to area where content starts
	echo "<body bgcolor=\"" . PHPGA_BG_COLOR . "\">\n";

	// bgcolor=\"" . PHPGA_TITLE_COLOR . "\"
	echo "	<table width=\"100%\" cellspacing=\"0\" cellpadding=\"7\" border=\"0\">\n";
	echo "    <tr>\n";
	echo "			<td bgcolor=\"" . PHPGA_TITLE_COLOR . "\" align=\"center\" valign=\"middle\" width=\"30%\">\n";
	echo "        <img src=\"PhpGa_logo.gif\" align=\"center\"><br><br>\n";
	echo "      </td>\n";
	echo "			<td bgcolor=\"" . PHPGA_TITLE_COLOR . "\" align=\"center\" valign=\"middle\">\n";
	echo "        <h1>$title</h1>\n";
	echo "      </td>\n";
	echo "    </tr>\n";
	echo "    <tr>\n";
	echo "			<td bgcolor=\"" . PHPGA_MENU_COLOR . "\" align=\"center\" valign=\"top\">\n";

	EmitTextBoxHeader("Site Navigation", "", "", "");
	echo "        <center><br>\n";
  echo "        <a href=\"/\">PhpGa Home</a><br><br>\n";
  echo "        <a href=\"http://sourceforge.net/project/?group_id=8594\">Project Summary</a><br><br>\n";
 	echo "  		  <a href=\"PhpGa_debug.php3\">Online Demo</a><br><br>\n";
	echo "				<a href=\"PhpGa_license.php3\">Terms of Use/License</a><br>\n";
	echo "        <br><br><br><br>\n";
	echo "        <br><br><br><br>\n";
	echo "        <br><br><br><br>\n";
	$HOSTNAME=$GLOBALS["HOSTNAME"]; 
	if($HOSTNAME != "einstein") {
		echo "      <a href=\"http://sourceforge.net\">" . 
			"<img src=\"http://sourceforge.net/sflogo.php?group_id=8594&type=1\" width=\"88\" height=\"31\" border=\"0\"" . 
			" alt=\"SourceForge Logo\"></a><br><br>\n";
	} else {
		echo "<b>SourceForge logo</b><br><br>\n";
	}
	echo "				<a href=\"http://apache.org\"><img src=\"pic/apache_pb.gif\" border=\"0\" valign=\"middle\"></a><br><br>\n";
	echo "				<a href=\"http://php.net\"><img src=\"pic/php_logo.gif\" border=\"0\" valign=\"middle\"></a><br><br>\n";
 	echo "				webmaster&nbsp;<a href=\"mailto:hexhead@users.sourceforge.net\">Bill White</a><br><br>\n";
	echo "        </center>\n";
	EmitTextBoxFooter();

	echo "      </td>\n";
	echo "			<td bgcolor=\"" . PHPGA_TEXT_BG_COLOR . "\" valign=\"top\">\n";
	flush();
}

/*
	##!
	### NAME: EmitPageFooter
	### PURPOSE: Emit HTML page footer 
	### DATE: 7/9/00
	###	LAST MODIFIED: 7/9/00
	###	NOTES: closes table layout defined in EmitPageHeader
	###	EXPECTS: nothing
	###	RETURNS: nothing
	##!
*/
function EmitPageFooter()
{
?>
              </td>
            </tr>
		      </table>
	      </body>
     </html>
<?
}

/*
	##!
	### NAME: EmitTextBoxHeader
	### PURPOSE: Emit HTML to start a "text box"
	### like slashdot article summaries on the home page
	### DATE: 8/2/00
	###	LAST MODIFIED: 8/2/00
	###	NOTES: inspired by Mat's TextBoxes.inc code
	###	EXPECTS: nothing
	###	RETURNS: nothing
	##!
*/
function EmitTextBoxHeader($title)
{
?>
  <table border="0" bgcolor="#000000" cellspacing="5" cellpadding="0">
		 <tr>
		   <td>
		     <table border="0" cellpadding="5" cellspacing="1" width="100%">
		       <tr>
		         <td bgcolor=<? echo "\"" . PHPGA_TEXTBOX_TITLE_BG_COLOR . "\""; ?>>
		           <? echo "<p style=\"font-size: 150%;	font-weight: bold; font-family: Arial,Helvetica,Verdona,Lucida;\">$title</p>\n"; ?>
		         </td>
		       </tr>
		       <tr>
		         <td bgcolor=<? echo "\"" . PHPGA_TEXTBOX_TEXT_BG_COLOR . "\""; ?>>
<?
}

/*
	##!
	### NAME: EmitTextBoxFooter
	### PURPOSE: Emit HTML to end a "text box"
	### like slashdot article summaries on the home page
	### DATE: 8/2/00
	###	LAST MODIFIED: 8/2/00
	###	NOTES: inspired by Mat's TextBoxes.inc code
	###	EXPECTS: nothing
	###	RETURNS: nothing
	##!
*/
function EmitTextBoxFooter()
{
?>
		         </td>
		       </tr>
		     </table>
		   </td>
		 </tr>
	</table>
<?
}


?>