]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3692 Centralize the way widget property and settings property are generated
authorJulien Lancelot <julien.lancelot@gmail.com>
Tue, 22 Jan 2013 18:00:07 +0000 (19:00 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Tue, 22 Jan 2013 18:00:32 +0000 (19:00 +0100)
20 files changed:
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/widgets/TimelineWidget.java
sonar-plugin-api/src/main/java/org/sonar/api/Property.java
sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java
sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetPropertyType.java
sonar-server/src/main/webapp/WEB-INF/app/helpers/properties_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/helpers/rules_configuration_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/helpers/widget_properties_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/models/property_type.rb
sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_widget_properties.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_properties.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_BOOLEAN.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_FLOAT.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_INTEGER.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_METRIC.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_PASSWORD.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_REGULAR_EXPRESSION.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_SINGLE_SELECT_LIST.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_STRING.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/settings/_type_TEXT.html.erb

index 652ea938ff4a72062dd61990a5bc2ff4d13b93d4..eb3f4b05d14d3ce4e0c500f7780b350067dd1820 100644 (file)
@@ -116,389 +116,429 @@ import org.sonar.plugins.core.widgets.reviews.UnplannedReviewsWidget;
 import java.util.List;
 
 @Properties({
-  @Property(
-    key = CoreProperties.SERVER_BASE_URL,
-    defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE,
-    name = "Server base URL",
-    description = "HTTP URL of this Sonar server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.",
-    project = false,
-    global = true,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.LINKS_HOME_PAGE,
-    defaultValue = "",
-    name = "Project Home Page",
-    description = "HTTP URL of the home page of the project.",
-    project = false,
-    global = false,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.LINKS_CI,
-    defaultValue = "",
-    name = "CI server",
-    description = "HTTP URL of the continuous integration server.",
-    project = false,
-    global = false,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.LINKS_ISSUE_TRACKER,
-    defaultValue = "",
-    name = "Issue Tracker",
-    description = "HTTP URL of the issue tracker.",
-    project = false,
-    global = false,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.LINKS_SOURCES,
-    defaultValue = "",
-    name = "SCM server",
-    description = "HTTP URL of the server which hosts the sources of the project.",
-    project = false,
-    global = false,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.LINKS_SOURCES_DEV,
-    defaultValue = "",
-    name = "SCM connection for developers",
-    description = "HTTP URL used by developers to connect to the SCM server for the project.",
-    project = false,
-    global = false,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.PROJECT_LANGUAGE_PROPERTY,
-    defaultValue = Java.KEY,
-    name = "Default language",
-    description = "Default language of the source code to analyse.",
-    project = false,
-    global = true,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY,
-    name = "Global source exclusions",
-    description = "Exclude sources from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.",
-    multiValues = true,
-    category = CoreProperties.CATEGORY_EXCLUSIONS),
-  @Property(
-    key = CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY,
-    name = "Global test exclusions",
-    description = "Exclude tests from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.",
-    multiValues = true,
-    category = CoreProperties.CATEGORY_EXCLUSIONS,
-    defaultValue = CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT),
-  @Property(
-    key = CoreProperties.PROJECT_EXCLUSIONS_PROPERTY,
-    name = "Exclusions",
-    description = "Exclude sources from code analysis. Changes will be applied during next code analysis.",
-    project = true,
-    global = true,
-    multiValues = true,
-    category = CoreProperties.CATEGORY_EXCLUSIONS),
-  @Property(
-    key = CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY,
-    name = "Test Exclusions",
-    description = "Exclude tests from code analysis. Changes will be applied during next code analysis.",
-    project = true,
-    global = true,
-    multiValues = true,
-    category = CoreProperties.CATEGORY_EXCLUSIONS),
-  @Property(
-    key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY,
-    defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE,
-    name = "Import sources",
-    description = "Set to false if sources should not be displayed, e.g. for security reasons.",
-    project = true,
-    module = true,
-    global = true,
-    category = CoreProperties.CATEGORY_SECURITY,
-    type = PropertyType.BOOLEAN),
-  @Property(
-    key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY,
-    defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE,
-    name = "Tendency period",
-    description = TendencyDecorator.PROP_DAYS_DESCRIPTION,
-    project = false,
-    global = true,
-    category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS,
-    type = PropertyType.INTEGER),
-  @Property(
-    key = CoreProperties.SKIP_TENDENCIES_PROPERTY,
-    defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE,
-    name = "Skip tendencies",
-    description = "Skip calculation of measure tendencies",
-    project = true,
-    module = false,
-    global = true,
-    category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS,
-    type = PropertyType.BOOLEAN),
-  @Property(
-    key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY,
-    name = "Exclude modules",
-    description = "Maven artifact ids of modules to exclude.",
-    project = true,
-    global = false,
-    multiValues = true,
-    category = CoreProperties.CATEGORY_EXCLUSIONS),
-  @Property(
-    key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY,
-    defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE,
-    name = "Force user authentication",
-    description = "Forcing user authentication stops un-logged users to access Sonar.",
-    project = false,
-    global = true,
-    category = CoreProperties.CATEGORY_SECURITY,
-    type = PropertyType.BOOLEAN),
-  @Property(
-    key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY,
-    defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE,
-    name = "Allow users to sign up online",
-    description = "Users can sign up online.",
-    project = false,
-    global = true,
-    category = CoreProperties.CATEGORY_SECURITY,
-    type = PropertyType.BOOLEAN),
-  @Property(
-    key = CoreProperties.CORE_DEFAULT_GROUP,
-    defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE,
-    name = "Default user group",
-    description = "Any new users will automatically join this group.",
-    project = false,
-    global = true,
-    category = CoreProperties.CATEGORY_SECURITY),
-  @Property(
-    key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY,
-    defaultValue = "en",
-    name = "Locale used for violation messages",
-    description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property",
-    project = true,
-    global = true,
-    category = CoreProperties.CATEGORY_L10N),
-  @Property(
-    key = "sonar.timemachine.period1",
-    name = "Period 1",
-    description = "Period used to compare measures and track new violations. Values are : <ul class='bullet'><li>Number of days before " +
-      "analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, for example 2010-12-25</li><li>'previous_analysis' to " +
-      "compare to previous analysis</li><li>'previous_version' to compare to the previous version in the project history</li></ul>" +
-      "<p>When specifying a number of days or a date, the snapshot selected for comparison is " +
-      " the first one available inside the corresponding time range. </p>" +
-      "<p>Changing this property only takes effect after subsequent project inspections.<p/>",
-    project = false,
-    global = true,
-    defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1,
-    category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
-  @Property(
-    key = "sonar.timemachine.period2",
-    name = "Period 2",
-    description = "See the property 'Period 1'",
-    project = false,
-    global = true,
-    defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2,
-    category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
-  @Property(
-    key = "sonar.timemachine.period3",
-    name = "Period 3",
-    description = "See the property 'Period 1'",
-    project = false,
-    global = true,
-    defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3,
-    category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
-  @Property(
-    key = "sonar.timemachine.period4",
-    name = "Period 4",
-    description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " +
-      "<ul class='bullet'><li>Number of days before analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, " +
-      "for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li>" +
-      "<li>'previous_version' to compare to the previous version in the project history</li><li>A version, for example 1.2</li></ul>" +
-      "<p>When specifying a number of days or a date, the snapshot selected for comparison is the first one available inside the corresponding time range. </p>" +
-      "<p>Changing this property only takes effect after subsequent project inspections.<p/>",
-    project = true,
-    global = false,
-    defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4,
-    category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
-  @Property(
-    key = "sonar.timemachine.period5",
-    name = "Period 5",
-    description = "See the property 'Period 4'",
-    project = true,
-    global = false,
-    defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5,
-    category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
-  @Property(
-    key = CoreProperties.DRY_RUN,
-    defaultValue = "false",
-    name = "Dry Run",
-    type = PropertyType.BOOLEAN,
-    global = false, project = false,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.DRY_RUN_INCLUDE_PLUGINS,
-    name = "Plugins accepted for dry run",
-    defaultValue = CoreProperties.DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE,
-    global = true, project = false,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS,
-    name = "Plugins excluded for dry run",
-    global = true, project = false,
-    defaultValue = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE,
-    category = CoreProperties.CATEGORY_GENERAL),
-  @Property(
-    key = "sonar.dryRun.export.path",
-    defaultValue = "dryRun.json",
-    name = "Dry Run Results Export File",
-    type = PropertyType.STRING,
-    global = false, project = false),
+    @Property(
+        key = CoreProperties.SERVER_BASE_URL,
+        defaultValue = CoreProperties.SERVER_BASE_URL_DEFAULT_VALUE,
+        name = "Server base URL",
+        description = "HTTP URL of this Sonar server, such as <i>http://yourhost.yourdomain/sonar</i>. This value is used i.e. to create links in emails.",
+        project = false,
+        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",
+        description = "HTTP URL of the home page of the project.",
+        project = false,
+        global = false,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = CoreProperties.LINKS_CI,
+        defaultValue = "",
+        name = "CI server",
+        description = "HTTP URL of the continuous integration server.",
+        project = false,
+        global = false,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = CoreProperties.LINKS_ISSUE_TRACKER,
+        defaultValue = "",
+        name = "Issue Tracker",
+        description = "HTTP URL of the issue tracker.",
+        project = false,
+        global = false,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = CoreProperties.LINKS_SOURCES,
+        defaultValue = "",
+        name = "SCM server",
+        description = "HTTP URL of the server which hosts the sources of the project.",
+        project = false,
+        global = false,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = CoreProperties.LINKS_SOURCES_DEV,
+        defaultValue = "",
+        name = "SCM connection for developers",
+        description = "HTTP URL used by developers to connect to the SCM server for the project.",
+        project = false,
+        global = false,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = CoreProperties.PROJECT_LANGUAGE_PROPERTY,
+        defaultValue = Java.KEY,
+        name = "Default language",
+        description = "Default language of the source code to analyse.",
+        project = false,
+        global = true,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = CoreProperties.GLOBAL_EXCLUSIONS_PROPERTY,
+        name = "Global source exclusions",
+        description = "Exclude sources from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.",
+        multiValues = true,
+        category = CoreProperties.CATEGORY_EXCLUSIONS),
+    @Property(
+        key = CoreProperties.GLOBAL_TEST_EXCLUSIONS_PROPERTY,
+        name = "Global test exclusions",
+        description = "Exclude tests from code analysis. Applies to every project. Cannot be overriden. Changes will be applied during next code analysis.",
+        multiValues = true,
+        category = CoreProperties.CATEGORY_EXCLUSIONS,
+        defaultValue = CoreProperties.GLOBAL_TEST_EXCLUSIONS_DEFAULT),
+    @Property(
+        key = CoreProperties.PROJECT_EXCLUSIONS_PROPERTY,
+        name = "Exclusions",
+        description = "Exclude sources from code analysis. Changes will be applied during next code analysis.",
+        project = true,
+        global = true,
+        multiValues = true,
+        category = CoreProperties.CATEGORY_EXCLUSIONS),
+    @Property(
+        key = CoreProperties.PROJECT_TEST_EXCLUSIONS_PROPERTY,
+        name = "Test Exclusions",
+        description = "Exclude tests from code analysis. Changes will be applied during next code analysis.",
+        project = true,
+        global = true,
+        multiValues = true,
+        category = CoreProperties.CATEGORY_EXCLUSIONS),
+    @Property(
+        key = CoreProperties.CORE_IMPORT_SOURCES_PROPERTY,
+        defaultValue = "" + CoreProperties.CORE_IMPORT_SOURCES_DEFAULT_VALUE,
+        name = "Import sources",
+        description = "Set to false if sources should not be displayed, e.g. for security reasons.",
+        project = true,
+        module = true,
+        global = true,
+        category = CoreProperties.CATEGORY_SECURITY,
+        type = PropertyType.BOOLEAN),
+    @Property(
+        key = CoreProperties.CORE_TENDENCY_DEPTH_PROPERTY,
+        defaultValue = "" + CoreProperties.CORE_TENDENCY_DEPTH_DEFAULT_VALUE,
+        name = "Tendency period",
+        description = TendencyDecorator.PROP_DAYS_DESCRIPTION,
+        project = false,
+        global = true,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS,
+        type = PropertyType.INTEGER),
+    @Property(
+        key = CoreProperties.SKIP_TENDENCIES_PROPERTY,
+        defaultValue = "" + CoreProperties.SKIP_TENDENCIES_DEFAULT_VALUE,
+        name = "Skip tendencies",
+        description = "Skip calculation of measure tendencies",
+        project = true,
+        module = false,
+        global = true,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS,
+        type = PropertyType.BOOLEAN),
+    @Property(
+        key = CoreProperties.CORE_SKIPPED_MODULES_PROPERTY,
+        name = "Exclude modules",
+        description = "Maven artifact ids of modules to exclude.",
+        project = true,
+        global = false,
+        multiValues = true,
+        category = CoreProperties.CATEGORY_EXCLUSIONS),
+    @Property(
+        key = CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY,
+        defaultValue = "" + CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE,
+        name = "Force user authentication",
+        description = "Forcing user authentication stops un-logged users to access Sonar.",
+        project = false,
+        global = true,
+        category = CoreProperties.CATEGORY_SECURITY,
+        type = PropertyType.BOOLEAN),
+    @Property(
+        key = CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_PROPERTY,
+        defaultValue = "" + CoreProperties.CORE_ALLOW_USERS_TO_SIGNUP_DEAULT_VALUE,
+        name = "Allow users to sign up online",
+        description = "Users can sign up online.",
+        project = false,
+        global = true,
+        category = CoreProperties.CATEGORY_SECURITY,
+        type = PropertyType.BOOLEAN),
+    @Property(
+        key = CoreProperties.CORE_DEFAULT_GROUP,
+        defaultValue = CoreProperties.CORE_DEFAULT_GROUP_DEFAULT_VALUE,
+        name = "Default user group",
+        description = "Any new users will automatically join this group.",
+        project = false,
+        global = true,
+        category = CoreProperties.CATEGORY_SECURITY),
+    @Property(
+        key = CoreProperties.CORE_VIOLATION_LOCALE_PROPERTY,
+        defaultValue = "en",
+        name = "Locale used for violation messages",
+        description = "Locale to be used when generating violation messages. It's up to each rule engine to support this global internationalization property",
+        project = true,
+        global = true,
+        category = CoreProperties.CATEGORY_L10N),
+    @Property(
+        key = "sonar.timemachine.period1",
+        name = "Period 1",
+        description = "Period used to compare measures and track new violations. Values are : <ul class='bullet'><li>Number of days before " +
+            "analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, for example 2010-12-25</li><li>'previous_analysis' to " +
+            "compare to previous analysis</li><li>'previous_version' to compare to the previous version in the project history</li></ul>" +
+            "<p>When specifying a number of days or a date, the snapshot selected for comparison is " +
+            " the first one available inside the corresponding time range. </p>" +
+            "<p>Changing this property only takes effect after subsequent project inspections.<p/>",
+        project = false,
+        global = true,
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
+    @Property(
+        key = "sonar.timemachine.period2",
+        name = "Period 2",
+        description = "See the property 'Period 1'",
+        project = false,
+        global = true,
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
+    @Property(
+        key = "sonar.timemachine.period3",
+        name = "Period 3",
+        description = "See the property 'Period 1'",
+        project = false,
+        global = true,
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
+    @Property(
+        key = "sonar.timemachine.period4",
+        name = "Period 4",
+        description = "Period used to compare measures and track new violations. This property is specific to the project. Values are : " +
+            "<ul class='bullet'><li>Number of days before analysis, for example 5.</li><li>A custom date. Format is yyyy-MM-dd, " +
+            "for example 2010-12-25</li><li>'previous_analysis' to compare to previous analysis</li>" +
+            "<li>'previous_version' to compare to the previous version in the project history</li><li>A version, for example 1.2</li></ul>" +
+            "<p>When specifying a number of days or a date, the snapshot selected for comparison is the first one available inside the corresponding time range. </p>" +
+            "<p>Changing this property only takes effect after subsequent project inspections.<p/>",
+        project = true,
+        global = false,
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
+    @Property(
+        key = "sonar.timemachine.period5",
+        name = "Period 5",
+        description = "See the property 'Period 4'",
+        project = true,
+        global = false,
+        defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5,
+        category = CoreProperties.CATEGORY_DIFFERENTIAL_VIEWS),
+    @Property(
+        key = CoreProperties.DRY_RUN,
+        defaultValue = "false",
+        name = "Dry Run",
+        type = PropertyType.BOOLEAN,
+        global = false, project = false,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = CoreProperties.DRY_RUN_INCLUDE_PLUGINS,
+        name = "Plugins accepted for dry run",
+        defaultValue = CoreProperties.DRY_RUN_INCLUDE_PLUGINS_DEFAULT_VALUE,
+        global = true, project = false,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS,
+        name = "Plugins excluded for dry run",
+        global = true, project = false,
+        defaultValue = CoreProperties.DRY_RUN_EXCLUDE_PLUGINS_DEFAULT_VALUE,
+        category = CoreProperties.CATEGORY_GENERAL),
+    @Property(
+        key = "sonar.dryRun.export.path",
+        defaultValue = "dryRun.json",
+        name = "Dry Run Results Export File",
+        type = PropertyType.STRING,
+        global = false, project = false),
 
-  // SERVER-SIDE TECHNICAL PROPERTIES
+    // SERVER-SIDE TECHNICAL PROPERTIES
 
-  @Property(
-    key = "sonar.security.realm",
-    name = "Security Realm",
-    project = false,
-    global = false
-  ),
-  @Property(
-    key = "sonar.security.savePassword",
-    name = "Save external password",
-    project = false,
-    global = false
-  ),
-  @Property(
-    key = "sonar.authenticator.downcase",
-    name = "Downcase login",
-    description = "Downcase login during user authentication, typically for Active Directory",
-    project = false,
-    global = false,
-    defaultValue = "false",
-    type = PropertyType.BOOLEAN),
-  @Property(
-    key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS,
-    name = "Create user accounts",
-    description = "Create accounts when authenticating users via an external system",
-    project = false,
-    global = false,
-    defaultValue = "true",
-    type = PropertyType.BOOLEAN),
-  @Property(
-    key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE,
-    name = "Ignore failures during authenticator startup",
-    defaultValue = "false",
-    project = false,
-    global = false,
-    type = PropertyType.BOOLEAN)
+    @Property(
+        key = "sonar.security.realm",
+        name = "Security Realm",
+        project = false,
+        global = false
+    ),
+    @Property(
+        key = "sonar.security.savePassword",
+        name = "Save external password",
+        project = false,
+        global = false
+    ),
+    @Property(
+        key = "sonar.authenticator.downcase",
+        name = "Downcase login",
+        description = "Downcase login during user authentication, typically for Active Directory",
+        project = false,
+        global = false,
+        defaultValue = "false",
+        type = PropertyType.BOOLEAN),
+    @Property(
+        key = CoreProperties.CORE_AUTHENTICATOR_CREATE_USERS,
+        name = "Create user accounts",
+        description = "Create accounts when authenticating users via an external system",
+        project = false,
+        global = false,
+        defaultValue = "true",
+        type = PropertyType.BOOLEAN),
+    @Property(
+        key = CoreProperties.CORE_AUTHENTICATOR_IGNORE_STARTUP_FAILURE,
+        name = "Ignore failures during authenticator startup",
+        defaultValue = "false",
+        project = false,
+        global = false,
+        type = PropertyType.BOOLEAN)
 })
 public final class CorePlugin extends SonarPlugin {
 
   @SuppressWarnings("unchecked")
   public List getExtensions() {
     return ImmutableList.of(
-      DefaultResourceTypes.class,
-      UserManagedMetrics.class,
-      ProjectFileSystemLogger.class,
-      Periods.class,
+        DefaultResourceTypes.class,
+        UserManagedMetrics.class,
+        ProjectFileSystemLogger.class,
+        Periods.class,
 
-      // maven
-      MavenInitializer.class,
+        // maven
+        MavenInitializer.class,
 
-      // languages
-      Java.class,
+        // languages
+        Java.class,
 
-      // pages
-      Lcom4Viewer.class,
-      TestsViewer.class,
+        // pages
+        Lcom4Viewer.class,
+        TestsViewer.class,
 
-      // measure filters
-      ProjectFilter.class,
-      MyFavouritesFilter.class,
+        // measure filters
+        ProjectFilter.class,
+        MyFavouritesFilter.class,
 
-      // widgets
-      AlertsWidget.class,
-      CoverageWidget.class,
-      ItCoverageWidget.class,
-      CommentsDuplicationsWidget.class,
-      DescriptionWidget.class,
-      ComplexityWidget.class,
-      RulesWidget.class,
-      SizeWidget.class,
-      EventsWidget.class,
-      CustomMeasuresWidget.class,
-      TimelineWidget.class,
-      TimeMachineWidget.class,
-      HotspotMetricWidget.class,
-      HotspotMostViolatedResourcesWidget.class,
-      HotspotMostViolatedRulesWidget.class,
-      MyReviewsWidget.class,
-      ProjectReviewsWidget.class,
-      FalsePositiveReviewsWidget.class,
-      ReviewsPerDeveloperWidget.class,
-      PlannedReviewsWidget.class,
-      UnplannedReviewsWidget.class,
-      ActionPlansWidget.class,
-      ReviewsMetricsWidget.class,
-      TreemapWidget.class,
-      MeasureFilterListWidget.class,
-      MeasureFilterTreemapWidget.class,
-      WelcomeWidget.class,
+        // widgets
+        AlertsWidget.class,
+        CoverageWidget.class,
+        ItCoverageWidget.class,
+        CommentsDuplicationsWidget.class,
+        DescriptionWidget.class,
+        ComplexityWidget.class,
+        RulesWidget.class,
+        SizeWidget.class,
+        EventsWidget.class,
+        CustomMeasuresWidget.class,
+        TimelineWidget.class,
+        TimeMachineWidget.class,
+        HotspotMetricWidget.class,
+        HotspotMostViolatedResourcesWidget.class,
+        HotspotMostViolatedRulesWidget.class,
+        MyReviewsWidget.class,
+        ProjectReviewsWidget.class,
+        FalsePositiveReviewsWidget.class,
+        ReviewsPerDeveloperWidget.class,
+        PlannedReviewsWidget.class,
+        UnplannedReviewsWidget.class,
+        ActionPlansWidget.class,
+        ReviewsMetricsWidget.class,
+        TreemapWidget.class,
+        MeasureFilterListWidget.class,
+        MeasureFilterTreemapWidget.class,
+        WelcomeWidget.class,
 
-      // dashboards
-      ProjectDefaultDashboard.class,
-      ProjectHotspotDashboard.class,
-      ProjectReviewsDashboard.class,
-      ProjectTimeMachineDashboard.class,
-      GlobalDefaultDashboard.class,
+        // dashboards
+        ProjectDefaultDashboard.class,
+        ProjectHotspotDashboard.class,
+        ProjectReviewsDashboard.class,
+        ProjectTimeMachineDashboard.class,
+        GlobalDefaultDashboard.class,
 
-      // chart
-      XradarChart.class,
-      DistributionBarChart.class,
-      DistributionAreaChart.class,
+        // chart
+        XradarChart.class,
+        DistributionBarChart.class,
+        DistributionAreaChart.class,
 
-      // colorizers
-      JavaColorizerFormat.class,
+        // colorizers
+        JavaColorizerFormat.class,
 
-      // batch
-      ProfileSensor.class,
-      ProfileEventsSensor.class,
-      ProjectLinksSensor.class,
-      UnitTestDecorator.class,
-      VersionEventsSensor.class,
-      CheckAlertThresholds.class,
-      GenerateAlertEvents.class,
-      ViolationsDecorator.class,
-      WeightedViolationsDecorator.class,
-      ViolationsDensityDecorator.class,
-      LineCoverageDecorator.class,
-      CoverageDecorator.class,
-      BranchCoverageDecorator.class,
-      ItLineCoverageDecorator.class,
-      ItCoverageDecorator.class,
-      ItBranchCoverageDecorator.class,
-      OverallLineCoverageDecorator.class,
-      OverallCoverageDecorator.class,
-      OverallBranchCoverageDecorator.class,
-      ApplyProjectRolesDecorator.class,
-      ExcludedResourceFilter.class,
-      CommentDensityDecorator.class,
-      NoSonarFilter.class,
-      DirectoriesDecorator.class,
-      FilesDecorator.class,
-      ReviewNotifications.class,
-      ReviewWorkflowDecorator.class,
-      ReferenceAnalysis.class,
-      ManualMeasureDecorator.class,
-      ManualViolationInjector.class,
-      ViolationSeverityUpdater.class,
-      IndexProjectPostJob.class,
-      ReviewsMeasuresDecorator.class,
+        // batch
+        ProfileSensor.class,
+        ProfileEventsSensor.class,
+        ProjectLinksSensor.class,
+        UnitTestDecorator.class,
+        VersionEventsSensor.class,
+        CheckAlertThresholds.class,
+        GenerateAlertEvents.class,
+        ViolationsDecorator.class,
+        WeightedViolationsDecorator.class,
+        ViolationsDensityDecorator.class,
+        LineCoverageDecorator.class,
+        CoverageDecorator.class,
+        BranchCoverageDecorator.class,
+        ItLineCoverageDecorator.class,
+        ItCoverageDecorator.class,
+        ItBranchCoverageDecorator.class,
+        OverallLineCoverageDecorator.class,
+        OverallCoverageDecorator.class,
+        OverallBranchCoverageDecorator.class,
+        ApplyProjectRolesDecorator.class,
+        ExcludedResourceFilter.class,
+        CommentDensityDecorator.class,
+        NoSonarFilter.class,
+        DirectoriesDecorator.class,
+        FilesDecorator.class,
+        ReviewNotifications.class,
+        ReviewWorkflowDecorator.class,
+        ReferenceAnalysis.class,
+        ManualMeasureDecorator.class,
+        ManualViolationInjector.class,
+        ViolationSeverityUpdater.class,
+        IndexProjectPostJob.class,
+        ReviewsMeasuresDecorator.class,
 
-      // time machine
-      TendencyDecorator.class,
-      VariationDecorator.class,
-      ViolationTrackingDecorator.class,
-      ViolationPersisterDecorator.class,
-      NewViolationsDecorator.class,
-      TimeMachineConfigurationPersister.class,
-      NewCoverageFileAnalyzer.class,
-      NewItCoverageFileAnalyzer.class,
-      NewOverallCoverageFileAnalyzer.class,
-      NewCoverageAggregator.class);
+        // time machine
+        TendencyDecorator.class,
+        VariationDecorator.class,
+        ViolationTrackingDecorator.class,
+        ViolationPersisterDecorator.class,
+        NewViolationsDecorator.class,
+        TimeMachineConfigurationPersister.class,
+        NewCoverageFileAnalyzer.class,
+        NewItCoverageFileAnalyzer.class,
+        NewOverallCoverageFileAnalyzer.class,
+        NewCoverageAggregator.class);
   }
 }
index 25d19a9f7405ba02754f4f719aebaa1c82709d72..930e5b02dfbeab7ae546094779a38fcc34a53b8b 100644 (file)
@@ -26,12 +26,31 @@ import org.sonar.api.web.WidgetPropertyType;
 
 @WidgetCategory("History")
 @WidgetProperties({
-  @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")
+  @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")
 })
 public class TimelineWidget extends CoreWidget {
   public TimelineWidget() {
index 4802b6fe2514604ecd202fc5693a045517405e31..8d3a370ad15add32aacc5a6c1fd1cbf57af26478 100644 (file)
@@ -89,6 +89,7 @@ public @interface Property {
    * Options for *_LIST types
    *
    * @since 3.0  Options for property of type PropertyType.SINGLE_SELECT_LIST</code>
+   * For example {"property_1", "property_3", "property_3"}).
    *
    * @since 3.3  Options for property of type PropertyType.METRIC</code>.
    * If no option is specified, any metric will match.
index 90fe3ea39fe634ce5d77a1243079bf0391f98a24..f646a7822f9f62f340d794a66857001a2a73067c 100644 (file)
@@ -39,7 +39,7 @@ public @interface WidgetProperty {
   boolean optional() default true;
 
   /**
-   * Options for property of type WidgetPropertyType.METRIC</code>.
+   * @since 3.3  Options for property of type WidgetPropertyType.METRIC</code>.
    *
    * If no option is specified, any metric will match.
    * If options are specified, all must match for the metric to be displayed.
@@ -48,7 +48,9 @@ public @interface WidgetProperty {
    * For example <code>type:INT,FLOAT</code> will match any metric of type <code>INT</code> or <code>FLOAT</code>.
    * For example <code>type:NUMERIC</code> will match any metric of numerictype.
    *
-   * @since 3.3
+   * @since 3.5  Options for property of type WidgetPropertyType.SINGLE_SELECT_LIST</code>
+   * For example {"property_1", "property_3", "property_3"}).
+   *
    */
   String[] options() default {};
 }
index edff6ee319fbc55f05033aeb9093e7a5d80815c0..2b64edfd085201cc21dbb17bad2394643a03f2a4 100644 (file)
@@ -73,5 +73,12 @@ public enum WidgetPropertyType {
    *
    * @since 3.2
    */
-  REGULAR_EXPRESSION
+  REGULAR_EXPRESSION,
+
+  /**
+   * Single select list with a list of options
+   *
+   * @since 3.5
+   */
+  SINGLE_SELECT_LIST
 }
index 2524b27bf20a4bf3c7faa041de64921478bf8b71..9a3a2ff7a34809e62e6925c299ab8fafe9d8ae7b 100644 (file)
 #
 module PropertiesHelper
 
-  # html_options support :
-  # :html_id - the id of the generated HTML element
-  #
-  def property_input_field(key, type, value, options, html_options = {})
-    if type==PropertyType::TYPE_STRING
-      text_field_tag key, value, {:size => 25}.update(html_options)
-
-    elsif type==PropertyType::TYPE_TEXT
-      text_area_tag key, value, {:rows => '6', :style => 'width: 100%'}.update(html_options)
-
-    elsif type==PropertyType::TYPE_PASSWORD
-      password_field_tag key, value, {:size => 25}.update(html_options)
-
-    elsif type==PropertyType::TYPE_BOOLEAN
-      (hidden_field_tag key, 'false', html_options) + (check_box_tag key, 'true', value=='true', html_options)
-
-    elsif type==PropertyType::TYPE_INTEGER
-      text_field_tag key, value, {:size => 10}.update(html_options)
-
-    elsif type==PropertyType::TYPE_FLOAT
-      text_field_tag key, value, {:size => 10}.update(html_options)
-
-    elsif type==PropertyType::TYPE_METRIC
-      metric_select_tag key, metrics_filtered_by(options), {:selected_key => value, :allow_empty => true}.update(html_options)
+  SCREEN_SETTINGS = 'SETTINGS'
+  SCREEN_WIDGET = 'WIDGET'
+  SCREEN_RULES = 'RULES'
 
-    elsif type==PropertyType::TYPE_REGULAR_EXPRESSION
-      text_field_tag key, value, {:size => 25}.update(html_options)
-
-    elsif type==PropertyType::TYPE_FILTER
-      user_filters = options_id(value, current_user.measure_filters)
-      shared_filters = options_id(value, MeasureFilter.find(:all, :conditions => ['(user_id<>? or user_id is null) and shared=?', current_user.id, true]).sort_by(&:name))
-
-      filters_combo = select_tag key, option_group('My Filters', user_filters) + option_group('Shared Filters', shared_filters), html_options
-      filter_link = link_to message('widget.filter.edit'), {:controller => 'measures', :action => 'manage'}, :class => 'link-action'
-
-      "#{filters_combo} #{filter_link}"
-
-    else
-      hidden_field_tag key, html_options
+  #
+  # screen is SETTINGS, WIDGET or RULES
+  # ==== Options
+  # * <tt>:id</tt> - html id to use if the name should not be used
+  # * <tt>:size</tt>
+  # * <tt>:values</tt> - list of values for metric and single select list
+  # * <tt>:default</tt> - default value
+  # * <tt>:disabled</tt>
+  # * <tt>:extra_values</tt>
+  #
+  def property_input_field(name, type, value, screen, options = {})
+
+    html_options = {:id => options[:id] || name}
+    html_options[:disabled] = 'disabled' if options[:disabled]
+
+    case type
+
+      when PropertyType::TYPE_STRING
+        text_field_tag name, value, {:size => options[:size] || 25}.update(html_options)
+
+      when PropertyType::TYPE_TEXT
+        cols = options[:size] || nil
+        html_class = options[:size].nil? ? ' width100' : ''
+        text_area_tag name, value, {:class => html_class, :rows => '5', :cols => cols}.update(html_options)
+
+      when PropertyType::TYPE_PASSWORD
+        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>"
+          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
+        else
+          (hidden_field_tag name, 'false', html_options) + (check_box_tag name, 'true', value=='true', html_options)
+        end
+
+      when PropertyType::TYPE_INTEGER
+        size = options[:size] || 10
+        text_field_tag name, value, {:size => size}.update(html_options)
+
+      when PropertyType::TYPE_FLOAT
+        size = options[:size] || 10
+        text_field_tag name, value, {:size => size}.update(html_options)
+
+      when PropertyType::TYPE_METRIC
+        metric_select_tag name, metrics_filtered_by(options[:values]), {:html_id => options[:id], :selected_key => value, :allow_empty => true,
+                                                                        :placeholder => !options[:default].blank? ?  message('default') : nil}
+
+      when PropertyType::TYPE_REGULAR_EXPRESSION
+        size = options[:size] || 25
+        text_field_tag name, value, {:size => size}.update(html_options)
+
+      when PropertyType::TYPE_FILTER
+        user_filters = options_id(value, current_user.measure_filters)
+        shared_filters = options_id(value, MeasureFilter.find(:all, :conditions => ['(user_id<>? or user_id is null) and shared=?', current_user.id, true]).sort_by(&:name))
+
+        filters_combo = select_tag name, option_group('My Filters', user_filters) + option_group('Shared Filters', shared_filters), html_options
+        filter_link = link_to message('widget.filter.edit'), {:controller => 'measures', :action => 'manage'}, :class => 'link-action'
+
+        "#{filters_combo} #{filter_link}"
+
+      when PropertyType::TYPE_SINGLE_SELECT_LIST
+        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
+          select_options += "<option value='#{ html_escape option }' #{ 'selected' if value && value==option }>#{ message }</option>"
+        end
+        select_tag name, select_options, html_options
+
+      else
+        hidden_field_tag id, html_options
     end
   end
 
index 8f797bcd9fd6118c9d07126d8b2ea4f00590c1e0..3ec0ee1aafd0c4a85225e7762e893359d85431ff 100644 (file)
@@ -49,8 +49,8 @@ module RulesConfigurationHelper
 
   def param_value_input(parameter, value, options = {})
     type=type_with_compatibility(parameter.param_type)
-
-    property_input_field 'value', type, value, nil, {:id => parameter.id}.update(options)
+    name = options[:name] || 'value'
+    property_input_field name, type, value, 'WIDGET', {:id => parameter.id, :size => options[:size] }.update(options)
   end
 
   def is_set(type)
index a6e161cecdbdc786a49da731c759f92dddd8d572..53dd397cbfd7678f145066cba385c6b38877c620 100644 (file)
@@ -21,8 +21,10 @@ module WidgetPropertiesHelper
   include PropertiesHelper
 
   def property_value_field(definition, value, widget)
-    property_input_field definition.key, definition.type.name, value.nil? ? definition.defaultValue : value, definition.options,
-                         {:html_id => "prop-#{widget.id}-#{widget.key.parameterize}-#{definition.key.parameterize}"}
+    id = definition.type.name != PropertyType::TYPE_METRIC ? definition.key : "prop-#{widget.id}-#{widget.key.parameterize}-#{definition.key.parameterize}"
+    options = {:values => definition.options, :id => id, :default => definition.defaultValue}
+    options[:extra_values] = {:key => widget.key} if definition.type.name == PropertyType::TYPE_SINGLE_SELECT_LIST
+    property_input_field definition.key, definition.type.name, value, 'WIDGET', options
   end
 
 end
index 8fcb9f06da39b6f17069954e606a7229f10c9181..0ef74a897b89c322e728c5d52a23115e9b804868 100644 (file)
@@ -24,7 +24,7 @@ class PropertyType
   TYPE_BOOLEAN = 'BOOLEAN'
   TYPE_INTEGER = 'INTEGER'
   TYPE_FLOAT = 'FLOAT'
-  #TYPE_SINGLE_SELECT_LIST = 'SINGLE_SELECT_LIST'
+  TYPE_SINGLE_SELECT_LIST = 'SINGLE_SELECT_LIST'
   TYPE_METRIC = 'METRIC'
   TYPE_LICENSE = 'LICENSE'
   TYPE_REGULAR_EXPRESSION = 'REGULAR_EXPRESSION'
index c903a8b2c8a193b1fd71dc1e084a2c3d2180110f..93fcc8f30abac7c9a16e690d36497eb52b4ca173 100644 (file)
                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 != ''
             -%>
-            <%= property_description -%>
+
+            <% unless property_description.blank? -%>
+              <div><%= property_description -%></div>
+            <% end %>
+            <% unless property_def.defaultValue.blank? -%>
+              <div><%= message('default') %>:: <%= property_def.type.name == PropertyType::TYPE_PASSWORD ? '********' : h(property_def.defaultValue) -%></div>
+            <% end -%>
           </div>
         </td>
       </tr>
index fed0c43bc2b8e8f7a1d228e3d835acacc54fc50a..f18db1161ff1381d18ad8a0581123c2b67a51df8 100644 (file)
@@ -44,7 +44,7 @@
 
             <% default_prop_value = (@resource ? Property.value(property.key, nil, property.defaultValue) : property.defaultValue) -%>
             <% unless default_prop_value.blank? -%>
-              <div class="note">Default: <%= property.type.to_s=='PASSWORD' ? '********' : h(default_prop_value) -%></div>
+              <div class="note"><%= message('default') %>: <%= property.type.to_s=='PASSWORD' ? '********' : h(default_prop_value) -%></div>
             <% end -%>
           </td>
         </tr>
index 117cf3b912771c629819af3c53b2d20ad86e8580..f465d0577e5c221bf17a8764b0b5010c830a88e2 100644 (file)
@@ -1,5 +1 @@
-<select name="<%= name -%>" id="<%= id -%>">
-  <option value="" <%= 'selected' if value.blank? -%>><%= message('default') -%></option>
-  <option value="true" <%= 'selected' if value=='true' -%>><%= message('true') -%></option>
-  <option value="false" <%= 'selected' if value=='false' -%>><%= message('false') -%></option>
-</select>
\ No newline at end of file
+<%= property_input_field(id, PropertyType::TYPE_BOOLEAN, value, PropertiesHelper::SCREEN_SETTINGS, {:id => id, :default => message('default')}) %>
\ No newline at end of file
index 80bad33688044b74e560c0d9cb00c73d773be41d..01ea42e3c208b638361be527de1211b459fb35dd 100644 (file)
@@ -1 +1,5 @@
-<input type="text" name="<%= name -%>" value="<%= h value if value -%>" size="<%= (defined? size) ? size : 50 -%>" id="<%= id -%>"/>
\ No newline at end of file
+<%
+   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
index ea7d4d7d8e774b8f9d10a4978148fdd8dee59539..077ff457a3b97d30aa5b2d4c696f2399c76aeeb4 100644 (file)
@@ -1 +1,5 @@
-<input type="text" name="<%= name -%>" value="<%= h value if value -%>" size="<%= (defined? size) ? size : 50 -%>" id="<%= id-%>"/>
\ No newline at end of file
+<%
+   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
index d06c87e3272ea1d2d93b90bf81cfa376bf83a569..2ac1183619bc669ad059ae52880ab8c89e7b3702 100644 (file)
@@ -1,5 +1,5 @@
 <select name="<%= name -%>" id="<%= id -%>">
-  <option value=""><%= message('default') -%></option>
+  <option value=""><%= !property.defaultValue.blank? ? message('default') : nil -%></option>
   <%
      metrics_per_domain={}
      metrics_filtered_by(property.options).each do |metric|
index 919ff05bd61dba78528d400425c7b037c19e8fbe..f7a94ebda2d64e033f04efb59e62ef376793a3c5 100644 (file)
@@ -1 +1,5 @@
-<input type="password" name="<%= name -%>" value="<%= h value if value -%>" size="<%= defined? size ? size : 50-%>" id="<%= id -%>"/>
\ No newline at end of file
+<%
+   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
index 80bad33688044b74e560c0d9cb00c73d773be41d..26ef0412fa816908d5cb3d8e0d0c702d42935821 100644 (file)
@@ -1 +1,5 @@
-<input type="text" name="<%= name -%>" value="<%= h value if value -%>" size="<%= (defined? size) ? size : 50 -%>" id="<%= id -%>"/>
\ No newline at end of file
+<%
+   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
index 2737ec732fc9355290fcc7dc5ac8c919bb364555..9dbeac7a2b50bbd7d9998022c5f3d2d6d4a5f7e6 100644 (file)
@@ -1,6 +1,2 @@
-<select name="<%= name -%>" id="<%= id -%>">
-  <option value=""><%= message('default') -%></option>
-  <% property.options.each do |option| %>
-    <option value="<%= h option -%>" <%= 'selected' if value && value==option -%>><%= option_name(property, field, option) -%></option>
-  <% end %>
-</select>
\ No newline at end of file
+<%= property_input_field(name, PropertyType::TYPE_SINGLE_SELECT_LIST, value, PropertiesHelper::SCREEN_SETTINGS,
+                          {:id => id, :default => property.defaultValue, :values => property.options, :extra_values => {:property => property, :field => field}}) %>
\ No newline at end of file
index 80bad33688044b74e560c0d9cb00c73d773be41d..903eb0b119f1baf1b20babaae11fd0cb4e693e20 100644 (file)
@@ -1 +1,5 @@
-<input type="text" name="<%= name -%>" value="<%= h value if value -%>" size="<%= (defined? size) ? size : 50 -%>" id="<%= id -%>"/>
\ No newline at end of file
+<%
+   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
index 414175775dc7d24704eb20d8fca158939c3ceffd..d3e59483f860dffef52410d23dd65b726d9dd83f 100644 (file)
@@ -1 +1,5 @@
-<textarea rows="5" cols="<%= (defined? size) ? size : 80 -%>" class="<%= (defined? size) ? '' : 'width100' -%>" name="<%= name -%>" id="<%= id -%>"><%= h value if value -%></textarea>
\ No newline at end of file
+<%
+   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}) %>