Index: cgi_client.py
===================================================================
RCS file: /ttt/private/schlatterbeck/private_cvs/roundup/cgi_client.py,v
retrieving revision 1.1
retrieving revision 1.2
diff --context -r1.1 -r1.2
*** cgi_client.py	2002/02/14 15:25:27	1.1
--- cgi_client.py	2002/02/14 18:09:36	1.2
***************
*** 27,32 ****
--- 27,36 ----
  import roundupdb, htmltemplate, date, hyperdb, password
  from roundup.i18n import _
  
+ def _status_as_string (db) :
+     s = db.getclass ("status")
+     return ','.join (map (lambda x, s=s : s.get (x, "name"), s.list ()))
+ 
  class Unauthorised(ValueError):
      pass
  
***************
*** 83,88 ****
--- 87,93 ----
      def pagehead(self, title, message=None):
          url = self.env['SCRIPT_NAME'] + '/'
          machine = self.env['SERVER_NAME']
+         states = _status_as_string (self.db)
          port = self.env['SERVER_PORT']
          if port != '80': machine = machine + ':' + port
          base = urlparse.urlunparse(('http', machine, url, None, None, None))
***************
*** 101,107 ****
          if self.user not in (None, 'anonymous'):
              userid = self.db.user.lookup(self.user)
              user_info = _('''
! <a href="issue?assignedto=%(userid)s&status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:filter=status,assignedto&:sort=-activity&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">My Issues</a> |
  <a href="user%(userid)s">My Details</a> | <a href="logout">Logout</a>
  ''')%locals()
          else:
--- 106,112 ----
          if self.user not in (None, 'anonymous'):
              userid = self.db.user.lookup(self.user)
              user_info = _('''
! <a href="issue?assignedto=%(userid)s&status=-1,%(states)s&:filter=status,assignedto&:sort=-activity&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">My Issues</a> |
  <a href="user%(userid)s">My Details</a> | <a href="logout">Logout</a>
  ''')%locals()
          else:
***************
*** 124,132 ****
  <td align=right valign=bottom>%(user_name)s</td></tr>
  <tr class="location-bar">
  <td align=left>All
! <a href="issue?status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=-activity&:filter=status&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>
  | Unassigned
! <a href="issue?assignedto=-1&status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=-activity&:filter=status,assignedto&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>
  %(add_links)s
  %(admin_links)s</td>
  <td align=right>%(user_info)s</td>
--- 129,137 ----
  <td align=right valign=bottom>%(user_name)s</td></tr>
  <tr class="location-bar">
  <td align=left>All
! <a href="issue?status=-1,%(states)s&:sort=-activity&:filter=status&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>
  | Unassigned
! <a href="issue?assignedto=-1&status=-1,%(states)s&:sort=-activity&:filter=status,assignedto&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>
  %(add_links)s
  %(admin_links)s</td>
  <td align=right>%(user_info)s</td>
***************
*** 337,386 ****
      showissue = shownode
      showmsg = shownode
  
-     def _add_assignedto_to_nosy(self, props):
-         ''' add the assignedto value from the props to the nosy list
-         '''
-         if not props.has_key('assignedto'):
-             return
-         assignedto_id = props['assignedto']
-         if not props.has_key('nosy'):
-             # load current nosy
-             if self.nodeid:
-                 cl = self.db.classes[self.classname]
-                 l = cl.get(self.nodeid, 'nosy')
- 		if assignedto_id in l:
- 		    return
- 		props['nosy'] = l
-             else:
-                 props['nosy'] = []
-         if assignedto_id not in props['nosy']:
-             props['nosy'].append(assignedto_id)
- 
      def _changenode(self, props):
          ''' change the node based on the contents of the form
          '''
          cl = self.db.classes[self.classname]
-         # set status to chatting if 'unread' or 'resolved'
-         try:
-             # determine the id of 'unread','resolved' and 'chatting'
-             unread_id = self.db.status.lookup('unread')
-             resolved_id = self.db.status.lookup('resolved')
-             chatting_id = self.db.status.lookup('chatting')
-             current_status = cl.get(self.nodeid, 'status')
-             if props.has_key('status'):
-                 new_status = props['status']
-             else:
-                 # apparently there's a chance that some browsers don't
-                 # send status...
-                 new_status = current_status
-         except KeyError:
-             pass
-         else:
-             if new_status == unread_id or (new_status == resolved_id
-                     and current_status == resolved_id):
-                 props['status'] = chatting_id
- 
-         self._add_assignedto_to_nosy(props)
  
          # create the message
          message, files = self._handle_message()
--- 342,351 ----
***************
*** 398,415 ****
          cl = self.db.classes[self.classname]
          props = parsePropsFromForm(self.db, cl, self.form)
  
-         # set status to 'unread' if not specified - a status of '- no
-         # selection -' doesn't make sense
-         if not props.has_key('status'):
-             try:
-                 unread_id = self.db.status.lookup('unread')
-             except KeyError:
-                 pass
-             else:
-                 props['status'] = unread_id
- 
-         self._add_assignedto_to_nosy(props)
- 
          # check for messages and files
          message, files = self._handle_message()
          if message:
--- 363,368 ----
***************
*** 1048,1053 ****
--- 1001,1007 ----
          url = self.env['SCRIPT_NAME'] + '/' #self.env.get('PATH_INFO', '/')
          machine = self.env['SERVER_NAME']
          port = self.env['SERVER_PORT']
+         states = _status_as_string (self.db)
          if port != '80': machine = machine + ':' + port
          base = urlparse.urlunparse(('http', machine, url, None, None, None))
          if message is not None:
***************
*** 1065,1072 ****
          if self.user not in (None, 'anonymous'):
              userid = self.db.user.lookup(self.user)
              user_info = _('''
! <a href="issue?assignedto=%(userid)s&status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:filter=status,assignedto&:sort=-activity&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">My Issues</a> |
! <a href="support?assignedto=%(userid)s&status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:filter=status,assignedto&:sort=-activity&:columns=id,activity,status,title,assignedto&:group=customername&show_customization=1">My Support</a> |
  <a href="user%(userid)s">My Details</a> | <a href="logout">Logout</a>
  ''')%locals()
          else:
--- 1019,1026 ----
          if self.user not in (None, 'anonymous'):
              userid = self.db.user.lookup(self.user)
              user_info = _('''
! <a href="issue?assignedto=%(userid)s&status=-1,%(states)s&:filter=status,assignedto&:sort=-activity&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">My Issues</a> |
! <a href="support?assignedto=%(userid)s&status=-1,%(states)s&:filter=status,assignedto&:sort=-activity&:columns=id,activity,status,title,assignedto&:group=customername&show_customization=1">My Support</a> |
  <a href="user%(userid)s">My Details</a> | <a href="logout">Logout</a>
  ''')%locals()
          else:
***************
*** 1090,1100 ****
  <td align=right valign=bottom>%(user_name)s</td></tr>
  <tr class="location-bar">
  <td align=left>All
! <a href="issue?status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=activity&:filter=status&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>,
! <a href="support?status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=activity&:filter=status&:columns=id,activity,status,title,assignedto&:group=customername&show_customization=1">Support</a>
  | Unassigned
! <a href="issue?assignedto=-1&status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=-activity&:filter=status,assignedto&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>,
! <a href="support?assignedto=-1&status=-1,unread,deferred,chatting,need-eg,in-progress,testing,done-cbb&:sort=-activity&:filter=status,assignedto&:columns=id,activity,status,title,assignedto&:group=customername&show_customization=1">Support</a>
  %(add_links)s
  %(admin_links)s</td>
  <td align=right>%(user_info)s</td>
--- 1044,1054 ----
  <td align=right valign=bottom>%(user_name)s</td></tr>
  <tr class="location-bar">
  <td align=left>All
! <a href="issue?status=-1,%(states)s&:sort=activity&:filter=status&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>,
! <a href="support?status=-1,%(states)s&:sort=activity&:filter=status&:columns=id,activity,status,title,assignedto&:group=customername&show_customization=1">Support</a>
  | Unassigned
! <a href="issue?assignedto=-1&status=-1,%(states)s&:sort=-activity&:filter=status,assignedto&:columns=id,activity,status,title,assignedto&:group=priority&show_customization=1">Issues</a>,
! <a href="support?assignedto=-1&status=-1,%(states)s&:sort=-activity&:filter=status,assignedto&:columns=id,activity,status,title,assignedto&:group=customername&show_customization=1">Support</a>
  %(add_links)s
  %(admin_links)s</td>
  <td align=right>%(user_info)s</td>

 	  	 
