Skip to content

Commit 1503f43

Browse files
author
Richard Jones
committed
Adding the classic template
1 parent b6c1112 commit 1503f43

File tree

16 files changed

+706
-1
lines changed

16 files changed

+706
-1
lines changed

roundup/templates/README.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ templates.
66

77
The currently available templates are:
88

9-
extended --
9+
classic -- The schema is as described in the Roundup spec.
10+
11+
extended -- The classic schema with some extra fields useful for support
12+
calls: product identification, customer name, source of call,
13+
log of time spent on call.
14+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# $Id: __init__.py,v 1.1 2001-07-23 23:28:43 richard Exp $
2+
3+
from instance_config import *
4+
from dbinit import *
5+
from interfaces import *
6+
7+
#
8+
# $Log: not supported by cvs2svn $
9+
# Revision 1.3 2001/07/23 23:16:01 richard
10+
# Split off the interfaces (CGI, mailgw) into a separate file from the DB stuff.
11+
#
12+
# Revision 1.2 2001/07/23 04:33:21 anthonybaxter
13+
# split __init__.py into 2. dbinit and instance_config.
14+
#
15+
#
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# $Id: dbinit.py,v 1.1 2001-07-23 23:28:43 richard Exp $
2+
3+
import os
4+
5+
import instance_config
6+
from roundup import roundupdb, cgi_client, mailgw
7+
import select_db
8+
from roundup.roundupdb import Class, FileClass
9+
10+
class Database(roundupdb.Database, select_db.Database):
11+
''' Creates a hybrid database from:
12+
. the selected database back-end from select_db
13+
. the roundup extensions from roundupdb
14+
'''
15+
pass
16+
17+
class IssueClass(roundupdb.IssueClass):
18+
''' issues need the email information
19+
'''
20+
ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
21+
ADMIN_EMAIL = instance_config.ADMIN_EMAIL
22+
MAILHOST = instance_config.MAILHOST
23+
24+
25+
def open(name=None):
26+
''' as from the roundupdb method openDB
27+
28+
'''
29+
from roundup.hyperdb import String, Date, Link, Multilink
30+
31+
# open the database
32+
db = Database(instance_config.DATABASE, name)
33+
34+
# Now initialise the schema. Must do this each time.
35+
pri = Class(db, "priority",
36+
name=String(), order=String())
37+
pri.setkey("name")
38+
39+
stat = Class(db, "status",
40+
name=String(), order=String())
41+
stat.setkey("name")
42+
43+
keywords = Class(db, "keyword",
44+
name=String())
45+
46+
user = Class(db, "user",
47+
username=String(), password=String(),
48+
address=String(), realname=String(),
49+
phone=String(), organisation=String())
50+
user.setkey("username")
51+
52+
msg = FileClass(db, "msg",
53+
author=Link("user"), recipients=Multilink("user"),
54+
date=Date(), summary=String(),
55+
files=Multilink("file"))
56+
57+
file = FileClass(db, "file",
58+
name=String(), type=String())
59+
60+
keyword = Class(db, "keyword", name=String())
61+
keyword.setkey("name")
62+
63+
issue = IssueClass(db, "issue",
64+
assignedto=Link("user"), topic=hyperdb.Multilink("keyword"),
65+
priority=Link("priority"), status=Link("status"))
66+
issue.setkey('title')
67+
68+
import detectors
69+
detectors.init(db)
70+
71+
return db
72+
73+
def init(adminpw):
74+
''' as from the roundupdb method initDB
75+
76+
Open the new database, and set up a bunch of attributes.
77+
78+
'''
79+
dbdir = os.path.join(instance_config.DATABASE, 'files')
80+
if not os.path.isdir(dbdir):
81+
os.makedirs(dbdir)
82+
83+
db = open("admin")
84+
db.clear()
85+
86+
pri = db.getclass('priority')
87+
pri.create(name="critical", order="1")
88+
pri.create(name="urgent", order="2")
89+
pri.create(name="bug", order="3")
90+
pri.create(name="feature", order="4")
91+
pri.create(name="wish", order="5")
92+
93+
stat = db.getclass('status')
94+
stat.create(name="unread", order="1")
95+
stat.create(name="deferred", order="2")
96+
stat.create(name="chatting", order="3")
97+
stat.create(name="need-eg", order="4")
98+
stat.create(name="in-progress", order="5")
99+
stat.create(name="testing", order="6")
100+
stat.create(name="done-cbb", order="7")
101+
stat.create(name="resolved", order="8")
102+
103+
user = db.getclass('user')
104+
user.create(username="admin", password=adminpw,
105+
address=instance_config.ADMIN_EMAIL)
106+
107+
db.close()
108+
109+
#
110+
# $Log: not supported by cvs2svn $
111+
# Revision 1.4 2001/07/23 08:45:28 richard
112+
# ok, so now "./roundup-admin init" will ask questions in an attempt to get a
113+
# workable instance_home set up :)
114+
# _and_ anydbm has had its first test :)
115+
#
116+
# Revision 1.3 2001/07/23 07:14:41 richard
117+
# Moved the database backends off into backends.
118+
#
119+
# Revision 1.2 2001/07/23 06:25:50 richard
120+
# relfected the move to roundup/backends
121+
#
122+
# Revision 1.1 2001/07/23 04:33:21 anthonybaxter
123+
# split __init__.py into 2. dbinit and instance_config.
124+
#
125+
# Revision 1.1 2001/07/23 03:50:46 anthonybaxter
126+
# moved templates to proper location
127+
#
128+
# Revision 1.2 2001/07/22 12:09:32 richard
129+
# Final commit of Grande Splite
130+
#
131+
#
132+
133+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#$Id: __init__.py,v 1.1 2001-07-23 23:29:10 richard Exp $
2+
3+
def init(db):
4+
''' execute the init functions of all the modules in this directory
5+
'''
6+
import os, sys
7+
this_dir = os.path.split(__file__)[0]
8+
try:
9+
sys.path.insert(0, this_dir)
10+
for file in os.listdir(this_dir):
11+
file, ext = os.path.splitext(file)
12+
if file == '__init__': continue
13+
if ext in ('.py', '.pyc'):
14+
module = __import__(file)
15+
module.init(db)
16+
finally:
17+
del sys.path[0]
18+
19+
#
20+
#$Log: not supported by cvs2svn $
21+
#Revision 1.1 2001/07/23 03:50:47 anthonybaxter
22+
#moved templates to proper location
23+
#
24+
#Revision 1.1 2001/07/22 12:09:32 richard
25+
#Final commit of Grande Splite
26+
#
27+
#
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#$Id: nosyreaction.py,v 1.1 2001-07-23 23:29:10 richard Exp $
2+
3+
def nosyreaction(db, cl, nodeid, oldvalues):
4+
''' A standard detector is provided that watches for additions to the
5+
"messages" property.
6+
7+
When a new message is added, the detector sends it to all the users on
8+
the "nosy" list for the issue that are not already on the "recipients"
9+
list of the message.
10+
11+
Those users are then appended to the "recipients" property on the
12+
message, so multiple copies of a message are never sent to the same
13+
user.
14+
15+
The journal recorded by the hyperdatabase on the "recipients" property
16+
then provides a log of when the message was sent to whom.
17+
'''
18+
messages = []
19+
if oldvalues is None:
20+
# the action was a create, so use all the messages in the create
21+
messages = cl.get(nodeid, 'messages')
22+
elif oldvalues.has_key('messages'):
23+
# the action was a set (so adding new messages to an existing issue)
24+
m = {}
25+
for msgid in oldvalues['messages']:
26+
m[msgid] = 1
27+
messages = []
28+
# figure which of the messages now on the issue weren't there before
29+
for msgid in cl.get(nodeid, 'messages'):
30+
if not m.has_key(msgid):
31+
messages.append(msgid)
32+
if not messages:
33+
return
34+
35+
# send a copy to the nosy list
36+
for msgid in messages:
37+
cl.sendmessage(nodeid, msgid)
38+
39+
# update the nosy list with the recipients from the new messages
40+
nosy = cl.get(nodeid, 'nosy')
41+
n = {}
42+
for nosyid in nosy: n[nosyid] = 1
43+
change = 0
44+
# but don't add admin to the nosy list
45+
for msgid in messages:
46+
for recipid in db.msg.get(msgid, 'recipients'):
47+
if recipid != '1' and not n.has_key(recipid):
48+
change = 1
49+
nosy.append(recipid)
50+
authid = db.msg.get(msgid, 'author')
51+
if authid != '1' and not n.has_key(authid):
52+
change = 1
53+
nosy.append(authid)
54+
if change:
55+
cl.set(nodeid, nosy=nosy)
56+
57+
58+
def init(db):
59+
db.issue.react('create', nosyreaction)
60+
db.issue.react('set', nosyreaction)
61+
62+
#
63+
#$Log: not supported by cvs2svn $
64+
#Revision 1.1 2001/07/23 03:50:47 anthonybaxter
65+
#moved templates to proper location
66+
#
67+
#Revision 1.1 2001/07/22 12:09:32 richard
68+
#Final commit of Grande Splite
69+
#
70+
#
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<!-- $Id: file.index,v 1.1 2001-07-23 23:29:10 richard Exp $-->
2+
<tr>
3+
<property name="name">
4+
<td><display call="link('name')"></td>
5+
</property>
6+
<property name="type">
7+
<td><display call="plain('type')"></td>
8+
</property>
9+
</tr>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- $Id: issue.filter,v 1.1 2001-07-23 23:29:10 richard Exp $-->
2+
<property name="title">
3+
<tr><th width="1%" align="right" class="location-bar">Title</th>
4+
<td><display call="field('title')"></td></tr>
5+
</property>
6+
<property name="status">
7+
<tr><th width="1%" align="right" class="location-bar">Status</th>
8+
<td><display call="checklist('status')"></td></tr>
9+
</property>
10+
<property name="priority">
11+
<tr><th width="1%" align="right" class="location-bar">Priority</th>
12+
<td><display call="checklist('priority')"></td></tr>
13+
</property>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!-- $Id: issue.index,v 1.1 2001-07-23 23:29:10 richard Exp $-->
2+
<tr>
3+
<property name="activity">
4+
<td valign="top"><display call="reldate('activity', pretty=1)"></td>
5+
</property>
6+
<property name="priority">
7+
<td valign="top"><display call="plain('priority')"></td>
8+
</property>
9+
<property name="status">
10+
<td valign="top"><display call="plain('status')"></td>
11+
</property>
12+
<property name="title">
13+
<td valign="top"><display call="link('title')"></td>
14+
</property>
15+
</tr>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!-- $Id: issue.item,v 1.1 2001-07-23 23:29:10 richard Exp $-->
2+
<table border=0 cellspacing=0 cellpadding=2>
3+
4+
<tr class="strong-header">
5+
<td colspan=4>Item Information</td>
6+
</td>
7+
8+
<tr bgcolor="ffffea">
9+
<td width=1% nowrap align=right><span class="form-label">Title</span></td>
10+
<td colspan=3 class="form-text"><display call="field('title', size=80)"></td>
11+
</tr>
12+
13+
<tr bgcolor="ffffea">
14+
<td width=1% nowrap align=right><span class="form-label">Created</span></td>
15+
<td class="form-text"><display call="reldate('creation', pretty=1)">
16+
(<display call="plain('creator')">)</td>
17+
<td width=1% nowrap align=right><span class="form-label">Last activity</span></td>
18+
<td class="form-text"><display call="reldate('activity', pretty=1)"></td>
19+
</tr>
20+
21+
<tr bgcolor="ffffea">
22+
<td width=1% nowrap align=right><span class="form-label">Priority</span></td>
23+
<td class="form-text"><display call="field('priority')"></td>
24+
<td width=1% nowrap align=right><span class="form-label">Status</span></td>
25+
<td class="form-text"><display call="menu('status')"></td>
26+
</tr>
27+
28+
<tr bgcolor="ffffea">
29+
<td width=1% nowrap align=right><span class="form-label">Superseder</span></td>
30+
<td class="form-text"><display call="field('superseder', size=40, showid=1)"></td>
31+
<td width=1% nowrap align=right><span class="form-label">Nosy List</span></td>
32+
<td class="form-text"><display call="field('nosy')"></td>
33+
</tr>
34+
35+
<tr bgcolor="ffffea">
36+
<td width=1% nowrap align=right><span class="form-label">Change Note</span></td>
37+
<td colspan=3 class="form-text"><display call="note()"></td>
38+
</tr>
39+
40+
<tr bgcolor="ffffea">
41+
<td>&nbsp;</td>
42+
<td colspan=3 class="form-text"><display call="submit()"></td>
43+
</tr>
44+
45+
<property name="messages">
46+
<tr class="strong-header">
47+
<td colspan=4><b>Messages</b></td>
48+
</tr>
49+
<tr>
50+
<td colspan=4><display call="list('messages')"></td>
51+
</tr>
52+
</property>
53+
54+
<property name="files">
55+
<tr class="strong-header">
56+
<td colspan=4><b>Files</b></td>
57+
</tr>
58+
<tr>
59+
<td colspan=4><display call="list('files')"></td>
60+
</tr>
61+
</property>
62+
63+
</table>
64+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!-- $Id: msg.index,v 1.1 2001-07-23 23:29:10 richard Exp $-->
2+
<tr>
3+
<property name="date">
4+
<td><display call="link('date')"></td>
5+
</property>
6+
<property name="author">
7+
<td><display call="plain('author')"></td>
8+
</property>
9+
<property name="summary">
10+
<td><display call="plain('summary')"></td>
11+
</property>
12+
</tr>

0 commit comments

Comments
 (0)