Changeset 2460
- Timestamp:
- 07/12/07 10:25:15 (1 year ago)
- Files:
-
- timingandestimationplugin/branches/trac0.10/setup.py (modified) (2 diffs)
- timingandestimationplugin/branches/trac0.10/timingandestimationplugin/htdocs/ticket.js (added)
- timingandestimationplugin/branches/trac0.10/timingandestimationplugin/migrate (deleted)
- timingandestimationplugin/branches/trac0.10/timingandestimationplugin/reports.py (modified) (9 diffs)
- timingandestimationplugin/branches/trac0.10/timingandestimationplugin/ticket_webui.py (modified) (1 diff)
- timingandestimationplugin/branches/trac0.11/setup.py (modified) (2 diffs)
- timingandestimationplugin/branches/trac0.11/timingandestimationplugin/htdocs/ticket.js (modified) (1 diff)
- timingandestimationplugin/branches/trac0.11/timingandestimationplugin/migrate (deleted)
- timingandestimationplugin/branches/trac0.11/timingandestimationplugin/reports.py (modified) (9 diffs)
- timingandestimationplugin/branches/trac0.11/timingandestimationplugin/ticket_webui.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
timingandestimationplugin/branches/trac0.10/setup.py
r2390 r2460 8 8 description='Plugin to make Trac support time estimation and tracking', 9 9 keywords='trac plugin estimation timetracking', 10 version='0.4. 5',10 version='0.4.6', 11 11 url='http://www.trac-hacks.org/wiki/TimingAndEstimationPlugin', 12 12 license='http://www.opensource.org/licenses/mit-license.php', … … 47 47 ## trac-hacks user: coling 48 48 ## Refactored the custom reports code to make it 49 ## easy for other plugins to provide reports to 50 ## compliment those provided by default 49 ## easy for other plugins to provide reports to 50 ## compliment those provided by default 51 ## Added Javascript that improves Ticket UI 51 52 timingandestimationplugin/branches/trac0.10/timingandestimationplugin/reports.py
r2390 r2460 9 9 "uuid":"b24f08c0-d41f-4c63-93a5-25e18a8513c2", 10 10 "title":"Ticket Work Summary", 11 "reportnumber":None,12 11 "version":14, 13 12 "sql":""" … … 51 50 "uuid":"af13564f-0e36-4a17-96c0-632dc68d8d14", 52 51 "title":"Milestone Work Summary", 53 "reportnumber":None,54 52 "version":13, 55 53 "sql":""" … … 99 97 "uuid":"7bd4b0ce-da6d-4b11-8be3-07e65b540d99", 100 98 "title":"Developer Work Summary", 101 "reportnumber":None,102 99 "version":13, 103 100 "sql":""" … … 141 138 "uuid":"8d785cdb-dcf5-43c9-b2a6-216997b0011a", 142 139 "title": "Ticket Hours", 143 "reportnumber": None,144 140 "version":10, 145 141 "sql": """ … … 211 207 "uuid":"71e7c36d-e512-4d0b-b499-087d4d20ff0b", 212 208 "title": "Ticket Hours with Description", 213 "reportnumber": None,214 209 "version":11, 215 210 "sql": """ … … 290 285 "uuid":"5f33b102-e6a6-47e8-976c-ac7a6794a909", 291 286 "title":"Ticket Hours Grouped By Component", 292 "reportnumber":None,293 287 "version":10, 294 288 "sql": """ … … 371 365 "uuid":"7816f034-a174-4a94-aed6-358fb648b2fc", 372 366 "title":"Ticket Hours Grouped By Component with Description", 373 "reportnumber":None,374 367 "version":9, 375 368 "sql": """ … … 447 440 "uuid":"03815803-7688-4f3a-8e65-8d254cc1d1fb", 448 441 "title":"Ticket Hours Grouped By Milestone", 449 "reportnumber":None,450 442 "version":10, 451 443 "sql": """ … … 524 516 "uuid":"040c9025-7641-4d18-96ad-2b26b4095566", 525 517 "title":"Ticket Hours Grouped By MileStone with Description", 526 "reportnumber":None,527 518 "version":10, 528 519 "sql": """ timingandestimationplugin/branches/trac0.10/timingandestimationplugin/ticket_webui.py
r1710 r2460 24 24 def get_navigation_items(self, req): 25 25 if re.search('ticket', req.path_info): 26 yield 'mainnav', "ticket-addon", \ 27 Markup("""<script language="javascript" type="text/javascript"> 28 function AddEventListener( elem, evt, func, capture){ 29 capture = capture || false; 30 if(elem.addEventListener) elem.addEventListener( evt, func, capture); 31 else elem.attachEvent('on'+evt, func); 32 return func; 33 }; 34 InitBilling = function(){ 35 var x = document.getElementById('totalhours'); 36 x = x || document.getElementById('field-totalhours'); 37 if(x){ 38 var p = x.parentNode; 39 var n = document.createElement('span') 40 n.id = x.id; 41 n.innerHTML = x.value 42 p.removeChild(x); 43 p.appendChild(n); 44 } 45 } 46 AddEventListener(window, 'load', InitBilling) 47 </script>""") 26 add_script(req, 'Billing/ticket.js') 27 yield 'mainnav', "ticket-addon", "" timingandestimationplugin/branches/trac0.11/setup.py
r2390 r2460 8 8 description='Plugin to make Trac support time estimation and tracking', 9 9 keywords='trac plugin estimation timetracking', 10 version='0.4. 5',11 url='http:// trac-hacks.org/wiki/TimingAndEstimationPlugin',10 version='0.4.6', 11 url='http://www.trac-hacks.org/wiki/TimingAndEstimationPlugin', 12 12 license='http://www.opensource.org/licenses/mit-license.php', 13 13 author='Russ Tyndall at Acceleration.net', … … 47 47 ## trac-hacks user: coling 48 48 ## Refactored the custom reports code to make it 49 ## easy for other plugins to provide reports to 50 ## compliment those provided by default 49 ## easy for other plugins to provide reports to 50 ## compliment those provided by default 51 ## Added Javascript that improves Ticket UI 51 52 timingandestimationplugin/branches/trac0.11/timingandestimationplugin/htdocs/ticket.js
r2298 r2460 1 1 (function(){ 2 function AddEventListener( elem, evt, func, capture){ 2 function teAddEventListener(elem, evt, func, capture) 3 { 3 4 capture = capture || false; 4 if (elem.addEventListener) elem.addEventListener(evt, func, capture);5 if (elem.addEventListener) elem.addEventListener(evt, func, capture); 5 6 else elem.attachEvent('on'+evt, func); 6 7 return func; 7 }; 8 } 9 10 // Function from: http://www.robertnyman.com/index.php?p=256 11 function getElementsByClassName(className, tag, elm) 12 { 13 var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)"); 14 var tag = tag || "*"; 15 var elm = elm || document; 16 var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag); 17 var returnElements = []; 18 var current; 19 var length = elements.length; 20 for (var i=0; i<length; i++) 21 { 22 current = elements[i]; 23 if(testClass.test(current.className)) 24 { 25 returnElements.push(current); 26 } 27 } 28 return returnElements; 29 } 30 31 32 function FloatToHoursMins(hours) 33 { 34 if (0 == hours) return hours; 35 mins = Math.floor((hours - Math.floor(hours)) * 60); 36 str = ''; 37 if (hours) str += Math.floor(hours) + 'h'; 38 if (mins) 39 { 40 if (str) str += ' '; 41 str += mins + 'm'; 42 } 43 return str; 44 } 45 46 function IntToYesNo(boolflag) 47 { 48 if (boolflag == '1') 49 return 'Yes'; 50 51 if (boolflag == '0') 52 return 'No'; 53 54 return boolflag; 55 } 56 57 8 58 InitBilling = function(){ 9 var x = document.getElementById('totalhours'); 10 x = x || document.getElementById('field-totalhours'); 11 if(x){ 12 var p = x.parentNode; 13 var n = document.createElement('span'); 14 n.id = x.id; 15 n.innerHTML = x.value; 16 p.removeChild(x); 17 p.appendChild(n); 59 // Convert totalhours field to non-editable 60 try 61 { 62 var x = document.getElementById('totalhours'); 63 x = x || document.getElementById('field-totalhours'); 64 if (x) 65 { 66 var p = x.parentNode; 67 var n = document.createElement('span') 68 n.id = x.id; 69 n.appendChild(document.createTextNode(x.value)); 70 p.removeChild(x); 71 p.appendChild(n); 72 } 18 73 } 74 catch (er) {} 75 76 // Display yes/no in the summary 77 // if we fail, then no harm done. 78 try 79 { 80 var b = document.getElementById('h_billable'); 81 while (b) 82 { 83 if (!b.nextSibling) break; 84 b = b.nextSibling; 85 if (b.nodeName == 'TD') 86 { 87 b.innerHTML = IntToYesNo(b.innerHTML); 88 break; 89 } 90 } 91 } 92 catch (er) {} 93 94 95 // Hide the Add Hours in the title table 96 // if we fail, then no harm done. 97 try 98 { 99 var b = document.getElementById('h_hours'); 100 b.firstChild.nodeValue = ''; 101 b.nextSibling.nextSibling.firstChild.nodeValue = ''; 102 } 103 catch (er) {} 104 105 106 // Convert hours from float to hours minutes seconds 107 // if we fail, then no harm done. 108 try 109 { 110 fields = Array('estimatedhours', 'totalhours'); 111 for (i=0; i < 2; ++i) 112 { 113 var b = document.getElementById('h_' + fields[i]); 114 while (b) 115 { 116 if (!b.nextSibling) break; 117 b = b.nextSibling; 118 if (b.nodeName == 'TD') 119 { 120 b.innerHTML = FloatToHoursMins(b.innerHTML); 121 break; 122 } 123 } 124 } 125 } 126 catch (er) {} 127 128 // Convert all relevent ticket changes to hours/minutes 129 // if we fail, then no harm done. 130 try 131 { 132 changes = getElementsByClassName('changes', 'ul', document.getElementById('changelog')); 133 for (i=0; i < changes.length; ++i) 134 { 135 change = changes[i]; 136 for (j=0; j < change.childNodes.length; ++j) 137 { 138 li = change.childNodes[j]; 139 if (li.nodeName != 'LI') continue; 140 // We look for a STRONG childNode 141 if (!li.firstChild 142 || li.firstChild.nodeName != 'STRONG' 143 || !li.firstChild.firstChild 144 || li.firstChild.firstChild.nodeName != '#text') 145 { 146 continue; 147 } 148 149 field = li.firstChild.firstChild.nodeValue; 150 if (field == 'billable') 151 { 152 for (k=1; k < li.childNodes.length; ++k) 153 { 154 if (li.childNodes[k].nodeName != 'EM' 155 || !li.childNodes[k].firstChild 156 || li.childNodes[k].firstChild.nodeName != '#text') 157 { 158 continue; 159 } 160 li.childNodes[k].firstChild.nodeValue = IntToYesNo(li.childNodes[k].firstChild.nodeValue); 161 } 162 } 163 else if (field == 'hours' 164 || field == 'estimatedhours' 165 || field == 'totalhours') 166 { 167 for (k=1; k < li.childNodes.length; ++k) 168 { 169 if (li.childNodes[k].nodeName != 'EM' 170 || !li.childNodes[k].firstChild 171 || li.childNodes[k].firstChild.nodeName != '#text') 172 { 173 continue; 174 } 175 li.childNodes[k].firstChild.nodeValue = FloatToHoursMins(li.childNodes[k].firstChild.nodeValue); 176 } 177 } 178 } 179 } 180 } 181 catch (er) {} 19 182 } 20 AddEventListener(window, 'load', InitBilling) 183 184 teAddEventListener(window, 'load', InitBilling) 21 185 })() 186 timingandestimationplugin/branches/trac0.11/timingandestimationplugin/reports.py
r2390 r2460 9 9 "uuid":"b24f08c0-d41f-4c63-93a5-25e18a8513c2", 10 10 "title":"Ticket Work Summary", 11 "reportnumber":None,12 11 "version":14, 13 12 "sql":""" … … 51 50 "uuid":"af13564f-0e36-4a17-96c0-632dc68d8d14", 52 51 "title":"Milestone Work Summary", 53 "reportnumber":None,54 52 "version":13, 55 53 "sql":""" … … 99 97 "uuid":"7bd4b0ce-da6d-4b11-8be3-07e65b540d99", 100 98 "title":"Developer Work Summary", 101 "reportnumber":None,102 99 "version":13, 103 100 "sql":""" … … 141 138 "uuid":"8d785cdb-dcf5-43c9-b2a6-216997b0011a", 142 139 "title": "Ticket Hours", 143 "reportnumber": None,144 140 "version":10, 145 141 "sql": """ … … 211 207 "uuid":"71e7c36d-e512-4d0b-b499-087d4d20ff0b", 212 208 "title": "Ticket Hours with Description", 213 "reportnumber": None,214 209 "version":11, 215 210 "sql": """ … … 290 285 "uuid":"5f33b102-e6a6-47e8-976c-ac7a6794a909", 291 286 "title":"Ticket Hours Grouped By Component", 292 "reportnumber":None,293 287 "version":10, 294 288 "sql": """ … … 371 365 "uuid":"7816f034-a174-4a94-aed6-358fb648b2fc", 372 366 "title":"Ticket Hours Grouped By Component with Description", 373 "reportnumber":None,374 367 "version":9, 375 368 "sql": """ … … 447 440 "uuid":"03815803-7688-4f3a-8e65-8d254cc1d1fb", 448 441 "title":"Ticket Hours Grouped By Milestone", 449 "reportnumber":None,450 442 "version":10, 451 443 "sql": """ … … 524 516 "uuid":"040c9025-7641-4d18-96ad-2b26b4095566", 525 517 "title":"Ticket Hours Grouped By MileStone with Description", 526 "reportnumber":None,527 518 "version":10, 528 519 "sql": """ timingandestimationplugin/branches/trac0.11/timingandestimationplugin/ticket_webui.py
r2298 r2460 23 23 24 24 def get_navigation_items(self, req): 25 src = req.href.chrome("Billing/ticket.js")26 25 if re.search('ticket', req.path_info): 27 yield 'mainnav', "ticket-addon", \28 Markup("""<script language="javascript" type="text/javascript" src="%s"></script>"""%src)26 add_script(req, 'Billing/ticket.js') 27 yield 'mainnav', "ticket-addon", ""