# LICENSES & SERVER KEY CONFIGURATION
#
#------------------------------------------------------------------------------
-property.category.Licenses=Licenses
-property.category.Licenses.description=In case of any issue or question about licenses, please send an email to contact@sonarsource.com.
-property.category.Licenses.server_id=Server ID
+property.category.licenses=Licenses
+property.category.licenses.description=In case of any issue or question about licenses, please send an email to contact@sonarsource.com.
+property.category.licenses.server_id=Server ID
server_id_configuration.generate_button=Generate ID
server_id_configuration.generating_button=Generating ID...
server_id_configuration.bad_key=The ID is not valid anymore. Please check the organisation and the IP address.
*/
String CATEGORY_EXCLUSIONS = "exclusions";
+ /**
+ * @since 3.7
+ */
+ String CATEGORY_LICENSES = "licenses";
+
/* Global settings */
String SONAR_HOME = "SONAR_HOME";
String PROJECT_BRANCH_PROPERTY = "sonar.branch";
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.config;
+
+import org.apache.commons.lang.StringUtils;
+
+import java.util.Locale;
+
+/**
+ * @since 3.7
+ */
+public class Category {
+
+ private final String originalKey;
+ private final boolean special;
+
+ public Category(String originalKey) {
+ this(originalKey, false);
+ }
+
+ Category(String originalKey, boolean special) {
+ this.originalKey = originalKey;
+ this.special = special;
+ }
+
+ public String originalKey() {
+ return originalKey;
+ }
+
+ public String key() {
+ return StringUtils.lowerCase(originalKey, Locale.ENGLISH);
+ }
+
+ public boolean isSpecial() {
+ return special;
+ }
+
+ @Override
+ public int hashCode() {
+ return key().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Category)) {
+ return false;
+ }
+ return StringUtils.equalsIgnoreCase(((Category) obj).originalKey, this.originalKey);
+ }
+
+ @Override
+ public String toString() {
+ return this.originalKey;
+ }
+
+}
import com.google.common.collect.Maps;
import org.apache.commons.lang.StringUtils;
import org.sonar.api.BatchComponent;
+import org.sonar.api.CoreProperties;
import org.sonar.api.Properties;
import org.sonar.api.Property;
import org.sonar.api.ServerComponent;
public final class PropertyDefinitions implements BatchComponent, ServerComponent {
private final Map<String, PropertyDefinition> definitions = Maps.newHashMap();
- private final Map<String, String> categories = Maps.newHashMap();
- private final Map<String, String> subcategories = Maps.newHashMap();
+ private final Map<String, Category> categories = Maps.newHashMap();
+ private final Map<String, SubCategory> subcategories = Maps.newHashMap();
// deprecated key -> new key
private final Map<String, String> deprecatedKeys = Maps.newHashMap();
if (!definitions.containsKey(definition.key())) {
definitions.put(definition.key(), definition);
String category = StringUtils.defaultIfBlank(definition.category(), defaultCategory);
- categories.put(definition.key(), category);
- subcategories.put(definition.key(), StringUtils.defaultIfBlank(definition.subCategory(), category));
+ categories.put(definition.key(), new Category(category));
+ String subcategory = StringUtils.defaultIfBlank(definition.subCategory(), category);
+ subcategories.put(definition.key(), new SubCategory(subcategory));
if (!Strings.isNullOrEmpty(definition.deprecatedKey()) && !definition.deprecatedKey().equals(definition.key())) {
deprecatedKeys.put(definition.deprecatedKey(), definition.key());
}
/**
* @since 3.6
+ * @deprecated since 3.7 use {@link #propertiesByCategory(String)}
*/
+ @Deprecated
public Map<String, Map<String, Collection<PropertyDefinition>>> getPropertiesByCategory(@Nullable String qualifier) {
Map<String, Map<String, Collection<PropertyDefinition>>> byCategory = new HashMap<String, Map<String, Collection<PropertyDefinition>>>();
return byCategory;
}
+ /**
+ * @since 3.6
+ * @deprecated since 3.7 use {@link #propertiesByCategory(String)}
+ */
+ @Deprecated
public Map<String, Map<String, Collection<PropertyDefinition>>> getPropertiesByCategory() {
return getPropertiesByCategory(null);
}
+ /**
+ * @since 3.7
+ */
+ public Map<Category, Map<SubCategory, Collection<PropertyDefinition>>> propertiesByCategory(@Nullable String qualifier) {
+ Map<Category, Map<SubCategory, Collection<PropertyDefinition>>> byCategory = new HashMap<Category, Map<SubCategory, Collection<PropertyDefinition>>>();
+ if (qualifier == null) {
+ // Special categories on global page
+ byCategory.put(new Category("email", true), new HashMap<SubCategory, Collection<PropertyDefinition>>());
+ byCategory.put(new Category("encryption", true), new HashMap<SubCategory, Collection<PropertyDefinition>>());
+ HashMap<SubCategory, Collection<PropertyDefinition>> licenseSubCategories = new HashMap<SubCategory, Collection<PropertyDefinition>>();
+ licenseSubCategories.put(new SubCategory("server_id", true), new ArrayList<PropertyDefinition>());
+ byCategory.put(new Category(CoreProperties.CATEGORY_LICENSES, false), licenseSubCategories);
+ }
+ for (PropertyDefinition definition : getAll()) {
+ if (qualifier == null ? definition.global() : definition.qualifiers().contains(qualifier)) {
+ Category category = categories.get(definition.key());
+ if (!byCategory.containsKey(category)) {
+ byCategory.put(category, new HashMap<SubCategory, Collection<PropertyDefinition>>());
+ }
+ SubCategory subCategory = subcategories.get(definition.key());
+ if (!byCategory.get(category).containsKey(subCategory)) {
+ byCategory.get(category).put(subCategory, new ArrayList<PropertyDefinition>());
+ }
+ byCategory.get(category).get(subCategory).add(definition);
+ }
+ }
+
+ return byCategory;
+ }
+
public String getDefaultValue(String key) {
PropertyDefinition def = get(key);
if (def == null) {
}
public String getCategory(String key) {
- return categories.get(validKey(key));
+ return categories.get(validKey(key)).toString();
}
public String getSubCategory(String key) {
- return subcategories.get(validKey(key));
+ return subcategories.get(validKey(key)).toString();
}
public String getCategory(Property prop) {
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.config;
+
+/**
+ * @since 3.7
+ */
+public class SubCategory extends Category {
+
+ public SubCategory(String originalKey) {
+ super(originalKey);
+ }
+
+ SubCategory(String originalKey, boolean special) {
+ super(originalKey, special);
+ }
+
+}
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2013 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.api.config;
+
+import org.junit.Test;
+
+import static org.fest.assertions.Assertions.assertThat;
+
+public class CategoryTest {
+
+ @Test
+ public void category_key_is_case_insentive() {
+ assertThat(new Category("Licenses")).isEqualTo(new Category("licenses"));
+ }
+
+ @Test
+ public void should_preserve_original_key() {
+ assertThat(new Category("Licenses").originalKey()).isEqualTo("Licenses");
+ }
+}
@Test
public void should_build_with_predefined_list_of_definitions() {
List<PropertyDefinition> list = Arrays.asList(
- PropertyDefinition.builder("foo").name("Foo").build(),
- PropertyDefinition.builder("one").name("One").build(),
- PropertyDefinition.builder("two").name("Two").defaultValue("2").build()
- );
+ PropertyDefinition.builder("foo").name("Foo").build(),
+ PropertyDefinition.builder("one").name("One").build(),
+ PropertyDefinition.builder("two").name("Two").defaultValue("2").build()
+ );
PropertyDefinitions def = new PropertyDefinitions(list);
assertProperties(def);
@Test
public void should_inspect_plugin_objects() {
PropertyDefinitions def = new PropertyDefinitions(
- PropertyDefinition.builder("foo").name("Foo").build(),
- PropertyDefinition.builder("one").name("One").build(),
- PropertyDefinition.builder("two").name("Two").defaultValue("2").build()
+ PropertyDefinition.builder("foo").name("Foo").build(),
+ PropertyDefinition.builder("one").name("One").build(),
+ PropertyDefinition.builder("two").name("Two").defaultValue("2").build()
);
assertProperties(def);
@Test
public void test_categories() {
PropertyDefinitions def = new PropertyDefinitions(
- PropertyDefinition.builder("inCateg").name("In Categ").category("categ").build(),
- PropertyDefinition.builder("noCateg").name("No categ").build()
+ PropertyDefinition.builder("inCateg").name("In Categ").category("categ").build(),
+ PropertyDefinition.builder("noCateg").name("No categ").build()
);
assertThat(def.getCategory("inCateg")).isEqualTo("categ");
assertThat(def.getCategory("noCateg")).isEqualTo("default");
}
+ @Test
+ public void should_return_special_categories() {
+ PropertyDefinitions def = new PropertyDefinitions();
+
+ assertThat(def.propertiesByCategory(null).keySet()).containsOnly(new Category("encryption"), new Category("email"), new Category("licenses"));
+ assertThat(def.propertiesByCategory(null).keySet().iterator().next().isSpecial()).isTrue();
+ assertThat(def.propertiesByCategory(null).get(new Category("licenses")).keySet()).containsOnly(new SubCategory("server_id"));
+ assertThat(def.propertiesByCategory(null).get(new Category("licenses")).keySet().iterator().next().isSpecial()).isTrue();
+ }
+
@Test
public void should_group_by_category() {
PropertyDefinitions def = new PropertyDefinitions(
- PropertyDefinition.builder("global1").name("Global1").category("catGlobal1").build(),
- PropertyDefinition.builder("global2").name("Global2").category("catGlobal1").build(),
- PropertyDefinition.builder("global3").name("Global3").category("catGlobal2").build(),
- PropertyDefinition.builder("project").name("Project").category("catProject").onlyOnQualifiers(Qualifiers.PROJECT).build(),
- PropertyDefinition.builder("module").name("Module").category("catModule").onlyOnQualifiers(Qualifiers.MODULE).build(),
- PropertyDefinition.builder("view").name("View").category("catView").onlyOnQualifiers(Qualifiers.VIEW).build()
+ PropertyDefinition.builder("global1").name("Global1").category("catGlobal1").build(),
+ PropertyDefinition.builder("global2").name("Global2").category("catGlobal1").build(),
+ PropertyDefinition.builder("global3").name("Global3").category("catGlobal2").build(),
+ PropertyDefinition.builder("project").name("Project").category("catProject").onlyOnQualifiers(Qualifiers.PROJECT).build(),
+ PropertyDefinition.builder("module").name("Module").category("catModule").onlyOnQualifiers(Qualifiers.MODULE).build(),
+ PropertyDefinition.builder("view").name("View").category("catView").onlyOnQualifiers(Qualifiers.VIEW).build()
);
assertThat(def.getPropertiesByCategory(null).keySet()).containsOnly("catGlobal1", "catGlobal2");
assertThat(def.getPropertiesByCategory(Qualifiers.MODULE).keySet()).containsOnly("catModule");
assertThat(def.getPropertiesByCategory(Qualifiers.VIEW).keySet()).containsOnly("catView");
assertThat(def.getPropertiesByCategory("Unkown").keySet()).isEmpty();
+
+ assertThat(def.propertiesByCategory(null).keySet()).containsOnly(new Category("encryption"), new Category("email"), new Category("licenses"), new Category("catGlobal1"),
+ new Category("catGlobal2"));
+ assertThat(def.propertiesByCategory(Qualifiers.PROJECT).keySet()).containsOnly(new Category("catProject"));
+ assertThat(def.propertiesByCategory(Qualifiers.MODULE).keySet()).containsOnly(new Category("catModule"));
+ assertThat(def.propertiesByCategory(Qualifiers.VIEW).keySet()).containsOnly(new Category("catView"));
+ assertThat(def.propertiesByCategory("Unkown").keySet()).isEmpty();
}
@Test
public void should_group_by_subcategory() {
PropertyDefinitions def = new PropertyDefinitions(
- PropertyDefinition.builder("global1").name("Global1").category("catGlobal1").subCategory("sub1").build(),
- PropertyDefinition.builder("global2").name("Global2").category("catGlobal1").subCategory("sub2").build(),
- PropertyDefinition.builder("global3").name("Global3").category("catGlobal1").build(),
- PropertyDefinition.builder("global4").name("Global4").category("catGlobal2").build()
+ PropertyDefinition.builder("global1").name("Global1").category("catGlobal1").subCategory("sub1").build(),
+ PropertyDefinition.builder("global2").name("Global2").category("catGlobal1").subCategory("sub2").build(),
+ PropertyDefinition.builder("global3").name("Global3").category("catGlobal1").build(),
+ PropertyDefinition.builder("global4").name("Global4").category("catGlobal2").build()
);
assertThat(def.getPropertiesByCategory(null).get("catGlobal1").keySet()).containsOnly("catGlobal1", "sub1", "sub2");
assertThat(def.getPropertiesByCategory(null).get("catGlobal2").keySet()).containsOnly("catGlobal2");
+
+ assertThat(def.propertiesByCategory(null).get(new Category("catGlobal1")).keySet()).containsOnly(new SubCategory("catGlobal1"), new SubCategory("sub1"),
+ new SubCategory("sub2"));
+ assertThat(def.propertiesByCategory(null).get(new Category("catGlobal2")).keySet()).containsOnly(new SubCategory("catGlobal2"));
}
@Test
assertThat(def.getPropertiesByCategory().keySet()).containsOnly("catGlobal1", "catGlobal2");
assertThat(def.getPropertiesByCategory(Qualifiers.PROJECT).keySet()).containsOnly("catProject");
assertThat(def.getPropertiesByCategory(Qualifiers.MODULE).keySet()).containsOnly("catModule");
+
+ assertThat(def.propertiesByCategory(null).keySet()).containsOnly(new Category("encryption"), new Category("email"), new Category("licenses"), new Category("catglobal1"),
+ new Category("catglobal2"));
+ assertThat(def.propertiesByCategory(Qualifiers.PROJECT).keySet()).containsOnly(new Category("catproject"));
+ assertThat(def.propertiesByCategory(Qualifiers.MODULE).keySet()).containsOnly(new Category("catmodule"));
}
private void assertProperties(PropertyDefinitions definitions) {
end
def category_name(category)
- message("property.category.#{category}", :default => category)
+ # Try with lowercase key then with original key for backward compatibility
+ message("property.category.#{category.key}", :default => message("property.category.#{category.originalKey}", :default => category.originalKey))
end
def subcategory_name(category, subcategory)
- message("property.category.#{category}.#{subcategory}", :default => subcategory)
+ if (category.key == subcategory.key)
+ # If subcategory == category then it is the default one
+ category_name(category)
+ else
+ # Try with lowercase key then with original key for backward compatibility
+ message("property.category.#{category.key}.#{subcategory.key}",
+ :default => message("property.category.#{category.originalKey}.#{subcategory.originalKey}", :default => subcategory.originalKey))
+ end
+ end
+
+ def processProperties(definitions_per_category)
+ @categories = by_category_name(definitions_per_category.keys)
+
+ default_category = @categories.empty? ? nil : @categories[0]
+
+ if params[:category].nil?
+ default_category = @categories.empty? ? nil : @categories[0]
+ @category = default_category
+ else
+ @category = @categories.select {|c| c == Java::OrgSonarApiConfig::Category.new(params[:category])}.first
+ not_found('category') if @category.nil?
+ end
+
+ unless @category.isSpecial then
+ @subcategories_per_categories = {}
+ definitions_per_category.each {|category, definitions_per_subcategories| @subcategories_per_categories.store(category, by_subcategory_name(category, definitions_per_subcategories.keys)) }
+
+ if params[:subcategory].nil?
+ default_subcategory =
+ @subcategories_per_categories[@category].nil? ? nil :
+ ((@subcategories_per_categories[@category].include? @category) ? @category : @subcategories_per_categories[@category][0])
+ @subcategory = default_subcategory
+ else
+ @subcategory = @subcategories_per_categories[@category].select {|s| s == Java::OrgSonarApiConfig::SubCategory.new(params[:subcategory])}.first
+ not_found('subcategory') if @subcategory.nil?
+ end
+
+ @definitions = definitions_per_category[@category] || {}
+ @definitions = @definitions[@subcategory] || []
+ end
end
end
@resource = get_current_project(params[:id])
@snapshot = @resource.last_snapshot
- if @resource && !java_facade.getResourceTypeBooleanProperty(@resource.qualifier, 'configurable')
+ if !java_facade.getResourceTypeBooleanProperty(@resource.qualifier, 'configurable')
redirect_to :action => 'index', :id => params[:id]
end
- definitions_per_category = java_facade.propertyDefinitions.getPropertiesByCategory(@resource ? @resource.qualifier : nil)
- @categories = definitions_per_category.keys || []
- @categories = by_category_name(@categories)
-
- default_category = nil
- default_category = @categories[0] if !@categories.empty?
- @category = params[:category] || default_category
-
- not_found('category') unless @categories.include? @category
-
- @subcategories_per_categories = {}
- definitions_per_category.each {|category, definitions_per_subcategories| @subcategories_per_categories.store(category, by_subcategory_name(category, definitions_per_subcategories.keys)) }
-
- default_subcategory =
- @subcategories_per_categories[@category].nil? ? nil :
- ((@subcategories_per_categories[@category].include? @category) ? @category : @subcategories_per_categories[@category][0])
- @subcategory = params[:subcategory] || default_subcategory
-
- @definitions = definitions_per_category[@category] || {}
- @definitions = @definitions[@subcategory] || []
+ definitions_per_category = java_facade.propertyDefinitions.propertiesByCategory(@resource.qualifier)
+ processProperties(definitions_per_category)
end
def update_version
SECTION=Navigation::SECTION_CONFIGURATION
- LICENSES_CATEGORY='Licenses'
- SERVER_ID_SUBCATEGORY='server_id'
- SPECIAL_CATEGORIES=%w(email encryption) + [LICENSES_CATEGORY]
-
-
verify :method => :post, :only => %w(update), :redirect_to => {:action => :index}
before_filter :admin_required, :only => %w(index)
end
def load_properties
- definitions_per_category = java_facade.propertyDefinitions.getPropertiesByCategory(@resource ? @resource.qualifier : nil)
- @categories = definitions_per_category.keys + SPECIAL_CATEGORIES
- @categories = by_category_name(@categories.uniq)
-
- default_category = @categories.empty? ? nil : @categories[0]
- @category = params[:category] || default_category
-
- not_found('category') unless @categories.include? @category
-
- @subcategories_per_categories = {}
- definitions_per_category.each {|category, definitions_per_subcategories| @subcategories_per_categories.store(category, by_subcategory_name(category, definitions_per_subcategories.keys)) }
-
- if (@subcategories_per_categories[LICENSES_CATEGORY].nil?)
- @subcategories_per_categories.store(LICENSES_CATEGORY, [SERVER_ID_SUBCATEGORY])
- else
- @subcategories_per_categories[LICENSES_CATEGORY].push(SERVER_ID_SUBCATEGORY)
- end
-
- default_subcategory =
- @subcategories_per_categories[@category].nil? ? nil :
- ((@subcategories_per_categories[@category].include? @category) ? @category : @subcategories_per_categories[@category][0])
- @subcategory = params[:subcategory] || default_subcategory
-
- @definitions = definitions_per_category[@category] || {}
- @definitions = @definitions[@subcategory] || []
+ definitions_per_category = java_facade.propertyDefinitions.propertiesByCategory(nil)
+ processProperties(definitions_per_category)
end
+
end
include PropertiesHelper
def category_name(category)
- message("property.category.#{category}", :default => category)
+ # Try with lowercase key then with original key for backward compatibility
+ message("property.category.#{category.key}", :default => message("property.category.#{category.originalKey}", :default => category.originalKey))
end
def subcategory_name(category, subcategory)
- if (category == subcategory)
+ if (category.key == subcategory.key)
# If subcategory == category then it is the default one
category_name(category)
else
- message("property.category.#{category}.#{subcategory}", :default => subcategory)
+ # Try with lowercase key then with original key for backward compatibility
+ message("property.category.#{category.key}.#{subcategory.key}",
+ :default => message("property.category.#{category.originalKey}.#{subcategory.originalKey}", :default => subcategory.originalKey))
end
end
end
def category_desc(category)
- message("property.category.#{category}.description", :default => '')
+ message("property.category.#{category.key}.description", :default => '')
end
def subcategory_desc(category, subcategory)
- message("property.category.#{category}.#{subcategory}.description", :default => '')
+ message("property.category.#{category.key}.#{subcategory.key}.description", :default => '')
end
def property_value(property)
-<% if SettingsController::SPECIAL_CATEGORIES.include?(@category) && @category != SettingsController::LICENSES_CATEGORY -%>
- <%= render 'special', :url => url_for(:controller => "#{@category}_configuration") -%>
+<% if @category.isSpecial -%>
+ <%= render 'special', :url => url_for(:controller => "#{@category.key}_configuration") -%>
<% else -%>
- <% form_remote_tag :url => {:controller => 'settings', :action => 'update', :category => @category, :subcategory => @subcategory, :resource_id => @resource ? @resource.id : nil},
+ <% form_remote_tag :url => {:controller => 'settings', :action => 'update', :category => @category.key, :subcategory => @subcategory.key, :resource_id => @resource ? @resource.id : nil},
:method => :post,
:before => "$('submit_settings').hide();$('loading_settings').show();",
:update => 'properties',
<ul class="tabs2">
<% subcategories.each do |subcategory| -%>
<li>
- <%= link_to subcategory_name(@category, subcategory), {:controller => @resource ? 'project' : 'settings', :action => @resource ? 'settings' : 'index', :category => @category, :subcategory => subcategory, :id => @resource ? @resource.id : nil}, :class => @subcategory==subcategory ? 'selected' : nil -%>
+ <%= link_to subcategory_name(@category, subcategory), {:controller => @resource ? 'project' : 'settings', :action => @resource ? 'settings' : 'index', :category => @category.key, :subcategory => subcategory.key, :id => @resource ? @resource.id : nil}, :class => @subcategory==subcategory ? 'selected' : nil -%>
</li>
<% end -%>
</ul>
- <% if @category == SettingsController::LICENSES_CATEGORY && @subcategory == SettingsController::SERVER_ID_SUBCATEGORY %>
- <%= render 'special', :url => url_for(:controller => "#{SettingsController::SERVER_ID_SUBCATEGORY}_configuration") -%>
+ <% if @subcategory.isSpecial %>
+ <%= render 'special', :url => url_for(:controller => "#{@subcategory.key}_configuration") -%>
<% else %>
<table class="data marginbottom10">
<thead>
- <% if @subcategory == @category && !category_desc(@category).blank? -%>
+ <% if @subcategory.key == @category.key && !category_desc(@category).blank? -%>
<tr>
<td class="categoryDescription"><%= category_desc(@category) -%> </td>
</tr>
<% end -%>
- <% if @subcategory != @category && !subcategory_desc(@category, @subcategory).blank? -%>
+ <% if @subcategory.key != @category.key && !subcategory_desc(@category, @subcategory).blank? -%>
<tr>
<td><%= subcategory_desc(@category, @subcategory) -%> </td>
</tr>
</thead>
<tbody>
<% @categories.each do |category| -%>
- <tr id="select_<%= category -%>" class="select <%= cycle('even', 'odd', :name => 'category') -%> <%= 'selected' if @category==category -%>">
- <td class="category"><%= link_to category_name(category), :category => category -%></td>
+ <tr id="select_<%= category.key -%>" class="select <%= cycle('even', 'odd', :name => 'category') -%> <%= 'selected' if @category.key==category.key -%>">
+ <td class="category"><%= link_to category_name(category), :category => category.key -%></td>
</tr>
<% end -%>
</tbody>