Search in sources :

Example 96 with TableEvent

use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.

the class WikiMainController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    Wiki wiki = getWiki();
    if (wiki == null) {
        mainPanel.setContent(createVelocityContainer("deleted"));
        return;
    }
    // reload page from cache
    WikiPage page = wiki.getPage(pageId, true);
    // set recent page id to the page currently used
    this.pageId = page.getPageId();
    if (event instanceof TreeEvent) {
        TreeEvent te = (TreeEvent) event;
        String nodeId = te.getNodeId();
        if (navAZNode.getIdent().equals(nodeId)) {
            openAtoZPage(ureq, wiki);
        } else if (navChangesNode.getIdent().equals(nodeId)) {
            openLastChangesPage(ureq, wiki);
        } else if (navMainPageNode.getIdent().equals(nodeId)) {
            page = openIndexPage(ureq, wiki);
        } else if (wikiMenuNode.getIdent().equals(nodeId)) {
            page = openPage(ureq, WikiPage.WIKI_MENU_PAGE, wiki);
        } else {
            TreeNode node = wikiMenuModel.getNodeById(nodeId);
            if (node != null && node.getUserObject() instanceof String) {
                String link = (String) node.getUserObject();
                page = openPage(ureq, link, wiki);
            }
        }
        if (page != null) {
            this.pageId = page.getPageId();
        }
    } else if (source == versioningTableCtr) {
        /**
         ***********************************************************************
         * history table events
         ***********************************************************************
         */
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            if (te.getActionId().equals(ACTION_COMPARE)) {
                selectedPage = versioningTableModel.getObject(te.getRowId());
                diffs = wiki.getDiff(page, selectedPage.getVersion() - 1, selectedPage.getVersion());
                versioningContent.contextPut("diffs", diffs);
                versioningContent.remove(wikiVersionDisplayComp);
                versioningContent.contextPut("page", selectedPage);
            } else if (te.getActionId().equals(ACTION_SHOW)) {
                versioningContent.contextRemove("diffs");
                selectedPage = versioningTableModel.getObject(te.getRowId());
                selectedPage = wiki.loadVersion(selectedPage, selectedPage.getVersion());
                wikiVersionDisplayComp.setWikiContent(selectedPage.getContent());
                wikiVersionDisplayComp.setImageMapperUri(ureq, wikiContainer);
                versioningContent.put("versionDisplay", wikiVersionDisplayComp);
                versioningContent.contextPut("page", selectedPage);
            }
        }
    } else if (source == wikiUploadFileCtr) {
        if (event.getCommand().equals(FolderEvent.UPLOAD_EVENT)) {
            FolderEvent fEvent = (FolderEvent) event;
            createMediaMetadataFile(fEvent.getFilename(), ureq.getIdentity().getKey());
            updateFileAndLinkList(wiki);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == removePageDialogCtr) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            wiki.removePage(page);
            breadcrumpDropdown.removeComponent(page.getPageName());
            WikiManager.getInstance().deleteWikiPage(ores, page);
            page = wiki.getPage(WikiPage.WIKI_INDEX_PAGE);
            updatePageContext(ureq, page);
            tabs.setSelectedPane(ureq, 0);
        }
    } else if (source == mediaTableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            if (te.getActionId().equals(ACTION_DELETE_MEDIA)) {
                List<MediaFileElement> list = new ArrayList<MediaFileElement>(1);
                list.add(mediaFilesTableModel.getObject(te.getRowId()));
                deleteMediaFile(list, ureq);
            } else if (te.getActionId().equals(ACTION_SHOW_MEDIA)) {
                // show a selected file from the media folder
                MediaFileElement element = mediaFilesTableModel.getObject(te.getRowId());
                if (isImage(element.getFilename())) {
                    // show images inline
                    // as modal overlay
                    imageDisplay.contextPut("mediaElement", element);
                    imageDisplay.contextPut("imageUri", wikiArticleComp.getImageBaseUri());
                    removeAsListenerAndDispose(cmc);
                    cmc = new CloseableModalController(getWindowControl(), translate("close"), imageDisplay);
                    listenTo(cmc);
                    cmc.activate();
                } else {
                    deliverMediaFile(ureq, element.getFilename());
                }
            }
        } else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            if (tmse.getAction().equals(ACTION_DELETE_MEDIAS)) {
                deleteMediaFile(mediaFilesTableModel.getObjects(tmse.getSelection()), ureq);
                updateFileAndLinkList(wiki);
            }
        }
    } else if (source == archiveWikiDialogCtr) {
        if (DialogBoxUIFactory.isOkEvent(event)) {
            WikiToCPResource rsrc = new WikiToCPResource(ores, getIdentity(), getTranslator());
            ureq.getDispatchResult().setResultingMediaResource(rsrc);
        }
    } else if (source == createArticleForm) {
        calloutCtrl.deactivate();
        String query = createArticleForm.getQuery();
        if (!StringHelper.containsNonWhitespace(query)) {
            query = WikiPage.WIKI_INDEX_PAGE;
        }
        page = wiki.findPage(query);
        pageId = page.getPageId();
        if (page.getPageName().equals(Wiki.NEW_PAGE)) {
            setTabsEnabled(false);
        }
        page.incrementViewCount();
        updatePageContext(ureq, page);
        if (!page.getPageName().startsWith("O_")) {
            Link pageLink = LinkFactory.createToolLink(page.getPageName(), "select-page", page.getPageName(), this);
            breadcrumpDropdown.addComponent(pageLink);
        }
        tabs.setSelectedPane(ureq, 0);
    } else if (source == wikiEditForm) {
        // set recent page id to the page currently used
        this.pageId = page.getPageId();
        boolean wantPreview = false;
        boolean wantSave = false;
        boolean wantClose = false;
        if (event == Event.CANCELLED_EVENT) {
            wantClose = true;
        } else if (event == Event.DONE_EVENT) {
            wantSave = true;
        } else if (event.getCommand().equals("save.and.close")) {
            wantClose = true;
            wantSave = true;
            event = Event.DONE_EVENT;
        } else if (event.getCommand().equals("preview")) {
            wantPreview = true;
            event = Event.DONE_EVENT;
        } else if (event.getCommand().equals("delete.page")) {
            String msg = translate("question", page.getPageName());
            removePageDialogCtr = activateOkCancelDialog(ureq, null, msg, removePageDialogCtr);
            return;
        } else if (event.getCommand().equals("media.upload")) {
            doUploadFiles(ureq);
            return;
        } else if (event.getCommand().equals("manage.media")) {
            doManageMedias(ureq, wiki);
            return;
        }
        boolean dirty = !wikiEditForm.getWikiContent().equals(page.getContent());
        if (wantPreview) {
            WikiPage preview = new WikiPage("temp");
            preview.setContent(wikiEditForm.getWikiContent());
            wikiVersionDisplayComp.setWikiContent(preview.getContent());
            editContent.put("versionDisplay", wikiVersionDisplayComp);
        }
        if (wantSave && dirty) {
            editContent.contextPut("isDirty", Boolean.valueOf(false));
            page.setContent(wikiEditForm.getWikiContent());
            page.setModifyAuthor(getIdentity().getKey().longValue());
            page.setUpdateComment(wikiEditForm.getUpdateComment());
            if (page.getInitalAuthor() == 0)
                page.setInitalAuthor(getIdentity().getKey().longValue());
            // changed
            if (page.getPageName().equals(WikiPage.WIKI_MENU_PAGE)) {
                updateWikiMenu(wiki);
            }
            WikiManager.getInstance().saveWikiPage(ores, page, true, wiki);
            // inform subscription context about changes
            NotificationsManager.getInstance().markPublisherNews(subsContext, ureq.getIdentity(), true);
            updatePageContext(ureq, page);
        }
        if (dirty && wantPreview && !wantSave) {
            // wikiEditForm.setDirty(true);
            editContent.contextPut("isDirty", Boolean.valueOf(dirty));
        }
        if (wantClose) {
            tabs.setSelectedPane(ureq, 0);
            doReleaseEditLock();
            return;
        }
    }
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) ArrayList(java.util.ArrayList) TreeEvent(org.olat.core.gui.components.tree.TreeEvent) TableEvent(org.olat.core.gui.components.table.TableEvent) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) FolderEvent(org.olat.core.commons.modules.bc.FolderEvent) Link(org.olat.core.gui.components.link.Link)

Example 97 with TableEvent

use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.

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);
}
Also used : OpenMeetingsUser(org.olat.modules.openmeetings.model.OpenMeetingsUser) TableEvent(org.olat.core.gui.components.table.TableEvent) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) ArrayList(java.util.ArrayList) List(java.util.List)

Example 98 with TableEvent

use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.

the class EPMultipleArtefactsAsTableController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == artefactListTblCtrl) {
        if (event instanceof TableEvent) {
            TableEvent te = (TableEvent) event;
            AbstractArtefact artefact = (AbstractArtefact) artefactListTblCtrl.getTableDataModel().getObject(te.getRowId());
            String action = te.getActionId();
            if (CMD_TITLE.equals(action)) {
                popupArtefact(artefact, ureq);
            } else if (CMD_REFLEXION.equals(action)) {
                EPReflexionWrapperController reflexionCtrl = new EPReflexionWrapperController(ureq, getWindowControl(), secCallback, artefact, struct);
                listenTo(reflexionCtrl);
            } else if (CMD_CHOOSE.equals(action)) {
                fireEvent(ureq, new EPArtefactChoosenEvent(artefact));
            } else if (CMD_UNLINK.equals(action)) {
                struct = ePFMgr.reloadPortfolioStructure(struct);
                ePFMgr.removeArtefactFromStructure(artefact, struct);
                artefactListTblCtrl.modelChanged();
                fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.ADDED, struct));
            } else if (CMD_MOVE.equals(action)) {
                showMoveTree(ureq, artefact);
            } else if (CMD_DELETEARTEFACT.equals(action)) {
                String text = translate("delete.artefact.text", StringHelper.escapeHtml(artefact.getTitle()));
                deleteDialogController = activateYesNoDialog(ureq, translate("delete.artefact"), text, deleteDialogController);
                deleteDialogController.setUserObject(artefact);
            }
        } else if (event instanceof TableMultiSelectEvent) {
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            BitSet objectMarkers = tmse.getSelection();
            List<AbstractArtefact> selectedArtefacts = new ArrayList<>(objectMarkers.size());
            for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
                AbstractArtefact entry = (AbstractArtefact) artefactListTblCtrl.getTableDataModel().getObject(i);
                selectedArtefacts.add(entry);
            }
            fireEvent(ureq, new EPArtefactListChoosenEvent(selectedArtefacts));
        }
    } else if (source == moveTreeCtrl && event.getCommand().equals(EPStructureChangeEvent.CHANGED)) {
        EPStructureChangeEvent epsEv = (EPStructureChangeEvent) event;
        PortfolioStructure newStruct = epsEv.getPortfolioStructure();
        showInfo("artefact.moved", newStruct.getTitle());
        fireEvent(ureq, event);
        moveTreeBox.deactivate();
    } else if (source == deleteDialogController) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            AbstractArtefact artefact2delete = (AbstractArtefact) deleteDialogController.getUserObject();
            ePFMgr.deleteArtefact(artefact2delete);
            ArtefactTableDataModel model = (ArtefactTableDataModel) artefactListTblCtrl.getTableDataModel();
            model.getObjects().remove(artefact2delete);
            artefactListTblCtrl.modelChanged();
            fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.REMOVED, struct));
        }
        removeAsListenerAndDispose(deleteDialogController);
        deleteDialogController = null;
    }
    super.event(ureq, source, event);
}
Also used : TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) BitSet(java.util.BitSet) EPReflexionWrapperController(org.olat.portfolio.ui.artefacts.edit.EPReflexionWrapperController) TableEvent(org.olat.core.gui.components.table.TableEvent) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) ArrayList(java.util.ArrayList) List(java.util.List) EPStructureChangeEvent(org.olat.portfolio.ui.structel.EPStructureChangeEvent)

Example 99 with TableEvent

use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.

the class GroupController 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)
 */
public void event(UserRequest ureq, Controller sourceController, Event event) {
    if (sourceController == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            // Single row selects
            TableEvent te = (TableEvent) event;
            String actionid = te.getActionId();
            final Identity identity = identitiesTableModel.getObject(te.getRowId()).getIdentity();
            if (actionid.equals(COMMAND_VCARD)) {
                // get identity and open new visiting card controller in new window
                ControllerCreator userInfoMainControllerCreator = new ControllerCreator() {

                    @Override
                    public Controller createController(UserRequest lureq, WindowControl lwControl) {
                        return new UserInfoMainController(lureq, lwControl, identity, true, false);
                    }
                };
                // wrap the content controller into a full header layout
                ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createAuthMinimalPopupLayout(ureq, userInfoMainControllerCreator);
                // open in new browser window
                PopupBrowserWindow pbw = getWindowControl().getWindowBackOffice().getWindowManager().createNewPopupBrowserWindowFor(ureq, layoutCtrlr);
                pbw.open(ureq);
            // 
            } else if (actionid.equals(COMMAND_SELECTUSER)) {
                fireEvent(ureq, new SingleIdentityChosenEvent(identity));
            } else if (COMMAND_IM.equals(actionid)) {
                doIm(ureq, identity);
            }
        } else if (event.getCommand().equals(Table.COMMAND_MULTISELECT)) {
            // Multiselect events
            TableMultiSelectEvent tmse = (TableMultiSelectEvent) event;
            if (tmse.getAction().equals(COMMAND_REMOVEUSER)) {
                if (tmse.getSelection().isEmpty()) {
                    // empty selection
                    showWarning("msg.selectionempty");
                    return;
                }
                int size = identitiesTableModel.getObjects().size();
                toRemove = identitiesTableModel.getIdentities(tmse.getSelection());
                // list is never null, but can be empty
                if (keepAtLeastOne && (size == 1 || size - toRemove.size() == 0)) {
                    // at least one must be kept
                    // do not delete the last one => ==1
                    // do not allow to delete all => size - selectedCnt == 0
                    showError("msg.atleastone");
                } else {
                    // valid selection to be deleted.
                    if (removeUserMailDefaultTempl == null) {
                        doBuildConfirmDeleteDialog(ureq);
                    } else {
                        removeAsListenerAndDispose(removeUserMailCtr);
                        removeUserMailCtr = new MailNotificationEditController(getWindowControl(), ureq, removeUserMailDefaultTempl, true, false, true);
                        listenTo(removeUserMailCtr);
                        removeAsListenerAndDispose(cmc);
                        cmc = new CloseableModalController(getWindowControl(), translate("close"), removeUserMailCtr.getInitialComponent());
                        listenTo(cmc);
                        cmc.activate();
                    }
                }
            }
        }
    } else if (sourceController == removeUserMailCtr) {
        if (event == Event.DONE_EVENT) {
            removeUserMailCustomTempl = removeUserMailCtr.getMailTemplate();
            cmc.deactivate();
            doBuildConfirmDeleteDialog(ureq);
        } else {
            cmc.deactivate();
        }
    } else if (sourceController == usc) {
        if (event == Event.CANCELLED_EVENT) {
            cmc.deactivate();
        } else {
            if (event instanceof SingleIdentityChosenEvent) {
                SingleIdentityChosenEvent singleEvent = (SingleIdentityChosenEvent) event;
                Identity choosenIdentity = singleEvent.getChosenIdentity();
                if (choosenIdentity == null) {
                    showError("msg.selectionempty");
                    return;
                }
                toAdd = new ArrayList<Identity>();
                toAdd.add(choosenIdentity);
            } else if (event instanceof MultiIdentityChosenEvent) {
                MultiIdentityChosenEvent multiEvent = (MultiIdentityChosenEvent) event;
                toAdd = multiEvent.getChosenIdentities();
                if (toAdd.size() == 0) {
                    showError("msg.selectionempty");
                    return;
                }
            } else {
                throw new RuntimeException("unknown event ::" + event.getCommand());
            }
            if (toAdd.size() == 1) {
                // check if already in group [makes only sense for a single choosen identity]
                if (securityManager.isIdentityInSecurityGroup(toAdd.get(0), securityGroup)) {
                    String fullName = userManager.getUserDisplayName(toAdd.get(0));
                    getWindowControl().setInfo(translate("msg.subjectalreadyingroup", new String[] { fullName }));
                    return;
                }
            } else if (toAdd.size() > 1) {
                // check if already in group
                List<Identity> alreadyInGroup = new ArrayList<Identity>();
                for (int i = 0; i < toAdd.size(); i++) {
                    if (securityManager.isIdentityInSecurityGroup(toAdd.get(i), securityGroup)) {
                        tableCtr.setMultiSelectSelectedAt(i, false);
                        alreadyInGroup.add(toAdd.get(i));
                    }
                }
                if (!alreadyInGroup.isEmpty()) {
                    StringBuilder names = new StringBuilder();
                    for (Identity ident : alreadyInGroup) {
                        if (names.length() > 0)
                            names.append(", ");
                        names.append(userManager.getUserDisplayName(ident));
                        toAdd.remove(ident);
                    }
                    getWindowControl().setInfo(translate("msg.subjectsalreadyingroup", names.toString()));
                }
                if (toAdd.isEmpty()) {
                    return;
                }
            }
            // in both cases continue adding the users or asking for the mail
            // template if available (=not null)
            cmc.deactivate();
            if (addUserMailDefaultTempl == null) {
                doAddIdentitiesToGroup(ureq, toAdd, null);
            } else {
                removeAsListenerAndDispose(addUserMailCtr);
                addUserMailCtr = new MailNotificationEditController(getWindowControl(), ureq, addUserMailDefaultTempl, true, mandatoryEmail, true);
                listenTo(addUserMailCtr);
                removeAsListenerAndDispose(cmc);
                cmc = new CloseableModalController(getWindowControl(), translate("close"), addUserMailCtr.getInitialComponent());
                listenTo(cmc);
                cmc.activate();
            }
        }
        // in any case cleanup this controller, not used anymore
        usc.dispose();
        usc = null;
    } else if (sourceController == addUserMailCtr) {
        if (event == Event.DONE_EVENT) {
            MailTemplate customTemplate = addUserMailCtr.getMailTemplate();
            doAddIdentitiesToGroup(ureq, toAdd, customTemplate);
            cmc.deactivate();
        } else if (event == Event.CANCELLED_EVENT) {
            cmc.deactivate();
        } else {
            throw new RuntimeException("unknown event ::" + event.getCommand());
        }
    } else if (sourceController == confirmDelete) {
        if (DialogBoxUIFactory.isYesEvent(event)) {
            // before deleting, assure it is allowed
            if (!mayModifyMembers)
                throw new AssertException("not allowed to remove member!");
            // list is never null, but can be empty
            // TODO: Theoretically it can happen that the table model here is not accurate!
            // the 'keep at least one' should be handled by the security manager that should
            // synchronizes the method on the group
            int size = identitiesTableModel.getObjects().size();
            if (keepAtLeastOne && (size - toRemove.size() == 0)) {
                showError("msg.atleastone");
            } else {
                doRemoveIdentitiesFromGroup(ureq, toRemove, removeUserMailCustomTempl);
            }
        }
    } else if (sourceController == userToGroupWizard) {
        if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            getWindowControl().pop();
            removeAsListenerAndDispose(userToGroupWizard);
            userToGroupWizard = null;
            if (event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
                reloadData();
            }
        }
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) TableMultiSelectEvent(org.olat.core.gui.components.table.TableMultiSelectEvent) WindowControl(org.olat.core.gui.control.WindowControl) ControllerCreator(org.olat.core.gui.control.creator.ControllerCreator) TableEvent(org.olat.core.gui.components.table.TableEvent) UserInfoMainController(org.olat.user.UserInfoMainController) PopupBrowserWindow(org.olat.core.gui.control.generic.popup.PopupBrowserWindow) MailTemplate(org.olat.core.util.mail.MailTemplate) SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) List(java.util.List) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity) MailNotificationEditController(org.olat.core.util.mail.MailNotificationEditController) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent) UserRequest(org.olat.core.gui.UserRequest)

Example 100 with TableEvent

use of org.olat.core.gui.components.table.TableEvent in project openolat by klemens.

the class QuotaController method event.

@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == quotaEditCtr) {
        if (event == Event.CHANGED_EVENT) {
            quotaTableModel.refresh();
            tableCtr.setTableDataModel(quotaTableModel);
        }
        // else cancel event. in any case set content to list
        main.setContent(myContent);
    }
    if (source == tableCtr && event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        TableEvent te = (TableEvent) event;
        Quota q = quotaTableModel.getRowData(te.getRowId());
        if (te.getActionId().equals("qf.edit")) {
            // clean up old controller first
            // start edit workflow in dedicated quota edit controller
            removeAsListenerAndDispose(quotaEditCtr);
            quotaEditCtr = new GenericQuotaEditController(ureq, getWindowControl(), q);
            listenTo(quotaEditCtr);
            main.setContent(quotaEditCtr.getInitialComponent());
        } else if (te.getActionId().equals("qf.del")) {
            // try to delete quota
            boolean deleted = QuotaManager.getInstance().deleteCustomQuota(q);
            if (deleted) {
                quotaTableModel.refresh();
                tableCtr.setTableDataModel(quotaTableModel);
                showInfo("qf.deleted", q.getPath());
            } else {
                // default quotas can not be deleted
                showError("qf.cannot.del.default");
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) Quota(org.olat.core.util.vfs.Quota)

Aggregations

TableEvent (org.olat.core.gui.components.table.TableEvent)114 ArrayList (java.util.ArrayList)42 List (java.util.List)40 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)40 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)16 Identity (org.olat.core.id.Identity)16 BitSet (java.util.BitSet)12 WindowControl (org.olat.core.gui.control.WindowControl)12 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)10 UserRequest (org.olat.core.gui.UserRequest)10 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)10 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)10 MultiIdentityChosenEvent (org.olat.basesecurity.events.MultiIdentityChosenEvent)8 BusinessGroup (org.olat.group.BusinessGroup)8 RepositoryEntry (org.olat.repository.RepositoryEntry)8 AssertException (org.olat.core.logging.AssertException)6 UserInfoMainController (org.olat.user.UserInfoMainController)6 KalendarEvent (org.olat.commons.calendar.model.KalendarEvent)4 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)4 Subscriber (org.olat.core.commons.services.notifications.Subscriber)4