switch from lists to a table

strip prefixes in each section
CSS to follow
This commit is contained in:
zzz
2024-07-12 12:07:56 -04:00
parent 7250ab558c
commit 05706131b9

View File

@@ -52,6 +52,8 @@ public class ConfigAdvancedHelper extends HelperBase {
sorted.putAll(_context.router().getConfigMap());
boolean adv = isAdvanced();
String lastType = null;
if (!adv)
buf.append("<table id=\"advcfgtable\">\n");
for (Map.Entry<String, String> e : sorted.entrySet()) {
String key = e.getKey();
if (!adv) {
@@ -64,23 +66,26 @@ public class ConfigAdvancedHelper extends HelperBase {
if (dot > 0)
type = type.substring(0, dot);
if (!type.equals(lastType)) {
if (lastType != null)
buf.append("</ul>\n");
lastType = type;
String dtype = _headers.get(type);
if (dtype == null)
dtype = type;
buf.append("<h4>").append(_t(dtype)).append("</h4>\n<ul><li>");
} else {
buf.append("<li>");
dtype = DataHelper.escapeHTML(dtype);
buf.append("<tr><th colspan=\"2\">[").append(_t(dtype)).append("]</th></tr>\n");
}
}
String name = DataHelper.escapeHTML(key);
String val = DataHelper.escapeHTML(e.getValue());
buf.append(name).append('=').append(val).append('\n');
if (adv) {
buf.append(name).append('=').append(val).append('\n');
} else {
if (name.length() > lastType.length())
name = name.substring(lastType.length() + 1);
buf.append("<tr><td>").append(name).append("</td><td>").append(val).append("</td></tr>\n");
}
}
if (!adv)
buf.append("</ul>\n");
buf.append("</table>\n");
return buf.toString();
}