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