content,
<div xmlns:kid="http://purl.org/kid/ns#" kid:omit="">
<?python
_logger = redfoot.getLogger(__uri__)
from rdflib.util import date_time
from time import gmtime, time
from urllib import quote
SESSION = redfoot.namespace("http://redfoot.net/3.0/session#")
ISSUE = redfoot.namespace("http://redfoot.net/3.0/issue#")
DC = redfoot.namespace("http://purl.org/dc/elements/1.1/")
DCTERMS = redfoot.namespace("http://purl.org/dc/terms/")
SERVER = redfoot.namespace("http://redfoot.net/3.0/server#")
label = Literal(request.parameters.get("label"))
comment = Literal(request.parameters.get("comment"))
sid = request.session_id
if sid:
uid = redfoot.value(sid, SESSION.uid)
else:
uid = None
if label and comment and uid:
year, month, date, h, m, s, _, _, _ = gmtime()
# TODO: create a method somewhere for turning a label into a path
# suitable for use in a URIRef
path = label.lower().replace(" ", "_")
path.replace("#", "_")
path.replace("/", "_")
uri = URIRef("issues/%04d/%02d/%02d/%s" % (year, month, date, path) + "#issue", base=request.host)
context = redfoot.get_context(redfoot.context_id(uri, "context"), creator=__uri__)
# check if context already in use?
redfoot.index.add((context.identifier, RDFS.label, label))
context.add((uri, RDF.type, ISSUE.Issue))
context.add((uri, DC.creator, uid))
context.add((uri, DCTERMS.created, Literal("%s" % time())))
context.add((uri, RDFS.label, label))
context.add((uri, RDFS.comment, comment))
redfoot.remove((uri, SERVER.last_modified, None))
context.add((uri, SERVER.last_modified, Literal("%s" % time())))
try:
redfoot.xmpp.send(REDFOOT.Admin, "%s just added a new issue: '%s'. See: %s" % (redfoot.label(uid) or uid, redfoot.label(uri), uri.concrete()))
except Exception, e:
_logger.exception(e)
?>
<div kid:if="not label">
<h2>Error: No label submitted</h2>
</div>
<div kid:if="not comment">
<h2>Error: No comment submitted</h2>
</div>
<div kid:if="not uid">
<h2>Error: Must be logged in</h2>
</div>
<div kid:if="label and comment and uid">
<h2>Thank you for your issue</h2>
<h3>${label}</h3>
<pre>${comment}</pre>
<p>Return to <a href="/issues/">Issues</a></p>
</div>
</div>
Comments regarding http://redfoot.net/3.0/aspects/issues/issues_add_content
Login to submit a comment.