blob: faad24e4b3a5086e9c532e8e55d6aa3b49e8d96f (
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
|
<? include /webgli/top.pyhtml ?>
<?
error_msg = ""
if post_params['back']:
zonepath = post_params['tzback']
if get_params['zonepath']:
zonepath = get_params['zonepath']
if zonepath[-1] != "/":
try:
shared_info.install_profile.set_time_zone(None, zonepath[20:], None)
error_msg = "Timezone Set"
except:
error_msg = "ERROR: Could not set that timezone!"
if not "UTC" in zonepath: # set conf value to local if not already set.
etc_files = shared_info.install_profile.get_etc_files()
if not "conf.d/clock" in etc_files:
etc_files['conf.d/clock'] = {}
etc_files['conf.d/clock']['CLOCK'] = "local"
try:
shared_info.install_profile.set_etc_files(etc_files)
except:
error_msg += "ERROR: Could not set the clock to local!"
else:
zonepath = "/usr/share/zoneinfo/"
skiplist = ["zone.tab","iso3166.tab","posixrules"]
tzlist = []
if os.path.isdir(zonepath):
for entry in os.listdir(zonepath):
if entry not in skiplist:
if os.path.isdir(zonepath + "/" + entry): entry += "/"
tzlist.append(entry)
tzlist.sort()
?>
<h2>Timezone Setup </h2>
<: if error_msg:
<br><% error_msg %><br><br>
:>
Timezones:<br>
<form name="Timezone" method="post" action="/webgli/timezone.pyhtml" enctype="multipart/form-data">
<input type="hidden" name="tzback" value="<% zonepath %>"><br>
<: for timezone in tzlist:
<a href="/webgli/timezone.pyhtml?zonepath=<% zonepath+timezone %>"><% timezone %></a><br>
:>
<br><input type="submit" name="back" value="Back">
</form>
<? include /webgli/bottom.pyhtml ?>
|