Commit 06560f401fc73211afadc6ab4c74ae9ab006b5b1

Authored by Nikita Kulshreshtha
2 parents 4bdc9664 ad052ea0

manually merged code for OldCBIntegration Branch

400-SOURCECODE/AIAHTML5.Web/app/controllers/CurrBuildController.js
1   -AIA.controller("CurrBuildController", ["$scope", "$rootScope", "pages", "$log", "Modules", "$http", "$compile", "$location",
2   -function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location) {
3   -
4   - // $rootScope.currentActiveModuleTitle = pages[6].name;
5   - $scope.showTabButton = false;
6   - $scope.listCurriculumBuilder = null;
7   - $scope.dataPopup = null;
8   - $scope.countLeftlist;
9   - $scope.countRightlist;
10   - $scope.IsVisible = function () {
11   - $scope.scroll();
12   -
13   - }
14   -
15   - $scope.scroll = function () {
16   - // $window.scrollTo(0, 0);
17   - $("html,body").scrollTop(0);
18   - //alert("scroll");
19   - }
20   - //load json data
21   - $scope.loadCurriculumBuiderData = function () {
22   -
23   - if ($rootScope.refreshcheck == null) {
24   - $location.path('/');
25   - }
26   - //get current path
27   - var currentURL = $location.path();
28   - var selectedModuleName = '';
29   - //set module title
30   - angular.forEach($rootScope.userModules, function (value, key) {
31   - if (value.slug === currentURL.replace('/', '')) {
32   - selectedModuleName = value.name;
33   - }
34   - $rootScope.currentActiveModuleTitle = selectedModuleName;
35   - })
36   -
37   - //get current path
38   - var currentURL = $location.path();
39   -
40   - $http({ method: 'GET', url: 'content/data/json/cb/cb_list_content.json' }).success(function (data) {
41   -
42   - $scope.listCurriculumBuilder = data;
43   - //load default body view list
44   - $scope.getCBViewList();
45   - })
46   - .error(function (data, status, headers, config) {
47   - console.log(data);
48   - });
49   - }
50   - //get CB body view list
51   - $scope.getCBViewList = function ($event) {
52   -
53   - $('#leftBodyViewList').empty();
54   - $scope.countLeftlist = Object.keys($scope.listCurriculumBuilder.slideshows.slideshow).length / 2;
55   - $scope.loadleftBodyViewList = new jinqJs()
56   - .from($scope.listCurriculumBuilder.slideshows.slideshow)
57   - .select();
58   - for (var i = 0; i < $scope.countLeftlist; i++) {
59   - console.log($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
60   - //alert($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
61   - var $el = $('<li class="list-group-item" data-toggle="modal" data-target="#myModal-1" ng-click="loadSlideShowXmldata()"><a href="#"><i class="fa fa-check"></i>' + $scope.listCurriculumBuilder.slideshows.slideshow[i]._label + '</a></li>').appendTo('#leftBodyViewList');
62   - $compile($el)($scope);
63   - }
64   -
65   - $scope.countRightlist = Object.keys($scope.listCurriculumBuilder.slideshows.slideshow).length;
66   - for (var i = $scope.countLeftlist; i < $scope.countRightlist; i++) {
67   - console.log($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
68   - var $el1 = $('<li class="list-group-item" data-toggle="modal" ng-click="loadSlideShowXmldata()" data-target="#myModal-1"><a href="#"><i class="fa fa-check"></i>' + $scope.listCurriculumBuilder.slideshows.slideshow[i]._label + '</a></li>').appendTo('#rightBodyViewList');
69   - $compile($el)($scope);
70   - }
71   -
72   - }
73   -
74   - $scope.loadSlideShowXmldata = function (e) {
75   -
76   - // alert(e);
77   - $http({ method: 'GET', url: 'content/data/json/cb/SlideShow/AIA_Curriculum_Builder_Guide.sldshw' }).success(function (data) {
78   -
79   - $scope.dataPopup = data;
80   - alert($scope.dataPopup);
81   - })
82   - .error(function (data, status, headers, config) {
83   - console.log(data);
84   - });
85   - }
86   -}]
87   -
88   -
89   -
  1 +AIA.controller("CurrBuildController", ["$scope", "$rootScope", "pages", "$log", "Modules", "$http", "$compile", "$location",
  2 +function ($scope, $rootScope, pages, log, Modules, $http, $compile, $location) {
  3 +
  4 + // $rootScope.currentActiveModuleTitle = pages[6].name;
  5 + $scope.showTabButton = false;
  6 + $scope.listCurriculumBuilder = null;
  7 + $scope.dataPopup = null;
  8 + $scope.countLeftlist;
  9 + $scope.countRightlist;
  10 + $scope.IsVisible = function () {
  11 + $scope.scroll();
  12 +
  13 + }
  14 +
  15 + $scope.scroll = function () {
  16 + // $window.scrollTo(0, 0);
  17 + $("html,body").scrollTop(0);
  18 + //alert("scroll");
  19 + }
  20 +
  21 + $scope.openAIAFlexCB = function () {
  22 + var userInfo = ($rootScope.userData);
  23 +
  24 +
  25 + var key = CryptoJS.enc.Base64.parse("MTIzNDU2NzgxMjM0NTY3OA");
  26 + var iv = CryptoJS.enc.Base64.parse("EBESExQVFhcYGRobHB0eHw");
  27 +
  28 + var encryptedUserName = CryptoJS.AES.encrypt(userInfo.LoginId, key, { iv: iv });
  29 + var encryptedPassword = CryptoJS.AES.encrypt(userInfo.Password, key, { iv: iv });
  30 +
  31 + $location.url('/');
  32 +
  33 + window.open('http://qa.interactiveanatomy.com/Default.aspx?un=' + encryptedUserName + '&up=' + encryptedPassword);
  34 +
  35 + }
  36 + //load json data
  37 + $scope.loadCurriculumBuiderData = function () {
  38 +
  39 + if ($rootScope.refreshcheck == null) {
  40 + $location.path('/');
  41 + }
  42 + //get current path
  43 + var currentURL = $location.path();
  44 + var selectedModuleName = '';
  45 + //set module title
  46 + angular.forEach($rootScope.userModules, function (value, key) {
  47 + if (value.slug === currentURL.replace('/', '')) {
  48 + selectedModuleName = value.name;
  49 + }
  50 + $rootScope.currentActiveModuleTitle = selectedModuleName;
  51 + })
  52 +
  53 + //get current path
  54 + var currentURL = $location.path();
  55 +
  56 + $http({ method: 'GET', url: 'content/data/json/cb/cb_list_content.json' }).success(function (data) {
  57 +
  58 + $scope.listCurriculumBuilder = data;
  59 + //load default body view list
  60 + $scope.getCBViewList();
  61 + })
  62 + .error(function (data, status, headers, config) {
  63 + console.log(data);
  64 + });
  65 + }
  66 + //get CB body view list
  67 + $scope.getCBViewList = function ($event) {
  68 +
  69 + $('#leftBodyViewList').empty();
  70 + $scope.countLeftlist = Object.keys($scope.listCurriculumBuilder.slideshows.slideshow).length / 2;
  71 + $scope.loadleftBodyViewList = new jinqJs()
  72 + .from($scope.listCurriculumBuilder.slideshows.slideshow)
  73 + .select();
  74 + for (var i = 0; i < $scope.countLeftlist; i++) {
  75 + console.log($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
  76 + //alert($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
  77 + var $el = $('<li class="list-group-item" data-toggle="modal" data-target="#myModal-1" ng-click="loadSlideShowXmldata()"><a href="#"><i class="fa fa-check"></i>' + $scope.listCurriculumBuilder.slideshows.slideshow[i]._label + '</a></li>').appendTo('#leftBodyViewList');
  78 + $compile($el)($scope);
  79 + }
  80 +
  81 + $scope.countRightlist = Object.keys($scope.listCurriculumBuilder.slideshows.slideshow).length;
  82 + for (var i = $scope.countLeftlist; i < $scope.countRightlist; i++) {
  83 + console.log($scope.listCurriculumBuilder.slideshows.slideshow[i]._label);
  84 + var $el1 = $('<li class="list-group-item" data-toggle="modal" ng-click="loadSlideShowXmldata()" data-target="#myModal-1"><a href="#"><i class="fa fa-check"></i>' + $scope.listCurriculumBuilder.slideshows.slideshow[i]._label + '</a></li>').appendTo('#rightBodyViewList');
  85 + $compile($el)($scope);
  86 + }
  87 +
  88 + }
  89 +
  90 + $scope.loadSlideShowXmldata = function (e) {
  91 +
  92 + // alert(e);
  93 + $http({ method: 'GET', url: 'content/data/json/cb/SlideShow/AIA_Curriculum_Builder_Guide.sldshw' }).success(function (data) {
  94 +
  95 + $scope.dataPopup = data;
  96 + alert($scope.dataPopup);
  97 + })
  98 + .error(function (data, status, headers, config) {
  99 + console.log(data);
  100 + });
  101 + }
  102 +}]
  103 +
  104 +
  105 +
90 106 );
91 107 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/app/views/CBuild/CBuild-view.html
1   -<div class="bodyWrap row ">
  1 +<!--<div class="bodyWrap row ">
2 2 <div ng-include="'app/widget/MainMenu.html'" />
3 3 <div class="main" ng-init="loadCurriculumBuiderData()">
4 4 <div class="col-sm-12">
... ... @@ -37,6 +37,7 @@
37 37 <a type="button" class="btn btn-primary" href="curriculum-builder-detail.html">OK</a>
38 38 </div>
39 39 </div><!-- /.modal-content -->
40   - </div><!-- /.modal-dialog -->
41   - </div><!-- /.modal -->
42   -</div>
  40 + <!--</div><!-- /.modal-dialog -->
  41 + <!--</div><!-- /.modal -->
  42 +<!--</div>-->
  43 +<div ng-init="openAIAFlexCB()"></div>
43 44 \ No newline at end of file
... ...
400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -1442,6 +1442,7 @@
1442 1442 <script src="libs/sketch.js"></script>
1443 1443  
1444 1444 <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>-->
  1445 + <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
1445 1446 <script src="libs/html2canvas.js"></script>
1446 1447 <script src="libs/FileSaver.js"></script>
1447 1448 <script src="app/services/LabExerciseService.js"></script>
... ...
400-SOURCECODE/AIAHTML5.Web/libs/crypto-js/3.1.9-1/aes.js 0 → 100644
  1 +;(function (root, factory, undef) {
  2 + if (typeof exports === "object") {
  3 + // CommonJS
  4 + module.exports = exports = factory(require("./core"), require("./enc-base64"), require("./md5"), require("./evpkdf"), require("./cipher-core"));
  5 + }
  6 + else if (typeof define === "function" && define.amd) {
  7 + // AMD
  8 + define(["./core", "./enc-base64", "./md5", "./evpkdf", "./cipher-core"], factory);
  9 + }
  10 + else {
  11 + // Global (browser)
  12 + factory(root.CryptoJS);
  13 + }
  14 +}(this, function (CryptoJS) {
  15 +
  16 + (function () {
  17 + // Shortcuts
  18 + var C = CryptoJS;
  19 + var C_lib = C.lib;
  20 + var BlockCipher = C_lib.BlockCipher;
  21 + var C_algo = C.algo;
  22 +
  23 + // Lookup tables
  24 + var SBOX = [];
  25 + var INV_SBOX = [];
  26 + var SUB_MIX_0 = [];
  27 + var SUB_MIX_1 = [];
  28 + var SUB_MIX_2 = [];
  29 + var SUB_MIX_3 = [];
  30 + var INV_SUB_MIX_0 = [];
  31 + var INV_SUB_MIX_1 = [];
  32 + var INV_SUB_MIX_2 = [];
  33 + var INV_SUB_MIX_3 = [];
  34 +
  35 + // Compute lookup tables
  36 + (function () {
  37 + // Compute double table
  38 + var d = [];
  39 + for (var i = 0; i < 256; i++) {
  40 + if (i < 128) {
  41 + d[i] = i << 1;
  42 + } else {
  43 + d[i] = (i << 1) ^ 0x11b;
  44 + }
  45 + }
  46 +
  47 + // Walk GF(2^8)
  48 + var x = 0;
  49 + var xi = 0;
  50 + for (var i = 0; i < 256; i++) {
  51 + // Compute sbox
  52 + var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);
  53 + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;
  54 + SBOX[x] = sx;
  55 + INV_SBOX[sx] = x;
  56 +
  57 + // Compute multiplication
  58 + var x2 = d[x];
  59 + var x4 = d[x2];
  60 + var x8 = d[x4];
  61 +
  62 + // Compute sub bytes, mix columns tables
  63 + var t = (d[sx] * 0x101) ^ (sx * 0x1010100);
  64 + SUB_MIX_0[x] = (t << 24) | (t >>> 8);
  65 + SUB_MIX_1[x] = (t << 16) | (t >>> 16);
  66 + SUB_MIX_2[x] = (t << 8) | (t >>> 24);
  67 + SUB_MIX_3[x] = t;
  68 +
  69 + // Compute inv sub bytes, inv mix columns tables
  70 + var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);
  71 + INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);
  72 + INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);
  73 + INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);
  74 + INV_SUB_MIX_3[sx] = t;
  75 +
  76 + // Compute next counter
  77 + if (!x) {
  78 + x = xi = 1;
  79 + } else {
  80 + x = x2 ^ d[d[d[x8 ^ x2]]];
  81 + xi ^= d[d[xi]];
  82 + }
  83 + }
  84 + }());
  85 +
  86 + // Precomputed Rcon lookup
  87 + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];
  88 +
  89 + /**
  90 + * AES block cipher algorithm.
  91 + */
  92 + var AES = C_algo.AES = BlockCipher.extend({
  93 + _doReset: function () {
  94 + // Skip reset of nRounds has been set before and key did not change
  95 + if (this._nRounds && this._keyPriorReset === this._key) {
  96 + return;
  97 + }
  98 +
  99 + // Shortcuts
  100 + var key = this._keyPriorReset = this._key;
  101 + var keyWords = key.words;
  102 + var keySize = key.sigBytes / 4;
  103 +
  104 + // Compute number of rounds
  105 + var nRounds = this._nRounds = keySize + 6;
  106 +
  107 + // Compute number of key schedule rows
  108 + var ksRows = (nRounds + 1) * 4;
  109 +
  110 + // Compute key schedule
  111 + var keySchedule = this._keySchedule = [];
  112 + for (var ksRow = 0; ksRow < ksRows; ksRow++) {
  113 + if (ksRow < keySize) {
  114 + keySchedule[ksRow] = keyWords[ksRow];
  115 + } else {
  116 + var t = keySchedule[ksRow - 1];
  117 +
  118 + if (!(ksRow % keySize)) {
  119 + // Rot word
  120 + t = (t << 8) | (t >>> 24);
  121 +
  122 + // Sub word
  123 + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  124 +
  125 + // Mix Rcon
  126 + t ^= RCON[(ksRow / keySize) | 0] << 24;
  127 + } else if (keySize > 6 && ksRow % keySize == 4) {
  128 + // Sub word
  129 + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];
  130 + }
  131 +
  132 + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;
  133 + }
  134 + }
  135 +
  136 + // Compute inv key schedule
  137 + var invKeySchedule = this._invKeySchedule = [];
  138 + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  139 + var ksRow = ksRows - invKsRow;
  140 +
  141 + if (invKsRow % 4) {
  142 + var t = keySchedule[ksRow];
  143 + } else {
  144 + var t = keySchedule[ksRow - 4];
  145 + }
  146 +
  147 + if (invKsRow < 4 || ksRow <= 4) {
  148 + invKeySchedule[invKsRow] = t;
  149 + } else {
  150 + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^
  151 + INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];
  152 + }
  153 + }
  154 + },
  155 +
  156 + encryptBlock: function (M, offset) {
  157 + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);
  158 + },
  159 +
  160 + decryptBlock: function (M, offset) {
  161 + // Swap 2nd and 4th rows
  162 + var t = M[offset + 1];
  163 + M[offset + 1] = M[offset + 3];
  164 + M[offset + 3] = t;
  165 +
  166 + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);
  167 +
  168 + // Inv swap 2nd and 4th rows
  169 + var t = M[offset + 1];
  170 + M[offset + 1] = M[offset + 3];
  171 + M[offset + 3] = t;
  172 + },
  173 +
  174 + _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {
  175 + // Shortcut
  176 + var nRounds = this._nRounds;
  177 +
  178 + // Get input, add round key
  179 + var s0 = M[offset] ^ keySchedule[0];
  180 + var s1 = M[offset + 1] ^ keySchedule[1];
  181 + var s2 = M[offset + 2] ^ keySchedule[2];
  182 + var s3 = M[offset + 3] ^ keySchedule[3];
  183 +
  184 + // Key schedule row counter
  185 + var ksRow = 4;
  186 +
  187 + // Rounds
  188 + for (var round = 1; round < nRounds; round++) {
  189 + // Shift rows, sub bytes, mix columns, add round key
  190 + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];
  191 + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];
  192 + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];
  193 + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];
  194 +
  195 + // Update state
  196 + s0 = t0;
  197 + s1 = t1;
  198 + s2 = t2;
  199 + s3 = t3;
  200 + }
  201 +
  202 + // Shift rows, sub bytes, add round key
  203 + var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];
  204 + var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];
  205 + var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];
  206 + var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];
  207 +
  208 + // Set output
  209 + M[offset] = t0;
  210 + M[offset + 1] = t1;
  211 + M[offset + 2] = t2;
  212 + M[offset + 3] = t3;
  213 + },
  214 +
  215 + keySize: 256/32
  216 + });
  217 +
  218 + /**
  219 + * Shortcut functions to the cipher's object interface.
  220 + *
  221 + * @example
  222 + *
  223 + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);
  224 + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);
  225 + */
  226 + C.AES = BlockCipher._createHelper(AES);
  227 + }());
  228 +
  229 +
  230 + return CryptoJS.AES;
  231 +
  232 +}));
0 233 \ No newline at end of file
... ...