Skip to content

Commit cc649b7

Browse files
author
Richard Jones
committed
additions
1 parent fd04449 commit cc649b7

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<span tal:condition="python:not (context.is_view_ok() or context.is_edit_ok())">
2+
You are not allowed to view this page.
3+
</span>
4+
5+
<form method="POST" onSubmit="return submit_once()"
6+
enctype="multipart/form-data" tal:condition="context/is_edit_ok">
7+
8+
<input type="hidden" name=":template" value="item">
9+
<input type="hidden" name=":required" value="name,type">
10+
11+
<input type="hidden" name="multilink"
12+
tal:condition="python:request.form.has_key(':multilink')"
13+
tal:attributes="value request/form/:multilink/value">
14+
15+
<table class="form">
16+
<tr>
17+
<th>Name</th>
18+
<td tal:content="structure context/name/field"></td>
19+
</tr>
20+
<tr>
21+
<th>Content Type</th>
22+
<td tal:content="structure context/type/field"></td>
23+
</tr>
24+
<tr>
25+
<th>Content</th>
26+
<td><input type="file" name="content" size="40"></td>
27+
</tr>
28+
29+
<tr>
30+
<td>&nbsp;</td>
31+
<td tal:content="structure context/submit">submit button here</td>
32+
</tr>
33+
</table>
34+
</form>
35+
36+
<a tal:condition="python:context.id and context.is_view_ok()"
37+
tal:attributes="href string:file${context/id}/${context/name}">download</a>
38+
39+
<table class="form" tal:condition="context/is_only_view_ok">
40+
<tr>
41+
<th>Name</th>
42+
<td tal:content="context/name"></td>
43+
</tr>
44+
<tr>
45+
<th>Content Type</th>
46+
<td tal:content="context/type"></td>
47+
</tr>
48+
</table>
49+
50+
<tal:block tal:condition="python:context.id and context.is_view_ok()"
51+
tal:replace="structure context/history" />
52+

scripts/schema_diagram.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#! /usr/bin/python
2+
#
3+
# Schema diagram generator contributed by Stefan Seefeld of the fresco
4+
# project http://www.fresco.org/.
5+
#
6+
# It generates a 'dot file' that is then fed into the 'dot'
7+
# tool (http://www.graphviz.org) to generate a graph:
8+
#
9+
# %> ./schema.py
10+
# %> dot -Tps schema.dot -o schema.ps
11+
# %> gv schema.ps
12+
#
13+
import sys
14+
import roundup.instance
15+
16+
# open the instance
17+
instance = roundup.instance.open(sys.argv[1])
18+
db = instance.open()
19+
20+
# diagram preamble
21+
print 'digraph schema {'
22+
print 'size="8,6"'
23+
print 'node [shape="record" bgcolor="#ffe4c4" style=filled]'
24+
print 'edge [taillabel="1" headlabel="1" dir=back arrowtail=ediamond]'
25+
26+
# get all the classes
27+
types = db.classes.keys()
28+
29+
# one record node per class
30+
for i in range(len(types)):
31+
print 'node%d [label=\"{%s|}"]'%(i, types[i])
32+
33+
# now draw in the relations
34+
for name in db.classes.keys():
35+
type = db.classes[name]
36+
attributes = type.getprops()
37+
for a in attributes.keys():
38+
attribute = attributes[a]
39+
if isinstance(attribute, roundup.hyperdb.Link):
40+
print 'node%d -> node%d [label=%s]'%(types.index(name),
41+
types.index(attribute.classname),
42+
a)
43+
elif isinstance(attribute, roundup.hyperdb.Multilink):
44+
print 'node%d -> node%d [taillabel="*" label=%s]'%(types.index(name),
45+
types.index(attribute.classname),
46+
a)
47+
# all done
48+
print '}'

0 commit comments

Comments
 (0)