Commit 8845454adff35a38c0a7224e9e6d3b84ceb066d4
1 parent
7be3ebe4
login and dynamic modules
Showing
12 changed files
with
42 additions
and
201 deletions
400-SOURCECODE/AIAHTML5.API/Models/Users.cs
... | ... | @@ -23,23 +23,28 @@ namespace AIAHTML5.API.Models |
23 | 23 | var client = new MongoClient(); |
24 | 24 | var db = client.GetDatabase(Settings.Default.database); |
25 | 25 | |
26 | - var collection = db.GetCollection<BsonDocument>("Users"); | |
26 | + var collection = db.GetCollection<dynamic>("Users"); | |
27 | 27 | |
28 | 28 | // var builder = Builders<BsonDocument>.Filter; |
29 | 29 | BsonDocument filter = new BsonDocument(); |
30 | 30 | filter.Add("loginId", credentials["username"].ToString()); |
31 | 31 | filter.Add("password", credentials["password"].ToString()); |
32 | 32 | |
33 | - dynamic userDetails = collection.Find(filter).SingleOrDefault(); | |
34 | - logger.Debug("userDetails= " + userDetails.ElementCount); | |
35 | - if (userDetails.ElementCount > 0) | |
36 | - { | |
33 | + | |
34 | + FilterDefinition<dynamic>[] filterCondition = { Builders<dynamic>.Filter.Eq("loginId", credentials["username"].ToString()), | |
35 | + Builders<dynamic>.Filter.Eq("password", credentials["password"].ToString())}; | |
36 | + | |
37 | + dynamic userDetails = collection.Find(Builders<dynamic>.Filter.And(filterCondition)).SingleOrDefault(); | |
38 | + | |
39 | + //logger.Debug("userDetails= " + userDetails.ElementCount); | |
40 | + //if (userDetails.ElementCount > 0) | |
41 | + //{ | |
37 | 42 | return userDetails; |
38 | - } | |
39 | - else | |
40 | - { | |
41 | - return AIAConstants.USER_NOT_FOUND; | |
42 | - } | |
43 | + //} | |
44 | + //else | |
45 | + //{ | |
46 | + // return AIAConstants.USER_NOT_FOUND; | |
47 | + //} | |
43 | 48 | } |
44 | 49 | catch(Exception e) |
45 | 50 | { | ... | ... |
400-SOURCECODE/AIAHTML5.Web/AIAHTML5.Web.csproj
... | ... | @@ -50,7 +50,6 @@ |
50 | 50 | <Content Include="app\controllers\DAController.js" /> |
51 | 51 | <Content Include="app\controllers\HomeController.js" /> |
52 | 52 | <Content Include="app\controllers\LabExercController.js" /> |
53 | - <Content Include="app\controllers\LoginController.js" /> | |
54 | 53 | <Content Include="app\main\AIA.js" /> |
55 | 54 | <Content Include="app\main\Link.js" /> |
56 | 55 | <Content Include="app\services\AuthenticationService.js" /> |
... | ... | @@ -43228,7 +43227,6 @@ |
43228 | 43227 | <Content Include="libs\video_4_12_11\img\video-js.png" /> |
43229 | 43228 | <Content Include="libs\video_4_12_11\video_4_12_11.js" /> |
43230 | 43229 | <Content Include="libs\worker.js" /> |
43231 | - <Content Include="login.html" /> | |
43232 | 43230 | <Content Include="app\widget\MainView.html" /> |
43233 | 43231 | <Content Include="extract-wp.js" /> |
43234 | 43232 | <Content Include="search-wp.js" /> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
... | ... | @@ -20,6 +20,10 @@ function ($scope, $rootScope, pages, log,Modules,$http,$compile) { |
20 | 20 | //load json data |
21 | 21 | $scope.loadCurriculumBuiderData = function () { |
22 | 22 | |
23 | + | |
24 | + //get current path | |
25 | + var currentURL = $location.path(); | |
26 | + | |
23 | 27 | $http({ method: 'GET', url: 'content/data/json/cb/cb_list_content.json' }).success(function (data) { |
24 | 28 | |
25 | 29 | $scope.listCurriculumBuilder = data; | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -170,7 +170,7 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
170 | 170 | if ($('#MainImage') != null) { |
171 | 171 | $('#MainImage').remove(); |
172 | 172 | } |
173 | - $rootScope.currentActiveModuleTitle = Modules[0].Name; | |
173 | + // $rootScope.currentActiveModuleTitle = Modules[0].Name; | |
174 | 174 | $("#bodyViewList").empty(); |
175 | 175 | //for default load |
176 | 176 | if ($event == null || $event == undefined) { |
... | ... | @@ -363,6 +363,19 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo |
363 | 363 | //load json data for body view |
364 | 364 | $scope.loadDissectibleAnatomyData = function () { |
365 | 365 | |
366 | + //get current path | |
367 | + var currentURL = $location.path(); | |
368 | + var selectedModuleName = ''; | |
369 | + angular.forEach( $rootScope.userModules, function (value, key) { | |
370 | + // alert(value.slug + 'and currentURL= ' + currentURL + 'NAD value.name= ' + value.name); | |
371 | + if (value.slug === currentURL.replace('/','')) { | |
372 | + selectedModuleName = value.name; | |
373 | + // alert('moduleName= '+moduleName) | |
374 | + } | |
375 | + $rootScope.currentActiveModuleTitle = selectedModuleName; | |
376 | + }) | |
377 | + | |
378 | + | |
366 | 379 | $rootScope.ClearIframe(); |
367 | 380 | |
368 | 381 | //load common data | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... | ... | @@ -72,9 +72,9 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService,Authentica |
72 | 72 | $rootScope.shapestyleborderStyles = "solid"; |
73 | 73 | |
74 | 74 | $rootScope.initializeAIA = function () { |
75 | + | |
75 | 76 | $rootScope.isLoading = false; |
76 | 77 | $rootScope.isVisibleLogin = true; |
77 | - $rootScope.isVisibleIndex = false; | |
78 | 78 | |
79 | 79 | } |
80 | 80 | |
... | ... | @@ -86,11 +86,11 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService,Authentica |
86 | 86 | $rootScope.userModules ; |
87 | 87 | |
88 | 88 | $rootScope.AuthenticateUser = function (userInfo) { |
89 | + | |
89 | 90 | AuthenticationService.authenticateUser(userInfo) |
90 | 91 | .then( |
91 | 92 | |
92 | 93 | function (result) { |
93 | - | |
94 | 94 | |
95 | 95 | $rootScope.userData = result; |
96 | 96 | $rootScope.userModules = result.modules; | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/LinkController.js
... | ... | @@ -19,7 +19,8 @@ function ($scope, $rootScope, log, pages, $routeParams) { |
19 | 19 | // code that will be executed ... |
20 | 20 | // every time this view is loaded |
21 | 21 | |
22 | - for (var i = 0; i < $scope.links.length; i++) { | |
22 | + | |
23 | + for (var i = 0; i < $scope.links.length; i++) { | |
23 | 24 | if ($scope.links[i].modname == $routeParams.modname) { |
24 | 25 | $rootScope.currentActiveModuleTitle = $scope.links[i].title; |
25 | 26 | $scope.objdata = $scope.links[i].objurl; | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/controllers/LoginController.js deleted
1 | -'use strict'; | |
2 | - | |
3 | -AIA.controller("LoginController", ["$scope", "$rootScope", "$location", "$window", "AuthenticationService", | |
4 | -function ($scope, $rootScope,$location, $window, AuthenticationService) { | |
5 | - | |
6 | - $scope.userInfo = { | |
7 | - username: null, | |
8 | - password: null | |
9 | - }; | |
10 | - | |
11 | - $scope.AuthenticateUser = function (userInfo) { | |
12 | - AuthenticationService.authenticateUser(userInfo) | |
13 | - .then( | |
14 | - | |
15 | - function (result) { | |
16 | - | |
17 | - if (result.length > 0) { | |
18 | - angular.forEach(result, function (value, key) { | |
19 | - | |
20 | - if (value.Name == "modules") { | |
21 | - $scope.modules = value.Value; | |
22 | - var moduleList = [] | |
23 | - angular.forEach($scope.modules, function (value, key) { | |
24 | - | |
25 | - | |
26 | - moduleList.push( | |
27 | - | |
28 | - { | |
29 | - | |
30 | - "ModuleName": value[0].Value, | |
31 | - "ModuleSlug": value[1].Value | |
32 | - | |
33 | - } | |
34 | - | |
35 | - ); | |
36 | - }); | |
37 | - localStorage.setItem("modules", moduleList); | |
38 | - | |
39 | - $scope.name = "HELLO"; | |
40 | - // $location.url('/index.html') | |
41 | - $window.location.assign('/index.html'); | |
42 | - | |
43 | - } | |
44 | - | |
45 | - | |
46 | - | |
47 | - // if ((value._id == 1) | |
48 | - }) | |
49 | - } | |
50 | - //alert('user authentication = ' + result) | |
51 | - }, | |
52 | - function (error) { | |
53 | - // handle errors here | |
54 | - console.log(' $rootScope.BodyLayerData= ' + error.statusText); | |
55 | - }); | |
56 | - //.success(function (data) { | |
57 | - | |
58 | - // alert('user authentication= '+data) | |
59 | - | |
60 | - // }) | |
61 | - // .error(function () { | |
62 | - // alert('issue in authentocation') | |
63 | - // }) | |
64 | - } | |
65 | - | |
66 | - | |
67 | - $scope.showModules = function () { | |
68 | - $scope.modules = localStorage.getItem("modules"); | |
69 | - | |
70 | - } | |
71 | -} | |
72 | -]) | |
73 | 0 | \ No newline at end of file |
400-SOURCECODE/AIAHTML5.Web/app/main/AIA.js
... | ... | @@ -13,14 +13,7 @@ AIA.constant('pages', [ |
13 | 13 | pageUrl: 'index.html', |
14 | 14 | pageController: 'HomeController' |
15 | 15 | }, |
16 | - { | |
17 | - // id:0, | |
18 | - name: 'Login', | |
19 | - pageSlug: 'login', | |
20 | - pageUrl: 'login.html', | |
21 | - pageController: 'AuthenticationController' | |
22 | - }, | |
23 | - { // id:1, | |
16 | + { // id:1, | |
24 | 17 | name: 'Dissectible Anatomy Views List', |
25 | 18 | pageSlug: 'da-view-list', |
26 | 19 | pageUrl: 'app/views/da/da-body-view-list.html', |
... | ... | @@ -49,7 +42,7 @@ AIA.constant('pages', [ |
49 | 42 | }, |
50 | 43 | { // id:5, |
51 | 44 | name: '3D Anatomy', |
52 | - pageSlug: '3dAnatomy', | |
45 | + pageSlug: '3d-anatomy-list', | |
53 | 46 | pageUrl: 'app/views/3dA/3dA-view.html', |
54 | 47 | pageController: '3dAController' |
55 | 48 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/services/AuthenticationService.js
... | ... | @@ -3,7 +3,7 @@ |
3 | 3 | authenticateUser: function (userInfo) { |
4 | 4 | var deferred = $q.defer(); |
5 | 5 | |
6 | - $http.post('http://localhost:95/API/api/Authenticate', JSON.stringify(userInfo), { | |
6 | + $http.post('/API/api/Authenticate', JSON.stringify(userInfo), { | |
7 | 7 | headers: { |
8 | 8 | 'Content-Type': 'application/json' |
9 | 9 | } | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/widget/MainMenu.html
1 | -<div class="bodyWrap row container-fluid" ng-controller="LoginController"> | |
1 | +<div class="bodyWrap row container-fluid" > | |
2 | 2 | <div class="col-sm-12 col-md-12 pageHeading"> |
3 | 3 | <!--<button type="button" class="btn btn-success pull-left toggleBar btn-sm" data-toggle="tooltip" data-placement="top" title="Show/Hide Sidebar"> <i class="fa fa-bars"></i> </button>--> |
4 | 4 | <div class=" pull-left toggleBar toggleHeadingButton" data-toggle="tooltip" data-placement="top" title="Show/Hide Sidebar" style="padding-left: 15px; "> <i class="fa fa-bars"></i> </div> |
... | ... | @@ -46,8 +46,7 @@ |
46 | 46 | </div> |
47 | 47 | |
48 | 48 | </div> |
49 | - | |
50 | -<script src="../controllers/LoginController.js"></script> | |
49 | +<script src="../controllers/HomeController.js"></script> | |
51 | 50 | <script src="app/services/AuthenticationService.js"></script> |
52 | 51 | |
53 | 52 | ... | ... |
400-SOURCECODE/AIAHTML5.Web/index.html
... | ... | @@ -1233,7 +1233,6 @@ |
1233 | 1233 | <script src="app/controllers/AODController.js"></script> |
1234 | 1234 | <script src="app/controllers/HomeController.js"></script> |
1235 | 1235 | <script src="app/controllers/LinkController.js"></script> |
1236 | - <script src="app/controllers/LoginController.js"></script> | |
1237 | 1236 | <script src="app/services/AuthenticationService.js"></script> |
1238 | 1237 | |
1239 | 1238 | <script src="app/services/DataService.js"></script> | ... | ... |
400-SOURCECODE/AIAHTML5.Web/login.html deleted
1 | -<!DOCTYPE html> | |
2 | -<html lang="en" ng-app="AIA"> | |
3 | -<head> | |
4 | - <base href="/" /> | |
5 | - | |
6 | - <meta charset="utf-8"> | |
7 | - <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
8 | - <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> | |
9 | - <title>A.D.A.M. Interactive Anatomy</title> | |
10 | - <link href="themes/default/css/bootstrap/3.3.6/bootstrap.css" rel="stylesheet" /> | |
11 | - | |
12 | - <link href="themes/default/css/bootstrap/3.3.6/main.css" rel="stylesheet" /> | |
13 | - | |
14 | - <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,800,700,600,400italic"> | |
15 | - <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> | |
16 | - | |
17 | -</head> | |
18 | -<body ng-controller="LoginController"> | |
19 | - <div class="container-fluid loginBg"> | |
20 | - <div class="row"> | |
21 | - <div class="col-xs-12 text-center"> | |
22 | - <a href="index.html" class="loginLogo"><img src="img/logo-large.png" class="img-responsive" alt=""></a> | |
23 | - <div class="headerBand row"> | |
24 | - <div class="col-xs-12"> | |
25 | - <h1>A.D.A.M. Interactive Anatomy</h1> | |
26 | - <p>The most compresive online interactive anatomy learning resource</p> | |
27 | - </div> | |
28 | - </div> | |
29 | - </div> | |
30 | - <!--LOGIN PANEL--> | |
31 | - <div class="col-xs-12 loginPanel"> | |
32 | - <div class="loginBox clearfix"> | |
33 | - <div class="col-xs-12"> | |
34 | - <!--<strong>Login</strong>--> | |
35 | - <form> | |
36 | - <div class="form-group"> | |
37 | - <!--<label for="">User ID</label>--> | |
38 | - <!--input type="email" class="form-control" placeholder="User ID"> | |
39 | - <span class="help-block text-right small"><a href="#" class="color-white">Forgot User ID?</a></span>--> | |
40 | - | |
41 | - | |
42 | - <div class="input-group"> | |
43 | - <span class="input-group-addon"><i class="fa fa-user"></i></span> | |
44 | - <input type="text" class="form-control" placeholder="Username" ng-model="userInfo.username"> | |
45 | - </div> | |
46 | - <span class="help-block text-right small"><a href="#" class="color-white">Forgot User ID?</a></span> | |
47 | - | |
48 | - | |
49 | - </div> | |
50 | - <div class="form-group"> | |
51 | - <!--<label for="">Password</label>--> | |
52 | - <!--<input type="password" class="form-control" placeholder="Password"> | |
53 | - <span class="help-block text-right small "><a href="#" class="color-white">Forgot Password?</a></span>--> | |
54 | - <div class="input-group"> | |
55 | - <span class="input-group-addon"><i class="fa fa-key"></i></span> | |
56 | - <input type="password" class="form-control" placeholder="Password" ng-model="userInfo.password"> | |
57 | - </div> | |
58 | - <span class="help-block text-right small "><a href="#" class="color-white">Forgot Password?</a></span> | |
59 | - </div> | |
60 | - <div class="form-group"> | |
61 | - <button class="btn btn-primary pull-right" ng-click="AuthenticateUser(userInfo)">Log In</button> | |
62 | - </div> | |
63 | - </form> | |
64 | - </div> | |
65 | - </div> | |
66 | - <div class="loginExBtn"> | |
67 | - <a href="#" class="btn btn-primary">Subscribe Now</a> | |
68 | - <a href="#" class="btn btn-primary pull-right">Learn More</a> | |
69 | - </div> | |
70 | - </div> | |
71 | - </div> | |
72 | - </div> | |
73 | - | |
74 | - <!-- Footer --> | |
75 | - <footer class="dark"> | |
76 | - <div class="container-fluid text-center">Copyright © 2016 Ebix Inc. All rights reserved.</div> | |
77 | - </footer> | |
78 | - | |
79 | - | |
80 | - <script src="libs/jquery/2.1.3/jquery.min.js"></script> | |
81 | - <script src="libs/jquery/1.11.4/jquery-ui.js"></script> | |
82 | - <script src="libs/jquery/jquery_plugin/jquery.mCustomScrollbar.concat.min.js"></script> | |
83 | - <script src="themes/default/scripts/bootstrap/3.3.5/bootstrap.js"></script> | |
84 | - | |
85 | - | |
86 | - <script src="libs/angular/1.4.9/angular.min.js"></script> | |
87 | - | |
88 | - | |
89 | - <script src="libs/angular/1.4.9/angular-route.min.js"></script> | |
90 | - <script src="libs/angular/1.4.9/angular-sanitize.min.js"></script> | |
91 | - <script src="libs/angular/1.4.9/ngStorage.js"></script> | |
92 | - <script src="content/js/custom/custom.js"></script> | |
93 | - | |
94 | - <script src="app/main/AIA.js"></script> | |
95 | - <script src="content/scripts/js/custom/custom.js"></script> | |
96 | - <script src="app/services/AuthenticationService.js"></script> | |
97 | - <script src="app/controllers/LoginController.js"></script> | |
98 | -</body> | |
99 | -</html> | |
100 | 0 | \ No newline at end of file |