var alpha = /^[a-zA-Z_]+$/;
var alphanum = /^[a-zA-Z0-9_]+$/;
var email = /^([\w]+)(.[\w]+)*@([\w-]+\.){1,5}([A-Za-z]){2,24}$/;
- var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
+ var url = /^(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
+ var urlWeb = /^((https?):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
// All these messages and functions are configurable
return {
url : function(v){
return url.test(v);
},
+ /**
+ * The funciton used to validate URLs (only allow schemes 'https' and 'http')
+ * @param {String} v The URL
+ */
+ urlWeb : function(v) {
+ return urlWeb.test(v);
+ },
/**
* The error text to display when the url validation function returns false
* @type String
this.el.select('.form-control-feedback', true).first().addClass([this.invalidFeedbackClass]);
- feedback.update(this.invalidText);
+ feedback.update(typeof(msg) == 'undefined' ? this.invalidText : msg);
if(!this.allowBlank && !this.getRawValue().length){
feedback.update(this.blankText);
this.el.select('.form-control-feedback', true).first().removeClass(this.invalidFeedbackClass);
feedback.update('');
+ feedback.hide();
}
}
if(feedback){
this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
feedback.update('');
+ feedback.hide();
}
if(this.disabled || this.allowBlank){
if(feedback){
this.el.select('.form-control-feedback', true).first().removeClass([this.invalidFeedbackClass, this.validFeedbackClass]);
feedback.update('');
+ feedback.hide();
}
if(this.disabled){
if(!this.allowBlank && !this.getRawValue().length){
feedback.update(this.blankText);
}
+
+ if(feedback.dom.innerHTML) {
+ feedback.show();
+ }
}
* Create a new DateField
* @param {Object} config The config object
*/
-
+
Roo.bootstrap.form.DateField = function(config){
Roo.bootstrap.form.DateField.superclass.constructor.call(this, config);
this.addEvents({
* valid according to {@link Date#parseDate} (defaults to 'm/d/y').
*/
format : "m/d/y",
- /**
- * @cfg {String} altFormats
- * Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined
- * format (defaults to 'm/d/Y|m-d-y|m-d-Y|m/d|m-d|d').
- */
- altFormats : "m/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d",
weekStart : 0,
_events: [],
singleMode : false,
+
+ hiddenField : false,
UTCDate: function()
{
setUTCDate: function(d) {
this.date = d;
- this.setValue(this.formatDate(this.date));
+ this.setValue(this.date);
+ },
+
+ translateDates: function(lang)
+ {
+ var translation = Roo.bootstrap.form.DateField.dates[lang] = {
+ days: [],
+ daysShort: [],
+ daysMin: [],
+ months: [],
+ monthsShort: []
+ };
+
+ var locale = lang.replace('_', '-');
+
+ var is_latin = [ 'zh-hk', 'zh-cn', 'jp', 'ko' ].indexOf(locale.toLowerCase()) < 0;
+
+
+ // fill days
+ for(var i = 0; i < 7; i++) {
+ var date = new Date(2020, 0, 5 + i);
+
+ var day = new Intl.DateTimeFormat(locale, {
+ weekday : 'long'
+ }).format(date);
+
+ var dayShort = new Intl.DateTimeFormat(locale, {
+ weekday : 'short'
+ }).format(date);
+
+ var dayMin = new Intl.DateTimeFormat(locale, {
+ weekday : 'narrow'
+ }).format(date);
+
+ if(is_latin) {
+ dayShort = day.substring(0, 3);
+ dayMin = day.substring(0, 2);
+ }
+
+ translation.days.push(day);
+ translation.daysShort.push(dayShort);
+ translation.daysMin.push(dayMin);
+ }
+
+ // fill months
+ for(var i = 0; i < 12; i++) {
+ var date = new Date(2020, i);
+
+ var month = new Intl.DateTimeFormat(locale, {
+ month : 'long'
+ }).format(date);
+
+ var monthShort = new Intl.DateTimeFormat(locale, {
+ month : 'short'
+ }).format(date);
+
+ if(is_latin) {
+ monthShort = month.substring(0, 3);
+ }
+
+ translation.months.push(month);
+ translation.monthsShort.push(monthShort);
+ }
},
onRender: function(ct, position)
{
Roo.bootstrap.form.DateField.superclass.onRender.call(this, ct, position);
-
- this.language = this.language || 'en';
- this.language = this.language in Roo.bootstrap.form.DateField.dates ? this.language : this.language.split('-')[0];
- this.language = this.language in Roo.bootstrap.form.DateField.dates ? this.language : "en";
+
+ this.translateDates(this.language);
this.isRTL = Roo.bootstrap.form.DateField.dates[this.language].rtl || false;
this.format = this.format || 'm/d/y';
}
Roo.each(this.picker().select('tfoot th.today', true).elements, function(v){
- if(!this.calendarWeeks){
- v.remove();
- return;
- }
-
- v.dom.innerHTML = Roo.bootstrap.form.DateField.dates[this.language].today;
- v.attr('colspan', function(i, val){
- return parseInt(val) + 1;
- });
+ v.dom.innerHTML = Roo.bootstrap.form.DateField.todayText;
});
if(this.isInline) {
this.showPopup();
}
+
+ this.hiddenField = this.inputEl().insertSibling(
+ {tag : 'input', type : 'hidden', name : this.name},
+ 'before',
+ true
+ );
+ this.inputEl().dom.setAttribute('name', this.name + '____hidden___');
+
},
picker : function()
]
};
- if(this.calendarWeeks){
- dow.cn.push({
- tag: 'th',
- cls: 'cw',
- html: ' '
- })
- }
-
while (dowCnt < this.weekStart + 7) {
dow.cn.push({
tag: 'th',
today = this.UTCToday();
this.picker().select('>.datepicker-days thead th.switch', true).first().dom.innerHTML = Roo.bootstrap.form.DateField.dates[this.language].months[month]+' '+year;
-
-// this.picker().select('>tfoot th.today', true).first().dom.innerHTML = Roo.bootstrap.form.DateField.dates[this.language].today;
-
-// this.picker.select('>tfoot th.today').
-// .text(dates[this.language].today)
-// .toggle(this.todayBtn !== false);
this.updateNavArrows();
this.fillMonths();
tag: 'tr',
cn: []
};
-
- if(this.calendarWeeks){
- // ISO 8601: First week contains first thursday.
- // ISO also states week starts on Monday, but we can be more abstract here.
- var
- // Start of current week: based on weekstart/current date
- ws = new Date(+prevMonth + (this.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
- // Thursday of this week
- th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
- // First Thursday of year, year from thursday
- yth = new Date(+(yth = this.UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
- // Calendar week: ms between thursdays, div ms per day, div 7 days
- calWeek = (th - yth) / 864e5 / 7 + 1;
-
- fillMonths.cn.push({
- tag: 'td',
- cls: 'cw',
- html: calWeek
- });
- }
}
if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
this.picker().setTop(this.inputEl().getBottom()).setLeft(this.inputEl().getLeft());
},
+ // return false when it fails
parseDate : function(value)
{
- if(!value || value instanceof Date){
- return value;
- }
- var v = Date.parseDate(value, this.format);
- if (!v && (this.useIso || value.match(/^(\d{4})-0?(\d+)-0?(\d+)/))) {
- v = Date.parseDate(value, 'Y-m-d');
+ if(!value) {
+ return false;
}
- if(!v && this.altFormats){
- if(!this.altFormatsArray){
- this.altFormatsArray = this.altFormats.split("|");
- }
- for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){
- v = Date.parseDate(value, this.altFormatsArray[i]);
- }
+ if(value instanceof Date){
+ return value;
}
- return v;
+ var v = Date.parseDate(value, 'Y-m-d');
+
+ return (typeof(v) == 'undefined') ? false : v;
},
formatDate : function(date, fmt)
return (!date || !(date instanceof Date)) ?
date : date.dateFormat(fmt || this.format);
},
+
+ translateDate : function(date)
+ {
+ switch(this.language) {
+ case 'zh_CN':
+ return new Intl.DateTimeFormat('zh-CN', {
+ year : 'numeric',
+ month : 'long',
+ day : 'numeric'
+ }).format(date);
+ default :
+ return this.formatDate(date);
+ }
+ },
onFocus : function()
{
onBlur : function()
{
Roo.bootstrap.form.DateField.superclass.onBlur.call(this);
-
- var d = this.inputEl().getValue();
-
- this.setValue(d);
+
+ if(!this.readOnly) {
+ var d = this.inputEl().getValue();
+ var date = this.parseDate(d);
+ if(date) {
+ this.setValue(date);
+ }
+ else {
+ this.setValue(this.getValue());
+ }
+ }
this.hidePopup();
},
setValue: function(v)
{
if(this.fireEvent('beforeselect', this, v) !== false){
- var d = new Date(this.parseDate(v) ).clearTime();
-
- if(isNaN(d.getTime())){
- this.date = this.viewDate = '';
- Roo.bootstrap.form.DateField.superclass.setValue.call(this, '');
+ var d = this.parseDate(v);
+
+ if(!d) {
+ this.date = this.viewDate = this.value = this.hiddenField.value = '';
+ if(this.rendered){
+ this.inputEl().dom.value = '';
+ this.validate();
+ }
+ return;
+ }
+
+ d = new Date(d).clearTime();
+
+ this.value = this.hiddenField.value = d.dateFormat('Y-m-d');
+
+ v = this.translateDate(d);
+ if(this.rendered){
+ this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
+ this.validate();
+ }
+
+ this.date = new Date(d.getTime() - d.getTimezoneOffset()*60000);
+
+ this.update();
+
+ this.fireEvent('select', this, this.date);
+ }
+ },
+
+ // bypass validation
+ setRawValue : function(v){
+ if(this.fireEvent('beforeselect', this, v) !== false){
+ var d = this.parseDate(v);
+
+ if(!d) {
+ this.date = this.viewDate = this.value = this.hiddenField.value = '';
+ if(this.rendered){
+ this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
+ }
return;
}
- v = this.formatDate(d);
+ d = new Date(d).clearTime();
+
+ this.value = this.hiddenField.value = d.dateFormat('Y-m-d');
- Roo.bootstrap.form.DateField.superclass.setValue.call(this, v);
+ v = this.translateDate(d);
+ if(this.rendered){
+ this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
+ }
this.date = new Date(d.getTime() - d.getTimezoneOffset()*60000);
getValue: function()
{
- return this.formatDate(this.date);
+ return this.value;
+ },
+
+ getRawValue : function(){
+ return this.getValue();
},
fireKey: function(e)
if (this.dateWithinRange(newDate)){
this.date = newDate;
this.viewDate = newViewDate;
- this.setValue(this.formatDate(this.date));
+ this.setValue(this.date);
// this.update();
e.preventDefault();
dateChanged = true;
if (this.dateWithinRange(newDate)){
this.date = newDate;
this.viewDate = newViewDate;
- this.setValue(this.formatDate(this.date));
+ this.setValue(this.date);
// this.update();
e.preventDefault();
dateChanged = true;
}
break;
case 13: // enter
- this.setValue(this.formatDate(this.date));
+ this.setValue(this.date);
this.hidePopup();
e.preventDefault();
break;
case 9: // tab
- this.setValue(this.formatDate(this.date));
+ this.setValue(this.date);
this.hidePopup();
break;
case 16: // shift
var date = new Date();
this.date = this.UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
// this.fill()
- this.setValue(this.formatDate(this.date));
+ this.setValue(this.date);
this.hidePopup();
break;
}
if(this.singleMode){
- this.setValue(this.formatDate(this.viewDate));
+ this.setValue(this.viewDate);
this.hidePopup();
return;
}
this.date = this.UTCDate(year, month, day,0,0,0,0);
this.viewDate = this.UTCDate(year, month, Math.min(28, day),0,0,0,0);
// this.fill();
- //Roo.log(this.formatDate(this.date));
- this.setValue(this.formatDate(this.date));
+ this.setValue(this.date);
this.hidePopup();
}
break;
{
this.startDate = startDate || -Infinity;
if (this.startDate !== -Infinity) {
- this.startDate = this.parseDate(this.startDate);
+ var date = this.parseDate(this.startDate);
+ this.startDate = date ? date : -Infinity;
}
this.update();
this.updateNavArrows();
{
this.endDate = endDate || Infinity;
if (this.endDate !== Infinity) {
- this.endDate = this.parseDate(this.endDate);
+ var date = this.parseDate(this.endDate);
+ this.endDate = date ? date : Infinity;
}
this.update();
this.updateNavArrows();
return false;
}
- if(typeof(this.parseDate(value)) == 'undefined'){
+ if(!this.parseDate(value)){
return false;
}
]
},
- dates:{
- en: {
- days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
- daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
- daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
- months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
- monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
- today: "Today"
- }
- },
+ dates : {},
+
+ todayText : "Today",
modes: [
{
*/
format : "H:i",
minuteStep : 1,
-
+ language : 'en',
+ hiddenField : false,
getAutoCreate : function()
{
this.after = '<i class="fa far fa-clock"></i>';
{
Roo.bootstrap.form.TimeField.superclass.onRender.call(this, ct, position);
+
+ this.language = this.language in Roo.bootstrap.form.TimeField.periodText ? this.language : "en";
this.pickerEl = Roo.get(document.body).createChild(Roo.bootstrap.form.TimeField.template);
this.pop.select('.minutes-down', true).first().on('click', this.onDecrementMinutes, this);
this.pop.select('button.period', true).first().on('click', this.onTogglePeriod, this);
this.pop.select('button.ok', true).first().on('click', this.setTime, this);
+ this.pop.select('button.ok', true).first().dom.innerHTML = Roo.bootstrap.form.TimeField.okText;
+
+ this.hiddenField = this.inputEl().insertSibling(
+ {tag : 'input', type : 'hidden', name : this.name},
+ 'before',
+ true
+ );
+ this.inputEl().dom.setAttribute('name', this.name + '____hidden___');
},
update: function()
{
// default minute is a multiple of minuteStep
- if(typeof(this.time) === 'undefined') {
+ if(typeof(this.time) === 'undefined' || this.time.length == 0) {
this.time = new Date();
this.time = this.time.add(Date.MINUTE, Math.round(parseInt(this.time.format('i')) / this.minuteStep) * this.minuteStep - parseInt(this.time.format('i')));
}
- this.time = (typeof(this.time) === 'undefined') ? new Date() : this.time;
+ this.time = (typeof(this.time) === 'undefined' || this.time.length == 0) ? new Date() : this.time;
this.fill();
},
{
var hours = this.time.getHours();
var minutes = this.time.getMinutes();
- var period = 'AM';
+ var period = Roo.bootstrap.form.TimeField.periodText[this.language]['am'];
if(hours > 11){
- period = 'PM';
+ period = Roo.bootstrap.form.TimeField.periodText[this.language]['pm'];
}
if(hours == 0){
this.update();
this.place();
- this.fireEvent('show', this, this.date);
+ this.fireEvent('show', this, this.time);
},
hide : function()
this.picker().hide();
this.pop.hide();
- this.fireEvent('hide', this, this.date);
+ this.fireEvent('hide', this, this.time);
},
setTime : function()
{
this.hide();
- this.setValue(this.time.format(this.format));
+ this.setValue(this.time);
- this.fireEvent('select', this, this.date);
+ this.fireEvent('select', this, this.time);
},
+
+ // return false when it fails
+ parseTime : function(value)
+ {
+ if(!value) {
+ return false;
+ }
+ if(value instanceof Date){
+ return value;
+ }
+ var v = Date.parseDate(value, 'H:i:s');
+
+ return (typeof(v) == 'undefined') ? false : v;
+ },
+
+ translateTime : function(time)
+ {
+ switch(this.language) {
+ case 'zh_CN':
+ return new Intl.DateTimeFormat('zh-CN', {
+ hour : 'numeric',
+ minute : 'numeric',
+ hour12 : true
+ }).format(time);
+ default :
+ return time.format(this.format);
+ }
+ },
+
+ setValue: function(v)
+ {
+ var t = this.parseTime(v);
+
+ if(!t) {
+ this.time = this.value = this.hiddenField.value = '';
+ if(this.rendered){
+ this.inputEl().dom.value = '';
+ this.validate();
+ }
+ return;
+ }
+
+ this.value = this.hiddenField.value = t.dateFormat('H:i:s');
+
+ v = this.translateTime(t);
+
+ if(this.rendered){
+ this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
+ this.validate();
+ }
+
+ this.time = t;
+
+ this.update();
+ },
+
+ setRawValue: function(v)
+ {
+ var t = this.parseTime(v);
+
+ if(!t) {
+ this.time = this.value = this.hiddenField.value = '';
+ if(this.rendered){
+ this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
+ }
+ return;
+ }
+
+ this.value = this.hiddenField.value = t.dateFormat('H:i:s');
+
+ v = this.translateTime(t);
+
+ if(this.rendered){
+ this.inputEl().dom.value = (v === null || v === undefined ? '' : v);
+ }
+
+ this.time = t;
+
+ this.update();
+ },
+
+ getValue: function()
+ {
+ return this.value;
+ },
+
+ getRawValue : function(){
+ return this.getValue();
+ },
onMousedown: function(e){
e.stopPropagation();
});
-
+Roo.apply(Roo.bootstrap.form.TimeField, {
+ okText : 'OK',
+ periodText : {
+ en : {
+ am : 'AM',
+ pm : 'PM'
+ },
+ zh_CN : {
+ am : '上午',
+ pm : '下午'
+ }
+ }
+});
Roo.apply(Roo.bootstrap.form.TimeField, {
-
template : {
tag: 'div',
cls: 'datepicker dropdown-menu',
{
tag: 'button',
cls: 'btn btn-info ok',
- html: 'OK'
+ html: "OK" // this is overridden on construciton
}
]
}
* @class Roo.bootstrap.form.SecurePass
* @extends Roo.bootstrap.form.Input
* Bootstrap SecurePass class
+ * @cfg {Number} minimumStrength invalid if the strength of the password input is less than the minimum strength (from 0 to 3) (default 2)
*
*
* @constructor
*/
Roo.bootstrap.form.SecurePass = function (config) {
- // these go here, so the translation tool can replace them..
- this.errors = {
- PwdEmpty: "Please type a password, and then retype it to confirm.",
- PwdShort: "Your password must be at least 6 characters long. Please type a different password.",
- PwdLong: "Your password can't contain more than 16 characters. Please type a different password.",
- PwdBadChar: "The password contains characters that aren't allowed. Please type a different password.",
- IDInPwd: "Your password can't include the part of your ID. Please type a different password.",
- FNInPwd: "Your password can't contain your first name. Please type a different password.",
- LNInPwd: "Your password can't contain your last name. Please type a different password.",
- TooWeak: "Your password is Too Weak."
- },
- this.meterLabel = "Password strength:";
- this.pwdStrengths = ["Too Weak", "Weak", "Medium", "Strong"];
- this.meterClass = [
- "roo-password-meter-tooweak",
- "roo-password-meter-weak",
- "roo-password-meter-medium",
- "roo-password-meter-strong",
- "roo-password-meter-grey"
- ];
-
- this.errors = {};
Roo.bootstrap.form.SecurePass.superclass.constructor.call(this, config);
}
Roo.extend(Roo.bootstrap.form.SecurePass, Roo.bootstrap.form.Input, {
- /**
- * @cfg {String/Object} errors A Error spec, or true for a default spec (defaults to
- * {
- * PwdEmpty: "Please type a password, and then retype it to confirm.",
- * PwdShort: "Your password must be at least 6 characters long. Please type a different password.",
- * PwdLong: "Your password can't contain more than 16 characters. Please type a different password.",
- * PwdBadChar: "The password contains characters that aren't allowed. Please type a different password.",
- * IDInPwd: "Your password can't include the part of your ID. Please type a different password.",
- * FNInPwd: "Your password can't contain your first name. Please type a different password.",
- * LNInPwd: "Your password can't contain your last name. Please type a different password."
- * })
- */
+ minimumStrength : 2,
// private
-
- meterWidth: 300,
- errorMsg :'',
- errors: false,
- imageRoot: '/',
- /**
- * @cfg {String/Object} Label for the strength meter (defaults to
- * 'Password strength:')
- */
- // private
- meterLabel: '',
- /**
- * @cfg {String/Object} pwdStrengths A pwdStrengths spec, or true for a default spec (defaults to
- * ['Weak', 'Medium', 'Strong'])
- */
- // private
- pwdStrengths: false,
+ meterWidth: 300,
+ imageRoot: '/',
// private
strength: 0,
// private
//var pm = this.trigger.child('div/div/div').dom;
var pm = this.trigger.child('div/div');
- pm.removeClass(this.meterClass);
- pm.addClass(this.meterClass[strength]);
+ pm.removeClass(Roo.bootstrap.form.SecurePass.meterClass);
+ pm.addClass(Roo.bootstrap.form.SecurePass.meterClass[strength]);
var pt = this.trigger.child('/div').child('>*[class=roo-password-meter-text]').dom;
- pt.innerHTML = this.meterLabel + ' ' + this.pwdStrengths[strength];
+ pt.innerHTML = Roo.bootstrap.form.SecurePass.meterLabel + ' ' + Roo.bootstrap.form.SecurePass.pwdStrengths[strength];
this._lastPwd = pwd;
},
this._lastPwd = '';
var pm = this.trigger.child('div/div');
- pm.removeClass(this.meterClass);
+ pm.removeClass(Roo.bootstrap.form.SecurePass.meterClass);
pm.addClass('roo-password-meter-grey');
return true;
}
- this.markInvalid(this.errors.PwdEmpty);
- this.errorMsg = this.errors.PwdEmpty;
+ this.invalidText = Roo.bootstrap.form.SecurePass.errors.PwdEmpty;
return false;
}
}
if (!value.match(/[\x21-\x7e]+/)) {
- this.markInvalid(this.errors.PwdBadChar);
- this.errorMsg = this.errors.PwdBadChar;
+ this.invalidText = Roo.bootstrap.form.SecurePass.errors.PwdBadChar;
return false;
}
if (value.length < 6) {
- this.markInvalid(this.errors.PwdShort);
- this.errorMsg = this.errors.PwdShort;
+ this.invalidText = Roo.bootstrap.form.SecurePass.errors.PwdShort;
return false;
}
if (value.length > 16) {
- this.markInvalid(this.errors.PwdLong);
- this.errorMsg = this.errors.PwdLong;
+ this.invalidText = Roo.bootstrap.form.SecurePass.errors.PwdLong;
return false;
}
var strength;
}
- if (strength < 2) {
- //this.markInvalid(this.errors.TooWeak);
- this.errorMsg = this.errors.TooWeak;
- //return false;
+ if (strength < this.minimumStrength) {
+ this.invalidText = Roo.bootstrap.form.SecurePass.errors.TooWeak;
+ return false;
}
//var pm = this.trigger.child('div/div/div').dom;
var pm = this.trigger.child('div/div');
- pm.removeClass(this.meterClass);
- pm.addClass(this.meterClass[strength]);
+ pm.removeClass(Roo.bootstrap.form.SecurePass.meterClass);
+ pm.addClass(Roo.bootstrap.form.SecurePass.meterClass[strength]);
var pt = this.trigger.child('/div').child('>*[class=roo-password-meter-text]').dom;
- pt.innerHTML = this.meterLabel + ' ' + this.pwdStrengths[strength];
-
- this.errorMsg = '';
+ pt.innerHTML = Roo.bootstrap.form.SecurePass.meterLabel + ' ' + Roo.bootstrap.form.SecurePass.pwdStrengths[strength];
+
return true;
},
// private
return this.IsLongEnough(pwd, 6) || !this.IsLongEnough(pwd, 0);
}
-});/**
+});
+
+Roo.bootstrap.form.SecurePass.errors = {
+ PwdEmpty: "Please type a password, and then retype it to confirm.",
+ PwdShort: "Your password must be at least 6 characters long. Please type a different password.",
+ PwdLong: "Your password can't contain more than 16 characters. Please type a different password.",
+ PwdBadChar: "The password contains characters that aren't allowed. Please type a different password.",
+ IDInPwd: "Your password can't include the part of your ID. Please type a different password.",
+ FNInPwd: "Your password can't contain your first name. Please type a different password.",
+ LNInPwd: "Your password can't contain your last name. Please type a different password.",
+ TooWeak: "Your password is Too Weak."
+};
+
+Roo.bootstrap.form.SecurePass.meterLabel = "Password strength:";
+Roo.bootstrap.form.SecurePass.pwdStrengths = ["Too Weak", "Weak", "Medium", "Strong"];
+Roo.bootstrap.form.SecurePass.meterClass = [
+ "roo-password-meter-tooweak",
+ "roo-password-meter-weak",
+ "roo-password-meter-medium",
+ "roo-password-meter-strong",
+ "roo-password-meter-grey"
+];/**
* @class Roo.bootstrap.form.Password
* @extends Roo.bootstrap.form.Input
* Bootstrap Password class
{
// we can not rely on yahoo syndication to use CSS elements - so have to use '<i>' to encase stuff.
tag : 'i',
- contenteditable : true,
+ contenteditable : Roo.htmleditor.BlockFigure.caption_edit,
html : captionhtml
}
-})
+});
+
+Roo.apply(Roo.htmleditor.BlockFigure, {
+ caption_edit : true
+});