Skip to content
Snippets Groups Projects
Commit abdac6c9 authored by srosse's avatar srosse
Browse files

OO-1593: fix rs default attempts in test part

parent e6d47b39
No related branches found
No related tags found
No related merge requests found
...@@ -75,7 +75,6 @@ public abstract class ItemSessionControlController extends FormBasicController { ...@@ -75,7 +75,6 @@ public abstract class ItemSessionControlController extends FormBasicController {
*/ */
ItemSessionControl itemSessionControl = part.getItemSessionControl();//can be null ItemSessionControl itemSessionControl = part.getItemSessionControl();//can be null
Integer maxAttempts = null; Integer maxAttempts = null;
if(part.getItemSessionControl() != null) { if(part.getItemSessionControl() != null) {
maxAttempts = part.getItemSessionControl().getMaxAttempts(); maxAttempts = part.getItemSessionControl().getMaxAttempts();
...@@ -86,17 +85,22 @@ public abstract class ItemSessionControlController extends FormBasicController { ...@@ -86,17 +85,22 @@ public abstract class ItemSessionControlController extends FormBasicController {
String[] aValues = part instanceof TestPart ? yesnoValues : attemptsValues; String[] aValues = part instanceof TestPart ? yesnoValues : attemptsValues;
limitAttemptsEl = uifactory.addRadiosHorizontal("form.imd.limittries", formLayout, aKeys, aValues); limitAttemptsEl = uifactory.addRadiosHorizontal("form.imd.limittries", formLayout, aKeys, aValues);
limitAttemptsEl.addActionListener(FormEvent.ONCLICK); limitAttemptsEl.addActionListener(FormEvent.ONCLICK);
String maxAttemptsStr = maxAttempts == null ? "" : maxAttempts.toString();
maxAttemptsEl = uifactory.addTextElement("attempts", "item.session.control.attempts", 4, maxAttemptsStr, formLayout);
if(maxAttempts == null) { if(maxAttempts == null) {
limitAttemptsEl.select(attemtpsKeys[2], true); if(aKeys.length == 2) {
limitAttemptsEl.select(attemtpsKeys[0], true);
maxAttemptsEl.setValue("1");
} else {
limitAttemptsEl.select(attemtpsKeys[2], true);
}
} else if(maxAttempts.intValue() == 0) { } else if(maxAttempts.intValue() == 0) {
limitAttemptsEl.select(attemtpsKeys[1], true); limitAttemptsEl.select(attemtpsKeys[1], true);
} else { } else {
limitAttemptsEl.select(attemtpsKeys[0], true); limitAttemptsEl.select(attemtpsKeys[0], true);
} }
limitAttemptsEl.setEnabled(!restrictedEdit); limitAttemptsEl.setEnabled(!restrictedEdit);
String maxAttemptsStr = maxAttempts == null ? "" : maxAttempts.toString();
maxAttemptsEl = uifactory.addTextElement("attempts", "item.session.control.attempts", 4, maxAttemptsStr, formLayout);
maxAttemptsEl.setVisible(limitAttemptsEl.isSelected(0)); maxAttemptsEl.setVisible(limitAttemptsEl.isSelected(0));
maxAttemptsEl.setEnabled(!restrictedEdit); maxAttemptsEl.setEnabled(!restrictedEdit);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment