]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2748 Make the profile backup available as permalink
authorEvgeny Mandrikov <mandrikov@gmail.com>
Tue, 18 Oct 2011 11:24:55 +0000 (15:24 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Tue, 18 Oct 2011 13:41:48 +0000 (17:41 +0400)
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb

index c525ec483246a3ae782a26d02f62d83ef145e645..54d8722a3cb81146439295971ee5ac3ac9c478cd 100644 (file)
@@ -689,7 +689,6 @@ quality_profiles.available_projects=Available projects
 quality_profiles.associated_projects=Associated projects
 quality_profiles.no_projects_associated_to_profile_x=No projects are explicitly associated to the profile "{0}".
 quality_profiles.projects_warning=List of projects explicitly associated to this Quality profile :
-quality_profiles.no_permalinks=No permalinks
 quality_profiles.including_x_overriding.suffix=, incl. {0} overriding
 quality_profiles.profile_cant_be_edited=This profile can not be edited.
 quality_profiles.set_parent=Set parent
@@ -712,6 +711,7 @@ quality_profiles.with_different_configuration=With different configuration
 quality_profiles.with_same_configuration=With same configuration
 quality_profiles.x_rules_only_in={0} rules only in
 quality_profiles.x_rules_have_different_configuration={0} rules have a different configuration
+quality_profiles.export_all_rules=All rules
 
 
 #------------------------------------------------------------------------------
index 48c87e4c8c042320b55e7721dd573ffac11da3b7..9f5b1e8ca82966017f957e07d4c7474b8e402d32 100644 (file)
@@ -180,9 +180,14 @@ class ProfilesController < ApplicationController
     else
       profile = Profile.find_by_name_and_language(CGI::unescape(params[:name]), language)
     end
-    exporter_key = params[:format]
-    result = java_facade.exportProfile(profile.id, exporter_key)
-    send_data(result, :type => java_facade.getProfileExporterMimeType(exporter_key), :disposition => 'inline')
+    if (params[:format].blank?)
+      result = java_facade.backupProfile(profile.id)
+      send_data(result, :type => 'text/xml', :disposition => 'inline')
+    else
+      exporter_key = params[:format]
+      result = java_facade.exportProfile(profile.id, exporter_key)
+      send_data(result, :type => java_facade.getProfileExporterMimeType(exporter_key), :disposition => 'inline')
+    end
   end
 
   #
index e583d280f9a2e45337013571aca8d22a7ce226b6..fd4f42eb9935328bcb4916612310ba041ec15e5f 100644 (file)
@@ -3,24 +3,29 @@
 
 <div class="tabs-panel marginbottom10 ">
        <% exporters=controller.java_facade.getProfileExportersForLanguage(@profile.language) %>
-       <% if exporters.empty? %>
-         <p><%= message('quality_profiles.no_permalinks') -%></p>
-       <% else %>
-         <br/>
-         <table class="data without-header marginbottom10" id="permalinks-table">
-           <tbody>
-           <% exporters.to_a.sort{|x,y| x.getName() <=> y.getName()}.each do |exporter| %>
-             <tr class="<%= cycle('even','odd') -%>">
-               <td width="1%" nowrap>
-                 <%= h exporter.getName() -%>
-               </td>
-               <td>
-                 <% permalink=url_for :controller => 'profiles', :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :format => exporter.getKey(), :only_path => false %>
-                 <span class="small"><%= link_to permalink, permalink, :id => "export_" + exporter.getKey().to_s + "_" + u(@profile.key) %></span>
-               </td>
-             </tr>
-           <% end %>
-           </tbody>
-         </table>
-       <% end %>
-</div>
\ No newline at end of file
+       <br/>
+       <table class="data without-header marginbottom10" id="permalinks-table">
+         <tbody>
+         <tr class="odd">
+           <td width="1%" nowrap>
+             <%= message('quality_profiles.export_all_rules') -%>
+           </td>
+           <td>
+             <% permalink = url_for :controller => 'profiles', :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :only_path => false %>
+             <span class="small"><%= link_to permalink, permalink %></span>
+           </td>
+         </tr>
+         <% exporters.to_a.sort{|x,y| x.getName() <=> y.getName()}.each do |exporter| %>
+           <tr class="<%= cycle('even','odd') -%>">
+             <td width="1%" nowrap>
+               <%= h exporter.getName() -%>
+             </td>
+             <td>
+               <% permalink=url_for :controller => 'profiles', :action => 'export', :language => @profile.language, :name => url_encode(@profile.name), :format => exporter.getKey(), :only_path => false %>
+               <span class="small"><%= link_to permalink, permalink, :id => "export_" + exporter.getKey().to_s + "_" + u(@profile.key) %></span>
+             </td>
+           </tr>
+         <% end %>
+         </tbody>
+       </table>
+</div>