Search in sources :

Example 11 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project openolat by klemens.

the class QuestionListController method reloadStatusFilterTitle.

private void reloadStatusFilterTitle(FormLink link, String i18n) {
    QuestionStatus linkStatus = (QuestionStatus) link.getUserObject();
    getSource().setStatusFilter(linkStatus);
    int numItems = getSource().getNumOfItems();
    link.setI18nKey(i18n, new String[] { Integer.toString(numItems) });
    link.getComponent().setDirty(true);
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus)

Example 12 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project openolat by klemens.

the class QuestionListController method initButtons.

@Override
protected void initButtons(UserRequest ureq, FormItemContainer formLayout) {
    if (getSource().isStatusFilterEnabled()) {
        QuestionStatus statusFilter = getSource().getStatusFilter();
        statusDraftLink = uifactory.addFormLink("source.status.draft", "source.status.draft", null, formLayout, Link.BUTTON);
        statusDraftLink.setUserObject(QuestionStatus.draft);
        statusDraftLink.setElementCssClass("btn-arrow-right o_qpool_qitem_draft");
        statusDraftLink.setIconLeftCSS("o_icon o_icon-lg o_icon_qitem_draft");
        if (QuestionStatus.draft.equals(statusFilter))
            setSelectionCssClass(statusDraftLink);
        statusReviewLink = uifactory.addFormLink("source.status.review", "source.status.review", null, formLayout, Link.BUTTON);
        statusReviewLink.setUserObject(QuestionStatus.review);
        statusReviewLink.setElementCssClass("btn-arrow-right o_qpool_qitem_review");
        statusReviewLink.setIconLeftCSS("o_icon o_icon-lg o_icon_qitem_review");
        if (QuestionStatus.review.equals(statusFilter))
            setSelectionCssClass(statusReviewLink);
        statusRevisedLink = uifactory.addFormLink("source.status.revised", "source.status.revised", null, formLayout, Link.BUTTON);
        statusRevisedLink.setUserObject(QuestionStatus.revised);
        statusRevisedLink.setElementCssClass("btn-arrow-right o_qpool_qitem_revised");
        statusRevisedLink.setIconLeftCSS("o_icon o_icon-lg o_icon_qitem_revised");
        if (QuestionStatus.revised.equals(statusFilter))
            setSelectionCssClass(statusRevisedLink);
        statusFinalLink = uifactory.addFormLink("source.status.finalVersion", "source.status.finalVersion", null, formLayout, Link.BUTTON);
        statusFinalLink.setUserObject(QuestionStatus.finalVersion);
        statusFinalLink.setElementCssClass("btn-arrow-right o_qpool_qitem_final");
        statusFinalLink.setIconLeftCSS("o_icon o_icon-lg o_icon_qitem_finalVersion");
        if (QuestionStatus.finalVersion.equals(statusFilter))
            setSelectionCssClass(statusFinalLink);
        statusEndOfLifeLink = uifactory.addFormLink("source.status.endOfLife", "source.status.endOfLife", null, formLayout, Link.BUTTON);
        statusEndOfLifeLink.setUserObject(QuestionStatus.endOfLife);
        statusEndOfLifeLink.setElementCssClass("btn-arrow-right o_qpool_qitem_end_of_life");
        statusEndOfLifeLink.setIconLeftCSS("o_icon o_icon-lg o_icon_qitem_endOfLife");
        if (QuestionStatus.endOfLife.equals(statusFilter))
            setSelectionCssClass(statusEndOfLifeLink);
        updateStatusFilter();
    }
    if (getSource().isCreateEnabled()) {
        newItem = uifactory.addFormLink("new.item", formLayout, Link.BUTTON);
        newItem.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_new");
    }
    importItem = uifactory.addFormLink("import.item", formLayout, Link.BUTTON);
    importItem.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_import");
    if (getSecurityCallback().canUseCollections()) {
        list = uifactory.addFormLink("list", formLayout, Link.BUTTON);
    }
    if (getSecurityCallback().canCreateTest()) {
        createTest = uifactory.addFormLink("create.test", formLayout, Link.BUTTON);
    }
    exportItem = uifactory.addFormLink("export.item", formLayout, Link.BUTTON);
    if (getSecurityCallback().canUsePools() || getSecurityCallback().canUseGroups()) {
        shareItem = uifactory.addFormLink("share.item", formLayout, Link.BUTTON);
    }
    if (getSource().isRemoveEnabled()) {
        removeItem = uifactory.addFormLink("unshare.item", formLayout, Link.BUTTON);
    }
    if (getSource().isCopyEnabled()) {
        copyItem = uifactory.addFormLink("copy", formLayout, Link.BUTTON);
    }
    if (getSource().isImportEnabled()) {
        convertItem = uifactory.addFormLink("convert.item", formLayout, Link.BUTTON);
    }
    if (getSource().isAuthorRightsEnable()) {
        authorItem = uifactory.addFormLink("author.item", formLayout, Link.BUTTON);
    }
    if (getSource().isDeleteEnabled()) {
        deleteItem = uifactory.addFormLink("delete.item", formLayout, Link.BUTTON);
    }
    if (getSource().isBulkChangeEnabled()) {
        bulkChange = uifactory.addFormLink("bulk.change", formLayout, Link.BUTTON);
    }
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus)

Example 13 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project openolat by klemens.

the class QuestionPoolServiceImpl method updateItem.

@Override
public QuestionItem updateItem(QuestionItem item) {
    QuestionItem previousItem = loadItemById(item.getKey());
    QuestionStatus previousStatus = previousItem != null ? previousItem.getQuestionStatus() : null;
    QuestionStatus newStatus = item.getQuestionStatus();
    if (statusChanged(previousStatus, newStatus)) {
        if (item instanceof QuestionItemImpl) {
            QuestionItemImpl itemImpl = (QuestionItemImpl) item;
            itemImpl.setQuestionStatusLastModified(new Date());
        }
        if (reviewService.isReviewStarting(previousStatus, newStatus)) {
            reviewService.startReview(item);
        }
    }
    QuestionItem mergedItem = questionItemDao.merge(item);
    dbInstance.commit();
    lifeIndexer.indexDocument(QItemDocument.TYPE, mergedItem.getKey());
    return mergedItem;
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) QuestionItem(org.olat.modules.qpool.QuestionItem) Date(java.util.Date)

Example 14 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.

the class QuestionPoolServiceImpl method updateItem.

@Override
public QuestionItem updateItem(QuestionItem item) {
    QuestionItem previousItem = loadItemById(item.getKey());
    QuestionStatus previousStatus = previousItem != null ? previousItem.getQuestionStatus() : null;
    QuestionStatus newStatus = item.getQuestionStatus();
    if (statusChanged(previousStatus, newStatus)) {
        if (item instanceof QuestionItemImpl) {
            QuestionItemImpl itemImpl = (QuestionItemImpl) item;
            itemImpl.setQuestionStatusLastModified(new Date());
        }
        if (reviewService.isReviewStarting(previousStatus, newStatus)) {
            reviewService.startReview(item);
        }
    }
    QuestionItem mergedItem = questionItemDao.merge(item);
    dbInstance.commit();
    lifeIndexer.indexDocument(QItemDocument.TYPE, mergedItem.getKey());
    return mergedItem;
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus) QuestionItemImpl(org.olat.modules.qpool.model.QuestionItemImpl) QuestionItem(org.olat.modules.qpool.QuestionItem) Date(java.util.Date)

Example 15 with QuestionStatus

use of org.olat.modules.qpool.QuestionStatus in project OpenOLAT by OpenOLAT.

the class QuestionItemDetailsController method buildStatusLink.

private Component buildStatusLink() {
    QuestionStatus actualStatus = metadatasCtrl.getItem().getQuestionStatus();
    Link statusLink = LinkFactory.createToolLink("status.link", translate("lifecycle.status." + actualStatus.name()), this);
    statusLink.setElementCssClass("o_qpool_tools_status o_qpool_status_" + actualStatus.name());
    statusLink.setIconLeftCSS("o_icon o_icon-fw o_icon_qitem_" + actualStatus.name());
    return statusLink;
}
Also used : QuestionStatus(org.olat.modules.qpool.QuestionStatus) Link(org.olat.core.gui.components.link.Link)

Aggregations

QuestionStatus (org.olat.modules.qpool.QuestionStatus)20 Test (org.junit.Test)6 QuestionItem (org.olat.modules.qpool.QuestionItem)4 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)4 ReviewDecision (org.olat.modules.qpool.model.ReviewDecision)4 Date (java.util.Date)2 Dropdown (org.olat.core.gui.components.dropdown.Dropdown)2 Link (org.olat.core.gui.components.link.Link)2 QuestionItemView (org.olat.modules.qpool.QuestionItemView)2 SearchQuestionItemParams (org.olat.modules.qpool.model.SearchQuestionItemParams)2