@severities = filter_any(params[:severities]) || ['']
@statuses = filter_any(params[:statuses]) || [Review::STATUS_OPEN]
@projects = filter_any(params[:projects]) || ['']
- @id = params[:review_id] || ""
+ @false_positives = params[:false_positives] || 'without'
+ @id = params[:review_id] || ''
@sort = params[:sort]
@asc = params[:asc] == "true"
end
end
def search_reviews
- options = { 'false_positives' => 'without' }
+ options = {}
unless @statuses == ['']
options['statuses']=@statuses.join(',')
end
if @assignee_id
options['assignees']=@assignee_id.to_s
end
+ if @false_positives
+ options['false_positives']=@false_positives
+ end
unless @id == ''
if is_number? @id
options['id'] = @id
period_index=nil if period_index && period_index<=0
if resource.display_dashboard?
if options[:dashboard]
- link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => (resource.copy_resource_id||resource.id), :period => period_index, :tab => options[:tab]}}, :title => options[:title])
+ link_to(name || resource.name, {:overwrite_params => {:controller => 'dashboard', :action => 'index', :id => (resource.copy_resource_id||resource.id), :period => period_index, :tab => options[:tab], :rule => options[:rule]}}, :title => options[:title])
else
# stay on the same page (for example components)
- link_to(name || resource.name, {:overwrite_params => {:id => (resource.copy_resource_id||resource.id), :period => period_index, :tab => options[:tab]}}, :title => options[:title])
+ link_to(name || resource.name, {:overwrite_params => {:id => (resource.copy_resource_id||resource.id), :period => period_index, :tab => options[:tab], :rule => options[:rule]}}, :title => options[:title])
end
else
- link_to(name || resource.name, {:controller => 'resource', :action => 'index', :id => resource.id, :period => period_index, :tab => options[:tab]}, :popup => ['resource', 'height=800,width=900,scrollbars=1,resizable=1'], :title => options[:title])
+ link_to(name || resource.name, {:controller => 'resource', :action => 'index', :id => resource.id, :period => period_index, :tab => options[:tab], :rule => options[:rule]}, :popup => ['resource', 'height=800,width=900,scrollbars=1,resizable=1'], :title => options[:title])
end
end
# field that is submitted is a hidden one that contains the user ID that corresponds
# to the typed name (if the user exists, of course).
#
+ # The 'options' argument can be used to pass HTML elements to the text field.
+ # (for the moment 'class' is supported).
+ #
# Example:
# <%= user_autocomplete_field "assignee_id", @assignee_id -%>
# # => generates an input field for the parameter 'assignee_id'
#
- def user_autocomplete_field(param_id, param_value)
+ def user_autocomplete_field(param_id, param_value, options={})
param_id_name = param_id
param_id_value = param_value
server_url = url_for :controller => 'users', :action => 'autocomplete'
render :partial => 'autocomplete/text_field', :locals => {:param_id_name => param_id_name, :param_id_value => param_id_value,
- :param_displayed_value => param_displayed_value, :server_url => server_url }
+ :param_displayed_value => param_displayed_value, :server_url => server_url,
+ :options => options.to_options}
end
end
- <input type="text" id="autocompleteText-<%= param_id_name -%>" value="<%= param_displayed_value -%>" onfocus="$('<%= param_id_name -%>').value=''; this.value=''"/>
+ <input type="text"
+ id="autocompleteText-<%= param_id_name -%>"
+ value="<%= param_displayed_value -%>"
+ onfocus="$('<%= param_id_name -%>').value=''; this.value=''"
+ <%= "class=\"" + options[:class] + "\"" if options[:class] -%>/>
<input type="hidden" id="<%= param_id_name -%>" name="<%= param_id_name -%>" value="<%= param_id_value -%>"/>
<div id="autocomplete-<%= param_id_name -%>" class="autocomplete"></div>
<script>
<div id="rev_<%= review.id -%>">
<div class="reportTitle">
<h2>Review #<%= h(review.id.to_s) -%> - <%= h(review.title) -%></h2>
+ <% if review.false_positive %>
+ <%= image_tag("sep12.png") -%>
+
+ <span class="falsePositive">False-Positive</span>
+ <% end %>
<%
if current_user && review.status != "CLOSED" && review.rule_failure
<td class="val" colspan="3">
<%= qualifier_icon(@review.resource) -%>
<% if !review.on_project? %> <%= @review.project.long_name -%> <%= image_tag 'sep12.png' -%> <% end %>
- <%= link_to_resource(review.resource, review.resource.long_name, { :tab => :violations } ) %>
+ <%= link_to_resource(review.resource, review.resource.long_name, { :tab => :violations, :rule => "f-positive" } ) %>
</td>
</tr>
</table>
$('author_id').value = ''
$('autocompleteText-author_id').value = ''
$('assignee_id').value = ''
- $('autocompleteText-assignee_id').value = ''
+ $('autocompleteText-assignee_id').value = ''
+ $('false_positives').value = 'with'
}
}
function launchSearch(columnName, link) {
</td>
<td width="1%" nowrap>
<span class="note">Created by</span><br/>
- <%= user_autocomplete_field "author_id", @author_id -%>
+ <%= user_autocomplete_field "author_id", @author_id, { :class => "max-width" } -%>
<br/>
<span class="note">Assigned to</span><br/>
- <%= user_autocomplete_field "assignee_id", @assignee_id -%>
+ <%= user_autocomplete_field "assignee_id", @assignee_id, { :class => "max-width" } -%>
<br/>
+ <br/>
+ <select name="false_positives" id="false_positives" class="withIcons">
+ <option <%= 'selected' if @false_positives=='without' -%> value="without" class="sel-without-false-positives">Without false positives</option>
+ <option <%= 'selected' if @false_positives=='only' -%> value="only" class="sel-only-false-positives">Only false positives</option>
+ <option <%= 'selected' if @false_positives=='with' -%> value="with" class="sel-with-false-positives">With false positives</option>
+ </select>
</td>
- <td width="1%" nowrap>
+ <td width="1%" style="padding-left: 20px" nowrap>
<span class="note">Id</span><br/>
<%= text_field_tag "review_id", @id, :size => 10, :onkeyup => "reviewIdFieldModified(this)" -%>
<br/>
<td>
<%= link_to h(review.title), :controller => "reviews", :action => "view", :id => review.id -%>
<div class="comment-excerpt">
- <%= image_tag("reviews/comment.png") -%> <b><%= comment.user.name -%> :</b>
+ <img src="<%= ApplicationController.root_context -%>/images/reviews/<%= review.false_positive ? "false_positive" : "comment" -%>.png" title="<%= 'False positive' if review.false_positive -%>"/>
+ <b><%= comment.user.name -%> :</b>
<%= comment.excerpt -%>
</div>
</td>
}
.falsePositive {
background-color: #FFF6BF;
+ padding-left: 5px;
+ padding-right: 5px;
}
div.vtitle a.action {
color: #777;
list-style: square inside;
}
div.comment-excerpt {
- background-color: transparent;
- margin-top: 5px;
- margin-bottom: 5px;
- color: #777777;
- font-size: 90%;
+ background-color: transparent;
+ margin-top: 5px;
+ margin-bottom: 5px;
+ color: #777777;
+ font-size: 90%;
+}
+.max-width {
+ width: 100%;
+}
+option.sel-with-false-positives {
+ background-image: url('../images/reviews/with_false_positives.png');
+}
+option.sel-only-false-positives {
+ background-image: url('../images/reviews/false_positive.png');
+}
+option.sel-without-false-positives {
+ background-image: url('../images/reviews/comment.png');
}