parent
							
								
									303c172203
								
							
						
					
					
						commit
						793b974519
					
				@ -1,65 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// helloworld.php demonstrates a very basic xajax implementation | 
				
			||||
// using xajax version 0.1 beta4 | 
				
			||||
// http://xajax.sourceforge.net | 
				
			||||
 | 
				
			||||
require ('../xajax.inc.php'); | 
				
			||||
 | 
				
			||||
function helloWorld($isCaps) | 
				
			||||
{ | 
				
			||||
	if ($isCaps) | 
				
			||||
		$text = "HELLO WORLD!"; | 
				
			||||
	else | 
				
			||||
		$text = "Hello World!"; | 
				
			||||
		 | 
				
			||||
	$objResponse = new xajaxResponse(); | 
				
			||||
	$objResponse->addAssign("div1","innerHTML",$text); | 
				
			||||
	 | 
				
			||||
	return $objResponse; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
function setColor($sColor) | 
				
			||||
{ | 
				
			||||
	$objResponse = new xajaxResponse(); | 
				
			||||
	$objResponse->addAssign("div1","style.color", $sColor); | 
				
			||||
	 | 
				
			||||
	return $objResponse; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
// Instantiate the xajax object.  No parameters defaults requestURI to this page, method to POST, and debug to off | 
				
			||||
$xajax = new xajax();  | 
				
			||||
 | 
				
			||||
//$xajax->debugOn(); // Uncomment this line to turn debugging on | 
				
			||||
 | 
				
			||||
// Specify the PHP functions to wrap. The JavaScript wrappers will be named xajax_functionname | 
				
			||||
$xajax->registerFunction("helloWorld"); | 
				
			||||
$xajax->registerFunction("setColor"); | 
				
			||||
 | 
				
			||||
// Process any requests.  Because our requestURI is the same as our html page, | 
				
			||||
// this must be called before any headers or HTML output have been sent | 
				
			||||
$xajax->processRequests(); | 
				
			||||
?> | 
				
			||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 
				
			||||
<html> | 
				
			||||
<head> | 
				
			||||
	<title>xajax example</title> | 
				
			||||
	<?php $xajax->printJavascript('../'); // output the xajax javascript. This must be called between the head tags ?>
 | 
				
			||||
</head> | 
				
			||||
<body style="text-align:center;"> | 
				
			||||
	<div id="div1" name="div1"> </div> | 
				
			||||
	<br/> | 
				
			||||
	 | 
				
			||||
	<button onclick="xajax_helloWorld(0)" >Click Me</button> | 
				
			||||
	<button onclick="xajax_helloWorld(1)" >CLICK ME</button> | 
				
			||||
	<select id="colorselect" name="colorselect" onchange="xajax_setColor(document.getElementById('colorselect').value);"> | 
				
			||||
		<option value="black" selected="selected">Black</option> | 
				
			||||
		<option value="red">Red</option> | 
				
			||||
		<option value="green">Green</option> | 
				
			||||
		<option value="blue">Blue</option> | 
				
			||||
	</select> | 
				
			||||
	<script type="text/javascript"> | 
				
			||||
	xajax_helloWorld(0); // call the helloWorld function to populate the div on load | 
				
			||||
	xajax_setColor(document.getElementById('colorselect').value); // call the setColor function on load | 
				
			||||
	</script> | 
				
			||||
</body> | 
				
			||||
</html> | 
				
			||||
@ -1,11 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// multiply.php, multiply.common.php, multiply.server.php | 
				
			||||
// demonstrate a very basic xajax implementation | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require_once ("../../xajax.inc.php"); | 
				
			||||
 | 
				
			||||
$xajax = new xajax("multiply.server.php"); | 
				
			||||
$xajax->registerFunction("multiply"); | 
				
			||||
?> | 
				
			||||
@ -1,22 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// multiply.php, multiply.common.php, multiply.server.php | 
				
			||||
// demonstrate a very basic xajax implementation | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require("multiply.common.php"); | 
				
			||||
 | 
				
			||||
?> | 
				
			||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 
				
			||||
<html>  | 
				
			||||
	<head> | 
				
			||||
		<title>xajax Multiplier</title>  | 
				
			||||
		<?php $xajax->printJavascript('../../'); ?> 
 | 
				
			||||
	</head>  | 
				
			||||
	<body>  | 
				
			||||
		<input type="text" name="x" id="x" value="2" size="3" /> *  | 
				
			||||
		<input type="text" name="y" id="y" value="3" size="3" /> =  | 
				
			||||
		<input type="text" name="z" id="z" value="" size="3" />  | 
				
			||||
		<input type="button" value="Calculate" onclick="xajax_multiply(document.getElementById('x').value,document.getElementById('y').value);return false;" /> | 
				
			||||
	</body>  | 
				
			||||
</html> | 
				
			||||
@ -1,16 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// multiply.php, multiply.common.php, multiply.server.php | 
				
			||||
// demonstrate a very basic xajax implementation | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
function multiply($x, $y) | 
				
			||||
{ | 
				
			||||
	$objResponse = new xajaxResponse(); | 
				
			||||
	$objResponse->addAssign("z", "value", $x*$y); | 
				
			||||
	return $objResponse; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
require("multiply.common.php"); | 
				
			||||
$xajax->processRequests(); | 
				
			||||
?> | 
				
			||||
@ -1,13 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// signup.php, signup.common.php, signup.server.php | 
				
			||||
// demonstrate a a simple implementation of a multipage signup form | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require_once ("../../xajax.inc.php"); | 
				
			||||
 | 
				
			||||
session_start(); | 
				
			||||
 | 
				
			||||
$xajax = new xajax("signup.server.php"); | 
				
			||||
$xajax->registerFunction("processForm"); | 
				
			||||
?> | 
				
			||||
@ -1,60 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// signup.php, signup.common.php, signup.server.php | 
				
			||||
// demonstrate a a simple implementation of a multipage signup form | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require_once('signup.common.php'); | 
				
			||||
?> | 
				
			||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 
				
			||||
<html> | 
				
			||||
	<head> | 
				
			||||
		<?php $xajax->printJavascript('../../'); ?> | 
				
			||||
		<style type="text/css"> | 
				
			||||
		#formWrapper{ | 
				
			||||
			color: rgb(255,255,255); | 
				
			||||
			background-color: rgb(149,67,97); | 
				
			||||
			width: 200px; | 
				
			||||
		} | 
				
			||||
		#title{ | 
				
			||||
			text-align: center; | 
				
			||||
			background-color: rgb(0,0,0); | 
				
			||||
		} | 
				
			||||
		#formDiv{ | 
				
			||||
			padding: 25px; | 
				
			||||
		} | 
				
			||||
		.submitDiv{ | 
				
			||||
			margin-top: 10px; | 
				
			||||
			text-align: center; | 
				
			||||
		} | 
				
			||||
		</style> | 
				
			||||
		<script type="text/javascript"> | 
				
			||||
		function submitSignup() | 
				
			||||
		{ | 
				
			||||
			xajax.$('submitButton').disabled=true; | 
				
			||||
			xajax.$('submitButton').value="please wait..."; | 
				
			||||
			xajax_processForm(xajax.getFormValues("signupForm")); | 
				
			||||
			return false; | 
				
			||||
		} | 
				
			||||
		</script> | 
				
			||||
	</head> | 
				
			||||
	<body> | 
				
			||||
		<div id="formWrapper"> | 
				
			||||
		 | 
				
			||||
			<div id="title">Create a New Account</div> | 
				
			||||
			 | 
				
			||||
			<div id="formDiv"> | 
				
			||||
				<form id="signupForm" action="javascript:void(null);" onsubmit="submitSignup();"> | 
				
			||||
					<div>Username:</div><div><input type="text" name="username" /></div> | 
				
			||||
					<div>Password:</div><div><input type="password" name="newPass1" /></div> | 
				
			||||
					<div>Confirm Password:</div><div><input type="password" name="newPass2" /></div> | 
				
			||||
					<div class="submitDiv"><input id="submitButton" type="submit" value="continue ->"/></div> | 
				
			||||
				</form> | 
				
			||||
			</div> | 
				
			||||
			 | 
				
			||||
		</div> | 
				
			||||
		 | 
				
			||||
		<div id="outputDiv"> | 
				
			||||
		</div> | 
				
			||||
	</body> | 
				
			||||
</html> | 
				
			||||
@ -1,111 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// signup.php, signup.common.php, signup.server.php | 
				
			||||
// demonstrate a a simple implementation of a multipage signup form | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require_once ("signup.common.php"); | 
				
			||||
 | 
				
			||||
function processForm($aFormValues) | 
				
			||||
{ | 
				
			||||
	if (array_key_exists("username",$aFormValues)) | 
				
			||||
	{ | 
				
			||||
		return processAccountData($aFormValues); | 
				
			||||
	} | 
				
			||||
	else if (array_key_exists("firstName",$aFormValues)) | 
				
			||||
	{ | 
				
			||||
		return processPersonalData($aFormValues); | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
 | 
				
			||||
function processAccountData($aFormValues) | 
				
			||||
{ | 
				
			||||
	$objResponse = new xajaxResponse(); | 
				
			||||
	 | 
				
			||||
	$bError = false; | 
				
			||||
	 | 
				
			||||
	if (trim($aFormValues['username']) == "") | 
				
			||||
	{ | 
				
			||||
		$objResponse->addAlert("Please enter a username."); | 
				
			||||
		$bError = true; | 
				
			||||
	} | 
				
			||||
	if (trim($aFormValues['newPass1']) == "") | 
				
			||||
	{ | 
				
			||||
		$objResponse->addAlert("You may not have a blank password."); | 
				
			||||
		$bError = true; | 
				
			||||
	} | 
				
			||||
	if ($aFormValues['newPass1'] != $aFormValues['newPass2']) | 
				
			||||
	{ | 
				
			||||
		$objResponse->addAlert("Passwords do not match.  Try again."); | 
				
			||||
		$bError = true; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	if (!$bError) | 
				
			||||
	{ | 
				
			||||
		$_SESSION = array(); | 
				
			||||
		$_SESSION['newaccount']['username'] = trim($aFormValues['username']); | 
				
			||||
		$_SESSION['newaccount']['password'] = trim($aFormValues['newPass1']); | 
				
			||||
		 | 
				
			||||
		$sForm = "<form id=\"signupForm\" action=\"javascript:void(null);\" onsubmit=\"submitSignup();\">"; | 
				
			||||
		$sForm .="<div>First Name:</div><div><input type=\"text\" name=\"firstName\" /></div>"; | 
				
			||||
		$sForm .="<div>Last Name:</div><div><input type=\"text\" name=\"lastName\" /></div>"; | 
				
			||||
		$sForm .="<div>Email:</div><div><input type=\"text\" name=\"email\" /></div>"; | 
				
			||||
		$sForm .="<div class=\"submitDiv\"><input id=\"submitButton\" type=\"submit\" value=\"done\"/></div>"; | 
				
			||||
		$sForm .="</form>"; | 
				
			||||
		$objResponse->addAssign("formDiv","innerHTML",$sForm); | 
				
			||||
		$objResponse->addAssign("formWrapper","style.backgroundColor", "rgb(67,149,97)"); | 
				
			||||
		$objResponse->addAssign("outputDiv","innerHTML","\$_SESSION:<pre>".var_export($_SESSION,true)."</pre>"); | 
				
			||||
	} | 
				
			||||
	else | 
				
			||||
	{ | 
				
			||||
		$objResponse->addAssign("submitButton","value","continue ->"); | 
				
			||||
		$objResponse->addAssign("submitButton","disabled",false); | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	return $objResponse; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
function processPersonalData($aFormValues) | 
				
			||||
{ | 
				
			||||
	$objResponse = new xajaxResponse(); | 
				
			||||
	 | 
				
			||||
	$bError = false; | 
				
			||||
	if (trim($aFormValues['firstName']) == "") | 
				
			||||
	{ | 
				
			||||
		$objResponse->addAlert("Please enter your first name."); | 
				
			||||
		$bError = true; | 
				
			||||
	} | 
				
			||||
	if (trim($aFormValues['lastName']) == "") | 
				
			||||
	{ | 
				
			||||
		$objResponse->addAlert("Please enter your last name."); | 
				
			||||
		$bError = true; | 
				
			||||
	} | 
				
			||||
	if (!eregi("^[a-zA-Z0-9]+[_a-zA-Z0-9-]*(\.[_a-z0-9-]+)*@[a-z??????0-9]+(-[a-z??????0-9]+)*(\.[a-z??????0-9-]+)*(\.[a-z]{2,4})$", $aFormValues['email'])) | 
				
			||||
	{ | 
				
			||||
		$objResponse->addAlert("Please enter a valid email address."); | 
				
			||||
		$bError = true; | 
				
			||||
	} | 
				
			||||
 | 
				
			||||
	if (!$bError) | 
				
			||||
	{ | 
				
			||||
		$_SESSION['newaccount']['firstname'] = $aFormValues['firstName']; | 
				
			||||
		$_SESSION['newaccount']['lastname'] = $aFormValues['lastName']; | 
				
			||||
		$_SESSION['newaccount']['email'] = $aFormValues['email']; | 
				
			||||
		 | 
				
			||||
		$objResponse->addAssign("formDiv","style.textAlign","center"); | 
				
			||||
		$sForm = "Account created.<br />Thank you."; | 
				
			||||
		$objResponse->addAssign("formDiv","innerHTML",$sForm); | 
				
			||||
		$objResponse->addAssign("formWrapper","style.backgroundColor", "rgb(67,97,149)"); | 
				
			||||
		$objResponse->addAssign("outputDiv","innerHTML","\$_SESSION:<pre>".var_export($_SESSION,true)."</pre>"); | 
				
			||||
	} | 
				
			||||
	else | 
				
			||||
	{ | 
				
			||||
		$objResponse->addAssign("submitButton","value","done"); | 
				
			||||
		$objResponse->addAssign("submitButton","disabled",false); | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	return $objResponse; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
$xajax->processRequests(); | 
				
			||||
?> | 
				
			||||
| 
		 Before Width: | Height: | Size: 1.1 KiB  | 
@ -1,12 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// thewall.php, thewall.common.php, thewall.server.php | 
				
			||||
// demonstrate a demonstrates a xajax implementation of a graffiti wall | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require_once ("../../xajax.inc.php"); | 
				
			||||
 | 
				
			||||
$xajax = new xajax("thewall.server.php"); | 
				
			||||
$xajax->registerFunction("scribble"); | 
				
			||||
$xajax->registerFunction("updateWall"); | 
				
			||||
?> | 
				
			||||
@ -1,70 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// thewall.php, thewall.common.php, thewall.server.php | 
				
			||||
// demonstrate a demonstrates a xajax implementation of a graffiti wall | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require_once("thewall.common.php"); | 
				
			||||
 | 
				
			||||
?> | 
				
			||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 
				
			||||
<html> | 
				
			||||
	<head> | 
				
			||||
		<title>The Graffiti Wall</title> | 
				
			||||
		<?php $xajax->printJavascript('../../'); ?> | 
				
			||||
		<script> | 
				
			||||
		function update() | 
				
			||||
		{ | 
				
			||||
			xajax_updateWall(); | 
				
			||||
			setTimeout("update()", 30000); | 
				
			||||
		} | 
				
			||||
		</script> | 
				
			||||
		<style type="text/css"> | 
				
			||||
		div.label{ | 
				
			||||
			clear: both; | 
				
			||||
			float:left; | 
				
			||||
			width:60px; | 
				
			||||
			text-align:right; | 
				
			||||
			font-size: small; | 
				
			||||
		} | 
				
			||||
		#handle{ | 
				
			||||
			font-size: x-small; | 
				
			||||
			width: 100px; | 
				
			||||
		} | 
				
			||||
		#words{ | 
				
			||||
			font-size: x-small; | 
				
			||||
			width: 400px; | 
				
			||||
		} | 
				
			||||
		#post{ | 
				
			||||
			font-size: small; | 
				
			||||
			margin-left: 390px; | 
				
			||||
		} | 
				
			||||
		#theWall{ | 
				
			||||
			background-image: url('brick.jpg'); | 
				
			||||
			height: 300px; | 
				
			||||
			padding: 50px; | 
				
			||||
			border: 3px outset black; | 
				
			||||
			overflow: auto; | 
				
			||||
		} | 
				
			||||
		.notice{ | 
				
			||||
			font-size: small; | 
				
			||||
		} | 
				
			||||
		</style> | 
				
			||||
	</head> | 
				
			||||
	<body> | 
				
			||||
		<form id="scribbleForm" onsubmit="return false;"> | 
				
			||||
			<div class="label">Handle:</div><input id="handle" name="handle" type="text" /><div></div> | 
				
			||||
			<div class="label">Graffiti:</div><input id="words" name="words"type="text" maxlength="75"/><div></div> | 
				
			||||
			<input id="post" type="submit" value="scribble" onclick="xajax_scribble(xajax.getFormValues('scribbleForm'));" /> | 
				
			||||
		</form> | 
				
			||||
		<div class="notice">To see xajax's UTF-8 support, try posting words in other languages.  You can copy and paste from <a href="http://www.unicode.org/iuc/iuc10/x-utf8.html" target="_new">here</a></div> | 
				
			||||
		<div id="theWall"> | 
				
			||||
		</div> | 
				
			||||
		<div style="text-align:center;"> | 
				
			||||
		powered by <a href="http://www.xajaxproject.org">xajax</a> | 
				
			||||
		</div> | 
				
			||||
		<script> | 
				
			||||
			update(); | 
				
			||||
		</script> | 
				
			||||
	</body> | 
				
			||||
</html> | 
				
			||||
@ -1,144 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// thewall.php, thewall.common.php, thewall.server.php | 
				
			||||
// demonstrate a demonstrates a xajax implementation of a graffiti wall | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
if (!defined ('MAX_SCRIBBLES')) | 
				
			||||
{ | 
				
			||||
	define ('MAX_SCRIBBLES', 5); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
if (!defined ('DATA_FILE')) | 
				
			||||
{ | 
				
			||||
	define ('DATA_FILE', "thewall.dta"); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
class graffiti | 
				
			||||
{ | 
				
			||||
	var $html; | 
				
			||||
	var $isValid = false; | 
				
			||||
	 | 
				
			||||
	function graffiti($sHandle, $sWords) | 
				
			||||
	{ | 
				
			||||
		if (trim($sHandle) == "" || trim($sWords) == "") | 
				
			||||
		{ | 
				
			||||
			return; | 
				
			||||
		} | 
				
			||||
		$this->html  = "\n<div style=\"font-weight: bold;text-align:".$this->getRandomAlignment(); | 
				
			||||
		$this->html .= ";color:".$this->getRandomColor().";\">"; | 
				
			||||
		$this->html .= "<span style=\"font-size:".$this->getRandomFontSize()."%;\">"; | 
				
			||||
		$this->html .= strip_tags(stripslashes($sWords)); | 
				
			||||
		$this->html .= "</span><br/><span style=\"font-size: small;\">"; | 
				
			||||
		$this->html .= " ~ ".strip_tags(stripslashes($sHandle))." ".date("m/d/Y H:i:s")."</span></div>"; | 
				
			||||
		 | 
				
			||||
		$this->isValid = true; | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	function getRandomFontSize() | 
				
			||||
	{ | 
				
			||||
		srand((double)microtime()*1000003); | 
				
			||||
		return rand(100,300); | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	function getRandomColor() | 
				
			||||
	{ | 
				
			||||
		$sColor = "rgb("; | 
				
			||||
		srand((double)microtime()*1000003); | 
				
			||||
		$sColor .= rand(0,255).","; | 
				
			||||
		srand((double)microtime()*1000003); | 
				
			||||
		$sColor .= rand(0,255).","; | 
				
			||||
		$sColor .= rand(0,255).")"; | 
				
			||||
		 | 
				
			||||
		return $sColor; | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	function getRandomAlignment() | 
				
			||||
	{ | 
				
			||||
		$sAlign = ""; | 
				
			||||
		srand((double)microtime()*1000003); | 
				
			||||
		$textAlign = rand(0,2); | 
				
			||||
		switch($textAlign) | 
				
			||||
		{ | 
				
			||||
			case 0: $sAlign = "left"; break; | 
				
			||||
			case 1: $sAlign = "right"; break; | 
				
			||||
			case 2: $sAlign = "center"; break; | 
				
			||||
			 | 
				
			||||
		} | 
				
			||||
		return $sAlign; | 
				
			||||
	} | 
				
			||||
	 | 
				
			||||
	function save() | 
				
			||||
	{ | 
				
			||||
		if ($this->isValid) | 
				
			||||
		{ | 
				
			||||
			$rFile = @fopen(DATA_FILE,"a+"); | 
				
			||||
			if (!$rFile) { | 
				
			||||
				return "ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder."; | 
				
			||||
			} | 
				
			||||
			fwrite($rFile, $this->html); | 
				
			||||
			fclose($rFile); | 
				
			||||
			return null; | 
				
			||||
		} | 
				
			||||
		else | 
				
			||||
		{ | 
				
			||||
			return "Please supply both a handle and some graffiti to scribble on the wall."; | 
				
			||||
		} | 
				
			||||
	} | 
				
			||||
} | 
				
			||||
 | 
				
			||||
function scribble($aFormValues) | 
				
			||||
{ | 
				
			||||
	$sHandle = $aFormValues['handle']; | 
				
			||||
	$sWords = $aFormValues['words']; | 
				
			||||
	$objResponse = new xajaxResponse(); | 
				
			||||
	 | 
				
			||||
	$objGraffiti = new graffiti($sHandle,$sWords); | 
				
			||||
	$sErrMsg = $objGraffiti->save(); | 
				
			||||
	if (!$sErrMsg) | 
				
			||||
	{ | 
				
			||||
		$objResponse->addScript("xajax_updateWall();"); | 
				
			||||
		$objResponse->addClear("words","value"); | 
				
			||||
	} | 
				
			||||
	else | 
				
			||||
		$objResponse->addAlert($sErrMsg); | 
				
			||||
	 | 
				
			||||
	return $objResponse; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
function updateWall() | 
				
			||||
{ | 
				
			||||
	$objResponse = new xajaxResponse(); | 
				
			||||
	 | 
				
			||||
	if (file_exists(DATA_FILE)) { | 
				
			||||
		$aFile = @file(DATA_FILE); | 
				
			||||
		if (!$aFile) { | 
				
			||||
			$objResponse->addAlert("ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder."); | 
				
			||||
			return $objResponse; | 
				
			||||
		} | 
				
			||||
		 | 
				
			||||
		$sHtmlSave = implode("\n",array_slice($aFile, -MAX_SCRIBBLES)); | 
				
			||||
		$sHtmlSave=str_replace("\n\n","\n",$sHtmlSave); | 
				
			||||
	} | 
				
			||||
	else { | 
				
			||||
		$sHtmlSave = ""; | 
				
			||||
		$aFile = array(); | 
				
			||||
	} | 
				
			||||
	$rFile = @fopen(DATA_FILE,"w+"); | 
				
			||||
	if (!$rFile) { | 
				
			||||
		$objResponse->addAlert("ERROR: the graffiti data file could not be written to the " . dirname(realpath(DATA_FILE)) . " folder."); | 
				
			||||
		return $objResponse; | 
				
			||||
	} | 
				
			||||
	fwrite($rFile, $sHtmlSave); | 
				
			||||
	fclose($rFile); | 
				
			||||
	 | 
				
			||||
	$sHtml = implode("\n",array_reverse(array_slice($aFile, -MAX_SCRIBBLES))); | 
				
			||||
	 | 
				
			||||
	$objResponse->addAssign("theWall","innerHTML",$sHtml); | 
				
			||||
 | 
				
			||||
	return $objResponse; | 
				
			||||
} | 
				
			||||
 | 
				
			||||
require("thewall.common.php"); | 
				
			||||
$xajax->processRequests(); | 
				
			||||
?> | 
				
			||||
@ -1,36 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// xulApplication.php demonstrates a XUL application with xajax | 
				
			||||
// XUL will only work in Mozilla based browsers like Firefox | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require_once("../../xajax.inc.php"); | 
				
			||||
 | 
				
			||||
function test() { | 
				
			||||
        $objResponse = new xajaxResponse(); | 
				
			||||
        $objResponse->addAlert("hallo"); | 
				
			||||
        $objResponse->addAssign('testButton','label','Success!'); | 
				
			||||
        return $objResponse->getXML(); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
$xajax = new xajax(); | 
				
			||||
$xajax->registerFunction("test"); | 
				
			||||
$xajax->processRequests(); | 
				
			||||
 | 
				
			||||
header("Content-Type: application/vnd.mozilla.xul+xml"); | 
				
			||||
?> | 
				
			||||
<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> | 
				
			||||
<window id="example-window" title="Exemple 2.2.1" | 
				
			||||
        xmlns:html="http://www.w3.org/1999/xhtml" | 
				
			||||
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | 
				
			||||
    <script type="application/x-javascript"> | 
				
			||||
		var xajaxRequestUri="xulServer.php"; | 
				
			||||
		var xajaxDebug=false; | 
				
			||||
		var xajaxStatusMessages=false; | 
				
			||||
		var xajaxDefinedGet=0; | 
				
			||||
		var xajaxDefinedPost=1; | 
				
			||||
	</script> | 
				
			||||
	<script type="application/x-javascript" src="../../xajax_js/xajax.js"></script> | 
				
			||||
    <button id="testButton" oncommand="xajax.call('test',[]);" label="Test" /> | 
				
			||||
</window> | 
				
			||||
@ -1,15 +0,0 @@ | 
				
			||||
<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?> | 
				
			||||
<window id="example-window" title="Exemple 2.2.1" | 
				
			||||
        xmlns:html="http://www.w3.org/1999/xhtml" | 
				
			||||
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> | 
				
			||||
    <script type="application/x-javascript"> | 
				
			||||
		var xajaxRequestUri="xulServer.php"; | 
				
			||||
		var xajaxDebug=false; | 
				
			||||
		var xajaxStatusMessages=false; | 
				
			||||
		var xajaxDefinedGet=0; | 
				
			||||
		var xajaxDefinedPost=1; | 
				
			||||
	</script> | 
				
			||||
	<script type="application/x-javascript" src="../../xajax_js/xajax.js"></script> | 
				
			||||
    <button id="testButton" oncommand="xajax.call('test',[]);" label="Test" /> | 
				
			||||
</window> | 
				
			||||
@ -1,19 +0,0 @@ | 
				
			||||
<?php | 
				
			||||
// xulServer.php demonstrates a XUL application with xajax | 
				
			||||
// XUL will only work in Mozilla based browsers like Firefox | 
				
			||||
// using xajax version 0.2 | 
				
			||||
// http://xajaxproject.org | 
				
			||||
 | 
				
			||||
require_once("../../xajax.inc.php"); | 
				
			||||
 | 
				
			||||
function test() { | 
				
			||||
        $objResponse = new xajaxResponse(); | 
				
			||||
        $objResponse->addAlert("hallo"); | 
				
			||||
        $objResponse->addAssign('testButton','label','Success!'); | 
				
			||||
        return $objResponse->getXML(); | 
				
			||||
} | 
				
			||||
 | 
				
			||||
$xajax = new xajax(); | 
				
			||||
$xajax->registerFunction("test"); | 
				
			||||
$xajax->processRequests(); | 
				
			||||
?> | 
				
			||||
					Loading…
					
					
				
		Reference in new issue