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

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

Added a link to submitting in view view.

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 index(self):
16        """
17        Shows a table of all procs.
18        """
19        pc = ProcConfig()
20        procs = pc.renderProcsViewTable()
21
22        resp = "%s" % procs
23        renderer = UIPageRenderer()
24        resp = renderer.render("View available processes",
25                               [("Select your process", resp)])
26        return resp
27
28    def list(self):
29        """
30        Shows a drop-down list of possible procs to choose from.
31        """
32        pc = ProcConfig()
33        procs = pc.getProcList()
34 
35        resp = """      <form action="/view/proc2">
36                <p>Please select a process from the drop-down menu below and press 'GO' to view its detailed description.</p>
37                <select name="proc_id">"""
38     
39        for (proc, long_name) in procs.items():
40            resp += ('                  <option name="%s" value="%s">%s</option>\n' % (proc, proc, long_name))
41
42        resp += """             </select>
43                <input type="submit" value="GO" />
44        </form>"""
45
46        renderer = UIPageRenderer()
47        resp = renderer.render("View available processes",
48                               [("Select your process", resp)])
49
50        return resp
51
52    def proc(self):
53        """
54        Show specific view of process.
55        """
56        proc = str(request.params.get("proc_id", None))
57        if proc == None:
58            return "Please provide an argument proc=&lt;Something&gt;"
59
60        pc = ProcConfig() 
61        proc_view_html = pc.renderProcConfig(proc)
62        resp = "\n".join(proc_view_html)
63
64        renderer = UIPageRenderer()
65        resp = renderer.render("Process Description for: '%s'" % proc,
66                               [("Process: %s" % proc, resp),
67                                ("Submit a job", '<a href="/submit/form?proc_id=%s">Submit a %s request.</a>' % (proc, proc))])
68        return resp
69       
Note: See TracBrowser for help on using the repository browser.