Search in sources :

Example 16 with QItemEdited

use of org.olat.modules.qpool.ui.events.QItemEdited in project openolat by klemens.

the class QuestionItemDetailsController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == copyConfirmationCtrl) {
        doPostCopy(ureq, event);
        cmc.deactivate();
        cleanUp();
    } else if (source == conversionConfirmationCtrl) {
        doPostConvert(ureq, event);
        cmc.deactivate();
        cleanUp();
    } else if (source == selectGroupCtrl) {
        if (event instanceof BusinessGroupSelectionEvent) {
            BusinessGroupSelectionEvent bge = (BusinessGroupSelectionEvent) event;
            List<BusinessGroup> groups = bge.getGroups();
            if (groups.size() > 0) {
                QuestionItem item = (QuestionItem) ((SelectBusinessGroupController) source).getUserObject();
                doShareItemsWithGroup(ureq, item, groups);
                metadatasCtrl.updateShares();
            }
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == selectPoolCtrl) {
        cmc.deactivate();
        if (event instanceof QPoolSelectionEvent) {
            QPoolSelectionEvent qpe = (QPoolSelectionEvent) event;
            List<Pool> pools = qpe.getPools();
            if (pools.size() > 0) {
                QuestionItemShort item = (QuestionItemShort) selectPoolCtrl.getUserObject();
                doShareItemsWithPool(ureq, item, pools);
                metadatasCtrl.updateShares();
            }
        }
        cleanUp();
    } else if (source == reviewActionCtrl) {
        if (QItemReviewEvent.START.equals(event.getCommand())) {
            doConfirmStartReview(ureq);
        } else if (QItemReviewEvent.DO.equals(event.getCommand())) {
            openReview(ureq);
        }
    } else if (source == reviewStartCtrl) {
        if (event == Event.DONE_EVENT) {
            TaxonomyLevel taxonomyLevel = reviewStartCtrl.getSelectedTaxonomyLevel();
            doStartReview(ureq, taxonomyLevel);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == reviewCtrl) {
        if (event == Event.DONE_EVENT) {
            float rating = reviewCtrl.getCurrentRatting();
            String comment = reviewCtrl.getComment();
            doRate(ureq, rating, comment);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == confirmEndOfLifeCtrl) {
        boolean endOfLife = DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event);
        if (endOfLife) {
            QuestionItem item = (QuestionItem) confirmEndOfLifeCtrl.getUserObject();
            doEndOfLife(ureq, item);
        }
        cleanUp();
    } else if (source == deleteConfirmationCtrl) {
        if (event == Event.DONE_EVENT) {
            List<QuestionItemShort> items = deleteConfirmationCtrl.getItemsToDelete();
            doDelete(ureq, items);
        }
        cmc.deactivate();
        cleanUp();
    } else if (source == cmc) {
        cleanUp();
    } else if (source == questionCtrl) {
        if (event instanceof QItemEdited) {
            questionEdited = true;
            fireEvent(ureq, event);
        }
    } else if (source == metadatasCtrl) {
        if (event instanceof QItemEdited) {
            reloadData(ureq);
            fireEvent(ureq, event);
        }
    }
    super.event(ureq, source, event);
}
Also used : QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) BusinessGroup(org.olat.group.BusinessGroup) QPoolSelectionEvent(org.olat.modules.qpool.ui.events.QPoolSelectionEvent) BusinessGroupSelectionEvent(org.olat.group.model.BusinessGroupSelectionEvent) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) List(java.util.List) ArrayList(java.util.ArrayList) QuestionItem(org.olat.modules.qpool.QuestionItem)

Example 17 with QItemEdited

use of org.olat.modules.qpool.ui.events.QItemEdited in project openolat by klemens.

the class RightsMetadataEditController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == groupController) {
        if (event instanceof IdentitiesAddEvent) {
            IdentitiesAddEvent identitiesAddedEvent = (IdentitiesAddEvent) event;
            List<Identity> list = identitiesAddedEvent.getAddIdentities();
            qpoolService.addAuthors(list, Collections.<QuestionItemShort>singletonList(item));
            identitiesAddedEvent.getAddedIdentities().addAll(list);
        } else if (event instanceof IdentitiesRemoveEvent) {
            IdentitiesRemoveEvent identitiesRemoveEvent = (IdentitiesRemoveEvent) event;
            List<Identity> list = identitiesRemoveEvent.getRemovedIdentities();
            qpoolService.removeAuthors(list, Collections.<QuestionItemShort>singletonList(item));
        }
        reloadAuthors();
    // cmc.deactivate();
    // cleanUp();
    } else if (source == cmc) {
        fireEvent(ureq, new QItemEdited(item));
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) IdentitiesRemoveEvent(org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent) QuestionItemShort(org.olat.modules.qpool.QuestionItemShort) IdentitiesAddEvent(org.olat.admin.securitygroup.gui.IdentitiesAddEvent) ArrayList(java.util.ArrayList) List(java.util.List) Identity(org.olat.core.id.Identity)

Example 18 with QItemEdited

use of org.olat.modules.qpool.ui.events.QItemEdited in project openolat by klemens.

the class GeneralMetadataEditController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (item instanceof QuestionItemImpl) {
        QuestionItemImpl itemImpl = (QuestionItemImpl) item;
        QuestionItemAuditLogBuilder builder = qpoolService.createAuditLogBuilder(getIdentity(), Action.UPDATE_QUESTION_ITEM_METADATA);
        builder.withBefore(itemImpl);
        itemImpl.setTopic(topicEl.getValue());
        if (taxonomyLevelEl.isOneSelected()) {
            String selectedKey = taxonomyLevelEl.getSelectedKey();
            TaxonomyLevel taxonomyLevel = qpoolTaxonomyTreeBuilder.getTaxonomyLevel(selectedKey);
            itemImpl.setTaxonomyLevel(taxonomyLevel);
        } else {
            itemImpl.setTaxonomyLevel(null);
        }
        QEducationalContext context = contextEl.isOneSelected() ? qpoolService.getEducationlContextByLevel(contextEl.getSelectedKey()) : null;
        itemImpl.setEducationalContext(context);
        if (StringHelper.containsNonWhitespace(keywordsEl.getValue())) {
            itemImpl.setKeywords(keywordsEl.getValue());
        } else {
            itemImpl.setKeywords("");
        }
        if (StringHelper.containsNonWhitespace(coverageEl.getValue())) {
            itemImpl.setCoverage(coverageEl.getValue());
        } else {
            itemImpl.setCoverage("");
        }
        if (StringHelper.containsNonWhitespace(addInfosEl.getValue())) {
            itemImpl.setAdditionalInformations(addInfosEl.getValue());
        } else {
            itemImpl.setAdditionalInformations(null);
        }
        itemImpl.setLanguage(languageEl.getValue());
        String assessmentType = assessmentTypeEl.isOneSelected() ? assessmentTypeEl.getSelectedKey() : null;
        itemImpl.setAssessmentType(assessmentType);
        item = qpoolService.updateItem(item);
        builder.withAfter(itemImpl);
        qpoolService.persist(builder.create());
        fireEvent(ureq, new QItemEdited(item));
    }
}
Also used : QuestionItemAuditLogBuilder(org.olat.modules.qpool.QuestionItemAuditLogBuilder) QItemEdited(org.olat.modules.qpool.ui.events.QItemEdited) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) QEducationalContext(org.olat.modules.qpool.model.QEducationalContext)

Aggregations

QItemEdited (org.olat.modules.qpool.ui.events.QItemEdited)18 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)12 QuestionItemAuditLogBuilder (org.olat.modules.qpool.QuestionItemAuditLogBuilder)8 ArrayList (java.util.ArrayList)6 List (java.util.List)6 QuestionItemShort (org.olat.modules.qpool.QuestionItemShort)6 BusinessGroup (org.olat.group.BusinessGroup)4 BusinessGroupSelectionEvent (org.olat.group.model.BusinessGroupSelectionEvent)4 QPoolSelectionEvent (org.olat.modules.qpool.ui.events.QPoolSelectionEvent)4 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)4 BigDecimal (java.math.BigDecimal)2 IdentitiesAddEvent (org.olat.admin.securitygroup.gui.IdentitiesAddEvent)2 IdentitiesRemoveEvent (org.olat.admin.securitygroup.gui.IdentitiesRemoveEvent)2 LicenseType (org.olat.core.commons.services.license.LicenseType)2 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)2 Identity (org.olat.core.id.Identity)2 ExportFormatOptions (org.olat.modules.qpool.ExportFormatOptions)2 QuestionItem (org.olat.modules.qpool.QuestionItem)2 QEducationalContext (org.olat.modules.qpool.model.QEducationalContext)2 QItemList (org.olat.modules.qpool.model.QItemList)2