use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class VCardModified method addStageInformation.
@Override
protected void addStageInformation(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.form);
form.setTitle("Dispatching a vCard updated event.");
form.addInstruction("Fill out this form to dispatch a vCard updated event.");
FormField field = form.addField();
field.setType(FormField.Type.hidden);
field.setVariable("FORM_TYPE");
field.addValue("http://jabber.org/protocol/admin");
field = form.addField();
field.setType(FormField.Type.text_single);
field.setLabel("The username of the user who's vCard was updated");
field.setVariable("username");
field.setRequired(true);
// Add the form to the command
command.add(form.getElement());
}
use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class GetListGroups method execute.
@Override
public void execute(SessionData data, Element command) {
String start = data.getData().get("start").get(0);
String max_items = data.getData().get("max_items").get(0);
int nStart = 0;
if (start != null) {
try {
nStart = Integer.parseInt(start);
} catch (NumberFormatException e) {
// Do nothing. Assume default value
}
}
int maxItems = 100000;
if (max_items != null && !"none".equals(max_items)) {
try {
maxItems = Integer.parseInt(max_items);
} catch (NumberFormatException e) {
// Do nothing. Assume that all users are being requested
}
}
DataForm form = new DataForm(DataForm.Type.result);
form.addReportedField("name", "Name", FormField.Type.text_single);
form.addReportedField("desc", "Description", FormField.Type.text_multi);
form.addReportedField("count", "User Count", FormField.Type.text_single);
form.addReportedField("shared", "Shared group?", FormField.Type.boolean_type);
form.addReportedField("display", "Display Name", FormField.Type.text_single);
form.addReportedField("visibility", "Visibility", FormField.Type.text_single);
form.addReportedField("groups", "Show group to members' rosters of these groups", FormField.Type.text_multi);
// Add groups to the result
for (Group group : GroupManager.getInstance().getGroups(nStart, maxItems)) {
boolean isSharedGroup = RosterManager.isSharedGroup(group);
Map<String, String> properties = group.getProperties();
Map<String, Object> fields = new HashMap<>();
fields.put("name", group.getName());
fields.put("desc", group.getDescription());
fields.put("count", group.getMembers().size() + group.getAdmins().size());
fields.put("shared", isSharedGroup);
fields.put("display", (isSharedGroup ? properties.get("sharedRoster.displayName") : ""));
String showInRoster = (isSharedGroup ? properties.get("sharedRoster.showInRoster") : "");
if ("onlyGroup".equals(showInRoster) && properties.get("sharedRoster.groupList").trim().length() > 0) {
// Show shared group to other groups
showInRoster = "spefgroups";
}
fields.put("visibility", showInRoster);
fields.put("groups", (isSharedGroup ? properties.get("sharedRoster.groupList") : ""));
form.addItemFields(fields);
}
command.add(form.getElement());
}
use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class AddUser method addStageInformation.
@Override
protected void addStageInformation(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.form);
form.setTitle("Adding a user");
form.addInstruction("Fill out this form to add a user.");
FormField field = form.addField();
field.setType(FormField.Type.hidden);
field.setVariable("FORM_TYPE");
field.addValue("http://jabber.org/protocol/admin");
field = form.addField();
field.setType(FormField.Type.jid_single);
field.setLabel("The Jabber ID for the account to be added");
field.setVariable("accountjid");
field.setRequired(true);
field = form.addField();
field.setType(FormField.Type.text_private);
field.setLabel("The password for this account");
field.setVariable("password");
field = form.addField();
field.setType(FormField.Type.text_private);
field.setLabel("Retype password");
field.setVariable("password-verify");
field = form.addField();
field.setType(FormField.Type.text_single);
field.setLabel("Email address");
field.setVariable("email");
field = form.addField();
field.setType(FormField.Type.text_single);
field.setLabel("Given name");
field.setVariable("given_name");
field = form.addField();
field.setType(FormField.Type.text_single);
field.setLabel("Family name");
field.setVariable("surname");
// Add the form to the command
command.add(form.getElement());
}
use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class ChangeUserPassword method addStageInformation.
@Override
protected void addStageInformation(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.form);
form.setTitle("Changing a User Password");
form.addInstruction("Fill out this form to change a user’s password.");
FormField field = form.addField();
field.setType(FormField.Type.hidden);
field.setVariable("FORM_TYPE");
field.addValue("http://jabber.org/protocol/admin");
field = form.addField();
field.setType(FormField.Type.jid_single);
field.setLabel("The Jabber ID for this account");
field.setVariable("accountjid");
field.setRequired(true);
field = form.addField();
field.setType(FormField.Type.text_private);
field.setLabel("The password for this account");
field.setVariable("password");
field.setRequired(true);
// Add the form to the command
command.add(form.getElement());
}
use of org.xmpp.forms.DataForm in project Openfire by igniterealtime.
the class DeleteUser method addStageInformation.
@Override
protected void addStageInformation(SessionData data, Element command) {
DataForm form = new DataForm(DataForm.Type.form);
form.setTitle("Deleting a user");
form.addInstruction("Fill out this form to delete a user.");
FormField field = form.addField();
field.setType(FormField.Type.hidden);
field.setVariable("FORM_TYPE");
field.addValue("http://jabber.org/protocol/admin");
field = form.addField();
field.setType(FormField.Type.jid_single);
field.setLabel("The Jabber ID for the account to be deleted");
field.setVariable("accountjid");
field.setRequired(true);
// Add the form to the command
command.add(form.getElement());
}
Aggregations