thiswebshoprules

git clone https://git.tarina.org/thiswebshoprules
Log | Files | Refs

commit 643de1f21d0acfee4b6c47157f46ce8c336d9532
parent bd234ed9ec22aefb2e743285f3bdc26f0700d070
Author: rob <rob@tarina.org>
Date:   Mon,  4 Mar 2024 10:10:28 +0200

wowoweewaa

Diffstat:
Mpublic_html/templates/base.html | 4++--
Mpublic_html/templates/bigpic.html | 7++++---
Mpublic_html/templates/index.html | 12+++++++-----
Mpublic_html/templates/op.html | 2+-
Mpublic_html/templates/products.html | 8+++++---
Mserver.py | 22+++++++++++++++++++---
6 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/public_html/templates/base.html b/public_html/templates/base.html @@ -2,8 +2,8 @@ $def with (content) <!doctype html> <HEAD> <meta charset="utf-8"> - <title>Gonzo Pi Shop | Buy all things Gonzo Pi</title> - <link rel="stylesheet" href="/static/robstyle.css?v=24" type="text/css" rel="stylesheet"/> + <title>Gonzo Pi shop | a retake on filmmaking</title> + <link rel="stylesheet" href="/static/robstyle.css?v=95" type="text/css" rel="stylesheet"/> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="cache-control" content="no-cache"> </HEAD> diff --git a/public_html/templates/bigpic.html b/public_html/templates/bigpic.html @@ -1,5 +1,6 @@ $def with (p,name,goodies) -<a href="/#$p"><-- back</a><br> -<a href="/#$p"><img class="imgprod" src="/static/img/web/$goodies.soundname"></a><br> -<a href="/#$p"><-- back</a><br> +$for i in goodies: + <a href="/#$p"><-- back</a> | <a href="/static/upload/$i.soundlink/$i.soundname">Full image resolution</a><br> + <a href="/#$p"><img class="imgprod" width="100%" src="/static/img/web/$i.soundname"></a><br> + <a href="/#$p"><-- back</a><br> diff --git a/public_html/templates/index.html b/public_html/templates/index.html @@ -35,13 +35,13 @@ $ categories = db.select('categories', what='id, category') <img src="/static/img/thumb/logo.png"> <br> <h1>$siteconfig.name</h1> -<h6>$siteconfig.description</h6> -<pre>$siteconfig.description2</pre> +$:markdown.markdown(siteconfig.description) +$:markdown.markdown(siteconfig.description2) - -<a href="/">All</a> | +<b><a href="/">All</a> $for c in categories: - <a href="?category=$c.category">$c.category</a> | + | <a href="?category=$c.category">$c.category</a> +</b> <br> </div> <div id="productlist"> @@ -59,6 +59,8 @@ $for i in products: $for g in goodies: $if g.soundname[-5:] == '.jpeg' or g.soundname[-4:] == '.png': <a href="/bigpic/$g.id"><img class="imgprod" src="/static/img/web/$g.soundname"></a> + <br> + <br> $code: sat, euro = getprice(i.id) $:markdown.markdown(i.description) diff --git a/public_html/templates/op.html b/public_html/templates/op.html @@ -3,7 +3,7 @@ $def with (content) <HEAD> <meta charset="utf-8"> <title>Tarina web shop Welcome!</title> - <link rel="stylesheet" href="/static/robstyle.css?v=1.15" type="text/css" rel="stylesheet"/> + <link rel="stylesheet" href="/static/robstyle.css?v=1.25" type="text/css" rel="stylesheet"/> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta http-equiv="cache-control" content="no-cache"> </HEAD> diff --git a/public_html/templates/products.html b/public_html/templates/products.html @@ -1,4 +1,4 @@ -$def with (addproduct, listproducts, goodies, idvalue) +$def with (addproduct, listproducts, goodies, idvalue, nocache) <div id="container"> <div id="default"> <br> @@ -19,11 +19,13 @@ $:addproduct.render() $if goodies != None: $for i in goodies: $if i.soundname[-5:] == '.jpeg' or i.soundname[-4:] == '.png': - <img src="/static/img/thumb/$i.soundname"> + <img src="/static/img/thumb/$i.soundname?nocache=$nocache"> $else: <p>$i.soundname</p> <br> - <a href='/products/$idvalue?cmd=remove&soundname=$i.soundname'>remove</a> + <a href='/products/$idvalue?cmd=flipleft&soundname=$i.soundname'>flip to left</a> | + <a href='/products/$idvalue?cmd=remove&soundname=$i.soundname'>remove</a> | + <a href='/products/$idvalue?cmd=flipright&soundname=$i.soundname'>flip to right</a> <br> <hr> $if idvalue != '': diff --git a/server.py b/server.py @@ -46,7 +46,6 @@ urls = ( '/config', 'config', '/payments?', 'payments') - bag = '' #Load from settings @@ -332,7 +331,7 @@ class bigpic(): print('faaaakyeee ' + i) p = web.input(pic=None) name=productname(i) - goodies = db.query("SELECT * FROM soundlink WHERE id='"+i+"';")[0] + goodies = db.query("SELECT * FROM soundlink WHERE id='"+i+"';") #if p.pic != None: return render.bigpic(i,name,goodies) @@ -756,6 +755,7 @@ class products: def GET(self, idvalue): if logged(): i = web.input(cmd=None,soundname=None) + nocache = hashlib.sha256(str(random.getrandbits(256)).encode('utf-8')).hexdigest()[11:15] if i.cmd == 'del': db.delete('products', where='id="'+idvalue+'"') imgdir = staticdir + 'img/' + idvalue @@ -773,6 +773,22 @@ class products: print('notin to delete') goodies = db.query("DELETE FROM soundlink WHERE id='"+idvalue+"' AND soundname='"+i.soundname+"';") raise web.seeother('/products/' + idvalue) + if i.cmd == 'flipright' and i.soundname != None: + original_thumb = Image.open(staticdir+'/img/thumb/'+i.soundname) + original_web = Image.open(staticdir+'/img/web/'+i.soundname) + o_thumb=original_thumb.rotate(270) + o_web=original_web.rotate(270) + o_thumb.save(staticdir+'/img/thumb/'+i.soundname) + o_web.save(staticdir+'/img/web/'+i.soundname) + raise web.seeother('/products/' + idvalue) + if i.cmd == 'flipleft' and i.soundname != None: + original_thumb = Image.open(staticdir+'/img/thumb/'+i.soundname) + original_web = Image.open(staticdir+'/img/web/'+i.soundname) + o_thumb=original_thumb.rotate(90) + o_web=original_web.rotate(90) + o_thumb.save(staticdir+'/img/thumb/'+i.soundname) + o_web.save(staticdir+'/img/web/'+i.soundname) + raise web.seeother('/products/' + idvalue) addproduct = self.form() addproduct.fill(available='1', priority='1', type='physical',currency='euro') goodies = None @@ -781,7 +797,7 @@ class products: addproduct.fill(name=oldinfo.name, description=oldinfo.description, type=oldinfo.type, currency=oldinfo.currency, price=oldinfo.price, available=oldinfo.available, priority=oldinfo.priority, category=oldinfo.category) goodies = db.query("SELECT * FROM soundlink WHERE id='"+idvalue+"';") listproducts = db.query("SELECT * FROM products ORDER BY priority DESC") - return renderop.products(addproduct, listproducts, goodies, idvalue) + return renderop.products(addproduct, listproducts, goodies, idvalue, nocache) else: raise web.seeother('/login') def POST(self, idvalue):