use of org.apache.openmeetings.web.common.ComunityUserForm in project openmeetings by apache.
the class UserForm method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
add(password.setResetPassword(false).setLabel(Model.of(getString("110"))).setRequired(false).add(passValidator = new StrongPasswordValidator(getMinPasswdLength(cfgDao), getModelObject())));
login.setLabel(Model.of(getString("108")));
add(login.add(minimumLength(getMinLoginLength(cfgDao))));
add(new DropDownChoice<>("type", Arrays.asList(Type.values())).add(new OnChangeAjaxBehavior() {
private static final long serialVersionUID = 1L;
@Override
protected void onUpdate(AjaxRequestTarget target) {
updateDomain(target);
}
}));
update(null);
add(domain.add(domainId).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true));
add(new Label("ownerId"));
add(new DateLabel("inserted"));
add(new DateLabel("updated"));
add(new CheckBox("forceTimeZoneCheck"));
add(new Select2MultiChoice<>("rights", null, new RestrictiveChoiceProvider<Right>() {
private static final long serialVersionUID = 1L;
@Override
public String getDisplayValue(Right choice) {
return choice.name();
}
@Override
public String toId(Right choice) {
return choice.name();
}
@Override
public void query(String term, int page, Response<Right> response) {
boolean isGroupAdmin = hasGroupAdminLevel(getRights());
for (Right r : Right.values()) {
if (Right.GroupAdmin == r) {
continue;
}
if (isGroupAdmin && (Right.Admin == r || Right.Soap == r)) {
continue;
}
if (Strings.isEmpty(term) || r.name().contains(term)) {
response.add(r);
}
}
}
@Override
public Right fromId(String id) {
return Right.valueOf(id);
}
}));
add(new ComunityUserForm("comunity", getModel()));
// attach an ajax validation behavior to all form component's keydown
// event and throttle it down to once per second
add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND));
add(adminPass);
}
use of org.apache.openmeetings.web.common.ComunityUserForm in project openmeetings by apache.
the class ProfileForm method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
add(passwd.setLabel(Model.of(getString("current.password"))).setRequired(true));
add(new FormSaveRefreshPanel<User>("buttons", this) {
private static final long serialVersionUID = 1L;
private void refreshUser() {
User u = getModelObject();
if (u.getId() != null) {
u = userDao.get(u.getId());
} else {
u = new User();
}
setModelObject(u);
}
@Override
protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
try {
userDao.update(getModelObject(), null, getUserId());
} catch (Exception e) {
error(e.getMessage());
}
refreshUser();
target.add(ProfileForm.this);
}
@Override
protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
refreshUser();
target.add(ProfileForm.this);
}
});
add(new WebMarkupContainer("changePwd").add(new ButtonBehavior("#changePwd"), new AjaxEventBehavior(EVT_CLICK) {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
chPwdDlg.open(target);
}
}));
add(userForm);
add(new UploadableProfileImagePanel("img", getUserId()));
add(new ComunityUserForm("comunity", getModel()));
// attach an ajax validation behavior to all form component's keydown
// event and throttle it down to once per second
add(new AjaxFormValidatingBehavior("keydown", Duration.ONE_SECOND));
}
Aggregations