{{extend 'layout.html'}} {{if request.function=='index':}}

{{=T("Available databases and tables")}}

{{if not databases:}}{{=T("No databases in this application")}}{{pass}} {{for db in sorted(databases):}} {{for table in databases[db].tables:}}

{{=A("%s.%s"%(db,table),_href=URL(r=request,f='select',args=[db],vars=dict(query='%s.%s.id>0'%(db,table))))}}

[ {{=A(str(T('insert new'))+' '+table,_href=URL(r=request,f='insert',args=[db,table]))}} ]

{{pass}} {{pass}} {{elif request.function=='select':}}

{{=XML(str(T("database %s select"))%A(request.args[0],_href=URL(r=request,f='index'))) }}

{{if table:}} [ {{=A(str(T('insert new %s'))%table,_href=URL(r=request,f='insert',args=[request.args[0],table]))}} ]

{{=T("Rows in table")}}


{{else:}}

{{=T("Rows selected")}}


{{pass}} {{=form}}

{{=T('The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.')}}
{{=T('Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.')}}
{{=T('"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN')}}



{{=nrows}} {{=T("selected")}}

{{if start>0:}}[ {{=A(T('previous 100 rows'),_href=URL(r=request,f='select',args=request.args[0],vars=dict(start=start-100)))}} ]{{pass}} {{if stop {{linkto=URL(r=request,f='update',args=request.args[0])}} {{upload=URL(r=request,f='download',args=request.args[0])}} {{=SQLTABLE(rows,linkto,upload,orderby=True,_class='sortable')}} {{pass}}

{{=T("Import/Export")}}


[ {{=T("export as csv file")}} ] {{if table:}} {{=FORM(str(T('or import from csv file'))+" ",INPUT(_type='file',_name='csvfile'),INPUT(_type='hidden',_value=table,_name='table'),INPUT(_type='submit',_value='import'))}} {{pass}} {{elif request.function=='insert':}}

{{=T("database")}} {{=A(request.args[0],_href=URL(r=request,f='index'))}} {{=T("table")}} {{=A(request.args[1],_href=URL(r=request,f='select',args=request.args[0],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))}}

{{=T("New Record")}}


{{=form}} {{elif request.function=='update':}}

{{=T("database")}} {{=A(request.args[0],_href=URL(r=request,f='index'))}} {{=T("table")}} {{=A(request.args[1],_href=URL(r=request,f='select',args=request.args[0],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))}} {{=T("record id")}} {{=A(request.args[2],_href=URL(r=request,f='update',args=request.args[:3]))}}

{{=T("Edit current record")}}



{{=form}} {{elif request.function=='state':}}

{{=T("Internal State")}}

{{=T("Current request")}}

{{=BEAUTIFY(request)}}

{{=T("Current response")}}

{{=BEAUTIFY(response)}}

{{=T("Current session")}}

{{=BEAUTIFY(session)}} {{pass}}