| | 1 | {{{ |
| | 2 | # RESTful controller function |
| | 3 | @t2.requires_login('login') |
| | 4 | def feature(): |
| | 5 | if request.args: |
| | 6 | method=request.args[0] |
| | 7 | try: |
| | 8 | id = int(method) |
| | 9 | item=t2.display(db.gis_feature) |
| | 10 | response.view='gis/display_feature.html' |
| | 11 | return dict(module_name=module_name,modules=modules,options=options,item=item) |
| | 12 | except: |
| | 13 | if method=="create": |
| | 14 | form=t2.create(db.gis_feature) |
| | 15 | return dict(module_name=module_name,modules=modules,options=options,form=form) |
| | 16 | elif method=="display": |
| | 17 | item=t2.display(db.gis_feature) |
| | 18 | response.view='gis/display_feature.html' |
| | 19 | return dict(module_name=module_name,modules=modules,options=options,item=item) |
| | 20 | elif method=="update": |
| | 21 | form=t2.update(db.gis_feature) |
| | 22 | response.view='gis/update_feature.html' |
| | 23 | return dict(module_name=module_name,modules=modules,options=options,form=form) |
| | 24 | elif method=="delete": |
| | 25 | t2.delete(db.gis_feature,next='features') |
| | 26 | return |
| | 27 | else: |
| | 28 | # Invalid! |
| | 29 | return |
| | 30 | else: |
| | 31 | # List Features (NB currently simple) |
| | 32 | list=t2.itemize(db.gis_feature) |
| | 33 | response.view='gis/list.html' |
| | 34 | return dict(module_name=module_name,modules=modules,options=options,list=list) |
| | 35 | }}} |