redmine-0.6.3.diff

sunday walker, 2008-02-12 13:50

Download (19.5 KB)

View differences:

app/helpers/projects_helper.rb (working copy)
148 148
    gc.stroke('transparent')
149 149
    events.each do |i|      
150 150
      if i.is_a?(Issue)       
151
        i_start_date = (i.start_date >= date_from ? i.start_date : date_from )
152
        i_end_date = (i.due_date <= date_to ? i.due_date : date_to )        
153
        i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor
151
        i_start_date = (i.total('start_date') >= date_from ? i.total('start_date') : date_from )
152
        i_end_date = (i.total('due_date') <= date_to ? i.total('due_date') : date_to )        
153
        #i_done_date = i.total('start_date') + ((i.total('due_date') - i.total('start_date')+1)*i.done_ratio/100).floor
154
        i_done_date = i.total('start_date') + i.total('actual_days')
154 155
        i_done_date = (i_done_date <= date_from ? date_from : i_done_date )
155 156
        i_done_date = (i_done_date >= date_to ? date_to : i_done_date )        
156 157
        i_late_date = [i_end_date, Date.today].min if i_start_date < Date.today
......
167 168
        gc.fill('blue')
168 169
        gc.rectangle(i_left, top, i_left + d_width, top - 6) if d_width > 0
169 170
        gc.fill('black')
170
        gc.text(i_left + i_width + 5,top + 1, "#{i.status.name} #{i.done_ratio}%")
171
        gc.text(i_left + i_width + 5,top + 1, "#{i.total('status').name} #{i.total('done_ratio')}%")
171 172
      else
172 173
        i_left = subject_width + ((i.start_date - date_from)*zoom).floor
173 174
        gc.fill('green')
app/helpers/issues_helper.rb (working copy)
27 27
    @cached_label_priority ||= l(:field_priority)
28 28
    
29 29
    link_to_issue(issue) + ": #{h(issue.subject)}<br /><br />" +
30
      "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.start_date)}<br />" +
31
      "<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.due_date)}<br />" +
30
      "<strong>#{@cached_label_start_date}</strong>: #{format_date(issue.total('start_date'))}<br />" +
31
      "<strong>#{@cached_label_due_date}</strong>: #{format_date(issue.total('due_date'))}<br />" +
32 32
      "<strong>#{@cached_label_assigned_to}</strong>: #{issue.assigned_to}<br />" +
33
      "<strong>#{@cached_label_priority}</strong>: #{issue.priority.name}"
33
      "<strong>#{@cached_label_priority}</strong>: #{issue.total('priority').name}"
34 34
  end
35 35

  
36 36
  def show_detail(detail, no_html=false)
......
134 134
      # csv lines
135 135
      issues.each do |issue|
136 136
        fields = [issue.id,
137
                  issue.status.name, 
137
                  issue.total('status').name, 
138 138
                  issue.project.name,
139 139
                  issue.tracker.name, 
140
                  issue.priority.name,
140
                  issue.total('priority').name,
141 141
                  issue.subject,
142 142
                  issue.assigned_to,
143 143
                  issue.category,
144 144
                  issue.fixed_version,
145 145
                  issue.author.name,
146
                  format_date(issue.start_date),
147
                  format_date(issue.due_date),
148
                  issue.done_ratio,
146
                  format_date(issue.total('start_date')),
147
                  format_date(issue.total('due_date')),
148
                  issue.total('done_ratio'),
149 149
                  format_time(issue.created_on),  
150 150
                  format_time(issue.updated_on)
151 151
                  ]
app/helpers/queries_helper.rb (working copy)
30 30
      cv = issue.custom_values.detect {|v| v.custom_field_id == column.custom_field.id}
31 31
      show_value(cv)
32 32
    else
33
      value = issue.send(column.name)
33
#      value = issue.send(column.name)
34
      value = issue.total(column.name)
34 35
      if value.is_a?(Date)
35 36
        format_date(value)
36 37
      elsif value.is_a?(Time)
app/models/issue.rb (working copy)
215 215
    (start_date && due_date) ? due_date - start_date : 0
216 216
  end
217 217
  
218
  def duration1
219
    (start_date && due_date) ? (due_date - start_date + 1) : 0
220
  end
221
  
218 222
  def soonest_start
219 223
    @soonest_start ||= relations_to.collect{|relation| relation.successor_soonest_start}.compact.min
220 224
  end
225
  
226
  def total(filed)
227
    if filed == 'done_ratio' || filed == 'planned_days' || filed == 'actual_days'
228
      @total_planned_days ||= self.duration1
229
      @total_actual_days ||= done_ratio ?  (@total_planned_days * done_ratio / 100).floor : 0
230
      @total_done_ratio ||= done_ratio
231
    else
232
      eval("@total_#{filed} ||= #{filed}")
233
    end
234
    if filed == 'estimated_hours' || filed == 'spent_hours'
235
      type = 'sum'
236
    elsif filed == 'start_date'
237
      type = 'min'
238
    elsif filed == 'due_date'
239
      type = 'max'
240
    elsif filed == 'priority' || filed == 'fixed_version'
241
      type = 'max_id'
242
    elsif filed == 'status'
243
      type = 'min_id'
244
    elsif filed == 'done_ratio' || filed == 'planned_days' || filed == 'actual_days'
245
      type = 'done_ratio'
246
    else
247
      return(eval("@total_#{filed}"))
248
    end
249
    if !eval("@total_#{filed}") || (eval("@total_#{filed}") == 0) || (type == 'max_id') || (type == 'min_id')
250
      relations_to.each do |relation|
251
        if relation.relation_type == IssueRelation::TYPE_PARENTS
252
          othertotal = relation.other_issue(self).total(filed)
253
          if ! eval("@total_#{filed}")
254
            eval("@total_#{filed} = othertotal")
255
          elsif type == 'done_ratio' || type == 'planned_days' || type == 'actual_days'
256
            planned_days = relation.other_issue(self).total('duration1')
257
            actual_days = relation.other_issue(self).total('done_ratio') ?  (planned_days * relation.other_issue(self).total('done_ratio') / 100).floor : 0
258
            @total_planned_days += planned_days
259
            @total_actual_days += actual_days
260
            @total_done_ratio = @total_planned_days != 0 ? (@total_actual_days * 100 / @total_planned_days).floor : 0
261
          elsif type == 'max_id'
262
            if othertotal && eval("@total_#{filed}.id") < othertotal.id
263
              eval("@total_#{filed} = othertotal")
264
            end
265
          elsif type == 'min_id'
266
            if othertotal && eval("@total_#{filed}.id") > othertotal.id
267
              eval("@total_#{filed} = othertotal")
268
            end
269
          elsif type == 'sum'
270
            if othertotal
271
              eval("@total_#{filed} += othertotal")
272
            end
273
          elsif type == "max"
274
            if othertotal && eval("@total_#{filed}") < othertotal
275
              eval("@total_#{filed} = othertotal")
276
            end
277
          elsif type == 'min'
278
            if othertotal && eval("@total_#{filed}") > othertotal
279
              eval("@total_#{filed} = othertotal")
280
            end
281
          end
282
        end
283
      end
284
    end
285
    eval("@total_#{filed}")
286
  end
221 287
end
app/models/issue_relation.rb (working copy)
23 23
  TYPE_DUPLICATES   = "duplicates"
24 24
  TYPE_BLOCKS       = "blocks"
25 25
  TYPE_PRECEDES     = "precedes"
26
  TYPE_PARENTS     = "parents"
26 27
  
27 28
  TYPES = { TYPE_RELATES =>     { :name => :label_relates_to, :sym_name => :label_relates_to, :order => 1 },
28 29
            TYPE_DUPLICATES =>  { :name => :label_duplicates, :sym_name => :label_duplicates, :order => 2 },
29 30
            TYPE_BLOCKS =>      { :name => :label_blocks, :sym_name => :label_blocked_by, :order => 3 },
30 31
            TYPE_PRECEDES =>    { :name => :label_precedes, :sym_name => :label_follows, :order => 4 },
32
            TYPE_PARENTS =>    { :name => :label_parents, :sym_name => :label_children, :order => 5 },
31 33
          }.freeze
32 34
  
33 35
  validates_presence_of :issue_from, :issue_to, :relation_type
app/views/projects/gantt.rhtml (working copy)
164 164
top = headers_height + 10
165 165
@events.each do |i| 
166 166
  if i.is_a? Issue 
167
	i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
168
	i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )
167
	i_start_date = (i.total('start_date') >= @date_from ? i.total('start_date') : @date_from )
168
	i_end_date = (i.total('due_date') <= @date_to ? i.total('due_date') : @date_to )
169 169
	
170
	i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor
170
	i_done_date = i.total('start_date') + i.total('actual_days')
171 171
	i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )
172 172
	i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )
173 173
	
......
186 186
	    <div style="top:<%= top %>px;left:<%= i_left %>px;width:<%= d_width %>px;" class="task task_done">&nbsp;</div>
187 187
	<% end %>
188 188
	<div style="top:<%= top %>px;left:<%= i_left + i_width + 5 %>px;background:#fff;" class="task">
189
	<%= i.status.name %>
190
	<%= (i.done_ratio).to_i %>%
189
	<%= i.total('status').name %>
190
	<%= (i.total('done_ratio')).to_i %>%
191 191
	</div>
192 192
	<% # === tooltip === %>
193 193
	<div class="tooltip" style="position: absolute;top:<%= top %>px;left:<%= i_left %>px;width:<%= i_width %>px;height:12px;">
......
195 195
    <%= render_issue_tooltip i %>
196 196
	</span></div>
197 197
<% else 
198
    i_left = ((i.start_date - @date_from)*zoom).floor
198
    i_left = ((i.total('start_date') - @date_from)*zoom).floor
199 199
    %>
200 200
    <div style="top:<%= top %>px;left:<%= i_left %>px;width:15px;" class="task milestone">&nbsp;</div>
201 201
	<div style="top:<%= top %>px;left:<%= i_left + 12 %>px;background:#fff;" class="task">
app/views/projects/gantt.rfpdf (working copy)
123 123
	pdf.SetY(top+1.5)
124 124
	
125 125
	if i.is_a? Issue
126
		i_start_date = (i.start_date >= @date_from ? i.start_date : @date_from )
127
		i_end_date = (i.due_date <= @date_to ? i.due_date : @date_to )
126
		i_start_date = (i.total('start_date') >= @date_from ? i.total('start_date') : @date_from )
127
		i_end_date = (i.total('due_date') <= @date_to ? i.total('due_date') : @date_to )
128 128
		
129
		i_done_date = i.start_date + ((i.due_date - i.start_date+1)*i.done_ratio/100).floor
129
		i_done_date = i.total('start_date') + i.total('actual_days')
130 130
		i_done_date = (i_done_date <= @date_from ? @date_from : i_done_date )
131 131
		i_done_date = (i_done_date >= @date_to ? @date_to : i_done_date )
132 132
		
......
157 157
		
158 158
		pdf.SetY(top+1.5)
159 159
		pdf.SetX(subject_width + i_left + i_width)
160
		pdf.Cell(30, 2, "#{i.status.name} #{i.done_ratio}%")
160
		pdf.Cell(30, 2, "#{i.total('status').name} #{i.total('done_ratio')}%")
161 161
	else
162
		i_left = ((i.start_date - @date_from)*zoom) 
162
		i_left = ((i.total('start_date') - @date_from)*zoom) 
163 163
		
164 164
		pdf.SetX(subject_width + i_left)
165 165
		pdf.SetFillColor(50,200,50)
app/views/issues/_relations.rhtml (working copy)
12 12
<tr>
13 13
<td><%= l(relation.label_for(@issue)) %> <%= "(#{lwr(:actionview_datehelper_time_in_words_day, relation.delay)})" if relation.delay && relation.delay != 0 %> <%= link_to_issue relation.other_issue(@issue) %></td>
14 14
<td><%=h relation.other_issue(@issue).subject %></td>
15
<td><%= relation.other_issue(@issue).status.name %></td>
16
<td><%= format_date(relation.other_issue(@issue).start_date) %></td>
17
<td><%= format_date(relation.other_issue(@issue).due_date) %></td>
15
<td><%= relation.other_issue(@issue).total('status').name %></td>
16
<td><%= format_date(relation.other_issue(@issue).total('start_date')) %></td>
17
<td><%= format_date(relation.other_issue(@issue).total('due_date')) %></td>
18 18
<td><%= link_to_remote(image_tag('delete.png'), { :url => {:controller => 'issue_relations', :action => 'destroy', :issue_id => @issue, :id => relation},                                              
19 19
                                                  :method => :post
20 20
                                                }, :title => l(:label_relation_delete)) if authorize_for('issue_relations', 'destroy') %></td>
app/views/issues/_list.rhtml (working copy)
13 13
	</tr></thead>
14 14
	<tbody>
15 15
	<% issues.each do |issue| %>
16

  
16 17
	<tr id="issue-<%= issue.id %>" class="issue hascontextmenu <%= cycle('odd', 'even') %> <%= "status-#{issue.status.position} priority-#{issue.priority.position}" %>">
17 18
	    <td class="checkbox"><%= check_box_tag("issue_ids[]", issue.id, false, :id => "issue_#{issue.id}", :disabled => (!@project || @project != issue.project)) %></td>
18 19
		<td><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
app/views/issues/show.rhtml (working copy)
19 19

  
20 20
<table width="100%">
21 21
<tr>
22
    <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td>
23
    <td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td>
22
    <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.total('status').name %></td>
23
    <td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%= format_date(@issue.total('start_date')) %></td>
24 24
</tr>
25 25
<tr>
26
    <td><b><%=l(:field_priority)%> :</b></td><td><%= @issue.priority.name %></td>
27
    <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td>
26
    <td><b><%=l(:field_priority)%> :</b></td><td><%= @issue.total('priority').name %></td>
27
    <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.total('due_date')) %></td>
28 28
</tr>
29 29
<tr>
30 30
    <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td>
31
    <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td>
31
    <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= progress_bar @issue.total('done_ratio'), :width => '80px', :legend => "#{@issue.total('done_ratio')}%" %></td>
32 32
</tr>
33 33
<tr>
34 34
    <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td>
35 35
    <% if User.current.allowed_to?(:view_time_entries, @project) %>
36 36
    <td><b><%=l(:label_spent_time)%> :</b></td>
37
    <td><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td>
37
    <td><%= @issue.total('spent_hours') > 0 ? (link_to lwr(:label_f_hour, @issue.total('spent_hours')), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td>
38 38
    <% end %>
39 39
</tr>
40 40
<tr>
41 41
    <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td>
42
    <% if @issue.estimated_hours %>
43
    <td><b><%=l(:field_estimated_hours)%> :</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td>
42
    <% if @issue.total('estimated_hours') %>
43
    <td><b><%=l(:field_estimated_hours)%> :</b></td><td><%= lwr(:label_f_hour, @issue.total('estimated_hours')) %></td>
44 44
    <% end %>
45 45
</tr>
46 46
<tr>
app/views/issues/index.rfpdf (working copy)
38 38
	@issues.each do |issue|		
39 39
	   	pdf.Cell(15, row_height, issue.id.to_s, 0, 0, 'L', 1)
40 40
	   	pdf.Cell(30, row_height, issue.tracker.name, 0, 0, 'L', 1)
41
	   	pdf.Cell(30, row_height, issue.status.name, 0, 0, 'L', 1)
42
	   	pdf.Cell(30, row_height, issue.priority.name, 0, 0, 'L', 1)
41
	   	pdf.Cell(30, row_height, issue.total('status').name, 0, 0, 'L', 1)
42
	   	pdf.Cell(30, row_height, issue.total('priority').name, 0, 0, 'L', 1)
43 43
	   	pdf.Cell(40, row_height, issue.assigned_to ? issue.assigned_to.name : '', 0, 0, 'L', 1)
44 44
	   	pdf.Cell(25, row_height, format_date(issue.updated_on), 0, 0, 'L', 1)
45 45
	   	pdf.MultiCell(0, row_height, (@project == issue.project ? issue.subject : "#{issue.project.name} - #{issue.subject}"))
app/views/issues/_pdf.rfpdf (working copy)
7 7
    pdf.SetFontStyle('B',9)
8 8
    pdf.Cell(35,5, l(:field_status) + ":","LT")
9 9
    pdf.SetFontStyle('',9)
10
    pdf.Cell(60,5, issue.status.name,"RT")
10
    pdf.Cell(60,5, issue.total('status').name,"RT")
11 11
    pdf.SetFontStyle('B',9)
12 12
    pdf.Cell(35,5, l(:field_priority) + ":","LT")
13 13
    pdf.SetFontStyle('',9)
14
    pdf.Cell(60,5, issue.priority.name,"RT")        
14
    pdf.Cell(60,5, issue.total('priority').name,"RT")        
15 15
    pdf.Ln
16 16
    
17 17
    pdf.SetFontStyle('B',9)
......
41 41
    pdf.SetFontStyle('B',9)
42 42
    pdf.Cell(35,5, l(:field_due_date) + ":","LB")
43 43
    pdf.SetFontStyle('',9)
44
    pdf.Cell(60,5, format_date(issue.due_date),"RB")
44
    pdf.Cell(60,5, format_date(issue.total('due_date')),"RB")
45 45
    pdf.Ln
46 46
    
47 47
	for custom_value in issue.custom_values
app/views/issues/_list_simple.rhtml (working copy)
11 11
			<td class="id">
12 12
				<%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %>
13 13
			</td>
14
			<td><%=h issue.project.name %> - <%= issue.tracker.name %><br />
15
                <%= issue.status.name %> - <%= format_time(issue.updated_on) %></td>
14
			<td><%=h issue.total('project').name %> - <%= issue.tracker.name %><br />
15
                <%= issue.total('status').name %> - <%= format_time(issue.updated_on) %></td>
16 16
			<td class="subject">
17 17
                <%= link_to h(issue.subject), :controller => 'issues', :action => 'show', :id => issue %>
18 18
            </td>
lang/ja.yml (working copy)
393 393
label_blocked_by: ブロックされている
394 394
label_precedes: 先行する
395 395
label_follows: 後続する
396
label_parents: 親
397
label_children: 子
396 398
label_end_to_start: end to start
397 399
label_end_to_end: end to end
398 400
label_start_to_start: start to start
lang/en.yml (working copy)
411 411
label_blocked_by: blocked by
412 412
label_precedes: precedes
413 413
label_follows: follows
414
label_parents: parents
415
label_children: children
414 416
label_end_to_start: end to start
415 417
label_end_to_end: end to end
416 418
label_start_to_start: start to start