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

Merge OpenOLAT 9.0 to OpenOLAT default branch with 54cd6392b2241e0daab023294de6370796f0ec44

parents 292a42a4 e784ae5d
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,7 @@ package org.olat.commons.calendar.ui.components; ...@@ -21,6 +21,7 @@ package org.olat.commons.calendar.ui.components;
import static org.apache.commons.lang.StringEscapeUtils.escapeJavaScript; import static org.apache.commons.lang.StringEscapeUtils.escapeJavaScript;
import java.text.DateFormat;
import java.util.Calendar; import java.util.Calendar;
import org.olat.core.gui.components.Component; import org.olat.core.gui.components.Component;
...@@ -59,6 +60,17 @@ public class FullCalendarComponentRenderer implements ComponentRenderer { ...@@ -59,6 +60,17 @@ public class FullCalendarComponentRenderer implements ComponentRenderer {
cal = Calendar.getInstance(); cal = Calendar.getInstance();
cal.setTime(fcC.getCurrentDate()); cal.setTime(fcC.getCurrentDate());
Calendar calRef = Calendar.getInstance(fcC.getTranslator().getLocale());
calRef.set(Calendar.DATE, 25);
calRef.set(Calendar.MONTH, 11);
calRef.set(Calendar.YEAR, 2013);
String formatted = DateFormat.getDateInstance(DateFormat.SHORT, fcC.getTranslator().getLocale()).format(calRef.getTime());
boolean firstMonth = (formatted.indexOf("12") < formatted.indexOf("25"));
String amFormatted = DateFormat.getTimeInstance(DateFormat.SHORT, fcC.getTranslator().getLocale()).format(calRef.getTime());
boolean ampm = amFormatted.contains("AM") || amFormatted.contains("PM");
sb.append("<script type='text/javascript'>\n") sb.append("<script type='text/javascript'>\n")
.append("/* <![CDATA[ */ \n") .append("/* <![CDATA[ */ \n")
.append("jQuery(function() {\n") .append("jQuery(function() {\n")
...@@ -79,6 +91,18 @@ public class FullCalendarComponentRenderer implements ComponentRenderer { ...@@ -79,6 +91,18 @@ public class FullCalendarComponentRenderer implements ComponentRenderer {
.append(" monthNamesShort: ").append(getMonthShort(translator)).append(",\n") .append(" monthNamesShort: ").append(getMonthShort(translator)).append(",\n")
.append(" dayNames: ").append(getDayLong(translator)).append(",\n") .append(" dayNames: ").append(getDayLong(translator)).append(",\n")
.append(" dayNamesShort: ").append(getDayShort(translator)).append(",\n") .append(" dayNamesShort: ").append(getDayShort(translator)).append(",\n")
.append(" allDayText:'").append(translator.translate("cal.form.allday")).append("',\n")
.append(" axisFormat:'").append(ampm ? "h(:mm)tt" : "H(:mm)").append("',\n")
.append(" titleFormat: {\n")
.append(" month: 'MMMM yyyy',\n")
.append(" week: ").append(firstMonth ? "\"MMM d[ yyyy]{ '&#8212;'[ MMM] d yyyy}\"" : "\"d [ MMM] [ yyyy]{ '&#8212;' d MMM yyyy}\"").append(",\n")
.append(" day: ").append(firstMonth ? "'dddd, MMM d, yyyy'" : "'dddd, d MMM yyyy'").append("\n")
.append(" },\n")
.append(" columnFormat: {\n")
.append(" month: 'ddd',\n")
.append(" week: ").append(firstMonth ? "'ddd M/d'" : "'ddd d.M'").append(",\n")
.append(" day: ").append(firstMonth ? "'dddd M/d'" : "'dddd d.M'").append("\n")
.append(" },\n")
.append(" year:").append(cal.get(Calendar.YEAR)).append(",\n") .append(" year:").append(cal.get(Calendar.YEAR)).append(",\n")
.append(" month:").append(cal.get(Calendar.MONTH)).append(",\n") .append(" month:").append(cal.get(Calendar.MONTH)).append(",\n")
.append(" date:").append(cal.get(Calendar.DAY_OF_MONTH)).append(",\n") .append(" date:").append(cal.get(Calendar.DAY_OF_MONTH)).append(",\n")
......
...@@ -40,6 +40,7 @@ import org.olat.core.gui.control.generic.ajax.autocompletion.ListProvider; ...@@ -40,6 +40,7 @@ import org.olat.core.gui.control.generic.ajax.autocompletion.ListProvider;
import org.olat.core.id.Identity; import org.olat.core.id.Identity;
import org.olat.core.id.Roles; import org.olat.core.id.Roles;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.mail.MailHelper;
import org.olat.core.util.mail.MailModule; import org.olat.core.util.mail.MailModule;
import org.olat.user.UserManager; import org.olat.user.UserManager;
...@@ -102,13 +103,18 @@ public class EMailCalloutCtrl extends FormBasicController { ...@@ -102,13 +103,18 @@ public class EMailCalloutCtrl extends FormBasicController {
if(StringHelper.isLong(mail)) { if(StringHelper.isLong(mail)) {
identity = BaseSecurityManager.getInstance().loadIdentityByKey(Long.parseLong(mail)); identity = BaseSecurityManager.getInstance().loadIdentityByKey(Long.parseLong(mail));
} }
if(identity == null) { if(MailHelper.isValidEmailAddress(mail)) {
identity = UserManager.getInstance().findIdentityByEmail(mail); if(identity == null) {
identity = UserManager.getInstance().findIdentityByEmail(mail);
}
if(identity == null) {
identity = new EMailIdentity(mail, getLocale());
}
} }
if(identity == null) {
identity = new EMailIdentity(mail, getLocale()); if(identity != null) {
fireEvent(ureq, new SingleIdentityChosenEvent(identity));
} }
fireEvent(ureq, new SingleIdentityChosenEvent(identity));
} }
@Override @Override
......
...@@ -350,24 +350,26 @@ public class FIBQuestion extends Question implements QTIObject { ...@@ -350,24 +350,26 @@ public class FIBQuestion extends Question implements QTIObject {
Element conditionvar = respcondition_fail.addElement("conditionvar"); Element conditionvar = respcondition_fail.addElement("conditionvar");
Element or = conditionvar.addElement("or"); Element or = conditionvar.addElement("or");
for (Iterator i = getResponses().iterator(); i.hasNext();) { for (Iterator<Response> i = getResponses().iterator(); i.hasNext();) {
FIBResponse tmpResponse = (FIBResponse) i.next(); FIBResponse tmpResponse = (FIBResponse) i.next();
if (!tmpResponse.getType().equals(FIBResponse.TYPE_BLANK)) { if (!tmpResponse.getType().equals(FIBResponse.TYPE_BLANK)) {
continue; continue;
} }
String[] correctFIBs = tmpResponse.getCorrectBlank().split(";"); String[] correctFIBs = tmpResponse.getCorrectBlank().split(";");
Element not = or.addElement("not"); if(correctFIBs.length > 1) {
Element orVal = not.addElement("or"); Element not = or.addElement("not");
for (int j = 0; j < correctFIBs.length; j++) { Element orVal = not.addElement("or");
String correctFIB = correctFIBs[j]; for (int j = 0; j < correctFIBs.length; j++) {
if (correctFIB.length() > 0) { String correctFIB = correctFIBs[j];
Element varequal = orVal.addElement("varequal"); if (correctFIB.length() > 0) {
varequal.addAttribute("respident", tmpResponse.getIdent()); Element varequal = orVal.addElement("varequal");
varequal.addAttribute("case", tmpResponse.getCaseSensitive()); varequal.addAttribute("respident", tmpResponse.getIdent());
varequal.addCDATA(correctFIB); varequal.addAttribute("case", tmpResponse.getCaseSensitive());
} varequal.addCDATA(correctFIB);
} // for loop correct FIB }
} // for loop correct FIB
}
} // for loop } // for loop
if (isSingleCorrect){ if (isSingleCorrect){
...@@ -386,15 +388,4 @@ public class FIBQuestion extends Question implements QTIObject { ...@@ -386,15 +388,4 @@ public class FIBQuestion extends Question implements QTIObject {
if (or.element("not") == null) if (or.element("not") == null)
resprocessingXML.remove(respcondition_fail); resprocessingXML.remove(respcondition_fail);
} }
private Collection<String> splitCorrectBlank(FIBResponse tmpResponse) {
String[] correctFIBs = tmpResponse.getCorrectBlank().split(";");
Set<String> unique = new LinkedHashSet<String>();
for(String correctFIB:correctFIBs) {
if(!unique.contains(correctFIB)) {
unique.add(correctFIB);
}
}
return unique;
}
} }
\ No newline at end of file
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