welcome3
This commit is contained in:
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
{{extend 'layout.html'}}
|
||||
<script><!--
|
||||
jQuery(document).ready(function(){
|
||||
jQuery("table.sortable tbody tr").mouseover( function() {
|
||||
jQuery(this).addClass("highlight"); }).mouseout( function() {
|
||||
jQuery(this).removeClass("highlight"); });
|
||||
jQuery('table.sortable tbody tr:odd').addClass('odd');
|
||||
jQuery('table.sortable tbody tr:even').addClass('even');
|
||||
});
|
||||
//--></script>
|
||||
|
||||
{{if request.function=='index':}}
|
||||
<h2>{{=T("Available Databases and Tables")}}</h2>
|
||||
{{if not databases:}}{{=T("No databases in this application")}}{{pass}}
|
||||
<table>
|
||||
{{for db in sorted(databases):}}
|
||||
{{for table in databases[db].tables:}}
|
||||
{{qry='%s.%s.id>0'%(db,table)}}
|
||||
{{tbl=databases[db][table]}}
|
||||
{{if hasattr(tbl,'_primarykey'):}}
|
||||
{{if tbl._primarykey:}}
|
||||
{{firstkey=tbl[tbl._primarykey[0]]}}
|
||||
{{if firstkey.type in ['string','text']:}}
|
||||
{{qry='%s.%s.%s!=""'%(db,table,firstkey.name)}}
|
||||
{{else:}}
|
||||
{{qry='%s.%s.%s>0'%(db,table,firstkey.name)}}
|
||||
{{pass}}
|
||||
{{else:}}
|
||||
{{qry=''}}
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
<tr>
|
||||
<th style="font-size: 1.75em;">
|
||||
{{=A("%s.%s" % (db,table),_href=URL('select',args=[db],vars=dict(query=qry)))}}
|
||||
</th>
|
||||
<td>
|
||||
{{=A(str(T('New Record')),_href=URL('insert',args=[db,table]),_class="btn")}}
|
||||
</td>
|
||||
</tr>
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
</table>
|
||||
|
||||
{{elif request.function=='select':}}
|
||||
<h2>{{=XML(str(T("Database %s select"))%A(request.args[0],_href=URL('index'))) }}
|
||||
</h2>
|
||||
{{if tb:}}
|
||||
<h3>{{=T('Traceback')}}</h3>
|
||||
<pre>
|
||||
{{=tb}}
|
||||
</pre>
|
||||
{{pass}}
|
||||
{{if table:}}
|
||||
{{=A(str(T('New Record')),_href=URL('insert',args=[request.args[0],table]),_class="btn")}}<br/><br/>
|
||||
<h3>{{=T("Rows in Table")}}</h3><br/>
|
||||
{{else:}}
|
||||
<h3>{{=T("Rows selected")}}</h3><br/>
|
||||
{{pass}}
|
||||
{{=form}}
|
||||
<p>{{=T('The "query" is a condition like "db.table1.field1==\'value\'". Something like "db.table1.field1==db.table2.field2" results in a SQL JOIN.')}}<br/>
|
||||
{{=T('Use (...)&(...) for AND, (...)|(...) for OR, and ~(...) for NOT to build more complex queries.')}}<br/>
|
||||
{{=T('"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN')}}</p>
|
||||
<br/><br/>
|
||||
<h4>{{=T("%s selected", nrows)}}</h4>
|
||||
{{if start>0:}}{{=A(T('previous %s rows') % step,_href=URL('select',args=request.args[0],vars=dict(start=start-step)),_class="btn")}}{{pass}}
|
||||
{{if stop<nrows:}}{{=A(T('next %s rows') % step,_href=URL('select',args=request.args[0],vars=dict(start=start+step)),_class="btn")}}{{pass}}
|
||||
{{if rows:}}
|
||||
<div style="overflow: auto;" width="80%">
|
||||
{{linkto = lambda f, t, r: URL('update', args=[request.args[0], r, f]) if f else "#"}}
|
||||
{{upload=URL('download',args=request.args[0])}}
|
||||
{{=SQLTABLE(rows,linkto,upload,orderby=True,_class='sortable')}}
|
||||
</div>
|
||||
{{pass}}
|
||||
<br/><br/><h3>{{=T("Import/Export")}}</h3><br/>
|
||||
<a href="{{=URL('csv',args=request.args[0],vars=dict(query=query))}}" class="btn">{{=T("export as csv file")}}</a>
|
||||
{{=formcsv or ''}}
|
||||
|
||||
{{elif request.function=='insert':}}
|
||||
<h2>{{=T("Database")}} {{=A(request.args[0],_href=URL('index'))}}
|
||||
{{if hasattr(table,'_primarykey'):}}
|
||||
{{fieldname=table._primarykey[0]}}
|
||||
{{dbname=request.args[0]}}
|
||||
{{tablename=request.args[1]}}
|
||||
{{cond = table[fieldname].type in ['string','text'] and '!=""' or '>0'}}
|
||||
{{=T("Table")}} {{=A(tablename,_href=URL('select',args=dbname,vars=dict(query='%s.%s.%s%s'%(dbname,tablename,fieldname,cond))))}}
|
||||
{{else:}}
|
||||
{{=T("Table")}} {{=A(request.args[1],_href=URL('select',args=request.args[0],vars=dict(query='%s.%s.id>0'%tuple(request.args[:2]))))}}
|
||||
{{pass}}
|
||||
</h2>
|
||||
<h3>{{=T("New Record")}}</h3><br/>
|
||||
{{=form}}
|
||||
{{elif request.function=='update':}}
|
||||
<h2>{{=T("Database")}} {{=A(request.args[0],_href=URL('index'))}}
|
||||
{{if hasattr(table,'_primarykey'):}}
|
||||
{{fieldname=request.vars.keys()[0]}}
|
||||
{{dbname=request.args[0]}}
|
||||
{{tablename=request.args[1]}}
|
||||
{{cond = table[fieldname].type in ['string','text'] and '!=""' or '>0'}}
|
||||
{{=T("Table")}} {{=A(tablename,_href=URL('select',args=dbname,vars=dict(query='%s.%s.%s%s'%(dbname,tablename,fieldname,cond))))}}
|
||||
{{=T("Record")}} {{=A('%s=%s'%request.vars.items()[0],_href=URL('update',args=request.args[:2],vars=request.vars))}}
|
||||
{{else:}}
|
||||
{{=T("Table")}} {{=A(request.args[1],_href=URL('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('update',args=request.args[:3]))}}
|
||||
{{pass}}
|
||||
</h2>
|
||||
<h3>{{=T("Edit current record")}}</h3><br/><br/>{{=form}}
|
||||
|
||||
{{elif request.function=='state':}}
|
||||
<h2>{{=T("Internal State")}}</h2>
|
||||
<h3>{{=T("Current request")}}</h3>
|
||||
{{=BEAUTIFY(request)}}
|
||||
<br/><h3>{{=T("Current response")}}</h3>
|
||||
{{=BEAUTIFY(response)}}
|
||||
<br/><h3>{{=T("Current session")}}</h3>
|
||||
{{=BEAUTIFY(session)}}
|
||||
|
||||
|
||||
{{elif request.function == 'ccache':}}
|
||||
<h2>{{T("Cache")}}</h2>
|
||||
<div class="list">
|
||||
|
||||
<div class="list-header">
|
||||
<h3>{{T("Statistics")}}</h3>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<h4>{{=T("Overview")}}</h4>
|
||||
<p>{{=T.M("Number of entries: **%s**", total['entries'])}}</p>
|
||||
{{if total['entries'] > 0:}}
|
||||
<p>{{=T.M("Hit Ratio: **%(ratio)s%%** (**%(hits)s** %%{hit(hits)} and **%(misses)s** %%{miss(misses})",
|
||||
dict(ratio=total['ratio'], hits=total['hits'], misses=total['misses']))}}
|
||||
</p>
|
||||
<p>
|
||||
{{=T("Size of cache:")}}
|
||||
{{if object_stats:}}
|
||||
{{=T.M("**%(items)s** %%{item(items)}, **%(bytes)s** %%{byte(bytes)}", dict(items=total['objects'], bytes=total['bytes']))}}
|
||||
{{if total['bytes'] > 524287:}}
|
||||
{{=T.M("(**%.0d MB**)", total['bytes'] / 1048576)}}
|
||||
{{pass}}
|
||||
{{else:}}
|
||||
{{=T.M("**not available** (requires the Python [[guppy http://pypi.python.org/pypi/guppy/ popup]] library)")}}
|
||||
{{pass}}
|
||||
</p>
|
||||
<p>
|
||||
{{=T.M("Cache contains items up to **%(hours)02d** %%{hour(hours)} **%(min)02d** %%{minute(min)} **%(sec)02d** %%{second(sec)} old.",
|
||||
dict(hours=total['oldest'][0], min=total['oldest'][1], sec=total['oldest'][2]))}}
|
||||
</p>
|
||||
{{=BUTTON(T('Cache Keys'), _onclick='jQuery("#all_keys").toggle();')}}
|
||||
<div class="hidden" id="all_keys">
|
||||
{{=total['keys']}}
|
||||
</div>
|
||||
<br />
|
||||
{{pass}}
|
||||
|
||||
<h4>{{=T("RAM")}}</h4>
|
||||
<p>{{=T.M("Number of entries: **%s**", ram['entries'])}}</p>
|
||||
{{if ram['entries'] > 0:}}
|
||||
<p>{{=T.M("Hit Ratio: **%(ratio)s%%** (**%(hits)s** %%{hit(hits)} and **%(misses)s** %%{miss(misses)})",
|
||||
dict( ratio=ram['ratio'], hits=ram['hits'], misses=ram['misses']))}}
|
||||
</p>
|
||||
<p>
|
||||
{{=T("Size of cache:")}}
|
||||
{{if object_stats:}}
|
||||
{{=T.M("**%(items)s** items, **%(bytes)s** %%{byte(bytes)}", dict(items=ram['objects'], bytes=ram['bytes']))}}
|
||||
{{if ram['bytes'] > 524287:}}
|
||||
{{=T.M("(**%.0d MB**)", ram['bytes'] / 10485576)}}
|
||||
{{pass}}
|
||||
{{else:}}
|
||||
{{=T.M("``**not available**``:red (requires the Python [[guppy http://pypi.python.org/pypi/guppy/ popup]] library)")}}
|
||||
{{pass}}
|
||||
</p>
|
||||
<p>
|
||||
{{=T.M("RAM contains items up to **%(hours)02d** %%{hour(hours)} **%(min)02d** %%{minute(min)} **%(sec)02d** %%{second(sec)} old.",
|
||||
dict(hours=ram['oldest'][0], min=ram['oldest'][1], sec=ram['oldest'][2]))}}
|
||||
</p>
|
||||
{{=BUTTON(T('RAM Cache Keys'), _onclick='jQuery("#ram_keys").toggle();')}}
|
||||
<div class="hidden" id="ram_keys">
|
||||
{{=ram['keys']}}
|
||||
</div>
|
||||
<br />
|
||||
{{pass}}
|
||||
|
||||
<h4>{{=T("DISK")}}</h4>
|
||||
<p>{{=T.M("Number of entries: **%s**", disk['entries'])}}</p>
|
||||
{{if disk['entries'] > 0:}}
|
||||
<p>
|
||||
{{=T.M("Hit Ratio: **%(ratio)s%%** (**%(hits)s** %%{hit(hits)} and **%(misses)s** %%{miss(misses)})",
|
||||
dict(ratio=disk['ratio'], hits=disk['hits'], misses=disk['misses']))}}
|
||||
</p>
|
||||
<p>
|
||||
{{=T("Size of cache:")}}
|
||||
{{if object_stats:}}
|
||||
{{=T.M("**%(items)s** %%{item(items)}, **%(bytes)s** %%{byte(bytes)}", dict( items=disk['objects'], bytes=disk['bytes']))}}
|
||||
{{if disk['bytes'] > 524287:}}
|
||||
{{=T.M("(**%.0d MB**)", disk['bytes'] / 1048576)}}
|
||||
{{pass}}
|
||||
{{else:}}
|
||||
{{=T.M("``**not available**``:red (requires the Python [[guppy http://pypi.python.org/pypi/guppy/ popup]] library)")}}
|
||||
{{pass}}
|
||||
</p>
|
||||
<p>
|
||||
{{=T.M("DISK contains items up to **%(hours)02d** %%{hour(hours)} **%(min)02d** %%{minute(min)} **%(sec)02d** %%{second(sec)} old.",
|
||||
dict(hours=disk['oldest'][0], min=disk['oldest'][1], sec=disk['oldest'][2]))}}
|
||||
</p>
|
||||
{{=BUTTON(T('Disk Cache Keys'), _onclick='jQuery("#disk_keys").toggle();')}}
|
||||
<div class="hidden" id="disk_keys">
|
||||
{{=disk['keys']}}
|
||||
</div>
|
||||
<br />
|
||||
{{pass}}
|
||||
</div>
|
||||
|
||||
<div class="list-header">
|
||||
<h3>{{=T("Manage Cache")}}</h3>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<p>
|
||||
{{=form}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
{{pass}}
|
||||
|
||||
{{if request.function=='graph_model':}}
|
||||
<h2>{{=T("Graph Model")}}</h2>
|
||||
{{if not pgv:}}
|
||||
{{=T('pygraphviz library not found')}}
|
||||
{{elif not databases:}}
|
||||
{{=T("No databases in this application")}}
|
||||
{{else:}}
|
||||
<div class="btn-group">
|
||||
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
||||
<i class="icon-download"></i> {{=T('Save model as...')}}
|
||||
<span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{{=URL('appadmin', 'bg_graph_model', args=['png'])}}">png</a></li>
|
||||
<li><a href="{{=URL('appadmin', 'bg_graph_model', args=['svg'])}}">svg</a></li>
|
||||
<li><a href="{{=URL('appadmin', 'bg_graph_model', args=['pdf'])}}">pdf</a></li>
|
||||
<li><a href="{{=URL('appadmin', 'bg_graph_model', args=['ps'])}}">ps</a></li>
|
||||
<li><a href="{{=URL('appadmin', 'bg_graph_model', args=['dot'])}}">dot</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<br />
|
||||
{{=IMG(_src=URL('appadmin', 'bg_graph_model'))}}
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
|
||||
{{if request.function == 'manage':}}
|
||||
<h2>{{=heading}}</h2>
|
||||
<ul class="nav nav-tabs">
|
||||
{{for k, tablename in enumerate(tablenames):}}
|
||||
<li{{=XML(' class="active"') if k == 0 else ''}}>
|
||||
<a href="#table-{{=tablename}}" data-toggle="tab">{{=labels[k]}}</a>
|
||||
</li>
|
||||
{{pass}}
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
{{for k, tablename in enumerate(tablenames):}}
|
||||
<div class="tab-pane{{=XML(' active') if k == 0 else ''}}" id="table-{{=tablename}}">
|
||||
{{=LOAD(f='manage.load', args=[request.args(0), k], ajax=True)}}
|
||||
</div>
|
||||
{{pass}}
|
||||
</div>
|
||||
{{pass}}
|
||||
@@ -0,0 +1,50 @@
|
||||
{{left_sidebar_enabled,right_sidebar_enabled=False,('message' in globals())}}
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
{{block head}}
|
||||
<style>
|
||||
#w2padmin-btn {margin:30px 0 30px 0;}
|
||||
</style>
|
||||
{{end head}}
|
||||
|
||||
{{if 'message' in globals():}}
|
||||
<h2>{{=message}}</h2>
|
||||
<p class="lead">{{=T('How did you get here?')}}</p>
|
||||
<ol>
|
||||
<li>{{=T('You are successfully running web2py')}}</li>
|
||||
<li>{{=XML(T('You visited the url %s', A(request.env.path_info,_href=request.env.path_info)))}}</li>
|
||||
<li>{{=XML(T('Which called the function %s located in the file %s',
|
||||
(A(request.function+'()',_href='#'),
|
||||
A('web2py/applications/%(application)s/controllers/%(controller)s.py'%request,
|
||||
_href=URL('admin','default','peek', args=(request.application,'controllers',request.controller+'.py'))))))}}</li>
|
||||
<li>{{=XML(T('The output of the file is a dictionary that was rendered by the view %s',
|
||||
A('web2py/applications/%(application)s/views/%(controller)s/index.html'%request,
|
||||
_href=URL('admin','default','peek',args=(request.application,'views',request.controller,'index.html')))))}}</li>
|
||||
<li>{{=T('You can modify this application and adapt it to your needs')}}</li>
|
||||
</ol>
|
||||
{{elif 'content' in globals():}}
|
||||
{{=content}}
|
||||
{{else:}}
|
||||
{{=BEAUTIFY(response._vars)}}
|
||||
{{pass}}
|
||||
|
||||
{{block right_sidebar}}
|
||||
<button id="w2padmin-btn" class="btn btn-primary btn-lg btn-block">
|
||||
<i class="glyphicon glyphicon-cog"></i> {{=T("Administrative Interface")}}</button>
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading">{{=T("Don't know what to do?")}}</div>
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">{{=A(T("Online examples"), _href=URL('examples','default','index'))}}</li>
|
||||
<li class="list-group-item"><a href="http://web2py.com">web2py.com</a></li>
|
||||
<li class="list-group-item"><a href="http://web2py.com/book">{{=T('Documentation')}}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{block page_js}}
|
||||
<script>
|
||||
$('#w2padmin-btn').click(function() {
|
||||
window.location = "{{=URL('admin','default','index')}}";
|
||||
});
|
||||
</script>
|
||||
{{end}}
|
||||
@@ -0,0 +1,36 @@
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
<h2>
|
||||
{{=T('Sign Up') if request.args(0) == 'register' else T('Log In') if request.args(0) == 'login' else T(request.args(0).replace('_',' ').title())}}
|
||||
</h2>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div id="web2py_user_form" class="col-lg-6">
|
||||
{{
|
||||
if request.args(0)=='login':
|
||||
if not 'register' in auth.settings.actions_disabled:
|
||||
form.add_button(T('Sign Up'),URL(args='register', vars={'_next': request.vars._next} if request.vars._next else None),_class='btn btn-default')
|
||||
pass
|
||||
if not 'request_reset_password' in auth.settings.actions_disabled:
|
||||
form.add_button(T('Lost Password'),URL(args='request_reset_password'),_class='btn btn-default')
|
||||
pass
|
||||
pass
|
||||
=form
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{{block page_js}}
|
||||
<script>
|
||||
jQuery("#web2py_user_form input:visible:enabled:first").focus();
|
||||
{{if request.args(0)=='register':}}
|
||||
web2py_validate_entropy(jQuery('#auth_user_password'),100);
|
||||
{{elif request.args(0)=='change_password':}}
|
||||
web2py_validate_entropy(jQuery('#no_table_new_password'),100);
|
||||
{{pass}}
|
||||
</script>
|
||||
{{end page_js}}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
{{extend 'layout.html'}}
|
||||
{{"""
|
||||
|
||||
You should not modify this file.
|
||||
It is used as default when a view is not provided for your controllers
|
||||
|
||||
"""}}
|
||||
<h2>{{=' '.join(x.capitalize() for x in request.function.split('_'))}}</h2>
|
||||
{{if len(response._vars)==1:}}
|
||||
{{=BEAUTIFY(response._vars.values()[0])}}
|
||||
{{elif len(response._vars)>1:}}
|
||||
{{=BEAUTIFY(response._vars)}}
|
||||
{{pass}}
|
||||
{{if request.is_local:}}
|
||||
{{=response.toolbar()}}
|
||||
{{pass}}
|
||||
@@ -0,0 +1,17 @@
|
||||
{{
|
||||
###
|
||||
# response._vars contains the dictionary returned by the controller action
|
||||
# Assuming something like:
|
||||
#
|
||||
# db.define_table('event',
|
||||
# Field('title'),
|
||||
# Field('start_datetime','datetime'),
|
||||
# Field('stop_datetime','datetime'))
|
||||
# events = db(db.event).select()
|
||||
#
|
||||
# Aor this to work the action must return something like
|
||||
#
|
||||
# dict(events=events, title='title',link=URL('action'),timeshift=0)
|
||||
#
|
||||
###
|
||||
from gluon.serializers import ics}}{{=XML(ics(**response._vars))}}
|
||||
@@ -0,0 +1 @@
|
||||
{{from gluon.serializers import json}}{{=XML(json(response._vars))}}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{
|
||||
###
|
||||
# response._vars contains the dictionary returned by the controller action
|
||||
###
|
||||
|
||||
# security check! This file is an example for a jsonp view.
|
||||
# it is not safe to use as a generic.jsonp because of security implications.
|
||||
|
||||
if response.view == 'generic.jsonp':
|
||||
raise HTTP(501,'generic.jsonp diasbled for security reasons')
|
||||
|
||||
try:
|
||||
from gluon.serializers import json
|
||||
result = "%s(%s)" % (request.vars['callback'], json(response._vars))
|
||||
response.write(result, escape=False)
|
||||
response.headers['Content-Type'] = 'application/jsonp'
|
||||
except (TypeError, ValueError):
|
||||
raise HTTP(405, 'JSON serialization error')
|
||||
except ImportError:
|
||||
raise HTTP(405, 'JSON not available')
|
||||
except:
|
||||
raise HTTP(405, 'JSON error')
|
||||
}}
|
||||
@@ -0,0 +1,30 @@
|
||||
{{'''
|
||||
# License: Public Domain
|
||||
# Author: Iceberg at 21cn dot com
|
||||
|
||||
With this generic.load file, you can use same function to serve two purposes.
|
||||
|
||||
= regular action
|
||||
- ajax callback (when called with .load)
|
||||
|
||||
Example modified from http://www.web2py.com/AlterEgo/default/show/252:
|
||||
|
||||
def index():
|
||||
return dict(
|
||||
part1='hello world',
|
||||
part2=LOAD(url=URL(r=request,f='auxiliary.load'),ajax=True))
|
||||
|
||||
def auxiliary():
|
||||
form=SQLFORM.factory(Field('name'))
|
||||
if form.accepts(request.vars):
|
||||
response.flash = 'ok'
|
||||
return dict(message="Hello %s" % form.vars.name)
|
||||
return dict(form=form)
|
||||
|
||||
Notice:
|
||||
|
||||
- no need to set response.headers['web2py-response-flash']
|
||||
- no need to return a string
|
||||
even if the function is called via ajax.
|
||||
|
||||
'''}}{{if len(response._vars)==1:}}{{=response._vars.values()[0]}}{{else:}}{{=BEAUTIFY(response._vars)}}{{pass}}
|
||||
@@ -0,0 +1,69 @@
|
||||
{{"""
|
||||
this is an example of usage of google map
|
||||
the web2py action should be something like:
|
||||
|
||||
def map():
|
||||
return dict(
|
||||
googlemap_key='...',
|
||||
center_latitude = 41.878,
|
||||
center_longitude = -87.629,
|
||||
scale = 7,
|
||||
maker = lambda point: A(row.id,_href='...')
|
||||
points = db(db.point).select() where a points have latitute and longitude
|
||||
)
|
||||
|
||||
the corresponding views/defaut/map.html should be something like:
|
||||
|
||||
\{\{extend 'layout.html'\}\}
|
||||
<center>\{\{include 'generic.map'\}\}</center>
|
||||
|
||||
"""}}
|
||||
<script src="http://maps.google.com/maps?file=api&v=2&key={{=googlemap_key}}" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function load() {
|
||||
if (GBrowserIsCompatible()) {
|
||||
var map = new GMap2(document.getElementById("map"));
|
||||
map.addControl(new GSmallMapControl());
|
||||
map.addControl(new GMapTypeControl());
|
||||
map.setCenter(new GLatLng({{=center_latitude}},
|
||||
{{=center_longitude}}), {{=scale}});
|
||||
// Create a base icon for all of our markers that specifies the
|
||||
// shadow, icon dimensions, etc.
|
||||
var baseIcon = new GIcon();
|
||||
baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
||||
baseIcon.iconSize = new GSize(20, 34);
|
||||
baseIcon.shadowSize = new GSize(37, 34);
|
||||
baseIcon.iconAnchor = new GPoint(9, 34);
|
||||
baseIcon.infoWindowAnchor = new GPoint(9, 2);
|
||||
baseIcon.infoShadowAnchor = new GPoint(18, 14);
|
||||
var blueIcon = new GIcon();
|
||||
blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
|
||||
blueIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
|
||||
blueIcon.iconSize = new GSize(37, 34);
|
||||
blueIcon.shadowSize = new GSize(37, 34);
|
||||
blueIcon.iconAnchor = new GPoint(9, 34);
|
||||
blueIcon.infoWindowAnchor = new GPoint(9, 2);
|
||||
blueIcon.infoShadowAnchor = new GPoint(18, 14);
|
||||
|
||||
function createMarker(point, i, message) {
|
||||
// Set up our GMarkerOptions object
|
||||
if(i==0) markerOptions = { icon:blueIcon };
|
||||
else markerOptions= {}
|
||||
var marker = new GMarker(point, markerOptions);
|
||||
GEvent.addListener(marker, "click", function() {
|
||||
marker.openInfoWindowHtml(message);
|
||||
});
|
||||
return marker;
|
||||
}
|
||||
{{for point in points:}}{{if point.latitude and point.longitude:}}
|
||||
var point = new GLatLng({{=point.latitude}},{{=point.longitude}});
|
||||
map.addOverlay(createMarker(point, 0,
|
||||
'{{=point.get('map_marker',maker(point))}}'));
|
||||
{{pass}}{{pass}}
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
<div id="map" style="width: 800px; height: 500px"></div>
|
||||
<script>load();</script>
|
||||
@@ -0,0 +1,11 @@
|
||||
{{
|
||||
import os
|
||||
from gluon.contrib.generics import pdf_from_html
|
||||
filename = '%s/%s.html' % (request.controller,request.function)
|
||||
if os.path.exists(os.path.join(request.folder,'views',filename)):
|
||||
html=response.render(filename)
|
||||
else:
|
||||
html=BODY(BEAUTIFY(response._vars)).xml()
|
||||
pass
|
||||
=pdf_from_html(html)
|
||||
}}
|
||||
@@ -0,0 +1,10 @@
|
||||
{{
|
||||
###
|
||||
# response._vars contains the dictionary returned by the controller action
|
||||
# for this to work the action must return something like
|
||||
#
|
||||
# dict(title=...,link=...,description=...,created_on='...',items=...)
|
||||
#
|
||||
# items is a list of dictionaries each with title, link, description, pub_date.
|
||||
###
|
||||
from gluon.serializers import rss}}{{=XML(rss(response._vars))}}
|
||||
@@ -0,0 +1 @@
|
||||
{{from gluon.serializers import xml}}{{=XML(xml(response._vars,quote=False))}}
|
||||
@@ -0,0 +1,143 @@
|
||||
<!--[if HTML5]><![endif]-->
|
||||
<!DOCTYPE html>
|
||||
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
|
||||
<!--[if lt IE 7]><html class="ie ie6 ie-lte9 ie-lte8 ie-lte7 no-js" lang="{{=T.accepted_language or 'en'}}"> <![endif]-->
|
||||
<!--[if IE 7]><html class="ie ie7 ie-lte9 ie-lte8 ie-lte7 no-js" lang="{{=T.accepted_language or 'en'}}"> <![endif]-->
|
||||
<!--[if IE 8]><html class="ie ie8 ie-lte9 ie-lte8 no-js" lang="{{=T.accepted_language or 'en'}}"> <![endif]-->
|
||||
<!--[if IE 9]><html class="ie9 ie-lte9 no-js" lang="{{=T.accepted_language or 'en'}}"> <![endif]-->
|
||||
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="{{=T.accepted_language or 'en'}}"> <!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<!-- www.phpied.com/conditional-comments-block-downloads/ -->
|
||||
<!-- Always force latest IE rendering engine
|
||||
(even in intranet) & Chrome Frame
|
||||
Remove this if you use the .htaccess -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge{{=not request.is_local and ',chrome=1' or ''}}">
|
||||
<!-- Mobile Viewport Fix
|
||||
j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag
|
||||
device-width: Occupy full width of the screen in its current orientation
|
||||
initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height
|
||||
user-scalable = yes allows the user to zoom in -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{=response.title or request.application}}</title>
|
||||
<!-- http://dev.w3.org/html5/markup/meta.name.html -->
|
||||
<meta name="application-name" content="{{=request.application}}">
|
||||
<!-- Speaking of Google, don't forget to set your site up:
|
||||
http://google.com/webmasters -->
|
||||
<meta name="google-site-verification" content="">
|
||||
<!-- include stylesheets -->
|
||||
{{
|
||||
response.files.insert(0,URL('static','css/web2py.css'))
|
||||
response.files.insert(1,URL('static','css/bootstrap.min.css'))
|
||||
response.files.insert(4,URL('static','css/web2py-bootstrap3.css'))
|
||||
}}
|
||||
<!-- All JavaScript at the bottom, except for Modernizr which enables
|
||||
HTML5 elements & feature detects -->
|
||||
<script src="{{=URL('static','js/modernizr.custom.js')}}"></script>
|
||||
<!-- Favicons -->
|
||||
<link rel="shortcut icon" href="{{=URL('static','images/favicon.ico')}}" type="image/x-icon">
|
||||
<link rel="apple-touch-icon" href="{{=URL('static','images/favicon.png')}}">
|
||||
{{include 'web2py_ajax.html'}}
|
||||
{{block head}}{{end}}
|
||||
<!--[if lt IE 9]>
|
||||
<script src="{{=URL('static','js/respond.min.js')}}"></script>
|
||||
<![endif]-->
|
||||
{{
|
||||
# using sidebars need to know what sidebar you want to use
|
||||
mc0 = 'col-md-12'
|
||||
mc1 = 'col-md-9'
|
||||
mc2 = 'col-md-6'
|
||||
left_sidebar_enabled = globals().get('left_sidebar_enabled', False)
|
||||
right_sidebar_enabled = globals().get('right_sidebar_enabled', False)
|
||||
middle_column = {0: mc0, 1: mc1, 2: mc2}[
|
||||
(left_sidebar_enabled and 1 or 0)+(right_sidebar_enabled and 1 or 0)]
|
||||
}}
|
||||
</head>
|
||||
<body>
|
||||
<div class="flash alert centered alert-dismissable">{{=response.flash or ''}}</div>
|
||||
<!-- Navbar =================================================================== -->
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
{{=response.logo or ''}}
|
||||
</div>
|
||||
<div class="collapse navbar-collapse navbar-ex1-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{{='auth' in globals() and auth.navbar('Welcome',mode='dropdown') or ''}}
|
||||
</ul>
|
||||
{{if response.menu:}}
|
||||
{{=MENU(response.menu, _class='nav navbar-nav',li_class='dropdown',ul_class='dropdown-menu')}}
|
||||
{{pass}}
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<!-- Masthead ================================================================= -->
|
||||
<header class="container">
|
||||
<div class="page-header">
|
||||
{{if response.title:}}
|
||||
<h1>{{=response.title}}
|
||||
<small>{{=response.subtitle or ''}}</small></h1>
|
||||
{{pass}}
|
||||
</div>
|
||||
</header>
|
||||
<!-- Main ===================================================================== -->
|
||||
<main class="container" id="content" role="main">
|
||||
<div class="row">
|
||||
{{if left_sidebar_enabled:}}
|
||||
<!-- left sidebar ---------------------------------------------------------- -->
|
||||
<div class="col-md-3">
|
||||
{{block left_sidebar}}
|
||||
{{end left_sidebar}}
|
||||
</div>
|
||||
{{pass}}
|
||||
<!-- central column -------------------------------------------------------- -->
|
||||
<div class="{{=middle_column}}">
|
||||
{{block center_page}}
|
||||
{{include}}
|
||||
{{end center_page}}
|
||||
</div>
|
||||
{{if right_sidebar_enabled:}}
|
||||
<!-- right sidebar --------------------------------------------------------- -->
|
||||
<div class="col-md-3">
|
||||
{{block right_sidebar}}
|
||||
{{end right_sidebar}}
|
||||
</div>
|
||||
{{pass}}
|
||||
</div>
|
||||
</main>
|
||||
<!-- Footer =================================================================== -->
|
||||
<footer id="footer" class="container">
|
||||
<div class="row">
|
||||
{{block footer}}
|
||||
<div class="col-xs-6">
|
||||
<p>{{=T('Copyright')}} © {{=request.now.year}}</p>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<p class="pull-right">{{=T('Powered by')}} <a href="http://www.web2py.com/">web2py</a></p>
|
||||
</div>
|
||||
{{end footer}}
|
||||
</div>
|
||||
</footer>
|
||||
<!-- The javascript =========================================================== -->
|
||||
<script src="{{=URL('static','js/bootstrap.min.js')}}"></script>
|
||||
<script src="{{=URL('static','js/web2py-bootstrap3.js')}}"></script>
|
||||
{{block page_js}}{{end page_js}}
|
||||
{{if response.google_analytics_id:}}
|
||||
<!-- Analytics ================================================================ -->
|
||||
<script src="{{=URL('static','js/analytics.min.js')}}"></script>
|
||||
<script type="text/javascript">
|
||||
analytics.initialize({
|
||||
'Google Analytics':{trackingId:'{{=response.google_analytics_id}}'}
|
||||
});
|
||||
</script>
|
||||
{{pass}}
|
||||
<!-- Share ==================================================================== -->
|
||||
<script src="{{=URL('static','js/share.js',vars=dict(static=URL('static','images')))}}"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,16 @@
|
||||
<script type="text/javascript"><!--
|
||||
// These variables are used by the web2py_ajax_init function in web2py_ajax.js (which is loaded below).
|
||||
var w2p_ajax_confirm_message = "{{=T('Are you sure you want to delete this object?')}}";
|
||||
var w2p_ajax_disable_with_message = "{{=T('Working...')}}";
|
||||
var w2p_ajax_date_format = "{{=T('%Y-%m-%d')}}";
|
||||
var w2p_ajax_datetime_format = "{{=T('%Y-%m-%d %H:%M:%S')}}";
|
||||
var ajax_error_500 = '{{=T.M('An error occured, please [[reload %s]] the page') % URL(args=request.args, vars=request.get_vars) }}'
|
||||
//--></script>
|
||||
{{
|
||||
response.files.insert(0,URL('static','js/jquery.js'))
|
||||
response.files.insert(1,URL('static','css/calendar.css'))
|
||||
response.files.insert(2,URL('static','js/calendar.js'))
|
||||
response.files.insert(3,URL('static','js/web2py.js'))
|
||||
response.include_meta()
|
||||
response.include_files()
|
||||
}}
|
||||
Reference in New Issue
Block a user