summaryrefslogtreecommitdiffstats
path: root/src/org.gluster.storage.management.gateway/WebContent/index.html
blob: 5947cf11bcaf95df7209a53750fae36d1b195f65 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<html>
<head>
	<title>Gluster Management Console</title>

	<script type="text/javascript">

	// Try to identify operating system (os), windowing system (ws) and CPU architecture (arch)
	// If found, automatically redirect to appropriate JNLP url.
	// If not, provide hyperlinks for all available options
	function startGMC()
	{
		var OSName="Unknown OS";
		if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
		if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
		if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
		if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
	
		var os = "unknown";
		var ws = "unknown";
		var arch = "unknown";

		if ( navigator.platform != null ) {
			platform = navigator.platform.toLowerCase();
        	if ( platform.indexOf( "win32" ) != -1 || platform.indexOf( "win64" ) != -1 ) {
            	os = "win32";
				ws = "win32";
				arch = "x86";
				if ( platform.indexOf( "win64" ) != -1 ) {
					arch = "x86_64";
				}
        	} else if ( platform.indexOf( "linux" ) != -1 ) {
				os = "linux";
				ws = "gtk";
				arch = "x86";
				if ( platform.indexOf ("x86_64") != -1 || platform.indexOf ( "i686" ) != -1 ) {
					arch = "x86_64";
				}
			} else if ( platform.indexOf( "mac" ) != -1 ) {
            	os = "macosx";
				ws = "cocoa";
				// There is no known way of finding CPU architecture in Mac as of now!
        	}
    	}
	
		// In windows, cpuClass can indicate the CPU architecture, though not always!
		if ( navigator.cpuClass != null ) {
			var cpuClass = navigator.cpuClass.toLowerCase();
			if ( cpuClass.indexOf ( "x64" ) != -1 || cpuClass.indexOf ( "x86_64" ) != -1 ) {
				arch = "x86_64";
			}
		}
	
		// 32 bit IE running in compatibility mode in 64 bit windows may return arch as x86.
		// following code verifies this by looking at text WOW64/Win64 in userAgent
		if ( navigator.userAgent != null ) {
			var userAgent = navigator.userAgent.toLowerCase();
			if( userAgent.indexOf ( "wow64" ) != -1 ) {
				// browser running in compatibility mode (32 bit) inside a 64 bit Windows OS
				// In such cases, we should re-direct to the 32 bit URL as the java webstart
				// plug-in in the browser will also be 32 bit. 
				arch = "x86";
			} else if ( userAgent.indexOf ( "win64" ) != -1 || userAgent.indexOf ( "x64" ) != -1 ) {
				arch = "x86_64";
			}
		}

		// hide the "loading" message
		var element = document.getElementById('loading');
		element.style.display = "none";

		if ( os == "unknown" ) {
			var element = document.getElementById('unknown_os');
			element.style.display = "block";

			// show the links for various os-arch combinations
			element = document.getElementById('all_links');
			element.style.display = "block";
		}
		
		if ( os != "unknown" && arch == "unknown" ) {
			var element = document.getElementById('unknown_arch');
			element.style.display = "block";
		}

		if ( os == "macosx" && arch == "unknown" ) {
			var element = document.getElementById('macosx');
			element.style.display = "block";
		}

		if ( os == "win32" && arch == "unknown" ) {
			var element = document.getElementById('win32');
			element.style.display = "block";
		}

		if ( os == "linux" && arch == "unknown" ) {
			var element = document.getElementById('linux');
			element.style.display = "block";
		}

		if ( os != "unknown" && ws != "unknown" && arch != "unknown" ) {
			// os-ws-arch detected. redirect to appropriate jnlp
			var element = document.getElementById('all_ok');
			element.style.display = "block";

			// show the links for various os-arch combinations
			element = document.getElementById('all_links');
			element.style.display = "block";

			url = os + "." + ws + "." + arch + "/gluster-management-console.jnlp";
			document.location.href = url;
		}
	}
	</script>
</head>

<body onload="startGMC()">
	<h3>Gluster Management Console</h3>
	<DIV ID="loading" style="display: block">
		Identifying your Operating System and CPU architecture...
	</DIV>
	<DIV ID="all_ok" style="display: none">
		Gluster Management Console will download and start automatically. If it doesn't, click on an appropriate link below to manually start the same: <br><br>
	</DIV>
	<DIV ID="unknown_os" style="display: none">
		Could not identify your Operating System. Please click on the appropriate link below to invoke Gluster Management Console!
	</DIV>
	<DIV ID="unknown_arch" style="display: none">
		Could not identify your CPU architecture. Please click on the appropriate link below to invoke Gluster Management Console!
	</DIV><br>
	<DIV ID="win32" style="display: none">
		<table style="width: 479px; ">
			<tr><td style="width: 100px;">Windows</td><td style="width: 60px;"><a href="win32.win32.x86/gluster-management-console.jnlp">32 bit</a></td><td style="width: 60px;"><a href="win32.win32.x86_64/gluster-management-console.jnlp">64 bit</a></td></tr>
		</table>
	</DIV>
	
	<DIV ID="linux" style="display: none">
		<table style="width: 479px; ">
			<tr><td style="width: 100px;">Linux</td><td style="width: 60px;"><a href="linux.gtk.x86/gluster-management-console.jnlp">32 bit</a></td><td style="width: 60px;"><a href="linux.gtk.x86_64/gluster-management-console.jnlp">64 bit</a></td></tr>
		</table>
	</DIV>

	<DIV ID="macosx" style="display: none">
		<table style="width: 479px; ">
			<tr><td style="width: 100px;">Mac OS X</td><td style="width: 60px;"><a href="macosx.cocoa.x86/gluster-management-console.jnlp">32 bit</a></td><td style="width: 60px;"><a href="macosx.cocoa.x86_64/gluster-management-console.jnlp">64 bit</a></td></tr>
		</table>
	</DIV>	
	
	<DIV ID="all_links" style="display: none">
		<table style="width: 479px; ">
			<tr><td style="width: 100px;">Linux</td><td style="width: 60px;"><a href="linux.gtk.x86/gluster-management-console.jnlp">32 bit</a></td><td style="width: 60px;"><a href="linux.gtk.x86_64/gluster-management-console.jnlp">64 bit</a></td></tr>
			<tr><td style="width: 100px;">Mac OS X</td><td style="width: 60px;"><a href="macosx.cocoa.x86/gluster-management-console.jnlp">32 bit</a></td><td style="width: 60px;"><a href="macosx.cocoa.x86_64/gluster-management-console.jnlp">64 bit</a></td></tr>
			<tr><td style="width: 100px;">Windows</td><td style="width: 60px;"><a href="win32.win32.x86/gluster-management-console.jnlp">32 bit</a></td><td style="width: 60px;"><a href="win32.win32.x86_64/gluster-management-console.jnlp">64 bit</a></td></tr>
		</table>
	</DIV>
	
</body>

</html>