From 2517ae62f7a79900def752082e96d4d3cbeba5b6 Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 23 Jul 2001 23:29:10 +0000 Subject: [PATCH] Adding the classic template git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@61 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/templates/README.txt | 7 +- roundup/templates/classic/__init__.py | 15 ++ roundup/templates/classic/dbinit.py | 133 ++++++++++++++ .../templates/classic/detectors/__init__.py | 27 +++ .../classic/detectors/nosyreaction.py | 70 ++++++++ roundup/templates/classic/html/file.index | 9 + roundup/templates/classic/html/issue.filter | 13 ++ roundup/templates/classic/html/issue.index | 15 ++ roundup/templates/classic/html/issue.item | 64 +++++++ roundup/templates/classic/html/msg.index | 12 ++ roundup/templates/classic/html/msg.item | 37 ++++ roundup/templates/classic/html/style.css | 163 ++++++++++++++++++ roundup/templates/classic/html/user.index | 18 ++ roundup/templates/classic/html/user.item | 46 +++++ roundup/templates/classic/instance_config.py | 50 ++++++ roundup/templates/classic/interfaces.py | 28 +++ 16 files changed, 706 insertions(+), 1 deletion(-) create mode 100644 roundup/templates/classic/__init__.py create mode 100644 roundup/templates/classic/dbinit.py create mode 100644 roundup/templates/classic/detectors/__init__.py create mode 100644 roundup/templates/classic/detectors/nosyreaction.py create mode 100644 roundup/templates/classic/html/file.index create mode 100644 roundup/templates/classic/html/issue.filter create mode 100644 roundup/templates/classic/html/issue.index create mode 100644 roundup/templates/classic/html/issue.item create mode 100644 roundup/templates/classic/html/msg.index create mode 100644 roundup/templates/classic/html/msg.item create mode 100644 roundup/templates/classic/html/style.css create mode 100644 roundup/templates/classic/html/user.index create mode 100644 roundup/templates/classic/html/user.item create mode 100644 roundup/templates/classic/instance_config.py create mode 100644 roundup/templates/classic/interfaces.py diff --git a/roundup/templates/README.txt b/roundup/templates/README.txt index 3fbf927..11a9223 100644 --- a/roundup/templates/README.txt +++ b/roundup/templates/README.txt @@ -6,4 +6,9 @@ templates. The currently available templates are: - extended -- + classic -- The schema is as described in the Roundup spec. + + extended -- The classic schema with some extra fields useful for support + calls: product identification, customer name, source of call, + log of time spent on call. + diff --git a/roundup/templates/classic/__init__.py b/roundup/templates/classic/__init__.py new file mode 100644 index 0000000..f3008d6 --- /dev/null +++ b/roundup/templates/classic/__init__.py @@ -0,0 +1,15 @@ +# $Id: __init__.py,v 1.1 2001-07-23 23:28:43 richard Exp $ + +from instance_config import * +from dbinit import * +from interfaces import * + +# +# $Log: not supported by cvs2svn $ +# Revision 1.3 2001/07/23 23:16:01 richard +# Split off the interfaces (CGI, mailgw) into a separate file from the DB stuff. +# +# Revision 1.2 2001/07/23 04:33:21 anthonybaxter +# split __init__.py into 2. dbinit and instance_config. +# +# diff --git a/roundup/templates/classic/dbinit.py b/roundup/templates/classic/dbinit.py new file mode 100644 index 0000000..172dd34 --- /dev/null +++ b/roundup/templates/classic/dbinit.py @@ -0,0 +1,133 @@ +# $Id: dbinit.py,v 1.1 2001-07-23 23:28:43 richard Exp $ + +import os + +import instance_config +from roundup import roundupdb, cgi_client, mailgw +import select_db +from roundup.roundupdb import Class, FileClass + +class Database(roundupdb.Database, select_db.Database): + ''' Creates a hybrid database from: + . the selected database back-end from select_db + . the roundup extensions from roundupdb + ''' + pass + +class IssueClass(roundupdb.IssueClass): + ''' issues need the email information + ''' + ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL + ADMIN_EMAIL = instance_config.ADMIN_EMAIL + MAILHOST = instance_config.MAILHOST + + +def open(name=None): + ''' as from the roundupdb method openDB + + ''' + from roundup.hyperdb import String, Date, Link, Multilink + + # open the database + db = Database(instance_config.DATABASE, name) + + # Now initialise the schema. Must do this each time. + pri = Class(db, "priority", + name=String(), order=String()) + pri.setkey("name") + + stat = Class(db, "status", + name=String(), order=String()) + stat.setkey("name") + + keywords = Class(db, "keyword", + name=String()) + + user = Class(db, "user", + username=String(), password=String(), + address=String(), realname=String(), + phone=String(), organisation=String()) + user.setkey("username") + + msg = FileClass(db, "msg", + author=Link("user"), recipients=Multilink("user"), + date=Date(), summary=String(), + files=Multilink("file")) + + file = FileClass(db, "file", + name=String(), type=String()) + + keyword = Class(db, "keyword", name=String()) + keyword.setkey("name") + + issue = IssueClass(db, "issue", + assignedto=Link("user"), topic=hyperdb.Multilink("keyword"), + priority=Link("priority"), status=Link("status")) + issue.setkey('title') + + import detectors + detectors.init(db) + + return db + +def init(adminpw): + ''' as from the roundupdb method initDB + + Open the new database, and set up a bunch of attributes. + + ''' + dbdir = os.path.join(instance_config.DATABASE, 'files') + if not os.path.isdir(dbdir): + os.makedirs(dbdir) + + db = open("admin") + db.clear() + + pri = db.getclass('priority') + pri.create(name="critical", order="1") + pri.create(name="urgent", order="2") + pri.create(name="bug", order="3") + pri.create(name="feature", order="4") + pri.create(name="wish", order="5") + + stat = db.getclass('status') + stat.create(name="unread", order="1") + stat.create(name="deferred", order="2") + stat.create(name="chatting", order="3") + stat.create(name="need-eg", order="4") + stat.create(name="in-progress", order="5") + stat.create(name="testing", order="6") + stat.create(name="done-cbb", order="7") + stat.create(name="resolved", order="8") + + user = db.getclass('user') + user.create(username="admin", password=adminpw, + address=instance_config.ADMIN_EMAIL) + + db.close() + +# +# $Log: not supported by cvs2svn $ +# Revision 1.4 2001/07/23 08:45:28 richard +# ok, so now "./roundup-admin init" will ask questions in an attempt to get a +# workable instance_home set up :) +# _and_ anydbm has had its first test :) +# +# Revision 1.3 2001/07/23 07:14:41 richard +# Moved the database backends off into backends. +# +# Revision 1.2 2001/07/23 06:25:50 richard +# relfected the move to roundup/backends +# +# Revision 1.1 2001/07/23 04:33:21 anthonybaxter +# split __init__.py into 2. dbinit and instance_config. +# +# Revision 1.1 2001/07/23 03:50:46 anthonybaxter +# moved templates to proper location +# +# Revision 1.2 2001/07/22 12:09:32 richard +# Final commit of Grande Splite +# +# + + diff --git a/roundup/templates/classic/detectors/__init__.py b/roundup/templates/classic/detectors/__init__.py new file mode 100644 index 0000000..1f3c6f7 --- /dev/null +++ b/roundup/templates/classic/detectors/__init__.py @@ -0,0 +1,27 @@ +#$Id: __init__.py,v 1.1 2001-07-23 23:29:10 richard Exp $ + +def init(db): + ''' execute the init functions of all the modules in this directory + ''' + import os, sys + this_dir = os.path.split(__file__)[0] + try: + sys.path.insert(0, this_dir) + for file in os.listdir(this_dir): + file, ext = os.path.splitext(file) + if file == '__init__': continue + if ext in ('.py', '.pyc'): + module = __import__(file) + module.init(db) + finally: + del sys.path[0] + +# +#$Log: not supported by cvs2svn $ +#Revision 1.1 2001/07/23 03:50:47 anthonybaxter +#moved templates to proper location +# +#Revision 1.1 2001/07/22 12:09:32 richard +#Final commit of Grande Splite +# +# diff --git a/roundup/templates/classic/detectors/nosyreaction.py b/roundup/templates/classic/detectors/nosyreaction.py new file mode 100644 index 0000000..05c9bfc --- /dev/null +++ b/roundup/templates/classic/detectors/nosyreaction.py @@ -0,0 +1,70 @@ +#$Id: nosyreaction.py,v 1.1 2001-07-23 23:29:10 richard Exp $ + +def nosyreaction(db, cl, nodeid, oldvalues): + ''' A standard detector is provided that watches for additions to the + "messages" property. + + When a new message is added, the detector sends it to all the users on + the "nosy" list for the issue that are not already on the "recipients" + list of the message. + + Those users are then appended to the "recipients" property on the + message, so multiple copies of a message are never sent to the same + user. + + The journal recorded by the hyperdatabase on the "recipients" property + then provides a log of when the message was sent to whom. + ''' + messages = [] + if oldvalues is None: + # the action was a create, so use all the messages in the create + messages = cl.get(nodeid, 'messages') + elif oldvalues.has_key('messages'): + # the action was a set (so adding new messages to an existing issue) + m = {} + for msgid in oldvalues['messages']: + m[msgid] = 1 + messages = [] + # figure which of the messages now on the issue weren't there before + for msgid in cl.get(nodeid, 'messages'): + if not m.has_key(msgid): + messages.append(msgid) + if not messages: + return + + # send a copy to the nosy list + for msgid in messages: + cl.sendmessage(nodeid, msgid) + + # update the nosy list with the recipients from the new messages + nosy = cl.get(nodeid, 'nosy') + n = {} + for nosyid in nosy: n[nosyid] = 1 + change = 0 + # but don't add admin to the nosy list + for msgid in messages: + for recipid in db.msg.get(msgid, 'recipients'): + if recipid != '1' and not n.has_key(recipid): + change = 1 + nosy.append(recipid) + authid = db.msg.get(msgid, 'author') + if authid != '1' and not n.has_key(authid): + change = 1 + nosy.append(authid) + if change: + cl.set(nodeid, nosy=nosy) + + +def init(db): + db.issue.react('create', nosyreaction) + db.issue.react('set', nosyreaction) + +# +#$Log: not supported by cvs2svn $ +#Revision 1.1 2001/07/23 03:50:47 anthonybaxter +#moved templates to proper location +# +#Revision 1.1 2001/07/22 12:09:32 richard +#Final commit of Grande Splite +# +# diff --git a/roundup/templates/classic/html/file.index b/roundup/templates/classic/html/file.index new file mode 100644 index 0000000..6ba4dd6 --- /dev/null +++ b/roundup/templates/classic/html/file.index @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/roundup/templates/classic/html/issue.filter b/roundup/templates/classic/html/issue.filter new file mode 100644 index 0000000..9d624c1 --- /dev/null +++ b/roundup/templates/classic/html/issue.filter @@ -0,0 +1,13 @@ + + + Title + + + + Status + + + + Priority + + diff --git a/roundup/templates/classic/html/issue.index b/roundup/templates/classic/html/issue.index new file mode 100644 index 0000000..7fff441 --- /dev/null +++ b/roundup/templates/classic/html/issue.index @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/roundup/templates/classic/html/issue.item b/roundup/templates/classic/html/issue.item new file mode 100644 index 0000000..f7109f9 --- /dev/null +++ b/roundup/templates/classic/html/issue.item @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Item Information
Title
Created + ()Last activity
PriorityStatus
SupersederNosy List
Change Note
 
Messages
Files
+ diff --git a/roundup/templates/classic/html/msg.index b/roundup/templates/classic/html/msg.index new file mode 100644 index 0000000..1934b35 --- /dev/null +++ b/roundup/templates/classic/html/msg.index @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/roundup/templates/classic/html/msg.item b/roundup/templates/classic/html/msg.item new file mode 100644 index 0000000..7145e43 --- /dev/null +++ b/roundup/templates/classic/html/msg.item @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Message Information
Author
Recipients
Date
+
+
Files
History
diff --git a/roundup/templates/classic/html/style.css b/roundup/templates/classic/html/style.css new file mode 100644 index 0000000..2316c7c --- /dev/null +++ b/roundup/templates/classic/html/style.css @@ -0,0 +1,163 @@ +h1 { + font-family: Verdana, Helvetica, sans-serif; + font-size: 18pt; + font-weight: bold; +} + +h2 { + font-family: Verdana, Helvetica, sans-serif; + font-size: 16pt; + font-weight: bold; +} + +h3 { + font-family: Verdana, Helvetica, sans-serif; + font-size: 12pt; + font-weight: bold; +} + +a:hover { + font-family: Verdana, Helvetica, sans-serif; + text-decoration: underline; + color: #333333; +} + +a:link { + font-family: Verdana, Helvetica, sans-serif; + text-decoration: none; + color: #000099; +} + +a { + font-family: Verdana, Helvetica, sans-serif; + text-decoration: none; + color: #000099; +} + +p { + font-family: Verdana, Helvetica, sans-serif; + font-size: 10pt; + color: #333333; +} + +th { + font-family: Verdana, Helvetica, sans-serif; + font-weight: bold; + font-size: 10pt; + color: #333333; +} + +.form-help { + font-family: Verdana, Helvetica, sans-serif; + font-size: 10pt; + color: #333333; +} + +.std-text { + font-family: Verdana, Helvetica, sans-serif; + font-size: 10pt; + color: #333333; +} + +.tab-small { + font-family: Verdana, Helvetica, sans-serif; + font-size: 8pt; + color: #333333; +} + +.location-bar { + background-color: #efefef; + border: none; +} + +.strong-header { + font-family: Verdana, Helvetica, sans-serif; + font-size: 12pt; + font-weight: bold; + background-color: #000000; + color: #ffffff; +} + +.list-header { + background-color: #c0c0c0; + border: none; +} + +.list-item { + font-family: Verdana, Helvetica, sans-serif; + font-size: 10pt; +} + +.list-nav { + font-family: Verdana, Helvetica, sans-serif; + font-size: 10pt; + font-weight: bold; +} + +.row-normal { + background-color: #ffffff; + border: none; + +} + +.row-hilite { + background-color: #efefef; + border: none; +} + +.section-bar { + background-color: #c0c0c0; + border: none; +} + +.system-msg { + font-family: Verdana, Helvetica, sans-serif; + font-size: 10pt; + background-color: #ffffff; + border: 1px solid #000000; + margin-bottom: 6px; + margin-top: 6px; + padding: 4px; + width: 100%; + color: #660033; +} + +.form-title { + font-family: Verdana, Helvetica, sans-serif; + font-weight: bold; + font-size: 12pt; + color: #333333; +} + +.form-label { + font-family: Verdana, Helvetica, sans-serif; + font-weight: bold; + font-size: 10pt; + color: #333333; +} + +.form-optional { + font-family: Verdana, Helvetica, sans-serif; + font-weight: bold; + font-style: italic; + font-size: 10pt; + color: #333333; +} + +.form-element { + font-family: Verdana, Helvetica, aans-serif; + font-size: 10pt; + color: #000000; +} + +.form-text { + font-family: Verdana, Helvetica, sans-serif; + font-size: 10pt; + color: #333333; +} + +.form-mono { + font-family: monospace; + font-size: 12px; + text-decoration: none; +} diff --git a/roundup/templates/classic/html/user.index b/roundup/templates/classic/html/user.index new file mode 100644 index 0000000..685fde8 --- /dev/null +++ b/roundup/templates/classic/html/user.index @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/roundup/templates/classic/html/user.item b/roundup/templates/classic/html/user.item new file mode 100644 index 0000000..5c755ac --- /dev/null +++ b/roundup/templates/classic/html/user.item @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Your Details
Name
Login Name
Login Password
Phone
Organisation
E-mail address
 
History
+ diff --git a/roundup/templates/classic/instance_config.py b/roundup/templates/classic/instance_config.py new file mode 100644 index 0000000..6b13989 --- /dev/null +++ b/roundup/templates/classic/instance_config.py @@ -0,0 +1,50 @@ +# $Id: instance_config.py,v 1.1 2001-07-23 23:28:43 richard Exp $ + +MAIL_DOMAIN=MAILHOST=HTTP_HOST=None +HTTP_PORT=0 + +try: + from localconfig import * +except ImportError: + localconfig = None + +import os + +# roundup home is this package's directory +INSTANCE_HOME=os.path.split(__file__)[0] + +# The SMTP mail host that roundup will use to send mail +if not MAILHOST: + MAILHOST = 'localhost' + +# The domain name used for email addresses. +if not MAIL_DOMAIN: + MAIL_DOMAIN = 'bizarsoftware.com.au' + +# the next two are only used for the standalone HTTP server. +if not HTTP_HOST: + HTTP_HOST = '' +if not HTTP_PORT: + HTTP_PORT = 9080 + +# This is the directory that the database is going to be stored in +DATABASE = os.path.join(INSTANCE_HOME, 'db') + +# This is the directory that the HTML templates reside in +TEMPLATES = os.path.join(INSTANCE_HOME, 'html') + +# The email address that mail to roundup should go to +ISSUE_TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN + +# The email address that roundup will complain to if it runs into trouble +ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN + +# Somewhere for roundup to log stuff internally sent to stdout or stderr +LOG = os.path.join(INSTANCE_HOME, 'roundup.log') + +# +# $Log: not supported by cvs2svn $ +# Revision 1.1 2001/07/23 04:33:21 anthonybaxter +# split __init__.py into 2. dbinit and instance_config. +# +# diff --git a/roundup/templates/classic/interfaces.py b/roundup/templates/classic/interfaces.py new file mode 100644 index 0000000..d7a4698 --- /dev/null +++ b/roundup/templates/classic/interfaces.py @@ -0,0 +1,28 @@ +# $Id: interfaces.py,v 1.1 2001-07-23 23:28:43 richard Exp $ + +import instance_config +from roundup import cgi_client, mailgw + +class Client(cgi_client.Client): + ''' derives basic mail gateway implementation from the standard module, + with any specific extensions + ''' + TEMPLATES = instance_config.TEMPLATES + pass + +class MailGW(mailgw.MailGW): + ''' derives basic mail gateway implementation from the standard module, + with any specific extensions + ''' + ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL + ADMIN_EMAIL = instance_config.ADMIN_EMAIL + MAILHOST = instance_config.MAILHOST + +# +# $Log: not supported by cvs2svn $ +# Revision 1.1 2001/07/23 23:16:01 richard +# Split off the interfaces (CGI, mailgw) into a separate file from the DB stuff. +# +# + + -- 2.30.2