Advertisement
Guest User

Untitled

a guest
Nov 29th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.63 KB | None | 0 0
  1. Error: document.getElementById(...) is null
  2. handleDynamicEditingOfScriptsAndHtml@http://localhost/angularAdmin/js/controllers/userForm.js:190:34
  3. @http://localhost/angularAdmin/js/controllers/userForm.js:189:1
  4. invoke@http://localhost/angularAdmin/vendor/angular/angular.js:4118:14
  5. $ControllerProvider/this.$get</</<@http://localhost/angularAdmin/vendor/angular/angular.js:8356:11
  6. nodeLinkFn/<@http://localhost/angularAdmin/vendor/angular/angular.js:7608:13
  7. forEach@http://localhost/angularAdmin/vendor/angular/angular.js:347:11
  8. nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7607:11
  9. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
  10. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6996:13
  11. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6996:13
  12. publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
  13. $ViewDirectiveFill/<.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3866:9
  14. invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9
  15. nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
  16. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
  17. publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
  18. updateView@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3800:23
  19. $ViewDirective/directive.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3768:9
  20. invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9
  21. nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
  22. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
  23. publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
  24. $ViewDirectiveFill/<.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3866:9invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
  25. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
  26. publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
  27. updateView@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3800:23
  28. $ViewDirective/directive.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3768:9
  29. invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9
  30. nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
  31. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
  32. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6996:13
  33. publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
  34. $ViewDirectiveFill/<.compile/<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3866:9
  35. invokeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:8125:9
  36. nodeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:7637:1
  37. compositeLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6993:13
  38. publicLinkFn@http://localhost/angularAdmin/vendor/angular/angular.js:6872:30
  39. updateView@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3800:23
  40. $ViewDirective/directive.compile/</<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3762:11
  41. $RootScopeProvider/this.$get</Scope.prototype.$broadcast@http://localhost/angularAdmin/vendor/angular/angular.js:14518:15
  42. transitionTo/$state.transition<@http://localhost/angularAdmin/vendor/angular/angular-ui-router/angular-ui-router.js:3169:11
  43. processQueue@http://localhost/angularAdmin/vendor/angular/angular.js:12984:27
  44. scheduleProcessQueue/<@http://localhost/angularAdmin/vendor/angular/angular.js:13000:27
  45. $RootScopeProvider/this.$get</Scope.prototype.$eval@http://localhost/angularAdmin/vendor/angular/angular.js:14200:16
  46. $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost/angularAdmin/vendor/angular/angular.js:14016:15
  47. $RootScopeProvider/this.$get</Scope.prototype.$evalAsync/<@http://localhost/angularAdmin/vendor/angular/angular.js:14238:15
  48. completeOutstandingRequest@http://localhost/angularAdmin/vendor/angular/angular.js:4842:7
  49. Browser/self.defer/timeoutId<@http://localhost/angularAdmin/vendor/angular/angular.js:5215:7
  50. <div ui-view="" class="fade-in ng-scope">
  51. [1]: https://angular-file-upload.appspot.com/
  52.  
  53. 'use strict';
  54.  
  55.  
  56. angular.module('app', [
  57. 'ngFileUpload',
  58. 'toaster',
  59. 'LocalStorageModule',
  60. 'ngAnimate',
  61. 'ngCookies',
  62. 'ngResource',
  63. 'ngSanitize',
  64. 'ngTouch',
  65. 'ngStorage',
  66. 'ui.router',
  67. 'ui.bootstrap',
  68. 'ui.load',
  69. 'ui.jq',
  70. 'ui.validate',
  71. 'oc.lazyLoad',
  72. 'pascalprecht.translate'
  73. ]);
  74.  
  75. 'use strict';
  76.  
  77. /* Controllers */
  78. var version = '3.0.6';
  79. // Form controller
  80. app.controller('FormProfileCtrl', ['$scope', '$http', '$timeout', '$compile', '$upload', function ($scope, $http, $timeout, $compile, $upload) {
  81. $scope.usingFlash = FileAPI && FileAPI.upload != null;
  82. $scope.fileReaderSupported = window.FileReader != null && (window.FileAPI == null || FileAPI.html5 != false);
  83.  
  84. $scope.changeAngularVersion = function () {
  85. window.location.hash = $scope.angularVersion;
  86. window.location.reload(true);
  87. };
  88.  
  89. $scope.angularVersion = window.location.hash.length > 1 ? (window.location.hash.indexOf('/') === 1 ?
  90. window.location.hash.substring(2) : window.location.hash.substring(1)) : '1.2.20';
  91.  
  92. $scope.$watch('files', function (files) {
  93. console.log(files);
  94. $scope.formUpload = false;
  95. if (files != null) {
  96. for (var i = 0; i < files.length; i++) {
  97. $scope.errorMsg = null;
  98. (function (file) {
  99. generateThumbAndUpload(file);
  100. })(files[i]);
  101. }
  102. }
  103. });
  104.  
  105. $scope.uploadPic = function (files) {
  106. $scope.formUpload = true;
  107. if (files != null) {
  108. generateThumbAndUpload(files[0])
  109. }
  110. }
  111.  
  112. function generateThumbAndUpload(file) {
  113. $scope.errorMsg = null;
  114. $scope.generateThumb(file);
  115. if ($scope.howToSend == 1) {
  116. uploadUsing$upload(file);
  117. } else if ($scope.howToSend == 2) {
  118. uploadUsing$http(file);
  119. } else {
  120. uploadS3(file);
  121. }
  122. }
  123.  
  124. $scope.generateThumb = function (file) {
  125. if (file != null) {
  126. if ($scope.fileReaderSupported && file.type.indexOf('image') > -1) {
  127. $timeout(function () {
  128. var fileReader = new FileReader();
  129. fileReader.readAsDataURL(file);
  130. fileReader.onload = function (e) {
  131. $timeout(function () {
  132. file.dataUrl = e.target.result;
  133. });
  134. }
  135. });
  136. }
  137. }
  138. }
  139.  
  140. function uploadUsing$upload(file) {
  141. file.upload = $upload.upload({
  142. url: 'https://angular-file-upload-cors-srv.appspot.com/upload' + $scope.getReqParams(),
  143. method: 'POST',
  144. headers: {
  145. 'my-header': 'my-header-value'
  146. },
  147. fields: {username: $scope.username},
  148. file: file,
  149. fileFormDataName: 'myFile',
  150. });
  151.  
  152. file.upload.then(function (response) {
  153. $timeout(function () {
  154. file.result = response.data;
  155. });
  156. }, function (response) {
  157. if (response.status > 0)
  158. $scope.errorMsg = response.status + ': ' + response.data;
  159. });
  160.  
  161. file.upload.progress(function (evt) {
  162. // Math.min is to fix IE which reports 200% sometimes
  163. file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
  164. });
  165.  
  166. file.upload.xhr(function (xhr) {
  167. // xhr.upload.addEventListener('abort', function(){console.log('abort complete')}, false);
  168. });
  169. }
  170.  
  171. function uploadUsing$http(file) {
  172. var fileReader = new FileReader();
  173. fileReader.onload = function (e) {
  174. $timeout(function () {
  175. file.upload = $upload.http({
  176. url: 'https://angular-file-upload-cors-srv.appspot.com/upload' + $scope.getReqParams(),
  177. method: 'POST',
  178. headers: {
  179. 'Content-Type': file.type
  180. },
  181. data: e.target.result
  182. });
  183.  
  184. file.upload.then(function (response) {
  185. file.result = response.data;
  186. }, function (response) {
  187. if (response.status > 0)
  188. $scope.errorMsg = response.status + ': ' + response.data;
  189. });
  190.  
  191. file.upload.progress(function (evt) {
  192. file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
  193. });
  194. }, 5000);
  195. }
  196. fileReader.readAsArrayBuffer(file);
  197. }
  198.  
  199. function uploadS3(file) {
  200. file.upload = $upload
  201. .upload({
  202. url: $scope.s3url,
  203. method: 'POST',
  204. fields: {
  205. key: file.name,
  206. AWSAccessKeyId: $scope.AWSAccessKeyId,
  207. acl: $scope.acl,
  208. policy: $scope.policy,
  209. signature: $scope.signature,
  210. "Content-Type": file.type === null || file.type === '' ? 'application/octet-stream' : file.type,
  211. filename: file.name
  212. },
  213. file: file,
  214. });
  215.  
  216. file.upload.then(function (response) {
  217. $timeout(function () {
  218. file.result = response.data;
  219. });
  220. }, function (response) {
  221. if (response.status > 0)
  222. $scope.errorMsg = response.status + ': ' + response.data;
  223. });
  224.  
  225. file.upload.progress(function (evt) {
  226. file.progress = Math.min(100, parseInt(100.0 * evt.loaded / evt.total));
  227. });
  228. storeS3UploadConfigInLocalStore();
  229. }
  230.  
  231. $scope.generateSignature = function () {
  232. $http.post('/s3sign?aws-secret-key=' + encodeURIComponent($scope.AWSSecretKey), $scope.jsonPolicy).
  233. success(function (data) {
  234. $scope.policy = data.policy;
  235. $scope.signature = data.signature;
  236. });
  237. }
  238.  
  239. if (localStorage) {
  240. $scope.s3url = localStorage.getItem("s3url");
  241. $scope.AWSAccessKeyId = localStorage.getItem("AWSAccessKeyId");
  242. $scope.acl = localStorage.getItem("acl");
  243. $scope.success_action_redirect = localStorage.getItem("success_action_redirect");
  244. $scope.policy = localStorage.getItem("policy");
  245. $scope.signature = localStorage.getItem("signature");
  246. }
  247.  
  248. $scope.success_action_redirect = $scope.success_action_redirect || window.location.protocol + "//" + window.location.host;
  249. $scope.jsonPolicy = $scope.jsonPolicy || '{n "expiration": "2020-01-01T00:00:00Z",n "conditions": [n {"bucket": "angular-file-upload"},n ["starts-with", "$key", ""],n {"acl": "private"},n ["starts-with", "$Content-Type", ""],n ["starts-with", "$filename", ""],n ["content-length-range", 0, 524288000]n ]n}';
  250. $scope.acl = $scope.acl || 'private';
  251.  
  252. function storeS3UploadConfigInLocalStore() {
  253. if ($scope.howToSend == 3 && localStorage) {
  254. localStorage.setItem("s3url", $scope.s3url);
  255. localStorage.setItem("AWSAccessKeyId", $scope.AWSAccessKeyId);
  256. localStorage.setItem("acl", $scope.acl);
  257. localStorage.setItem("success_action_redirect", $scope.success_action_redirect);
  258. localStorage.setItem("policy", $scope.policy);
  259. localStorage.setItem("signature", $scope.signature);
  260. }
  261. }
  262.  
  263. (function handleDynamicEditingOfScriptsAndHtml($scope, $http) {
  264. $scope.defaultHtml = document.getElementById('editArea').innerHTML.replace(/tttt/g, '');
  265.  
  266. $scope.editHtml = (localStorage && localStorage.getItem("editHtml" + version)) || $scope.defaultHtml;
  267. function htmlEdit(update) {
  268. document.getElementById("editArea").innerHTML = $scope.editHtml;
  269. $compile(document.getElementById("editArea"))($scope);
  270. $scope.editHtml && localStorage && localStorage.setItem("editHtml" + version, $scope.editHtml);
  271. if ($scope.editHtml != $scope.htmlEditor.getValue())
  272. $scope.htmlEditor.setValue($scope.editHtml);
  273. }
  274. $scope.$watch("editHtml", htmlEdit);
  275.  
  276. $scope.htmlEditor = CodeMirror(document.getElementById('htmlEdit'), {
  277. lineNumbers: true, indentUnit: 4,
  278. mode: "htmlmixed"
  279. });
  280. $scope.htmlEditor.on('change', function () {
  281. if ($scope.editHtml != $scope.htmlEditor.getValue()) {
  282. $scope.editHtml = $scope.htmlEditor.getValue();
  283. htmlEdit();
  284. }
  285. });
  286. })($scope, $http);
  287.  
  288. $scope.confirm = function () {
  289. return confirm('Are you sure? Your local changes will be lost.');
  290. }
  291.  
  292. $scope.getReqParams = function () {
  293. return $scope.generateErrorOnServer ? "?errorCode=" + $scope.serverErrorCode +
  294. "&errorMessage=" + $scope.serverErrorMsg : "";
  295. }
  296.  
  297. angular.element(window).bind("dragover", function (e) {
  298. e.preventDefault();
  299. });
  300. angular.element(window).bind("drop", function (e) {
  301. e.preventDefault();
  302. });
  303.  
  304. }])
  305. ;
  306.  
  307. <div class="bg-light lter b-b wrapper-md">
  308. <h1 class="m-n font-thin h3">Edit User</h1>
  309. </div>
  310. <div class="wrapper-md">
  311. <!-- breadcrumb -->
  312. <div>
  313. <ul class="breadcrumb bg-white b-a">
  314. <li><a ui-sref="app.dashboard"><i class="fa fa-home"></i> Dashboard</a></li>
  315. <li class="active">Edit User</li>
  316. </ul>
  317. </div>
  318. <!-- / breadcrumb -->
  319. <div class="col-lg-12">
  320. <div class="wrapper-md" ng-controller="FormProfileCtrl">
  321.  
  322. <form name="userForm" class="form-validation">
  323. <tabset justified="true" class="tab-container">
  324. <tab heading="Personal Information">
  325. <div class="panel-body">
  326. <div class="form-group">
  327. <label>Username</label>
  328. <input type="text" class="form-control" ng-model="user.vName" >
  329. </div>
  330. <div class="form-group">
  331. <label>Email</label>
  332. <input type="email" class="form-control" ng-model="user.vEmail">
  333. </div>
  334. <div class="form-group">
  335. <label>Phone</label>
  336. <input type="text" class="form-control" ng-model="user.vPhone" >
  337. </div>
  338. <div class="form-group">
  339. <label>Address</label>
  340. <textarea class="form-control" ng-model="user.vAddress" ></textarea>
  341. </div>
  342. <div class="form-group pull-in clearfix">
  343. <div class="col-sm-6">
  344. <label>Enter password</label>
  345. <input type="password" class="form-control" name="vPassword" ng-model="vPassword" >
  346. </div>
  347. <div class="col-sm-6">
  348. <label>Confirm password</label>
  349. <input type="password" class="form-control" name="confirm_password" required ng-model="confirm_password" ui-validate=" '$value==password' " ui-validate-watch=" 'password' ">
  350. <span ng-show='form.confirm_password.$error.validator'>Passwords do not match!</span>
  351. </div>
  352. </div>
  353.  
  354.  
  355. </div>
  356. </tab>
  357. <tab heading="Company Information">
  358. <div class="form-group">
  359. <label>Company Name</label>
  360. <input type="text" class="form-control" ng-model="user.vCompanyName" >
  361. </div>
  362. <div class="form-group">
  363. <label>Phone</label>
  364. <input type="text" class="form-control" ng-model="user.vCompanyPhone" >
  365. </div>
  366. <div class="form-group">
  367. <label>Designation</label>
  368. <input type="text" class="form-control" ng-model="user.vDesignation" >
  369. </div>
  370. <div class="form-group">
  371. <label>Address</label>
  372. <textarea class="form-control" ng-model="user.vCompanyAddress" ></textarea>
  373. </div>
  374.  
  375. </tab>
  376. </tabset>
  377. <!-- I want -->
  378. <div class="upload-div">
  379. <div class="upload-buttons">
  380. <div id="editArea">
  381. <fieldset><legend>Upload right away</legend>
  382. <div ng-file-drop ng-file-select ng-model="files" ng-model-rejected="rejFiles"
  383. drag-over-class="{accept:'dragover', reject:'dragover-err', delay:100}" class="drop-box"
  384. ng-multiple="true" allow-dir="true" ng-accept="'image/*,application/pdf'">
  385. Drop Images or PDFs<div>or click to select</div>
  386. </div>
  387. <div ng-no-file-drop class="drop-box">File Farg&Drop not supported on your browser</div>
  388. </fieldset>
  389. <br/>
  390. </div>
  391. </div>
  392. <ul ng-show="rejFiles.length > 0" class="response">
  393. <li class="sel-file" ng-repeat="f in rejFiles">
  394. Rejected file: {{f.name}} - size: {{f.size}}B - type: {{f.type}}
  395. </li>
  396. </ul>
  397. <ul ng-show="files.length > 0" class="response">
  398. <li class="sel-file" ng-repeat="f in files">
  399. <img ng-show="f.dataUrl" ng-src="{{f.dataUrl}}" class="thumb">
  400. <span class="progress" ng-show="f.progress >= 0">
  401. <div style="width:{{f.progress}}%">{{f.progress}}%</div>
  402. </span>
  403. <button class="button" ng-click="f.upload.abort();
  404. f.upload.aborted = true"
  405. ng-show="f.upload != null && f.progress < 100 && !f.upload.aborted">Abort</button>
  406. {{f.name}} - size: {{f.size}}B - type: {{f.type}}
  407. <a ng-show="f.result" href="javascript:void(0)" ng-click="f.showDetail = !f.showDetail">details</a>
  408. <div ng-show="f.showDetail">
  409. <br/>
  410. <div data-ng-show="f.result.result == null">{{f.result}}</div>
  411. <ul>
  412. <li ng-repeat="item in f.result.result">
  413. <div data-ng-show="item.name">file name: {{item.name}}</div>
  414. <div data-ng-show="item.fieldName">name: {{item.fieldName}}</div>
  415. <div data-ng-show="item.size">size on the serve: {{item.size}}</div>
  416. <div data-ng-show="item.value">value: {{item.value}}</div>
  417. </li>
  418. </ul>
  419. <div data-ng-show="f.result.requestHeaders" class="reqh">request headers: {{f.result.requestHeaders}}</div>
  420. </div>
  421. </li>
  422. </ul>
  423.  
  424. <br/>
  425. <div class="err" ng-show="errorMsg != null">{{errorMsg}}</div>
  426. </div>
  427.  
  428. <input type="hidden" class="form-control" ng-model="user.iUserID">
  429. <input type="submit" class="btn btn-success" ng-click="postForm(user)">
  430. </form>
  431. </div>
  432. </div>
  433.  
  434. $scope.tab_data = {}
  435.  
  436. $scope.$watch 'tab_data.files', ->
  437. $scope.upload $scope.tab_data.files
  438.  
  439. <div ngf-drop ngf-select ng-model="tab_data.files" class="drop-box" ngf-drag-over-class="dragover" ngf-multiple="true" ngf-allow-dir="true" ngf-accept="'.jpg,.png,.pdf'" class="drop-box">
  440. <div ngf-drop-available >Drop Images here</div>
  441. <div ngf-no-file-drop>File Drag/Drop is not supported for this browser</div>
  442. <div>click to select</div>
  443. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement