source: cows_wps/trunk/cows_wps/controllers/view.py @ 5938

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows_wps/trunk/cows_wps/controllers/view.py@5938
Revision 5938, 1.6 KB checked in by astephen, 12 years ago (diff)

Added a lot of UI related stuff.

Line 
1import logging
2
3from pylons import request, response, session, tmpl_context as c
4from pylons.controllers.util import abort, redirect_to
5
6from cows_wps.renderer.ui_renderer import *
7from cows_wps.controllers import *
8from cows_wps.lib.ui.proc_config import *
9
10log = logging.getLogger(__name__)
11
12
13class ViewController(BaseController):
14
15    def proc(self):
16        """
17        Show specific view of process.
18        """
19
20        proc = str(request.params.get("proc_id", None))
21        if proc == None:
22            return "Please provide an argument proc=<Something>"
23
24        pc = ProcConfig() 
25        proc_view_html = pc.renderProcConfig(proc)
26        resp = "\n".join(proc_view_html)
27
28        renderer = UIPageRenderer()
29        resp = renderer.render("Process Description for: '%s'" % proc,
30                               [("Process: %s" % proc, resp)])
31        return resp
32
33    def index(self):
34        """Show generic ui list."""
35        pc = ProcConfig()
36        procs = pc.getProcList()
37 
38        resp = """      <form action="/view/proc">
39                <p>Please select a process from the drop-down menu below and press 'GO' to view its detailed description.</p>
40                <select name="proc_id">
41                """
42     
43        for (proc, long_name) in procs.items():
44            resp += ('                  <option name="%s" value="%s">%s</option>\n' % (proc, proc, long_name))
45
46        resp += """             </select>
47                <input type="submit" value="GO" />
48        </form>
49        """
50
51        renderer = UIPageRenderer()
52        resp = renderer.render("View available processes",
53                               [("Select your process", resp)])
54
55        return resp
56       
Note: See TracBrowser for help on using the repository browser.