GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Code Duplication    Length = 210-216 lines in 2 locations

archive/2.8.x/js/directive.upload.js 1 location

@@ 2-217 (lines=216) @@
1
// JavaScript Document
2
"use strict";
3
4
app.directive('upload', [
5
    '$rootScope',
6
    '$timeout',
7
    'Core',
8
    'Security',
9
    'LockManager',
10
    'Upload',
11
    'MessageService',
12
    'DataAdapter',    function($rootScope, $timeout, Core, Security, LockManager, Upload, MessageService, DataAdapter) {
13
    function UploadConstructor($scope, $element, $attrs) {
14
        var constructor = this;
15
        var $ctrl = $scope.uploadCtrl;
16
        var tagName = $element[0].tagName.toLowerCase();
17
        $scope.DisplayMessageList = MessageService.messageList;
18
19
        function TryToCallInitDirective(){
20
            if(typeof $scope.InitDirective == "function"){
21
                $scope.InitDirective($scope, $element, $attrs, $ctrl);
22
            }else{
23
                $scope.DefaultInitDirective();
24
            }
25
        }
26
        $scope.DefaultInitDirective = function(){
27
            if(Core.GetConfig().debugLog.DirectiveFlow)
28
            console.log("scope.$id:"+$scope.$id+", may implement $scope.InitDirective() function in webapge");
29
        }
30
        function InitializeUpload() {
31
            $scope.uploadInfo = [];
32
            $scope.uploadResult = [];
33
34
            $scope.uploadInstance = null;
35
        }
36
37
        function UploadFileList(files){
38
            var isFiles = Array.isArray(files);
39
			
40
            $scope.uploadInfo = [];
41
			
42
            if(!isFiles){
43
                UploadFile(files);
44
            }
45
            else{
46
                for(var index in files){
47
                    UploadFile(files[index]);
48
                }
49
            }
50
        }
51
52
        function UploadFile(file, options, callback) {
53
            var url = $rootScope.serverHost;
54
            var uploadInfoRecord = {};
55
            var recordCount = $scope.uploadInfo.length;
56
            // create new row in uploadInfo, since upload in async
57
            $scope.uploadInfo[recordCount] = {};
58
59
            if (!file || file.$error) {
60
                return;
61
            }
62
63
            uploadInfoRecord.fileInfo = file;
64
            uploadInfoRecord.uploadResult = {};
65
66
            uploadInfoRecord.name = file.name;
67
            uploadInfoRecord.size = file.size;
68
            uploadInfoRecord.uploadProgress = 0;
69
70
            // File Object
71
            // console.dir(file)
72
            /*
73
                lastModified: 1474968722283
74
                lastModifiedDate: Tue Sep 27 2016 17:32:02 GMT+0800 (China Standard Time)
75
                name: "hu01ca.xlsx"
76
                size: 8629
77
                type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
78
                upload: d
79
                webkitRelativePath: ""
80
            */
81
82
            // Upload Result from PHP
83
            /*
84
            {
85
              "name": "hu01ca.xlsx",
86
              "type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
87
              "tmp_name": "D:\\xampp\\tmp\\phpDFD9.tmp",
88
              "error": 0,
89
              "size": 8629,
90
              "movedTo": "D:\\xampp\\htdocs\\Develop\\model/../temp/upload/hu01ca.xlsx",
91
              "fileIntegrity-md5": "3e7992dbabfbc9ea84c621762831975b",
92
              "fileIntegrity-sha1": "691528b6437c8e686d342eeacd0f27620a6ba295",
93
              "errorMsg": ""
94
            }
95
            */
96
            
97
            /*
98
                var uploadAction = $scope.uploadInstance = Upload.upload({
99
                  //url: 'https://angular-file-upload-cors-srv.appspot.com/upload',
100
                  url: url+'/archive/2.8.x/controller/documentUploader.for12.2.21.php',
101
                  data: {file: file},
102
                });
103
                */
104
				var submitData = {
105
					"Table": "",
106
					"file": file
107
				};
108
				var uploadAction = DataAdapter.UploadData(submitData);
109
                
110
                
111
                // http://api.jquery.com/deferred.then/#deferred-then-doneCallbacks-failCallbacks
112
                // deferred.then( doneCallbacks, failCallbacks [, progressCallbacks ] )
113
                uploadAction.then(function (response) {
114
                    uploadInfoRecord.uploadResult = response.data;
115
                    //if(response.data.error)
116
                    //$scope.errorMsg = response.data.error + " - "+response.data.errorMsg
117
118
                    $scope.uploadInfo[recordCount] = uploadInfoRecord;
119
                    // $ctrl.ngModel = $scope.uploadInfo;
120
121
                    $scope.uploadResult[$scope.uploadResult.length] = response.data;
122
                    $ctrl.ngModel = $scope.uploadResult;
123
                }, function (response) {
124
                    //if(response.data.error)
125
                    //$scope.errorMsg = response.data.error + " - "+response.data.errorMsg
126
                }, function (evt) {
127
                  // Math.min is to fix IE which reports 200% sometimes
128
                  var uploadedPercentage = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
129
                  uploadInfoRecord.uploadProgress = uploadedPercentage;
130
                });
131
132
                return uploadAction;
133
        }
134
135
        $scope.UploadData = function(files){
136
            // console.dir(files)
137
            UploadFileList(files);
138
        }
139
140
        $scope.Initialize = function(){
141
            $scope.InitScope();
142
            if(typeof $scope.EventListener == "function"){
143
                $scope.EventListener($scope, $element, $attrs, $ctrl);
144
            }else{
145
                EventListener();
146
            }
147
            TryToCallInitDirective();
148
        }
149
        $scope.InitScope = function(){
150
            InitializeUpload();
151
        }
152
153
        function InitDirective(){
154
            if(Core.GetConfig().debugLog.DirectiveFlow)
155
            console.log("scope.$id:"+$scope.$id+", may implement $scope.InitDirective() function in webapge");
156
        }
157
        function EventListener(){
158
            if(Core.GetConfig().debugLog.DirectiveFlow)
159
            console.log("scope.$id:"+$scope.$id+", may implement $scope.EventListener() function in webapge");
160
        }
161
        // function SetDefaultValue(){
162
        //     console.log("scope.$id:"+$scope.$id+", may implement $scope.SetDefaultValue() function in webapge");
163
        // }
164
        function StatusChange(){
165
            if(Core.GetConfig().debugLog.DirectiveFlow)
166
            console.log("scope.$id:"+$scope.$id+", may implement $scope.StatusChange() function in webapge");
167
        }
168
169
//        $scope.Initialize();
170
    }
171
    function templateFunction(tElement, tAttrs) {
172
        var globalCriteria = $rootScope.globalCriteria;
173
174
        var template = '' +
175
          '<div class="custom-transclude"></div>';
176
        return template;
177
    }
178
179
    return {
180
        require: ['ngModel', '?import'],
181
        restrict: 'EA', //'EA', //Default in 1.3+
182
        transclude: true,
183
184
        // scope: [false | true | {...}]
185
        // false = use parent scope
186
        // true =  A new child scope that prototypically inherits from its parent
187
        // {} = create a isolate scope
188
        scope: true,
189
190
        controller: UploadConstructor,
191
        controllerAs: 'uploadCtrl',
192
193
        //If both bindToController and scope are defined and have object hashes, bindToController overrides scope.
194
        bindToController: {
195
            ngModel: '=',
196
        },
197
        template: templateFunction,
198
        compile: function compile(tElement, tAttrs, transclude) {
199
            return {
200
                pre: function preLink(scope, iElement, iAttrs, controller) {
201
                    //console.log("entry preLink() compile");
202
                },
203
                post: function postLink(scope, iElement, iAttrs, controller) {
204
                    //console.log("entry postLink() compile");
205
206
                    // "scope" here is the directive's isolate scope
207
                    // iElement.find('.custom-transclude').append(
208
                    // );
209
                    transclude(scope, function (clone, scope) {
210
                        iElement.find('.custom-transclude').append(clone);
211
                    })
212
                    scope.Initialize();
213
                }
214
            }
215
        },
216
    };
217
}]);
218

js/directive.upload.js 1 location

@@ 2-211 (lines=210) @@
1
// JavaScript Document
2
"use strict";
3
4
app.directive('upload', [
5
    '$rootScope',
6
    '$timeout',
7
    'Core',
8
    'Security',
9
    'LockManager',
10
    'Upload',
11
    'MessageService', function($rootScope, $timeout, Core, Security, LockManager, Upload, MessageService) {
12
    function UploadConstructor($scope, $element, $attrs) {
13
        var constructor = this;
14
        var $ctrl = $scope.uploadCtrl;
15
        var tagName = $element[0].tagName.toLowerCase();
16
        $scope.DisplayMessageList = MessageService.messageList;
17
18
        function TryToCallInitDirective(){
19
            if(typeof $scope.InitDirective == "function"){
20
                $scope.InitDirective($scope, $element, $attrs, $ctrl);
21
            }else{
22
                $scope.DefaultInitDirective();
23
            }
24
        }
25
        $scope.DefaultInitDirective = function(){
26
            if(Core.GetConfig().debugLog.DirectiveFlow)
27
            console.log("scope.$id:"+$scope.$id+", may implement $scope.InitDirective() function in webapge");
28
        }
29
        function InitializeUpload() {
30
            $scope.uploadInfo = [];
31
            $scope.uploadResult = [];
32
33
            $scope.uploadInstance = null;
34
        }
35
36
        function UploadFileList(files){
37
            var isFiles = Array.isArray(files);
38
			
39
            $scope.uploadInfo = [];
40
			
41
            if(!isFiles){
42
                UploadFile(files);
43
            }
44
            else{
45
                for(var index in files){
46
                    UploadFile(files[index]);
47
                }
48
            }
49
        }
50
51
        function UploadFile(file, options, callback) {
52
            var url = $rootScope.serverHost;
53
            var uploadInfoRecord = {};
54
            var recordCount = $scope.uploadInfo.length;
55
            // create new row in uploadInfo, since upload in async
56
            $scope.uploadInfo[recordCount] = {};
57
58
            if (!file || file.$error) {
59
                return;
60
            }
61
62
            uploadInfoRecord.fileInfo = file;
63
            uploadInfoRecord.uploadResult = {};
64
65
            uploadInfoRecord.name = file.name;
66
            uploadInfoRecord.size = file.size;
67
            uploadInfoRecord.uploadProgress = 0;
68
69
            // File Object
70
            // console.dir(file)
71
            /*
72
                lastModified: 1474968722283
73
                lastModifiedDate: Tue Sep 27 2016 17:32:02 GMT+0800 (China Standard Time)
74
                name: "hu01ca.xlsx"
75
                size: 8629
76
                type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
77
                upload: d
78
                webkitRelativePath: ""
79
            */
80
81
            // Upload Result from PHP
82
            /*
83
            {
84
              "name": "hu01ca.xlsx",
85
              "type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
86
              "tmp_name": "D:\\xampp\\tmp\\phpDFD9.tmp",
87
              "error": 0,
88
              "size": 8629,
89
              "movedTo": "D:\\xampp\\htdocs\\Develop\\model/../temp/upload/hu01ca.xlsx",
90
              "fileIntegrity-md5": "3e7992dbabfbc9ea84c621762831975b",
91
              "fileIntegrity-sha1": "691528b6437c8e686d342eeacd0f27620a6ba295",
92
              "errorMsg": ""
93
            }
94
            */
95
96
                var uploadAction = $scope.uploadInstance = Upload.upload({
97
                  //url: 'https://angular-file-upload-cors-srv.appspot.com/upload',
98
                  url: url+'/controller/documentUploader.for12.2.21.php',
99
                  data: {file: file},
100
                });
101
                // http://api.jquery.com/deferred.then/#deferred-then-doneCallbacks-failCallbacks
102
                // deferred.then( doneCallbacks, failCallbacks [, progressCallbacks ] )
103
                uploadAction.then(function (response) {
104
                    uploadInfoRecord.uploadResult = response.data;
105
                    //if(response.data.error)
106
                    //$scope.errorMsg = response.data.error + " - "+response.data.errorMsg
107
108
                    $scope.uploadInfo[recordCount] = uploadInfoRecord;
109
                    // $ctrl.ngModel = $scope.uploadInfo;
110
111
                    $scope.uploadResult[$scope.uploadResult.length] = response.data;
112
                    $ctrl.ngModel = $scope.uploadResult;
113
                }, function (response) {
114
                    //if(response.data.error)
115
                    //$scope.errorMsg = response.data.error + " - "+response.data.errorMsg
116
                }, function (evt) {
117
                  // Math.min is to fix IE which reports 200% sometimes
118
                  var uploadedPercentage = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
119
                  uploadInfoRecord.uploadProgress = uploadedPercentage;
120
                });
121
122
                return uploadAction;
123
124
125
            // if(typeof callback == "function")
126
            //     callback($scope.uploadInfo[recordCount]);
127
        }
128
129
        $scope.UploadData = function(files){
130
            // console.dir(files)
131
            UploadFileList(files);
132
        }
133
134
        $scope.Initialize = function(){
135
            $scope.InitScope();
136
            if(typeof $scope.EventListener == "function"){
137
                $scope.EventListener($scope, $element, $attrs, $ctrl);
138
            }else{
139
                EventListener();
140
            }
141
            TryToCallInitDirective();
142
        }
143
        $scope.InitScope = function(){
144
            InitializeUpload();
145
        }
146
147
        function InitDirective(){
148
            if(Core.GetConfig().debugLog.DirectiveFlow)
149
            console.log("scope.$id:"+$scope.$id+", may implement $scope.InitDirective() function in webapge");
150
        }
151
        function EventListener(){
152
            if(Core.GetConfig().debugLog.DirectiveFlow)
153
            console.log("scope.$id:"+$scope.$id+", may implement $scope.EventListener() function in webapge");
154
        }
155
        // function SetDefaultValue(){
156
        //     console.log("scope.$id:"+$scope.$id+", may implement $scope.SetDefaultValue() function in webapge");
157
        // }
158
        function StatusChange(){
159
            if(Core.GetConfig().debugLog.DirectiveFlow)
160
            console.log("scope.$id:"+$scope.$id+", may implement $scope.StatusChange() function in webapge");
161
        }
162
163
//        $scope.Initialize();
164
    }
165
    function templateFunction(tElement, tAttrs) {
166
        var globalCriteria = $rootScope.globalCriteria;
167
168
        var template = '' +
169
          '<div class="custom-transclude"></div>';
170
        return template;
171
    }
172
173
    return {
174
        require: ['ngModel', '?import'],
175
        restrict: 'EA', //'EA', //Default in 1.3+
176
        transclude: true,
177
178
        // scope: [false | true | {...}]
179
        // false = use parent scope
180
        // true =  A new child scope that prototypically inherits from its parent
181
        // {} = create a isolate scope
182
        scope: true,
183
184
        controller: UploadConstructor,
185
        controllerAs: 'uploadCtrl',
186
187
        //If both bindToController and scope are defined and have object hashes, bindToController overrides scope.
188
        bindToController: {
189
            ngModel: '=',
190
        },
191
        template: templateFunction,
192
        compile: function compile(tElement, tAttrs, transclude) {
193
            return {
194
                pre: function preLink(scope, iElement, iAttrs, controller) {
195
                    //console.log("entry preLink() compile");
196
                },
197
                post: function postLink(scope, iElement, iAttrs, controller) {
198
                    //console.log("entry postLink() compile");
199
200
                    // "scope" here is the directive's isolate scope
201
                    // iElement.find('.custom-transclude').append(
202
                    // );
203
                    transclude(scope, function (clone, scope) {
204
                        iElement.find('.custom-transclude').append(clone);
205
                    })
206
                    scope.Initialize();
207
                }
208
            }
209
        },
210
    };
211
}]);
212