aboutsummaryrefslogtreecommitdiffstats
path: root/packages/torouter-web/src/tui/controllers/old/wizard.py
blob: 7b82df2d2bbd3568c242719894cc01557bc24cd8 (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
import web 

from web import form
from config import view

class step:
  cur_step = 1
  next_step = 2
  wiztext = []
  wizform = []

  wiztext.append("Tor Configuration")
  wizform.append(form.Form(
          form.Textbox('Nickname',
            form.notnull, description="Relay Nickname"),
          form.Textbox('RelayBandwidthRate',
            form.notnull, description="Relay Bandwidth Rate"),
          form.Textbox('RelayBandwidthBurst',
            form.notnull, description="Relay Bandwidth Burst"),
          form.Textbox('ContactInfo',
            form.notnull, description="Contact Info"),
          form.Textbox('ExitPolicy',
            form.notnull, description="Exit Policy"),
          form.Button('Next Step')
          ))

  wiztext.append("Wireless setup")
  wizform.append(form.Form(
          form.Textbox('essid',
            form.notnull, description="Wireless ESSID"),
          form.Textbox('mac',
            form.notnull, description="MAC address"),
          form.Textbox('whatever',
            form.notnull, description="Wireless ESSID"),
          form.Button('Next Step')
          ))

  wiztext.append("")
  wizform.append(form.Form(
          form.Textbox('essid',
            form.notnull, description="Wireless ESSID"),
          form.Textbox('mac',
            form.notnull, description="MAC address"),
          form.Textbox('whatever',
            form.notnull, description="Wireless ESSID"),
          form.Button('Next Step')
          ))

  wiztext.append("")
  wizform.append(form.Form(
          form.Textbox('essid',
            form.notnull, description="Wireless ESSID"),
          form.Textbox('mac',
            form.notnull, description="MAC address"),
          form.Textbox('whatever',
            form.notnull, description="Wireless ESSID"),
          form.Button('Next Step')
          ))
  
  def GET(self, step):
    if step:
      self.cur_step = int(step)
      self.next_step = int(step) + 1
    else:
      self.cur_step = 1
      self.next_step = 2
    if len(self.wizform) < int(self.cur_step):
      return "Done!"
    return view.wizard(self.wizform[self.cur_step-1], self.wiztext[self.cur_step-1], self.cur_step, self.next_step)

  def POST(self, step):
    x = web.input()
    self.cur_step = int(step)
    self.next_step = int(step) + 1
    if len(self.wizform) < int(self.cur_step):
      return "Done!"
    return view.wizard(self.wizform[self.cur_step-1], self.wiztext[self.cur_step-1], self.cur_step, self.next_step)