phoneValue = request.getParameter("phone");
// DIVISION: eperson-edit
Division edit = body.addInteractiveDivision("eperson-edit",contextPath+"/admin/epeople",Division.METHOD_POST,"primary administrative eperson");
edit.setHead(T_head1);
if (errors.contains("eperson_email_key")) {
Para problem = edit.addPara();
problem.addHighlight("bold").addContent(T_email_taken);
}
List identity = edit.addList("form",List.TYPE_FORM);
identity.setHead(T_head2.parameterize(eperson.getFullName()));
if (admin)
{
Text email = identity.addItem().addText("email_address");
email.setRequired();
email.setLabel(T_email_address);
email.setValue(emailValue);
if (errors.contains("eperson_email_key"))
email.addError(T_error_email_unique);
else if (errors.contains("email_address"))
email.addError(T_error_email);
}
else
{
identity.addLabel(T_email_address);
identity.addItem(emailValue);
}
if (admin)
{
Text firstName = identity.addItem().addText("first_name");
firstName.setRequired();
firstName.setLabel(T_first_name);
firstName.setValue(firstValue);
if (errors.contains("first_name"))
firstName.addError(T_error_fname);
}
else
{
identity.addLabel(T_first_name);
identity.addItem(firstValue);
}
if (admin)
{
Text lastName = identity.addItem().addText("last_name");
lastName.setRequired();
lastName.setLabel(T_last_name);
lastName.setValue(lastValue);
if (errors.contains("last_name"))
lastName.addError(T_error_lname);
}
else
{
identity.addLabel(T_last_name);
identity.addItem(lastValue);
}
if (admin)
{
Text phone = identity.addItem().addText("phone");
phone.setLabel(T_telephone);
phone.setValue(phoneValue);
}
else
{
identity.addLabel(T_telephone);
identity.addItem(phoneValue);
}
if (admin)
{
// Administrative options:
CheckBox canLogInField = identity.addItem().addCheckBox("can_log_in");
canLogInField.setLabel(T_can_log_in);
canLogInField.addOption(canLogInValue, "true");
CheckBox certificateField = identity.addItem().addCheckBox("certificate");
certificateField.setLabel(T_req_certs);
certificateField.addOption(certificatValue,"true");
// Buttons to reset, delete or login as
identity.addItem().addHighlight("italic").addContent(T_special_help);
Item special = identity.addItem();
special.addButton("submit_reset_password").setValue(T_submit_reset_password);
Button submitDelete = special.addButton("submit_delete");
submitDelete.setValue(T_submit_delete);
Button submitLoginAs = special.addButton("submit_login_as");
submitLoginAs.setValue(T_submit_login_as);
if (!ConfigurationManager.getBooleanProperty("xmlui.user.assumelogin", false))
submitLoginAs.setDisabled();
if (deleteConstraints != null && deleteConstraints.size() > 0)
{
submitDelete.setDisabled();
Highlight hi = identity.addItem("eperson-delete-constraint","eperson-delete-constraint").addHighlight("error");
hi.addContent(T_delete_constraint);
hi.addContent(" ");
for (String constraint : deleteConstraints)
{
int idx = deleteConstraints.indexOf(constraint);
if (idx > 0 && idx == deleteConstraints.size() -1 )
{
hi.addContent(", ");
hi.addContent(T_constraint_last_conjunction);
hi.addContent(" ");
}
else if (idx > 0)
hi.addContent(", ");
if ("item".equals(constraint))
hi.addContent(T_constraint_item);
else if ("workflowitem".equals(constraint))
hi.addContent(T_constraint_workflowitem);
else if ("tasklistitem".equals(constraint))
hi.addContent(T_constraint_tasklistitem);
else
hi.addContent(T_constraint_unknown);
}
hi.addContent(".");
}
}
Item buttons = identity.addItem();
if (admin)
buttons.addButton("submit_save").setValue(T_submit_save);
buttons.addButton("submit_cancel").setValue(T_submit_cancel);
if (admin)
{
List member = edit.addList("eperson-member-of");
member.setHead(T_member_head);
Group[] groups = Group.allMemberGroups(context, eperson);
for (Group group : groups)
{
String url = contextPath + "/admin/groups?administrative-continue="+knot.getId()+"&submit_edit_group&groupID="+group.getID();
Item item = member.addItem();
item.addXref(url,group.getName());
// Check if this membership is via another group or not, if so then add a note.
Group via = findViaGroup(eperson, group);
if (via != null)
item.addHighlight("fade").addContent(T_indirect_member.parameterize(via.getName()));
}
if (groups.length <= 0)
member.addItem().addHighlight("italic").addContent(T_member_none);
}
edit.addHidden("administrative-continue").setValue(knot.getId());
}