Project

General

Profile

Feature #8559 » total-estimate.js

Bevan Rudge, 2011-06-07 23:37

 
1
// Load an external JS script
2
function loadjsfile(filename){
3
 var fileref=document.createElement('script')
4
 fileref.setAttribute("type","text/javascript")
5
 fileref.setAttribute("src", filename)
6
 if (typeof fileref!="undefined") {
7
   document.getElementsByTagName("head")[0].appendChild(fileref)
8
 }
9
}
10

    
11
loadjsfile("http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js");
12

    
13
(function ($) {
14
 var total_hours = 0;
15
 $('table.list.issues td.estimated_hours').each(function () {
16
   var hours = parseFloat($(this).html());
17
   if ( hours != 0 && hours) {
18
     total_hours += hours;
19
   }
20
 });
21

    
22
 /**
23
   This could handle building out a percentage complete but requires calculating
24
   against the estimated time for this task
25
 var percent_complete = 0;
26
 var total_rows = 0;
27
 $('table.list.issues td.done_ratio table.progress td.closed').each(function () {
28
   total_rows += 100;
29
   var estimated = parseFloat($(this).css('width'));
30
   if ( estimated != 0 && estimated) {
31
     percent_complete += estimated;
32
   }
33
 });
34
 */
35

    
36
 $("table.list.issues tr.group.open td").each(function () {
37
   $(this).attr('colspan', 6);
38
   $(this).after('<td></td><td>' + total_hours + ' hours scheduled</td>');
39
 });
40

    
41
})(jQuery);
(2-2/2)