Changeset 3814
- Timestamp:
- 06/10/08 09:38:16 (7 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ticketmodifiedfilesplugin/0.11/setup.py
r3813 r3814 4 4 name='TicketModifiedFiles', 5 5 description='Trac plugin that lists the files that have been modified while resolving a ticket', 6 version='0. 2',6 version='0.3', 7 7 license='BSD', 8 8 author='Emilien Klein', ticketmodifiedfilesplugin/0.11/ticketmodifiedfiles/templates/ticketmodifiedfiles.html
r3805 r3814 55 55 <py:when test="len(files) > 0 or len(deletedfiles) > 0"> 56 56 <py:choose> 57 <py:when test="len(conflictingtickets) > 0"> 58 <h3><span style="text-decoration: underline;">WARNING:</span> ${len(conflictingtickets)} conflicting ticket<py:choose><py:when test="len(conflictingtickets) > 1">s</py:when></py:choose> <py:choose><py:when test="len(conflictingtickets) > 1">have</py:when><py:otherwise>has</py:otherwise></py:choose> been detected:</h3> 59 <ul> 60 <li py:for="relticketid, relticketdesc, relticketstatus, relticketowner in conflictingtickets"> 61 <a href="${href.ticket(relticketid)}">#${relticketid}</a> (${relticketdesc}, <span style="text-decoration: underline;">status:</span> ${relticketstatus}, <span style="text-decoration: underline;">owner:</span> ${relticketowner}) 62 </li> 63 </ul> 57 <py:when test="ticketisclosed == False"> 58 <py:choose> 59 <py:when test="len(conflictingtickets) > 0"> 60 <h3><span style="text-decoration: underline;">WARNING:</span> ${len(conflictingtickets)} conflicting ticket<py:choose><py:when test="len(conflictingtickets) > 1">s</py:when></py:choose> <py:choose><py:when test="len(conflictingtickets) > 1">have</py:when><py:otherwise>has</py:otherwise></py:choose> been detected:</h3> 61 <ul> 62 <li py:for="relticketid, relticketdesc, relticketstatus, relticketowner in conflictingtickets"> 63 <a href="${href.ticket(relticketid)}">#${relticketid}</a> (${relticketdesc}, <span style="text-decoration: underline;">status:</span> ${relticketstatus}, <span style="text-decoration: underline;">owner:</span> ${relticketowner}) 64 </li> 65 </ul> 66 </py:when> 67 <py:otherwise> 68 <h3>No conflicting ticket has been detected.</h3> 69 </py:otherwise> 70 </py:choose> 64 71 </py:when> 65 72 <py:otherwise> 66 <h3> No conflicting ticket has been detected.</h3>73 <h3>Conflicting tickets are not detected for closed tickets.</h3> 67 74 </py:otherwise> 68 75 </py:choose> ticketmodifiedfilesplugin/0.11/ticketmodifiedfiles/ticketmodifiedfiles.py
r3812 r3814 28 28 29 29 def process_request(self, req): 30 (id, files, deletedfiles, ticketsperfile, filestatus, conflictingtickets ) = self.__process_ticket_request(req)30 (id, files, deletedfiles, ticketsperfile, filestatus, conflictingtickets, ticketisclosed) = self.__process_ticket_request(req) 31 31 #Pack the information to send it to the html file 32 data = {'ticketid':id, 'files':files, 'deletedfiles':deletedfiles, 'ticketsperfile':ticketsperfile, 'filestatus':filestatus, 'conflictingtickets':conflictingtickets }32 data = {'ticketid':id, 'files':files, 'deletedfiles':deletedfiles, 'ticketsperfile':ticketsperfile, 'filestatus':filestatus, 'conflictingtickets':conflictingtickets, 'ticketisclosed':ticketisclosed} 33 33 add_stylesheet(req, 'tmf/css/ticketmodifiedfiles.css') 34 34 return 'ticketmodifiedfiles.html', data, None … … 67 67 def filter_stream(self, req, method, filename, stream, data): 68 68 if 'modifiedfiles' in data: 69 numconflictingtickets = self.__process_ticket_request(req, True)70 69 #If there are conflicting tickets, display a warning message 71 if numconflictingtickets > 0: 72 text = " There " 73 if numconflictingtickets == 1: text += "is one ticket that is" 74 else: text += "are " + str(numconflictingtickets) + " tickets that are" 75 text += " in conflict with this one!" 76 stream |= Transformer("//div[@id='content']/div[@id='changelog']").before(tag.p(tag.strong("Warning:"), text, style='background: #def; border: 2px solid #00d; padding: 3px;')) 70 #Only show the message when the current ticket is not closed 71 db = self.env.get_db_cnx() 72 cursor = db.cursor() 73 cursor.execute("SELECT status FROM ticket WHERE id=" + str(req.args.get('id'))) 74 for status, in cursor: 75 if status != "closed": 76 numconflictingtickets = self.__process_ticket_request(req, True) 77 if numconflictingtickets > 0: 78 text = " There " 79 if numconflictingtickets == 1: text += "is one ticket that is" 80 else: text += "are " + str(numconflictingtickets) + " tickets that are" 81 text += " in conflict with this one!" 82 stream |= Transformer("//div[@id='content']/div[@id='changelog']").before(tag.p(tag.strong("Warning:"), text, style='background: #def; border: 2px solid #00d; padding: 3px;')) 77 83 78 84 #Display the link to this ticket's modifiedfiles page … … 154 160 155 161 #Get the global list of conflicting tickets 162 #Only if the ticket is not already closed 156 163 conflictingtickets=[] 157 for fn, relticketids in ticketsperfile.items(): 158 for relticketid in relticketids: 159 cursor.execute("SELECT summary, status, owner FROM ticket WHERE id=" + str(relticketid)) 160 for summary, status, owner, in cursor: 161 conflictingtickets.append((relticketid, summary, status, owner)) 164 cursor.execute("SELECT status FROM ticket WHERE id=" + str(req.args.get('id'))) 165 for status, in cursor: 166 if status != "closed": 167 ticketisclosed = False 168 for fn, relticketids in ticketsperfile.items(): 169 for relticketid in relticketids: 170 cursor.execute("SELECT summary, status, owner FROM ticket WHERE id=" + str(relticketid)) 171 for summary, status, owner, in cursor: 172 conflictingtickets.append((relticketid, summary, status, owner)) 162 173 163 #Remove duplicated values 164 conflictingtickets = self.__remove_duplicated_elements_and_sort(conflictingtickets) 174 #Remove duplicated values 175 conflictingtickets = self.__remove_duplicated_elements_and_sort(conflictingtickets) 176 else: 177 ticketisclosed = True 165 178 166 179 #Separate the deleted files from the others … … 171 184 for deletedfile in deletedfiles: 172 185 files.remove(deletedfile) 186 187 #Return only the number of conflicting tickets (if asked for) 173 188 if justnumconflictingtickets: 174 189 return len(conflictingtickets) 175 return (id, files, deletedfiles, ticketsperfile, filestatus, conflictingtickets) 190 191 #Return all the needed information 192 return (id, files, deletedfiles, ticketsperfile, filestatus, conflictingtickets, ticketisclosed) 176 193 177 194 def __remove_duplicated_elements_and_sort(self, list):
