var dbg = false; //********************************************************************************************************************** // // Author: GF // www.bm.hu // //********************************************************************************************************************** var ns4 = (document.layers); var ie4 = (document.all && !document.getElementById); var ie5 = (document.all && document.getElementById); var ns6 = (!document.all && document.getElementById); //********************************************************************************************************************** // function open_sx() //********************************************************************************************************************** function open_sx() { window.open(getPath() + '/info.htm?OpenPage', 'info', 'width=400, height=300, statusbar=no, left=50, top=50'); } //********************************************************************************************************************** // function openerRefresh(loc) //********************************************************************************************************************** function openerRefresh(win, loc) { win.opener.location.href = getPath() + '/' + loc; } //********************************************************************************************************************** // function idozito(loops, mess) //********************************************************************************************************************** function idozito(loops, mess, win) { if (!win) w = window; else w = win; for (i = 0; i < loops; i++) w.status = mess + " ... " + String(i); } //********************************************************************************************************************** // function getElement(id, w) //********************************************************************************************************************** function getElement(id) { var obj; if (ns4) { obj = document.layers[id]; } else if (ie4) { obj = document.all[id]; } else if (ie5 || ns6) { obj = document.getElementById(id); } if (!obj) obj = document.getElementsByName(id)[0] return(obj); } //********************************************************************************************************************** // function getPath(mode) //********************************************************************************************************************** function getPath(mode) { w = window.location; n = w.pathname.indexOf(".nsf"); n += 4; p = w.pathname.substr(0, n); loc = w.protocol + "//" + w.hostname + p; if (mode == 'P') return p; else return loc; } //********************************************************************************************************************** // function openwin(url, name, ww, wh, scroll, status) //********************************************************************************************************************** function openwin(url, name, ww, wh, scroll) { var sh = screen.availHeight; var sw = screen.availWidth; var p = getPath(); var win; var attr; var s; if (!ww) ww = 400; if (!wh) wh = 200; s = scroll ? '1' : '0'; st = status ? '1' : '0'; attr = "toolbar=0, location=0, directories=0, status=" + st + ", menuBar=0, scrollbars=" + s + ", resizable=0, width=" + String(ww) + ", height=" + String(wh) + ", left=" + String((sw - ww) / 2) + ", top=" + String((sh - wh) / 2); if (dbg) alert('openwin...' + p + url + ', ' + name + ', ' + attr); win = window.open(p + url, name, attr); win.focus(); return win; } //********************************************************************************************************************** // function cookieDate(secs) //********************************************************************************************************************** function cookieDate(secs) { var d; d = new Date(); if(secs) { d.setTime(d.getTime() + secs * 1000); } else { d.setTime(d.getTime() + 60 * 60 * 1000); } return(d.toGMTString()); } //********************************************************************************************************************** // function doCookie(cookieName, value, del) //********************************************************************************************************************** function doCookie(cookieName, value, del) { var secs = 1800; if (dbg) alert('doCookie...' + cookieName + '...' + value + '...' + String(del)); if (!del) { if (document.cookie) { index = document.cookie.indexOf(cookieName); } else { index = -1; } if (index == -1) { document.cookie = cookieName + "=" + value + ";expires=" + cookieDate(secs) + ";path=" + getPath('P'); } else { countbegin = (document.cookie.indexOf( "=", index) + 1); countend = document.cookie.indexOf( ";", index); if (countend == -1) { countend = document.cookie.length; } document.cookie = cookieName + "=" + value + ";expires=" + cookieDate(secs) + ";path=" + getPath('P'); } if (!document.cookie) { alert("Figyelem, a regisztrációhoz a cookiek engedélyezése szükséges!") } } else { document.cookie = cookieName + "=" + value + ";expires=" + cookieDate(-60) + ";path=" + getPath('P'); if (dbg) alert('Cookie törölve...' + cookieName + "=" + value + ";expires=" + cookieDate(-60)); alert('Köszönjük, hogy meglátogatta fórumunkat! \n Ön sikeresen kijelentkezett.'); } } //********************************************************************************************************************** // function getCookie(cookieName) //********************************************************************************************************************** function getCookie(cookieName) { if(document.cookie) { index = document.cookie.indexOf(cookieName); } else { index = -1; } if (dbg) alert('getCookie.index=' + index + '.....' + document.cookie); if (index == -1) { return(false); } else { return(true); } } //********************************************************************************************************************** // function readCookie(cookieName) //********************************************************************************************************************** function readCookie(cookieName) { var search = cookieName + "=" var tx; if (dbg) alert('readCookie=' + cookieName); if (document.cookie.length > 0) { if (dbg) alert('readCookie= van cookie'); offset = document.cookie.indexOf(search) if (offset != -1) { if (dbg) alert('readCookie=' + document.cookie); offset += search.length end = document.cookie.indexOf(";", offset) if (end == -1) end = document.cookie.length tx = document.cookie.substring(offset, end); if (dbg) alert('readCookie...offset=' + String(offset) + '...end=' + String(end) + '...tx=' + tx); return unescape(tx) } } } //********************************************************************************************************************** // function modifyPwd() //********************************************************************************************************************** function modifyPwd() { if (validateRegistration('P')) { var database = getElement('DBPath').value; var loc = opener.location; var orig_url = loc.href; var qs = getElement('User').value + "&" + getElement('Password_1').value + ">" + loc.href + '<' + opener.document.cookie; var url = getPath() + "/_reg_modifyPwd?OpenAgent&" + encode(qs); if (dbg) alert('modifyPwd...' + qs); doCookie('User', escape(getElement('User').value)); // window.close(); window.location.replace(url); } } //********************************************************************************************************************** // function validateRegistration(mode) //********************************************************************************************************************** function validateRegistration(mode) { form = document.forms[0]; var t1 = form.User; var t2 = form.Password_1; var t3 = form.Password_2; var mess1 = 'A nevet kötelező kitölteni!'; var mess2 = (mode == 'R' || mode == 'N') ? 'Az email címet kötelező kitölteni!' : 'Az új jelszót kötelező kitölteni!'; var mess3 = (mode == 'R') ? 'Az email cím megerősítését kötelező kitölteni!' : 'Az új jelszó megerősítését kötelező kitölteni!'; var mess4 = (mode == 'R') ? 'Az email címek nem egyeznek!' : 'A jelszavak nem egyeznek!'; if (dbg) alert('validateRegistration...' + mess2); if (t1.value.length < 1) { alert(mess1); t1.focus(); return false; } if (t2.value.length < 1) { alert(mess2); t2.focus(); return false; } if (mode == 'P' || mode == 'R') { if (t3.value.length < 1) { alert(mess3); t3.focus(); return false; } if (t2.value != t3.value) { alert(mess4); return false; } } return true; } //********************************************************************************************************************** // function validateLogin() //********************************************************************************************************************** function validateLogin() { var t1 = getElement('User'); var t2 = getElement('Password'); if (t1.value.length < 1) { alert('A nevet kötelező kitölteni!'); t1.focus(); return false; } if (t2.value.length < 1) { alert('A jelszót kötelező kitölteni!'); t2.focus(); return false; } return true; } //********************************************************************************************************************** // function validateInput() //********************************************************************************************************************** function validateInput() { if (dbg) alert(this.name); // var t1 = getElement('Subject'); var t2 = getElement('body'); var t3 = getElement('AUTO'); // if (t1.value.length < 1) // { // alert('Cím nélkül a lap nem menthető el!'); // t1.focus(); // return false; // } if (t2.value.length < 1) { alert('Kérjük üresen ne küldje el az adatlapot!'); t2.focus(); return false; } if (t3.value == '-1') { alert('Nana, így nem szabad!!!!'); return false; } return true; } //********************************************************************************************************************** // function openLogin() //********************************************************************************************************************** function openLogin() { if (validateLogin()) { var database = getElement('DBPath').value; var loc = opener.location; var orig_url = loc.href; var qs = getElement('User').value + "&" + getElement('Password').value + ">" + loc.href + '<' + opener.document.cookie; var url = getPath() + "/_reg_Login?OpenAgent&" + encode(qs); if (dbg) alert(qs); window.close(); loc.replace(url); } } //********************************************************************************************************************** // function setSubjectFocus() //********************************************************************************************************************** function setSubjectFocus() { if ((navigator.userAgent.indexOf('Lotus') == -1) && (getElement('AUTO').value == '1')) { getElement('Subject').focus(); } } //********************************************************************************************************************** // function changePwd() //********************************************************************************************************************** function changePwd() { if (validateLogin()) { var database = getElement('DBPath').value; var loc = opener.location; var orig_url = loc.href; var qs = getElement('User').value + "&" + getElement('Password').value + ">" + loc.href + '<' + opener.document.cookie; var url = getPath() + "/_reg_changePwd?OpenAgent&" + encode(qs); if (dbg) alert(qs); doCookie('User', escape(getElement('User').value)); // window.close(); window.location.replace(url); } } //********************************************************************************************************************** // function changePwd() //********************************************************************************************************************** function changePwd() { if (validateLogin()) { var database = getElement('DBPath').value; var loc = opener.location; var orig_url = loc.href; var qs = getElement('User').value + "&" + getElement('Password').value + ">" + loc.href + '<' + opener.document.cookie; var url = getPath() + "/_reg_changePwd?OpenAgent&" + encode(qs); if (dbg) alert(qs); doCookie('User', escape(getElement('User').value)); // window.close(); window.location.replace(url); } } //********************************************************************************************************************** // function createNewPwd() //********************************************************************************************************************** function createNewPwd() { if (validateRegistration('N')) { var database = getElement('DBPath').value; var loc = opener.location; var orig_url = loc.href; var qs = getElement('User').value + "&" + getElement('Password_1').value + ">" + loc.href + '<' + opener.document.cookie; var url = getPath() + "/_reg_newPassword?OpenAgent&" + encode(qs); if (dbg) alert(qs); doCookie('User', escape(getElement('User').value)); // window.close(); window.location.replace(url); } } //********************************************************************************************************************** // function newPassword() //********************************************************************************************************************** function newPassword() { // var loc = opener.location; // var orig_url = loc.href; var url = getPath() + "/_REG_NEWPWD?OpenForm"; if (dbg) alert('newPassword...' + qs); win = openwin('/_REG_NEWPWD?OpenForm'); } //********************************************************************************************************************** // function Login(form, unid, url, mode) //********************************************************************************************************************** function Login(form, unid, url, mode) { var tmp = form + '&' + unid + '&' + url + '&' + mode; if (dbg) alert('Login...' + tmp); doCookie('Login', encode(tmp)); openwin('/_REG_LOGIN?OpenForm&' + encode(tmp), 'wLogin', 350, 180); } //********************************************************************************************************************** // function createLoginForm(mode) //********************************************************************************************************************** function createLoginForm(mode) { var form = getElement('Form').value; var unid = getElement('DocUNID').value; var url = window.location.href; var tmp = form + '&' + unid + '&' + url + '&' + mode; var ck; if (dbg) alert('createLoginForm...' + tmp); doCookie('Login', encode(tmp)); if (getCookie('Register')) { if (mode == 'L') { alert('Ön már bejelentkezett !'); } else { ck = readCookie('Register'); ck = Word(ck, '!', 2); tmp = ck + '&' + tmp; if (dbg) alert('createLoginForm...' + tmp); if (form == 'T' || form == 'V') { href = getPath() + '/Create_Form?OpenAgent&' + encode(tmp); window.location.replace(href); } else { href = '/Create_Form?OpenAgent&' + encode(tmp); openwin(href, 'Topic', 795, 500, true); } } } else { Login(form, unid, url, mode); } } //********************************************************************************************************************** // function successfullLogin(key, form, unid, url, mode) //********************************************************************************************************************** function successfullLogin(key, form, unid, url, mode) { var tmp = key + '&' + form + '&' + unid + '&' + url; if (dbg) alert('successfullLogin...' + tmp); doCookie('Register', 'validated!' + escape(key)); if (mode == 'L') { window.location.replace(getPath() + '/html/options'); return true; } else { if (form == 'T' || form == 'V') { href = getPath() + '/Create_Form?OpenAgent&' + encode(tmp); window.location.replace(href); } else { window.location.replace(url); href = '/Create_Form?OpenAgent&' + encode(tmp); openwin(href, 'Topic', 795, 500, true); } } } //********************************************************************************************************************** // function openDoc(docid) //********************************************************************************************************************** function openDoc(docid) { openwin('/0/' + docid + '?OpenDocument', 'Topic', 795, 500, true); } //********************************************************************************************************************** // function openReg() //********************************************************************************************************************** function openReg() { win = openwin('/_REG_REGISTER?OpenForm'); } //********************************************************************************************************************** // function Registration() //********************************************************************************************************************** function createReg() { if (validateRegistration('R')) { var href = getPath() + '/_reg_Registration?OpenAgent'; var user = getElement('User').value; var email = getElement('Password_1').value; if (dbg) alert('createReg...href=' + href + '...User=' + user + '...email=' + email); href = href + '&' + encode(user + '&' + email); window.location.replace(href); } } //********************************************************************************************************************** // function saveDocument(doc) //********************************************************************************************************************** function saveDocument(doc) { var ref = opener.location.href var win = opener; var ww = window; var log; if (dbg) alert('saveDocument...' + doc.URL); window.close(); for (i = 0; i < 1000; i++) opener.status = 'Adatok mentése...'; //opener.location.reload(); } //********************************************************************************************************************** // Base64 // Encodes / decodes strings in the Base64 format. // @author GF // LotusScript's original author Johan Känngĺrd, http://dev.kanngard.net/ // original code by Julian Robichaux, http://www.nsftools.com/ //********************************************************************************************************************** b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' var encoded var decoded function Left(s, n) { return(String(s).substring(0, n)); } function Right(s, n) { return(String(s).substring(String(s).length - n, String(s).length)); } function Mid(s, n, m) { return(String(s).substring(n - 1, n - 1 + m)); } function Instr(s, t) { return(String(s).indexOf(t) + 1); } function Fix(n) { return(Math.floor(n)); } function Word(txt, delim, num) { var tx = txt; var tx_beg; var tx_end; var dlen; var offset; var i; dlen = delim.length; tx_end = 0; offset = 0; i = 0; do { tx = Mid(tx, tx_end, tx.length + 1 - tx_end) offset = Instr(tx, delim); i++; if (offset != 0); { tx_beg = tx_end; tx_end = offset + dlen; } } while (offset != 0 && i < num) if (offset == 0 && i != num) { return(''); } else if (offset == 0 && i == num) { return(tx); } else { return(Mid(tx, 1, tx_end - tx_beg - dlen + 2)); } } function Asc(s) { c = s.charCodeAt(0); switch (c) { case 337: c = 245; break; case 369: c = 251; break; case 336: c = 213; break; case 368: c = 219; break; } return(c); } function Chr(n) { switch (n) { case 245: n = 337; break; case 251: n = 369; break; case 213: n = 336; break; case 219: n= 368; break; } return(String.fromCharCode(n)); } function removeWhitespace(s) { // Removes line terminators, spaces, and tabs from a string s = replaceSubstring(s, unescape('%0d'), ''); s = replaceSubstring(s, unescape('%0a'), ''); s = replaceSubstring(s, unescape('%09'), ''); s = replaceSubstring(s, ' ', ''); return(s); } function replaceSubstring(s, source, target) { // Replaces s substring in a String with another substring var pos; pos = s.indexOf(source); do { if (pos == -1) { pos = -1; } else { if (pos == 0 && s.length == 1) { s = target; pos = -1; } else { s = s.substring(0, pos) + target + s.substring(pos + source.length); pos = s.indexOf(source, pos + target.length); } } } while (pos > -1); return(s) } function isBase64(s) { // check to see if the string is a well-formed Base64 string. var i; var legalString; // Check for bad string length (must be a multiple of 4) if((s.length % 4) > 0) return(false); legalString = b64chars + '='; // Check for illegal characters for (i = 0; i < s.length; i++) { if (Instr(legalString, Mid(s, i, 1)) == -1) { return(false); } } // Make sure any '=' are only at the end var p = Instr(s, '='); if (p == 0) { return(true); } else { if (p < s.length - 1) { return(false); } else { if (p == s.length - 1) { if (Right(s, 1) != '=') return(false); } } } return(true); } function encode(s) { // Base64 encodes a string. The string doesn't have to // be text-only, either. You can also encode strings of non-ASCII data, // like the contents of a binary file. If you're encoding a whole file, // make sure you break the contents into lengths divisible by three, so // you can concatenate them together properly. var decNum; var encText = ''; var chunk = ''; var i; for (i = 1; i <= s.length; i += 3) { // Pad the 3-character string with Chr(0), if needed chunk = Left(Mid(s, i, 3) + unescape('%00') + unescape('%00'), 3); // Get the number we'll use for encoding decNum = Asc(Mid(chunk, 1, 1)) * Math.pow(2, 16); decNum = decNum | (Asc(Mid(chunk, 2, 1)) * Math.pow(2, 8)); decNum = decNum | (Asc(Mid(chunk, 3, 1))); // Calculate the first 2 of 4 encoded characters encText = encText + Mid(b64chars, (Fix(decNum / Math.pow(2, 18)) & 0x3F) + 1, 1); encText = encText + Mid(b64chars, (Fix(decNum / Math.pow(2, 12)) & 0x3F) + 1, 1); // Pad with '=' as necessary when we reach the end of the string switch (s.length - i) { case 0: encText = encText + '=='; break case 1: encText = encText + Mid(b64chars, (Fix(decNum / Math.pow(2, 6)) & 0x3F) + 1, 1); encText = encText + '='; break; default: encText = encText + Mid(b64chars, (Fix(decNum / Math.pow(2, 6)) & 0x3F) + 1, 1); encText = encText + Mid(b64chars, (decNum & 0x3F) + 1, 1); } } return(encText); } function decode(s) { // Decodes a Base64 string. You should check the validity of the // string with isBase64 prior calling this function, to avoid errors. var encNum; var decText = ''; var i; s = removeWhitespace(s); for (i = 1; i <= s.length; i += 4) { // Convert the next 2 of 4 characters to a number we can decode encNum = (Instr(b64chars, Mid(s, i, 1)) - 1) * Math.pow(2, 18); encNum = encNum | ((Instr(b64chars, Mid(s, i + 1, 1)) - 1) * Math.pow(2, 12)); // Deal with trailing '=' if (Mid(s, i + 2, 1) == '=') { decText = decText + Chr(Fix(encNum / Math.pow(2, 16)) & 0xFF); } else { if (Mid(s, i + 3, 1) == '=') { encNum = encNum | ((Instr(b64chars, Mid(s, i + 2, 1)) - 1) * Math.pow(2, 6)); decText = decText + Chr(Fix(encNum / Math.pow(2, 16)) & 0xFF) decText = decText + Chr(Fix(encNum / Math.pow(2, 8)) & 0xFF) } else { encNum = encNum | ((Instr(b64chars, Mid(s, i + 2, 1)) - 1) * Math.pow(2, 6)) encNum = encNum | (Instr(b64chars, Mid(s, i + 3, 1)) - 1) decText = decText + Chr(Fix(encNum / Math.pow(2, 16)) & 0xFF) decText = decText + Chr(Fix(encNum / Math.pow(2, 8)) & 0xFF) decText = decText + Chr(encNum & 0xFF) } } } return(decText); } //***************************************************************************************** function GetView() { form = document.forms[0]; url = "/forum_datum?OpenView"; if (form == NaN) return url; if (form.Form_Name.value == "_N") { url = "/naptar_NAPTAR?OpenView"; } else if( form.Form_Name.value == "_F") { url = "/forum_datum?OpenView"; } return url; } function EditClear() { w = window.location; n = w.pathname.indexOf(".nsf"); n +=4; p = w.pathname.substr(0, n); url = GetView() if (window.confirm('Valóban eltörli a dokumentumot?')) { loc = w.protocol + "//" + w.hostname + w.pathname + "?DeleteDocument"; delwin = window.open(loc, "delwin", "z-lock=yes"); delwin.location.replace(w.protocol + "//" + w.hostname + w.pathname + "?DeleteDocument"); alert('A dokumentum törölve!'); w.replace(w.protocol + "//" + w.hostname + p + url); delwin.close() } } function Edit() { w = window.location; n = w.pathname.indexOf(".nsf"); n +=4; p = w.pathname.substr(0, n); loc = w.protocol + "//" + w.hostname + w.pathname + "?EditDocument"; w.replace(loc); } function Close() { w = window.location; n = w.pathname.indexOf(".nsf"); n +=4; p = w.pathname.substr(0, n); url = GetView() w.replace(w.protocol + "//" + w.hostname + p + url); } function Save() { w = window.location; n = w.pathname.lastIndexOf("/"); n +=4; p = w.pathname.substr(n); p = '3870b4ae051a99e3c1256e7a005d2b4f/$V5ACTIONS/0.178'; return _doClick(p, this, null) }