From 706395b2b2deb3255677423b93f8cc51274bfa4d Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Tue, 18 Oct 2011 15:24:55 +0400 Subject: [PATCH] SONAR-2748 Make the profile backup available as permalink --- .../resources/org/sonar/l10n/core.properties | 2 +- .../app/controllers/profiles_controller.rb | 11 +++-- .../app/views/profiles/permalinks.html.erb | 47 ++++++++++--------- 3 files changed, 35 insertions(+), 25 deletions(-) diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties index c525ec48324..54d8722a3cb 100644 --- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -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 #------------------------------------------------------------------------------ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb index 48c87e4c8c0..9f5b1e8ca82 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb @@ -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 # diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb index e583d280f9a..fd4f42eb993 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/profiles/permalinks.html.erb @@ -3,24 +3,29 @@
<% exporters=controller.java_facade.getProfileExportersForLanguage(@profile.language) %> - <% if exporters.empty? %> -

<%= message('quality_profiles.no_permalinks') -%>

- <% else %> -
- - - <% exporters.to_a.sort{|x,y| x.getName() <=> y.getName()}.each do |exporter| %> - - - - - <% end %> - - - <% end %> -
\ No newline at end of file +
+ + + + + + + <% exporters.to_a.sort{|x,y| x.getName() <=> y.getName()}.each do |exporter| %> + + + + + <% end %> + + + -- 2.39.5