aboutsummaryrefslogtreecommitdiffstats
path: root/packages/torouter-web/src/tui/controllers
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-10-02 16:44:03 +0200
committerficus <ficus@robocracy.org>2012-10-02 16:44:03 +0200
commitfcf6a8630b7ae818e7719d6e811d01d9359388c3 (patch)
tree81610e80263e0f326f300b1bc7ea4264df9f29ab /packages/torouter-web/src/tui/controllers
parent7dcf9aa0db8585eb3489bcf0903e67bdd9dee027 (diff)
downloadtorouter-fcf6a8630b7ae818e7719d6e811d01d9359388c3.tar.gz
torouter-fcf6a8630b7ae818e7719d6e811d01d9359388c3.zip
remove unused told TUI
Diffstat (limited to 'packages/torouter-web/src/tui/controllers')
-rw-r--r--packages/torouter-web/src/tui/controllers/__init__.py0
-rw-r--r--packages/torouter-web/src/tui/controllers/main.py27
-rw-r--r--packages/torouter-web/src/tui/controllers/network.py140
-rw-r--r--packages/torouter-web/src/tui/controllers/old/main.py11
-rw-r--r--packages/torouter-web/src/tui/controllers/old/status.py9
-rw-r--r--packages/torouter-web/src/tui/controllers/old/wizard.py81
-rw-r--r--packages/torouter-web/src/tui/controllers/tor.py59
7 files changed, 0 insertions, 327 deletions
diff --git a/packages/torouter-web/src/tui/controllers/__init__.py b/packages/torouter-web/src/tui/controllers/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/packages/torouter-web/src/tui/controllers/__init__.py
+++ /dev/null
diff --git a/packages/torouter-web/src/tui/controllers/main.py b/packages/torouter-web/src/tui/controllers/main.py
deleted file mode 100644
index fb925d3..0000000
--- a/packages/torouter-web/src/tui/controllers/main.py
+++ /dev/null
@@ -1,27 +0,0 @@
-import web
-from tui import config
-from tui import view
-from tui.view import render
-from tui.utils import session
-
-"""
-The main page for network configuration
-"""
-class index:
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.index())
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.check_login(web.input()) == 0:
- return render.base(render.index())
- else:
- return render.base(render.login())
-
-class logout:
- def GET(self):
- session.logout()
- return render.base(render.logout())
-
diff --git a/packages/torouter-web/src/tui/controllers/network.py b/packages/torouter-web/src/tui/controllers/network.py
deleted file mode 100644
index 598d332..0000000
--- a/packages/torouter-web/src/tui/controllers/network.py
+++ /dev/null
@@ -1,140 +0,0 @@
-import web
-from tui import config
-from tui import view
-from tui.view import render
-from tui.utils import session, configuration, parsing, fileio
-
-"""
-This function is used to generate the network
-submenus.
-"""
-def menu(n):
- a = []
- for i in range(0,5):
- if i == n:
- a.append("sel")
- else:
- a.append("")
- print a
- return """<ul id="submenu">
- <li><a href="/network" class="%s">Main</a></li>
- <li><a href="/network/firewall" class="%s">Firewall</a></li>
- <li><a href="/network/wireless" class="%s">Wireless</a></li>
- <li><a href="/network/wired" class="%s">Wired</a></li>
- <li><a href="/network/status" class="%s">Status</a></li>
-</ul>
-""" % tuple(a)
-
-"""
-The main page for network configuration
-"""
-class main:
- # XXX do all the backend stuff
- def update_config(self, data):
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.main(),menu(0))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- return render.base(render.main(),menu(0))
- else:
- return render.base(render.login())
-
-"""
-The firewall configuration page
-"""
-class firewall:
- # XXX do all the backend stuff
- def update_config(self, data):
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.firewall(configuration.get_form("firewall")),menu(1))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- return render.base(render.firewall(configuration.get_form("firewall")),menu(1))
- else:
- return render.base(render.login())
-
-
-
-"""
-Wireless network configuration page
-"""
-class wireless:
- # XXX do all the backend stuff
- def update_config(self, data):
- itfc = parsing.interfaces(config.interfaces_file)
- itfc.parse()
- itfc.set_ssid(data.essid)
- itfc.set_mac(data.mac)
- itfc.wifi['netmask'] = data.netmask
- itfc.wifi['address'] = data.address
- filecontent = itfc.exclude_output(config.network_interfaces[0]) + itfc.output(itfc.wifi)
- files = [('/etc/network/interfaces', filecontent)]
- fileio.write(files)
- #print itfc.output(itfc.wifi)
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.wireless(configuration.get_form("wireless")),menu(2))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- print web.input()
- return render.base(render.saved(web.input()),menu(2))
- else:
- return render.base(render.login())
-
-"""
-Wired network configuration page
-"""
-class wired:
- # XXX do all the backend stuff
- def update_config(self, data):
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- return render.base(render.wired(configuration.get_form("wired")),menu(3))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- return render.base(render.wired(),menu(3))
- else:
- return render.base(render.login())
-
-"""
-General status page, displays a bit more detail than main
-"""
-class status:
- def GET(self):
- itfc = parsing.interfaces(config.interfaces_file)
- itfc.parse()
- network = itfc.html_output(itfc.wifi) + itfc.html_output(itfc.eth0) + itfc.html_output(itfc.eth1)
- return render.base(render.status(network),menu(4))
-
- def POST(self):
- itfc = parsing.interfaces(config.interfaces_file)
- itfc.parse()
- network = itfc.html_output(itfc.wifi) + itfc.html_output(itfc.eth0) + itfc.html_output(itfc.eth1)
- return render.base(render.status(),menu(4))
-
diff --git a/packages/torouter-web/src/tui/controllers/old/main.py b/packages/torouter-web/src/tui/controllers/old/main.py
deleted file mode 100644
index 9127e72..0000000
--- a/packages/torouter-web/src/tui/controllers/old/main.py
+++ /dev/null
@@ -1,11 +0,0 @@
-import web
-
-
-class index:
- def GET(self):
- return "index"
-
-class config:
- def GET(self):
- return "config"
-
diff --git a/packages/torouter-web/src/tui/controllers/old/status.py b/packages/torouter-web/src/tui/controllers/old/status.py
deleted file mode 100644
index 05f0bf8..0000000
--- a/packages/torouter-web/src/tui/controllers/old/status.py
+++ /dev/null
@@ -1,9 +0,0 @@
-import web
-import config
-
-from config import views
-from web import form
-
-class status:
- def GET():
- print "status"
diff --git a/packages/torouter-web/src/tui/controllers/old/wizard.py b/packages/torouter-web/src/tui/controllers/old/wizard.py
deleted file mode 100644
index 7b82df2..0000000
--- a/packages/torouter-web/src/tui/controllers/old/wizard.py
+++ /dev/null
@@ -1,81 +0,0 @@
-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)
-
-
-
-
diff --git a/packages/torouter-web/src/tui/controllers/tor.py b/packages/torouter-web/src/tui/controllers/tor.py
deleted file mode 100644
index e671d80..0000000
--- a/packages/torouter-web/src/tui/controllers/tor.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import web
-from tui import config
-from tui import view
-from tui.view import render
-from tui.utils import session, parsing, fileio
-
-"""
-The main Tor status page
-"""
-class status:
- def GET(self):
- if session.is_logged() > 0:
- trc = parsing.torrc(config.torrc_file)
- trc.parse()
- output = trc.html_output()
- return render.base(render.torstatus(output,config.torrc_file))
- else:
- return render.base(render.login())
-
-
- def POST(self):
- if session.is_logged() > 0:
- trc = parsing.torrc(config.torrc_file)
- trc.parse()
- output = trc.html_output()
- return render.base(render.torstatus(output,config.torrc_file))
- else:
- return render.base(render.login())
-
-"""
-Tor configuration page
-"""
-class torrc:
- def update_config(self, data):
- # Now it will just write to /tmp/torrc
- files = [('/tmp/torrc',data.torrc)]
- fileio.write(files)
-
- return True
-
- def GET(self):
- if session.is_logged() > 0:
- trc = parsing.torrc(config.torrc_file)
- output = trc.output()
- return render.base(render.torconfig(output))
- else:
- return render.base(render.login())
-
- def POST(self):
- if session.is_logged() > 0:
- self.update_config(web.input())
- trc = parsing.torrc(config.torrc_file)
- trc.parse()
- output = trc.html_output()
- return render.base(render.torstatus(output,config.torrc_file))
- else:
- return render.base(render.login())
-
-