1 2app.controller('FormActionController', function($scope,$http,$rootScope,FileUploader) { 3 4 $rootScope.uploader = new FileUploader({ 5 url: '?type=324423' //'/?eID=uploadforms' 6 }); 7 8 $rootScope.uploader.onCompleteAll = function() { 9 $rootScope.DoSubmit(); 10 }; 11 12 $rootScope.action = null; 13 14 $rootScope.history = []; 15 $rootScope.actions = { 16 'add': { 17 'show': 'askRegistered', 18 'index': 1, 19 'steps': { 20 'isRegistered': { 21 'show': 'askObjectnumber', 22 'index': 2, 23 'steps':{ 24 'hasObjectnumber':{ 25 'show': 'objectnumber', 26 'index': 3, 27 'steps':{ 28 'next':{ 29 'show': 'container', 30 'index': 4, 31 } 32 } 33 }, 34 'hasNotObjectnumber':{ 35 'show': 'address', 36 'index': 3, 37 'steps':{ 38 'next':{ 39 'show': 'container', 40 'index': 4, 41 } 42 } 43 } 44 } 45 }, 46 'isNotRegistered':{ 47 'show': 'newproperty', 48 'index': 2, 49 'steps':{ 50 'next':{ 51 'show': 'container', 52 'index': 3, 53 } 54 } 55 } 56 } 57 }, 58 'remove': { 59 'show': 'askObjectnumber', 60 'index': 1, 61 'steps':{ 62 'hasObjectnumber':{ 63 'show': 'objectnumber', 64 'index': 2, 65 'steps':{ 66 'next':{ 67 'show': 'container', 68 'index': 3, 69 } 70 } 71 }, 72 'hasNotObjectnumber':{ 73 'show': 'address', 74 'index': 2, 75 'steps':{ 76 'next':{ 77 'show': 'container', 78 'index': 3, 79 } 80 } 81 } 82 } 83 }, 84 'edit': { 85 'show': 'askObjectnumber', 86 'index': 1, 87 'steps':{ 88 'hasObjectnumber':{ 89 'show': 'objectnumber', 90 'index': 2, 91 'steps':{ 92 'next':{ 93 'show': 'container', 94 'index': 3, 95 'steps':{ 96 'next':{ 97 'show': 'container2', 98 'index': 4, 99 } 100 } 101 } 102 } 103 }, 104 'hasNotObjectnumber':{ 105 'show': 'address', 106 'index': 2, 107 'steps':{ 108 'next':{ 109 'show': 'container', 110 'index': 3, 111 'steps':{ 112 'next':{ 113 'show': 'container2', 114 'index': 4, 115 } 116 } 117 } 118 } 119 } 120 } 121 }, 122 'bulktrash': { 123 'show': 'bulktrash', 124 'index': 1, 125 'steps':{} 126 }, 127 'change': { 128 'show': 'askObjectnumber', 129 'index': 1, 130 'steps':{ 131 'hasObjectnumber':{ 132 'show': 'objectnumber', 133 'index': 2, 134 'steps':{ 135 'next':{ 136 'show': 'oldowner', 137 'index': 3, 138 'steps':{ 139 'next':{ 140 'show': 'newowner', 141 'index': 4, 142 'steps':{ 143 'next':{ 144 'show': 'container', 145 'index': 5, 146 'steps':{ 147 'next':{ 148 'show': 'container2', 149 'index': 6, 150 } 151 } 152 } 153 } 154 } 155 } 156 } 157 } 158 }, 159 'hasNotObjectnumber':{ 160 'show': 'address', 161 'index': 2, 162 'steps':{ 163 'next':{ 164 'show': 'oldowner', 165 'index': 3, 166 'steps':{ 167 'next':{ 168 'show': 'newowner', 169 'index': 4, 170 'steps':{ 171 'next':{ 172 'show': 'container', 173 'index': 3, 174 'steps':{ 175 'next':{ 176 'show': 'container2', 177 'index': 4, 178 } 179 } 180 } 181 } 182 } 183 } 184 } 185 } 186 } 187 } 188 }, 189 }; 190 191 $rootScope.Action = function(action,event){ 192 if( typeof event == 'undefined' ) return; 193 194 const formObject = document.getElementById('ekm_forms_top'); 195 const formClose = document.getElementById('ekm_forms_close'); 196 const target = ( typeof event.delegateTarget != 'undefined')? event.delegateTarget : event.target;
197 const row = $(target).closest('.row'); 198 const col = $(target).closest('.col'); 199 $rootScope.colIndex = parseInt( $(row).find('> .col').index(col) ) +1; 200 $('#ekm_forms_top').insertAfter(row); 201 202 toFormTop(); 203 $rootScope.ResetForm(); 204 205 if( action === $rootScope.action ){ 206 formObject.classList.remove('is-open'); 207 formObject.classList.add('is-none'); 208 formObject.removeEventListener('keydown', focusTrap, false); 209 document.removeEventListener('keydown', closeOnEsc, false); 210 211 $rootScope.action = null; 212 $rootScope.ask = ''; 213 $rootScope.currentStep = null; 214 target.removeAttribute('data-active'); 215 target.focus(); 216 return false; 217 } 218 219 $rootScope.action = action; 220 $rootScope.uploader.clearQueue(); 221 222 try{ 223 $rootScope.ask = $rootScope.actions[$rootScope.action].show; 224 225 formObject.classList.add('is-open'); 226 formObject.classList.remove('is-none'); 227 formObject.addEventListener('keydown', focusTrap, false); 228 target.setAttribute('data-active', 'true'); 229 formClose.focus(); 230 $rootScope.currentStep = { 'step': $rootScope.actions[$rootScope.action], 'name': null }; 231 $scope.clearHistory(); 232 }catch(e){} 233 }; 234 235 $rootScope.Close = function(){ 236 const formObject = document.getElementById('ekm_forms_top'); 237 const opener = document.querySelector('button[data-active="true"]'); 238 239 $rootScope.ResetForm(); 240 $rootScope.action = null; 241 $rootScope.ask = ''; 242 $rootScope.currentStep = null; 243 $rootScope.uploader.clearQueue(); 244 formObject.classList.remove('is-open'); 245 formObject.classList.add('is-none'); 246 opener.focus(); 247 opener.removeAttribute('data-active'); 248 formObject.removeEventListener('keydown', focusTrap, false); 249 document.removeEventListener('keydown', closeOnEsc, false); 250 }; 251 252 $rootScope.IsAction=function(action){ 253 254 if( $rootScope.action===null ) return true; 255 return (action==$rootScope.action)? true : false;; 256 257 } 258 259}); 260 261app.controller('FormAskController', function($scope,$http,$rootScope,$anchorScroll,$location) { 262 263 $rootScope.ask = ''; 264 $rootScope.currentStep = null; 265 $rootScope.form = {'newproperty': {'proof': 'after'},'newowner': {'proof': 'after', 'container': 'apply'}, 'containers':[{}],'containers2':[{}],'bulktrash':{'data':[{}]}}; 266 267 $scope.showValidation = false; 268 $scope.dateFormat = "[0-9][0-9]\\.[0-9][0-9]\\.[0-9][0-9][0-9][0-9]"; 269 $scope.containernumberFormat = "[0-9]{6,9}"; 270 $scope.objectnumberFormat = "[0-9]{13}"; 271 $scope.zipcodeFormat = "[0-9]{5}"; 272 $scope.numberFormat = "[0-9]+"; 273 274 $rootScope.BulktrashNumberValidate=function(){ 275 276 var volume = String( $rootScope.form.bulktrash.volume ); 277 if(volume.length){ 278 var volumeReplaced = volume.replace(/[^0-9\,\.]*/, ''); 279 volumeReplaced = String(volumeReplaced.replace(",", '.')); 280 $rootScope.form.bulktrash.volume = parseInt(volumeReplaced); 281 } 282 283 } 284 285 $rootScope.bulktrash_terms= [ 286 'Bettgestell(e), Springrahmen', 287 'Couch, Liege, Sofa', 288 'Sessel', 289 'Stuhl, Hocker', 290 'Tisch / Schreibtisch, Sitzbank / -ecke', 291 'Teppich, FuÃbodenbelag', 292 'Matratze, Federbett, Steppdecken', 293 'Schrank, Kommode, Flurgarderobe', 294 'Kiste, Koffer, Tasche (leer)', 295 'Regale, Schublade (leer)', 296 'Gartengeräte, Hausarbeitsgeräte', 297 'Gardinenstange, Rollo, Lampe (nicht aus Metall)', 298 'Ski, Schlitten, Holzroller u.ä.', 299 'Kinderwagen, Handwagen', 300 'Wäschekorb, Plastikwanne, Fass, Eimer', 301 'Camping- und Gartenmöbel', 302 'Bretter (Kleinteile) von Möbeln', 303 'Schrankwand', 304 'Gartengeräte/Hausarbeitsgeräte wie Besen', 305 'Sonstiges', 306 ]; 307 308 $rootScope.containers = [ 309 {'id':1,'name': 'Restabfallbehälter', 'key': 'r', 'sizes': [80,120,240,1100]}, 310 {'id':2,'name': 'Blaue Tonne für Papier', 'key': 'p', 'sizes': [240,1100]}, 311 {'id':3,'name': 'Gelbe Tonne für Leichtverpackungen', 'key':'l', 'sizes': [240,1100]} 312 ]; 313 314 $rootScope.newpropertyTypes = [ 315 'Gewerbe', 316 'Verein', 317 'Freiberufler', 318 'Privatgrundstück' 319 ]; 320 321 var PrevStep = function( step, stepname, steptrunk ){ 322 323 if( ( 'steps' in step ) && ( stepname in step['steps'] ) ){ 324 return { 'step': step, 'name': steptrunk}; 325 }else{ 326 327 if( 'steps' in step ){ 328 for( steptrunk in step['steps'] ){ 329 var result = PrevStep( step['steps'][steptrunk], stepname, steptrunk ); 330 if( typeof result == 'object' ) return result; 331 } 332 333 } 334 335 } 336 } 337 338 $rootScope.StepBack=function(){ 339 340 toFormTop(); 341 if( $rootScope.ShowConfirmation() ){ 342 $rootScope.Confirmation(false); 343 return; 344 } 345 346 347 var tmp = $rootScope.history.pop(); 348 $rootScope.currentStep = tmp; 349 $rootScope.ask = tmp.step.show; 350 351 if( $rootScope.currentStep.name === null ) $scope.clearHistory(); 352 353 } 354 355 $scope.clearHistory = function(){ 356 357 $rootScope.history = []; 358 359 } 360
361 $rootScope.Step = function(step){ 362 363 var status = false; 364 365 if( !$scope.validateForm() ) return false; 366 367 if( 'steps' in $rootScope.currentStep.step ){ 368 if( step in $rootScope.currentStep.step['steps'] ){ 369 370 $rootScope.history.push($rootScope.currentStep); 371 372 $rootScope.currentStep = { 'step': $rootScope.currentStep.step['steps'][step], 'name': step }; 373 $rootScope.ask = $rootScope.currentStep.step.show; 374 status = true; 375 } 376 377 } 378 379 if( !status ) $scope.Submit(); 380 381 toFormTop(); 382 383 }; 384 385 $rootScope.validateForm = function(){ 386 if( $scope.AskForm.$invalid ){ 387 $scope.showValidation = true; 388 return false; 389 } 390 391 $scope.showValidation = false; 392 return true; 393 } 394 395 $rootScope.ResetForm = function(){ 396 397 $rootScope.form = {'newproperty': {'proof': 'after'},'newowner': {'proof': 'after', 'container': 'apply'}, 'containers':[{}],'containers2':[{}],'bulktrash':{'data':[{}]}}; 398 399 $rootScope.Confirmation(false); 400 $rootScope.SetSubmitted(false); 401 402 } 403 404 // Container erstellen 405 $rootScope.AddContainer = function(){ 406 407 if( $scope.validateForm() ){ 408 $scope.showValidation = false; 409 $rootScope.form.containers.push({}); 410 411 setTimeout(() => { 412 let lastContainerId = $rootScope.form.containers.length - 1; 413 let lastRowSelect = document.getElementById('forms_container_type-' + lastContainerId); 414 415 if (lastRowSelect) { 416 lastRowSelect.focus(); 417 } 418 419 }, 50); 420 }else{ 421 422 $scope.showValidation = true; 423 } 424 425 } 426 427 // Container erstellen 428 $rootScope.AddContainer2 = function(){ 429 if( $scope.validateForm() ){ 430 $scope.showValidation = false; 431 $rootScope.form.containers2.push({}); 432 433 setTimeout(() => { 434 let lastContainerId = $rootScope.form.containers2.length - 1; 435 let lastRowSelect = document.getElementById('forms_container_type-' + lastContainerId); 436 437 if (lastRowSelect) { 438 lastRowSelect.focus(); 439 } 440 441 }, 50); 442 }else{ 443 444 $scope.showValidation = true; 445 } 446 447 } 448 449 // Container entfernen 450 $rootScope.RemoveContainer = function(keyRemove){ 451 452 var tmp = []; 453 angular.forEach($rootScope.form.containers, function(value, key) { 454 if( key !== keyRemove ) 455 tmp.push(value); 456 }); 457 $rootScope.form.containers = tmp; 458 459 } 460 461 $rootScope.RemoveContainer2 = function(keyRemove){ 462 463 var tmp = []; 464 angular.forEach($rootScope.form.containers2, function(value, key) { 465 if( key !== keyRemove ) 466 tmp.push(value); 467 }); 468 $rootScope.form.containers2 = tmp; 469 470 } 471 472 $rootScope.AddBulktrash = function(){ 473 474 $rootScope.form.bulktrash.data.push({});return; 475 476 if( $scope.validateForm() ){ 477 $scope.showValidation = false; 478 $rootScope.form.bulktrash.data.push({}); 479 }else{ 480 481 $scope.showValidation = true; 482 } 483 484 } 485 486 // Container entfernen 487 $rootScope.RemoveBulktrash = function(keyRemove){ 488 489 var tmp = []; 490 angular.forEach($rootScope.form.bulktrash.data, function(value, key) { 491 if( key !== keyRemove ) 492 tmp.push(value); 493 }); 494 $rootScope.form.bulktrash.data = tmp; 495 496 } 497 498 // Formular absenden 499 $scope.Submit = function(){ 500 501 if( !$scope.validateForm() ) return false; 502 $rootScope.Confirmation(); 503 504 } 505 506 $scope.ChangeUploadOption = function(){ 507 508 if( $scope.form.newproperty.proof == 'after' ){ 509 $rootScope.uploader.queue = []; 510 } 511 512 if( $scope.form.newowner.proof == 'after' ){ 513 $rootScope.uploader.queue = []; 514 } 515 516 if( $scope.form.newproperty.proof == 'file' && $rootScope.uploader.queue.length == 0 ){ 517 $scope.AskForm.newpropertyprooffile.$setValidity('file', false); 518 } 519 520 } 521}); 522 523app.controller('FormConfirmationController', function($scope,$http,$rootScope) { 524 525 $scope.show=false; 526 $scope.submitError = false;
527 $scope.isSubmitted = false; 528 $scope.isPrivacyChecked = false; 529 $scope.showValidation = false; 530 $rootScope.isSubmitting = false; 531 532 $rootScope.HasContainers=function(){ 533 return (typeof $rootScope.form.containers[0].type !== 'undefined')? true : false; 534 } 535 536 $rootScope.HasContainers2=function(){ 537 return (typeof $rootScope.form.containers2[0].type !== 'undefined')? true : false; 538 } 539 540 $rootScope.HasBulktrash=function(){ 541 return (typeof $rootScope.form.bulktrash.data[0].type !== 'undefined')? true : false; 542 } 543 544 $rootScope.ShowConfirmation=function(){ 545 546 return $scope.show; 547 } 548 549 $rootScope.Confirmation=function(bool){ 550 $scope.show=(typeof bool == 'boolean')? bool : true; 551 552 } 553 554 $rootScope.ConfirmationInit=function(){ 555 toFormTop(); 556 } 557 558 $rootScope.SetSubmitted=function( bool ){ 559 $scope.isSubmitted = bool; 560 } 561 562 $rootScope.IsSubmitted=function(){ 563 return $scope.isSubmitted; 564 } 565 566 $rootScope.SubmitForm = function(){ 567 $scope.showValidation = true; 568 569 if ($rootScope.form.hp === undefined) { 570 if( $rootScope.uploader.queue.length > 0 ){ 571 $rootScope.uploader.uploadAll(); 572 }else{ 573 if ("undefined" != typeof $rootScope.form.objectnumber.isPrivacyChecked 574 && true == $rootScope.form.objectnumber.isPrivacyChecked 575 ) { 576 $rootScope.DoSubmit(); 577 } 578 } 579 } 580 } 581 582 $rootScope.DoSubmit = function(){ 583 584 if( $rootScope.isSubmitting ) return; 585 $rootScope.isSubmitting = true; 586 587 $http({ 588 method: 'POST', 589 url: '?type=324422', 590 data: {'form': $rootScope.form, 'action': $rootScope.action }, 591 }).then(function successCallback(response) { 592 593 if( typeof response.error == 'integer' && response.error === 0){ 594 $scope.Success(); 595 }else{ 596 $scope.Error(); 597 } 598 599 $rootScope.isSubmitting = false; 600 toFormTop(); 601 602 }, function errorCallback(response) { 603 604 $rootScope.isSubmitting = false; 605 606 }); 607 608 } 609 610 $scope.Success=function(){ 611 $rootScope.SetSubmitted(true); 612 } 613 614 $scope.Error=function(){ 615 $rootScope.SetSubmitted(true); 616 $scope.submitError = true; 617 } 618}); 619 620function toFormTop(){ 621 const offset = $('#ekm_forms_top').position().top-100; 622 window.scrollTo(0,offset); 623 624 const formObject = document.getElementById('ekm_forms_top'); 625 const formClose = document.getElementById('ekm_forms_close'); 626 formClose.focus(); 627 formObject.addEventListener('keydown', focusTrap, false); 628 629 document.addEventListener('keydown', closeOnEsc, false); 630 631 // positioning of the arrow 632 setTimeout(() => { 633 const bObj = document.querySelector('button[data-active="true"]'); 634 const marker = document.querySelector('.col.mark'); 635 636 // reset marker in case it has been already positioned 637 marker.removeAttribute('style'); 638 639 const position = bObj.getBoundingClientRect(); 640 const markerPosition = marker.getBoundingClientRect(); 641 marker.style.left = (position.left - markerPosition.left + ((position.width / 2) - (markerPosition.width / 2))) + 'px'; 642 }, 25); 643} 644 645function closeOnEsc(event) { 646 if (event.keyCode === 27) { 647 event.preventDefault(); 648 const formObject = document.getElementById('ekm_forms_top'); 649 const elementScope = angular.element(formObject).scope(); 650 elementScope.$parent.Close(); 651 } 652} 653
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.