Added: web2py current files
This commit is contained in:
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
{{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>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
{{if request.function=='index':}}
|
||||
<h2>{{=T("Available Databases and Tables")}}</h2>
|
||||
{{if not databases:}}{{=T("No databases in this application")}}{{pass}}
|
||||
<ul class="nav nav-tabs" id="myTab">
|
||||
<li class="nav-item"><a href="#alltables" data-toggle="tab" class="nav-link active">Tables</a></li>
|
||||
<li class="nav-item"><a href="#hooks" data-toggle="tab" class="nav-link">Hooks</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="alltables">
|
||||
<table class="table table-striped">
|
||||
{{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 btn-primary")}}
|
||||
</td>
|
||||
</tr>
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
</table>
|
||||
</div>
|
||||
<div class="tab-pane" id="hooks">
|
||||
{{=LOAD('appadmin', 'hooks', ajax=True)}}
|
||||
</div>
|
||||
</div>
|
||||
{{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 btn-primary", _role="button")}}<br/><br/>
|
||||
<hr />
|
||||
<h3>{{=T("Rows in Table")}}</h3><br/>
|
||||
{{else:}}
|
||||
<h3>{{=T("Rows selected")}}</h3><br/>
|
||||
{{pass}}
|
||||
{{=form}}
|
||||
<p class="text-muted">{{=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 btn-primary")}}{{pass}}
|
||||
{{if stop<nrows:}}{{=A(T('next %s rows') % step,_href=URL('select',args=request.args[0],vars=dict(start=start+step)),_class="btn btn-primary")}}{{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,query=query,_class='table table-striped table-bordered sortable')}}
|
||||
</div>
|
||||
{{pass}}
|
||||
<br/><br/>
|
||||
<hr />
|
||||
<h3>{{=T("Import/Export")}}</h3><br/>
|
||||
<a href="{{=URL('csv',args=request.args[0],vars=dict(query=query))}}" class="btn btn-primary">{{=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 [[Pympler https://pypi.python.org/pypi/Pympler 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().toggleClass( "w2p_hidden" );')}}
|
||||
<div class="w2p_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 [[Pympler https://pypi.python.org/pypi/Pympler 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().toggleClass( "w2p_hidden" );')}}
|
||||
<div class="w2p_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 [[Pympler https://pypi.python.org/pypi/Pympler 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().toggleClass( "w2p_hidden" );')}}
|
||||
<div class="w2p_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=='d3_graph_model':}}
|
||||
<h2>{{=T("Graph Model")}}</h2>
|
||||
{{if not databases:}}
|
||||
{{=T("No databases in this application")}}
|
||||
{{else:}}
|
||||
<div id="vis"></div>
|
||||
<link rel="stylesheet" href="{{=URL('admin','static','css/d3_graph.css')}}"/>
|
||||
<script>
|
||||
// Define the d3 input data
|
||||
{{from gluon.serializers import json }}
|
||||
var nodes = {{=XML(json(nodes))}};
|
||||
var links = {{=XML(json(links))}};
|
||||
d3_graph();
|
||||
</script>
|
||||
{{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}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1>{{=u1}}</h1>
|
||||
<h2>{{=u2}}</h2>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1>{{=u1}}</h1>
|
||||
<h1>{{=u2}}</h1>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,33 @@
|
||||
{{extend 'layout.html'}}
|
||||
|
||||
<div class="row">
|
||||
<div id="web2py_user_form" class="col-lg-6" style="background-color:white; margin: 0 auto 5px auto; box-shadow: 0 0 5px #a1a1a1; border-radius:5px;padding: 20px">
|
||||
<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>
|
||||
{{=form}}
|
||||
{{if request.args(0)=='login' and not 'register' in auth.settings.actions_disabled:}}
|
||||
<a href="{{=URL('user/register')}}">{{=T('Register')}}</a>
|
||||
<br/>
|
||||
{{pass}}
|
||||
{{if request.args(0)=='login' and not 'retrieve_password' in auth.settings.actions_disabled:}}
|
||||
<a href="{{=URL('user/retrieve_password')}}">{{=T('Lost your password?')}}</a>
|
||||
{{pass}}
|
||||
{{if request.args(0)=='register':}}
|
||||
<a href="{{=URL('user/login')}}">{{=T('Login')}}</a>
|
||||
{{pass}}
|
||||
</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,17 @@
|
||||
{{"""Usage:
|
||||
|
||||
def controller():
|
||||
return {"": db().select(db.thing.ALL)}
|
||||
|
||||
And then visit that controller with a .csv extention name
|
||||
"""
|
||||
}}{{if len(response._vars)==1:}}{{
|
||||
# Not yet find a Python 2/3 compatible StringIO pattern,
|
||||
# we avoid this solution http://web2py.com/books/default/chapter/29/10/services#CSV
|
||||
# Here we buffer the entire csv file instead (it is your controller's job to limit the volume anyway),
|
||||
# based on: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV-one-Table-at-a-time-
|
||||
|
||||
content = response._vars[next(iter(response._vars))]
|
||||
response.headers['Content-Type'] = 'application/vnd.ms-excel'
|
||||
response.write(str(content), escape=False)
|
||||
}}{{pass}}
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 3.
|
@@ -0,0 +1,13 @@
|
||||
{{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[next(iter(response._vars))])}}
|
||||
{{elif len(response._vars)>1:}}
|
||||
{{=BEAUTIFY(response._vars)}}
|
||||
{{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 disabled 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[next(iter(response._vars))]}}{{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))
|
||||
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,131 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[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 -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
|
||||
<link rel="stylesheet" href="{{=URL('static','css/bootstrap.min.css')}}"/>
|
||||
<link rel="stylesheet" href="{{=URL('static','css/web2py-bootstrap4.css')}}"/>
|
||||
<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')}}">
|
||||
<!-- All JavaScript at the bottom, except for Modernizr which enables
|
||||
HTML5 elements & feature detects -->
|
||||
<script src="{{=URL('static','js/modernizr-2.8.3.min.js')}}"></script>
|
||||
<!-- Favicons -->
|
||||
{{include 'web2py_ajax.html'}} <!-- this includes jquery.js, calendar.js/.css and web2py.js -->
|
||||
{{block head}}{{end}}
|
||||
</head>
|
||||
<body>
|
||||
<div class="w2p_flash alert alert-dismissable">{{=response.flash or ''}}</div>
|
||||
<!-- Navbar ======================================= -->
|
||||
<nav class="navbar navbar-light navbar-expand-md bg-faded bg-dark navbar-dark justify-content-center">
|
||||
<a href="http://web2py.com" class="navbar-brand d-flex w-50 mr-auto">web2py</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse w-100" id="navbarNavDropdown">
|
||||
<ul class="navbar-nav w-100 justify-content-center">
|
||||
{{for _item in response.menu or []:}}
|
||||
{{if len(_item)<4 or not _item[3]:}}
|
||||
<li class="nav-item {{if _item[1]:}}active{{pass}}">
|
||||
<a class="nav-link" href="{{=_item[2]}}">{{=_item[0]}}</a>
|
||||
</li>
|
||||
{{else:}}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="{{=_item[2]}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{=_item[0]}}</a>
|
||||
<div class="dropdown-menu">
|
||||
{{for _subitem in _item[3]:}}
|
||||
<a class="dropdown-item" href="{{=_subitem[2]}}">{{=_subitem[0]}}</a>
|
||||
{{pass}}
|
||||
</div>
|
||||
</li>
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
</ul>
|
||||
<form class="form-inline my-2 my-lg-0">
|
||||
<input class="form-control mr-sm-2" type="text" placeholder="Search">
|
||||
</form>
|
||||
{{if 'auth' in globals():}}
|
||||
<ul class="nav navbar-nav ml-auto w-100 justify-content-end">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{if auth.user:}}{{=auth.user.first_name}}{{else:}}LOGIN{{pass}}
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
{{if auth.user:}}
|
||||
<a class="dropdown-item" href="{{=URL('default','user/profile')}}">{{=T('Profile')}}</a>
|
||||
{{if 'change_password' not in auth.settings.actions_disabled:}}
|
||||
<a class="dropdown-item" href="{{=URL('default','user/change_password')}}">{{=T('Change Password')}}</a>
|
||||
{{pass}}
|
||||
<a class="dropdown-item" href="{{=URL('default','user/logout')}}">{{=T('Logout')}}</a>
|
||||
{{else:}}
|
||||
<a class="dropdown-item" href="{{=URL('default','user/login')}}">{{=T('Login')}}</a>
|
||||
{{if 'register' not in auth.settings.actions_disabled:}}
|
||||
<a class="dropdown-item" href="{{=URL('default','user/register')}}">{{=T('Sign up')}}</a>
|
||||
{{pass}}
|
||||
{{if 'retrieve_password' not in auth.settings.actions_disabled:}}
|
||||
<a class="dropdown-item" href="{{=URL('default','user/retrieve_password')}}">{{=T('Lost Password')}}</a>
|
||||
{{pass}}
|
||||
{{pass}}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
{{pass}}
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<!-- Masthead ===================================== -->
|
||||
{{block header}}
|
||||
{{end}}
|
||||
<!-- Main ========================================= -->
|
||||
<!-- Begin page content -->
|
||||
<div class="container-fluid main-container">
|
||||
{{include}}
|
||||
{{=response.toolbar() if response.show_toolbar else ''}}
|
||||
</div>
|
||||
|
||||
{{block footer}} <!-- this is default footer -->
|
||||
<footer class="footer container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="copyright pull-left">{{=T('Copyright')}} © {{=request.now.year}}</div>
|
||||
<div id="poweredBy" class="pull-right">
|
||||
{{=T('Powered by')}}
|
||||
<a href="http://www.web2py.com/">web2py</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
{{end}}
|
||||
<!-- The javascript =============================== -->
|
||||
<script src="{{=URL('static','js/bootstrap.bundle.min.js')}}"></script>
|
||||
<script src="{{=URL('static','js/web2py-bootstrap4.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}}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
<script type="text/javascript"><!--
|
||||
// These variables are used by the web2py_ajax_init function in web2py_ajax.js (which is loaded below).
|
||||
{{=ASSIGNJS(
|
||||
w2p_ajax_confirm_message = T('Are you sure you want to delete this object?'),
|
||||
w2p_ajax_disable_with_message = T('Working...'),
|
||||
w2p_ajax_date_format = T('%Y-%m-%d'),
|
||||
w2p_ajax_datetime_format = T('%Y-%m-%d %H:%M:%S'),
|
||||
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