aboutsummaryrefslogtreecommitdiff
blob: 45468a5554735239e207ee5f00755bbd242ef0f8 (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
<? include /webgli/top.pyhtml ?>

<?
errormsg = ""
if post_params:
	#Deal with GLIMD adding of profile first by saving both profiles locally with a prefix of the name.
	if 'addtoGLIMD' in post_params and post_params['GLIMDprofile']:
		post_params['clientfile'] = post_params['GLIMDprofile'] + "_cc.xml"
		post_params['ipfile'] = post_params['GLIMDprofile'] + "_ip.xml"
	
	if not 'downloadclient' in post_params and post_params['clientfile']:
		try:
			tmpfile = open(post_params['clientfile'], "w")
			tmpfile.write(shared_info.client_profile.serialize())
			tmpfile.close()
		except:
			errormsg = "There was a problem writing the file"
#			return wrap_in_webgli_template(content)
#		return wrap_in_webgli_template(content + "Client Profile saved successfully")
	elif 'downloadclient' in post_params:
		headers_out.append(("Content-type", "text/xml"))
		headers_out.append(('Content-disposition', "attatchment;filename=clientprofile.xml"))
		return shared_info.client_profile.serialize()
	if not 'downloadip' in post_params and post_params['ipfile']:
		try:
			tmpfile = open(post_params['ipfile'], "w")
			tmpfile.write(shared_info.install_profile.serialize())
			tmpfile.close()
		except:
			errormsg = "There was a problem writing the file" + get_exception()
#			return wrap_in_webgli_template(content)
#		return wrap_in_webgli_template(content + "Client Profile saved successfully")
	elif 'downloadip' in post_params:
		headers_out.append(("Content-type", "text/xml"))
		headers_out.append(('Content-disposition', "attatchment;filename=installprofile.xml"))
		return shared_info.install_profile.serialize()
	
	if post_params['addtoGLIMD']:
		for profile in shared_info.profiles:
			if post_params['GLIMDprofile'] == profile['name']:
				errormsg = "That profile already exists!"
		if not errormsg:
			try:
				new_profile = {}
				new_profile['name'] = post_params['GLIMDprofile']
				new_profile['ccxmlfile'] = post_params['clientfile']
				new_profile['ipxmlfile'] = post_params['ipfile']
				shared_info.profiles.append(new_profile)
			except:
				errormsg += "Error while adding the new profile!"
	
	if not errormsg:
		errormsg = "Profile added successfully"

?>

<h2>Save Client Profile</h2>
<: if errormsg:
<br><% errormsg %><br><br>
:>
<br>
<form action="/webgli/saveprofile.pyhtml" method="POST" enctype="multipart/form-data">
Save to local (to server) file (USE FULL PATH, write to a writeable location (such as ~/) ): <input type="text" name="clientfile"> <input type="submit" value="Save"><br>
or<br>
Download the file: <input type="submit" name="downloadclient" value="Download">
</form><hr>
<h2>Save Install Profile</h2>
<br>
<form action="/webgli/saveprofile.pyhtml" method="POST" enctype="multipart/form-data">
Save to local (to server) file (USE FULL PATH, write to a writeable location (such as ~/) ): <input type="text" name="ipfile"> <input type="submit" value="Save"><br>
or<br>
Download the file: <input type="submit" name="downloadip" value="Download">
<hr>
If you plan to use these profiles for the GLI Management Daemon, you can simply give the profile a name and
add it to the list of available profiles.<br>
Name:<input type="text" name="GLIMDprofile"><br>
<input type="submit" name="addtoGLIMD" value="Add Profile to GLIMD">
</form>

<? include /webgli/bottom.pyhtml ?>