use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class GroupOverviewController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
super.event(ureq, source, event);
if (source == groupListCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
GroupOverviewRow item = tableDataModel.getObject(te.getRowId());
BusinessGroup currBusinessGroup = businessGroupService.loadBusinessGroup(item.getKey());
if (currBusinessGroup == null) {
// group seems to be removed meanwhile, reload table and show error
showError("group.removed");
updateModel();
} else if (TABLE_ACTION_LAUNCH.equals(te.getActionId())) {
NewControllerFactory.getInstance().launch("[BusinessGroup:" + currBusinessGroup.getKey() + "]", ureq, getWindowControl());
} else if (TABLE_ACTION_UNSUBSCRIBE.equals(te.getActionId())) {
doLeave(ureq, Collections.singletonList(currBusinessGroup));
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent mse = (TableMultiSelectEvent) event;
List<GroupOverviewRow> items = tableDataModel.getObjects(mse.getSelection());
if (TABLE_ACTION_UNSUBSCRIBE.equals(mse.getAction())) {
List<BusinessGroup> groups = toBusinessGroups(items);
doLeave(ureq, groups);
}
}
} else if (source == groupsCtrl && event instanceof AddToGroupsEvent) {
AddToGroupsEvent groupsEv = (AddToGroupsEvent) event;
if (groupsEv.isEmpty()) {
// no groups selected
showWarning("group.add.result.none");
} else {
if (cmc != null) {
cmc.deactivate();
}
boolean mailMandatory = groupModule.isMandatoryEnrolmentEmail(ureq.getUserSession().getRoles());
if (mailMandatory) {
doAddToGroups(groupsEv, true);
updateModel();
} else {
confirmSendMailBox = activateYesNoDialog(ureq, null, translate("dialog.modal.bg.send.mail"), confirmSendMailBox);
confirmSendMailBox.setUserObject(groupsEv);
}
}
cleanUpPopups();
} else if (source == confirmSendMailBox) {
boolean sendMail = DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event);
AddToGroupsEvent groupsEv = (AddToGroupsEvent) confirmSendMailBox.getUserObject();
doAddToGroups(groupsEv, sendMail);
updateModel();
} else if (source == removeFromGrpDlg) {
if (event == Event.DONE_EVENT) {
boolean sendMail = removeFromGrpDlg.isSendMail();
List<BusinessGroup> groupsToDelete = removeFromGrpDlg.getGroupsToDelete();
List<BusinessGroup> groupsToLeave = removeFromGrpDlg.getGroupsToLeave();
removeUserFromGroup(ureq, groupsToLeave, groupsToDelete, sendMail);
}
cmc.deactivate();
cleanUpPopups();
} else if (source == cmc) {
cleanUpPopups();
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class CourseOverviewController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == courseListCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
CourseMemberView item = tableDataModel.getObject(te.getRowId());
if (TABLE_ACTION_LAUNCH.equals(te.getActionId())) {
launch(ureq, item.getRepoKey());
} else if (TABLE_ACTION_UNSUBSCRIBE.equals(te.getActionId())) {
doLeave(ureq, Collections.singletonList(item));
} else if (TABLE_ACTION_EDIT.equals(te.getActionId())) {
doOpenEdit(ureq, item);
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent mse = (TableMultiSelectEvent) event;
List<CourseMemberView> items = tableDataModel.getObjects(mse.getSelection());
if (TABLE_ACTION_UNSUBSCRIBE.equals(mse.getAction())) {
doLeave(ureq, items);
}
}
} else if (source == repoSearchCtr) {
SearchType type = (SearchType) repoSearchCtr.getUserObject();
if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
// repository search controller done
RepositoryEntry re = repoSearchCtr.getSelectedEntry();
removeAsListenerAndDispose(repoSearchCtr);
cmc.deactivate();
doConfirmSendEmail(ureq, Collections.singletonList(re), type);
} else if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRIES_SELECTED) {
// repository search controller done
List<RepositoryEntry> res = repoSearchCtr.getSelectedEntries();
removeAsListenerAndDispose(repoSearchCtr);
cmc.deactivate();
if (res != null && !res.isEmpty()) {
doConfirmSendEmail(ureq, res, type);
}
}
} else if (source == editSingleMemberCtrl) {
cmc.deactivate();
if (event instanceof MemberPermissionChangeEvent) {
MemberPermissionChangeEvent e = (MemberPermissionChangeEvent) event;
RepositoryEntry re = editSingleMemberCtrl.getRepositoryEntry();
doConfirmChangePermission(ureq, e, re);
}
} else if (source == confirmSendMailBox) {
boolean sendMail = DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event);
Object confirmation = confirmSendMailBox.getUserObject();
if (confirmation instanceof ConfirmAdd) {
ConfirmAdd addInfos = (ConfirmAdd) confirmation;
doAddToRepositoryEntry(ureq, addInfos.getEntries(), addInfos.getType(), sendMail);
} else if (confirmation instanceof ConfirmEdit) {
ConfirmEdit editInfos = (ConfirmEdit) confirmation;
doChangePermission(ureq, editInfos.getChangeEvent(), editInfos.getEntry(), sendMail);
}
updateModel();
} else if (source == removeFromCourseDlg) {
if (event == Event.DONE_EVENT) {
boolean sendMail = removeFromCourseDlg.isSendMail();
List<BusinessGroup> groupsToDelete = removeFromCourseDlg.getGroupsToDelete();
List<BusinessGroup> groupsToLeave = removeFromCourseDlg.getGroupsToLeave();
List<RepositoryEntry> repoEntriesToLeave = removeFromCourseDlg.getRepoEntriesToLeave();
removeUserFromCourse(ureq, repoEntriesToLeave, groupsToLeave, groupsToDelete, sendMail);
}
cmc.deactivate();
cleanUp();
} else if (source == cmc) {
cleanUp();
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class ReadyToDeleteController method event.
public void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
TableEvent te = (TableEvent) event;
if (te.getActionId().equals(ACTION_SINGLESELECT_CHOOSE)) {
int rowid = te.getRowId();
Identity foundIdentity = tdm.getObject(rowid);
UserDeletionManager.getInstance().setIdentityAsActiv(foundIdentity);
updateUserList();
}
} else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
if (tmse.getAction().equals(ACTION_MULTISELECT_CHOOSE)) {
handleDeleteButtonEvent(ureq, tmse);
}
}
} else if (source == deleteConfirmController) {
if (DialogBoxUIFactory.isOkEvent(event)) {
List<String> errors = new ArrayList<String>();
deleteIdentities(readyToDeleteIdentities, errors);
if (errors.isEmpty()) {
showInfo("deleted.feedback.msg");
} else {
StringBuilder sb = new StringBuilder();
for (String error : errors) {
if (sb.length() > 0)
sb.append(", ");
sb.append(error);
}
showWarning("error.delete", sb.toString());
}
initializeContent();
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class DeletedFileListController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == deletedFilesListTableCtr) {
if (event instanceof TableEvent) {
TableEvent tEvent = (TableEvent) event;
int row = tEvent.getRowId();
if (CMD_DOWNLOAD.equals(tEvent.getActionId())) {
VFSRevision version = getLastRevision(deletedFiles.get(row));
MediaResource resource = new VFSRevisionMediaResource(version, true);
ureq.getDispatchResult().setResultingMediaResource(resource);
} else if (CMD_RESTORE.equals(tEvent.getActionId())) {
VFSRevision version = getLastRevision(deletedFiles.get(row));
if (VersionsManager.getInstance().restore(container, version)) {
status = FolderCommandStatus.STATUS_SUCCESS;
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
} else {
status = FolderCommandStatus.STATUS_FAILED;
// ERROR
}
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent tEvent = (TableMultiSelectEvent) event;
if (CMD_CANCEL.equals(tEvent.getAction())) {
status = FolderCommandStatus.STATUS_CANCELED;
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
} else if (CMD_RESTORE.equals(tEvent.getAction())) {
List<VFSRevision> selectedRevisions = getSelectedRevisions(tEvent.getSelection());
boolean allOk = true;
for (VFSRevision revision : selectedRevisions) {
allOk &= VersionsManager.getInstance().restore(container, revision);
}
if (allOk) {
status = FolderCommandStatus.STATUS_SUCCESS;
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
} else {
status = FolderCommandStatus.STATUS_FAILED;
}
} else if (CMD_DELETE.equals(tEvent.getAction())) {
List<Versions> versionsToDelete = getSelectedVersions(tEvent.getSelection());
if (!versionsToDelete.isEmpty()) {
String msg = translate("version.del.confirm") + "<p>" + renderVersionsAsHtml(versionsToDelete) + "</p>";
// create dialog controller
dialogCtr = activateYesNoDialog(ureq, translate("version.del.header"), msg, dialogCtr);
dialogCtr.setUserObject(versionsToDelete);
}
}
}
} else if (source == dialogCtr) {
if (DialogBoxUIFactory.isYesEvent(event)) {
@SuppressWarnings("unchecked") List<Versions> versionsToDelete = (List<Versions>) dialogCtr.getUserObject();
VersionsManager.getInstance().deleteVersions(versionsToDelete);
status = FolderCommandStatus.STATUS_SUCCESS;
fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
}
}
}
use of org.olat.core.gui.components.table.TableEvent in project OpenOLAT by OpenOLAT.
the class OpenMeetingsAdminRoomMembersController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event instanceof TableEvent) {
TableEvent e = (TableEvent) event;
int row = e.getRowId();
OpenMeetingsUser identity = (OpenMeetingsUser) tableCtr.getTableDataModel().getObject(row);
if ("kickout".equals(e.getActionId())) {
signOut(Collections.singletonList(identity));
}
} else if (event instanceof TableMultiSelectEvent) {
TableMultiSelectEvent e = (TableMultiSelectEvent) event;
List<OpenMeetingsUser> identities = new ArrayList<OpenMeetingsUser>();
for (int i = e.getSelection().nextSetBit(0); i >= 0; i = e.getSelection().nextSetBit(i + 1)) {
OpenMeetingsUser identity = (OpenMeetingsUser) tableCtr.getTableDataModel().getObject(i);
identities.add(identity);
}
if ("kickout".equals(e.getAction())) {
signOut(identities);
}
}
}
super.event(ureq, source, event);
}
Aggregations