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

OO-190: fix the RS and a lot of small issues

parent ec77f416
No related branches found
No related tags found
No related merge requests found
...@@ -679,7 +679,7 @@ public class Form extends LogDelegator { ...@@ -679,7 +679,7 @@ public class Form extends LogDelegator {
} }
private class FormDependencyRulesInitComponentVisitor implements FormComponentVisitor { private static class FormDependencyRulesInitComponentVisitor implements FormComponentVisitor {
public boolean visit(FormItem comp, UserRequest ureq) { public boolean visit(FormItem comp, UserRequest ureq) {
if (comp instanceof FormItemContainer) { if (comp instanceof FormItemContainer) {
...@@ -698,18 +698,8 @@ public class Form extends LogDelegator { ...@@ -698,18 +698,8 @@ public class Form extends LogDelegator {
} }
private static class ValidatingFormComponentVisitor implements FormComponentVisitor {
/** final List<ValidationStatus> tmp = new ArrayList<ValidationStatus>();
* Description:<br>
* TODO: patrickb Class Description for ValidatingFormComponentVisitor
* <P>
* Initial Date: 07.12.2006 <br>
*
* @author patrickb
*/
private class ValidatingFormComponentVisitor implements FormComponentVisitor {
List tmp = new ArrayList();
public ValidationStatus[] getStatus() { public ValidationStatus[] getStatus() {
return ValidationStatusHelper.sort(tmp); return ValidationStatusHelper.sort(tmp);
...@@ -723,15 +713,8 @@ public class Form extends LogDelegator { ...@@ -723,15 +713,8 @@ public class Form extends LogDelegator {
return true; return true;
} }
} }
/**
* Description:<br> private static class ResettingFormComponentVisitor implements FormComponentVisitor {
* TODO: patrickb Class Description for ValidatingFormComponentVisitor
* <P>
* Initial Date: 07.12.2006 <br>
*
* @author patrickb
*/
private class ResettingFormComponentVisitor implements FormComponentVisitor {
public boolean visit(FormItem comp, UserRequest ureq) { public boolean visit(FormItem comp, UserRequest ureq) {
//reset all fields including also non visible and disabled form items! //reset all fields including also non visible and disabled form items!
......
...@@ -153,6 +153,10 @@ public class EPShareListController extends FormBasicController { ...@@ -153,6 +153,10 @@ public class EPShareListController extends FormBasicController {
for (PolicyWrapper policyWrapper : policyWrappers) { for (PolicyWrapper policyWrapper : policyWrappers) {
Type type = policyWrapper.getType(); Type type = policyWrapper.getType();
if(type == null) {
continue;//tutor implicit rule
}
TextElement mailEl = policyWrapper.getMailEl(); TextElement mailEl = policyWrapper.getMailEl();
if (mailEl != null) { if (mailEl != null) {
String mail = mailEl.getValue(); String mail = mailEl.getValue();
...@@ -185,7 +189,8 @@ public class EPShareListController extends FormBasicController { ...@@ -185,7 +189,8 @@ public class EPShareListController extends FormBasicController {
allOk &= false; allOk &= false;
} }
} }
if (policyWrapper.getFromChooser().hasError() || policyWrapper.getToChooser().hasError()){ if ((policyWrapper.getFromChooser() != null && policyWrapper.getFromChooser().hasError())
|| (policyWrapper.getToChooser() != null && policyWrapper.getToChooser().hasError())){
genericError = translate("map.share.date.invalid"); genericError = translate("map.share.date.invalid");
allOk &= false; allOk &= false;
} }
...@@ -200,7 +205,9 @@ public class EPShareListController extends FormBasicController { ...@@ -200,7 +205,9 @@ public class EPShareListController extends FormBasicController {
FormLayoutContainer cmp = (FormLayoutContainer) flc.getFormComponent(policyWrapper.getComponentName()); FormLayoutContainer cmp = (FormLayoutContainer) flc.getFormComponent(policyWrapper.getComponentName());
String errorCompName = policyWrapper.calc("errorpanel"); String errorCompName = policyWrapper.calc("errorpanel");
StaticTextElement errTextEl = (StaticTextElement) cmp.getFormComponent(errorCompName); StaticTextElement errTextEl = (StaticTextElement) cmp.getFormComponent(errorCompName);
if (genericError != null) errTextEl.setValue(genericError); if (genericError != null && errTextEl != null) {
errTextEl.setValue(genericError);
}
} }
return allOk && super.validateFormLogic(ureq); return allOk && super.validateFormLogic(ureq);
...@@ -213,6 +220,8 @@ public class EPShareListController extends FormBasicController { ...@@ -213,6 +220,8 @@ public class EPShareListController extends FormBasicController {
List<EPMapPolicy> mapPolicies = new ArrayList<EPMapPolicy>(); List<EPMapPolicy> mapPolicies = new ArrayList<EPMapPolicy>();
for(PolicyWrapper wrapper:policyWrappers) { for(PolicyWrapper wrapper:policyWrappers) {
if(wrapper.getType() == null) continue;
mapPolicies.add(wrapper.getMapPolicy()); mapPolicies.add(wrapper.getMapPolicy());
if (wrapper.getType().equals(EPMapPolicy.Type.invitation)){ if (wrapper.getType().equals(EPMapPolicy.Type.invitation)){
// always send an invitation mail for invited-non-olat users // always send an invitation mail for invited-non-olat users
...@@ -387,8 +396,12 @@ public class EPShareListController extends FormBasicController { ...@@ -387,8 +396,12 @@ public class EPShareListController extends FormBasicController {
if(mailEl != null) { if(mailEl != null) {
policyWrapper.getInvitation().setMail(mailEl.getValue()); policyWrapper.getInvitation().setMail(mailEl.getValue());
} }
policyWrapper.setFrom(policyWrapper.getFromChooser().getDate()); if(policyWrapper.getFromChooser() != null) {
policyWrapper.setTo(policyWrapper.getToChooser().getDate()); policyWrapper.setFrom(policyWrapper.getFromChooser().getDate());
}
if(policyWrapper.getToChooser() != null) {
policyWrapper.setTo(policyWrapper.getToChooser().getDate());
}
} }
} }
...@@ -413,10 +426,10 @@ public class EPShareListController extends FormBasicController { ...@@ -413,10 +426,10 @@ public class EPShareListController extends FormBasicController {
container.contextPut("wrapper", policyWrapper); container.contextPut("wrapper", policyWrapper);
container.setRootForm(mainForm); container.setRootForm(mainForm);
SingleSelection type = uifactory.addDropdownSingleselect("map.share.target." + cmpName, "map.share.target", container, targetKeys, targetValues, null);
type.addActionListener(this, FormEvent.ONCHANGE);
type.setUserObject(policyWrapper);
if(policyWrapper.getType() != null) { if(policyWrapper.getType() != null) {
SingleSelection type = uifactory.addDropdownSingleselect("map.share.target." + cmpName, "map.share.target", container, targetKeys, targetValues, null);
type.addActionListener(this, FormEvent.ONCHANGE);
type.setUserObject(policyWrapper);
type.select(policyWrapper.getType().name(), true); type.select(policyWrapper.getType().name(), true);
switch(policyWrapper.getType()) { switch(policyWrapper.getType()) {
case user: case user:
...@@ -628,7 +641,7 @@ public class EPShareListController extends FormBasicController { ...@@ -628,7 +641,7 @@ public class EPShareListController extends FormBasicController {
if (StringHelper.containsNonWhitespace(searchValue)) { if (StringHelper.containsNonWhitespace(searchValue)) {
String searchValueLower = searchValue.toLowerCase(); String searchValueLower = searchValue.toLowerCase();
for(BusinessGroup group:groupList) { for(BusinessGroup group:groupList) {
if(group.getName().toLowerCase().indexOf(searchValueLower) >= 0) { if(group.getName() != null && group.getName().toLowerCase().indexOf(searchValueLower) >= 0) {
resMap.put(group.getName(), group.getKey().toString()); resMap.put(group.getName(), group.getKey().toString());
} }
} }
...@@ -638,6 +651,11 @@ public class EPShareListController extends FormBasicController { ...@@ -638,6 +651,11 @@ public class EPShareListController extends FormBasicController {
public class TutorPolicyWrapper extends PolicyWrapper { public class TutorPolicyWrapper extends PolicyWrapper {
@Override
public Type getType() {
return null;
}
@Override @Override
public Date getTo() { public Date getTo() {
return null; return null;
......
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