summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java40
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java31
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb27
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb5
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb2
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb2
13 files changed, 39 insertions, 85 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
index eb3f4b05d14..bd7015dfddf 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
@@ -125,46 +125,6 @@ import java.util.List;
global = true,
category = CoreProperties.CATEGORY_GENERAL),
@Property(
- key = "sonar.test",
- defaultValue = "complexity",
- name = "Metric",
- project = true,
- global = true,
- category = CoreProperties.CATEGORY_GENERAL,
- type = PropertyType.METRIC),
- @Property(
- key = "sonar.testmetric",
- name = "Metric",
- project = true,
- global = true,
- category = CoreProperties.CATEGORY_GENERAL,
- type = PropertyType.METRIC),
- @Property(
- key = "sonar.test2",
- name = "Single",
- defaultValue = "2",
- project = true,
- global = true,
- category = CoreProperties.CATEGORY_GENERAL,
- type = PropertyType.SINGLE_SELECT_LIST,
- options = {"1", "2", "3"}),
- @Property(
- key = "sonar.testsinglelist",
- name = "Single2",
- project = true,
- global = true,
- category = CoreProperties.CATEGORY_GENERAL,
- type = PropertyType.SINGLE_SELECT_LIST,
- options = {"1", "2", "3"}),
- @Property(
- key = "sonar.test3",
- name = "Password",
- project = true,
- global = true,
- category = CoreProperties.CATEGORY_GENERAL,
- type = PropertyType.PASSWORD,
- options = {"1", "2", "3"}),
- @Property(
key = CoreProperties.LINKS_HOME_PAGE,
defaultValue = "",
name = "Project Home Page",
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java
index 930e5b02dfb..a7f2e322d81 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java
@@ -26,31 +26,12 @@ import org.sonar.api.web.WidgetPropertyType;
@WidgetCategory("History")
@WidgetProperties({
- @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING, description = "chartTitle description"),
- @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}, description = "metric1 description"),
- @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}, description = "metric2 description"),
- @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}, description = "metric3 description"),
- @WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN, description = "hideEvents description"),
- @WidgetProperty(key = "hideEvents2", type = WidgetPropertyType.BOOLEAN, description = "hideEvents description", defaultValue = "true"),
- @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "80", description = "chartHeight description"),
-
- @WidgetProperty(key = "text", type = WidgetPropertyType.TEXT, description = "text description"),
- @WidgetProperty(key = "password", type = WidgetPropertyType.PASSWORD, description = "password description", defaultValue = "123"),
- @WidgetProperty(key = "password2", type = WidgetPropertyType.PASSWORD, description = "password2 description"),
- @WidgetProperty(key = "float", type = WidgetPropertyType.FLOAT, description = "float description"),
- @WidgetProperty(key = "regex", type = WidgetPropertyType.REGULAR_EXPRESSION, description = "regex description"),
- @WidgetProperty(key = "filter", type = WidgetPropertyType.FILTER, description = "filter description"),
- @WidgetProperty(
- key = "list",
- defaultValue = "2",
- type = WidgetPropertyType.SINGLE_SELECT_LIST,
- options = {"1", "2", "3"},
- description = "list description"),
- @WidgetProperty(
- key = "list2",
- type = WidgetPropertyType.SINGLE_SELECT_LIST,
- options = {"1", "2", "3"},
- description = "list2 description")
+ @WidgetProperty(key = "chartTitle", type = WidgetPropertyType.STRING),
+ @WidgetProperty(key = "metric1", type = WidgetPropertyType.METRIC, defaultValue = "ncloc", options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric2", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "metric3", type = WidgetPropertyType.METRIC, options = {WidgetConstants.FILTER_OUT_NEW_METRICS}),
+ @WidgetProperty(key = "hideEvents", type = WidgetPropertyType.BOOLEAN),
+ @WidgetProperty(key = "chartHeight", type = WidgetPropertyType.INTEGER, defaultValue = "80")
})
public class TimelineWidget extends CoreWidget {
public TimelineWidget() {
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
index 9a3a2ff7a34..fd19bacb372 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
@@ -52,8 +52,8 @@ module PropertiesHelper
password_field_tag name, value, {:size => options[:size] || 25}.update(html_options)
when PropertyType::TYPE_BOOLEAN
- if options[:default]
- select_options = "<option value='' #{ 'selected' if value.blank? }>#{ options[:default] }</option>"
+ if !options[:default].blank?
+ select_options = "<option value='' #{ 'selected' if value.blank? }>#{ message('default') }</option>"
select_options += "<option value='true' #{ 'selected' if value=='true' }>#{ message('true') }</option>"
select_options += "<option value='false' #{ 'selected' if value=='false' }>#{ message('false') }</option>"
select_tag name, select_options, html_options
@@ -90,11 +90,8 @@ module PropertiesHelper
default_value = options[:default].blank? ? '' : message('default')
select_options = "<option value=''>#{ default_value }</option>"
options[:values].each do |option|
- if screen == SCREEN_WIDGET
- message = message("widget.#{options[:extra_values][:key]}.option.#{name}.#{option}.name", :default => option)
- else
- message = option_name(options[:extra_values][:property], options[:extra_values][:field], option)
- end
+ message = screen == SCREEN_WIDGET ? option_name_with_key(options[:extra_values][:key], nil, option, 'widget') :
+ option_name(options[:extra_values][:property], options[:extra_values][:field], option)
select_options += "<option value='#{ html_escape option }' #{ 'selected' if value && value==option }>#{ message }</option>"
end
select_tag name, select_options, html_options
@@ -135,4 +132,20 @@ module PropertiesHelper
end
end
+ def option_name_with_key(property_key, field_key, option, key_prefix = '')
+ prefix = ''
+ prefix = key_prefix + "." if !key_prefix.blank?
+ if field_key
+ # Old key used for retro-compatibility
+ message = message(prefix +"option.#{property_key}.#{field_key}.#{option}.name", :default => '')
+ message = message(prefix +"property.#{property_key}.#{field_key}.option.#{option}.name", :default => option) unless message != ''
+ message
+ else
+ # Old key used for retro-compatibility
+ message = message(prefix +"option.#{property_key}.#{option}.name", :default => '')
+ message = message(prefix +"property.#{property_key}.option.#{option}.name", :default => option) unless message != ''
+ message
+ end
+ end
+
end
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb
index f019fdc4ff1..e61180f519c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/settings_helper.rb
@@ -45,11 +45,7 @@ module SettingsHelper
end
def option_name(property, field, option)
- if field
- message("option.#{property.key}.#{field.key}.#{option}.name", :default => option)
- else
- message("option.#{property.key}.#{option}.name", :default => option)
- end
+ option_name_with_key(property.key, field ? field.key : nil, option, nil)
end
def category_help(category)
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb
index 93fcc8f30ab..df14ac28ff4 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb
@@ -29,6 +29,7 @@
<%= property_value_field(property_def, widget.property_text_value(property_def.key()), widget) -%>
<div class="form-val-note">
<%
+ # Old key used for retro-compatibility
property_description = message("widget." + widget.key + ".param." + property_def.key(), :default => '')
property_description = message("widget." + widget.key + ".property." + property_def.key() + ".desc", :default => property_def.description()) unless property_description != ''
-%>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb
index f465d0577e5..e1e809eb2b2 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb
@@ -1 +1 @@
-<%= property_input_field(id, PropertyType::TYPE_BOOLEAN, value, PropertiesHelper::SCREEN_SETTINGS, {:id => id, :default => message('default')}) %> \ No newline at end of file
+<%= property_input_field(name, PropertyType::TYPE_BOOLEAN, value, PropertiesHelper::SCREEN_SETTINGS, {:id => id, :default => (defined? defaultValue) ? property.defaultValue : nil }) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
index 01ea42e3c20..d9e9399908d 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
@@ -2,4 +2,4 @@
options = {:id => id}
options[:size] = (defined? size) ? size : 50
%>
-<%= property_input_field(id, PropertyType::TYPE_FLOAT, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
+<%= property_input_field(name, PropertyType::TYPE_FLOAT, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
index 077ff457a3b..79f4a1f6efa 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
@@ -2,4 +2,4 @@
options = {:id => id}
options[:size] = (defined? size) ? size : 50
%>
-<%= property_input_field(id, PropertyType::TYPE_INTEGER, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
+<%= property_input_field(name, PropertyType::TYPE_INTEGER, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb
index 2ac1183619b..4f121917ca4 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb
@@ -1,5 +1,8 @@
+<%
+ defaultValue = (defined? defaultValue) ? property.defaultValue : nil
+%>
<select name="<%= name -%>" id="<%= id -%>">
- <option value=""><%= !property.defaultValue.blank? ? message('default') : nil -%></option>
+ <option value=""><%= !defaultValue.blank? ? message('default') : nil -%></option>
<%
metrics_per_domain={}
metrics_filtered_by(property.options).each do |metric|
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
index f7a94ebda2d..ee7ca50b73a 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
@@ -2,4 +2,4 @@
options = {:id => id}
options[:size] = (defined? size) ? size : 50
%>
-<%= property_input_field(id, PropertyType::TYPE_PASSWORD, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
+<%= property_input_field(name, PropertyType::TYPE_PASSWORD, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb
index 26ef0412fa8..7dececf6629 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb
@@ -2,4 +2,4 @@
options = {:id => id}
options[:size] = (defined? size) ? size : 50
%>
-<%= property_input_field(id, PropertyType::TYPE_REGULAR_EXPRESSION, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
+<%= property_input_field(name, PropertyType::TYPE_REGULAR_EXPRESSION, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb
index 903eb0b119f..3df9028bebe 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb
@@ -2,4 +2,4 @@
options = {:id => id}
options[:size] = (defined? size) ? size : 50
%>
-<%= property_input_field(id, PropertyType::TYPE_STRING, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
+<%= property_input_field(name, PropertyType::TYPE_STRING, value, PropertiesHelper::SCREEN_SETTINGS, options) %> \ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb
index d3e59483f86..ac671bf6915 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb
@@ -2,4 +2,4 @@
options = {:id => id}
options[:cols] = (defined? size) ? size : 50
%>
-<%= property_input_field(id, PropertyType::TYPE_TEXT, value, PropertiesHelper::SCREEN_SETTINGS, {:id => id, :cols => (defined? size) ? size : nil}) %>
+<%= property_input_field(name, PropertyType::TYPE_TEXT, value, PropertiesHelper::SCREEN_SETTINGS, {:id => id, :cols => (defined? size) ? size : nil}) %>