use of org.apache.openmeetings.web.common.BasePanel.EVT_CLICK in project openmeetings by apache.
the class ChatToolbar method onInitialize.
@Override
protected void onInitialize() {
super.onInitialize();
BasePage page = (BasePage) getPage();
add(toolbar.add(new WebMarkupContainer("hyperlink").add(AttributeModifier.append("class", page.isRtl() ? "dropdown-menu-left" : "dropdown-menu-right"))));
add(download);
delBtn = new ConfirmableAjaxBorder("delete", getString("80"), getString("832"), chatForm) {
private static final long serialVersionUID = 1L;
@Override
protected void onSubmit(AjaxRequestTarget target) {
final String scope = chatForm.getScope();
final boolean admin = hasAdminLevel(getRights());
chatForm.process(() -> {
if (admin) {
chatDao.deleteGlobal();
clean(target, ID_ALL);
}
return true;
}, r -> {
if (admin || isModerator(cm, getUserId(), r.getId())) {
chatDao.deleteRoom(r.getId());
clean(target, scope);
}
return true;
}, u -> {
chatDao.deleteUser(u.getId());
clean(target, scope);
return true;
});
}
};
toolbar.add(delBtn.setVisible(hasAdminLevel(getRights())).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true));
toolbar.add(save.setVisible(hasAdminLevel(getRights())).setOutputMarkupId(true).setOutputMarkupPlaceholderTag(true).add(new AjaxEventBehavior(EVT_CLICK) {
private static final long serialVersionUID = 1L;
@Override
protected void onEvent(AjaxRequestTarget target) {
download.initiate(target);
}
}));
}
Aggregations