can3p (can3p) wrote in changelog,
can3p
can3p
changelog

[ljcom] r9467: LJSUP-6550: SMS Notifications bug fixes

Committer: dpetrov
LJSUP-6550: SMS Notifications bug fixes
U   trunk/htdocs/js/editprofile.js
Modified: trunk/htdocs/js/editprofile.js
===================================================================
--- trunk/htdocs/js/editprofile.js	2010-09-06 08:21:01 UTC (rev 9466)
+++ trunk/htdocs/js/editprofile.js	2010-09-07 01:59:14 UTC (rev 9467)
@@ -4,7 +4,7 @@
 	$.fn.maskInput = function(options)
 	{
 		var supportedDEF = [901,903,905,906,909,920,921,922,923,924,925,926,927,928,929,930,931,932,933,934,936,937,938,960,961,962,963,964,965,967,968,997],
-			mask = /^(\+?[17]|8)\d{10}$/,
+			mask = /^(\+?[7]|8)\d{10}$/,
 			allowedChars = "0-9";
 		var lastValue;
 
@@ -78,28 +78,25 @@
 					if(!that.checkProvider(that.ui.provider.val()) || that.ui.phInput.val().length == 0)
 					{
 						that.setState('initial', 'info', 'initial');
-						return;
-					}
-
-					if(!isok)
+					} 
+					else if(!isok)
 					{
 						that.setState('badNum', 'error', 'badnum');
-						return;
 					}
-
-					if(!isGoodDef)
+					else if(!isGoodDef)
 					{
-						that.setState('unsupporteddef', 'error', 'unsupporteddef');
-						return;
+						that.setState('unsupporteddef', 'success', 'unsupporteddef');
 					}
-
-					if(initial)
+					else
 					{
-						that.checkVerification();
-						initial = false;
+						if(initial)
+						{
+							that.checkVerification();
+							initial = false;
+						}
+						else
+							that.setState('correctNum', 'success', 'correctnum');
 					}
-					else
-						that.setState('correctNum', 'success', 'correctnum');
 				}
 			});
 
@@ -243,37 +240,30 @@
 				hideSendButton = hideSendButton || false;
 				that.ui.resendBtn.parent('.b-manage-smsn-btn').css('display', (hideSendButton) ? 'none' : '');
 				clearInterval(that.verifyTimer);
-				this.stopVerification = true;
+				that.stopVerification = true;
 				that.ui.phVerification.css('display', 'none');
 				that.ui.verCode.val('');
+				bt.val(dict['sendsmsbut']);
 				that.skipReqSent = false;
 			}
 
 			if(this.skipReqSent && event == 'reqsent')
 				return;
 									
-			switch(status)
-			{
-				case 'info': setBubble('info'); break;
-				case 'success': setBubble('success'); break;
-				case 'error': setBubble('error'); break;
-			}
+			setBubble(status);
 
-
 			if(event.length > 0)
 			{
-				var eventClasses = ['initial', 'badnum', 'correctnum', 'reqsent', 'rateexceed', 'verified'];
+				var eventClasses = ['initial', 'badnum', 'correctnum', 'reqsent', 'rateexceed', 'verified', 'wrongcode', 'unsupporteddef'];
 				n.find(".i-manage-smsn-icon").removeClass($.map(eventClasses, function(el){ return "i-manage-smsn-" + el }).join(' '));
 				n.find(".i-manage-smsn-icon").addClass("i-manage-smsn-" + event);
 				switch(event)
 				{
 					case 'initial':
 					case 'badnum':  bt.attr('disabled', true);
-									bt.val(smsNotifyDict['sendsmsbut']);
 									resetUI();
 									break;
 					case 'correctnum': bt.attr('disabled', false);
-									bt.val(smsNotifyDict['sendsmsbut']);
 									resetUI();
 									break;
 					case 'reqsent':	bt.val( dict['resendsmsbut']);
@@ -288,6 +278,9 @@
 									break;
 					case 'wrongcode': this.skipReqSent = true;
 									  break;
+					case 'unsupporteddef': resetUI(true);
+									bt.attr('disabled', true);
+									break;
 				}
 			}
 

Tags: can3p, js, ljcom
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments