aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb18
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb5
2 files changed, 14 insertions, 9 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
index 9b4126436c7..766eb5135b0 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/settings_controller.rb
@@ -39,16 +39,22 @@ class SettingsController < ApplicationController
properties=java_facade.getPluginProperties(plugin)
properties.each do |property|
value=params[property.key()]
- old_value=params['old_' + property.key()]
- if (value != old_value)
- if value.blank?
- Property.clear(property.key(), resource_id)
- else
- Property.set(property.key(), value, resource_id)
+ persisted_property = Property.find(:first, :conditions => {:prop_key=> property.key(), :resource_id => resource_id, :user_id => nil})
+
+ if persisted_property
+ if value.empty?
+ Property.delete_all('prop_key' => property.key(), 'resource_id' => resource_id, 'user_id' => nil)
+ elsif persisted_property.text_value != value.to_s
+ persisted_property.text_value = value.to_s
+ persisted_property.save
end
+ elsif !value.blank?
+ Property.create(:prop_key => property.key(), :text_value => value.to_s, :resource_id => resource_id)
end
end
end
+ java_facade.reloadConfiguration()
+
flash[:notice] = 'Parameters updated.'
if resource_id
redirect_to :controller => 'project', :action => 'settings', :id => resource_id
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
index 5948e312783..f47ce1da745 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_plugins.html.erb
@@ -83,7 +83,6 @@
<p><%= property.description() %></p>
<p>
<% span_id = "text_" + property.key().gsub('.', '_') %>
- <input type="hidden" name="old_<%= property.key() -%>" value="<%= value -%>"></input>
<% textfield = text_field_tag property.key(), value, :size => '20' %>
<% textfield += link_to_function(image_tag("zoom.png"), "replaceTextField('#{span_id}', '#{property.key()}')", :id => "toggle_text", :class => 'nolink') %>
<% textarea = text_area_tag property.key(), value, :size => "100x10" %>
@@ -91,9 +90,9 @@
<% unless property.defaultValue().blank? %>
<% if project.nil? %>
- <span class="note">Default : <%= property.defaultValue() -%></span>
+ <span class="note">Default : <%= h property.defaultValue() -%></span>
<% else %>
- <span class="note">Default : <%= Property.value(property.key(), nil, property.defaultValue()) -%></span>
+ <span class="note">Default : <%= h Property.value(property.key(), nil, property.defaultValue()) -%></span>
<% end %>
<% end %>
</p>