Commits

seccanj  committed b1cbbf5

Release 1.3.11. Enhancement #8007: Added out of the box operation to workflow engine; Enhancement #8259: Add navigation from a test case to its related tickets

  • Participants
  • Parent commits 7749e40

Comments (0)

Files changed (14)

 
 (Refer to the tickets on trac-hacks or SourceForge for complete descriptions.)
 
+Release 1.3.11 (2010-12-02):
+  o Added out of the box operation to workflow engine: set_owner and set_owner_to_self
+  o Enhancement #8259 (Track-Hacks): Add navigation from a test case to its related tickets
+
 Release 1.3.10 (2010-11-28):
   o Fixed Ticket #8154 (Track-Hacks): LookupError: unknown encoding: cp0
 

File testman4trac/trunk/setup.py

 
 setup(
     name='TestManager',
-    version='1.3.10',
+    version='1.3.11',
     packages=['testmanager'],
     package_data={'testmanager' : ['*.txt', 'templates/*.html', 'htdocs/js/*.js', 'htdocs/css/*.css', 'htdocs/images/*.*']},
     author = 'Roberto Longobardi',

File testman4trac/trunk/testmanager/README.txt

 
 (Refer to the tickets on trac-hacks or SourceForge for complete descriptions.)
 
+Release 1.3.11 (2010-12-02):
+  o Added out of the box operation to workflow engine: set_owner and set_owner_to_self
+  o Enhancement #8259 (Track-Hacks): Add navigation from a test case to its related tickets
+
 Release 1.3.10 (2010-11-28):
   o Fixed Ticket #8154 (Track-Hacks): LookupError: unknown encoding: cp0
 

File testman4trac/trunk/testmanager/htdocs/js/testmanager.js

 	window.location = url;
 }
 
+function showTickets(tcName, planId, planName){ 
+	var url = baseLocation+'/query?description=~'+tcName+'?planId='+planId; 
+	window.location = url;
+}
+
 function duplicateTestCatalog(catName){
     if (confirm(messages['duplicate_catalog_confirm'])) {
         var url = baseLocation+'/testcreate?type=catalog&duplicate=true&path='+catName; 
 /******************************************************/
 
 function expandCollapseSection(nodeId) {
-    toggleClass(nodeId, "collapsed");
+    $(nodeId).toggleClass("collapsed");
 }
 
 function stripSpecialChars(str) {

File testman4trac/trunk/testmanager/labels.py

     'description_header': "Description",
     'last_change_header': "Last Change",
     'delete': "Delete",
-    'duplicate_catalog': "Duplicate the Catalog"
+    'duplicate_catalog': "Duplicate the Catalog",
+    'show_tickets_button': "Show Related Tickets"
 }

File testman4trac/trunk/testmanager/labels_en.py

     'description_header': "Description",
     'last_change_header': "Last Change",
     'delete': "Delete",
-    'duplicate_catalog': "Duplicate the Catalog"
+    'duplicate_catalog': "Duplicate the Catalog",
+    'show_tickets_button': "Show Related Tickets"
 }

File testman4trac/trunk/testmanager/labels_it.py

     'description_header': "Descrizione",
     'last_change_header': "Ultima Modifica",
     'delete': "Elimina",
-    'duplicate_catalog': "Duplica il Catalogo"
+    'duplicate_catalog': "Duplica il Catalogo",
+    'show_tickets_button': "Mostra i Tickets Correlati"
 }

File testman4trac/trunk/testmanager/wiki.py

                     tag.script('var baseLocation="'+req.href()+'";', type='text/javascript'),
                     tag.input(type='button', value=LABELS['open_ticket_button'], onclick='creaTicket("'+tc_name+'", "", "")'),
                     HTML('  '), 
+                    tag.input(type='button', value=LABELS['show_tickets_button'], onclick='showTickets("'+tc_name+'", "", "")'),
+                    HTML('  '), 
                     tag.input(type='button', id='moveTCButton', value=LABELS['move_tc_button'], onclick='copyTestCaseToClipboard("'+tc_name+'")'),
                     HTML('  '), 
                     tag.input(type='button', id='duplicateTCButton', value=LABELS['duplicate_tc_button'], onclick='duplicateTestCase("'+tc_name+'", "'+cat_name+'")'),
                     tag.br(), tag.br(),
                     tag.input(type='button', value=LABELS['open_ticket_button'], onclick='creaTicket("'+tc_name+'", "'+planid+'", "'+plan_name+'")'),
                     HTML('  '), 
+                    tag.input(type='button', value=LABELS['show_tickets_button'], onclick='showTickets("'+tc_name+'", "'+planid+'", "'+plan_name+'")'),
+                    HTML('  '), 
                     tag.br(), tag.br(), 
                     self._get_testcase_status_history_markup(formatter, has_status, page_name, planid),
                     tag.br(), tag.br()

File tracgenericclass/trunk/tracgenericclass/model.py

         return False
     except:
         db.rollback()
-        print("Need to create db tables for class '%s'." % realm)
+        env.log.debug("Need to create db tables for class '%s'." % realm)
         return True
 
         

File tracgenericworkflow/trunk/setup.py

 
 setup(
     name='TracGenericWorkflow',
-    version='1.0.1',
+    version='1.0.2',
     packages=['tracgenericworkflow'],
     package_data={'tracgenericworkflow' : ['*.txt', 'templates/*.html', 'htdocs/*.*', 'htdocs/js/*.js', 'htdocs/css/*.css', 'htdocs/images/*.*']},
     author = 'Roberto Longobardi',

File tracgenericworkflow/trunk/tracgenericworkflow/README.txt

 
 (Refer to the tickets on trac-hacks for complete descriptions.)
 
+Release 1.0.2 (2010-11-30):
+  o Added out of the box operation to workflow engine: set_owner and set_owner_to_self
+
 Release 1.0.0 (2010-10-01):
   o First release publicly available apart from the core Test Manager plugin
   

File tracgenericworkflow/trunk/tracgenericworkflow/api.py

         hints = []
         
         for operation in operations:
-            print (">>>>>>>>>>>>>>> "+operation)
+            self.env.log.debug(">>>>>>>>>>>>>>> "+operation)
             provider = self.get_operation_provider(operation)
-            print (provider)
+            self.env.log.debug (provider)
             
             if provider is not None:
                 control, hint = provider.get_operation_control(req, action, operation, rws, resource)
         
         if 'leave_status' not in operations:
             if status != '*':
-                hints.append(_("Next status will be '%(name)s'", name=status))
+                hints.append(_(" Next status will be '%(name)s'", name=status))
 
         return (this_action['name'], tag(*controls), '. '.join(hints))
 

File tracgenericworkflow/trunk/tracgenericworkflow/model.py

             
     # IConcreteClassProvider methods
     def get_realms(self):
-            yield 'resourceworkflowstate'
+        yield 'resourceworkflowstate'
 
     def get_data_models(self):
         return self.SCHEMA

File tracgenericworkflow/trunk/tracgenericworkflow/operations.py

 from trac.core import *
+from trac.perm import PermissionSystem
 from trac.resource import Resource
 from trac.util.datefmt import utc
 from trac.util.translation import _, N_, gettext
+from trac.web.chrome import Chrome
 
 from genshi.builder import tag
 from genshi.filters.transform import Transformer
         # A custom field named "owner" is required in the ResourceWorkflowState 
         # class for this operation to be available
         
-        print (res_wf_state.fields)
+        self.env.log.debug(res_wf_state.fields)
         
-        if operation == 'set_owner' and 'owner' in res_wf_state.fields:
+        if operation == 'set_owner' and self._has_field_named('owner', res_wf_state.fields):
             self.log.debug("Creating control for setting owner.")
 
             current_owner = res_wf_state['owner'] or '(none)'
             control = None
             hint = ''
 
-            if self.config.getbool(resource.realm, 'set_owners'):
-                target_owners = self.config.getstring(resource.realm, 'restrict_to_permission')
+            owners = None
+
+            available_owners = self.config.get(resource.realm, 'available_owners')
+            if available_owners is not None and not available_owners == '':
                 owners = [x.strip() for x in
-                          target_owners.split(',')]
+                          available_owners.split(',')]
             elif self.config.getbool(resource.realm, 'restrict_owner'):
-                target_permission = self.config.getstring(resource.realm, 'restrict_to_permission')
-                perm = PermissionSystem(self.env)
-                owners = perm.get_users_with_permission(target_permission)
-                owners.sort()
-            else:
-                owners = None
+                target_permission = self.config.get(resource.realm, 'restrict_owner_to_permission')
+                if target_permission is not None and not target_permission == '':
+                    perm = PermissionSystem(self.env)
+                    owners = perm.get_users_with_permission(target_permission)
+                    owners.sort()
 
             if owners == None:
                 owner = req.args.get(id, req.authname)
-                control = tag_('to %(owner)s',
-                                    owner=tag.input(type='text', id=id,
+                control = tag('Assign to ',
+                                    tag.input(type='text', id=id,
                                                     name=id, value=owner))
-                hint = _("The owner will be changed from "
-                               "%(current_owner)s",
-                               current_owner=current_owner)
+                hint = "The owner will be changed from %s" % current_owner
             elif len(owners) == 1:
                 owner = tag.input(type='hidden', id=id, name=id,
                                   value=owners[0])
                 formatted_owner = format_user(owners[0])
-                control = tag_('to %(owner)s ',
-                                    owner=tag(formatted_owner, owner))
+                control = tag('Assign to ',
+                                    tag(formatted_owner, owner))
                 if res_wf_state['owner'] != owners[0]:
-                    hint = _("The owner will be changed from "
-                                   "%(current_owner)s to %(selected_owner)s",
-                                   current_owner=current_owner,
-                                   selected_owner=formatted_owner)
+                    hint = "The owner will be changed from %s to %s" % (current_owner, formatted_owner)
             else:
-                control = tag_('to %(owner)s', owner=tag.select(
+                control = tag('Assign to ', tag.select(
                     [tag.option(format_user(x), value=x,
                                 selected=(x == selected_owner or None))
                      for x in owners],
                     id=id, name=id))
-                hint = _("The owner will be changed from "
-                               "%(current_owner)s",
-                               current_owner=current_owner)
+                hint = "The owner will be changed from %s" % current_owner
 
             return control, hint
 
-        elif operation == 'set_owner_to_self' and 'owner' in res_wf_state.fields and \
+        elif operation == 'set_owner_to_self' and self._has_field_named('owner', res_wf_state.fields) and \
                 res_wf_state['owner'] != req.authname:
-            hint = _("The owner will be changed from %(current_owner)s "
-                           "to %(authname)s", current_owner=current_owner,
-                           authname=req.authname)
+                    
+            current_owner = res_wf_state['owner'] or '(none)'
+            if not (Chrome(self.env).show_email_addresses
+                    or 'EMAIL_VIEW' in req.perm(resource)):
+                format_user = obfuscate_email_address
+            else:
+                format_user = lambda address: address
+            current_owner = format_user(current_owner)
+                    
+            control = tag('')
+            hint = "The owner will be changed from %s to %s" % (current_owner, req.authname)
 
             self.log.debug("<<< WorkflowStandardOperations - get_operation_control - set_owner_to_self")
             
-            return None, hint
+            return control, hint
 
         elif operation == 'std_notify':
             pass
                 new_owner = req.args.get('action_%s_operation_%s' % (action, operation), None)
 
             if new_owner is not None and len(new_owner.strip()) > 0:
-                res_wf_state['owner'] = newowner.strip()
+                res_wf_state['owner'] = new_owner.strip()
+                #res_wf_state.save_changes()
             else:
                 self.log.debug("Unable to get the new owner!") 
 
         elif operation == 'set_owner_to_self':
             res_wf_state['owner'] = req.authname.strip()
 
+    def _has_field_named(self, field_name, fields):
+        for f in fields:
+            if 'name' in f and f['name'] == field_name:
+                return True
+                
+        return False
+