use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow in project openolat by klemens.
the class CorrectionIdentityAssessmentItemListController method updatePreviousNext.
private void updatePreviousNext() {
if (identityItemCtrl != null) {
List<CorrectionIdentityAssessmentItemRow> rows = tableModel.getObjects();
AssessmentItemListEntry itemSession = identityItemCtrl.getAssessmentItemSession();
String previousText = translate("previous.item");
String nextText = translate("next.item");
boolean previousEnable = false;
boolean nextEnable = false;
int index = rows.indexOf(itemSession);
if (index - 1 >= 0 && rows.size() > index - 1) {
previousText = rows.get(index - 1).getLabel();
previousEnable = true;
}
if (index + 1 >= 0 && rows.size() > index + 1) {
nextText = rows.get(index + 1).getLabel();
nextEnable = true;
}
identityItemCtrl.updatePreviousNext(previousText, previousEnable, nextText, nextEnable);
}
}
use of org.olat.ims.qti21.ui.assessment.model.CorrectionIdentityAssessmentItemRow in project openolat by klemens.
the class CorrectionIdentityAssessmentItemListController method doSelect.
private void doSelect(UserRequest ureq, CorrectionIdentityAssessmentItemRow row) {
removeAsListenerAndDispose(identityItemCtrl);
doUnlock();
AssessmentItemRef itemRef = row.getItemRef();
TestSessionState testSessionState = qtiService.loadTestSessionState(candidateSession);
List<TestPlanNode> nodes = testSessionState.getTestPlan().getNodes(itemRef.getIdentifier());
AssessmentItemSession reloadItemSession = null;
if (nodes.size() == 1) {
TestPlanNode itemNode = nodes.get(0);
String stringuifiedIdentifier = itemNode.getKey().getIdentifier().toString();
ParentPartItemRefs parentParts = AssessmentTestHelper.getParentSection(itemNode.getKey(), testSessionState, model.getResolvedAssessmentTest());
reloadItemSession = qtiService.getOrCreateAssessmentItemSession(candidateSession, parentParts, stringuifiedIdentifier);
}
// lock on item, need to check the lock on identity / test
String lockSubKey = "item-" + reloadItemSession.getKey();
OLATResourceable testOres = OresHelper.clone(model.getTestEntry().getOlatResource());
lockResult = CoordinatorManager.getInstance().getCoordinator().getLocker().acquireLock(testOres, getIdentity(), lockSubKey);
if (lockResult.isSuccess()) {
if (nodes.size() == 1) {
TestPlanNode itemNode = nodes.get(0);
ItemSessionState itemSessionState = testSessionState.getItemSessionStates().get(itemNode.getKey());
AssessmentItemCorrection itemCorrection = new AssessmentItemCorrection(assessedIdentity, candidateSession, testSessionState, reloadItemSession, itemSessionState, itemRef, itemNode);
itemCorrection.setItemSession(reloadItemSession);
ResolvedAssessmentItem resolvedAssessmentItem = model.getResolvedAssessmentTest().getResolvedAssessmentItem(itemRef);
AssessmentItem assessmentItem = resolvedAssessmentItem.getRootNodeLookup().extractIfSuccessful();
identityItemCtrl = new CorrectionIdentityAssessmentItemNavigationController(ureq, getWindowControl(), model.getTestEntry(), model.getResolvedAssessmentTest(), itemCorrection, row, tableModel.getObjects(), model);
listenTo(identityItemCtrl);
stackPanel.pushController(assessmentItem.getTitle(), identityItemCtrl);
updatePreviousNext();
}
} else {
String lockOwnerName = userManager.getUserDisplayName(lockResult.getOwner());
showWarning("warning.assessment.item.locked", new String[] { lockOwnerName });
}
}
Aggregations