@@ -1,166 +1,167 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | class Query < ActiveRecord::Base |
|
18 | class Query < ActiveRecord::Base | |
19 | belongs_to :project |
|
19 | belongs_to :project | |
20 | belongs_to :user |
|
20 | belongs_to :user | |
21 | serialize :filters |
|
21 | serialize :filters | |
22 |
|
22 | |||
23 | attr_protected :project, :user |
|
23 | attr_protected :project, :user | |
24 |
|
24 | |||
25 | validates_presence_of :name, :on => :save |
|
25 | validates_presence_of :name, :on => :save | |
26 |
|
26 | |||
27 | @@operators = { "=" => :label_equals, |
|
27 | @@operators = { "=" => :label_equals, | |
28 | "!" => :label_not_equals, |
|
28 | "!" => :label_not_equals, | |
29 | "o" => :label_open_issues, |
|
29 | "o" => :label_open_issues, | |
30 | "c" => :label_closed_issues, |
|
30 | "c" => :label_closed_issues, | |
31 | "!*" => :label_none, |
|
31 | "!*" => :label_none, | |
32 | "*" => :label_all, |
|
32 | "*" => :label_all, | |
33 | "<t+" => :label_in_less_than, |
|
33 | "<t+" => :label_in_less_than, | |
34 | ">t+" => :label_in_more_than, |
|
34 | ">t+" => :label_in_more_than, | |
35 | "t+" => :label_in, |
|
35 | "t+" => :label_in, | |
36 | "t" => :label_today, |
|
36 | "t" => :label_today, | |
37 | ">t-" => :label_less_than_ago, |
|
37 | ">t-" => :label_less_than_ago, | |
38 | "<t-" => :label_more_than_ago, |
|
38 | "<t-" => :label_more_than_ago, | |
39 | "t-" => :label_ago, |
|
39 | "t-" => :label_ago, | |
40 | "~" => :label_contains, |
|
40 | "~" => :label_contains, | |
41 | "!~" => :label_not_contains } |
|
41 | "!~" => :label_not_contains } | |
42 |
|
42 | |||
43 | cattr_reader :operators |
|
43 | cattr_reader :operators | |
44 |
|
44 | |||
45 | @@operators_by_filter_type = { :list => [ "=", "!" ], |
|
45 | @@operators_by_filter_type = { :list => [ "=", "!" ], | |
46 | :list_status => [ "o", "=", "!", "c", "*" ], |
|
46 | :list_status => [ "o", "=", "!", "c", "*" ], | |
47 | :list_optional => [ "=", "!", "!*", "*" ], |
|
47 | :list_optional => [ "=", "!", "!*", "*" ], | |
48 | :date => [ "<t+", ">t+", "t+", "t", ">t-", "<t-", "t-" ], |
|
48 | :date => [ "<t+", ">t+", "t+", "t", ">t-", "<t-", "t-" ], | |
49 | :date_past => [ ">t-", "<t-", "t-", "t" ], |
|
49 | :date_past => [ ">t-", "<t-", "t-", "t" ], | |
50 | :text => [ "~", "!~" ] } |
|
50 | :text => [ "~", "!~" ] } | |
51 |
|
51 | |||
52 | cattr_reader :operators_by_filter_type |
|
52 | cattr_reader :operators_by_filter_type | |
53 |
|
53 | |||
54 | def initialize(attributes = nil) |
|
54 | def initialize(attributes = nil) | |
55 | super attributes |
|
55 | super attributes | |
56 | self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} } |
|
56 | self.filters ||= { 'status_id' => {:operator => "o", :values => [""]} } | |
57 | self.is_public = true |
|
57 | self.is_public = true | |
58 | end |
|
58 | end | |
59 |
|
59 | |||
60 | def validate |
|
60 | def validate | |
61 | filters.each_key do |field| |
|
61 | filters.each_key do |field| | |
62 | errors.add field.gsub(/\_id$/, ""), :activerecord_error_blank unless |
|
62 | errors.add field.gsub(/\_id$/, ""), :activerecord_error_blank unless | |
63 | # filter requires one or more values |
|
63 | # filter requires one or more values | |
64 | (values_for(field) and !values_for(field).first.empty?) or |
|
64 | (values_for(field) and !values_for(field).first.empty?) or | |
65 | # filter doesn't require any value |
|
65 | # filter doesn't require any value | |
66 | ["o", "c", "!*", "*", "t"].include? operator_for(field) |
|
66 | ["o", "c", "!*", "*", "t"].include? operator_for(field) | |
67 | end if filters |
|
67 | end if filters | |
68 | end |
|
68 | end | |
69 |
|
69 | |||
70 | def available_filters |
|
70 | def available_filters | |
71 | return @available_filters if @available_filters |
|
71 | return @available_filters if @available_filters | |
72 | @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all).collect{|s| [s.name, s.id.to_s] } }, |
|
72 | @available_filters = { "status_id" => { :type => :list_status, :order => 1, :values => IssueStatus.find(:all).collect{|s| [s.name, s.id.to_s] } }, | |
73 | "tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all).collect{|s| [s.name, s.id.to_s] } }, |
|
73 | "tracker_id" => { :type => :list, :order => 2, :values => Tracker.find(:all).collect{|s| [s.name, s.id.to_s] } }, | |
74 | "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } }, |
|
74 | "priority_id" => { :type => :list, :order => 3, :values => Enumeration.find(:all, :conditions => ['opt=?','IPRI']).collect{|s| [s.name, s.id.to_s] } }, | |
75 |
"subject" => { :type => :text, :order => |
|
75 | "subject" => { :type => :text, :order => 8 }, | |
76 |
"created_on" => { :type => :date_past, :order => |
|
76 | "created_on" => { :type => :date_past, :order => 9 }, | |
77 |
"updated_on" => { :type => :date_past, :order => |
|
77 | "updated_on" => { :type => :date_past, :order => 10 }, | |
78 |
"start_date" => { :type => :date, :order => 1 |
|
78 | "start_date" => { :type => :date, :order => 11 }, | |
79 |
"due_date" => { :type => :date, :order => 1 |
|
79 | "due_date" => { :type => :date, :order => 12 } } | |
80 | unless project.nil? |
|
80 | unless project.nil? | |
81 | # project specific filters |
|
81 | # project specific filters | |
82 | @available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => @project.users.collect{|s| [s.name, s.id.to_s] } } |
|
82 | @available_filters["assigned_to_id"] = { :type => :list_optional, :order => 4, :values => @project.users.collect{|s| [s.name, s.id.to_s] } } | |
83 | @available_filters["author_id"] = { :type => :list, :order => 5, :values => @project.users.collect{|s| [s.name, s.id.to_s] } } |
|
83 | @available_filters["author_id"] = { :type => :list, :order => 5, :values => @project.users.collect{|s| [s.name, s.id.to_s] } } | |
84 | @available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } } |
|
84 | @available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } } | |
|
85 | @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.collect{|s| [s.name, s.id.to_s] } } | |||
85 | # remove category filter if no category defined |
|
86 | # remove category filter if no category defined | |
86 | @available_filters.delete "category_id" if @available_filters["category_id"][:values].empty? |
|
87 | @available_filters.delete "category_id" if @available_filters["category_id"][:values].empty? | |
87 | end |
|
88 | end | |
88 | @available_filters |
|
89 | @available_filters | |
89 | end |
|
90 | end | |
90 |
|
91 | |||
91 | def add_filter(field, operator, values) |
|
92 | def add_filter(field, operator, values) | |
92 | # values must be an array |
|
93 | # values must be an array | |
93 | return unless values and values.is_a? Array # and !values.first.empty? |
|
94 | return unless values and values.is_a? Array # and !values.first.empty? | |
94 | # check if field is defined as an available filter |
|
95 | # check if field is defined as an available filter | |
95 | if available_filters.has_key? field |
|
96 | if available_filters.has_key? field | |
96 | filter_options = available_filters[field] |
|
97 | filter_options = available_filters[field] | |
97 | # check if operator is allowed for that filter |
|
98 | # check if operator is allowed for that filter | |
98 | #if @@operators_by_filter_type[filter_options[:type]].include? operator |
|
99 | #if @@operators_by_filter_type[filter_options[:type]].include? operator | |
99 | # allowed_values = values & ([""] + (filter_options[:values] || []).collect {|val| val[1]}) |
|
100 | # allowed_values = values & ([""] + (filter_options[:values] || []).collect {|val| val[1]}) | |
100 | # filters[field] = {:operator => operator, :values => allowed_values } if (allowed_values.first and !allowed_values.first.empty?) or ["o", "c", "!*", "*", "t"].include? operator |
|
101 | # filters[field] = {:operator => operator, :values => allowed_values } if (allowed_values.first and !allowed_values.first.empty?) or ["o", "c", "!*", "*", "t"].include? operator | |
101 | #end |
|
102 | #end | |
102 | filters[field] = {:operator => operator, :values => values } |
|
103 | filters[field] = {:operator => operator, :values => values } | |
103 | end |
|
104 | end | |
104 | end |
|
105 | end | |
105 |
|
106 | |||
106 | def add_short_filter(field, expression) |
|
107 | def add_short_filter(field, expression) | |
107 | return unless expression |
|
108 | return unless expression | |
108 | parms = expression.scan(/^(o|c|\!|\*)?(.*)$/).first |
|
109 | parms = expression.scan(/^(o|c|\!|\*)?(.*)$/).first | |
109 | add_filter field, (parms[0] || "="), [parms[1] || ""] |
|
110 | add_filter field, (parms[0] || "="), [parms[1] || ""] | |
110 | end |
|
111 | end | |
111 |
|
112 | |||
112 | def has_filter?(field) |
|
113 | def has_filter?(field) | |
113 | filters and filters[field] |
|
114 | filters and filters[field] | |
114 | end |
|
115 | end | |
115 |
|
116 | |||
116 | def operator_for(field) |
|
117 | def operator_for(field) | |
117 | has_filter?(field) ? filters[field][:operator] : nil |
|
118 | has_filter?(field) ? filters[field][:operator] : nil | |
118 | end |
|
119 | end | |
119 |
|
120 | |||
120 | def values_for(field) |
|
121 | def values_for(field) | |
121 | has_filter?(field) ? filters[field][:values] : nil |
|
122 | has_filter?(field) ? filters[field][:values] : nil | |
122 | end |
|
123 | end | |
123 |
|
124 | |||
124 | def statement |
|
125 | def statement | |
125 | sql = "1=1" |
|
126 | sql = "1=1" | |
126 | sql << " AND issues.project_id=%d" % project.id if project |
|
127 | sql << " AND issues.project_id=%d" % project.id if project | |
127 | filters.each_key do |field| |
|
128 | filters.each_key do |field| | |
128 | v = values_for field |
|
129 | v = values_for field | |
129 | next unless v and !v.empty? |
|
130 | next unless v and !v.empty? | |
130 | sql = sql + " AND " unless sql.empty? |
|
131 | sql = sql + " AND " unless sql.empty? | |
131 | case operator_for field |
|
132 | case operator_for field | |
132 | when "=" |
|
133 | when "=" | |
133 | sql = sql + "issues.#{field} IN (" + v.each(&:to_i).join(",") + ")" |
|
134 | sql = sql + "issues.#{field} IN (" + v.each(&:to_i).join(",") + ")" | |
134 | when "!" |
|
135 | when "!" | |
135 | sql = sql + "issues.#{field} NOT IN (" + v.each(&:to_i).join(",") + ")" |
|
136 | sql = sql + "issues.#{field} NOT IN (" + v.each(&:to_i).join(",") + ")" | |
136 | when "!*" |
|
137 | when "!*" | |
137 | sql = sql + "issues.#{field} IS NULL" |
|
138 | sql = sql + "issues.#{field} IS NULL" | |
138 | when "*" |
|
139 | when "*" | |
139 | sql = sql + "issues.#{field} IS NOT NULL" |
|
140 | sql = sql + "issues.#{field} IS NOT NULL" | |
140 | when "o" |
|
141 | when "o" | |
141 | sql = sql + "issue_statuses.is_closed=#{connection.quoted_false}" if field == "status_id" |
|
142 | sql = sql + "issue_statuses.is_closed=#{connection.quoted_false}" if field == "status_id" | |
142 | when "c" |
|
143 | when "c" | |
143 | sql = sql + "issue_statuses.is_closed=#{connection.quoted_true}" if field == "status_id" |
|
144 | sql = sql + "issue_statuses.is_closed=#{connection.quoted_true}" if field == "status_id" | |
144 | when ">t-" |
|
145 | when ">t-" | |
145 | sql = sql + "issues.#{field} >= '%s'" % connection.quoted_date(Date.today - v.first.to_i) |
|
146 | sql = sql + "issues.#{field} >= '%s'" % connection.quoted_date(Date.today - v.first.to_i) | |
146 | when "<t-" |
|
147 | when "<t-" | |
147 | sql = sql + "issues.#{field} <= '" + (Date.today - v.first.to_i).strftime("%Y-%m-%d") + "'" |
|
148 | sql = sql + "issues.#{field} <= '" + (Date.today - v.first.to_i).strftime("%Y-%m-%d") + "'" | |
148 | when "t-" |
|
149 | when "t-" | |
149 | sql = sql + "issues.#{field} = '" + (Date.today - v.first.to_i).strftime("%Y-%m-%d") + "'" |
|
150 | sql = sql + "issues.#{field} = '" + (Date.today - v.first.to_i).strftime("%Y-%m-%d") + "'" | |
150 | when ">t+" |
|
151 | when ">t+" | |
151 | sql = sql + "issues.#{field} >= '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'" |
|
152 | sql = sql + "issues.#{field} >= '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'" | |
152 | when "<t+" |
|
153 | when "<t+" | |
153 | sql = sql + "issues.#{field} <= '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'" |
|
154 | sql = sql + "issues.#{field} <= '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'" | |
154 | when "t+" |
|
155 | when "t+" | |
155 | sql = sql + "issues.#{field} = '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'" |
|
156 | sql = sql + "issues.#{field} = '" + (Date.today + v.first.to_i).strftime("%Y-%m-%d") + "'" | |
156 | when "t" |
|
157 | when "t" | |
157 | sql = sql + "issues.#{field} = '%s'" % connection.quoted_date(Date.today) |
|
158 | sql = sql + "issues.#{field} = '%s'" % connection.quoted_date(Date.today) | |
158 | when "~" |
|
159 | when "~" | |
159 | sql = sql + "issues.#{field} LIKE '%#{connection.quote_string(v.first)}%'" |
|
160 | sql = sql + "issues.#{field} LIKE '%#{connection.quote_string(v.first)}%'" | |
160 | when "!~" |
|
161 | when "!~" | |
161 | sql = sql + "issues.#{field} NOT LIKE '%#{connection.quote_string(v.first)}%'" |
|
162 | sql = sql + "issues.#{field} NOT LIKE '%#{connection.quote_string(v.first)}%'" | |
162 | end |
|
163 | end | |
163 | end if filters and valid? |
|
164 | end if filters and valid? | |
164 | sql |
|
165 | sql | |
165 | end |
|
166 | end | |
166 | end |
|
167 | end |
@@ -1,107 +1,111 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %> |
|
2 | <%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %> | |
3 | </div> |
|
3 | </div> | |
4 |
|
4 | |||
5 | <h2><%= @issue.tracker.name %> #<%= @issue.id %> - <%=h @issue.subject %></h2> |
|
5 | <h2><%= @issue.tracker.name %> #<%= @issue.id %> - <%=h @issue.subject %></h2> | |
6 |
|
6 | |||
7 | <div class="box"> |
|
7 | <div class="box"> | |
8 | <table width="100%"> |
|
8 | <table width="100%"> | |
9 | <tr> |
|
9 | <tr> | |
10 | <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td> |
|
10 | <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td> | |
11 | <td style="width:15%"><b><%=l(:field_priority)%> :</b></td><td style="width:35%"><%= @issue.priority.name %></td> |
|
11 | <td style="width:15%"><b><%=l(:field_priority)%> :</b></td><td style="width:35%"><%= @issue.priority.name %></td> | |
12 | </tr> |
|
12 | </tr> | |
13 | <tr> |
|
13 | <tr> | |
14 | <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? @issue.assigned_to.name : "-" %></td> |
|
14 | <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? @issue.assigned_to.name : "-" %></td> | |
15 | <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> |
|
15 | <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> | |
16 | </tr> |
|
16 | </tr> | |
17 | <tr> |
|
17 | <tr> | |
18 | <td><b><%=l(:field_author)%> :</b></td><td><%= link_to_user @issue.author %></td> |
|
18 | <td><b><%=l(:field_author)%> :</b></td><td><%= link_to_user @issue.author %></td> | |
19 | <td><b><%=l(:field_start_date)%> :</b></td><td><%= format_date(@issue.start_date) %></td> |
|
19 | <td><b><%=l(:field_start_date)%> :</b></td><td><%= format_date(@issue.start_date) %></td> | |
20 | </tr> |
|
20 | </tr> | |
21 | <tr> |
|
21 | <tr> | |
22 | <td><b><%=l(:field_created_on)%> :</b></td><td><%= format_date(@issue.created_on) %></td> |
|
22 | <td><b><%=l(:field_created_on)%> :</b></td><td><%= format_date(@issue.created_on) %></td> | |
23 | <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td> |
|
23 | <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td> | |
24 | </tr> |
|
24 | </tr> | |
25 | <tr> |
|
25 | <tr> | |
26 | <td><b><%=l(:field_updated_on)%> :</b></td><td><%= format_date(@issue.updated_on) %></td> |
|
26 | <td><b><%=l(:field_updated_on)%> :</b></td><td><%= format_date(@issue.updated_on) %></td> | |
27 | <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td> |
|
27 | <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td> | |
28 | </tr> |
|
28 | </tr> | |
29 | <tr> |
|
29 | <tr> | |
|
30 | <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? @issue.fixed_version.name : "-" %></td> | |||
|
31 | <td></td><td></td> | |||
|
32 | </tr> | |||
|
33 | <tr> | |||
30 | <% n = 0 |
|
34 | <% n = 0 | |
31 | for custom_value in @custom_values %> |
|
35 | for custom_value in @custom_values %> | |
32 | <td><b><%= custom_value.custom_field.name %> :</b></td><td><%=h show_value custom_value %></td> |
|
36 | <td><b><%= custom_value.custom_field.name %> :</b></td><td><%=h show_value custom_value %></td> | |
33 | <% n = n + 1 |
|
37 | <% n = n + 1 | |
34 | if (n > 1) |
|
38 | if (n > 1) | |
35 | n = 0 %> |
|
39 | n = 0 %> | |
36 | </tr><tr> |
|
40 | </tr><tr> | |
37 | <%end |
|
41 | <%end | |
38 | end %> |
|
42 | end %> | |
39 | </tr> |
|
43 | </tr> | |
40 | </table> |
|
44 | </table> | |
41 | <hr /> |
|
45 | <hr /> | |
42 | <br /> |
|
46 | <br /> | |
43 |
|
47 | |||
44 | <b><%=l(:field_description)%> :</b><br /><br /> |
|
48 | <b><%=l(:field_description)%> :</b><br /><br /> | |
45 | <%= textilizable @issue.description %> |
|
49 | <%= textilizable @issue.description %> | |
46 | <br /> |
|
50 | <br /> | |
47 |
|
51 | |||
48 | <div class="contextual"> |
|
52 | <div class="contextual"> | |
49 | <%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit' %> |
|
53 | <%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit' %> | |
50 | <%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %> |
|
54 | <%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %> | |
51 | <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :post => true, :class => 'icon icon-del' %> |
|
55 | <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :post => true, :class => 'icon icon-del' %> | |
52 | </div> |
|
56 | </div> | |
53 |
|
57 | |||
54 | <% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %> |
|
58 | <% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %> | |
55 | <%= start_form_tag ({:controller => 'issues', :action => 'change_status', :id => @issue}) %> |
|
59 | <%= start_form_tag ({:controller => 'issues', :action => 'change_status', :id => @issue}) %> | |
56 | <%=l(:label_change_status)%> : |
|
60 | <%=l(:label_change_status)%> : | |
57 | <select name="new_status_id"> |
|
61 | <select name="new_status_id"> | |
58 | <%= options_from_collection_for_select @status_options, "id", "name" %> |
|
62 | <%= options_from_collection_for_select @status_options, "id", "name" %> | |
59 | </select> |
|
63 | </select> | |
60 | <%= submit_tag l(:button_change) %> |
|
64 | <%= submit_tag l(:button_change) %> | |
61 | <%= end_form_tag %> |
|
65 | <%= end_form_tag %> | |
62 | <% end %> |
|
66 | <% end %> | |
63 | |
|
67 | | |
64 | </div> |
|
68 | </div> | |
65 |
|
69 | |||
66 | <div id="history" class="box"> |
|
70 | <div id="history" class="box"> | |
67 | <h3><%=l(:label_history)%> |
|
71 | <h3><%=l(:label_history)%> | |
68 | <% if @journals_count > @journals.length %>(<%= l(:label_last_changes, @journals.length) %>)<% end %></h3> |
|
72 | <% if @journals_count > @journals.length %>(<%= l(:label_last_changes, @journals.length) %>)<% end %></h3> | |
69 | <%= render :partial => 'history', :locals => { :journals => @journals } %> |
|
73 | <%= render :partial => 'history', :locals => { :journals => @journals } %> | |
70 | <% if @journals_count > @journals.length %> |
|
74 | <% if @journals_count > @journals.length %> | |
71 | <p><center><small>[ <%= link_to l(:label_change_view_all), :action => 'history', :id => @issue %> ]</small></center></p> |
|
75 | <p><center><small>[ <%= link_to l(:label_change_view_all), :action => 'history', :id => @issue %> ]</small></center></p> | |
72 | <% end %> |
|
76 | <% end %> | |
73 | </div> |
|
77 | </div> | |
74 |
|
78 | |||
75 | <div class="box"> |
|
79 | <div class="box"> | |
76 | <h3><%=l(:label_attachment_plural)%></h3> |
|
80 | <h3><%=l(:label_attachment_plural)%></h3> | |
77 | <table width="100%"> |
|
81 | <table width="100%"> | |
78 | <% for attachment in @issue.attachments %> |
|
82 | <% for attachment in @issue.attachments %> | |
79 | <tr> |
|
83 | <tr> | |
80 | <td><%= link_to attachment.filename, { :action => 'download', :id => @issue, :attachment_id => attachment }, :class => 'icon icon-attachment' %> (<%= human_size(attachment.filesize) %>)</td> |
|
84 | <td><%= link_to attachment.filename, { :action => 'download', :id => @issue, :attachment_id => attachment }, :class => 'icon icon-attachment' %> (<%= human_size(attachment.filesize) %>)</td> | |
81 | <td><%= format_date(attachment.created_on) %></td> |
|
85 | <td><%= format_date(attachment.created_on) %></td> | |
82 | <td><%= attachment.author.display_name %></td> |
|
86 | <td><%= attachment.author.display_name %></td> | |
83 | <td><div class="contextual"><%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy_attachment', :id => @issue, :attachment_id => attachment }, :confirm => l(:text_are_you_sure), :post => true, :class => 'icon icon-del' %></div></td> |
|
87 | <td><div class="contextual"><%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy_attachment', :id => @issue, :attachment_id => attachment }, :confirm => l(:text_are_you_sure), :post => true, :class => 'icon icon-del' %></div></td> | |
84 | </tr> |
|
88 | </tr> | |
85 | <% end %> |
|
89 | <% end %> | |
86 | </table> |
|
90 | </table> | |
87 | <br /> |
|
91 | <br /> | |
88 | <% if authorize_for('issues', 'add_attachment') %> |
|
92 | <% if authorize_for('issues', 'add_attachment') %> | |
89 | <%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") %> |
|
93 | <%= start_form_tag ({ :controller => 'issues', :action => 'add_attachment', :id => @issue }, :multipart => true, :class => "tabular") %> | |
90 | <p id="attachments_p"><label><%=l(:label_attachment_new)%> |
|
94 | <p id="attachments_p"><label><%=l(:label_attachment_new)%> | |
91 | <%= image_to_function "add.png", "addFileField();return false" %></label> |
|
95 | <%= image_to_function "add.png", "addFileField();return false" %></label> | |
92 | <%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= human_size(Attachment.max_size) %>)</em></p> |
|
96 | <%= file_field_tag 'attachments[]', :size => 30 %> <em>(<%= l(:label_max_size) %>: <%= human_size(Attachment.max_size) %>)</em></p> | |
93 | <%= submit_tag l(:button_add) %> |
|
97 | <%= submit_tag l(:button_add) %> | |
94 | <%= end_form_tag %> |
|
98 | <%= end_form_tag %> | |
95 | <% end %> |
|
99 | <% end %> | |
96 | </div> |
|
100 | </div> | |
97 |
|
101 | |||
98 | <% if authorize_for('issues', 'add_note') %> |
|
102 | <% if authorize_for('issues', 'add_note') %> | |
99 | <div class="box"> |
|
103 | <div class="box"> | |
100 | <h3><%= l(:label_add_note) %></h3> |
|
104 | <h3><%= l(:label_add_note) %></h3> | |
101 | <%= start_form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) %> |
|
105 | <%= start_form_tag ({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular" ) %> | |
102 | <p><label for="notes"><%=l(:field_notes)%></label> |
|
106 | <p><label for="notes"><%=l(:field_notes)%></label> | |
103 | <%= text_area_tag 'notes', '', :cols => 60, :rows => 10 %></p> |
|
107 | <%= text_area_tag 'notes', '', :cols => 60, :rows => 10 %></p> | |
104 | <%= submit_tag l(:button_add) %> |
|
108 | <%= submit_tag l(:button_add) %> | |
105 | <%= end_form_tag %> |
|
109 | <%= end_form_tag %> | |
106 | </div> |
|
110 | </div> | |
107 | <% end %> |
|
111 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now