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);
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations