From 5dd14c4b99364263c1ca0436c8e88ea9e9bdac1a Mon Sep 17 00:00:00 2001 From: David Gageot Date: Thu, 5 Jul 2012 16:12:53 +0200 Subject: [PATCH] SONAR-3432 Add password property type for widgets --- .../main/java/org/sonar/api/web/WidgetPropertyType.java | 7 ++++++- .../main/webapp/WEB-INF/app/helpers/properties_helper.rb | 7 ++++++- .../src/main/webapp/WEB-INF/app/models/property_type.rb | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java index 5d333988554..bf095c46c67 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java @@ -59,5 +59,10 @@ public enum WidgetPropertyType { * * @since 3.2 */ - TEXT + TEXT, + + /** + * Variation of {#STRING} with masked characters + */ + PASSWORD } 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 c203272c239..cf5c2fcb6b3 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 @@ -21,6 +21,7 @@ module PropertiesHelper def property_value_field(definition, value) val=value || definition.defaultValue() + if definition.type.name()==PropertyType::TYPE_INTEGER text_field_tag definition.key(), val, :size => 10 @@ -47,7 +48,11 @@ module PropertiesHelper elsif definition.type.name()==PropertyType::TYPE_TEXT text_area_tag definition.key(), val, :size => '40x6' - else + + elsif definition.type.name()==PropertyType::TYPE_PASSWORD + password_field_tag definition.key(), val, :size => 10 + + else hidden_field_tag definition.key() end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb index c5227fff69d..9a9cd071e8c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb @@ -25,6 +25,7 @@ class PropertyType TYPE_METRIC = 'METRIC' TYPE_FILTER = 'FILTER' TYPE_TEXT = 'TEXT' + TYPE_PASSWORD = 'PASSWORD' def self.text_to_value(text, type) case type -- 2.39.5