From: David Gageot Date: Thu, 5 Jul 2012 14:12:53 +0000 (+0200) Subject: SONAR-3432 Add password property type for widgets X-Git-Tag: 3.2~228 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5dd14c4b99364263c1ca0436c8e88ea9e9bdac1a;p=sonarqube.git SONAR-3432 Add password property type for widgets --- 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