Commit 63019649 authored by Ian Green's avatar Ian Green Committed by Guus der Kinderen

OF-35 Improvements to form structure and bug fixes

* Moved detail text to under the field label i.e. left of the field.
* the add user/group text box has been moved to the bottom row of the
  repective table, and table headings have been changed.
* Fixed bug where blank properties were causing empty jids to be populated
  for sysadmins and allowedToCreate on the PubSubModule.
* Fixed bug where options were removed from the forms after users/groups
  were added (options were not being transfered onto the new form).
parent e0957167
...@@ -856,6 +856,7 @@ global.test=Test ...@@ -856,6 +856,7 @@ global.test=Test
global.click_test=Click to test... global.click_test=Click to test...
global.csrf.failed=CSRF Error: No changes made, you'll need to retry. global.csrf.failed=CSRF Error: No changes made, you'll need to retry.
global.update=Update global.update=Update
global.remove=Remove
# Group Chat Service Properties Page # Group Chat Service Properties Page
...@@ -2778,9 +2779,7 @@ pubsub.form.user=User ...@@ -2778,9 +2779,7 @@ pubsub.form.user=User
pubsub.form.not_valid="{0}" is not a valid {1}. pubsub.form.not_valid="{0}" is not a valid {1}.
pubsub.form.already_in_list={0} "{1}" already in list. pubsub.form.already_in_list={0} "{1}" already in list.
pubsub.form.no_data=No values set pubsub.form.action=Action
pubsub.form.add=Add {0}:
# Plugins Admin Page # Plugins Admin Page
......
...@@ -406,7 +406,7 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di ...@@ -406,7 +406,7 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
// Load the list of JIDs that are sysadmins of the PubSub service // Load the list of JIDs that are sysadmins of the PubSub service
String property = JiveGlobals.getProperty("xmpp.pubsub.sysadmin.jid"); String property = JiveGlobals.getProperty("xmpp.pubsub.sysadmin.jid");
String[] jids; String[] jids;
if (property != null) { if (property != null && !property.isEmpty()) {
jids = property.split(","); jids = property.split(",");
for (String jid : jids) { for (String jid : jids) {
sysadmins.add(jid.trim().toLowerCase()); sysadmins.add(jid.trim().toLowerCase());
...@@ -415,7 +415,7 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di ...@@ -415,7 +415,7 @@ public class PubSubModule extends BasicModule implements ServerItemsProvider, Di
nodeCreationRestricted = JiveGlobals.getBooleanProperty("xmpp.pubsub.create.anyone", false); nodeCreationRestricted = JiveGlobals.getBooleanProperty("xmpp.pubsub.create.anyone", false);
// Load the list of JIDs that are allowed to create nodes // Load the list of JIDs that are allowed to create nodes
property = JiveGlobals.getProperty("xmpp.pubsub.create.jid"); property = JiveGlobals.getProperty("xmpp.pubsub.create.jid");
if (property != null) { if (property != null && !property.isEmpty()) {
jids = property.split(","); jids = property.split(",");
for (String jid : jids) { for (String jid : jids) {
allowedToCreate.add(jid.trim().toLowerCase()); allowedToCreate.add(jid.trim().toLowerCase());
......
...@@ -149,40 +149,37 @@ public class PubSubServiceInfo { ...@@ -149,40 +149,37 @@ public class PubSubServiceInfo {
for (FormField field : form.getFields()) { for (FormField field : form.getFields()) {
if (excludedFields == null || !excludedFields.contains(field.getVariable())) { if (excludedFields == null || !excludedFields.contains(field.getVariable())) {
FormField completedField = completedForm.addField(field.getVariable(), field.getLabel(), field.getType());
switch (field.getType()) { switch (field.getType()) {
case boolean_type: case boolean_type:
FormField boolField = completedForm.addField(field.getVariable(), field.getLabel(), completedField.addValue(ParamUtils.getBooleanParameter(request, field.getVariable()));
field.getType());
boolField.addValue(ParamUtils.getBooleanParameter(request, field.getVariable()));
break; break;
case jid_multi: case jid_multi:
FormField multiJidField = completedForm.addField(field.getVariable(), field.getLabel(),
field.getType());
for (String param : ParamUtils.getParameters(request, field.getVariable())) { for (String param : ParamUtils.getParameters(request, field.getVariable())) {
multiJidField.addValue(param); completedField.addValue(param);
} }
break; break;
case list_multi: case list_multi:
FormField multiListField = completedForm.addField(field.getVariable(), field.getLabel(),
field.getType());
for (String param : ParamUtils.getParameters(request, field.getVariable())) { for (String param : ParamUtils.getParameters(request, field.getVariable())) {
multiListField.addValue(param); completedField.addValue(param);
} }
break; break;
case list_single: case list_single:
FormField listField = completedForm.addField(field.getVariable(), field.getLabel(), completedField.addValue(ParamUtils.getParameter(request, field.getVariable()));
field.getType());
listField.addValue(ParamUtils.getParameter(request, field.getVariable()));
break; break;
case text_single: case text_single:
FormField textField = completedForm.addField(field.getVariable(), field.getLabel(), completedField.addValue(ParamUtils.getParameter(request, field.getVariable()));
field.getType());
textField.addValue(ParamUtils.getParameter(request, field.getVariable()));
break; break;
default: default:
completedForm.addField(field.getVariable(), field.getLabel(), field.getType());
break; break;
} }
for(FormField.Option option: field.getOptions()) {
completedField.addOption(option.getLabel(), option.getValue());
}
} }
} }
return completedForm; return completedForm;
......
...@@ -53,29 +53,29 @@ detailPreFix - property prefix for additional detail to be displayed against the ...@@ -53,29 +53,29 @@ detailPreFix - property prefix for additional detail to be displayed against the
<br> <br>
</c:forEach> </c:forEach>
</c:if> </c:if>
<table cellpadding="3" cellspacing="0" border="0" width="100%"> <table cellpadding="3" cellspacing="0" border="0" width="1%">
<tbody> <tbody>
<c:forEach var="field" items="${requestScope.fields}"> <c:forEach var="field" items="${requestScope.fields}">
<c:if <c:if
test="${not requestScope.nonDisplayFields.contains(field.variable)}"> test="${not requestScope.nonDisplayFields.contains(field.variable)}">
<tr> <tr>
<td nowrap width="1%"><label for="${field.variable}">${field.label}</label></td> <td nowrap style="min-width: 300px"><label
style="font-weight: bold" for="${field.variable}">${field.label}</label></td>
<c:set var="isList" <c:set var="isList"
value="${field.type.name() eq 'list_multi' or field.type.name() eq 'jid_multi'}" /> value="${field.type.name() eq 'list_multi' or field.type.name() eq 'jid_multi'}" />
<c:choose> <c:choose>
<c:when test="${field.type.name() eq 'boolean_type'}"> <c:when test="${field.type.name() eq 'boolean_type'}">
<td width="1%" colspan="2"><input type="checkbox" <td width="1%" rowspan="2"><input type="checkbox"
name="${field.variable}" id="${field.variable}" name="${field.variable}" id="${field.variable}"
${field.firstValue == 1 ? 'checked="checked"' : '' } /> ${field.firstValue == 1 ? 'checked="checked"' : '' } /></td>
</td>
</c:when> </c:when>
<c:when test="${field.type.name() eq 'text_single'}"> <c:when test="${field.type.name() eq 'text_single'}">
<td width="1%" colspan="2"><input type="text" <td width="1%" rowspan="2"><input type="text"
name="${field.variable}" id="${field.variable}" name="${field.variable}" id="${field.variable}"
value="${field.firstValue}" style="width: 200px;" /></td> value="${field.firstValue}" style="width: 200px;" /></td>
</c:when> </c:when>
<c:when test="${field.type.name() eq 'list_single'}"> <c:when test="${field.type.name() eq 'list_single'}">
<td width="1%" colspan="2"><select name="${field.variable}" <td width="1%" rowspan="2"><select name="${field.variable}"
id="${field.variable}" style="width: 200px;"> id="${field.variable}" style="width: 200px;">
<c:forEach var="option" items="${field.options}"> <c:forEach var="option" items="${field.options}">
<option value="${option.value}" <option value="${option.value}"
...@@ -86,7 +86,7 @@ detailPreFix - property prefix for additional detail to be displayed against the ...@@ -86,7 +86,7 @@ detailPreFix - property prefix for additional detail to be displayed against the
</select></td> </select></td>
</c:when> </c:when>
<c:when test="${isList and not empty field.options}"> <c:when test="${isList and not empty field.options}">
<td width="1%" colspan="2"><select name="${field.variable}" <td width="1%" rowspan="2"><select name="${field.variable}"
id="${field.variable}" style="width: 200px;" multiple> id="${field.variable}" style="width: 200px;" multiple>
<c:forEach var="option" items="${field.options}"> <c:forEach var="option" items="${field.options}">
<option value="${option.value}" <option value="${option.value}"
...@@ -101,23 +101,18 @@ detailPreFix - property prefix for additional detail to be displayed against the ...@@ -101,23 +101,18 @@ detailPreFix - property prefix for additional detail to be displayed against the
</button></td> </button></td>
</c:when> </c:when>
<c:when test="${isList and empty field.options}"> <c:when test="${isList and empty field.options}">
<td> <td rowspan="2">
<div class="jive-table"> <div class="jive-table">
<table id="${field.variable}" cellpadding="0" cellspacing="0" <table id="${field.variable}" cellpadding="0" cellspacing="0"
border="0" width="100%"> border="0" width="100%">
<thead> <thead>
<tr> <tr>
<th scope="col">value</th> <th scope="col"><fmt:message
<th scope="col">remove</th> key="pubsub.form.${listTypes[field.variable]}" /></th>
<th scope="col"><fmt:message key="pubsub.form.action" /></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<c:if test="${empty field.values}">
<tr>
<td align="center" colspan="2"><fmt:message
key="pubsub.form.no_data" /></td>
</tr>
</c:if>
<c:forEach var="value" items="${field.values}" <c:forEach var="value" items="${field.values}"
varStatus="loop"> varStatus="loop">
<tr id="${field.variable}${loop.index}"> <tr id="${field.variable}${loop.index}">
...@@ -129,23 +124,23 @@ detailPreFix - property prefix for additional detail to be displayed against the ...@@ -129,23 +124,23 @@ detailPreFix - property prefix for additional detail to be displayed against the
</td> </td>
</tr> </tr>
</c:forEach> </c:forEach>
</tbody> <tr>
</table> <td><input type="text" style="width: 200px;"
</div>
</td>
<td><fmt:message var="paramVal"
key="pubsub.form.${listTypes[field.variable]}" /> <fmt:message
key="pubsub.form.add">
<fmt:param value="${paramVal}" />
</fmt:message> <br> <input type="text" size="45"
id="${field.variable}-Additional" id="${field.variable}-Additional"
name="${field.variable}-Additional" name="${field.variable}-Additional"
onkeypress="detect_enter_keyboard(event)" /> <br> <input onkeypress="detect_enter_keyboard(event)" /></td>
type="submit" id="${field.variable}-Add" <td><input type="submit" id="${field.variable}-Add"
name="${field.variable}-Add" name="${field.variable}-Add"
value="<fmt:message key="global.add" />"></td> value="<fmt:message key="global.add" />"></td>
</tr>
</tbody>
</table>
</div>
</td>
</c:when> </c:when>
</c:choose> </c:choose>
</tr>
<tr>
<td><fmt:message var="detail" <td><fmt:message var="detail"
key="${param.detailPreFix}.${fn:substringAfter(field.variable, '#')}" /> key="${param.detailPreFix}.${fn:substringAfter(field.variable, '#')}" />
<c:if test="${not fn:startsWith(detail, '???')}"> <c:if test="${not fn:startsWith(detail, '???')}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment