1 # $Id: interfaces.py,v 1.7 2001-08-02 00:43:06 richard Exp $
3 import instance_config, urlparse, os
4 from roundup import cgi_client, mailgw
6 class Client(cgi_client.Client):
7 ''' derives basic mail gateway implementation from the standard module,
8 with any specific extensions
9 '''
10 TEMPLATES = instance_config.TEMPLATES
11 showsupport = cgi_client.Client.shownode
12 showtimelog = cgi_client.Client.shownode
13 newsupport = cgi_client.Client.newnode
14 newtimelog = cgi_client.Client.newnode
16 default_index_sort = ['-activity']
17 default_index_group = ['priority']
18 default_index_filter = []
19 default_index_columns = ['activity','status','title','assignedto']
20 default_index_filterspec = {'status': ['1', '2', '3', '4', '5', '6', '7']}
22 def pagehead(self, title, message=None):
23 url = self.env['SCRIPT_NAME'] + '/' #self.env.get('PATH_INFO', '/')
24 machine = self.env['SERVER_NAME']
25 port = self.env['SERVER_PORT']
26 if port != '80': machine = machine + ':' + port
27 base = urlparse.urlunparse(('http', machine, url, None, None, None))
28 if message is not None:
29 message = '<div class="system-msg">%s</div>'%message
30 else:
31 message = ''
32 style = open(os.path.join(self.TEMPLATES, 'style.css')).read()
33 userid = self.db.user.lookup(self.user)
34 if self.user == 'admin':
35 extras = ' | <a href="list_classes">Class List</a>'
36 else:
37 extras = ''
38 self.write('''<html><head>
39 <title>%s</title>
40 <style type="text/css">%s</style>
41 </head>
42 <body bgcolor=#ffffff>
43 %s
44 <table width=100%% border=0 cellspacing=0 cellpadding=2>
45 <tr class="location-bar"><td><big><strong>%s</strong></big></td>
46 <td align=right valign=bottom>%s</td></tr>
47 <tr class="location-bar">
48 <td align=left>All
49 <a href="issue?status=unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=activity&:columns=id,activity,status,title,assignedto&:group=priority">Issues</a>,
50 <a href="support?status=unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=activity&:columns=id,activity,status,title,assignedto&:group=customername">Support</a>
51 | Unassigned
52 <a href="issue?assignedto=admin&status=unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=activity&:columns=id,activity,status,title,assignedto&:group=priority">Issues</a>,
53 <a href="support?assignedto=admin&status=unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=activity&:columns=id,activity,status,title,assignedto&:group=customername">Support</a>
54 | Add
55 <a href="newissue">Issue</a>,
56 <a href="newsupport">Support</a>,
57 <a href="newuser">User</a>
58 %s</td>
59 <td align=right>
60 <a href="issue?assignedto=%s&status=unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=activity&:columns=id,activity,status,title,assignedto&:group=priority">My Issues</a> |
61 <a href="support?assignedto=%s&status=unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=activity&:columns=id,activity,status,title,assignedto&:group=customername">My Support</a> |
62 <a href="user%s">My Details</a></td>
63 </table>
64 '''%(title, style, message, title, self.user, extras, userid, userid, userid))
66 class MailGW(mailgw.MailGW):
67 ''' derives basic mail gateway implementation from the standard module,
68 with any specific extensions
69 '''
70 ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
71 ADMIN_EMAIL = instance_config.ADMIN_EMAIL
72 MAILHOST = instance_config.MAILHOST
74 #
75 # $Log: not supported by cvs2svn $
76 # Revision 1.6 2001/08/02 00:36:42 richard
77 # Made all the user-specific link names the same (My Foo)
78 #
79 # Revision 1.5 2001/08/01 05:15:09 richard
80 # Added "My Issues" and "My Support" to extended template.
81 #
82 # Revision 1.4 2001/07/30 08:12:17 richard
83 # Added time logging and file uploading to the templates.
84 #
85 # Revision 1.3 2001/07/30 01:26:59 richard
86 # Big changes:
87 # . split off the support priority into its own class
88 # . added "new support, new user" to the page head
89 # . fixed the display options for the heading links
90 #
91 # Revision 1.2 2001/07/29 07:01:39 richard
92 # Added vim command to all source so that we don't get no steenkin' tabs :)
93 #
94 # Revision 1.1 2001/07/23 23:16:01 richard
95 # Split off the interfaces (CGI, mailgw) into a separate file from the DB stuff.
96 #
97 #
98 # vim: set filetype=python ts=4 sw=4 et si