Commit 4705a3f733da0406c96c97eb9003393aebcc724e

Authored by Amrita Vishnoi
2 parents 1e20167d c306fe7f

Against Merge Request #799.

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -3063,9 +3063,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l @@ -3063,9 +3063,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
3063 grayCanvasContext.putImageData($rootScope.grayImageDataList[parseInt(i)], 0, 0); 3063 grayCanvasContext.putImageData($rootScope.grayImageDataList[parseInt(i)], 0, 0);
3064 } 3064 }
3065 } 3065 }
3066 - $scope.message = AIAConstants.NO_BODY_SYSTEM_AVAILABLE;  
3067 - $("#daMessageModal").modal('show');  
3068 - 3066 +
3069 3067
3070 $scope.message = AIAConstants.NO_BODY_SYSTEM_AVAILABLE; 3068 $scope.message = AIAConstants.NO_BODY_SYSTEM_AVAILABLE;
3071 $("#daMessageModal").modal('show'); 3069 $("#daMessageModal").modal('show');
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
1 'use strict'; 1 'use strict';
2 2
3 -AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants",  
4 -function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants) { 3 +AIA.controller("HomeController", ["$rootScope", "Modules", "$log", "$location", "$timeout", "DataService", "AuthenticationService", "LoginConstants", "UserModules", "LoginMessageConstants", "AdminService", "$http", "AdminConstants", "UserTypeConstants", "AIAConstants",
  4 +function ($rootScope, Modules, $log, $location, $timeout, DataService, AuthenticationService, LoginConstants, UserModules, LoginMessageConstants, AdminService, $http, AdminConstants, UserTypeConstants,AIAConstants) {
5 5
6 //$scope.pageToOpen = { 6 //$scope.pageToOpen = {
7 // name: 'MainMenu' 7 // name: 'MainMenu'
@@ -111,117 +111,138 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -111,117 +111,138 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
111 $("body.modal-open").css("padding-right", "0px"); 111 $("body.modal-open").css("padding-right", "0px");
112 112
113 } 113 }
114 - $rootScope.initializeAIA = function () {  
115 114
116 - $rootScope.isLoading = false;  
117 -  
118 - var url = $location.url(); 115 + $rootScope.promptUserForCookies= function()
  116 + {
  117 + $rootScope.errorMessage = AIAConstants.COOKIES_MESSAGE;
  118 + $("#messageModal").modal('show');
  119 +
  120 + }
  121 +
  122 +
  123 + $rootScope.initializeAIA = function () {
  124 +
  125 + if (navigator.cookieEnabled) {
119 126
120 - if (url.indexOf('?unb:') != -1) { 127 + $rootScope.isLoading = false;
121 128
122 - $rootScope.isVisibleLogin = true;  
123 - $rootScope.UnblockUser();  
124 - }  
125 - else if (url.indexOf('?em:') != -1) { 129 + var url = $location.url();
  130 +
  131 + //unblock user
  132 + if (url.indexOf('?unb:') != -1) {
126 133
127 - $rootScope.isVisibleLogin = false;  
128 - $rootScope.isVisibleResetPass = true; 134 + $rootScope.isVisibleLogin = true;
  135 + $rootScope.UnblockUser();
  136 + }
  137 + else if (url.indexOf('?em:') != -1) {
  138 +
  139 + $rootScope.isVisibleLogin = false;
  140 + $rootScope.isVisibleResetPass = true;
  141 + }
  142 + else {
  143 + $rootScope.isVisibleLogin = true;
  144 + $rootScope.isVisibleResetPass = false;
  145 + getUserDetails();
  146 + }
129 } 147 }
  148 +
130 else { 149 else {
  150 +
131 $rootScope.isVisibleLogin = true; 151 $rootScope.isVisibleLogin = true;
132 - $rootScope.isVisibleResetPass = false;  
133 - getUserDetails(); 152 +
  153 + $rootScope.promptUserForCookies();
134 } 154 }
135 155
136 156
137 } 157 }
138 158
139 - $rootScope.AuthenticateUser = function (userInfo) {  
140 - $rootScope.errorMessage = "";  
141 - if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) { 159 + $rootScope.AuthenticateUser = function (userInfo)
  160 + {
  161 + if (navigator.cookieEnabled) {
142 162
143 - // alert(LoginMessageConstants.USER_CREDENTIALS_MISSING);  
144 - $rootScope.errorMessage = LoginMessageConstants.USER_CREDENTIALS_MISSING;  
145 - $("#messageModal").modal('show');  
146 - }  
147 - else { 163 + $rootScope.errorMessage = "";
  164 + if (userInfo.username == "" || userInfo.username == null || userInfo.password == "" || userInfo.password == null) {
148 165
149 - AuthenticationService.authenticateUser(userInfo)  
150 - .then( 166 + // alert(LoginMessageConstants.USER_CREDENTIALS_MISSING);
  167 + $rootScope.errorMessage = LoginMessageConstants.USER_CREDENTIALS_MISSING;
  168 + $("#messageModal").modal('show');
  169 + }
  170 + else {
151 171
152 - function (result) {  
153 - if (result == LoginConstants.USER_NOT_FOUND) {  
154 - $rootScope.isVisibleLogin = true;  
155 - // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);  
156 - $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;  
157 - $("#messageModal").modal('show');  
158 - }  
159 - else {  
160 - if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) { 172 + AuthenticationService.authenticateUser(userInfo)
  173 + .then(
161 174
162 - if ($("#messageModal").length > 0) {  
163 - $("#messageModal").modal('hide');  
164 - }  
165 - if (result.LoginFailureCauseId!=undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) {  
166 - $rootScope.isVisibleLogin = true;  
167 - $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD;  
168 - $("#messageModal").modal('show');  
169 - }  
170 - else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS)  
171 - {  
172 - $rootScope.isVisibleLogin = true;  
173 - $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED;  
174 - $("#messageModal").modal('show');  
175 - }  
176 - else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && result.IsSubscriptionExpired)  
177 - {  
178 - $rootScope.isVisibleLogin = true;  
179 - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';  
180 - $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;  
181 - $("#messageModal").modal('show');  
182 - }  
183 - else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {  
184 - $rootScope.isVisibleLogin = true;  
185 - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';  
186 - $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;  
187 - $("#messageModal").modal('show');  
188 - }  
189 - else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {  
190 - $rootScope.isVisibleLogin = true;  
191 - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';  
192 - $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;  
193 - $("#messageModal").modal('show');  
194 - }  
195 - else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {  
196 - $rootScope.isVisibleLogin = true;  
197 - $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;  
198 - $("#messageModal").modal('show');  
199 - }  
200 - else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) {  
201 - $rootScope.isVisibleLogin = true;  
202 - $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;  
203 - $("#messageModal").modal('show');  
204 - }  
205 - else if ( (result.LicenseInfo!= null) && (result.LicenseInfo!= undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {  
206 - $rootScope.isVisibleLogin = true;  
207 - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';  
208 - $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;  
209 - $("#messageModal").modal('show');  
210 - }  
211 - else if ((result.LicenseInfo!= null) && (result.LicenseInfo!= undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {  
212 - $rootScope.isVisibleLogin = true;  
213 - $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';  
214 - $("#messageModal").modal('show');  
215 - }  
216 - else if ((result.LicenseInfo!= null) && (result.LicenseInfo!= undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {  
217 - $rootScope.isVisibleLogin = true;  
218 - $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;  
219 - $("#messageModal").modal('show');  
220 - }  
221 - else {  
222 -  
223 - //if (result.UserType == UserTypeConstants.SUPER_ADMIN && result.IsActive) { //(!result.IsSubscriptionExpired) &&  
224 - if (result.LicenseId == 0 && result.IsActive) { 175 + function (result) {
  176 + if (result == LoginConstants.USER_NOT_FOUND) {
  177 + $rootScope.isVisibleLogin = true;
  178 + // alert(LoginMessageConstants.USER_OR_PASSWORD_INCORRECT);
  179 + $rootScope.errorMessage = LoginMessageConstants.INVALID_USER;
  180 + $("#messageModal").modal('show');
  181 + }
  182 + else {
  183 + if (typeof result.LoginId != undefined || result.LoginId != "" || result.LoginId != null) {
  184 +
  185 + if ($("#messageModal").length > 0) {
  186 + $("#messageModal").modal('hide');
  187 + }
  188 + if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_PASSWORD_NOT_MATCH) {
  189 + $rootScope.isVisibleLogin = true;
  190 + $rootScope.errorMessage = LoginMessageConstants.INVALID_PASSWORD;
  191 + $("#messageModal").modal('show');
  192 + }
  193 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_ID_BLOCKED_24_HRS) {
  194 + $rootScope.isVisibleLogin = true;
  195 + $rootScope.errorMessage = LoginMessageConstants.USER_BLOCKED;
  196 + $("#messageModal").modal('show');
  197 + }
  198 + else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
  199 + $rootScope.isVisibleLogin = true;
  200 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
  201 + $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
  202 + $("#messageModal").modal('show');
  203 + }
  204 + else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
  205 + $rootScope.isVisibleLogin = true;
  206 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
  207 + $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
  208 + $("#messageModal").modal('show');
  209 + }
  210 + else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && result.IsSubscriptionExpired) {
  211 + $rootScope.isVisibleLogin = true;
  212 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
  213 + $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
  214 + $("#messageModal").modal('show');
  215 + }
  216 + else if ((result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) && (result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {
  217 + $rootScope.isVisibleLogin = true;
  218 + $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE + ' ' + LoginMessageConstants.USER_INACTIVE_MESSAGE;
  219 + $("#messageModal").modal('show');
  220 + }
  221 + else if (result.LoginFailureCauseId != undefined && result.LoginFailureCauseId.toString() == LoginConstants.E_USER_NOT_ACTIVE) {
  222 + $rootScope.isVisibleLogin = true;
  223 + $rootScope.errorMessage = LoginMessageConstants.USER_INACTIVE_MESSAGE;
  224 + $("#messageModal").modal('show');
  225 + }
  226 + else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
  227 + $rootScope.isVisibleLogin = true;
  228 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
  229 + $rootScope.errorMessage = $rootScope.errorMessage + ' ' + LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
  230 + $("#messageModal").modal('show');
  231 + }
  232 + else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (result.LicenseInfo.IsActive) && (result.IsSubscriptionExpired)) {
  233 + $rootScope.isVisibleLogin = true;
  234 + $rootScope.errorMessage = LoginMessageConstants.SUBSCRIPTION_EXPIRATION_MESSAGE + result.SubscriptionExpirationDate + '.';
  235 + $("#messageModal").modal('show');
  236 + }
  237 + else if ((result.LicenseInfo != null) && (result.LicenseInfo != undefined) && (!result.LicenseInfo.IsActive) && (!result.IsSubscriptionExpired)) {
  238 + $rootScope.isVisibleLogin = true;
  239 + $rootScope.errorMessage = LoginMessageConstants.LICENSE_INACTIVE_MESSAGE;
  240 + $("#messageModal").modal('show');
  241 + }
  242 + else {
  243 +
  244 + //if (result.UserType == UserTypeConstants.SUPER_ADMIN && result.IsActive) { //(!result.IsSubscriptionExpired) &&
  245 + if (result.LicenseId == 0 && result.IsActive) {
225 $rootScope.userData = result; 246 $rootScope.userData = result;
226 $rootScope.userModules = result.Modules; 247 $rootScope.userModules = result.Modules;
227 $rootScope.isVisibleLogin = false; 248 $rootScope.isVisibleLogin = false;
@@ -233,42 +254,49 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic @@ -233,42 +254,49 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
233 } 254 }
234 else { 255 else {
235 if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) { 256 if (result.LicenseInfo != null && result.LicenseInfo.IsTermAccepted) {
236 - $rootScope.userData = result;  
237 - $rootScope.userModules = result.Modules;  
238 - $rootScope.isVisibleLogin = false;  
239 - $rootScope.haveRoleAdmin = false;  
240 - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));  
241 - ShowAssignedModulesPopup(result.Modules);  
242 - $location.path('/'); 257 + $rootScope.userData = result;
  258 + $rootScope.userModules = result.Modules;
  259 + $rootScope.isVisibleLogin = false;
  260 + $rootScope.haveRoleAdmin = false;
  261 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  262 + ShowAssignedModulesPopup(result.Modules);
  263 + $location.path('/');
243 264
  265 + }
  266 + else {
  267 + if ($('#dvTerms').length > 0) {
  268 + $('#dvTerms').html(result.TermsAndConditionsText);
244 } 269 }
245 - else {  
246 - if ($('#dvTerms').length > 0) {  
247 - $('#dvTerms').html(result.TermsAndConditionsText);  
248 - }  
249 - $rootScope.isVisibleLogin = true;  
250 - $('#dvTermCondition').fadeIn();  
251 - $rootScope.userData = result;  
252 - $rootScope.haveRoleAdmin = false;  
253 - localStorage.setItem('loggedInUserDetails', JSON.stringify(result));  
254 - $location.path('/');  
255 - } 270 + $rootScope.isVisibleLogin = true;
  271 + $('#dvTermCondition').fadeIn();
  272 + $rootScope.userData = result;
  273 + $rootScope.haveRoleAdmin = false;
  274 + localStorage.setItem('loggedInUserDetails', JSON.stringify(result));
  275 + $location.path('/');
256 } 276 }
257 -  
258 } 277 }
259 - 278 +
260 } 279 }
  280 +
261 } 281 }
262 - }),  
263 -  
264 - function (error) {  
265 - console.log(' Error in authentication = ' + error.statusText);  
266 - // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);  
267 - $rootScope.isVisibleLogin = true;  
268 - $rootScope.errorMessage = error;  
269 - $("#messageModal").modal('show');  
270 - } 282 + }
  283 + }),
  284 +
  285 + function (error) {
  286 + console.log(' Error in authentication = ' + error.statusText);
  287 + // alert(LoginMessageConstants.ERROR_IN_FECTHING_DETAILS);
  288 + $rootScope.isVisibleLogin = true;
  289 + $rootScope.errorMessage = error;
  290 + $("#messageModal").modal('show');
  291 + }
  292 + }
271 } 293 }
  294 +
  295 + else
  296 + {
  297 + $rootScope.promptUserForCookies();
  298 + }
  299 +
272 } 300 }
273 301
274 function ShowAssignedModulesPopup(userModules) { 302 function ShowAssignedModulesPopup(userModules) {
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
@@ -492,11 +492,13 @@ AIA.constant("UserModules", [ @@ -492,11 +492,13 @@ AIA.constant("UserModules", [
492 } 492 }
493 ]); 493 ]);
494 494
495 -AIA.constant("AIAConstants", {  
496 495
  496 +AIA.constant("AIAConstants", {
497 "NO_BODY_SYSTEM_AVAILABLE": "Selected body system is not available on this layer.", 497 "NO_BODY_SYSTEM_AVAILABLE": "Selected body system is not available on this layer.",
  498 + "COOKIES_MESSAGE": "You need to enable your browser's cookies to run this application.",
498 }) 499 })
499 500
  501 +
500 AIA.config(function ($routeProvider, pages, $locationProvider) { 502 AIA.config(function ($routeProvider, pages, $locationProvider) {
501 503
502 $locationProvider.html5Mode(true); 504 $locationProvider.html5Mode(true);