ABOUT0000755000076500007650000000014410745732774016345 0ustar massimodipierromassimodipierro00000000000000This is a basic e-commerce web size that works with Google Checkout developed by Massimo Di Pierro LICENSE0000755000076500007650000000300210745732774016551 0ustar massimodipierromassimodipierro00000000000000Copyright (c) 2007, Massimo Di Pierro All rights reserved. Licensed under GPL v2 agreement. In particular, redistribution and use in source and binary forms are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Gluon nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cache/0000755000076500007650000000000011031621174016565 5ustar massimodipierromassimodipierro00000000000000cache/cache.lock0000644000076500007650000000000011031621174020470 0ustar massimodipierromassimodipierro00000000000000controllers/0000755000076500007650000000000011031621164020067 5ustar massimodipierromassimodipierro00000000000000controllers/appadmin.py0000755000076500007650000001137711031621164022246 0ustar massimodipierromassimodipierro00000000000000########################################################### ### make sure administrator is on localhost ############################################################ import os from gluon.contenttype import contenttype from gluon.fileutils import check_credentials if request.env.remote_addr!=request.env.http_host.split(':')[0]: raise HTTP(400) if not check_credentials(request): redirect('/admin') response.view='appadmin.html' response.menu=[['design',False,'/admin/default/design/%s' % request.application], ['db',False,'/%s/%s/index' % (request.application, request.controller)], ['state',False,'/%s/%s/state' % (request.application, request.controller)]] ########################################################### ### list all tables in database ############################################################ def index(): import types as _types _dbs={} for _key,_value in globals().items(): try: if _value.__class__==SQLDB: tables=_dbs[_key]=[] for _tablename in _value.tables(): tables.append((_key,_tablename)) except: pass return dict(dbs=_dbs) ########################################################### ### insert a new record ############################################################ def insert(): try: dbname=request.args[0] db=eval(dbname) table=request.args[1] form=SQLFORM(db[table]) except: redirect(URL(r=request,f='index')) if form.accepts(request.vars,session): response.flash='new record inserted' return dict(form=form) ########################################################### ### list all records in table and insert new record ############################################################ def download(): filename=request.args[0] response.headers['Content-Type']=contenttype(filename) return open(os.path.join(request.folder,'uploads/','%s' % filename),'rb').read() def csv(): try: dbname=request.vars.dbname db=eval(dbname) records=db(request.vars.query).select() except: redirect(URL(r=request,f='index')) response.headers['Content-Type']='text/csv' return str(records) def select(): try: dbname=request.args[0] db=eval(dbname) if not request.vars.query: table=request.args[1] query='%s.id>0' % table else: query=request.vars.query except: redirect(URL(r=request,f='index')) ### if import from csv if request.vars.csvfile!=None: try: db[table].import_from_csv_file(request.vars.csvfile.file) response.flash='data uploaded' except: reponse.flash='unable to parse csv file' ### if delete if request.vars.delete_all and request.vars.delete_all_sure=='yes': try: db(query).delete() response.flash='records deleted' except: response.flash='invalid SQL FILTER' ### if update elif request.vars.update_string: try: env=dict(db=db,query=query) exec('db(query).update('+request.vars.update_string+')') in env response.flash='records updated' except: response.flash='invalid SQL FILTER or UPDATE STRING' ### if limitby if request.vars.start: start=int(request.vars.start) else: start=0 limitby=(start,start+100) try: records=db(query).select(limitby=limitby) except: response.flash='invalid SQL FILTER' return dict(records='no records',nrecords=0,query=query,start=0) linkto=URL(r=request,f='update/%s'% (dbname)) upload=URL(r=request,f='download') return dict(start=start,query=query,\ nrecords=len(records),\ records=SQLTABLE(records,linkto,upload,_class='sortable')) ########################################################### ### edit delete one record ############################################################ def update(): try: dbname=request.args[0] db=eval(dbname) table=request.args[1] except: redirect(URL(r=request,f='index')) try: id=int(request.args[2]) record=db(db[table].id==id).select()[0] except: redirect(URL(r=request,f='select/%s/%s'%(dbname,table))) form=SQLFORM(db[table],record,deletable=True, linkto=URL(r=request,f='select/'+dbname), upload=URL(r=request,f='download/')) if form.accepts(request.vars,session): response.flash='done!' redirect(URL(r=request,f='select/%s/%s'%(dbname,table))) return dict(form=form) ########################################################### ### get global variables ############################################################ def state(): return dict(state=request.env) controllers/default.py0000755000076500007650000000775011031621164022101 0ustar massimodipierromassimodipierro00000000000000 if not session.chart: session.chart, session.balance={},0 app=request.application response.menu=\ [['Store Front',request.function=='index','/%s/default/index'%app], ['About Us',request.function=='aboutus','/%s/default/aboutus'%app], ['Contact Us',request.function=='contactus','/%s/default/contactus'%app], ['Shopping Chart $%.2f'%float(session.balance),request.function=='checkout', '/%s/default/checkout'%app]] session.google_merchant_id=mystore.google_merchant_id if not session.google_merchant_id: redirect(URL(r=request,c='manage',f='index')) def index(): categories=store(store.category.id>0).select(orderby=store.category.name) featured=store(store.product.featured=='T')\ .select(orderby=~store.product.id) return dict(categories=categories,featured=featured) def category(): if len(request.args)<1: redirect(URL(r=request,f='index')) category=request.args[0] if len(request.args)==3: start,stop=int(request.args[1]),int(request.args[2]) else: start,stop=0,20 categories=store(store.category.id>0).select(orderby=store.category.name) for item in categories: if str(item.id)==category: category_name=item.name if start==0: featured=store(store.product.featured=='T')\ (store.product.category==category)\ .select(orderby=~store.product.id) else: featured=[] ids=[p.id for p in featured] favourites=store(store.product.category==category)\ .select(orderby=~store.product.rating,limitby=(start,stop)) favourites=[f for f in favourites if not f.id in ids] return dict(category_name=category_name,categories=categories, featured=featured,favourites=favourites) def product(): if len(request.args)!=1: redirect(URL(r=request,f='index')) pid=request.args[0] products=store(store.product.id==pid).select() if not len(products): redirect(URL(r=request,f='index')) product=products[0] product.update_record(viewed=product.viewed+1) # post a comment about a product form=SQLFORM(store.comment,fields=['author','email','body','rate']) form.vars.product=pid nc=store(store.comment.product==pid).select("count(*)")[0]["count(*)"] if form.accepts(request.vars,session): t=products[0].rating*nc+int(form.vars.rate) products[0].update_record(rating=t/(nc+1)) response.flash='comment posted' if form.errors: response.flash='please check your form below' comments=store(store.comment.product==pid).select(orderby=~store.comment.id) return dict(product=product,comments=comments, form=form) def add_to_chart(): # allow add to chart pid=request.args[0] product=store(store.product.id==pid).select()[0] product.update_record(clicked=product.clicked+1) try: qty=session.chart[pid]+1 except: qty=1 session.chart[pid]=qty session.balance+=product.price redirect(URL(r=request,f='checkout')) def remove_from_chart(): # allow add to chart pid=request.args[0] product=store(store.product.id==pid).select()[0] if session.chart.has_key(pid): session.balance-=product.price session.chart[pid]-=1 if not session.chart[pid]: del session.chart[pid] redirect(URL(r=request,f='checkout')) def empty_chart(): # allow add to chart session.chart, session.balance={},0 redirect(URL(r=request,f='checkout')) def checkout(): pids=session.chart.keys() chart={} pids=session.chart.keys() products={} for pid in pids: products[pid]=store(store.product.id==pid).select()[0] return dict(products=products,merchant_id=session.google_merchant_id) def popup(): return dict() def show(): response.session_id=None import gluon.contenttype, os filename=request.args[0] response.headers['Content-Type']=gluon.contenttype.contenttype(filename) return open(os.path.join(request.folder,'uploads/','%s' % filename),'rb').read() def aboutus(): return dict() def contactus(): return dict() controllers/manage.py0000755000076500007650000001454611031733437021715 0ustar massimodipierromassimodipierro00000000000000########################################################### ### make sure administrator is on localhost ############################################################ import os from gluon.contenttype import contenttype from gluon.fileutils import check_credentials, listdir if request.env.remote_addr!=request.env.http_host.split(':')[0]: raise HTTP(400) if not session.authorized and not request.function=='login': redirect('login') response.view='manage.html' response.menu=[['manage',True,'/%s/manage/index' % (request.application)], ['logout',False,'/%s/manage/logout' % (request.application)], ['back to store',False,'/%s/default/index' % (request.application)]] ########################################################### ### list all tables in database ############################################################ def login(): response.view='manage/login.html' from gluon.fileutils import check_credentials if check_credentials(request,'admin'): session.authorized=True redirect(URL(r=request,f='index')) return dict() def logout(): session.authorized=False redirect('/%s/default/index' % request.application) def index(): import types as _types _dbs={} for _key,_value in globals().items(): try: if _value.__class__==SQLDB: tables=_dbs[_key]=[] for _tablename in _value.tables(): tables.append((_key,_tablename)) except: pass return dict(dbs=_dbs) ########################################################### ### insert a new record ############################################################ def insert(): try: dbname=request.args[0] db=eval(dbname) table=request.args[1] form=SQLFORM(db[table]) except: redirect(URL(r=request,f='index')) if form.accepts(request.vars,session): response.flash='new record inserted' redirect(URL(r=request,f='select',args=request.args)) elif len(request.vars): response.flash='There are error in your submission form' return dict(form=form) ########################################################### ### list all records in table and insert new record ############################################################ def download(): filename=request.args[0] response.headers['Content-Type']=contenttype(filename) return open(os.path.join(request.folder,'uploads/','%s' % filename),'rb').read() def csv(): import gluon.contenttype, csv, cStringIO response.headers['Content-Type']=gluon.contenttype.contenttype('.csv') try: dbname=request.vars.dbname db=eval(dbname) records=db(request.vars.query).select() except: redirect(URL(r=request,f='index')) s=cStringIO.StringIO() writer = csv.writer(s) writer.writerow(records.colnames) c=range(len(records.colnames)) for i in range(len(records)): writer.writerow([records.response[i][j] for j in c]) ### FILL HERE return s.getvalue() def import_csv(table,file): import csv reader = csv.reader(file) colnames=None for line in reader: if not colnames: colnames=[x[x.find('.')+1:] for x in line] c=[i for i in range(len(line)) if colnames[i]!='id'] else: items=[(colnames[i],line[i]) for i in c] table.insert(**dict(items)) def select(): try: dbname=request.args[0] db=eval(dbname) if not request.vars.query: table=request.args[1] query='%s.id>0' % table else: query=request.vars.query except: redirect(URL(r=request,f='index')) if request.vars.csvfile!=None: try: import_csv(db[table],request.vars.csvfile.file) response.flash='data uploaded' except: reponse.flash='unable to parse csv file' if request.vars.delete_all and request.vars.delete_all_sure=='yes': try: db(query).delete() response.flash='records deleted' except: response.flash='invalid SQL FILTER' elif request.vars.update_string: try: env=dict(db=db,query=query) exec('db(query).update('+request.vars.update_string+')') in env response.flash='records updated' except: response.flash='invalid SQL FILTER or UPDATE STRING' if request.vars.start: start=int(request.vars.start) else: start=0 limitby=(start,start+100) try: records=db(query).select(limitby=limitby) except: response.flash='invalid SQL FILTER' return dict(records='no records',nrecords=0,query=query,start=0) linkto=URL(r=request,f='update/%s'% (dbname)) upload=URL(r=request,f='download') return dict(start=start,query=query,\ nrecords=len(records),\ records=SQLTABLE(records,linkto,upload,_class='sortable')) ########################################################### ### edit delete one record ############################################################ def update(): try: dbname=request.args[0] db=eval(dbname) table=request.args[1] except: redirect(URL(r=request,f='index')) try: id=int(request.args[2]) record=db(db[table].id==id).select()[0] except: redirect(URL(r=request,f='select/%s/%s'%(dbname,table))) form=SQLFORM(db[table],record,deletable=True, linkto=URL(r=request,f='select/'+dbname), upload=URL(r=request,f='download/')) if form.accepts(request.vars,session): response.flash='done!' redirect(URL(r=request,f='select/%s/%s'%(dbname,table))) return dict(form=form) def cleanup(): app=request.application files=listdir('applications/%s/cache/' % app,'',0) for file in files: os.unlink(file) files=listdir('applications/%s/errors/' % app,'',0) for file in files: os.unlink(file) files=listdir('applications/%s/sessions/' % app,'',0) for file in files: os.unlink(file) session.flash="cache, errors and sessions cleaned" redirect(URL(r=request,f='index')) def setup(): response.view='manage/setup.html' form=SQLFORM(store.info,mystore) if form.accepts(request.vars,session): response.flash='that was easy! now go vist your store.' else: response.flash='welcome to the store-in-a-stick setup' return dict(form=form)databases/0000755000076500007650000000000011031621164017450 5ustar massimodipierromassimodipierro00000000000000databases/bd03b72cace4c3a371545130526a85b7_category.table0000755000076500007650000000016310745732774026661 0ustar massimodipierromassimodipierro00000000000000(dp1 S'headline' p2 S'CHAR(512)' p3 sS'id' p4 S'INTEGER PRIMARY KEY AUTOINCREMENT' p5 sS'name' p6 S'CHAR(32)' p7 s.databases/bd03b72cace4c3a371545130526a85b7_comment.table0000755000076500007650000000026711031733453026473 0ustar massimodipierromassimodipierro00000000000000(dp1 S'body' p2 S'BLOB' p3 sS'product' p4 S'INTEGER PRIMARY KEY AUTOINCREMENT' p5 sS'author' p6 S'CHAR(32)' p7 sS'id' p8 g5 sS'rate' p9 S'INTEGER' p10 sS'email' p11 S'CHAR(32)' p12 s.databases/bd03b72cace4c3a371545130526a85b7_info.table0000755000076500007650000000363311031733454025765 0ustar massimodipierromassimodipierro00000000000000(dp1 S'ship_ups_second_day_air' p2 S'CHAR(1)' p3 sS'color_foreground' p4 S'CHAR(10)' p5 sS'ship_ups_ground_bc' p6 S'DOUBLE' p7 sS'ship_fedex_priority_overnight_fc' p8 S'DOUBLE' p9 sS'ship_ups_ground' p10 g3 sS'ship_ups_next_day_air_fc' p11 g9 sS'ship_usps_express_mail_fc' p12 g9 sS'ship_usps_express_mail_bc' p13 g7 sS'ship_fedex_second_day_bc' p14 g7 sS'ship_usps_priority_mail_vc' p15 g9 sS'ship_fedex_ground_vc' p16 g9 sS'ship_fedex_ground' p17 g3 sS'logo' p18 S'CHAR(64)' p19 sS'ship_ups_second_day_air_vc' p20 g9 sS'id' p21 S'INTEGER PRIMARY KEY AUTOINCREMENT' p22 sS'city' p23 S'CHAR(32)' p24 sS'ship_usps_priority_mail_fc' p25 g9 sS'why_buy' p26 S'BLOB' p27 sS'ship_usps_priority_mail' p28 g3 sS'ship_usps_express_mail' p29 g3 sS'state' p30 S'CHAR(2)' p31 sS'font_family' p32 S'CHAR(10)' p33 sS'google_merchant_id' p34 S'CHAR(256)' p35 sS'ship_ups_ground_fc' p36 g9 sS'ship_usps_priority_mail_bc' p37 g7 sS'ship_fedex_priority_overnight_vc' p38 g9 sS'email' p39 S'CHAR(32)' p40 sS'ship_usps_express_mail_vc' p41 g9 sS'zip_code' p42 S'CHAR(10)' p43 sS'fax' p44 S'CHAR(10)' p45 sS'description' p46 S'BLOB' p47 sS'ship_fedex_ground_fc' p48 g9 sS'ship_usps' p49 S'CHAR(1)' p50 sS'phone' p51 S'CHAR(10)' p52 sS'color_header' p53 S'CHAR(10)' p54 sS'color_background' p55 S'CHAR(10)' p56 sS'address' p57 S'CHAR(64)' p58 sS'ship_fedex_second_day_vc' p59 g9 sS'ship_ups' p60 g50 sS'color_link' p61 S'CHAR(10)' p62 sS'ship_ups_next_day_air_vc' p63 g9 sS'name' p64 S'CHAR(32)' p65 sS'ship_ups_second_day_air_bc' p66 g7 sS'ship_ups_second_day_air_fc' p67 g9 sS'ship_ups_ground_vc' p68 g9 sS'ship_fedex_second_day' p69 g3 sS'ship_fedex' p70 g50 sS'ship_fedex_priority_overnight' p71 g3 sS'ship_fedex_ground_bc' p72 g7 sS'return_policy' p73 g27 sS'desctiption' p74 g27 sS'ship_ups_next_day_air' p75 g3 sS'headline' p76 S'CHAR(64)' p77 sS'ship_ups_next_day_air_bc' p78 g7 sS'ship_fedex_priority_overnight_bc' p79 g7 sS'ship_fedex_second_day_fc' p80 g9 s.databases/bd03b72cace4c3a371545130526a85b7_product.table0000755000076500007650000000105111031733453026501 0ustar massimodipierromassimodipierro00000000000000(dp1 S'category' p2 S'CHAR(32)' p3 sS'rating' p4 S'INTEGER' p5 sS'tax_rate_outside_your_state' p6 S'DOUBLE' p7 sS'large_image' p8 S'CHAR(64)' p9 sS'name' p10 g3 sS'old_price' p11 S'DOUBLE' p12 sS'price' p13 g12 sS'small_image' p14 g9 sS'id' p15 S'INTEGER PRIMARY KEY AUTOINCREMENT' p16 sS'tax_rate_in_your_state' p17 g7 sS'featured' p18 S'CHAR(1)' p19 sS'weight_in_pounds' p20 g7 sS'allow_rating' p21 g19 sS'short_description' p22 S'CHAR(512)' p23 sS'clicked' p24 g5 sS'long_description' p25 S'BLOB' p26 sS'viewed' p27 g5 sS'quantity_in_stock' p28 g5 s.databases/sql.log0000755000076500007650000001367710745732774021020 0ustar massimodipierromassimodipierro00000000000000timestamp: 2007-11-13T13:40:53.102473 CREATE TABLE category( id INTEGER PRIMARY KEY AUTOINCREMENT, name CHAR(32), headline CHAR(512) ); success! timestamp: 2007-11-13T13:40:53.110252 CREATE TABLE product( id INTEGER PRIMARY KEY AUTOINCREMENT, name CHAR(32), category REFERENCES category(id), short_description CHAR(512), long_description BLOB, small_image CHAR(64), large_image CHAR(64), quantity_in_stock INTEGER, price DOUBLE, old_price DOUBLE, featured CHAR(1), allow_rating CHAR(1), rating INTEGER, viewed INTEGER, clicked INTEGER ); success! timestamp: 2007-11-13T13:40:53.114945 CREATE TABLE comment( id INTEGER PRIMARY KEY AUTOINCREMENT, product REFERENCES product(id), author CHAR(32), email CHAR(32), body BLOB, rate INTEGER ); success! timestamp: 2007-11-18T20:50:32.123662 CREATE TABLE info( id INTEGER PRIMARY KEY AUTOINCREMENT, google_merchant_id CHAR(256), name CHAR(32), headline CHAR(64), address CHAR(64), phone CHAR(10), fax CHAR(10), email CHAR(32), desctiption BLOB, why_buy BLOB, return_policy BLOB ); success! timestamp: 2007-11-18T21:04:01.978303 ALTER TABLE info ADD COLUMN logo CHAR(64); success! timestamp: 2007-11-18T21:15:08.520008 ALTER TABLE info ADD COLUMN font_family CHAR(10); success! timestamp: 2007-11-18T21:15:08.524602 ALTER TABLE info ADD COLUMN color_foreground CHAR(10); success! timestamp: 2007-11-18T21:15:08.528162 ALTER TABLE info ADD COLUMN color_link CHAR(10); success! timestamp: 2007-11-18T21:15:08.533931 ALTER TABLE info ADD COLUMN color_background CHAR(10); success! timestamp: 2007-11-18T21:15:08.538160 ALTER TABLE info ADD COLUMN color_header CHAR(10); success! timestamp: 2007-11-18T22:22:04.245717 ALTER TABLE info ADD COLUMN description BLOB; success! timestamp: 2007-11-21T14:46:53.200326 ALTER TABLE info ADD COLUMN ship_ups CHAR(1); success! timestamp: 2007-11-21T14:46:53.245043 ALTER TABLE info ADD COLUMN ship_fedex CHAR(1); success! timestamp: 2007-11-21T14:46:53.248883 ALTER TABLE info ADD COLUMN ship_usps CHAR(1); success! timestamp: 2007-11-21T15:14:41.095781 ALTER TABLE info ADD COLUMN ship_ups_second_day_air CHAR(1); success! timestamp: 2007-11-21T15:14:41.100250 ALTER TABLE info ADD COLUMN ship_fedex_priority_overnight_fc DOUBLE; success! timestamp: 2007-11-21T15:14:41.104150 ALTER TABLE info ADD COLUMN ship_ups_ground CHAR(1); success! timestamp: 2007-11-21T15:14:41.107758 ALTER TABLE info ADD COLUMN ship_ups_next_day_air_fc DOUBLE; success! timestamp: 2007-11-21T15:14:41.111908 ALTER TABLE info ADD COLUMN ship_usps_express_mail_fc DOUBLE; success! timestamp: 2007-11-21T15:14:41.115453 ALTER TABLE info ADD COLUMN ship_fedex_ground_vc DOUBLE; success! timestamp: 2007-11-21T15:14:41.118955 ALTER TABLE info ADD COLUMN ship_fedex_ground CHAR(1); success! timestamp: 2007-11-21T15:14:41.122798 ALTER TABLE info ADD COLUMN ship_ups_second_day_air_vc DOUBLE; success! timestamp: 2007-11-21T15:14:41.126671 ALTER TABLE info ADD COLUMN city CHAR(32); success! timestamp: 2007-11-21T15:14:41.130235 ALTER TABLE info ADD COLUMN ship_usps_priority_mail_fc DOUBLE; success! timestamp: 2007-11-21T15:14:41.134704 ALTER TABLE info ADD COLUMN ship_usps_priority_mail CHAR(1); success! timestamp: 2007-11-21T15:14:41.138392 ALTER TABLE info ADD COLUMN state CHAR(2); success! timestamp: 2007-11-21T15:14:41.142001 ALTER TABLE info ADD COLUMN ship_fedex_priority_overnight_vc DOUBLE; success! timestamp: 2007-11-21T15:14:41.145795 ALTER TABLE info ADD COLUMN ship_usps_express_mail_vc DOUBLE; success! timestamp: 2007-11-21T15:14:41.150560 ALTER TABLE info ADD COLUMN zip_code CHAR(10); success! timestamp: 2007-11-21T15:14:41.154455 ALTER TABLE info ADD COLUMN ship_fedex_ground_fc DOUBLE; success! timestamp: 2007-11-21T15:14:41.158063 ALTER TABLE info ADD COLUMN ship_fedex_second_day_vc DOUBLE; success! timestamp: 2007-11-21T15:14:41.162485 ALTER TABLE info ADD COLUMN ship_usps_priority_mail_vc DOUBLE; success! timestamp: 2007-11-21T15:14:41.166343 ALTER TABLE info ADD COLUMN ship_ups_second_day_air_fc DOUBLE; success! timestamp: 2007-11-21T15:14:41.170949 ALTER TABLE info ADD COLUMN ship_ups_ground_vc DOUBLE; success! timestamp: 2007-11-21T15:14:41.175114 ALTER TABLE info ADD COLUMN ship_fedex_second_day CHAR(1); success! timestamp: 2007-11-21T15:14:41.179288 ALTER TABLE info ADD COLUMN ship_ups_next_day_air_vc DOUBLE; success! timestamp: 2007-11-21T15:14:41.183949 ALTER TABLE info ADD COLUMN ship_fedex_priority_overnight CHAR(1); success! timestamp: 2007-11-21T15:14:41.188083 ALTER TABLE info ADD COLUMN ship_ups_ground_fc DOUBLE; success! timestamp: 2007-11-21T15:14:41.192260 ALTER TABLE info ADD COLUMN ship_ups_next_day_air CHAR(1); success! timestamp: 2007-11-21T15:14:41.196386 ALTER TABLE info ADD COLUMN ship_usps_express_mail CHAR(1); success! timestamp: 2007-11-21T15:14:41.200625 ALTER TABLE info ADD COLUMN ship_fedex_second_day_fc DOUBLE; success! timestamp: 2007-11-21T15:24:03.641209 ALTER TABLE product ADD COLUMN tax_rate_outside_your_state DOUBLE; success! timestamp: 2007-11-21T15:24:03.645614 ALTER TABLE product ADD COLUMN tax_rate_in_your_state DOUBLE; success! timestamp: 2007-11-21T15:24:03.648697 ALTER TABLE product ADD COLUMN weight_in_pounds DOUBLE; success! timestamp: 2007-11-21T15:47:44.364160 ALTER TABLE info ADD COLUMN ship_fedex_ground_bc DOUBLE; success! timestamp: 2007-11-21T15:47:44.368898 ALTER TABLE info ADD COLUMN ship_ups_ground_bc DOUBLE; success! timestamp: 2007-11-21T15:47:44.372614 ALTER TABLE info ADD COLUMN ship_fedex_priority_overnight_bc DOUBLE; success! timestamp: 2007-11-21T15:47:44.376174 ALTER TABLE info ADD COLUMN ship_usps_express_mail_bc DOUBLE; success! timestamp: 2007-11-21T15:47:44.379765 ALTER TABLE info ADD COLUMN ship_fedex_second_day_bc DOUBLE; success! timestamp: 2007-11-21T15:47:44.383437 ALTER TABLE info ADD COLUMN ship_usps_priority_mail_bc DOUBLE; success! timestamp: 2007-11-21T15:47:44.387079 ALTER TABLE info ADD COLUMN ship_ups_second_day_air_bc DOUBLE; success! timestamp: 2007-11-21T15:47:44.390628 ALTER TABLE info ADD COLUMN ship_ups_next_day_air_bc DOUBLE; success! databases/store.db0000755000076500007650000002400010745732774021137 0ustar massimodipierromassimodipierro00000000000000SQLite format 3@ 4 #Tshirtsbest of all&?PaintingsOur top quality paintings info6 product category WW33}UUSunflowers Painting1by Vincent Van GoghSunflowers is a series of still life oil paintings that the Dutch painter Vincent van Gogh painted. Among the Sunflowers paintings are three similar paintings with fifteen sunflowers in a vase, and two similar paintings with twelve sunflowers in a vase. Van Gogh painted the first Vase with Twelve Sunflowers, which is now in the Neue Pinakothek Museum in Munich, Germany, and the first Vase with Fifteen Sunflowers, which is now in National Gallery, London, England, in August 1888 when he was living in Arles southern France. The later similar paintings were painted in January the following year. The paintings are all painted on about 93 × 72 cm (37" × 28") canvases. An earlier series of four still life using sunflowers were painted in Paris in 1887.product.small_image.655963020136.jpgproduct.large_image.949418750758.jpg TT ! A1AFF   E%-+51;561%-+51;;E -1%test[store name][store headline][store address][store phone number][store fax number]yourname@yourdomain.com[why buy at your store][what is your return policy]arial, helveticablack#ff0033white#339900[about your store]TTT[store city]TIL60302TTTT }+qg%tableproductproductCREATE TABLE product( id INTEGER PRIMARY KEY AUTOINCREMENT, name CHAR(32), category REFERENCES category(id), short_description CHAR(512), long_description BLOB, small_image CHAR(64), large_image CHAR(64), quantity_in_stock INTEGER, price DOUBLE, old_price DOUBLE, featured CHAR(1), allow_rating CHAR(1), rating INTEGER, viewed INTEGER, clicked INTEGER , tax_rate_outside_your_state DOUBLE, tax_rate_in_your_state DOUBLE, weight_in_pounds DOUBLE)7EtablecommentcommentCREATE TABLE comment( id INTEGER PRIMARY KEY AUTOINCREMENT, product REFERENCES product(id), author CHAR(32), email CHAR(32), body BLOB, rate INTEGER )P++Ytablesqlite_sequencesqlite_sequenceCREATE TABLE sqlite_sequence(name,seq)StablecategorycategoryCREATE TABLE category( id INTEGER PRIMARY KEY AUTOINCREMENT, name CHAR(32), headline CHAR(512) ) ]tableinfoinfoCREATE TABLE info( id INTEGER PRIMARY KEY AUTOINCREMENT, google_merchant_id CHAR(256), name CHAR(32), headline CHAR(64), address CHAR(64), phone CHAR(10), fax CHAR(10), email CHAR(32), desctiption BLOB, why_buy BLOB, return_policy BLOB , logo CHAR(64), font_family CHAR(10), color_foreground CHAR(10), color_link CHAR(10), color_background CHAR(10), color_he,;tableinfoinfoCREATE TABLE info( id INTEGER PRIMARY KEY AUTOINCREMENT, google_merchant_id CHAR(256), name CHAR(32), headline CHAR(64), address CHAR(64), phone CHAR(10), fax CHAR(10), email CHAR(32), desctiption BLOB, why_buy BLOB, return_policy BLOB , logo CHAR(64), font_family CHAR(10), color_foreground CHAR(10), color_link CHAR(10), color_background CHAR(10), color_header CHAR(10), description BLOB, ship_ups CHAR(1), ship_fedex CHAR(1), ship_usps CHAR(1), ship_ups_second_day_air CHAR(1), ship_fedex_priority_overnight_fc DOUBLE, ship_u ps_ground CHAR(1), ship_ups_next_day_air_fc DOUBLE, ship_usps_express_mail_fc DOUBLE, ship_fedex_ground_vc DOUBLE, ship_fedex_ground CHAR(1), ship_ups_second_day_air_vc DOUBLE, city CHAR(32), ship_usps_priority_mail_fc DOUBLE, ship_usps_priority_mail CHAR(1), state CHAR(2), ship_fedex_priority_overnight_vc DOUBLE, ship_usps_express_mail_vc DOUBLE, zip_code CHAR(10), ship_fedex_ground_fc DOUBLE, ship_fedex_second_day_vc DOUBLE, ship_usps_priority_mail_vc DOUBLE, ship_ups_second_day_air_fc DOUBLE, ship_ups_ground_vc DOUBLE, ship_fedex_second_day CHAR(1), ship_ups_next_day_air_vc DOUBLE, ship_fedex_priority_overnight CHAR(1), ship_ups_ground_fc DOUBLE, ship_ups_next_day_air CHAR(1), ship_usps_express_mail CHAR(1), ship_fedex_second_day_fc DOUBLE, ship_fedex_ground_bc DOUBLE, ship_ups_ground_bc DOUBLE, ship_fedex_priority_overnight_bc DOUBLE, ship_usps_express_mail_bc DOUBLE, ship_fedex_second_day_bc DOUBLE, ship_usps_priority_mail_bc DOUBLE, ship_ups_second_day_air_bc DOUBLE, ship_ups_next_day_air_bc DOUBLE)y_overnight_fc DOUBLE, ship_ups_ground CHAR(1), ship_ups_next_day_air_fc DOUBLE, ship_usps_express_mail_fc DOUBLE, ship_fedex_ground_vc DOUBLE, ship_fedex_ground CHAR(1), ship_ups_second_day_air_vc DOUBLE, city CHAR(32), ship_usps_priority_mail_fc DOUBLE, ship_usps_priority_mail CHAR(1), state CHAR(2), ship_fedex_priority_overnight_vc DOUBLE, ship_usps_express_mail_vc DOUBLE, zip_code CHAR(10), ship_fedex_ground_fc DOUBLE, ship_fedex_second_day_vc DOUBLE, ship_usps_priority_mail_vc DOUBLE, ship_ups_second_day_air_fc DOUBLE, ship_ups_ground_vc DOUBLE, ship_fedex_second_day CHAR(1), ship_ups_next_day_air_vc DOUBLE, ship_fedex_priority_overnight CHAR(1), ship_ups_ground_fc DOUBLE, ship_ups_next_day_air CHAR(1), ship_usps_express_mail CHAR(1), ship_fedex_second_day_fc DOUBLE, ship_fedex_ground_bc DOUBLE, ship_ups_ground_bc DOUBLE, ship_fedex_priority_overnight_bc DOUBLE, ship_usps_express_mail_bc DOUBLE, ship_fedex_second_day_bc DOUBLE, ship_usps_priority_mail_bc DOUBLE, ship_ups_second_day_air_bc DOUBLE)errors/0000755000076500007650000000000011031733725017044 5ustar massimodipierromassimodipierro00000000000000google_merchant_id.txt0000755000076500007650000000000410745732774022115 0ustar massimodipierromassimodipierro00000000000000testlanguages/0000755000076500007650000000000011031621164017467 5ustar massimodipierromassimodipierro00000000000000models/0000755000076500007650000000000011031621164017004 5ustar massimodipierromassimodipierro00000000000000models/store.py0000755000076500007650000001207611031621311020515 0ustar massimodipierromassimodipierro00000000000000# try something like store=SQLDB("sqlite://store.db") store.define_table('category', SQLField('name'), SQLField('headline',length=512)) store.define_table('product', SQLField('name'), SQLField('category',store.category), SQLField('short_description',length=512), SQLField('long_description','text',default=''), SQLField('small_image','upload'), SQLField('large_image','upload',default=''), SQLField('quantity_in_stock','integer',default=0), SQLField('price','double',default=1.00), SQLField('old_price','double',default=0.0), SQLField('weight_in_pounds','double',default=1), SQLField('tax_rate_in_your_state','double',default=10.0), SQLField('tax_rate_outside_your_state','double',default=0.00), SQLField('featured','boolean',default='T'), SQLField('allow_rating','boolean',default='T'), SQLField('rating','integer',default='0'), SQLField('viewed','integer',default='0'), SQLField('clicked','integer',default='0')) store.define_table('comment', SQLField('product',store.product), SQLField('author'), SQLField('email'), SQLField('body','text'), SQLField('rate','integer')) store.define_table('info', SQLField('google_merchant_id',length=256), SQLField('name',default='[store name]'), SQLField('headline',length=64,default='[store headline]'), SQLField('address',default='[store address]'), SQLField('city',default='[store city]'), SQLField('state',length=2,default='[store state]'), SQLField('zip_code',length=10,default='[store zip]'), SQLField('phone',default='[store phone number]'), SQLField('fax',default='[store fax number]'), SQLField('email',requires=IS_EMAIL(),default='yourname@yourdomain.com'), SQLField('description','text',default='[about your store]'), SQLField('why_buy','text',default='[why buy at your store]'), SQLField('return_policy','text',default='[what is your return policy]'), SQLField('logo','upload',default=''), SQLField('color_background',length=10,default='white'), SQLField('color_foreground',length=10,default='black'), SQLField('color_header',length=10,default='#339900'), SQLField('color_link',length=10,default='#ff0033'), SQLField('font_family',length=32,default='arial, helvetica'), SQLField('ship_usps_express_mail','boolean',default=True), SQLField('ship_usps_express_mail_fc','double',default=0), SQLField('ship_usps_express_mail_vc','double',default=0), SQLField('ship_usps_express_mail_bc','double',default=0), SQLField('ship_usps_priority_mail','boolean',default=True), SQLField('ship_usps_priority_mail_fc','double',default=0), SQLField('ship_usps_priority_mail_vc','double',default=0), SQLField('ship_usps_priority_mail_bc','double',default=0), SQLField('ship_ups_next_day_air','boolean',default=True), SQLField('ship_ups_next_day_air_fc','double',default=0), SQLField('ship_ups_next_day_air_vc','double',default=0), SQLField('ship_ups_next_day_air_bc','double',default=0), SQLField('ship_ups_second_day_air','boolean',default=True), SQLField('ship_ups_second_day_air_fc','double',default=0), SQLField('ship_ups_second_day_air_vc','double',default=0), SQLField('ship_ups_second_day_air_bc','double',default=0), SQLField('ship_ups_ground','boolean',default=True), SQLField('ship_ups_ground_fc','double',default=0), SQLField('ship_ups_ground_vc','double',default=0), SQLField('ship_ups_ground_bc','double',default=0), SQLField('ship_fedex_priority_overnight','boolean',default=True), SQLField('ship_fedex_priority_overnight_fc','double',default=0), SQLField('ship_fedex_priority_overnight_vc','double',default=0), SQLField('ship_fedex_priority_overnight_bc','double',default=0), SQLField('ship_fedex_second_day','boolean',default=True), SQLField('ship_fedex_second_day_fc','double',default=0), SQLField('ship_fedex_second_day_vc','double',default=0), SQLField('ship_fedex_second_day_bc','double',default=0), SQLField('ship_fedex_ground','boolean',default=True), SQLField('ship_fedex_ground_fc','double',default=0), SQLField('ship_fedex_ground_vc','double',default=0), SQLField('ship_fedex_ground_bc','double',default=0) ) #store(store.info.id>0).delete() if len(store(store.info.id>0).select())==0: store.info.insert(name='[store name]') mystore=store(store.info.id>0).select()[0] store.product.category.requires=IS_IN_DB(store,'category.id','category.name') store.product.name.requires=IS_NOT_EMPTY() store.product.short_description.requires=IS_NOT_EMPTY() store.product.quantity_in_stock.requires=IS_INT_IN_RANGE(0,1000) store.product.price.requires=IS_FLOAT_IN_RANGE(0,10000) store.product.rating.requires=IS_INT_IN_RANGE(-10000,10000) store.product.viewed.requires=IS_INT_IN_RANGE(0,1000000) store.product.clicked.requires=IS_INT_IN_RANGE(0,1000000) store.comment.product.requires=IS_IN_DB(store,'product.id','product.name') store.comment.author.requires=IS_NOT_EMPTY() store.comment.email.requires=IS_EMAIL() store.comment.body.requires=IS_NOT_EMPTY() store.comment.rate.requires=IS_IN_SET(range(5,0,-1)) for field in store.info.fields: if field[:-2] in ['fc','vc']: store.info[field].requires=IS_FLOAT_IN_RANGE(0,100) mystore=store(store.info.id>0).select()[0]modules/0000755000076500007650000000000011031621164017171 5ustar massimodipierromassimodipierro00000000000000private/0000755000076500007650000000000011031621164017173 5ustar massimodipierromassimodipierro00000000000000sessions/0000755000076500007650000000000011031733732017374 5ustar massimodipierromassimodipierro00000000000000static/0000755000076500007650000000000011031621164017010 5ustar massimodipierromassimodipierro00000000000000static/sorttable.js0000755000076500007650000004102510745732774021377 0ustar massimodipierromassimodipierro00000000000000/* SortTable version 2 7th April 2007 Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/ Instructions: Download this file Add to your HTML Add class="sortable" to any table you'd like to make sortable Click on the headers to sort Thanks to many, many people for contributions and suggestions. Licenced as X11: http://www.kryogenix.org/code/browser/licence.html This basically means: do what you want with it. */ var stIsIE = /*@cc_on!@*/false; sorttable = { init: function() { // quit if this function has already been called if (arguments.callee.done) return; // flag this function so we don't do the same thing twice arguments.callee.done = true; // kill the timer if (_timer) clearInterval(_timer); if (!document.createElement || !document.getElementsByTagName) return; sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/; forEach(document.getElementsByTagName('table'), function(table) { if (table.className.search(/\bsortable\b/) != -1) { sorttable.makeSortable(table); } }); }, makeSortable: function(table) { if (table.getElementsByTagName('thead').length == 0) { // table doesn't have a tHead. Since it should have, create one and // put the first table row in it. the = document.createElement('thead'); the.appendChild(table.rows[0]); table.insertBefore(the,table.firstChild); } // Safari doesn't support table.tHead, sigh if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0]; if (table.tHead.rows.length != 1) return; // can't cope with two header rows // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as // "total" rows, for example). This is B&R, since what you're supposed // to do is put them in a tfoot. So, if there are sortbottom rows, // for backwards compatibility, move them to tfoot (creating it if needed). sortbottomrows = []; for (var i=0; i5' : ' ▴'; this.appendChild(sortrevind); return; } if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) { // if we're already sorted by this column in reverse, just // re-reverse the table, which is quicker sorttable.reverse(this.sorttable_tbody); this.className = this.className.replace('sorttable_sorted_reverse', 'sorttable_sorted'); this.removeChild(document.getElementById('sorttable_sortrevind')); sortfwdind = document.createElement('span'); sortfwdind.id = "sorttable_sortfwdind"; sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; this.appendChild(sortfwdind); return; } // remove sorttable_sorted classes theadrow = this.parentNode; forEach(theadrow.childNodes, function(cell) { if (cell.nodeType == 1) { // an element cell.className = cell.className.replace('sorttable_sorted_reverse',''); cell.className = cell.className.replace('sorttable_sorted',''); } }); sortfwdind = document.getElementById('sorttable_sortfwdind'); if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); } sortrevind = document.getElementById('sorttable_sortrevind'); if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); } this.className += ' sorttable_sorted'; sortfwdind = document.createElement('span'); sortfwdind.id = "sorttable_sortfwdind"; sortfwdind.innerHTML = stIsIE ? ' 6' : ' ▾'; this.appendChild(sortfwdind); // build an array to sort. This is a Schwartzian transform thing, // i.e., we "decorate" each row with the actual sort key, // sort based on the sort keys, and then put the rows back in order // which is a lot faster because you only do getInnerText once per row row_array = []; col = this.sorttable_columnindex; rows = this.sorttable_tbody.rows; for (var j=0; j 12) { // definitely dd/mm return sorttable.sort_ddmm; } else if (second > 12) { return sorttable.sort_mmdd; } else { // looks like a date, but we can't tell which, so assume // that it's dd/mm (English imperialism!) and keep looking sortfn = sorttable.sort_ddmm; } } } } return sortfn; }, getInnerText: function(node) { // gets the text we want to use for sorting for a cell. // strips leading and trailing whitespace. // this is *not* a generic getInnerText function; it's special to sorttable. // for example, you can override the cell text with a customkey attribute. // it also gets .value for fields. hasInputs = (typeof node.getElementsByTagName == 'function') && node.getElementsByTagName('input').length; if (node.getAttribute("sorttable_customkey") != null) { return node.getAttribute("sorttable_customkey"); } else if (typeof node.textContent != 'undefined' && !hasInputs) { return node.textContent.replace(/^\s+|\s+$/g, ''); } else if (typeof node.innerText != 'undefined' && !hasInputs) { return node.innerText.replace(/^\s+|\s+$/g, ''); } else if (typeof node.text != 'undefined' && !hasInputs) { return node.text.replace(/^\s+|\s+$/g, ''); } else { switch (node.nodeType) { case 3: if (node.nodeName.toLowerCase() == 'input') { return node.value.replace(/^\s+|\s+$/g, ''); } case 4: return node.nodeValue.replace(/^\s+|\s+$/g, ''); break; case 1: case 11: var innerText = ''; for (var i = 0; i < node.childNodes.length; i++) { innerText += sorttable.getInnerText(node.childNodes[i]); } return innerText.replace(/^\s+|\s+$/g, ''); break; default: return ''; } } }, reverse: function(tbody) { // reverse the rows in a tbody newrows = []; for (var i=0; i=0; i--) { tbody.appendChild(newrows[i]); } delete newrows; }, /* sort functions each sort function takes two parameters, a and b you are comparing a[0] and b[0] */ sort_numeric: function(a,b) { aa = parseFloat(a[0].replace(/[^0-9.-]/g,'')); if (isNaN(aa)) aa = 0; bb = parseFloat(b[0].replace(/[^0-9.-]/g,'')); if (isNaN(bb)) bb = 0; return aa-bb; }, sort_alpha: function(a,b) { if (a[0]==b[0]) return 0; if (a[0] 0 ) { var q = list[i]; list[i] = list[i+1]; list[i+1] = q; swap = true; } } // for t--; if (!swap) break; for(var i = t; i > b; --i) { if ( comp_func(list[i], list[i-1]) < 0 ) { var q = list[i]; list[i] = list[i-1]; list[i-1] = q; swap = true; } } // for b++; } // while(swap) } } /* ****************************************************************** Supporting functions: bundled here to avoid depending on a library ****************************************************************** */ // Dean Edwards/Matthias Miller/John Resig /* for Mozilla/Opera9 */ if (document.addEventListener) { document.addEventListener("DOMContentLoaded", sorttable.init, false); } /* for Internet Explorer */ /*@cc_on @*/ /*@if (@_win32) document.write("