1////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 2// 3// GLOBALE JAVASCRIPT FUNKTIONEN UND KLASSEN WELCHE QUER DURCH DIE APPLIKATION BENÃTIGT WERDEN 4// 5// Beinhaltet aktuell folgende Klassen: 6// 7// #XX Allgemeine Funktionen wie LTrim, RTrim, Trim, NumTrim ... 8// #XX Allgemeine Handler wie window.onerror usw. 9// 10// sowie die Klassen 11// 12// #01 ####RESERVIERT###### 13// #02 Url (utf8 encode und decode von strings) 14// #03 FunctionDelayer (verzögert einen Funktionsaufruf so lange bis kein Trigger Event innerhalb der x ms aufgetreten ist. 15// #04 Office - Menü (Superfish Menü) Funktionalität für das Hauptmenü der Applikation 16// #05 LyoFileUpload - Klasse für FileUpload Diloage 17// #06 CustomerIdFormatter - Formatiert die eingegebene KundenID beim Verlassen anhand des Kunden-ID Schemas 18// #07 DealerIdFormatter - Formatiert eine HändlerID beim Verlassen eines Feldes anhand des Händler-ID Schemas 19// #08 FieldRubber - Löscht den Wert aus allen übergebenen Eingabefeldern 20// #09 Klasse onchangeblur - Ruft eine Funktion auf wenn sich der Wert im Eingabefeld seit dem letzten Verlassen geändert hat, und das Eingabefeld verlassen wird. 21// #10 Klasse für Please Wait 22// #11 Serveraufruf via Ajax 23// #12 Klasse FormFieldReminder - Merkt sich alle Formularfelder beim Seitenaufbau beim verlassen kann so z.B. geprüft werden ob mann nicht auf das Speichern vergessen hat. 24// #13 Cascade 25// 26////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 27/// <reference path="jquery-1.3.2.min-vsdoc.js" /> 28 29////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 30// ToDo Eventuell umabuen auf eine sichere Variante 31// Eval ist
32////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 33function doEval(str) { 34 return eval(str); 35} 36 37 38 39 40// Check KeyCode 41function checkKey(e, key) { 42 43 e = e || window.event; 44 var k = e.keyCode || e.which || e.charCode; 45 46 if (k == key) return true; 47 return false; 48} 49 50// Enter 51function checkEnter(event) { 52 return checkKey(event, 13); 53} 54 55// Löschen 56function checkDel(event) { 57 return checkKey(event, 8); 58} 59 60// ESC 61function checkESC(event) { 62 return checkKey(event, 27); 63} 64 65function toJQuerySelectorString(orig) { 66 67 orig = orig.replace('[', '\\['); 68 orig = orig.replace(']', '\\]'); 69 70 return orig; 71} 72 73////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 74// Copy text to clipboard 75////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 76function copyToClipboard(meintext, message,errorMessage) { 77 78try{ 79 80 if (window.clipboardData) { // the IE-way 81 window.clipboardData.setData("Text", meintext); 82 // Probabely not the best way to detect netscape/mozilla. 83 // I am unsure from what version this is supported 84 } 85 else if (window.netscape) { 86 // This is importent but it's not noted anywhere 87 netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 88 // create interface to the clipboard 89 var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 90 if (!clip) return; 91 // create a transferable 92 var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 93 if (!trans) return; 94 // specify the data we wish to handle. Plaintext in this case. 95 trans.addDataFlavor('text/unicode'); 96 // To get the data from the transferable we need two new objects 97 var str = new Object(); var len = new Object(); 98 var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 99 var copytext = meintext; str.data = copytext; 100 trans.setTransferData("text/unicode", str, copytext.length * 2); 101 var clipid = Components.interfaces.nsIClipboard; 102 if (!clip) return false; 103 clip.setData(trans, null, clipid.kGlobalClipboard); 104 } 105 alert(message + ":\n\n" + meintext); 106 return false; 107 } 108 catch(ex) 109 { 110 alert(errorMessage); 111 } 112} //--> 113 114 115////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 116// Allgemeine Funktionen 117// 118// Beinhaltet: 119// 120// LTrim, RTrim, Trim, NumTrim 121// 122////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 123/*tp%3A//www.lyoness.ag/internal/CustomerCenter/OnlineShops/Redirect%3Fhid%3D109000006%26s 124$(window).error(function(e) { 125//alert(e); 126}); 127*/ 128 129/* Setzt die Cursorposition an eine bestimmte Stelle im Textfeld bzw. in der Textbox */ 130new function ($) { 131 $.fn.setCursorPosition = function (pos) { 132 if ($(this).get(0).setSelectionRange) { 133 $(this).get(0).setSelectionRange(pos, pos); 134 } else if ($(this).get(0).createTextRange) { 135 var range = $(this).get(0).createTextRange(); 136 range.collapse(true); 137 range.moveEnd('character', pos); 138 range.moveStart('character', pos); 139 range.select(); 140 } 141 } 142} (jQuery); 143 144 145var Public_onlineShops = { 146 onlineShops_open: function(obj, loggedIn, loginUrl, openInSameWindow) { 147 148 var url = $(obj).attr("href"); 149 150 if (!url) return true; 151 if (loggedIn) { 152 if (openInSameWindow) { 153 location.href = url; 154 } 155 else { 156 var popup = window.open(url, ''); 157 return (popup) ? false : true; 158 } 159 } 160 else { 161 162 163 var title = Translate("OnlineshoppingLoginDialogTitle", "JSArea.DealerSearchArea") 164 165 // tmp disabled 166 // var url = loginUrl + "?referrer=" + escape(url) + "&openWindow=true"; 167 if (openInSameWindow) 168 url = loginUrl + "?referrer=" + escape(url); 169 else 170 url = loginUrl + "?referrer=" + escape(url) + "&openWindow=true"; 171 172 //alert(loginUrl); 173 174 var defaults = { 175 InitUrl: url, 176 title: title, 177 Size: { 178 Height: 468, 179 Width: 440 180 }, 181 OnClosed: Public_onlineShops.onlineShopsDialogClose, 182 WindowName: 'OnlineshoppingLoginDialog', 183 NoScrollBars: true 184 }; 185 186 var parentWin = new LyoGenericWindow(url, defaults); 187 parentWin.ShowDlg(); 188 return false;
189 } 190 } 191} 192 193/* 194 * c.by@gery 195 * Erstellt ein indiv. popup mit Titel, Url => filename mitgeben 196 * param: obj, Url, Array: Translation(Key, Area), Width, Height 197 * 198 */ 199var CustomPopup = { 200 win_open: function(obj, Url, arrTransKey, w, h) { 201 202 var title = ""; 203 var url = $(obj).attr("href"); 204 205 if (!url) return true; 206 207 if (arrTransKey != null) 208 title = Translate(arrTransKey[0], arrTransKey[1]); 209 210 var defaults = { 211 InitUrl: Url, 212 title: title, 213 Size: { 214 Height: h, 215 Width: w 216 }, 217 OnClosed: CustomPopup.onlineShopsDialogClose 218 }; 219 var parentWin = new LyoGenericWindow(url, defaults); 220 parentWin.ShowDlg(); 221 return false; 222 223 } 224} 225 226// Schneidet bestimmte Zeichen am Anfang eines Strings weg 227function LTrim(str, chars) { 228 chars = chars || "\\s"; 229 return str.replace(new RegExp("^[" + chars + "]+", "g"), ""); 230} 231 232// Schneidet bestimmte Zeichen am Ende Eines Strings weg 233function RTrim(str, chars) { 234 chars = chars || "\\s"; 235 return str.replace(new RegExp("[" + chars + "]+$", "g"), ""); 236} 237 238// Schneidet bestimmte Zeichen am Anfang und Ende des Strings weg 239function Trim(str, chars) { 240 return LTrim(RTrim(str, chars), chars); 241} 242 243// Schneidet alle Sonderzeichen ausser Zahlen aus dem String. 244function NumTrim(str) { 245 246 if (str == null) return null; 247 var vNewStr = ""; 248 249 for (var vcnt = 0; vcnt < str.length; vcnt++) { 250 if (!isNaN(str.charAt(vcnt))) { 251 vNewStr = vNewStr + str.charAt(vcnt); 252 } 253 } 254 255 return vNewStr; 256} 257 258function StripTags(str) { 259 return str.replace(/<\/?[^>]+>/gi, ''); 260} 261 262 263// Prüft ob ein String leer ist oder Null 264function IsNullOrEmpty(str) { 265 if (str == null || str == "" || str == undefined) { 266 return true; 267 } 268 return false; 269} 270 271function IsNullOrUndefined(obj) { 272 273 if (obj == null || obj == undefined) 274 return true; 275 276 return false; 277} 278 279// Prüfungen für Zahlen (Javascriptprüfung und Länderprüfung) 280function IsNumber(value) { 281 282 if (IsNullOrEmpty(value)) 283 return false; 284 if(!isNaN(value)) 285 return true; 286 287 value = value.replace(new RegExp(/\s+/g), ''); 288 289 var regex = '^-?(?:\\d+|\\d{1,3}(?:' + _thousandSeparator.replace('.', '\\.') + '\\d{3})+)(?:' + _decimalSeparator.replace('.', '\\.') + '\\d+)?$'; 290 var re = new RegExp(regex); 291 292 return !isNaN(value) || re.test(value); 293} 294 295// Wandelt länderspezifische Zahl in javascriptfähige Zahl um 296function NumberDefaultToNumber(value) { 297 298 value = value + ''; 299 if (IsNumber(value)) { 300 var thSeparator = _thousandSeparator.replace('.', '\\.'); 301 var deciSeparator = _decimalSeparator.replace('.', '\\.'); 302 303 return parseFloat(value.replace(new RegExp(/\s+/g), '').replace(new RegExp(thSeparator, 'g'), '').replace(new RegExp(deciSeparator), '.')); 304 } 305 306 return value; 307} 308 309// Wandelt javascriptfähige Zahl in länderspezifische Zahl um 310function NumberToNumberDefault(value) { 311 value = value + ''; 312 var start = value.indexOf('-') != -1 ? 4 : 3; 313 if (value.indexOf('.') > start || (value.indexOf('.') == -1 && value.length > (start + 1))) { 314 var index = value.indexOf('.') - 3; 315 if (index < 1) index = value.length - 3; 316 do { 317 value = value.substring(0, index) + ',' + value.substring(index); 318 index = index - 3; 319 } while (index > 0 && (value.indexOf('-') == -1 || index > 1)); 320 } 321 322 return value.replace(/\./g, '#').replace(/,/g, _thousandSeparator).replace(/#/, _decimalSeparator); 323} 324 325// Wandelt einen String in eine Kundennummer um 326function toCustomerNumber(custnumvalue) { 327 328 var vOrigValue = NumTrim(custnumvalue); 329 330 var vTempValue = ""; 331 var vNewValue = ""; 332 333 var vCharCount = 0; 334 var vPointCount = 0; 335 336 if (vOrigValue.length < 7 || vOrigValue.length > 12) { 337 return; 338 } 339 340 if (vOrigValue.length >= 7 && vOrigValue.length <= 15) { 341 342 // Punkte setzen 343 for (var vMax = vOrigValue.length - 1; vMax >= 0; --vMax) { 344 345 if (vCharCount == 3) { 346 vTempValue = vTempValue + "."; 347 vCharCount = 0; 348 vPointCount++; 349 } 350 351 vTempValue = vTempValue + vOrigValue.charAt(vMax); 352 vCharCount = vCharCount + 1; 353 } 354 355 var vTempNulls = ""; 356 // mit führenden Nullen auffüllen 357 for (var noex = vCharCount; noex < 3; noex++) { 358 vTempNulls = vTempNulls + "0"; 359 } 360 361 vNewValue = vTempNulls; 362
363 // jetzt nochmal deas Ganze umdrehen. 364 for (var vMax2 = vTempValue.length - 1; vMax2 >= 0; --vMax2) { 365 vNewValue = vNewValue + vTempValue.charAt(vMax2); 366 } 367 368 369 // wir befüllen den zweiten Block mit drei Nullen wenn notwendig. 370 if (vPointCount == 2) { 371 var vCols = vNewValue.split("."); 372 if (vCols.length == 3) { 373 vNewValue = vCols[0] + ".000." + vCols[1] + "." + vCols[2]; 374 } 375 } 376 } 377 378 return vNewValue; 379} 380 381// Wandelt einen String in eine Dealernummer um 382function toDealerNumber(dealernumvalue) { 383 return dealernumvalue; 384} 385 386 387////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 388// Allgemeine Handler 389////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 390 391////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 392// Allgemeine Handler 393////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 394 395 396LyonessErrorHandler = function() { 397this.self = this; 398 //ToDo vorübergehen ausgeschaltet 399 return; 400 if (DebugMode != undefined && DebugMode == false) { 401 402 // Alle nicht von uns geworfenen bzw. abgefangen Javascript Fehler werden hier klient und serverseitig gemeldet 403 window.onerror = function(nachricht, datei, zeile) { 404 405 if (window.disableErrorCatching == undefined || window.disableErrorCatching == null || window.disableErrorCatching == false) { 406 407 var errMsg = "" + 408 LyonessErrorHandler.MessagePrefix + "\n\n" + 409 "Error: " + nachricht + " \n" + 410 "File: " + datei + " \n" + 411 "Row: " + zeile + " \n\n" + 412 "You will be forwarded automatically. The error will be logged on the server! "; 413 414 alert(errMsg); 415 LyonessErrorHandler.SendAndRedirectToErrorPage(errMsg); 416 417 return true; 418 419 } else { 420 421 return false; 422 } 423 } 424 } 425} 426 427LyonessErrorHandler.MessagePrefix = "JavaScriptError: "; 428 429LyonessErrorHandler.prototype.SendError = function(message) { 430 LyonessErrorHandler.SendAndRedirectToErrorPage(LyonessErrorHandler.MessagePrefix + message); 431} 432 433LyonessErrorHandler.prototype.SendAjaxError = function(xhr, ajaxOptions, thrownError) { 434 435 var errMsg = "" + 436 LyonessErrorHandler.MessagePrefix + "\n\n" + 437 "xhr: " + xhr + " \n" + 438 "ajaxOptions: " + ajaxOptions + " \n" + 439 "thrownError: " + thrownError + ""; 440 441 LyonessErrorHandler.SendAndRedirectToErrorPage(errMsg); 442} 443 444LyonessErrorHandler.SendAndRedirectToErrorPage = function(errMsg) { 445 446 var logError = false; 447 448 try { 449 450 if (DebugMode == true) { 451 $.ajax({ 452 url: HttpRootPath + 'public/Home/LogError', 453 cache: false, 454 type: 'POST', 455 async: false, 456 data: { msg: errMsg }, 457 dataType: 'text', 458 success: function(response) { 459 if (response == 'OK') { 460 logError = false; 461 } else { 462 logError = true; 463 } 464 }, 465 error: function(xhr, ajaxOptions, thrownError) { 466 logError = true; 467 } 468 }); 469 470 window.document.location.href = HttpRootPath + 'public/Home/error'; 471 } 472 473 } catch (e) { 474 logError = true; 475 } 476 477 if (logError == true) { 478 alert("Your error could not be logged! Contact DataService!"); 479 } 480} 481 482var LyoErrorHandler = new LyonessErrorHandler(); 483 484////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 485// KLASSE URL (utf8 encode und decode von strings) 486// 487// Beispiel: 488// 489// var newstring = Url.decode("ein utf encodierter string");
490// var oldstring = Url.encode(newstring); 491// 492////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 493 494var Url = { 495 496 // public method for url encoding 497 encode: function(string) { 498 return escape(this._utf8_encode(string)); 499 }, 500 501 // public method for url decoding 502 decode: function(string) { 503 return this._utf8_decode(unescape(string)); 504 }, 505 506 // private method for UTF-8 encoding 507 _utf8_encode: function(string) { 508 509 string = string.replace(/\r\n/g, "\n"); 510 var utftext = ""; 511 512 for (var n = 0; n < string.length; n++) { 513 514 var c = string.charCodeAt(n); 515 516 if (c < 128) { 517 utftext += String.fromCharCode(c); 518 } 519 else if ((c > 127) && (c < 2048)) { 520 utftext += String.fromCharCode((c >> 6) | 192); 521 utftext += String.fromCharCode((c & 63) | 128); 522 } 523 else { 524 utftext += String.fromCharCode((c >> 12) | 224); 525 utftext += String.fromCharCode(((c >> 6) & 63) | 128); 526 utftext += String.fromCharCode((c & 63) | 128); 527 } 528 529 } 530 531 return utftext; 532 }, 533 534 // private method for UTF-8 decoding 535 _utf8_decode: function(utftext) { 536 537 var string = ""; 538 var i = 0; 539 var c = c1 = c2 = 0; 540 541 while (i < utftext.length) { 542 543 c = utftext.charCodeAt(i); 544 545 if (c < 128) { 546 string += String.fromCharCode(c); 547 i++; 548 } 549 else if ((c > 191) && (c < 224)) { 550 c2 = utftext.charCodeAt(i + 1); 551 string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); 552 i += 2; 553 } 554 else { 555 c2 = utftext.charCodeAt(i + 1); 556 c3 = utftext.charCodeAt(i + 2); 557 string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); 558 i += 3; 559 } 560 561 } 562 563 return string; 564 } 565} 566 567 568////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 569// Klasse FUNCTION DELAYER 570// Verzögert einen Funktionsaufruf so lange bis kein Trigger Event innerhalb der ms aufgetreten ist 571// 572// Beispiel: 573// 574// var fctdelay = new FunctionDelayer( 575// [Name des FunktionDelayers], 576// [Die Funktion die aufgerufen werden soll], 577// [Ein Objekt das der Funktion als Parameter übergeben werden soll], 578// [Anzahl der Millisekunden die bis zum Aufruf gewartet werden soll] 579// ); 580// 581// fctdelay.Trigger(); 582// 583////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 584 585FunctionDelayer = function(name, successfunction, obj, ms) { 586 587 this.name = name; 588 this.succobject = obj; 589 this.succfunction = successfunction; 590 this.ms = ms; 591 592 this.triggered = null; 593 this.aborted = false; 594 595 this.CheckWait = function(objectname) { 596 597 if (window["fctdelayer_" + objectname].aborted == false) { 598 599 if (window["fctdelayer_" + objectname].triggered == false) { 600 // funktion aufrufen 601 window["fctdelayer_" + objectname].triggered = null; 602 window["fctdelayer_" + objectname].succfunction(this.succobject); 603 } else { 604 // es folgt ein weiterer aufruf 605 window["fctdelayer_" + objectname].triggered = false; 606 window.setTimeout("window[\"fctdelayer_" + objectname + "\"].CheckWait(\"" + objectname + "\")", window["fctdelayer_" + objectname].ms); 607 } 608 609 } else { 610 window["fctdelayer_" + objectname].triggered = null; 611 } 612 } 613} 614 615FunctionDelayer.prototype.Trigger = function() { 616 617 if (this.triggered == false) { 618 619 this.triggered = true; 620 621 } else if (this.triggered == null) { 622 623 this.triggered = false; 624 window["fctdelayer_" + name] = this; 625 window.setTimeout("window[\"fctdelayer_" + name + "\"].CheckWait(\"" + name + "\")", this.ms); 626 } 627} 628 629FunctionDelayer.prototype.Abort = function() { 630 631 this.aborted = true; 632} 633 634 635 636////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 637// Klasse OFFICE-MENU 638// DropDown Menü für die Office - Webseite 639// 640// Beispiel: 641// 642// $(document).ready(function() { 643// $('ul.sf-menu').superfish(); 644// }); 645// 646////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 647 648; (function($) { 649 650 $.fn.superfish = function(op) { 651 652 var sf = $.fn.superfish, 653 c = sf.c, 654 $arrow = $(['<span class="', c.arrowClass, '"> »</span>'].join('')), 655 over = function() { 656 var $$ = $(this), menu = getMenu($$); 657 clearTimeout(menu.sfTimer); 658 $$.showSuperfishUl().siblings().hideSuperfishUl(); 659 }, 660 out = function() { 661 662 var $$ = $(this), menu = getMenu($$), o = sf.op; 663 664 clearTimeout(menu.sfTimer); 665 666 menu.sfTimer = setTimeout(function() { 667 o.retainPath = ($.inArray($$[0], o.$path) > -1);
668 $$.hideSuperfishUl(); 669 if (o.$path.length && $$.parents(['li.', o.hoverClass].join('')).length < 1) { over.call(o.$path); } 670 }, o.delay); 671 }, 672 getMenu = function($menu) { 673 var menu = $menu.parents(['ul.', c.menuClass, ':first'].join(''))[0]; 674 sf.op = sf.o[menu.serial]; 675 return menu; 676 }, 677 addArrow = function($a) { $a.addClass(c.anchorClass).append($arrow.clone()); }; 678 679 return this.each(function() { 680 var s = this.serial = sf.o.length; 681 var o = $.extend({}, sf.defaults, op); 682 o.$path = $('li.' + o.pathClass, this).slice(0, o.pathLevels).each(function() { 683 $(this).addClass([o.hoverClass, c.bcClass].join(' ')) 684 .filter('li:has(ul)').removeClass(o.pathClass); 685 }); 686 sf.o[s] = sf.op = o; 687 688 $('li:has(ul)', this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over, out).each(function() { 689 }) 690 .not('.' + c.bcClass) 691 .hideSuperfishUl(); 692 693 694 $('li li:has(ul)', this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over, out).each(function() { 695 if (o.autoArrows) addArrow($('>a:first-child', this)); 696 }) 697 .not('.' + c.bcClass) 698 .hideSuperfishUl(); 699 700 701 var $a = $('a', this); 702 $a.each(function(i) { 703 var $li = $a.eq(i).parents('li'); 704 $a.eq(i).focus(function() { over.call($li); }).blur(function() { out.call($li); }); 705 }); 706 o.onInit.call(this); 707 708 }).each(function() { 709 var menuClasses = [c.menuClass]; 710 if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass); 711 $(this).addClass(menuClasses.join(' ')); 712 }); 713 }; 714 715 var sf = $.fn.superfish; 716 sf.o = []; 717 sf.op = {}; 718 sf.IE7fix = function() { 719 var o = sf.op; 720 if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity != undefined) 721 this.toggleClass(sf.c.shadowClass + '-off'); 722 }; 723 sf.c = { 724 bcClass: 'sf-breadcrumb', 725 menuClass: 'sf-js-enabled', 726 anchorClass: 'sf-with-ul', 727 arrowClass: 'sf-sub-indicator', 728 shadowClass: 'sf-shadow' 729 }; 730 sf.defaults = { 731 hoverClass: 'sfHover', 732 pathClass: 'overideThisToUse', 733 pathLevels: 1, 734 delay: 100, /*800 = default */ 735 animation: { opacity: 'show' }, 736 speed: 'fast', 737 autoArrows: true, 738 dropShadows: true, 739 disableHI: false, // true disables hoverIntent detection 740 onInit: function() { }, // callback functions 741 onBeforeShow: function() { }, 742 onShow: function() { }, 743 onHide: function() { } 744 }; 745 $.fn.extend({ 746 hideSuperfishUl: function() { 747 var o = sf.op, 748 not = (o.retainPath === true) ? o.$path : ''; 749 o.retainPath = false; 750 var $ul = $(['li.', o.hoverClass].join(''), this).add(this).not(not).removeClass(o.hoverClass) 751 .find('>ul').hide().css('visibility', 'hidden'); 752 o.onHide.call($ul); 753 return this; 754 }, 755 showSuperfishUl: function() { 756 var o = sf.op, 757 sh = sf.c.shadowClass + '-off', 758 $ul = this.addClass(o.hoverClass) 759 .find('>ul:hidden').css('visibility', 'visible'); 760 sf.IE7fix.call($ul); 761 o.onBeforeShow.call($ul); 762 $ul.animate(o.animation, o.speed, function() { sf.IE7fix.call($ul); o.onShow.call($ul); }); 763 return this; 764 } 765 }); 766 767})(jQuery); 768 769 770 771////////////////////////////////////////////////////////////////////////////////////////////////////////// 772// KLASSE LYONESS FILEUPLOAD DIALOG 773// Erzeugt aus einen input type="file" ein schönes Konstrukt das mit CSS belegt werden kann. 774////////////////////////////////////////////////////////////////////////////////////////////////////////// 775(function($) { 776 777 $.fn.lyofileupload = function(defaults) { 778 779 var self = this; 780 781 /* übernimmt die settings in das eingabefeld (oder anderes objekt) 782 ** und erstellt den kern der komponente mit oder ohne jquery ui - datepicker 783 */ 784 this._attach_defaults = function(obj, attdefaults) { 785 786 var fileuploaddefaults = { 787 EnableInputFieldClick: true 788 }; 789 790 if (attdefaults != null) $.extend(fileuploaddefaults, attdefaults); 791 $(obj).context.lyofileuploaddefaults = fileuploaddefaults; 792 }; 793 794 /* Schaltet den eigentlichen FileUpload Dialog invisible und baut ein 795 ** schönes CSS formatierbares Konstrukt herum 796 */ 797 this._build_new = function(obj) { 798 799 $(obj).css("opacity", "0.5"); 800 801 $(obj).parent().html( 802 "<div style='position:absolute;'>" + 803 "<div style='z-index:1; position:absolute; top: 0; left: 0;'>" + 804 " <table cellpadding='0' cellspacing='0' border='0' class='lyofileupload'>" + 805 " <tr>" + 806 " <td><input type='text' id='" + $(obj).attr('id') + "_input_field' name='" + $(obj).attr('name') + "_input_field' /></td>" + 807 " <td><input id='" + $(obj).attr('id') + '_browse_button' + "' type='button' value='Browse' /></td>" + 808 " </tr>" +
809 " </table>" + 810 "</div>" + 811 "<div style='z-index:100; position:absolute; top:0; left: 0;' id='" + $(obj).attr('id') + "_original_field_div'></div>" + 812 "</div>" 813 ); 814 815 $('#' + $(obj).attr('id') + '_original_field_div').append($(obj)); 816 817 818 $(obj).context.lyofileupload_do_original_object_handling = function(origobj) { 819 alert($(obj)); 820 } 821 822 // Callback für Browse Button 823 $('#' + $(obj).attr('id') + '_browse_button').click(function() { 824 $(obj).context.lyofileupload_do_original_object_handling(obj); 825 }); 826 827 // Browsen beim Klick auf Eingabefeld 828 if ($(obj).context.lyofileuploaddefaults.EnableInputFieldClick) { 829 $('#' + $(obj).attr('id') + '_input_field').click(function() { 830 $(obj).context.lyofileupload_do_original_object_handling(obj); 831 }); 832 } 833 } 834 835 836 837 /* die einzelnen funktionen auf die entsprechenden edit fields 838 ** legen. (anhand einer klasse, einer id usw.) 839 */ 840 this.each(function(i, obj) { 841 842 self._attach_defaults(obj, defaults); 843 self._build_new(obj); 844 }); 845 } 846 847})(jQuery); 848 849////////////////////////////////////////////////////////////////////////////////////////////////////////// 850// KLASSE CUSTOMERIDFORMATTER 851// Lyoness KundenID Formatierung 852// Formatiert eine KundenID nach Eingabe beim Verlassen des Eingabefeldes 853// 854// Beispiele für Eingabeformate: 855// 856// 043.000.000.123 857// 43.000.000.123 858// 043.000.123 859// 43.000.123 860// 043000000123 861// 43000000123 862// 043000123 863// 43000123 864// 865////////////////////////////////////////////////////////////////////////////////////////////////////////// 866 867 868(function($) { 869 870 $.fn.lyocustomeridformat = function(defaults) { 871 872 var self = this; 873 874 875 /* OnBlur event hinzufügen 876 */ 877 this._attach_on_blur = function(obj) { 878 879 obj._original_on_blur_fct = obj.onblur; 880 881 // neue, überschriebene Funktion 882 obj.onblur = function(event) { 883 884 if (obj.value != null) { 885 var vNewValue = toCustomerNumber(obj.value); 886 obj.value = vNewValue; 887 } 888 889 // original on blur wieder aufrufen 890 if (obj._original_on_blur_fct != null) { 891 obj._original_on_blur_fct(); 892 } 893 } 894 } 895 896 897 /* übernimmt die settings in das eingabefeld (oder anderes objekt) 898 ** und erstellt den kern der komponente mit oder ohne jquery ui - datepicker 899 */ 900 this._attach_defaults = function(obj, attdefaults) { 901 902 // Defaults überschreiben 903 for (var attrName in attdefaults) { 904 obj[attrName] = attdefaults[attrName]; 905 } 906 907 this._attach_on_blur(obj); 908 }; 909 910 /* die einzelnen funktionen auf die entsprechenden edit fields 911 ** legen. (anhand einer klasse, einer id usw.) 912 */ 913 this.each(function(i, obj) { 914 self._attach_defaults(obj, defaults); 915 }); 916 } 917 918})(jQuery); 919 920 921////////////////////////////////////////////////////////////////////////////////////////////////////////// 922// KLASSE DEALERIDFORMATTER 923// Lyoness HändlerID Formatierung 924// Formatiert eine HändlerID nach Eingabe beim Verlassen des Eingabefeldes 925// 926// Beispiele für Eingabeformate: 927// 928// Zur Zeit ist nur eine Eingabe Möglich (z.B. 10109) 929// 930////////////////////////////////////////////////////////////////////////////////////////////////////////// 931 932(function($) { 933 934 $.fn.lyodealeridformat = function(defaults) { 935 936 var self = this; 937 938 939 /* OnBlur event hinzufügen 940 */ 941 this._attach_on_blur = function(obj) { 942 943 obj._original_on_blur_fct = obj.onblur; 944 945 // neue, überschriebene Funktion 946 obj.onblur = function(event) { 947 948 if (obj.value != null) { 949 950 var vOrigValue = NumTrim(obj.value); 951 obj.value = vOrigValue; 952 } 953 954 // original on blur wieder aufrufen 955 if (obj._original_on_blur_fct != null) { 956 obj._original_on_blur_fct(); 957 } 958 } 959 } 960 961 962 /* übernimmt die settings in das eingabefeld (oder anderes objekt) 963 ** und erstellt den kern der komponente mit oder ohne jquery ui - datepicker 964 */ 965 this._attach_defaults = function(obj, attdefaults) { 966 967 // Defaults überschreiben 968 for (var attrName in attdefaults) { 969 obj[attrName] = attdefaults[attrName]; 970 } 971 972 this._attach_on_blur(obj); 973 }; 974 975 /* die einzelnen funktionen auf die entsprechenden edit fields 976 ** legen. (anhand einer klasse, einer id usw.) 977 */ 978 this.each(function(i, obj) { 979 self._attach_defaults(obj, defaults); 980 }); 981 } 982 983})(jQuery); 984 985
986///////////////////////// 987////Tracking 988////// 989 990var LyoTracking = { 991 992 DoLyoTrack: function (trackingTypeID, elementId1, elementId2, elementId3) { 993 994 LyoTracking.Track( 995 { 996 TrackingTypeID: trackingTypeID, 997 ElementId1: elementId1, 998 ElementId2: elementId2, 999 ElementId3: elementId3 1000 }); 1001 1002 }, 1003 1004 Track: function (trackData) { 1005 $.ajax({ 1006 type: "POST", 1007 url: LyoTrackingUrl, 1008 data: trackData 1009 }); 1010 } 1011 1012 1013}; 1014 1015 1016 1017(function ($) { 1018 1019 $.fn.lyoTrack = function (type,id1,id2,id3) { 1020 1021 var self = this; 1022 1023 this._click_track_function = function (e, data) { 1024 1025 LyoTracking.Track(this.LyoTrackParams); 1026 1027 }; 1028 1029 1030 1031 this._init_objects = function (obj, params) { 1032 1033 obj.LyoTrackParams = params; 1034 $(obj).click(self._click_track_function()); 1035 1036 }; 1037 1038 /* die einzelnen funktionen auf die entsprechenden edit fields 1039 ** legen. (anhand einer klasse, einer id usw.) 1040 */ 1041 this.each(function (i, obj) { 1042 self._init_objects(obj, new 1043 { 1044 TrackingTypeID: trackingTypeID, 1045 ElementId1: elementId1, 1046 ElementId2: elementId2, 1047 ElementId3: elementId3 1048 } 1049 ); 1050 }); 1051 } 1052 1053})(jQuery); 1054 1055 1056 1057 1058////////////////////////////////////////////////////////////////////////////////////////////////////////// 1059// KLASSE FIELDRUBBER 1060// Löscht den Wert aus allen übergebenen Eingabefelder 1061////////////////////////////////////////////////////////////////////////////////////////////////////////// 1062 1063LyoFieldRubber = function() { 1064 this.self = this; 1065} 1066 1067LyoFieldRubber.prototype.Clean = function(fields) { 1068 1069 if (fields == null || fields == undefined) return; 1070 1071 var vIds = fields.split(","); 1072 if (vIds != null && vIds.length > 0) { 1073 1074 for (var cnt = 0; cnt < vIds.length; cnt++) { 1075 var aktfield = $('#' + (Trim(vIds[cnt], " "))); 1076 if (aktfield.attr('name') == '__RequestVerificationToken') continue; 1077 if (!IsNullOrEmpty(aktfield.val())) aktfield.val(''); 1078 1079 // Brauchen wir für die onChangeBlur Felder die eventuell auch geleert werden. 1080 if (aktfield[0] != null && aktfield[0] != undefined && aktfield[0].SetOldValue != null && aktfield[0].SetOldValue != undefined) { 1081 aktfield[0].SetOldValue(''); 1082 } 1083 } 1084 } 1085} 1086 1087LyoFieldRubber.prototype.CleanArea = function(areaid, ignorefieldids) { 1088 1089 var area = document.getElementById(areaid); 1090 if (area == null) return; 1091 1092 var igfields = null; 1093 if (ignorefieldids != null) { 1094 igfields = ignorefieldids.split(","); 1095 } 1096 1097 var aInputs = $(area).find('input,textarea,select,radio'); 1098 1099 var ignore = false; 1100 for (var i in aInputs) { 1101 1102 if (typeof (aInputs[parseInt(i)]) != 'undefined') { 1103 1104 ignore = false; 1105 1106 if (igfields != null) { 1107 for (var idx = 0; idx < igfields.length; idx++) { 1108 //alert(aInputs[parseInt(i)].id + ' ' + Trim(igfields[idx], " ")); 1109 if (aInputs[parseInt(i)].id == Trim(igfields[idx], " ") || aInputs[parseInt(i)].name == '__RequestVerificationToken') { 1110 ignore = true; 1111 break; 1112 } 1113 } 1114 if (ignore == true) continue; 1115 }
1116 if (aInputs[parseInt(i)].type != "submit" && aInputs[parseInt(i)].type != "button" && 1117 aInputs[parseInt(i)].type != "radio" && aInputs[parseInt(i)].type != "checkbox") { 1118 1119 aInputs[parseInt(i)].value = ""; 1120 1121 // Brauchen wir für die onChangeBlur Felder die eventuell auch geleert werden. 1122 if (aInputs[parseInt(i)] != null && aInputs[parseInt(i)] != undefined && aInputs[parseInt(i)].SetOldValue != null && aInputs[parseInt(i)].SetOldValue != undefined) { 1123 aInputs[parseInt(i)].SetOldValue(''); 1124 } 1125 } 1126 1127 if (aInputs[parseInt(i)].type == "radio" || aInputs[parseInt(i)].type == "checkbox") aInputs[parseInt(i)].checked = ""; 1128 } 1129 } 1130} 1131 1132LyoFieldRubber.prototype.CleanForm = function(formid, ignorefieldids) { 1133 1134 var form = document.getElementById(formid); 1135 if (form == null) return; 1136 1137 var igfields = null; 1138 if (ignorefieldids != null) { 1139 igfields = ignorefieldids.split(","); 1140 } 1141 1142 var ignore = false; 1143 for (var i = 0; i < form.elements.length; i++) { 1144 1145 ignore = false; 1146 if (igfields != null) { 1147 for (var idx = 0; idx < igfields.length; idx++) { 1148 if (form.elements[i].id == Trim(igfields[idx])) { 1149 ignore = true; 1150 break; 1151 } 1152 } 1153 if (ignore == true) continue; 1154 } 1155 if (form.elements[i].type != "submit" && form.elements[i].type != "button" && 1156 form.elements[i].type != "radio" && form.elements[i].type != "checkbox") { 1157 1158 form.elements[i].value = ""; 1159 1160 // Brauchen wir für die onChangeBlur Felder die eventuell auch geleert werden. 1161 if (form.elements[i] != null && form.elements[i] != undefined && form.elements[i].SetOldValue != null && form.elements[i].SetOldValue != undefined) { 1162 form.elements[i].SetOldValue(''); 1163 } 1164 } 1165 1166 if (form.elements[i].type == "radio" || form.elements[i].type == "checkbox") form.elements[i].checked = ""; 1167 } 1168} 1169 1170var FieldRubber = new LyoFieldRubber(); 1171 1172 1173 1174////////////////////////////////////////////////////////////////////////////////////////////////////////// 1175// KLASSE onchangeblur 1176// funktion wird aufgerufen wenn sich der Wert im Eingabefeld verändert hat, 1177// und onblur aufgerufen wird. 1178////////////////////////////////////////////////////////////////////////////////////////////////////////// 1179 1180(function($) { 1181 1182 $.fn.onchangeblur = function(fct, ignoreemptynow) { 1183 1184 1185 var self = this; 1186 1187 // Startet das Handling 1188 this.doHandling = function(self, obj) { 1189 1190 if (fct == null || fct == undefined) { 1191 $(obj).blur(); 1192 return; 1193 } 1194 1195 obj._old_onchangeblur_onblur = obj.onblur; 1196 1197 $(obj).blur( 1198 1199 function() { 1200 1201 // Alte onblur wieder aufrufen 1202 if (obj._old_onchangeblur_onblur != null) obj._old_onchangeblur_onblur(); 1203 1204 var ignorecheck = false; 1205 if (ignoreemptynow == true && IsNullOrEmpty(obj.value)) { 1206 ignorecheck = true; 1207 } 1208 1209 if (ignorecheck == false) { 1210 1211 if (obj._onchangeblur_old_value == null || obj._onchangeblur_old_value == undefined) obj._onchangeblur_old_value = ""; 1212 1213 if (obj.value != obj._onchangeblur_old_value) { 1214 if (fct != null) fct(); 1215 } 1216 } 1217 1218 obj._onchangeblur_old_value = obj.value; 1219 } 1220 ); 1221 1222 obj.SetOldValue = function(valuein) { 1223 1224 obj._onchangeblur_old_value = valuein; 1225 } 1226 } 1227 1228 /* die einzelnen funktionen auf die entsprechenden edit fields 1229 ** legen. (anhand einer klasse, einer id usw.) 1230 */ 1231 this.each(function(i, obj) { 1232 self.doHandling(self, obj); 1233 }); 1234 } 1235 1236})(jQuery); 1237 1238 1239////////////////////////////////////////////////////////////////////////////////////////////////////////// 1240// LyoPleaseWaitBox 1241// Bitte warten Box neben Mauszeiger 1242///////////////////////////////////////////////////////////////////////////////////////////////////////// 1243 1244 1245PleaseWaitBox = function() { 1246PleaseWaitBox.PleaseWaitDivName = '__pleaseWaitBox__'; 1247 PleaseWaitBox.PleaseWaitShown = '__isShown__'; 1248} 1249PleaseWaitBox.prototype._FollowCursor = function(e) { 1250 1251 var pwBox = document.getElementById(PleaseWaitBox.PleaseWaitDivName); 1252 1253 if ($("div#" + PleaseWaitBox.PleaseWaitDivName).data(PleaseWaitBox.PleaseWaitShown) == 1) { 1254 1255 pwBox.style.top = e.pageY + 'px'; 1256 pwBox.style.left = e.pageX + 5 + 'px' 1257 1258 if (pwBox.style.display != 'block') { 1259 1260 pwBox.style.display = 'block'; 1261 } 1262 } else { 1263 if (pwBox.style.display != 'none') pwBox.style.display = 'none'; 1264 } 1265
1266 //$("#tt").text($("div#" + PleaseWaitBox.PleaseWaitDivName).data(PleaseWaitBox.PleaseWaitShown)); 1267} 1268PleaseWaitBox.prototype._ShowCursor = function() { 1269 $("div#" + PleaseWaitBox.PleaseWaitDivName).data(PleaseWaitBox.PleaseWaitShown, 1); 1270 var pwBox = document.getElementById(PleaseWaitBox.PleaseWaitDivName); 1271 pwBox.style.display = 'block'; 1272 1273} 1274PleaseWaitBox.prototype._HideCursor = function() { 1275 $("div#" + PleaseWaitBox.PleaseWaitDivName).data(PleaseWaitBox.PleaseWaitShown, 0); 1276 var pwBox = document.getElementById(PleaseWaitBox.PleaseWaitDivName); 1277 pwBox.style.display = 'none'; 1278 1279} 1280 1281PleaseWaitBox.prototype.Init = function() { 1282 // Please Wait DIV 1283 var pleaseWaitDiv = document.createElement('div'); 1284 pleaseWaitDiv.style.display = "none"; 1285 pleaseWaitDiv.className = "pleasewaiticon"; 1286 pleaseWaitDiv.style.position = 'absolute'; 1287 pleaseWaitDiv.id = PleaseWaitBox.PleaseWaitDivName; 1288 //pleaseWaitDiv.style.border = "1px solid red"; 1289 pleaseWaitDiv.style.zIndex = 9999; 1290 1291 document.body.appendChild(pleaseWaitDiv); 1292 // Please Wait DIV Text 1293 var pleaseWaitDivText = document.createElement('div'); 1294 pleaseWaitDivText.style.marginLeft = "20px"; 1295 pleaseWaitDivText.innerHTML = Translate("PleaseWait", "JSArea.GlobalArea"); 1296 pleaseWaitDiv.appendChild(pleaseWaitDivText); 1297 1298 $(document).bind("mousemove", this._FollowCursor); 1299 1300 $(document).bind("mouseleave", function() { 1301 if ($("div#" + PleaseWaitBox.PleaseWaitDivName).data(PleaseWaitBox.PleaseWaitShown) == 1) 1302 document.getElementById(PleaseWaitBox.PleaseWaitDivName).style.display = 'none'; 1303 }); 1304 $(document).bind("mouseenter", function() { 1305 if ($("div#" + PleaseWaitBox.PleaseWaitDivName).data(PleaseWaitBox.PleaseWaitShown) == 1) 1306 document.getElementById(PleaseWaitBox.PleaseWaitDivName).style.display = 'block'; 1307 }); 1308} 1309 1310 1311var __PleaseWaitBox = new PleaseWaitBox(); 1312 1313$(document).ready(function() { 1314 __PleaseWaitBox.Init(); 1315}); 1316 1317 1318 1319$.showPleaseWaitBox = function() { 1320 __PleaseWaitBox._ShowCursor(); 1321} 1322$.hidePleaseWaitBox = function() { 1323 __PleaseWaitBox._HideCursor(); 1324} 1325 1326 1327 1328////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1329// Ruft eine einfache Serverseitige Funktion via Ajax auf und schreibt den returnierten Wert in das 1330// angegebene Feld 1331////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1332 1333function lyonessAjaxCallValueFiller(fieldid, ajaxurl) { 1334 1335 $.ajax({ 1336 url: ajaxurl, 1337 cache: false, 1338 type: 'GET', 1339 async: true, 1340 dataType: 'text', 1341 success: function(response) { 1342 $('#' + fieldid).attr('value', response); 1343 }, 1344 error: function(xhr, ajaxOptions, thrownError) { 1345 LyoErrorHandler.SendAjaxError(xhr, ajaxOptions, thrownError); 1346 } 1347 }); 1348} 1349 1350////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1351// Merkt sich Formular eingabe Felder 1352// Es kann somit geprüft werden ob sich beim Verlassen Felder geändert haben ohne zu speichern. 1353// 1354// Beispiel: 1355// FormFieldReminder.TakeShnapshot('meineformularid'); 1356////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1357 1358_FormFieldReminder = function() { 1359 1360 this.self = this; 1361 this.myForm = null; 1362 1363 this.alSavedElements = new Array(); 1364 this.bCheckForm = true; 1365 1366 // Speichert die Formularelemente in das Array 1367 this.saveFormElements = function(self, form) { 1368 1369 for (var i = 0; i < form.elements.length; i++) { 1370 if ("select-one" == form.elements[i].type) { 1371 self.alSavedElements.push(form.elements[i].selectedIndex); 1372 continue; 1373 } 1374 if ("radio" == form.elements[i].type || "checkbox" == form.elements[i].type) { 1375 self.alSavedElements.push(form.elements[i].checked); 1376 continue; 1377 } 1378 self.alSavedElements.push(form.elements[i].value); 1379 } 1380 } 1381 1382 1383 this.isFormChanged = function(self, form) { 1384 1385 //alert(form.elements.length + "##" + self.alSavedElements.length); 1386 1387 var bChanged = false; 1388 if (form.elements.length != self.alSavedElements.length) { 1389 bChanged = true; 1390 return bChanged; 1391 } 1392 1393 1394 for (var i = 0; i < form.elements.length; i++) { 1395 if ("submit" != form.elements[i].type && "button" != form.elements[i].type && "reset" != form.elements[i].type && "hidden" != form.elements[i].type && "radio" != form.elements[i].type && "checkbox" != form.elements[i].type && "select-one" != form.elements[i].type && form.elements[i].value != self.alSavedElements[i]) { 1396 //alert("#1" + form.elements[i].type + " --> " + form.elements[i].id + " --> old: " + self.alSavedElements[i] + " --> new: " + self.alSavedElements[i].value); 1397 bChanged = true; 1398 break; 1399 } 1400 if ("select-one" == form.elements[i].type && form.elements[i].selectedIndex != self.alSavedElements[i]) { 1401 //alert("#2" + form.elements[i].type); 1402 bChanged = true; 1403 break; 1404 } 1405 if (("radio" == form.elements[i].type || "checkbox" == form.elements[i].type) && form.elements[i].checked != self.alSavedElements[i]) { 1406 //alert("#3" + form.elements[i].type); 1407 bChanged = true; 1408 break; 1409 } 1410 } 1411 1412 return bChanged; 1413 } 1414 1415 1416 this.checkFormOnUnload = function(self, form) { 1417 1418 var bFormStatus = self.isFormChanged(self, form); 1419 1420 if (self.bCheckForm && bFormStatus) { 1421 return true; 1422 } 1423 return false;
1424 } 1425} 1426 1427_FormFieldReminder.prototype.TakeShnapshot = function(formId) { 1428 this.myForm = document.getElementById(formId); 1429 this.saveFormElements(this, this.myForm); 1430} 1431 1432_FormFieldReminder.prototype.CheckChanges = function() { 1433 if (this.myForm == null) { alert('NO FORMULAR DEFINED!') }; 1434 return this.checkFormOnUnload(this, this.myForm); 1435} 1436 1437var FormFieldReminder = new _FormFieldReminder(); 1438 1439 1440 1441 1442////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1443// Merkt sich Formular eingabe Felder 1444// Es kann somit geprüft werden ob sich beim Verlassen Felder geändert haben ohne zu speichern. 1445// 1446// Beispiel: 1447// FormFieldReminder.TakeShnapshot('meineformularid'); 1448////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1449_FieldChecker = function(defaults) { 1450 1451 this.self = this; 1452 this.defaults = defaults; 1453 1454 this.parseIgnoreFields = function(ignorefieldids) { 1455 1456 var igfields = null; 1457 if (ignorefieldids != null) { 1458 igfields = ignorefieldids.split(","); 1459 } 1460 1461 return igfields; 1462 } 1463} 1464 1465_FieldChecker.prototype.CheckAllEmpty = function(containerelementid, ignorefieldids) { 1466 1467 1468 var aInputs = $('#' + containerelementid).find('input[type!=hidden]'); 1469 var igfarray = this.parseIgnoreFields(ignorefieldids); 1470 1471 var ignorefield; 1472 1473 for (var i in aInputs) { 1474 1475 ignorefield = false; 1476 1477 if (typeof (aInputs[parseInt(i)]) != 'undefined') { 1478 if (igfarray != null) { 1479 for (var igfldidx = 0; igfldidx < igfarray.length; igfldidx++) { 1480 if (Trim(igfarray[igfldidx], " ") == aInputs[parseInt(i)].id) { 1481 ignorefield = true; 1482 break; 1483 } 1484 } 1485 } 1486 1487 if (ignorefield == true) continue; 1488 1489 var val = aInputs[parseInt(i)].value 1490 if (val != null && val != undefined && val != "") { 1491 return false; 1492 } 1493 } 1494 } 1495 1496 return true; 1497} 1498 1499var FieldChecker = new _FieldChecker(null); 1500 1501////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1502// Session & Cookiemanagement 1503////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 1504var Session = { 1505 SessionID: null, 1506 Cookies: { 1507 IsHistoryCookieName: "ishistory", 1508 1509 Set: function(name, value) { 1510 $.cookie(Session.SessionID + '_' + name, value); 1511 }, 1512 1513 SetHistoryCookie: function(state) { 1514 this.Set(this.IsHistoryCookieName, state); 1515 }, 1516 1517 IsHistory: function() { 1518 if (this.Get(this.IsHistoryCookieName) == "true") { 1519 return true; 1520 } 1521 else { 1522 return false; 1523 } 1524 }, 1525 1526 Get: function(name) { 1527 return $.cookie(Session.SessionID + '_' + name); 1528 }, 1529 1530 Delete: function(name) { 1531 $.cookie(Session.SessionID + '_' + name, null); 1532 } 1533 } 1534}; 1535 1536 1537CharCounter = function(editFieldId, maxValue, fctReFreshCharCountDisplay) { 1538 1539 var freeChars = maxValue - $('#' + editFieldId).val().length; 1540 if (fctReFreshCharCountDisplay != null) 1541 fctReFreshCharCountDisplay(freeChars); 1542 1543 1544 this.putMessage = function(currentCount) { 1545 freeChars = maxValue - currentCount; 1546 fctReFreshCharCountDisplay(freeChars); 1547 } 1548 1549 1550 $('#' + editFieldId).keydown( 1551 function(event) { 1552 1553 freeChars = maxValue - $('#' + editFieldId).val().length; 1554 1555 if (fctReFreshCharCountDisplay != null) 1556 fctReFreshCharCountDisplay(freeChars); 1557 1558 if (freeChars <= 0) { 1559 if (!checkDel(event)) 1560 return false; 1561 } 1562 } 1563 ); 1564} 1565 1566function OpenStatisticsWindow(instaturl, winname, inwidth, inheight) { 1567 1568 if (inwidth == null) { 1569 inwidth = "700px"; 1570 } 1571 1572 if (inheight == null) { 1573 inheight = "600px"; 1574 } 1575 1576 if (winname == null) { 1577 winname = "window"; 1578 } 1579 1580 return window.open(instaturl, winname, "menubar=0,scrollbars=yes,resizable=1,width=" + inwidth + ",height=" + inheight + ""); 1581} 1582 1583// Baut ein JSON Objekt in einen für einen für einen QueryString tauglichen String um 1584function BuildFilterParameterList(prefix, filterobject) { 1585 1586 if (filterobject == null) return ""; 1587 if (!IsNullOrEmpty(prefix)) prefix = prefix + "."; 1588 else prefix = ""; 1589 1590 var paramlist = ""; 1591 1592 $.each(filterobject, function (i, n) { 1593 1594 if (typeof (n) != 'object') { 1595 paramlist = paramlist + "&" + prefix + i + "=" + n; 1596 } else { 1597 paramlist = paramlist + "&" + prefix + i + "=" + n.val(); 1598 } 1599 }); 1600 1601 return paramlist; 1602} 1603
1604////////////////////////////////////////////////////////////////////////////////////////////////////////// 1605// KLASSE cascade 1606// Ermöglicht es DropDowns miteinander zu synchronisieren (wobei die Quelle der Daten nicht zwingend ein 1607// DropDown sein muss) 1608////////////////////////////////////////////////////////////////////////////////////////////////////////// 1609 1610(function ($) { 1611 1612 $.fn.cascade = function (settings) { 1613 1614 if (!IsNullOrUndefined(settings)) { 1615 1616 // Generelle Checks 1617 if (IsNullOrUndefined(settings.Url)) 1618 LyoErrorHandler.SendError("Der Parameter Url muss angegeben werden!"); 1619 1620 this._defaults = { 1621 SrcElements: null, 1622 Url: null, 1623 UrlParams: null, 1624 DefaultOption: new Option("", ""), 1625 CheckFunction: null, 1626 AfterFunction: null 1627 }; 1628 } 1629 1630 1631 this._obj_defaults_name = "_cascade_defaults"; 1632 var self = this; 1633 1634 1635 // Am Objekt selbst die ganzen Einstellungen merken 1636 this.applayDefaultsToField = function (obj, defaults) { 1637 obj[self._obj_defaults_name] = defaults; 1638 } 1639 1640 // Definiert die Events zu bestimmten Elementen wann die eigentliche cascade Funktion aufgerufen werden soll 1641 this.applaySrcElementsHandlers = function (obj) { 1642 1643 if (!IsNullOrUndefined(obj[self._obj_defaults_name].SrcElements)) { 1644 1645 var srcElements = obj[self._obj_defaults_name].SrcElements.Objects; 1646 1647 $.each(srcElements, function (i, n) { 1648 1649 if (!IsNullOrUndefined(n.Object) && !IsNullOrUndefined(n.Events)) { 1650 n.Object.bind(n.Events, function () { 1651 1652 self.workingAction(self, obj); 1653 }); 1654 } 1655 }); 1656 } 1657 } 1658 1659 this.workingAction = function (selfin, obj) { 1660 // Wenn keine CheckFunction vorhanden, oder diese true zurückliefert das cascade ausführen 1661 if (IsNullOrUndefined(obj[selfin._obj_defaults_name].CheckFunction) || obj[selfin._obj_defaults_name].CheckFunction()) { 1662 1663 var callingURL = obj[selfin._obj_defaults_name].Url + "?caller=" + obj.id + BuildFilterParameterList("", obj[selfin._obj_defaults_name].UrlParams); 1664 1665 $.showPleaseWaitBox(); 1666 1667 $.getJSON(callingURL, null, function (data) { 1668 1669 var selectedValue = $(obj).val(); 1670 var ddl = $(obj)[0]; 1671 1672 if (!IsNullOrUndefined(ddl) && !IsNullOrUndefined(ddl.options)) { 1673 1674 ddl.options.length = 0; 1675 1676 if (!IsNullOrUndefined(obj[selfin._obj_defaults_name].DefaultOption)) { 1677 var defOptions = new Option(obj[selfin._obj_defaults_name].DefaultOption.text, obj[selfin._obj_defaults_name].DefaultOption.value); 1678 ddl.options.add(defOptions); 1679 } 1680 1681 $.each(data, function (index, optionData) { 1682 var newOption = new Option(optionData.Text, optionData.Value); 1683 ddl.options.add(newOption); 1684 }); 1685 1686 $(obj).val(selectedValue); 1687 1688 // Wenn eine AfterFunction vorhanden ist, diese ausführen 1689 if (!IsNullOrUndefined(obj[selfin._obj_defaults_name].AfterFunction)) { 1690 obj[selfin._obj_defaults_name].AfterFunction(obj); 1691 } 1692 } 1693 1694 $.hidePleaseWaitBox(); 1695 }); 1696 } 1697 } 1698 1699 // Jedes Element des Selektors durchlaufen 1700 this.each(function (i, obj) { 1701 1702 1703 if (!IsNullOrUndefined([self._obj_defaults_name]) && IsNullOrUndefined(settings)) { 1704 1705 self.workingAction(self, obj); 1706 } else { 1707 1708 // Die Erweiterung cascade soll vorerst nur für DropDowns erlaubt sein. 1709 if ($(obj).is("select")) { 1710 1711 $.extend(self._defaults, settings); 1712 1713 self.applayDefaultsToField(obj, self._defaults); 1714 1715 self.applaySrcElementsHandlers(obj); 1716 1717 } else { 1718 1719 LyoErrorHandler.SendError("Die Erweiterung cascade ist nur für DropDowns erlaubt!"); 1720 } 1721 } 1722 }); 1723 } 1724 1725})(jQuery); 1726/*///////////////////////////////////////////////////////////////////////////////////////////////////////// 1727// KLASSE LyonessPupup 1728// EINFACH ERWEITERBARES UND ANPASSBARES POPUP 1729////////////////////////////////////////////////////////////////////////////////////////////////////////// 1730/// <reference path="jquery-1.3.2.min-vsdoc.js" />*/ 1731var SubmitTypes = new Array(); 1732(function($) { 1733 1734 var setDataSwitch = { 1735 dragStart: "start.draggable", 1736 drag: "drag.draggable", 1737 dragStop: "stop.draggable", 1738 maxHeight: "maxHeight.resizable", minHeight: "minHeight.resizable", 1739 maxWidth: "maxWidth.resizable", 1740 minWidth: "minWidth.resizable", 1741 resizeStart: "start.resizable", 1742 resize: "drag.resizable", 1743 resizeStop: "stop.resizable" 1744 }, 1745 1746 uiDialogClasses = 1747 'ui-dialog ' + 1748 'ui-widget ' + 1749 'ui-widget-content ' + 1750 'ui-corner-all '; 1751 1752 1753 $.widget("ui.dialog", { 1754 1755 _init: function() { 1756 1757 this.originalTitle = this.element.attr('title'); 1758 1759 var self = this, 1760 options = this.options, 1761 1762 title = options.title || this.originalTitle || ' ', 1763 titleId = $.ui.dialog.getTitleId(this.element), 1764 1765 1766 1767 uiDialog = (this.uiDialog = $('<div/>')) 1768 .appendTo(document.body) 1769 .hide() 1770 .addClass(uiDialogClasses + options.dialogClass) 1771 .css({ 1772 position: 'absolute', 1773 overflow: 'hidden', 1774 zIndex: options.zIndex 1775 }) 1776 /* setting tabIndex makes the div focusable 1777 setting outline to 0 prevents a border on focus in Mozilla*/ 1778 .attr('tabIndex', -1).css('outline', 0).keydown(function(event) { 1779 (options.closeOnEscape && event.keyCode 1780 && event.keyCode == $.ui.keyCode.ESCAPE && self.close(event)); 1781 }) 1782 .attr({ 1783 role: 'dialog', 1784 'aria-labelledby': titleId 1785 }) 1786 .mousedown(function(event) { 1787 self.moveToTop(false, event); 1788 }), 1789 1790 uiDialogContent = this.element 1791 .show() 1792 .removeAttr('title') 1793 .addClass( 1794 'ui-dialog-content ' + 1795 'ui-widget-content') 1796 .appendTo(uiDialog), 1797 1798 // �berschriftenzeile div 1799 uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>')) 1800 .addClass( 1801 'ui-dialog-titlebar ' + 1802 'ui-widget-header ' + 1803 'ui-corner-all ' + 1804 'ui-helper-clearfix' 1805 ) 1806 .prependTo(uiDialog), 1807 // �berschriftenzeile table 1808 uiDialogTitlebarTable = (this.uiDialogTitlebarTable = $('<table></table>')) 1809 .attr({ 1810 style: 'width:100%' 1811 }) 1812 .prependTo(uiDialogTitlebar), 1813 1814 // �berschriftenzeile tr 1815 uiDialogTitlebarRow = (this.uiDialogTitlebarTable = $('<tr></tr>')) 1816 .prependTo(uiDialogTitlebarTable), 1817 1818 // �berschriftenzeile td rechts 1819 uiDialogTitlebarTdRight = (this.uiDialogTitlebarTable = $('<td></td>')) 1820 .addClass( 1821 'rightTd ' + 1822 'ui-corner-all' 1823 ) 1824 .prependTo(uiDialogTitlebarRow), 1825 1826 // �berschriftenzeile schlie�en
1827 uiDialogTitleClosediv = $('<div style=\"float:right;padding-right:10px;\">'), 1828 1829 uiDialogTitleCloseLink = $('<a id="popupclosetag"/>') 1830 .css({ color: '#fff' }) 1831 .click(function(event) { 1832 self.close(event); 1833 return false; 1834 }) 1835 .attr('href', '#') 1836 .html(Translate("Close", "JSArea.GlobalArea") + " X") 1837 .appendTo(uiDialogTitleClosediv); 1838 uiDialogTitlebarTdRight.append(uiDialogTitleClosediv); 1839 1840 // Wird ein Titel angezeigt 1841 if (options.showTitle) { 1842 uiDialogTitle = $('<span/>') 1843 .addClass('ui-dialog-title') 1844 .attr('id', titleId) 1845 .html(title) 1846 .prependTo(uiDialogTitlebarTdRight); 1847 } 1848 1849 // Lyoness Logo in Header anzeigen 1850 if (options.showLyonessLogo) { 1851 uiDialogTitle = $('<td><img src="internal/public/images/lyo_logo_maps.jpg" align="left" style="max-height:20px; padding-right:10px;" /></td>') 1852 .prependTo(uiDialogTitlebarRow); 1853 } 1854 1855 uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); 1856 1857 (options.draggable && $.fn.draggable && this._makeDraggable()); 1858 (options.resizable && $.fn.resizable && this._makeResizable()); 1859 1860 1861 this._createButtons(options.buttons, options.advancedFields); 1862 this._isOpen = false; 1863 1864 (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); 1865 (options.autoOpen && this.open()); 1866 1867 if (this.element.context.tagName == "IFRAME") { 1868 this.element 1869 .removeClass('ui-dialog-content ui-widget-content') 1870 } 1871 1872 }, 1873 1874 destroy: function() { 1875 1876 var options = this.options; 1877 1878 if (options.noOverlayDeleteOnClose != true) (this.overlay && this.overlay.destroy()); 1879 1880 this.uiDialog.hide(); 1881 this.element 1882 .unbind('.dialog') 1883 .removeData('dialog') 1884 .removeClass('ui-dialog-content ui-widget-content') 1885 .hide().appendTo('body'); 1886 this.uiDialog.remove(); 1887 1888 (this.originalTitle && this.element.attr('title', this.originalTitle)); 1889 }, 1890 1891 close: function(event) { 1892 1893 var options = this.options; 1894 1895 var self = this; 1896 1897 if (false === self._trigger('beforeclose', event)) { 1898 return; 1899 } 1900 1901 if (options.noOverlayDeleteOnClose != true) (self.overlay && self.overlay.destroy()); 1902 1903 self.uiDialog.unbind('keypress.ui-dialog'); 1904 1905 (self.options.hide 1906 ? self.uiDialog.hide(self.options.hide, function() { 1907 self._trigger('close', event); 1908 }) 1909 : self.uiDialog.hide() && self._trigger('close', event)); 1910 1911 if (options.noOverlayDeleteOnClose != true) $.ui.dialog.overlay.resize(); 1912 1913 self._isOpen = false; 1914 if(this.element != null && this.element.context != null) 1915 this.element.context.src = ""; 1916 }, 1917 1918 isOpen: function() { 1919 return this._isOpen; 1920 }, 1921 1922 /* the force parameter allows us to move modal dialogs to their correct 1923 position on open*/ 1924 moveToTop: function(force, event) { 1925 1926 if (this.options.DoNotmoveToTop) 1927 return; 1928 if ((this.options.modal && !force) 1929 || (!this.options.stack && !this.options.modal)) { 1930 return this._trigger('focus', event); 1931 } 1932 1933 if (this.options.zIndex > $.ui.dialog.maxZ) { 1934 $.ui.dialog.maxZ = this.options.zIndex; 1935 } 1936 (this.overlay && this.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = ++$.ui.dialog.maxZ)); 1937 1938 /*Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed. 1939 // http://ui.jquery.com/bugs/ticket/3193*/ 1940 var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') }; 1941 this.uiDialog.css('z-index', ++$.ui.dialog.maxZ); 1942 this.element.attr(saveScroll); 1943 this._trigger('focus', event); 1944 1945 }, 1946 1947 openhiddendialog: function() { 1948 1949 var options = this.options, uiDialog = this.uiDialog; 1950 uiDialog.show(options.show); 1951 this.moveToTop(true); 1952 }, 1953 1954 open: function() { 1955 1956 if (this._isOpen) { return; } 1957 1958 var options = this.options, 1959 uiDialog = this.uiDialog; 1960 1961 1962 this.overlay = options.modal ? new $.ui.dialog.overlay(this) : null; 1963 1964 (uiDialog 1965 .next() 1966 .length && uiDialog.appendTo('body') 1967 ); 1968 1969 1970 this._size(); 1971 this._position(options.position); 1972 1973 if (!options.hidedealogaftergeneration) { 1974 uiDialog.show(options.show); 1975 } 1976 1977 this.moveToTop(true); 1978 1979 /* prevent tabbing out of modal dialogs*/ 1980 (options.modal && uiDialog.bind('keypress.ui-dialog', function(event) { 1981 if (event.keyCode != $.ui.keyCode.TAB) { 1982 return; 1983 } 1984 1985 var tabbables = $(':tabbable', this), 1986 first = tabbables.filter(':first')[0], 1987 last = tabbables.filter(':last')[0]; 1988 1989 if (event.target == last && !event.shiftKey) { 1990 setTimeout(function() { 1991 first.focus(); 1992 }, 1); 1993 } else if (event.target == first && event.shiftKey) { 1994 setTimeout(function() { 1995 last.focus(); 1996 }, 1); 1997 } 1998 })); 1999 2000 /* set focus to the first tabbable element in the content area or the first button 2001 // if there are no tabbable elements, set focus on the dialog itself*/ 2002 $([]) 2003 .add(uiDialog.find('.ui-dialog-content :tabbable:first')) 2004 .add(uiDialog.find('.ui-dialog-buttonpane :tabbable:first')) 2005 .add(uiDialog) 2006 .filter(':first') 2007 .focus(); 2008 2009 /*Modification by Erich */ 2010 if (options.selectedButton != null) { 2011 var buttons = $([]).add(uiDialog.find('.ui-dialog-buttonpane :tabbable')).add(uiDialog); 2012 if (buttons.length > options.selectedButton) 2013 buttons[options.selectedButton].focus(); 2014 } 2015 /*End Modification by Erich */ 2016 2017 this._trigger('open'); 2018 this._isOpen = true; 2019 }, 2020 2021 _createButtons: function(buttons, advancedFields) { 2022 var self = this, 2023 hasButtons = false, 2024 hasAdvancedFields = false,
2025 uiDialogButtonPane = $('<div></div>') 2026 .addClass( 2027 'ui-dialog-buttonpane ' + 2028 'ui-widget-content ' + 2029 'ui-helper-clearfix' 2030 ); 2031 2032 uiDialogButtonPaneTable = $('<table></table>') 2033 .addClass( 2034 'ui-dialog-buttonpane' 2035 ); 2036 var uiDialogButtonPaneTr = $('<tr></tr>'); 2037 2038 var uiDialogButtonPaneTd = $('<td></td>'); 2039 2040 /* if we already have a button pane, remove it*/ 2041 this.uiDialog.find('.ui-dialog-buttonpane').remove(); 2042 2043 2044 (typeof buttons == 'object' && buttons !== null && 2045 $.each(buttons, function() { return !(hasButtons = true); })); 2046 2047 (typeof advancedFields == 'object' && advancedFields !== null && 2048 $.each(advancedFields, function() { return !(hasAdvancedFields = true); })); 2049 2050 2051 if (hasAdvancedFields) { 2052 $.each(advancedFields, function(name, field) { 2053 //uiDialogButtonPaneTd = $('<td style=\" padding-right:6px\"></td>'); 2054 2055 /*.appendTo(uiDialogButtonPane);*/ 2056 field.appendTo(uiDialogButtonPaneTd); 2057 2058 2059 }); 2060 uiDialogButtonPaneTd.appendTo(uiDialogButtonPaneTr); 2061 2062 } 2063 2064 if (hasButtons) { 2065 2066 uiDialogButtonPaneTd = $('<td></td>'); 2067 2068 $.each(buttons, function(name, fn) { 2069 2070 $('<button type="button"></button>') 2071 .addClass( 2072 'defaultbutton ' + 2073 'noprint' 2074 ) 2075 .text(name) 2076 .click(function() { fn.apply(self.element[0], arguments); }) 2077 /*.hover( 2078 function() { 2079 $(this).addClass('ui-state-hover'); 2080 }, 2081 function() { 2082 $(this).removeClass('ui-state-hover'); 2083 } 2084 )*/ 2085 .focus(function() { 2086 $(this).addClass('ui-state-focus'); 2087 }) 2088 .blur(function() { 2089 $(this).removeClass('ui-state-focus'); 2090 }) 2091 /*.appendTo(uiDialogButtonPane);*/ 2092 .appendTo(uiDialogButtonPaneTd); 2093 2094 }); 2095 2096 uiDialogButtonPaneTd.appendTo(uiDialogButtonPaneTr); 2097 } 2098 2099 if (hasAdvancedFields || hasButtons) { 2100 uiDialogButtonPaneTr.appendTo(uiDialogButtonPaneTable); 2101 uiDialogButtonPaneTable.appendTo(uiDialogButtonPane); 2102 uiDialogButtonPane.appendTo(this.uiDialog); 2103 } 2104 }, 2105 2106 _makeDraggable: function() { 2107 var self = this, 2108 options = this.options, 2109 heightBeforeDrag; 2110 2111 this.uiDialog.draggable({ 2112 cancel: '.ui-dialog-content', 2113 handle: '.ui-dialog-titlebar', 2114 containment: 'document', 2115 start: function() { 2116 heightBeforeDrag = options.height; 2117 $(this).height($(this).height()).addClass("ui-dialog-dragging"); 2118 (options.dragStart && options.dragStart.apply(self.element[0], arguments)); 2119 }, 2120 drag: function() { 2121 (options.drag && options.drag.apply(self.element[0], arguments)); 2122 }, 2123 stop: function() { 2124 $(this).removeClass("ui-dialog-dragging").height(heightBeforeDrag); 2125 (options.dragStop && options.dragStop.apply(self.element[0], arguments)); 2126 $.ui.dialog.overlay.resize(); 2127 } 2128 }); 2129 }, 2130 2131 _makeResizable: function(handles) { 2132 handles = (handles === undefined ? this.options.resizable : handles); 2133 var self = this, 2134 options = this.options, 2135 resizeHandles = typeof handles == 'string' 2136 ? handles 2137 : 'n,e,s,w,se,sw,ne,nw'; 2138 2139 this.uiDialog.resizable({ 2140 cancel: '.ui-dialog-content', 2141 alsoResize: this.element, 2142 maxWidth: options.maxWidth, 2143 maxHeight: options.maxHeight, 2144 minWidth: options.minWidth, 2145 minHeight: options.minHeight, 2146 start: function() { 2147 $(this).addClass("ui-dialog-resizing"); 2148 (options.resizeStart && options.resizeStart.apply(self.element[0], arguments)); 2149 }, 2150 resize: function() { 2151 (options.resize && options.resize.apply(self.element[0], arguments)); 2152 }, 2153 handles: resizeHandles, 2154 stop: function() { 2155 $(this).removeClass("ui-dialog-resizing"); 2156 options.height = $(this).height(); 2157 options.width = $(this).width(); 2158 (options.resizeStop && options.resizeStop.apply(self.element[0], arguments)); 2159 $.ui.dialog.overlay.resize(); 2160 } 2161 }) 2162 .find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); 2163 }, 2164 2165 _position: function(pos) { 2166 var wnd = $(window), doc = $(document), 2167 pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), 2168 minTop = pTop; 2169 2170 if ($.inArray(pos, ['center', 'top', 'right', 'bottom', 'left']) >= 0) { 2171 pos = [ 2172 pos == 'right' || pos == 'left' ? pos : 'center', 2173 pos == 'top' || pos == 'bottom' ? pos : 'middle' 2174 ]; 2175 } 2176 if (pos.constructor != Array) { 2177 pos = ['center', 'middle']; 2178 } 2179 if (pos[0].constructor == Number) { 2180 pLeft += pos[0]; 2181 } else { 2182 switch (pos[0]) { 2183 case 'left': 2184 pLeft += 0; 2185 break; 2186 case 'right': 2187 pLeft += wnd.width() - this.uiDialog.outerWidth(); 2188 break; 2189 default: 2190 case 'center': 2191 pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2; 2192 } 2193 } 2194 if (pos[1].constructor == Number) { 2195 pTop += pos[1]; 2196 } else { 2197 switch (pos[1]) { 2198 case 'top': 2199 pTop += 0; 2200 break; 2201 case 'bottom': 2202 pTop += wnd.height() - this.uiDialog.outerHeight(); 2203 break; 2204 default: 2205 case 'middle': 2206 pTop += (wnd.height() - this.uiDialog.outerHeight()) / 2; 2207 } 2208 } 2209 2210 /* prevent the dialog from being too high (make sure the titlebar 2211 // is accessible)*/ 2212 pTop = Math.max(pTop, minTop); 2213 this.uiDialog.css({ top: pTop, left: pLeft }); 2214 }, 2215 2216 _setData: function(key, value) { 2217 (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); 2218 switch (key) { 2219 case "buttons": 2220 this._createButtons(value); 2221 break; 2222 case "closeText": 2223 this.uiDialogTitlebarCloseText.text(value); 2224 break; 2225 case "dialogClass": 2226 this.uiDialog 2227 .removeClass(this.options.dialogClass) 2228 .addClass(uiDialogClasses + value); 2229 break; 2230 case "draggable": 2231 (value 2232 ? this._makeDraggable() 2233 : this.uiDialog.draggable('destroy')); 2234 break; 2235 case "height": 2236 this.uiDialog.height(value); 2237 break; 2238 case "position": 2239 this._position(value); 2240 break; 2241 case "resizable": 2242 var uiDialog = this.uiDialog, 2243 isResizable = this.uiDialog.is(':data(resizable)'); 2244 2245 /* currently resizable, becoming non-resizable*/ 2246 (isResizable && !value && uiDialog.resizable('destroy')); 2247 2248 /* currently resizable, changing handles*/ 2249 (isResizable && typeof value == 'string' && 2250 uiDialog.resizable('option', 'handles', value)); 2251 2252 /* currently non-resizable, becoming resizable*/ 2253 (isResizable || this._makeResizable(value)); 2254 break; 2255 case "title": 2256 $(".ui-dialog-title", this.uiDialogTitlebar).html(value || ' '); 2257 break; 2258 case "width": 2259 this.uiDialog.width(value); 2260 break; 2261 } 2262 2263 $.widget.prototype._setData.apply(this, arguments); 2264 }, 2265 2266 _size: function() { 2267 2268 /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 2269 * divs will both have width and height set, so we need to reset them 2270 */ 2271 var options = this.options; 2272 2273 /*beginn von karl eingefuegt*/ 2274 if (this.element.context.tagName == "IFRAME") { 2275 /* reset content sizing*/ 2276 this.element.css({ 2277 height: 0, 2278 minHeight: 0, 2279 width: options.width, 2280 border: '0' 2281 }); 2282 } else { 2283 /* reset content sizing*/ 2284 this.element.css({ 2285 height: 0, 2286 minHeight: 0, 2287 width: 'auto' 2288 }); 2289 } 2290 2291 /*ende von karl eingef�gt*/ 2292 2293 2294 /* reset wrapper sizing 2295 determine the height of all the non-content elements*/ 2296 var nonContentHeight = this.uiDialog.css({ 2297 height: 'auto', 2298 width: options.width 2299 }) 2300 .height(); 2301 2302 this.element 2303 .css({ 2304 minHeight: Math.max(options.minHeight - nonContentHeight, 0), 2305 height: options.height == 'auto' 2306 ? 'auto' 2307 : Math.max(options.height - nonContentHeight, 0) 2308 }); 2309 } 2310 }); 2311 2312 $.extend($.ui.dialog, { 2313 version: "1.7.1", 2314 defaults: { 2315 autoOpen: true, 2316 bgiframe: false, 2317 buttons: {}, 2318 closeOnEscape: true, 2319 closeText: 'close', 2320 dialogClass: '', 2321 draggable: true, 2322 hide: null, 2323 height: 'auto', 2324 maxHeight: false, 2325 maxWidth: false, 2326 minHeight: 150, 2327 minWidth: 150, 2328 modal: false, 2329 position: 'center', 2330 resizable: true, 2331 show: null, 2332 showLyonessLogo: true, 2333 stack: true, 2334 title: '', 2335 width: 300, 2336 zIndex: 1000, 2337 2338 /*Modification by Erich */ 2339 selectedButton: null, 2340 /*End Modification by Erich */ 2341 2342 /*Modification by Robert */ 2343 hidedealogaftergeneration: false, 2344 noOverlayDeleteOnClose: false 2345 /*End Modification by Robert */ 2346 }, 2347 2348 getter: 'isOpen', 2349 2350 uuid: 0, 2351 maxZ: 0, 2352 2353 getTitleId: function($el) { 2354 return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid); 2355 }, 2356 2357 overlay: function(dialog) { 2358 this.$el = $.ui.dialog.overlay.create(dialog); 2359 } 2360 }); 2361 2362 $.extend($.ui.dialog.overlay, { 2363 instances: [], 2364 maxZ: 0, 2365 events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), 2366 function(event) { return event + '.dialog-overlay'; }).join(' '), 2367 create: function(dialog) { 2368 if (this.instances.length === 0) { 2369 /* prevent use of anchors and inputs 2370 // we use a setTimeout in case the overlay is created from an 2371 // event that we're going to be cancelling (see #2804)*/ 2372 setTimeout(function() { 2373 $(document).bind($.ui.dialog.overlay.events, function(event) { 2374 var zindex = $(event.target).parents('.ui-dialog').css('zIndex'); 2375 if (zindex == undefined) return true; 2376 var dialogZ = $(event.target).parents('.ui-dialog').css('zIndex') || 0; 2377 return (dialogZ > $.ui.dialog.overlay.maxZ); 2378 }); 2379 }, 1); 2380 2381 /* allow closing by pressing the escape key*/ 2382 $(document).bind('keydown.dialog-overlay', function(event) { 2383 (dialog.options.closeOnEscape && event.keyCode 2384 && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close(event)); 2385 }); 2386 2387 /* handle window resize*/ 2388 $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize); 2389 } 2390 2391 var $el = $('<div></div>').appendTo(document.body) 2392 .addClass('ui-widget-overlay').css({ 2393 width: this.width(), 2394 height: this.height() 2395 }); 2396 2397 (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); 2398 2399 this.instances.push($el); 2400 return $el; 2401 }, 2402 2403 destroy: function($el) { 2404 this.instances.splice($.inArray(this.instances, $el), 1); 2405 2406 if (this.instances.length === 0) { 2407 $([document, window]).unbind('.dialog-overlay'); 2408 } 2409 2410 $el.remove(); 2411 }, 2412 2413 height: function() { 2414 2415 /* handle IE 6*/ 2416 if ($.browser.msie && $.browser.version < 7) { 2417 var scrollHeight = Math.max( 2418 document.documentElement.scrollHeight, 2419 document.body.scrollHeight 2420 ); 2421 var offsetHeight = Math.max( 2422 document.documentElement.offsetHeight, 2423 document.body.offsetHeight 2424 ); 2425 2426 if (scrollHeight < offsetHeight) { 2427 return $(window).height() + 'px'; 2428 } else { 2429 return scrollHeight + 'px'; 2430 } 2431 /* handle "good" browsers*/ 2432 } else { 2433 return $(document).height() + 'px'; 2434 } 2435 }, 2436 2437 width: function() { 2438 /* handle IE 6*/ 2439 if ($.browser.msie && $.browser.version < 7) { 2440 var scrollWidth = Math.max( 2441 document.documentElement.scrollWidth, 2442 document.body.scrollWidth 2443 ); 2444 var offsetWidth = Math.max( 2445 document.documentElement.offsetWidth, 2446 document.body.offsetWidth 2447 ); 2448 2449 if (scrollWidth < offsetWidth) { 2450 return $(window).width() + 'px'; 2451 } else { 2452 return scrollWidth + 'px'; 2453 } 2454 /* handle "good" browsers*/ 2455 } else { 2456 return $(document).width() + 'px'; 2457 } 2458 }, 2459 2460 resize: function() { 2461 /* If the dialog is draggable and the user drags it past the 2462 * right edge of the window, the document becomes wider so we 2463 * need to stretch the overlay. If the user then drags the 2464 * dialog back to the left, the document will become narrower, 2465 * so we need to shrink the overlay to the appropriate size. 2466 * This is handled by shrinking the overlay before setting it 2467 * to the full document size. 2468 */ 2469 var $overlays = $([]); 2470 $.each($.ui.dialog.overlay.instances, function() { 2471 $overlays = $overlays.add(this); 2472 }); 2473 2474 $overlays.css({ 2475 width: 0, 2476 height: 0 2477 }).css({ 2478 width: $.ui.dialog.overlay.width(), 2479 height: $.ui.dialog.overlay.height() 2480 }); 2481 } 2482 }); 2483 2484 $.extend($.ui.dialog.overlay.prototype, { 2485 destroy: function() { 2486 $.ui.dialog.overlay.destroy(this.$el); 2487 } 2488 }); 2489 2490 this.state = ""; 2491 2492})(jQuery); 2493 2494 2495 2496///////////////////////////////////////////////////////////////////////////////////////////////////////// 2497// �ffnet ein PopUp (in der DIV Variante - kein IFRAME) 2498//////////////////////////////////////////////////////////////////////////////////////////////////////// 2499DivWindow = function(indefaults, divContainerID) { 2500 2501 var self = this; 2502 this.dialogWindow; 2503 2504 this.defaults = { 2505 bgiframe: false, 2506 resizable: false, 2507 Size: { 2508 Height: 650, 2509 Width: 900 2510 }, 2511 modal: true, 2512 position: 'center', 2513 title: 'www.lyoness.ag',
2514 showCloseButton: false 2515 }; 2516 2517 $.extend(this.defaults, indefaults); 2518 2519 this.dialogWindow = $('#' + divContainerID).dialog(this.defaults); 2520 //Diese Zeile unbedingt lassen (funktioniert nicht richtig sonst) 2521 $('#' + divContainerID).dialog().parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").hide(); 2522 2523 this.Close = function(selfin, doCloseAction) { 2524 2525 if (doCloseAction == true && selfin.defaults.OnClosed != null) selfin.defaults.OnClosed(null, selfin); 2526 $('#' + divContainerID).dialog('close'); 2527 } 2528 2529 $('#' + divContainerID).dialog('open'); 2530} 2531 2532 2533/* 2534////////////////////////////////////////////////////////////////////////////////////////////////////////// 2535// KLASSE Generic Dialog 2536// Allgemeine Dialog Klasse 2537//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 2538LyoGenericWindow = function(obj, defaultsin) { 2539 2540 var self = this; 2541 this.dialogFrame = null; 2542 this.caller = obj; 2543 this.dialogWindow; 2544 2545 this.defaults = { 2546 Event: "click", 2547 bgiframe: false, 2548 resizable: false, 2549 Size: { 2550 Height: 650, 2551 Width: 900 2552 }, 2553 modal: true, 2554 position: 'center', 2555 title: 'DefWindow',
2556 showTakeItButton: false, 2557 showCloseButton: false, 2558 CloseButtonLabel: Translate("Close", "JSArea.GlobalArea"), 2559 TakeItButtonLabel: Translate("TakeIt", "JSArea.GlobalArea"), 2560 OnSelected: null, 2561 OnClosed: null, 2562 showLyonessLogo: true, 2563 showTitle: false, 2564 NoScrollBars: false, 2565 WindowName: 'GenericWindow', 2566 NoScrollBars: true 2567 }; 2568 2569 $.extend(this.defaults, defaultsin); 2570 2571 2572 2573 this.CollectAndClose = function(selfin) { 2574 2575 var data = null; 2576 2577 if (selfin.DataCollectorFunction != null) data = selfin.DataCollectorFunction(); 2578 if (data != false) { 2579 var callcose = true; 2580 if (selfin.defaults.OnSelected != null) callcose = selfin.defaults.OnSelected(data, selfin); 2581 if (callcose != false) selfin.Close(selfin, false); 2582 } 2583 } 2584 2585 this.Close = function(selfin, doCloseAction) { 2586 2587 2588 2589 if (doCloseAction == true && selfin.defaults.OnClosed != null) selfin.defaults.OnClosed(null, selfin); 2590 $(selfin.dialogFrame).dialog('close'); 2591 } 2592 2593 /* Dialog - Buttons definieren*/ 2594 this.dialogButtons = {}; 2595 2596 this.dialogState = ""; 2597 2598 if (this.defaults.showCloseButton) { 2599 this.dialogButtons[this.defaults.CloseButtonLabel] = function(event) { 2600 self.Close(self, true); 2601 } 2602 } 2603 2604 if (this.defaults.showTakeItButton != null && this.defaults.showTakeItButton == true) { 2605 this.dialogButtons[this.defaults.TakeItButtonLabel] = function(event) { 2606 self.CollectAndClose(self); 2607 } 2608 } 2609 2610 this.ToggleTakeItButton = function(show) { 2611 var toggle; 2612 if (show.toLowerCase() == 'true') 2613 toggle = ''; 2614 else 2615 toggle = 'disabled'; 2616 var firstButton = $(".ui-dialog-buttonpane button:contains('" + Translate("TakeIt", "JSArea.GlobalArea") + "')"); 2617 firstButton.attr('disabled', toggle); 2618 } 2619 2620 this.DataCollectorFunction = function() { 2621 return null; 2622 } 2623 2624 this.dialogFrame = document.createElement("iframe"); 2625 this.dialogFrame.style.border = "none"; 2626 this.dialogFrame.frameBorder = "0"; 2627 //this.dialogFrame.style.overflow = "scroll"; 2628 //this.dialogFrame.setAttribute("scrolling", "auto"); 2629 2630 2631 2632 if (this.defaults.NoScrollBars == true) { 2633 this.dialogFrame.style.overflowX = "hidden"; 2634 this.dialogFrame.style.overflowY = "hidden"; 2635 this.dialogFrame.style.overflow = "hidden"; 2636 this.dialogFrame.setAttribute("scrolling", "no"); 2637 } 2638 2639 2640 /*g�ndert von Karl damit alle Paremter hineingereicht werden*/ 2641 if (this.defaults.Size != null && this.defaults.Size.Height > 0) 2642 this.defaults.height = this.defaults.Size.Height; 2643 if (this.defaults.Size != null && this.defaults.Size.Width > 0) 2644 this.defaults.width = this.defaults.Size.Width; 2645 2646 this.defaults.autoOpen = false; 2647 2648 var defaultsButtons = this.defaults.buttons; 2649 if (!this.defaults.buttons) 2650 this.defaults.buttons = this.dialogButtons; 2651 else $.extend(this.defaults.buttons, this.dialogButtons); 2652 this.dialogWindow = $(this.dialogFrame).dialog(this.defaults); 2653 2654 if (this.defaults.Event != null && obj != null) { 2655 $(obj).bind(this.defaults.Event, { Dlg: this }, this.ShowDlg); 2656 } 2657} 2658 2659 2660LyoGenericWindow.prototype.ShowDlg = function(e) { 2661 2662 var dialog; 2663 var defaults; 2664 var dlgklasse; 2665 if (e != null) { 2666 dialog = e.data.Dlg.dialogWindow; 2667 defaults = e.data.Dlg.defaults; 2668 dlgklasse = e.data.Dlg; 2669 } 2670 else { 2671 dialog = $(this.dialogFrame); 2672 defaults = this.defaults; 2673 dlgklasse = this; 2674 } 2675 2676 dialog.dialog('open'); 2677 dialog.dialog().parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").hide(); 2678 2679 if (e != null) { 2680 e.data.Dlg.dialogFrame.src = e.data.Dlg.defaults.InitUrl; 2681 } else { 2682 this.dialogFrame.src = this.defaults.InitUrl; 2683 } 2684 2685 top[this.defaults.WindowName] = this; 2686 return this; 2687} 2688/* 2689////////////////////////////////////////////////////////////////////////////////////////////////////////// 2690// KLASSE Pin Dialog 2691// Leitet von der allgemeinen Dialog Klasse ab 2692//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 2693 2694LyoPinWindow = function() { } 2695LyoPinWindow.Instance = function(namein, caller, defaultsin) { 2696 2697 this.name = namein; 2698 2699 this.defaults = { 2700 title: "", 2701 InitUrl: HttpRootPath + "/Controls/PinForgotten/Popup", 2702 NoScrollBars:false, 2703 Size: { 2704 Height: 440, 2705 Width: 600 2706 } 2707 } 2708 2709 $.extend(this.defaults, defaultsin); 2710 2711 var parentWin = new LyoGenericWindow(caller, this.defaults); 2712 this.parent = parentWin; 2713 return parentWin; 2714} 2715 2716 2717//LyoPinWindow = function(caller, defaultsin) { 2718// this.defaults = { 2719// title: Translate("PinForgotten", "JSArea.GlobalArea"), 2720// InitUrl: HttpRootPath + "/Controls/PinForgotten/Popup" 2721// } 2722// $.extend(this.defaults, defaultsin); 2723// this.parent = new LyoGenericWindow(caller, this.defaults) 2724//} 2725 2726//$.fn.showPinDialog = function(linkID) { 2727// var defaults = { 2728// Size: { 2729// Height: 640, 2730// Width: 800 2731// } 2732// } 2733 2734// var _pinWindow = new LyoPinWindow(document.getElementById(linkID), defaults); 2735// 2736//} 2737 2738/* 2739////////////////////////////////////////////////////////////////////////////////////////////////////////// 2740// KLASSE History Dialog 2741// Leitet von der allgemeinen Dialog Klasse ab, dient zur anzeige der historisierung
2742//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 2743/* Auskommentiert, da nicht verwendet wird (hoffentlich) sreicht 15.09.2010 2744LyoHistoryWindow = function(caller, defaultsin) { 2745 this.defaults = { 2746 title: Translate("History", "JSArea.GlobalArea"), 2747 InitUrl: HttpRootPath + "Note/Popup", 2748 Size: { 2749 Height: 650, 2750 Width: 900 2751 } 2752 } 2753 this.defaults.InitUrl += "?EntityId=" + defaultsin.Id + "&NoteType=" + defaultsin.NoteType; 2754 2755 $.extend(this.defaults, defaultsin); 2756 this.parent = new LyoGenericWindow(caller, this.defaults); 2757} 2758 2759 2760$.fn.showHistoryDialog = function(defaultsin) { 2761 this.each(function(i, obj) { 2762 $(document).ready(function() { 2763 var _LyoHistoryWindow = new LyoHistoryWindow(obj, defaultsin); 2764 }); 2765 }); 2766 2767}*/ 2768 2769/* 2770////////////////////////////////////////////////////////////////////////////////////////////////////////// 2771// KLASSE FileUpload Dialog 2772// Leitet von der allgemeinen Dialog Klasse ab, dient zur Anzeige des FileUploads 2773//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 2774LyoFileUploadWindow = function() { } 2775LyoFileUploadWindow.Instance = function(name, caller, defaultsin, onSelected) { 2776 this.defaults = { 2777 title: Translate("Datei Hochladen", "JSArea.GlobalArea"), 2778 InitUrl: HttpRootPath + "/Controls/UploadForm/Popup", 2779 OnSelected: onSelected, 2780 showTakeItButton: true, 2781 Size: { 2782 Height: 200, 2783 Width: 400 2784 } 2785 } 2786 this.defaults.InitUrl += "?EntityId=" + defaultsin.EntityID + "&FileUsageID=" + defaultsin.FileUsageID + 2787 "&Path=" + defaultsin.Path + "&Name=" + name; 2788 2789 $.extend(this.defaults, defaultsin); 2790 var parentWin = new LyoGenericWindow(caller, this.defaults); 2791 this.parent = parentWin; 2792 top[name] = parentWin; 2793 2794 return parentWin; 2795} 2796 2797LyoFileUploadWindow.GetExistingInstance = function(name) { 2798 return top[name]; 2799} 2800 2801////////////////////////////////////////////////////////////////////////////////////////////////////////// 2802// KLASSE DealerInvoiceDetail - PrintInvoice 2803// �ffnet ein PopUp mit dem in Navision generierten Pdf 2804////////////////////////////////////////////////////////////////////////////////////////////////////////// 2805/*wird nicht scheinbar mehr ben�tigt 2806LyoBillDetailPrint = function() { } 2807LyoBillDetailPrint.Instance = function(namein, caller, defaultsin) { 2808 this.name = namein; 2809 2810 this.defaults = { 2811 InitUrl: HttpRootPath + "Dealers/BillDetail/PrintInvoice", 2812 title: Translate("PrintDealerInvoice", "JSArea.GlobalArea"), 2813 InvoiceID: null 2814 } 2815 2816 $.extend(this.defaults, defaultsin); 2817 this.defaults.InitUrl = this.defaults.InitUrl + "?invoiceID=" + this.defaults.InvoiceID; 2818 2819 var parentWin = new LyoGenericWindow(namein, this.defaults); 2820 this.parent = parentWin; 2821 return parentWin; 2822} 2823 2824LyoBillDetailPrint.GetExistingInstance = function(name) { 2825 return LyoReportWindow.GetInstanzeByName(name); 2826} 2827*/ 2828/* 2829////////////////////////////////////////////////////////////////////////////////////////////////////////// 2830// KLASSE Kunden Information 2831// Zeigt Daten, Addressen und Erreichbarkeiten eines Kunden 2832//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 2833/* Auskommentiert, da nicht verwendet wird (hoffentlich) sreicht 15.09.2010 2834LyoCustomerInformation = function() { } 2835LyoCustomerInformation.Instance = function(namein, caller, defaultsin) { 2836 2837this.defaults = { 2838Titel: Translate("CustomerInformation", "JSArea.GlobalArea"), 2839InitUrl: HttpRootPath + "Controls/CustomerInformation/Find", 2840title: Translate("Kunden Information", "JSArea.GlobalArea"), 2841Size: { 2842Height: 580, 2843Width: 550 2844} 2845} 2846this.defaults.InitUrl += "?EntityId=" + defaultsin.EntityID + "&Name=" + namein; 2847$.extend(this.defaults, defaultsin); 2848 2849var parentWin = new LyoGenericWindow(caller, this.defaults); 2850this.parent = parentWin; 2851return parentWin; 2852} 2853LyoCustomerInformation.GetExistingInstance = function(name) { 2854return top[name]; 2855}*/ 2856 2857 2858////////////////////////////////////////////////////////////////////////////////////////////////////////// 2859// KLASSE H�ndler Information 2860// Zeigt Daten, Addressen und Erreichbarkeiten eines H�ndlers 2861////////////////////////////////////////////////////////////////////////////////////////////////////////// 2862LyoDealerInformation = function() { } 2863LyoDealerInformation.Instance = function(namein, caller, defaultsin) { 2864 2865 this.name = namein; 2866 2867 this.defaults = { 2868 InitUrl: HttpRootPath + "Controls/DealerInformation/Find", 2869 title: Translate("DealerInformation", "JSArea.GlobalArea"), 2870 Size: { 2871 Height: 300, 2872 Width: 400 2873 }, 2874 ValuesFromFields: false, 2875 EntityID: null, 2876 DealerLocationID: null 2877 } 2878 2879 $.extend(this.defaults, defaultsin); 2880
2881 this.defaults.InitUrl += "?Name=" + this.name; 2882 2883 this.defaults.InitUrl += "&entityId=" + this.defaults.EntityID + "&dealerLocationID=" + this.defaults.DealerLocationID; 2884 2885 var parentWin = new LyoGenericWindow(caller, this.defaults); 2886 this.parent = parentWin; 2887 2888 return parentWin; 2889} 2890 2891LyoDealerInformation.GetExistingInstance = function(name) { 2892 return top[name]; 2893} 2894 2895/* 2896////////////////////////////////////////////////////////////////////////////////////////////////////////// 2897// KLASSE BigImagePreview 2898// Zeigt ein Storebild in gro� an und man kann sogar bl�ttern 2899//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 2900LyoBigImagePreview = function() { } 2901LyoBigImagePreview.Instance = function(namein, caller, defaultsin) { 2902 2903 this.defaults = { 2904 title: ''/*Translate("LyonessStore", "JSArea.GlobalArea")*/, 2905 InitUrl: HttpRootPath + "Store/Catalog/BigImagePreview", 2906 ItemNumber: '', 2907 InternalCount: '', 2908 Size: { 2909 Height: 520, 2910 Width: 470 2911 } 2912 } 2913 $.extend(this.defaults, defaultsin); 2914 2915 this.defaults.InitUrl += "?itemNumber=" + defaultsin.ItemNumber + "&internalCount=" + defaultsin.InternalCount; 2916 2917 var parentWin = new LyoGenericWindow(caller, this.defaults); 2918 this.parent = parentWin; 2919 return parentWin; 2920} 2921 2922LyoBigImagePreview.GetExistingInstance = function(name) { 2923 return top[name]; 2924} 2925 2926////////////////////////////////////////////////////////////////////////////////////////////////////////// 2927// KLASSE Bonus-Rabatt Detail 2928// Zeigt Bonus-Rabatt 2929//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 2930LyoDealerBonusDetail = function() { } 2931LyoDealerBonusDetail.Instance = function (namein, caller, defaultsin) { 2932 2933 this.defaults = { 2934 Titel: Translate("DealerBonus", "JSArea.GlobalArea"), 2935 InitUrl: HttpRootPath + "Public/DealerBonusOverview/ShowDetail", 2936 title: Translate("Bonus-Rabatt", "JSArea.GlobalArea"), 2937 ReturnUri: HttpRootPath + "Public/DealerBonusOverview/Index", 2938 NoScrollBars: false, 2939 FriendlyID: 0, 2940 cm_sp: "", 2941 Size: { 2942 Height: 468, 2943 Width: 490 2944 } 2945 } 2946 $.extend(this.defaults, defaultsin); 2947 2948 // Ajax-Request, ob der Bonus-Rabatt aktiv/vorhanden ist 2949 var ajaxUrl = HttpRootPath + "Public/DealerBonusOverview/GetIdIfActive?dealerBonusID=" + defaultsin.EntityID + "&friendlyID=" + this.defaults.FriendlyID; 2950 var mainDefaults = this.defaults; 2951 $.ajax({ 2952 url: ajaxUrl, 2953 cache: false, 2954 type: 'POST', 2955 async: false, 2956 dataType: 'string', 2957 data: {}, 2958 success: function (response) { 2959 if (IsNullOrEmpty(response)) { 2960 return; 2961 } 2962 2963 mainDefaults.InitUrl += "?dealerBonusId=" + response + "&retUri=" + mainDefaults.ReturnUri + "&cm_sp=" + mainDefaults.cm_sp; 2964 2965 var parentWin = new LyoGenericWindow(caller, mainDefaults); 2966 this.parent = parentWin; 2967 parentWin.ShowDlg(); 2968 }, 2969 error: function (xhr, ajaxOptions, thrownError) { 2970 LyoErrorHandler.SendAjaxError(xhr, ajaxOptions, thrownError); 2971 } 2972 }); 2973} 2974LyoDealerBonusDetail.GetExistingInstance = function(name) { 2975 return top[name]; 2976} 2977 2978////////////////////////////////////////////////////////////////////////////////////////////////////////// 2979// KLASSE Bonus-Rabatt Detail 2980// Zeigt Bonus-Rabatt 2981//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 2982LyoSpecialDealerBonusDetail = function() { } 2983LyoSpecialDealerBonusDetail.Instance = function(namein, caller, defaultsin) { 2984 2985 this.defaults = { 2986 Titel: Translate("DealerBonus", "JSArea.GlobalArea"), 2987 InitUrl: HttpRootPath + "Public/DealerBonusOverview/ShowDetail", 2988 title: Translate("Bonus-Rabatt", "JSArea.GlobalArea"), 2989 ReturnUri: HttpRootPath + "Public/DealerBonusOverview/Index", 2990 SpecialTypeEnum: "", 2991 NoScrollBars: false, 2992 cm_sp:"", 2993 Size: { 2994 Height: 500, 2995 Width: 490 2996 } 2997 } 2998 2999 $.extend(this.defaults, defaultsin); 3000 this.defaults.InitUrl += "?dealerBonusId=" + defaultsin.EntityID + "&retUri=" + this.defaults.ReturnUri + "&cm_sp=" + this.defaults.cm_sp; 3001 3002 3003 var parentWin = new LyoGenericWindow(caller, this.defaults); 3004 3005 var closeText = $('#popupclosetag').parent(); 3006 $(closeText).find('a').css('color', ''); 3007 $('.ui-dialog-titlebar').html(closeText.html()).removeClass('ui-corner-all').addClass(this.defaults.SpecialTypeEnum + "_" + CountryID); 3008 $('#popupclosetag').click(function(event) { 3009 $(parentWin.dialogFrame).dialog('destroy'); 3010 return false;
3011 }); 3012 3013 this.parent = parentWin; 3014 return parentWin; 3015} 3016LyoSpecialDealerBonusDetail.GetExistingInstance = function(name) { 3017 return top[name]; 3018} 3019 3020 3021////////////////////////////////////////////////////////////////////////////////////////////////////////// 3022// KLASSE Structogram - Glossar 3023// Zeigt Glossar f�r Tree in Structogram an 3024//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 3025OpenGlossar = function () { } 3026OpenGlossar.Instance = function (namein, caller, defaultsin) { 3027 3028 this.defaults = { 3029 Titel: Translate("Glossar", "JSArea.GlobalArea"), 3030 InitUrl: HttpRootPath + "Customers/BpStructogram/ShowGlossar", 3031 title: Translate("Glossar", "JSArea.GlobalArea"), 3032 ReturnUri: HttpRootPath + "Customers/BpStructogram/Index", 3033 NoScrollBars: true, 3034 cm_sp: "", 3035 Size: { 3036 Height: 470, 3037 Width: 720 3038 } 3039 } 3040 $.extend(this.defaults, defaultsin); 3041 3042 //this.defaults.InitUrl += "?customerID=" + defaultsin.EntityID + "&productionMonth=" + defaultsin.productionMonth + "&reportType=" + defaultsin.reportType; 3043 3044 var parentWin = new LyoGenericWindow(caller, this.defaults); 3045 this.parent = parentWin; 3046 return parentWin; 3047} 3048OpenGlossar.GetExistingInstance = function (name) { 3049 return top[name]; 3050} 3051 3052////////////////////////////////////////////////////////////////////////////////////////////////////////// 3053// KLASSE BpStatusbox - Erkl�rung Kundentyp 3054// Zeigt Erkl�rung Kundentyp f�r Status�bersicht 3055//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 3056OpenCustomertypeDescription = function () { } 3057OpenCustomertypeDescription.Instance = function (namein, caller, defaultsin) { 3058 3059 this.defaults = { 3060 Titel: Translate("Glossar", "JSArea.GlobalArea"), 3061 InitUrl: HttpRootPath + "Controls/BpStatusbox/ShowCustomertypeDescription", 3062 title: Translate("Glossar", "JSArea.GlobalArea"), 3063 ReturnUri: HttpRootPath + "Customers/BpStatusreport/Index", 3064 NoScrollBars: true, 3065 cm_sp: "", 3066 Size: { 3067 Height: 370, 3068 Width: 720 3069 } 3070 } 3071 $.extend(this.defaults, defaultsin); 3072 3073 var parentWin = new LyoGenericWindow(caller, this.defaults); 3074 this.parent = parentWin; 3075 return parentWin; 3076} 3077OpenCustomertypeDescription.GetExistingInstance = function (name) { 3078 return top[name]; 3079} 3080 3081////////////////////////////////////////////////////////////////////////////////////////////////////////// 3082// KLASSE Top-Of-The-Top 3083// Zeigt Top-Of-The-Top f�r einen Kunden an 3084//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 3085OpenTopOfTop = function () { } 3086OpenTopOfTop.Instance = function (namein, caller, defaultsin, titlepar) { 3087 3088 this.defaults = { 3089 InitUrl: HttpRootPath + "Customers/BpTopOfTop/ShowDetail", 3090 title: titlepar, 3091 showTitle: true, 3092 ReturnUri: HttpRootPath + "Customers/BpTopOfTop/Index", 3093 NoScrollBars: true, 3094 cm_sp: "", 3095 Size: { 3096 Height: 520, 3097 Width: 900 3098 } 3099 } 3100 $.extend(this.defaults, defaultsin); 3101 3102 this.defaults.InitUrl += "?customerID=" + defaultsin.EntityID + "&productionMonth=" + defaultsin.productionMonth + "&reportType=" + defaultsin.reportType; 3103 3104 3105 var parentWin = new LyoGenericWindow(caller, this.defaults); 3106 this.parent = parentWin; 3107 return parentWin; 3108} 3109OpenTopOfTop.GetExistingInstance = function (name) { 3110 return top[name]; 3111} 3112 3113 3114////////////////////////////////////////////////////////////////////////////////////////////////////////// 3115// KLASSE Structogram - Glossar 3116// Zeigt Glossar f�r Tree in Structogram an 3117//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 3118OpenCareerFiftyPercent = function () { } 3119OpenCareerFiftyPercent.Instance = function (namein, caller, defaultsin, titlepar) { 3120 3121 this.defaults = { 3122 InitUrl: HttpRootPath + "Controls/CareerLevelGraphic/Index", 3123 title: titlepar, 3124 ReturnUri: HttpRootPath + "Customers/BpStructogram/Index", 3125 NoScrollBars: true, 3126 showTitle: true, 3127 cm_sp: "", 3128 Size: { 3129 Height: 600, 3130 Width: 880 3131 } 3132 } 3133 $.extend(this.defaults, defaultsin); 3134
3135 this.defaults.InitUrl += "?customerID=" + defaultsin.EntityID + "&monthID=" + defaultsin.monthID; 3136 3137 var parentWin = new LyoGenericWindow(caller, this.defaults); 3138 this.parent = parentWin; 3139 3140 return parentWin; 3141} 3142OpenCareerFiftyPercent.GetExistingInstance = function (name) { 3143 return top[name]; 3144} 3145 3146/* 3147////////////////////////////////////////////////////////////////////////////////////////////////////////// 3148// KLASSE Message Box 3149// Leitet von der allgemeinen Dialog Klasse ab, dient zur anzeige von Messageboxen 3150//////////////////////////////////////////////////////////////////////////////////////////////////////////*/ 3151 3152function createEnum(type, flags) { 3153 for (var i in type.prototype) { 3154 type[i] = type.prototype[i]; 3155 } 3156 type.__enum = true; 3157 type.__flags = flags; 3158} 3159 3160MessageBoxButton = function() { 3161 throw new Error("constructor not implemented. this is a static enum"); 3162} 3163 3164MessageBoxButton.prototype = { 3165 OK: { text: Translate("Ok", "JSArea.GlobalArea") }, 3166 Cancel: { text: Translate("Cancel", "JSArea.GlobalArea") }, 3167 Retry: { text: Translate("Retry", "JSArea.GlobalArea") }, 3168 Abort: { text: Translate("Abort", "JSArea.GlobalArea") }, 3169 Ignore: { text: Translate("Ignore", "JSArea.GlobalArea") }, 3170 Yes: { text: Translate("Yes", "JSArea.GlobalArea") }, 3171 No: { text: Translate("No", "JSArea.GlobalArea") } 3172} 3173 3174createEnum(MessageBoxButton); 3175 3176MessageBoxButtons = function() { 3177 throw new Error("constructor not implemented. this is a static enum"); 3178} 3179 3180MessageBoxButtons.prototype = { 3181 OK: { buttons: [MessageBoxButton.OK], defaultButton: MessageBoxButton.OK }, /*Das Meldungsfeld enth�lt die Schaltfl�che OK. */ 3182 OKCancel: { buttons: [MessageBoxButton.OK, MessageBoxButton.Cancel], defaultButton: MessageBoxButton.OK }, /*Das Meldungsfeld enth�lt die Schaltfl�chen OK und Abbrechen. */ 3183 AbortRetryIgnore: { buttons: [MessageBoxButton.Abort, MessageBoxButton.Retry, MessageBoxButton.Ignore], defaultButton: MessageBoxButton.Retry }, /*Das Meldungsfeld enth�lt die Schaltfl�chen Abbrechen, Wiederholen und Ignorieren. */ 3184 YesNoCancel: { buttons: [MessageBoxButton.Yes, MessageBoxButton.No, MessageBoxButton.Cancel], defaultButton: MessageBoxButton.Cancel }, /*Das Meldungsfeld enth�lt die Schaltfl�chen Ja, Nein und Abbrechen. */ 3185 YesNo: { buttons: [MessageBoxButton.Yes, MessageBoxButton.No], defaultButton: MessageBoxButton.No }, /*Das Meldungsfeld enth�lt die Schaltfl�chen Ja und Nein. */ 3186 RetryCancel: { buttons: [MessageBoxButton.Retry, MessageBoxButton.Cancel], defaultButton: MessageBoxButton.Cancel} /*Das Meldungsfeld enth�lt die Schaltfl�chen Wiederholen und Abbrechen. */ 3187} 3188 3189createEnum(MessageBoxButtons); 3190 3191MessageBoxType = function() { 3192 throw new Error("constructor not implemented. this is a static enum"); 3193} 3194MessageBoxType.prototype = { 3195 Info: { title: Translate("Information", "JSArea.GlobalArea"), icon: "MsgBoxIconInfo" }, /*Informationsbox*/ 3196 Advise: { title: Translate("Advise", "JSArea.GlobalArea"), icon: "MsgBoxIconAdvise" }, /*Hinweisbox*/ 3197 Error: { title: Translate("Error", "JSArea.GlobalArea"), icon: "MsgBoxIconError"} /*Fehlerbox*/ 3198} 3199createEnum(MessageBoxType); 3200 3201 3202 3203LyoMessageBox = function(caller, defaultsin) { 3204 3205 this.defaults = { 3206 Size: { 3207 Height: "auto", 3208 Width: 350 3209 }, 3210 autoopen: false, 3211 bgiframe: true, 3212 bindMethod: this.ShowBox, 3213 titleText: null, 3214 resizable: false, 3215 messagetext: null, 3216 messageboxtype: MessageBoxType.Info, 3217 messageBoxButtons: MessageBoxButtons.OK, 3218 Event: "click", 3219 modal: true, 3220 position: 'center', 3221 title: null, 3222 ResultCallback: { 3223 onOk: null, 3224 onCancel: null, 3225 onRetry: null, 3226 onAbort: null, 3227 onIgnore: null, 3228 onYes: null, 3229 onNo: null 3230 }, 3231 selectedButton: null 3232 } 3233 3234 $.extend(this.defaults, defaultsin); 3235 3236 3237 if (IsNullOrEmpty(this.defaults.title)) { 3238 this.defaults.title = this.defaults.messageboxtype.title; 3239 } 3240 3241 this.dlgWnd = document.createElement("div"); 3242 this.dlgWnd.id = "dialog"; 3243 3244 this.table = document.createElement("table"); 3245 this.table.classname = "msgTable" 3246 this.row = this.table.insertRow(0); 3247 3248 this.icon = document.createElement("div"); 3249 this.icon.className = this.defaults.messageboxtype.icon; 3250 this.cell1 = this.row.insertCell(0); 3251 this.cell1.appendChild(this.icon); 3252 this.cell1.setAttribute("width", "40px"); 3253 this.cell1.align = "Left"; 3254 this.cell1.vAlign = "Top"; 3255 3256 this.cell2 = this.row.insertCell(1); 3257 this.cell2.innerHTML = this.defaults.messagetext; 3258 this.cell2.align = "Left"; 3259 this.cell2.vAlign = "Top"; 3260 this.cell2.style.padding = "5px 0 0 0;"; 3261 3262 this.dlgWnd.appendChild(this.table); 3263 3264 this.dialogFrame = this.dlgWnd; 3265 this.dialogFrame.dialogOwner = this; 3266 this.caller = caller; 3267 3268 3269 this._saved_caller_onclick = null; 3270
3271 /* onclick attribut des DOM elements wird gespeichert und gegen ein return false ersetzt*/ 3272 if (caller != null) { 3273 this._saved_caller_onclick = caller.onclick; 3274 this.caller.onclick = function() { return false; }; 3275 } 3276 3277 3278 /* Dialog - Buttons definieren*/ 3279 this.dialogButtons = {}; 3280 if (this.defaults.messageBoxButtons != null) { 3281 if (this.defaults.selectedButton == null && this.defaults.messageBoxButtons.defaultButton != null) { 3282 this.defaults.selectedButton = this.defaults.messageBoxButtons.defaultButton; 3283 } 3284 3285 for (x in this.defaults.messageBoxButtons.buttons) { 3286 var curIdx = (this.defaults.messageBoxButtons.buttons.length - 1) - x; 3287 3288 if (this.defaults.messageBoxButtons.buttons[curIdx] == this.defaults.selectedButton) { 3289 this.selectedButtonIdx = x; 3290 } 3291 this.dialogButtons[this.defaults.messageBoxButtons.buttons[curIdx].text] = function(e) { 3292 $(this).dialog('close'); 3293 var but = this.dialogOwner.defaults.messageBoxButtons.buttons; 3294 for (idx in but) { 3295 if (but[idx].text == e.currentTarget.innerHTML) { 3296 this.dialogOwner.onFinish(but[idx], this); 3297 return; 3298 } 3299 } 3300 } 3301 } 3302 } 3303 3304 this.onFinish = function(dialogResult, dialog) { 3305 3306 var callbackReturn; 3307 3308 switch (dialogResult) { 3309 case MessageBoxButton.OK: 3310 if (this.defaults.ResultCallback.onOk != null) { 3311 callbackReturn = this.defaults.ResultCallback.onOk(dialog); 3312 } 3313 break; 3314 case MessageBoxButton.Cancel: 3315 if (this.defaults.ResultCallback.onCancel != null) { 3316 callbackReturn = this.defaults.ResultCallback.onCancel(dialog); 3317 } 3318 break; 3319 case MessageBoxButton.Retry: 3320 if (this.defaults.ResultCallback.onRetry != null) { 3321 callbackReturn = this.defaults.ResultCallback.onRetry(dialog); 3322 } 3323 break; 3324 case MessageBoxButton.Abort: 3325 if (this.defaults.ResultCallback.onAbort != null) { 3326 callbackReturn = this.defaults.ResultCallback.onAbort(dialog); 3327 } 3328 break; 3329 case MessageBoxButton.Ignore: 3330 if (this.defaults.ResultCallback.onIgnore != null) { 3331 callbackReturn = this.defaults.ResultCallback.onIgnore(dialog); 3332 } 3333 break; 3334 case MessageBoxButton.Yes: 3335 /*alert("YES WE CAN");*/ 3336 if (this.defaults.ResultCallback.onYes != null) { 3337 callbackReturn = this.defaults.ResultCallback.onYes(dialog); 3338 } 3339 break; 3340 case MessageBoxButton.No: 3341 /*alert("OHHH NO");*/ 3342 if (this.defaults.ResultCallback.onNo != null) { 3343 callbackReturn = this.defaults.ResultCallback.onNo(dialog); 3344 } 3345 break; 3346 default: 3347 /*alert("NO IDEA");*/ 3348 break; 3349 } 3350 3351 /* wenn der callback ein true zur�ckgegeben hat*/ 3352 if (callbackReturn != false && this._saved_caller_onclick != null) { 3353 3354 this.caller.onclick = this._saved_caller_onclick; /* wird das DOM Attribut onclick wieder hergestellt*/ 3355 3356 var onClick = $(this.caller).click; /* der jQuery click event gesichert*/ 3357 $(this.caller).unbind("click"); /* der jQuery click event gel�scht*/ 3358 this.caller.click(); /* ein click auf den button im originalzustand (vor dem boxbinding) ausgef�hrt*/ 3359 $(this.caller).bind("click", onClick); /* und der boxbinded zustand wieder hergestellt*/ 3360 this.caller.onclick = function() { return false; } 3361 3362 } 3363 3364 if (callbackReturn != false && (this._saved_caller_onclick == null || this._saved_caller_onclick == undefined)) { 3365 if (this.caller != null) { 3366 this.caller.onclick = function() { return true; } 3367 this.caller.click(); 3368 } 3369 } 3370 } 3371 3372 this.dialogWindow = $(this.dialogFrame).dialog({ 3373 bgiframe: this.defaults.bgiframe, 3374 resizable: this.defaults.resizable, 3375 height: this.defaults.Size.Height, 3376 width: this.defaults.Size.Width, 3377 modal: this.defaults.modal, 3378 position: this.defaults.position, 3379 title: this.defaults.title, 3380 autoOpen: false, 3381 buttons: this.dialogButtons, 3382 selectedButton: this.selectedButtonIdx 3383 }); 3384 if (caller != null) { 3385 $(caller).bind(this.defaults.Event, { Dlg: this }, this.ShowBox); 3386 } 3387} 3388 3389LyoMessageBox.prototype.ShowBox = function(e) { 3390 e.data.Dlg.ShowDialogBox(e.data.Dlg); 3391} 3392 3393LyoMessageBox.prototype.ShowDialogBox = function(dlg) { 3394 dlg.dialogWindow.dialog('open').parents(".ui-dialog:first").find(".ui-dialog-titlebar-close").hide(); 3395} 3396 3397 3398$.fn.InfoBox = function(defaultsin) { 3399 this.each(function(i, obj) { 3400 $(document).ready(function() { 3401 var defaults = { 3402 messageboxtype: MessageBoxType.Info 3403 } 3404 $.extend(defaults, defaultsin); 3405 var _LyoMessageBox = new LyoMessageBox(obj, defaults); 3406 }); 3407 }); 3408} 3409function InfoBox(defaultsin) { 3410 var defaults = { 3411 messageboxtype: MessageBoxType.Info 3412 } 3413 $.extend(defaults, defaultsin); 3414 var _LyoMessageBox = new LyoMessageBox(null, defaults);
3415 _LyoMessageBox.ShowDialogBox(_LyoMessageBox); 3416} 3417 3418 3419$.fn.ErrorBox = function(defaultsin) { 3420 this.each(function(i, obj) { 3421 $(document).ready(function() { 3422 var defaults = { 3423 messageboxtype: MessageBoxType.Error 3424 } 3425 $.extend(defaults, defaultsin); 3426 var _LyoMessageBox = new LyoMessageBox(obj, defaults); 3427 }); 3428 }); 3429} 3430function ErrorBox(defaultsin) { 3431 var defaults = { 3432 messageboxtype: MessageBoxType.Error 3433 } 3434 $.extend(defaults, defaultsin); 3435 var _LyoMessageBox = new LyoMessageBox(null, defaults); 3436 _LyoMessageBox.ShowDialogBox(_LyoMessageBox); 3437} 3438 3439$.fn.AdviseBox = function(defaultsin) { 3440 this.each(function(i, obj) { 3441 $(document).ready(function() { 3442 var defaults = { 3443 messageboxtype: MessageBoxType.Advise 3444 } 3445 $.extend(defaults, defaultsin); 3446 var _LyoMessageBox = new LyoMessageBox(obj, defaults); 3447 }); 3448 }); 3449} 3450function AdviseBox(defaultsin) { 3451 var defaults = { 3452 messageboxtype: MessageBoxType.Error 3453 } 3454 $.extend(defaults, defaultsin); 3455 var _LyoMessageBox = new LyoMessageBox(null, defaults); 3456 _LyoMessageBox.ShowDialogBox(_LyoMessageBox); 3457} 3458 3459function WebSiteMessageBox(defaultsin) { 3460 var defaults = { 3461 messageboxtype: MessageBoxType.Info 3462 } 3463 $.extend(defaults, defaultsin); 3464 var _LyoMessageBox = new LyoGenericWindow(null, defaults); 3465 return _LyoMessageBox; 3466 3467} 3468 3469 3470WebSiteMessageBox = function (caller, defaultsin) { 3471 3472 3473 this.WebSiteMessageBoxState = ""; 3474 this.WebSiteMessageBoxMessageID = defaultsin.messageID; 3475 3476 if (defaultsin.messageID == null || defaultsin.messageID == "") { 3477 alert("WebSiteMessageBox->messageID darf nicht leer sein!"); 3478 return; 3479 } 3480 3481 if (defaultsin.id == null || defaultsin.id == "") { 3482 alert("WebSiteMessageBox->id darf nicht leer sein!"); 3483 return; 3484 } 3485 else { 3486 defaultsin.id = "WebSiteMessageBox_" + defaultsin.id; 3487 } 3488 if (window[defaultsin.id] != null) { 3489 return; 3490 } 3491 else 3492 window[defaultsin.id] = "1"; 3493 3494 3495 var self = this; 3496 var lyoGenericWindow = null; 3497 var state = ""; 3498 var closeButtonName = Translate("Close", "JSArea.GlobalArea"); 3499 3500 this.defaults = { 3501 title: Translate("Info", "JSArea.GlobalArea"), 3502 InitUrl: "https://www.google.at", 3503 modal: true, 3504 Size: { 3505 Height: 660, 3506 Width: 760 3507 }, 3508 DoNotmoveToTop: true, 3509 showCloseButton: true, 3510 showLyonessLogo: true, 3511 showLyonessLogo: true, 3512 buttons: {} 3513 3514 } 3515 3516 /* Default values */ 3517 /* 3518 Height: 500, 3519 Width: 745 3520 */ 3521 3522 $.extend(this.defaults, defaultsin); 3523 this.lyoGenericWindow = new LyoGenericWindow(caller, this.defaults); 3524 3525 $(this.lyoGenericWindow.dialogFrame).attr('style', 'width:100%'); 3526 $(this.lyoGenericWindow.dialogFrame).attr('style', 'height:100%'); 3527 3528 3529 this.lyoGenericWindow.ShowDlg(); 3530 lyoGenericWindow = this.lyoGenericWindow; 3531 3532 this.GetConfirmationParams = function () { 3533 3534 return { messageID: self.defaults.messageID, 3535 customerID: self.defaults.customerID, 3536 lotteryID: self.defaults.lotteryID, 3537 webSiteMessageBoxState: self.WebSiteMessageBoxState 3538 }; 3539 3540 } 3541 3542 3543} 3544 3545WebSiteMessageBoxLottery = function(caller, defaultsin) { 3546 var chkid = 'WebSiteMessageBoxLotteryBtnChk' + defaultsin.id; 3547 var btnChk = '<input style=\"border:0;\" name=\"' + chkid + '\" id=\"' + chkid + '\" type=\"checkbox\" />'; 3548 var id = 'WebSiteMessageBoxLotteryLblChk' + defaultsin.id; 3549 var label_chk = $('<Div id=\"' + id + '\">' + defaultsin.label_Chk + '</Div>'); 3550 3551 3552 var checkBox = $(btnChk); 3553 var self = this; 3554 var table = $('<table class=\"advancedFields\" style=\"width:100%\" ><tr></tr></table>'); 3555 3556 3557 3558 var td = $('<td>' + btnChk + '</td>'); 3559 //btnChk.appendTo(td); 3560 $('tr', table).append(td); 3561 3562 3563 3564 var td1 = $('<td style=\"width:100%;\" ></td>'); 3565 label_chk.appendTo(td1); 3566 $('tr', table).append(td1); 3567 3568 this.defaults = { 3569 advancedFields: { "advancedFields": table 3570 }, 3571 Size: { 3572 Height: 605, 3573 Width: 520 3574 }, 3575 buttons: {} 3576 3577 }; 3578 3579 $.extend(this.defaults, defaultsin); 3580 3581 3582 this.defaults.buttons[defaultsin.lbl_btn_yes] = function(e) { self.webSiteMessageBox.WebSiteMessageBoxState = 'yes'; if ($('#' + chkid)[0].checked) { self.webSiteMessageBox.Close(); } else { alert(defaultsin.label_mustCheck) } }; 3583 this.defaults.buttons[defaultsin.lbl_btn_no] = function(e) { self.webSiteMessageBox.WebSiteMessageBoxState = 'no'; self.webSiteMessageBox.Close(); }; 3584 this.webSiteMessageBox = new WebSiteMessageBox(caller, this.defaults); 3585 3586 this.webSiteMessageBox.Close = function() { 3587 3588 $.post(this.defaults.confirmationurl, this.GetConfirmationParams()); 3589 this.lyoGenericWindow.Close(this.lyoGenericWindow, true); 3590 } 3591 3592 return this.webSiteMessageBox; 3593} 3594 3595 3596 3597WebSiteMessageBoxWithRadio = function(caller, defaultsin) { 3598 var self = this; 3599 var id = 'WebSiteMessageBoxWithCheckBoxYes' + defaultsin.id; 3600 var name = 'WebSiteMessageBoxWithCheckBox' + defaultsin.id; 3601 var radio = $('<Input name=\"' + name + '\" id=\"' + id + '\" type=\"radio\"></Input>'); 3602 3603 $(radio).bind("change", this, function(e) { e.data.webSiteMessageBox.WebSiteMessageBoxState = "yes"; }); 3604 3605 if (!defaultsin.label_yes_no) 3606 defaultsin.label_yes_no = ""; 3607 3608 var label_yes_no = $('<Div id=\"label_yes_no\">' + defaultsin.label_yes_no + '</Div>'); 3609 3610 var label = $('<Div id=\"label_yes\">' + Translate("Yes", "JSArea.GlobalArea") + '</Div>'); 3611 var table = $('<table class=\"advancedFields\"><tr></tr></table>'); 3612 var tdLabel = $('<td style=\"width:50px\" > </td>'); 3613 3614 var td = $('<td style="white-space:normal;" ></td>'); 3615 label_yes_no.appendTo(td); 3616 $('tr', table).append(td); 3617 $('tr', table).append(tdLabel); 3618 td = $('<td ></td>'); 3619 label.appendTo(td); 3620 $('tr', table).append(td); 3621 td = $('<td></td>'); 3622 radio.appendTo(td); 3623 $('tr', table).append(td); 3624 td = $('<td></td>'); 3625 $('tr', table).append(td); 3626 3627 id = 'WebSiteMessageBoxWithCheckBoxNo' + defaultsin.id; 3628 radio = $('<Input name=\"' + name + '\" id=\"' + id + '\" type=\"radio\"></Input>'); 3629 3630 $(radio).bind("change", this, function(e) { e.data.webSiteMessageBox.WebSiteMessageBoxState = "no"; }); 3631 3632 label = $('<Div id=\"label_no\">' + Translate("No", "JSArea.GlobalArea") + '</Div>'); 3633 3634 label.appendTo(td); 3635 $('tr', table).append(td); 3636 td = $('<td></td>'); 3637 radio.appendTo(td); 3638 $('tr', table).append(td); 3639 td = $('<td ></td>'); 3640 $('tr', table).append(td); 3641 3642 3643 this.defaults = { 3644 advancedFields: { "advancedFields": table 3645 }, 3646 buttons: {} 3647 }; 3648 // var closeButtonName = Translate("Close", "JSArea.GlobalArea"); 3649 // this.defaults.buttons[closeButtonName] = function(e) { self.webSiteMessageBox.Close(); }; 3650 3651 $.extend(this.defaults, defaultsin); 3652 self.webSiteMessageBox = new WebSiteMessageBox(caller, this.defaults); 3653 3654 this.defaults = { 3655 advancedFields: { "advancedFields": table 3656 }, 3657 buttons: {}, 3658 showCloseButton: true 3659 }; 3660 3661 $.extend(this.defaults, defaultsin); 3662 3663 this.webSiteMessageBox.lyoGenericWindow.defaults.close = function(data, obj) { 3664 $.post(self.defaults.confirmationurl, self.webSiteMessageBox.GetConfirmationParams()); 3665 alert("haha"); 3666 obj.dialogWindow.context.src = ''; 3667 3668 } 3669 3670 return this.webSiteMessageBox; 3671} 3672 3673WebSiteMessageBoxWithCheckBox = function(caller, defaultsin) { 3674 3675 var self = this; 3676 var id = 'WebSiteMessageBoxWithCheckBoxYes' + defaultsin.id; 3677 var checkbox = $('<Input name=\"' + id + '\" id=\"' + id + '\" type=\"checkbox\"></Input>'); 3678 $(checkbox).bind("click", this, function(e) { if (this.checked) e.data.webSiteMessageBox.WebSiteMessageBoxState = "yes"; else e.data.webSiteMessageBox.WebSiteMessageBoxState = "no"; }); 3679 3680 // Wenn bei defaultsin der param 'Label' vorhanden ist, dann anzeigen, ansonsten die default message dont show message again 3681 var label; 3682 if (defaultsin.Label) { 3683 label = $('<Div id=\"label_checkBox\"><nobr>' + defaultsin.Label + '</nobr></Div>'); 3684 } else { 3685 label = $('<Div id=\"label_checkBox\"><nobr>' + Translate("WebSiteMmessageDontShowMessageAgain", "JSArea.CustomerArea") + '</nobr></Div>'); 3686 } 3687 3688 var table = $('<table class=\"advancedFields\"><tr><td></td></tr></table>'); 3689 var td = $('<td ></td>'); 3690 label.appendTo(td); 3691 $('tr', table).append(td); 3692 td = $('<td></td>'); 3693 checkbox.appendTo(td); 3694 $('tr', table).append(td); 3695 td = $('<td style="width:100%;"></td>'); 3696 $('tr', table).append(td); 3697 3698 this.defaults = { 3699 advancedFields: { "advancedFields": table }, 3700 buttons: {}, 3701 showCloseButton: true 3702 }; 3703 3704 3705 $.extend(this.defaults, defaultsin); 3706 3707 this.webSiteMessageBox = new WebSiteMessageBox(caller, this.defaults); 3708 this.webSiteMessageBox.lyoGenericWindow.defaults.OnClosed = function(data, obj) { 3709 $.post(self.defaults.confirmationurl, self.webSiteMessageBox.GetConfirmationParams()); 3710 obj.dialogWindow.context.src = ''; 3711 3712 } 3713 3714 return this.webSiteMessageBox; 3715} 3716 3717EasterEggContinue = function(foundCount, defaultsin, caller, statusChecked) { 3718 var self = this; 3719 var id = 'EasterEggContinueChk' + defaultsin.id; 3720 var status = ''; 3721 if (statusChecked) 3722 status = "checked"; 3723 3724 var changed = false;
3725 var checkbox = $('<Input name=\"' + id + '\" id=\"' + id + '\" ' + status + ' type=\"checkbox\"></Input>'); 3726 $(checkbox).bind("click", this, function(e) { changed = true; if (this.checked) self.webSiteMessageBox.WebSiteMessageBoxState = "yes"; else self.webSiteMessageBox.WebSiteMessageBoxState = "no"; }); 3727 3728 3729 var conditionslink = '<a target=\"blank\" href=\"' + defaultsin.conditionsURL + '\">' + Translate("game_popup_conditions", "JSArea.GlobalArea") + ' »</a>'; 3730 var continueLable = Translate("game_popup_continueplay", "JSArea.GlobalArea") + ' / ' + Translate("game_popup_eggs_collected", "JSArea.GlobalArea"); 3731 3732 var table = $('<table class=\"advancedFields\"><tr></tr></table>'); 3733 var td = $('<td style=\"width:100%\" >' + conditionslink + '</td>'); 3734 $('tr', table).append(td); 3735 3736 var tr = $('<tr></tr>'); 3737 td = $('<td></td>'); 3738 3739 3740 tr = $('<tr></tr>'); 3741 td = $('<td></td>'); 3742 td.appendTo(tr); 3743 3744 var tableInner = $('<table class=\"advancedFields\"></table>'); 3745 var trInner = $('<tr></tr>'); 3746 3747 var tdInner = $('<td></td>'); 3748 tdInner.append(checkbox); 3749 tdInner.appendTo(trInner); 3750 3751 tdInner = $('<td></td>'); 3752 tdInner.append(continueLable + ': ' + foundCount); //<span>continueLable' + ': ' + '</span><span style=\"font-weight:bold;\">' + foundCount + '<span>'); 3753 tdInner.appendTo(trInner); 3754 trInner.appendTo(tableInner); 3755 tableInner.appendTo(td); 3756 td.appendTo(tr); 3757 tr.appendTo(table); 3758 tr.appendTo(table); 3759 3760 3761 3762 this.defaults = { 3763 advancedFields: { "advancedFields": table }, 3764 buttons: {}, 3765 Size: { 3766 Height: 460, 3767 Width: 460 3768 } 3769 }; 3770 3771 3772 $.extend(this.defaults, defaultsin); 3773 var closeButtonName = Translate("Close", "JSArea.GlobalArea"); 3774 this.defaults.buttons[closeButtonName] = function(e) { 3775 3776 3777 3778 if (changed) { 3779 if (checkbox[0].checked) 3780 self.webSiteMessageBox.WebSiteMessageBoxState = "yes"; 3781 else self.webSiteMessageBox.WebSiteMessageBoxState = "no"; 3782 $.post(self.defaults.confirmationurl, self.webSiteMessageBox.GetConfirmationParams()); 3783 } 3784 self.webSiteMessageBox.Close(); 3785 }; 3786 this.webSiteMessageBox = new WebSiteMessageBox(caller, this.defaults); 3787 3788 this.webSiteMessageBox.Close = function() { 3789 3790 3791 3792 return this.webSiteMessageBox; 3793 } 3794} 3795 3796 WebSitePrintBox = function(reportType, queryStringParams, defaultsin) { 3797 3798 3799 var id = "WebSitePrintBox_"; 3800 if (reportType == null || reportType == "") { 3801 alert("WebSitePrintBox->reportType darf nicht leer sein!"); 3802 return; 3803 } 3804 else { 3805 id = "WebSitePrintBox_" + reportType; 3806 } 3807 3808 window[id] = "1"; 3809 3810 3811 var self = this; 3812 var lyoGenericWindow = null; 3813 var state = ""; 3814 var closeButtonName = Translate("Close", "JSArea.GlobalArea"); 3815 3816 this.defaults = { 3817 title: ""/*Translate("Info", "JSArea.GlobalArea")*/, 3818 InitUrl: "/internal/Handlers/Reports.ashx?type=" + reportType + queryStringParams, 3819 modal: true, 3820 Size: { 3821 Height: 640, 3822 Width: 860 3823 }, 3824 DoNotmoveToTop: true, 3825 showCloseButton: false, 3826 buttons: {} 3827 } 3828 3829 if (defaultsin != null) 3830 $.extend(this.defaults, defaultsin); 3831 3832 3833 //this.defaults.buttons[closeButtonName] = function(e) { self.Close(); }; 3834 3835 this.lyoGenericWindow = new LyoGenericWindow(null, this.defaults); 3836 3837 $(this.lyoGenericWindow.dialogFrame).attr('style', 'width:100%'); 3838 $(this.lyoGenericWindow.dialogFrame).attr('style', 'height:100%'); 3839 3840 3841 this.lyoGenericWindow.ShowDlg(); 3842 lyoGenericWindow = this.lyoGenericWindow; 3843 3844 return lyoGenericWindow; 3845 3846 } 3847 3848 3849 OnlinePositioningAgbBox = function(defaultsin) { 3850 3851 var self = this; 3852 var lyoGenericWindow = null; 3853 3854 this.defaults = { 3855 title: Translate("Rules", "JSArea.GlobalArea"), 3856 InitUrl: "/internal/Customers/Matrix/ShowOnlinePositioningAgbBox", 3857 modal: true, 3858 Size: { 3859 Height: 200, 3860 Width: 500 3861 }, 3862 DoNotmoveToTop: false, 3863 showCloseButton: true, 3864 showTakeItButton: true, 3865 TakeItButtonLabel: Translate("Continue", "JSArea.GlobalArea") 3866 } 3867 3868 if (defaultsin != null) 3869 $.extend(this.defaults, defaultsin); 3870 3871 this.lyoGenericWindow = new LyoGenericWindow(null, this.defaults); 3872 3873 this.lyoGenericWindow.ShowDlg(); 3874 lyoGenericWindow = this.lyoGenericWindow; 3875 3876 return lyoGenericWindow; 3877 } 3878 3879 StoreLightbox = function(defaultsin) { 3880 3881 var self = this; 3882 var lyoGenericWindow = null; 3883 3884 this.defaults = { 3885 title: "", // Translate("store", "JSArea.GlobalArea"), 3886 InitUrl: "", 3887 modal: true, 3888 Size: { 3889 Height: 500, 3890 Width: 500 3891 }, 3892 DoNotmoveToTop: false, 3893 showCloseButton: true,
3894 showTakeItButton: false 3895 3896 } 3897 3898 if (defaultsin != null) 3899 $.extend(this.defaults, defaultsin); 3900 3901 3902 this.lyoGenericWindow = new LyoGenericWindow(null, this.defaults); 3903 3904 this.lyoGenericWindow.ShowDlg(); 3905 lyoGenericWindow = this.lyoGenericWindow; 3906 3907 return lyoGenericWindow; 3908 } 3909 3910 3911 3912 /* 3913 //Beispiel 3914 InformationPopup = function() { } 3915 InformationPopup.Instance = function(namein, caller, defaultsin) { 3916 3917 this.name = namein; 3918 3919 this.defaults = { 3920 InitUrl: HttpRootPath + "Controls/DepositDetail/Find", 3921 title: Translate("InformationPopup", "JSArea.GlobalArea"), 3922 Size: { 3923 Height: 300, 3924 Width: 550 3925 } 3926 } 3927 3928 $.extend(this.defaults, defaultsin); 3929 var parentWin = new LyoGenericWindow(caller, this.defaults); 3930 this.parent = parentWin; 3931 return parentWin; 3932 } 3933 3934 InformationPopup.GetExistingInstance = function(name) { 3935 return top[name]; 3936 } 3937 */
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.