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);