content,
<span xmlns:kid="http://purl.org/kid/ns#" kid:omit="">
<?python
TEMPLATE = redfoot.namespace("http://redfoot.net/3.0/template#")
KID = redfoot.namespace("http://redfoot.net/3.0/kid#")
SERVER = redfoot.namespace("http://redfoot.net/3.0/server#")
CODE = redfoot.namespace("http://redfoot.net/3.0/code#")
allowed = allow(URIRef("%s/edit/put_content/" % request.host))
from urllib import quote
uri = request.parameters.get("uri")
if uri:
uri = URIRef(uri)
label = redfoot.label(uri)
content = redfoot.value(uri, TEMPLATE.content)
if content:
content_type = redfoot.value(content, RDF.type)
if content_type==KID.PagePartHandler:
content_value = redfoot.value(content, KID.template)
elif content_type==SERVER.PagePartHandler:
content_value = redfoot.value(content, CODE.python)
else:
raise Exception("Unexpected content_type: %s" % content_type)
else:
content_value = None
content_type = KID.PagePartHandler
if content_value is None:
content_value = Literal("", datatype=URIRef("http://www.w3.org/2001/XMLSchema#string"))
value_list = [("Kid", KID.PagePartHandler),
("Python", SERVER.PagePartHandler)]
?>
<div kid:if="uri and allowed" kid:strip="">
<form action="/edit/put_content/" method="post">
<input name="uri" type="hidden" value="${uri}"/>
<p>Title: <input type="text" name="title" value="${label}" style="width: 80%"/></p>
<textarea name="content" cols="" rows="40" style="width: 100%">${content_value}</textarea>
<p>Format:
<select name="format">
<span kid:for="option_label, option_value in value_list" kid:strip="">
<option kid:if="option_value==content_type" value="${option_value}" selected="true" >${option_label}</option>
<option kid:if="option_value!=content_type" value="${option_value}">${option_label}</option>
</span>
</select>
<input name="submit" type="submit" value="Submit Content" />
</p>
</form>
</div>
<div kid:if="not allowed" kid:strip="">
<p kid:if="allow(URIRef('%s/login/'% request.host))">
<a href="/login/?return_uri=${quote(request.uri)}">Login</a> to submit a edit_content content.
</p>
</div>
</span>
Comments regarding http://redfoot.net/3.0/aspects/edit_content/edit_content_content
Login to submit a comment.