Skip to content
Permalink
Browse files

[misc] Added missing escaping, improved jsdoc

  • Loading branch information...
sdumitriu committed Mar 10, 2017
1 parent 1d5ff37 commit d2d4fbe3a40bf7fd70c644be13f181648ac77a69
@@ -92,7 +92,7 @@ var PhenoTips = (function(PhenoTips) {
if (this.regexp.match(this.element.value)) {
return true;
} else {
Validate.fail("$services.localization.render('phenotips.widgets.durationField.invalid')");
Validate.fail("$escapetool.javascript($services.localization.render('phenotips.widgets.durationField.invalid'))");
}
}
});
@@ -36,9 +36,9 @@ var PhenoTips = (function(PhenoTips) {
var thisDateParts = this.el && this.el.__datePicker && this.el.__datePicker.dateParts;

if (bdayParts && thisDateParts && PhenoTips.widgets.FuzzyDatePicker.isDateAfter(thisDateParts, bdayParts)) {
Validate.fail("$services.localization.render('phenotips.widgets.dateWhileAlive.dateBeforeBirth')");
Validate.fail("$escapetool.javascript($services.localization.render('phenotips.widgets.dateWhileAlive.dateBeforeBirth'))");
} else if (ddayParts && thisDateParts && PhenoTips.widgets.FuzzyDatePicker.isDateAfter(ddayParts, thisDateParts)) {
Validate.fail("$services.localization.render('phenotips.widgets.dateWhileAlive.dateAfterDeath')");
Validate.fail("$escapetool.javascript($services.localization.render('phenotips.widgets.dateWhileAlive.dateAfterDeath'))");
} else {
return true;
}
@@ -5204,9 +5204,8 @@ document.observe("xwiki:dom:updated", init);
});

Object.extend(widgets.FuzzyDatePicker, {
// Returns true if d1 is before d2, false if d1 is after d2 and undefined if they cannot be compared
// A decade value is understood as the first day of the decade for d1, and the last day of the decade for d2
// (so only the years are compared)
// Returns true if birth_date is before death_date, false if birth_date is after death_date, and undefined if they cannot be compared.
// A date range is understood as the first possible day of the range for a birth date, and the last possible day of the range for a death date (so only the years are compared)
isDateAfter: function(birth_date, death_date) {
var birth = birth_date;
var death = death_date;

0 comments on commit d2d4fbe

Please sign in to comment.
You can’t perform that action at this time.