summaryrefslogtreecommitdiff
path: root/includes/js/dojox/widget/tests/test_Loader.html
blob: 3c014a262641b42da9602602abe719ac8c1c1514 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>Dojo Visual Loader Test</title>
	<style type="text/css">
		@import "../../../dojo/resources/dojo.css";
		@import "../../../dijit/themes/tundra/tundra.css";
		@import "../../../dijit/themes/dijit.css";
		@import "../../../dijit/tests/css/dijitTests.css"; 
		@import "../Loader/Loader.css"; 
	</style>

	<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true"></script>
	<script type="text/javascript" src="../Loader.js"></script>
	<script type="text/javascript">
		// dojo.require("dojox.widget.Loader"); 
		dojo.require("dojo.parser");	// scan page for widgets and instantiate them

		function getHoney(){
			// simple xhrGet example
			var foo = dojo.xhrGet({
				url: '../Loader/honey.php?delay=0',
				handleAs: 'text',
				load: function(result){
					content.innerHTML = result; 
				}
			});
		}

		function postHoney(){
			// simple xhrPost example
			var foo = dojo.xhrPost({
				url: '../Loader/honey.php?delay=0',
				handleAs: 'text',
				load: function(result){
					content.innerHTML = result; 
				}
			});
		}

		function alertMe(){ 
			console.log('subscription fired',arguments); 
		}

		var content = null; 
		dojo.addOnLoad(function(){

			content = dojo.byId("dataholder"); 
			// FIXME: why aren't you working?
			// var foo = dojo.subscribe("Loader",null,"alertMe");
			// console.log(foo); 

		});
	</script>
</head>
<body class="tundra">
	<div id="globalLoader" dojoType="dojox.widget.Loader"></div>

	<!-- Other examples: 
	<div id="globalLoader" dojoType="dojox.widget.Loader" hasVisuals="false"></div>
	<div id="globalLoader" dojoType="dojox.widget.Loader" hasVisuals="true" attachToPointer="false"></div>
	-->

	<h1 class="testTitle">Dojox xhrListener test</h1>

	<a href="javascript:getHoney();">start xhrGet demo</a>
	<a href="javascript:postHoney();">start xhrPost demo</a>

	<p>No additional code is required except for the existance of a 
	dojoType="dojox.widget.Loader" node. It will listen for the start
	and end of xhr* requests (via _ioSetArgs [ugh] and Deferred.prototype._fire .. 
	</p>

	<br>
	<div id="dataholder" style="float:left; height:300px; overflow:auto; width:400px; border:1px solid #ccc; "></div>
	<!-- make me a scrollbar. a Taaaaaall scrollbar  -->
	<div style="float:left; height:2000px; width:1px; overflow:hidden">spacer</div>

</body>
</html>