Location: PHPKode > projects > JaxBlog > JaxBlog/module/JaxTree/example.php
<?php

$request = isset($_GET['request']) ? $_GET['request'] : '';
$test = isset($_GET['test']) ? $_GET['test'] : '';

if ($request == 'xml') {
	header('Content-Type: text/xml');
	echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
	
	sleep(1.5);
	
	if ($test == 'test_empty') {
		echo '<root></root>';
		
	} else {
		echo '<root>';
		echo '	<record>';
		echo '		<id>1</id>';
		echo '		<parent_id>0</parent_id>';
		echo '		<is_leaf>N</is_leaf>';
		echo '		<title>disk1</title>';
		echo '		<path>disk1</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>2</id>';
		echo '		<parent_id>0</parent_id>';
		echo '		<is_leaf>N</is_leaf>';
		echo '		<title>disk2</title>';
		echo '		<path>disk2</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>3</id>';
		echo '		<parent_id>0</parent_id>';
		echo '		<is_leaf>N</is_leaf>';
		echo '		<title>disk3</title>';
		echo '		<path>disk3</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>4</id>';
		echo '		<parent_id>1</parent_id>';
		echo '		<is_leaf>N</is_leaf>';
		echo '		<title>inside</title>';
		echo '		<path>disk1/inside</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>5</id>';
		echo '		<parent_id>4</parent_id>';
		echo '		<is_leaf>N</is_leaf>';
		echo '		<title>stuff</title>';
		echo '		<path>disk1/inside/stuff</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>6</id>';
		echo '		<parent_id>1</parent_id>';
		echo '		<is_leaf>Y</is_leaf>';
		echo '		<title>inside.txt</title>';
		echo '		<path>disk1/inside/inside.txt</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>7</id>';
		echo '		<parent_id>1</parent_id>';
		echo '		<is_leaf>Y</is_leaf>';
		echo '		<title>content.txt</title>';
		echo '		<path>disk1/inside/content.txt</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>8</id>';
		echo '		<parent_id>1</parent_id>';
		echo '		<is_leaf>N</is_leaf>';
		echo '		<title>outside</title>';
		echo '		<path>disk1/outside/</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>9</id>';
		echo '		<parent_id>8</parent_id>';
		echo '		<is_leaf>N</is_leaf>';
		echo '		<title>outside_1</title>';
		echo '		<path>disk1/outside/outside_1</path>';
		echo '	</record>';
		echo '	<record>';
		echo '		<id>10</id>';
		echo '		<parent_id>8</parent_id>';
		echo '		<is_leaf>N</is_leaf>';
		echo '		<title>outside_2</title>';
		echo '		<path>disk1/outside/outside_2</path>';
		echo '	</record>';
		echo '</root>';
	}
	exit;
}

if ($test == 'test_empty') {
	$onload = "jaxTreeRegister('example.php?request=xml&test=test_empty', 'example');";
} elseif ($test == 'test_fullflavor') {
	$append  = "?test=test_fullflavor";
	$onload  = "\n";
	$onload .= "jaxTreeShowAdd('example.php$append');\n";
	$onload .= "jaxTreeShowEdit('example.php$append');\n";
	$onload .= "jaxTreeShowDelete('example.php$append');\n";
	$onload .= "jaxTreeDisableEditTopLevelNonLeafs();\n";
	$onload .= "jaxTreeRegister('example.php$append&request=xml', 'example');\n";
} else {
	$onload = "jaxTreeRegister('example.php?request=xml', 'example');";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link type="text/css" rel="stylesheet" href="jax-tree.css">
<script language="JavaScript" type="text/javascript" src="../common/jax-common.js"></script>
<script language="JavaScript" type="text/javascript" src="../common/jax-effect.js"></script>
<script language="JavaScript" type="text/javascript" src="../common/jax-xmlhttprequest.js"></script>
<script language="JavaScript" type="text/javascript" src="jax-tree.js"></script>
</head>

<body onLoad="<?= $onload ?>">

<h3>Folder List</h3>

<div class="example_indent">
	<div id="example" class="example">The entire tree will go here</div>
</div>

<a href="example.php">Test with normal xml return</a><br />
<a href="example.php?test=test_fullflavor">Test with all actions available</a><br />
<a href="example.php?test=test_empty">Test with empty xml return</a>

</body>
</html>
Return current item: JaxBlog