--- /dev/null
+<div id="coverage_header" class="tab_header">
+ <table class="col">
+ <tr>
+ <td class="big"><%= format_measure('coverage', :default => '-') -%></td>
+ </tr>
+ </table>
+
+ <table class="col">
+ <% if m=measure('line_coverage') %>
+ <tr>
+ <td class="name">Line coverage:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('uncovered_lines') %>
+ <tr>
+ <td class="name">Uncovered lines:</td>
+ <td class="value"><%= format_measure(m) -%> / <%= format_measure('lines_to_cover') -%></td>
+ </tr>
+ <% end %>
+ </table>
+
+ <table class="col">
+ <% if m=measure('branch_coverage') %>
+ <tr>
+ <td class="name">Branch coverage:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('uncovered_conditions') %>
+ <tr>
+ <td class="name">Uncovered conditions:</td>
+ <td class="value"><%= format_measure(m) -%> / <%= format_measure('conditions_to_cover') -%></td>
+ </tr>
+ <% end %>
+ </table>
+
+ <%= render :partial => 'options' -%>
+ <div class="clear"></div>
+</div>
+
--- /dev/null
+<div id="source_header" class="tab_header">
+ <table class="col">
+ <% if m=measure('lines') %>
+ <tr>
+ <td class="name">Lines:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('ncloc') %>
+ <tr>
+ <td class="name">Lines of code:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('functions') %>
+ <tr>
+ <td class="name">Methods:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('accessors') %>
+ <tr>
+ <td class="name">Accessors:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('paragraphs') %>
+ <tr>
+ <td class="name">Paragraphs:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ </table>
+
+ <table class="col">
+ <% if m=measure('statements') %>
+ <tr>
+ <td class="name">Statements:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('complexity') %>
+ <tr>
+ <td class="name">Complexity:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('function_complexity') %>
+ <tr>
+ <td class="name">Complexity/method:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('paragraph_complexity') %>
+ <tr>
+ <td class="name">Complexity/paragraph:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ </table>
+
+ <table class="col">
+ <% if m=measure('comment_lines_density') %>
+ <tr>
+ <td class="name">Comments:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('comment_lines') %>
+ <tr>
+ <td class="name">Comment lines:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('commented_out_code_lines') %>
+ <tr>
+ <td class="name">Commented-out LOC:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('comment_blank_lines') %>
+ <tr>
+ <td class="name">Blank comments:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ </table>
+
+ <table class="col">
+ <% if m=measure('public_documented_api_density') %>
+ <tr>
+ <td class="name">Public documented API:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('public_undocumented_api') %>
+ <tr>
+ <td class="name">Public undocumented API:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('public_api') %>
+ <tr>
+ <td class="name">Public API:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ </table>
+
+ <table class="col">
+ <% if m=measure('classes') %>
+ <tr>
+ <td class="name">Classes:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('noc') %>
+ <tr>
+ <td class="name">Number of Children:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('dit') %>
+ <tr>
+ <td class="name">Depth in Tree:</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ <% if m=measure('rfc') %>
+ <tr>
+ <td class="name">Response for Class (RFC):</td>
+ <td class="value"><%= format_measure(m) -%></td>
+ </tr>
+ <% end %>
+ </table>
+
+ <%= render :partial => 'options' -%>
+</div>
+
--- /dev/null
+<div id="violations_header" class="tab_header">
+
+ <table class="bottomcol">
+ <tr>
+ <td><span class="big"><%= format_measure('violations', :default => 0) -%></span> violations</td>
+ </tr>
+ </table>
+
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/BLOCKER.png' -%></td>
+ <td class="name">Blocker:</td>
+ <td class="value"><%= format_measure('blocker_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/CRITICAL.png' -%></td>
+ <td class="name">Critical:</td>
+ <td class="value"><%= format_measure('critical_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/MAJOR.png' -%></td>
+ <td class="name">Major:</td>
+ <td class="value"><%= format_measure('major_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/MINOR.png' -%></td>
+ <td class="name">Minor:</td>
+ <td class="value"><%= format_measure('minor_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+ <table class="bottomcol">
+ <tr>
+ <td><%= image_tag 'priority/INFO.png' -%></td>
+ <td class="name">Info:</td>
+ <td class="value"><%= format_measure('info_violations', :default => 0) -%></td>
+ </tr>
+ </table>
+
+ <%= render :partial => 'options' -%>
+ <div class="clear"></div>
+</div>
+
--- /dev/null
+<% display_options = @scm_available || @expandable || @snapshot.project_snapshot.periods? || @display_violations
+ if display_options
+%>
+
+<div id="source_options">
+ <script>
+ applyOptions=function() {
+ $('resource-loading').show();
+ <% if request.xhr? %>
+ var params = Form.serialize($('options-form'));
+ new Ajax.Updater('resource_container', '<%= url_for :controller => 'resource', :action => 'index', :id => @resource.key -%>', {asynchronous:true, parameters:params});
+ return true;
+ <% else %>
+ $('options-form').submit();
+ return false;
+ <% end %>
+ };
+ </script>
+ <form method="GET" action="<%= url_for :controller => 'resource', :action => 'index', :id => @resource.key -%>" id="options-form">
+ <input type="hidden" name="tab" value="<%= params[:tab] -%>"/>
+ <input type="hidden" name="metric" value="<%= params[:metric] -%>"/>
+ <input type="hidden" name="period" value="<%= params[:period] -%>"/>
+
+ <table>
+ <tr>
+ <% first=true %>
+ <% if @scm_available %>
+ <td class="<%= 'first' if first -%>">
+ <input type="checkbox" value="true" name="scm" id="scm" <%= 'checked' if @display_scm -%> onclick="applyOptions()"/>
+ <label for="scm">Show commits</label>
+ </td>
+ <% first=false
+ end %>
+
+ <% if @expandable %>
+ <td class="<%= 'first' if first -%>">
+ <input type="checkbox" value="true" name="expand" id="expand" <%= 'checked' if @expanded -%> onclick="applyOptions()"/>
+ <label for="expand">Show full source</label>
+ </td>
+ <% first=false
+ end %>
+
+ <% if @snapshot.project_snapshot.periods? %>
+ <td class="<%= 'first' if first -%>">
+ <select id="period" name="period" onchange="applyOptions()">
+ <option value="">Time changes...</option>
+ <%= period_select_options(@snapshot, 1) -%>
+ <%= period_select_options(@snapshot, 2) -%>
+ <%= period_select_options(@snapshot, 3) -%>
+ <%= period_select_options(@snapshot, 4) -%>
+ <%= period_select_options(@snapshot, 5) -%>
+ </select>
+ </td>
+ <%
+ first=false
+ end %>
+
+ <% if @display_violations %>
+ <td class="<%= 'first' if first -%>"><%= render :partial => 'rules_filter' -%></td>
+ <% end %>
+ </tr>
+ </table>
+ </form>
+</div>
+<% end %>
\ No newline at end of file
--- /dev/null
+<%
+ blocker_violations = @snapshot.measure('blocker_violations')
+ critical_violations = @snapshot.measure('critical_violations')
+ major_violations = @snapshot.measure('major_violations')
+ minor_violations = @snapshot.measure('minor_violations')
+ info_violations = @snapshot.measure('info_violations')
+
+ rule_counts={}
+ rules=[]
+ rule_measures=ProjectMeasure.find(:all, :include => 'rule', :conditions => ['metric_id=? AND snapshot_id=? AND rule_id IS NOT NULL AND characteristic_id IS NULL', Metric.by_key('violations').id, @snapshot.id])
+ rule_measures.each do |rule_measure|
+ rule_counts[rule_measure.rule_id]=rule_measure.value.to_i
+ rules<<rule_measure.rule
+ end
+
+ rule_options=[]
+ rules.uniq.sort_by{|rule| rule.name}.each do |rule|
+ rule_options<<["#{h rule.name} (#{rule_counts[rule.id]})", rule.id]
+ end
+%>
+<select id="rule" name="rule" onchange="applyOptions()">
+ <option value="">No filters</option>
+ <optgroup label="Severity">
+ <% if blocker_violations && blocker_violations.value>0 %>
+ <option value="<%= Sonar::RulePriority::BLOCKER.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::BLOCKER.to_s -%>>Blocker (<%= blocker_violations.formatted_value -%>)</option>
+ <% end %>
+ <% if critical_violations && critical_violations.value>0 %>
+ <option value="<%= Sonar::RulePriority::CRITICAL.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::CRITICAL.to_s -%>>Critical (<%= critical_violations.formatted_value -%>)</option>
+ <% end %>
+ <% if major_violations && major_violations.value>0 %>
+ <option value="<%= Sonar::RulePriority::MAJOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MAJOR.to_s -%>>Major (<%= major_violations.formatted_value -%>)</option>
+ <% end %>
+ <% if minor_violations && minor_violations.value>0 %>
+ <option value="<%= Sonar::RulePriority::MINOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MINOR.to_s -%>>Minor (<%= minor_violations.formatted_value -%>)</option>
+ <% end %>
+ <% if info_violations && info_violations.value>0 %>
+ <option value="<%= Sonar::RulePriority::INFO.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::INFO.to_s -%>>Info (<%= info_violations.formatted_value -%>)</option>
+ <% end %>
+ </optgroup>
+
+
+ <optgroup label="Rule">
+ <%= options_for_select(rule_options, params[:rule].to_i) -%>
+ </optgroup>
+</select>
\ No newline at end of file
--- /dev/null
+<style>
+
+</style>
+
+<div id="source_title">
+ <span class="h1"><%= qualifier_icon(@resource) -%> <%= @resource.long_name -%></span>
+</div>
+
+<div id="source_tabs">
+ <ul class="tablinks">
+ <%
+ first=true
+ if @snapshot.source
+ %>
+ <li class="<%= 'first' if first -%>"><a href="<%= ApplicationController.root_context -%>/api/sources?resource=<%= @resource.key -%>&format=txt">Raw</a></li>
+ <% first=false
+ end
+ if request.xhr? %>
+ <li class="<%= 'first' if first -%>"><a href="<%= ApplicationController.root_context -%>/resource/index/<%= @resource.key -%>" target="sonar">New Window</a></li>
+ <% end %>
+ </ul>
+ <ul class="tabs" >
+ <% if request.xhr? %>
+ <% @extensions.each do |extension| %>
+ <li><a href="#" onclick="loadAjaxTab('<%= @resource.id -%>','<%= extension.getId() -%>')" class="<%= 'selected' if @extension.getId()==extension.getId() -%>"><%= extension.getTitle() -%></a></li>
+ <% end %>
+ <% else %>
+ <script>function loadTab(url) {$('resource-loading').show();document.location.href=url;return false;}</script>
+ <% @extensions.each do |extension| %>
+ <li><a href="#" onClick="loadTab('<%= url_for(:overwrite_params => {:tab => extension.getId()}) -%>')" class="<%= 'selected' if @extension.getId()==extension.getId() -%>"><%= extension.getTitle() -%></a></li>
+ <% end %>
+ <% end %>
+ <li>
+ <img src="<%= ApplicationController.root_context -%>/images/loading.gif" id="resource-loading" style="display:none"/>
+ </li>
+ </ul>
+</div>
--- /dev/null
+<img src="<%= ApplicationController.root_context -%>/images/priority/<%=violation.failure_level-%>.png"/>
+
+<span class="rulename"><a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => violation.rule.key, :layout => 'false' -%>"><%= h(violation.rule.name) -%></a></span>
+ ยป
+<%= h(violation.message) -%>
+<%
+ if violation.created_at
+ duration=Date.today - violation.created_at.to_date
+
+%>
+ <span class="violation_date"><%= duration==0 ? 'today' : "#{duration} days ago" -%></span>
+<% end %>
\ No newline at end of file
--- /dev/null
+<%= render :partial => 'tabs' -%>
+
+<% if @extension.isGwt() %>
+
+ <% if request.xhr? %>
+ <div id="gwtpage"> </div>
+ <script>loadGWT('<%= @extension.getId() -%>', <%= @resource.id -%>,'<%= @resource.key -%>', '<%= @resource.name -%>', '<%= @resource.scope -%>', '<%= @resource.qualifier -%>', '<%= @resource.language -%>');</script>
+
+ <% else %>
+
+
+ <div id="gwtpage"> </div>
+ <!-- for SmartGWT -->
+ <script>var isomorphicDir = "<%= "#{ApplicationController.root_context}/deploy/gwt/#{@extension.getId()}" -%>/sc/";</script>
+
+ <%= render :partial => 'gwt/base', :locals => {:resource => @resource, :popup => false, :metric => params[:metric]} -%>
+ <script src="<%= ApplicationController.root_context -%>/deploy/gwt/<%= @extension.getId() -%>/<%= @extension.getId() -%>.nocache.js?<%= sonar_version -%>"></script>
+
+ <% end %>
+
+<% else # ruby on rails page %>
+ <%= render :inline => @page.getTemplate() %>
+<% end %>
\ No newline at end of file
--- /dev/null
+<%= render :partial => 'tabs' -%>
\ No newline at end of file