grundlegender Ablauf ist fertig
Code muss noch gefuellt werden Interface-Gestaltung fehlt
This commit is contained in:
parent
4cc6b56519
commit
50111cf9d1
10 changed files with 239 additions and 42 deletions
|
@ -4,10 +4,67 @@ from turbogears import controllers, expose, flash
|
|||
# import logging
|
||||
# log = logging.getLogger("fotokiste.controllers")
|
||||
|
||||
|
||||
class DummyPicture(object):
|
||||
title = "leer"
|
||||
url = "nichts"
|
||||
|
||||
import os
|
||||
|
||||
IMAGE_STORE = os.tempnam()
|
||||
|
||||
class Root(controllers.RootController):
|
||||
@expose(template="fotokiste.templates.welcome")
|
||||
def index(self):
|
||||
import time
|
||||
# log.debug("Happy TurboGears Controller Responding For Duty")
|
||||
flash("Your application is now running")
|
||||
return dict(now=time.ctime())
|
||||
|
||||
@expose(template="fotokiste.templates.start")
|
||||
def index(self, **kargs):
|
||||
|
||||
# Bilder zufaellig aus der Datenbank auswaehlen
|
||||
# eine andere Funktion muss die Bilder ausliefern
|
||||
gallery = []
|
||||
for i in range(22):
|
||||
obj = DummyPicture()
|
||||
obj.title = "test%d" % i
|
||||
obj.url = "URL: %d" % i
|
||||
gallery.append(obj)
|
||||
|
||||
# alte Bild-Datei loeschen
|
||||
if os.path.isfile(IMAGE_STORE):
|
||||
os.unlink(IMAGE_STORE)
|
||||
|
||||
return { "gallery": gallery }
|
||||
|
||||
|
||||
@expose(template="fotokiste.templates.ausloeser")
|
||||
def ausloeser(self, **kargs):
|
||||
flash("Das Bild wird in 5 Sekunden aufgenommen!")
|
||||
return {}
|
||||
|
||||
@expose(template="fotokiste.templates.mailtext")
|
||||
def mailtext(self, mailtext=None, already_stored="no", **kargs):
|
||||
# mailtext filtern
|
||||
|
||||
# "already_stored" filtern
|
||||
if already_stored != "no":
|
||||
already_stored = "yes"
|
||||
return {
|
||||
"mailtext": mailtext,
|
||||
"already_stored": already_stored,
|
||||
}
|
||||
|
||||
@expose(template="fotokiste.templates.senden")
|
||||
def senden(self, mailaddress=None, mailtext=None, already_stored=False, **kargs):
|
||||
# Bild speichern, falls "already_stored" falsch ist
|
||||
# Mail versenden
|
||||
|
||||
# mailaddress filtern
|
||||
# mailtext filtern
|
||||
|
||||
# das Bild wurde gerade gespeichert
|
||||
already_stored = "yes"
|
||||
|
||||
return {
|
||||
"mailaddress": mailaddress,
|
||||
"mailtext": mailtext,
|
||||
"already_stored": already_stored,
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,11 @@ from sqlobject import StringCol, UnicodeCol, IntCol, DateTimeCol
|
|||
__connection__ = hub = PackageHub('fotokiste')
|
||||
|
||||
|
||||
# your data model
|
||||
|
||||
|
||||
# class YourDataClass(SQLObject):
|
||||
# pass
|
||||
|
||||
class Picture(SQLObject):
|
||||
adresse = UnicodeCol()
|
||||
text = UnicodeCol()
|
||||
date = DateTimeCol()
|
||||
picture = BLOBCol()
|
||||
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ tr.odd td {background-color:#edf3fe;}
|
|||
tr.even td {background-color:#fff;}
|
||||
|
||||
#header {
|
||||
height: 80px;
|
||||
width: 777px;
|
||||
background: blue URL('../images/header_inner.png') no-repeat;
|
||||
height: 100px;
|
||||
width: 770px;
|
||||
background: blue URL('../images/header_glasmensch.gif') no-repeat;
|
||||
border-left: 1px solid #aaa;
|
||||
border-right: 1px solid #aaa;
|
||||
margin: 0 auto 0 auto;
|
||||
|
@ -59,7 +59,7 @@ a.link, a, a.active {
|
|||
padding-left: 0;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6,#getting_started_steps {
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
font-family: "Century Schoolbook L", Georgia, serif;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -68,28 +68,8 @@ h2 {
|
|||
font-size: 150%;
|
||||
}
|
||||
|
||||
#getting_started_steps a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#getting_started_steps a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#getting_started_steps li {
|
||||
font-size: 80%;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
#getting_started_steps h2 {
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
#getting_started_steps p {
|
||||
font: 100% "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, sans-serif;
|
||||
}
|
||||
|
||||
#footer {
|
||||
clear: both;
|
||||
border: 1px solid #aaa;
|
||||
border-top: 0px none;
|
||||
color: #999;
|
||||
|
@ -131,4 +111,29 @@ span.code {
|
|||
.fielderror {
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
#gallery {
|
||||
clear: both;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
#live_pic {
|
||||
float: left;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
#shoot_pic {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#mail_pic {
|
||||
float: left;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
#mail_info {
|
||||
float: left;
|
||||
margin: 20px;
|
||||
}
|
||||
|
||||
|
|
BIN
fotokiste/fotokiste/static/images/header_glasmensch.gif
Normal file
BIN
fotokiste/fotokiste/static/images/header_glasmensch.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 5 KiB |
BIN
fotokiste/fotokiste/static/images/platzhalter.jpg
Normal file
BIN
fotokiste/fotokiste/static/images/platzhalter.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
19
fotokiste/fotokiste/templates/ausloeser.kid
Normal file
19
fotokiste/fotokiste/templates/ausloeser.kid
Normal file
|
@ -0,0 +1,19 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
|
||||
py:extends="'master.kid'">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
|
||||
<meta http-equiv="refresh" content="5;URL=${tg.url('/mailtext')}" />
|
||||
<title>Käääääääsekuchen!</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div id="shoot_pic">
|
||||
<p><img width="300" height="384"
|
||||
src="${tg.url('/static/images/platzhalter.jpg')}"
|
||||
alt="shoot_pic" /></p>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
32
fotokiste/fotokiste/templates/mailtext.kid
Normal file
32
fotokiste/fotokiste/templates/mailtext.kid
Normal file
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
|
||||
py:extends="'master.kid'">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
|
||||
<title>Bild versenden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div id="mail_pic">
|
||||
<p><img width="200px" height="256px"
|
||||
src="${tg.url('/static/images/platzhalter.jpg')}"
|
||||
alt="Versende-Bild" /></p>
|
||||
</div>
|
||||
|
||||
<div id="mail_info">
|
||||
<form action="${tg.url('/senden')}">
|
||||
<label for="mailaddress">An:</label>
|
||||
<input type="textfield" id="mailaddress"
|
||||
name="mailaddress" size="30" />
|
||||
<br/>
|
||||
<label for="mailtext">Text:</label>
|
||||
<textarea name="mailtext" id="mailtext"
|
||||
rows="10" cols="40" wrap="physical">${mailtext}</textarea>
|
||||
<br/>
|
||||
<input type="submit" name="senden" value="senden" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -39,11 +39,15 @@
|
|||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<img src="${tg.url('/static/images/under_the_hood_blue.png')}"
|
||||
alt="TurboGears under the hood" />
|
||||
<p>TurboGears is a open source front-to-back web development framework
|
||||
written in Python</p>
|
||||
<p>Copyright © 2007 Kevin Dangoor</p>
|
||||
<!-- TODO: logo <img src="${tg.url('/static/images/logo.png')}"
|
||||
alt="sense.lab e.V." /> -->
|
||||
<p>Die Fotokiste ist ein Projekt von <a href="http://senselab.org"
|
||||
alt="sense.lab-Webseite">sense.lab e.V.</a>.</p>
|
||||
<p>Diese Webseiten können unter den Bedingungen der<br/>
|
||||
<a href="http://creativecommons.org/licenses/by-sa/2.5/"
|
||||
alt="Creative-Commans-Lizenz by-sa v2.5">Creative-Commons-Lizenz:
|
||||
Namensnennung-Weitergabe unter gleichen Bedingungen</a>
|
||||
wiederverwendet werden.</p>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
|
29
fotokiste/fotokiste/templates/senden.kid
Normal file
29
fotokiste/fotokiste/templates/senden.kid
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
|
||||
py:extends="'master.kid'">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
|
||||
<title>Käääääääsekuchen!</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div id="mail_pic">
|
||||
<p><img width="300" height="384"
|
||||
src="${tg.url('/static/images/platzhalter.jpg')}"
|
||||
alt="versendetes Bild" /></p>
|
||||
</div>
|
||||
|
||||
<div id="mail_info">
|
||||
<form action="${tg.url('/mailtext')}">
|
||||
<input type="hidden" name="mailtext" value="${mailtext}" />
|
||||
<input type="hidden" name="already_stored" value="${already_stored}" />
|
||||
<input type="submit" name="send" value="Erneut versenden" />
|
||||
</form>
|
||||
<form action="${tg.url('/')}">
|
||||
<input type="submit" name="send" value="Fertig" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
50
fotokiste/fotokiste/templates/start.kid
Normal file
50
fotokiste/fotokiste/templates/start.kid
Normal file
|
@ -0,0 +1,50 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#"
|
||||
py:extends="'master.kid'">
|
||||
<head>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
|
||||
<title>Willkommen in der Fotokiste!</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div id="live_pic">
|
||||
<p><img width="200" height="256"
|
||||
src="${tg.url('/static/images/platzhalter.jpg')}"
|
||||
alt="beispiel" /></p>
|
||||
</div>
|
||||
</td>
|
||||
<td valign="center">
|
||||
<!-- TODO: einfach nur ein weiterfuehrendes Icon - kein Formular -->
|
||||
<form action="${tg.url('/ausloeser')}">
|
||||
<input type="submit" value="Bild senden" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="gallery">
|
||||
<!-- see http://www.kid-templating.org/trac/wiki/GenerateTableFromListRecipe -->
|
||||
<?python i= iter(gallery); rows= map(None, i, i, i, i, i, i, i, i, i, i, i) ?>
|
||||
<table>
|
||||
<tr py:for="row in rows">
|
||||
<td py:for="picture in row">
|
||||
<img py:if="picture" py:strip="False"
|
||||
title="${picture.title}" width="50" height="64"
|
||||
src="${tg.url('/static/images/platzhalter.jpg')}"
|
||||
TODO="${picture.url}" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<div class="notice">Falls du Fragen zur FotoKiste hast, dann schau mal auf die
|
||||
<a href="http://glasmensch.org/fotokiste">Webseite</a> oder schreib eine Mail
|
||||
an <a href="mailto:fotokiste@glasmensch.org">fotokiste@glasmensch.org</a>.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue