const char *WebVisionVCA_js= "\n" "//OpenSCADA system module UI.WebVision file: VCA.js\n" "/***************************************************************************\n" " * Copyright (C) 2007-2021 by Roman Savochenko, *\n" " * *\n" " * This program is free software; you can redistribute it and/or modify *\n" " * it under the terms of the GNU General Public License as published by *\n" " * the Free Software Foundation; version 2 of the License. *\n" " * *\n" " * This program is distributed in the hope that it will be useful, *\n" " * but WITHOUT ANY WARRANTY; without even the implied warranty of *\n" " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *\n" " * GNU General Public License for more details. *\n" " * *\n" " * You should have received a copy of the GNU General Public License *\n" " * along with this program; if not, write to the *\n" " * Free Software Foundation, Inc., *\n" " * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *\n" " ***************************************************************************/\n" "\n" "var MOD_ID = 'WebVision';\n" "var isNN = navigator.appName.indexOf('Netscape') != -1;\n" "var isIE = navigator.appName.indexOf('Microsoft') != -1;\n" "var isOpera = navigator.appName.indexOf('Opera') != -1;\n" "var isKonq = navigator.userAgent.indexOf('Konqueror') != -1;\n" "var mainTmId = 0;\n" "var gPrms = window.location.search || '';\n" "var tmClearEdit = 10; //Clear time of line edit fields, seconds\n" "var tmFullUpd = 5; //Full tree updating time,seconds\n" "var tmAlrmUpd = 0.5; //Alarms updating time, seconds\n" "var limTblItmCnt = 300; //Limit of the table item content\n" "\n" "/***************************************************\n" " * pathLev - Path parsing function. *\n" " ***************************************************/\n" "pathLev.off = 0;\n" "function pathLev( path, level, scan )\n" "{\n" " var an_dir = scan ? pathLev.off : 0;\n" " var t_lev = 0;\n" " var t_dir;\n" " while(an_dir < path.length && path.charAt(an_dir) == '/') an_dir++;\n" " if(an_dir >= path.length) return '';\n" " while(true) {\n" " t_dir = path.indexOf('/', an_dir);\n" " if(t_dir < 0) { pathLev.off = path.length; return (t_lev==level)?path.substr(an_dir):''; }\n" " if(t_lev == level) { pathLev.off = t_dir; return path.substr(an_dir,t_dir-an_dir); }\n" " an_dir = t_dir;\n" " t_lev++;\n" " while(an_dir < path.length && path.charAt(an_dir) == '/') an_dir++;\n" " }\n" "}\n" "\n" "/***************************************************\n" " * noSpace - Get no space (trimmed) string *\n" " ***************************************************/\n" "function noSpace( str )\n" "{\n" " var posSt = -1; var posEnd = 0;\n" " for(var i = 0; i < str.length; i++)\n" " if(str[i] != ' ') { if(posSt<0) posSt = i; posEnd = i; }\n" " return (posSt>=0) ? str.substr(posSt,posEnd-posSt+1) : '';\n" "}\n" "\n" "/***************************************************\n" " * i2s - integer to string *\n" " ***************************************************/\n" "function i2s( vl, base, len )\n" "{\n" " rez = vl.toString(base);\n" " if(len) while(rez.length < len) rez = \"0\"+rez;\n" " return rez;\n" "}\n" "\n" "/***************************************************\n" " * posGetX - Get absolute position *\n" " **************************************************/\n" "function posGetX( obj, noWScrl )\n" "{\n" " var posX = 0;\n" " for( ; obj && obj.nodeName != 'BODY'; obj = obj.parentNode) {\n" " posX += (obj.style.left?parseInt(obj.style.left):0)+\n" " (obj.parentNode.style.borderLeftWidth?parseInt(obj.parentNode.style.borderLeftWidth):0)+\n" " (obj.parentNode.style.marginLeft?parseInt(obj.parentNode.style.marginLeft):0);\n" " if(obj.style.position == 'relative') posX += obj.offsetLeft;\n" " }\n" " return posX + (!noWScrl?-window.pageXOffset:0);\n" "}\n" "\n" "/***************************************************\n" " * posGetY - Get absolute position *\n" " **************************************************/\n" "function posGetY( obj, noWScrl )\n" "{\n" " var posY = 0;\n" " for( ; obj && obj.nodeName != 'BODY'; obj = obj.parentNode) {\n" " posY += (obj.style.top?parseInt(obj.style.top):0)+\n" " (obj.parentNode.style.borderTopWidth?parseInt(obj.parentNode.style.borderTopWidth):0)+\n" " (obj.parentNode.style.marginTop?parseInt(obj.parentNode.style.marginTop):0);\n" " if(obj.style.position == 'relative') posY += obj.offsetTop;\n" " posY -= obj.scrollTop;\n" " }\n" " return posY + (!noWScrl?-window.pageYOffset:0);\n" "}\n" "\n" "/***************************************************\n" " * getXmlHttp - Check and return XMLHttpRequest for*\n" " * various browsers. *\n" " ***************************************************/\n" "function getXmlHttp( )\n" "{\n" " reqO = null;\n" " if(window.XMLHttpRequest) reqO = new XMLHttpRequest();\n" " else if(window.ActiveXObject) {\n" " try { reqO = new ActiveXObject('Msxml2.XMLHTTP'); }\n" " catch(e) { reqO = new ActiveXObject('Microsoft.XMLHTTP'); }\n" " }\n" "\n" " for(iO = 0; iO < reqObjects.length; iO++) {\n" " if(reqObjects[iO] && reqObjects[iO].readyState == 4) { delete reqObjects[iO]; reqObjects[iO] = null; }\n" " if(!reqObjects[iO]) { reqObjects.splice(iO, 1); iO--; }\n" " }\n" "\n" " reqObjects.push(reqO);\n" "\n" " return reqO;\n" "}\n" "\n" "/***************************************************\n" " * realRound - Real numbers round *\n" " ***************************************************/\n" "function realRound( val, dig, toInt )\n" "{\n" " var rrRez = Math.floor(val*Math.pow(10,dig?dig:0)+0.5)/Math.pow(10,dig?dig:0);\n" " if(toInt) return Math.floor(rrRez+0.5);\n" " return rrRez;\n" "}\n" "\n" "/***************************************************\n" " * evMouseGet - Get mouse key code from event *\n" " ***************************************************/\n" "function evMouseGet( e )\n" "{\n" " if(e.which == 1) return 'Left';\n" " else if(e.which == 2) return 'Midle';\n" " else if(e.which == 3) return 'Right';\n" " return '';\n" "}\n" "\n" "/***************************************************\n" " * evKeyGet - Get key code from event *\n" " ***************************************************/\n" "function evKeyGet( e )\n" "{\n" " if((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 65 && e.keyCode <= 90))\n" " return String.fromCharCode(e.keyCode);\n" " switch(e.keyCode) {\n" " case 27: return 'Esc';\n" " case 8: return 'BackSpace';\n" " case 13: return 'Enter';\n" " case 45: return 'Insert';\n" " case 19: return 'Pause';\n" " case 36: return 'Home';\n" " case 35: return 'End';\n" " case 37: return 'Left';\n" " case 38: return 'Up';\n" " case 39: return 'Right';\n" " case 40: return 'Down';\n" " case 33: return 'PageUp';\n" " case 34: return 'PageDown';\n" " case 112: return 'F1';\n" " case 113: return 'F2';\n" " case 114: return 'F3';\n" " case 115: return 'F4';\n" " case 116: return 'F5';\n" " case 117: return 'F6';\n" " case 118: return 'F7';\n" " case 119: return 'F8';\n" " case 120: return 'F9';\n" " case 121: return 'F10';\n" " case 122: return 'F11';\n" " case 123: return 'F12';\n" " case 32: return 'Space';\n" " case 59: return 'Semicolon';\n" " case 61: return 'Equal';\n" " }\n" " if(isNN) switch(e.keyCode) {\n" " case 46: return 'Delete';\n" " case 44: return 'Print';\n" " case 192: return 'Apostrophe';\n" " case 106: return 'Asterisk';\n" " case 107: return 'Plus';\n" " case 188: return 'Comma';\n" " case 109: return 'Minus';\n" " case 190: return 'Period';\n" " case 220: return 'Slash';\n" " case 219: return 'BracketLeft';\n" " case 191: return 'BackSlash';\n" " case 221: return 'BracketRight';\n" " case 222: return 'QuoteLeft';\n" " }\n" " else switch(e.keyCode) {\n" " case 127: return 'Delete';\n" " case 96: return 'Apostrophe';\n" " case 42: return 'Asterisk';\n" " case 43: return 'Plus';\n" " case 44: return 'Comma';\n" " case 45: return 'Minus';\n" " case 46: return 'Period';\n" " case 92: return 'Slash';\n" " case 91: return 'BracketLeft';\n" " case 47: return 'BackSlash';\n" " case 93: return 'BracketRight';\n" " case 39: return 'QuoteLeft';\n" " }\n" " return '#'+e.keyCode.toString(16);\n" "}\n" "\n" "/***************************************************\n" " * servGet - XML get request to server *\n" " ***************************************************/\n" "function servGet( adr, prm, callBack, callBackPrm )\n" "{\n" " var req = getXmlHttp();\n" " req.open('GET', encodeURI('/'+MOD_ID+adr+(gPrms.length?gPrms+'&':'?')+prm), callBack ? true : false);\n" " if(callBack) {\n" " req.callBack = callBack;\n" " req.callBackPrm = callBackPrm;\n" " req.responseXML = null;\n" " req.onreadystatechange = function( ) {\n" " if(this.readyState != 4) return;\n" " if(this.status != 200) window.location.reload();\n" " else if(this.responseXML && this.responseXML.childNodes.length) {\n" " this.responseXML.childNodes[0].callBackPrm = this.callBackPrm;\n" " this.callBack(this.responseXML.childNodes[0]);\n" " }\n" " else this.callBack(-1);\n" " };\n" " req.send(null);\n" " return null;\n" " }\n" " req.send(null);\n" " if(req.status != 200) window.location.reload();\n" " else if(req.responseXML.childNodes.length) return req.responseXML.childNodes[0];\n" "\n" " return null;\n" "}\n" "\n" "/***************************************************\n" " * servSet - XML set request to server *\n" " ***************************************************/\n" "function servSet( adr, prm, body, noWaitRez )\n" "{\n" " if(noWaitRez == null) noWaitRez = false; //!!!! Otherwise we can get of processing old events after new ones\n" " var req = getXmlHttp();\n" " req.open('POST', encodeURI('/'+MOD_ID+adr+(gPrms.length?gPrms+'&':'?')+prm), noWaitRez);\n" " try {\n" " req.responseXML = null;\n" " req.send(body);\n" " if(!noWaitRez && req.status == 200 && req.responseXML.childNodes.length)\n" " return req.responseXML.childNodes[0];\n" " else if(req.status == 404) window.location.reload();\n" " //if(mainTmId) clearTimeout(mainTmId);\n" " //mainTmId = setTimeout(makeUI, 1000);\n" " } catch(e) { window.location.reload(); /*window.location = '/'+MOD_ID;*/ }\n" "\n" " return null;\n" "}\n" "\n" "/***************************************************\n" " * getWAttr - request page/widget attribute *\n" " ***************************************************/\n" "function getWAttr( wId, attr )\n" "{\n" " var rNode = servGet(wId, 'com=attr&attr='+attr);\n" " if(!rNode) return null;\n" "\n" " return rNode.textContent;\n" "}\n" "\n" "/***************************************************\n" " * setWAttrs - set page/widget attributes *\n" " ***************************************************/\n" "function setWAttrs( wId, attrs, val )\n" "{\n" " var body = '';\n" " if(typeof(attrs) == 'string')\n" " body += ''+((typeof(val)=='string')?val.replace(new RegExp('&','g'),'&').replace(new RegExp('<','g'),'<').replace(new RegExp('>','g'),'>'):val)+'';\n" " else for(var i in attrs)\n" " body += ''+((typeof(attrs[i])=='string')?attrs[i].replace(new RegExp('&','g'),'&').replace(new RegExp('<','g'),'<').replace(new RegExp('>','g'),'>'):attrs[i])+'';\n" " body += '';\n" "\n" " servSet(wId, 'com=attrs', body);\n" "}\n" "\n" "/***************************************************\n" " * getFont( fStr, fSc, opt ) - Parse font *\n" " * opt - options: 1-punkts; 2-return size *\n" " ***************************************************/\n" "function getFont( fStr, fSc, opt )\n" "{\n" " var rez = '';\n" " if(fStr) {\n" " var allFnt = fStr.split(' ');\n" " if(opt == 2) return (parseInt(allFnt[1])*(fSc?fSc:1)).toFixed(0);\n" " if(allFnt.length >= 1) rez += 'font-family: ' + allFnt[0].replace(/_/g,' ') + '; ';\n" " if(allFnt.length >= 2) rez += 'font-size: ' + (parseInt(allFnt[1])*(fSc?fSc:1)).toFixed(0) + (opt==1?'pt; ':'px; ');\n" " if(allFnt.length >= 3) rez += 'font-weight: ' + (parseInt(allFnt[2])?'bold':'normal') + '; ';\n" " if(allFnt.length >= 4) rez += 'font-style: ' + (parseInt(allFnt[3])?'italic':'normal') + '; ';\n" " if(allFnt.length >= 5 && parseInt(allFnt[4])) rez += 'text-decoration: underline; ';\n" " else if(allFnt.length >= 6 && parseInt(allFnt[5])) rez += 'text-decoration: line-through; ';\n" " }\n" "\n" " return rez;\n" "}\n" "\n" "/***************************************************\n" " * getFontCond( fStr, fSc, opt ) - Parse font *\n" " * opt - options: 1-punkts; 2-return size *\n" " ***************************************************/\n" "function getFontCond( fStr, fSc, opt )\n" "{\n" " fontCfg = \"\";\n" " if(fStr) {\n" " allFnt = fStr.split(\" \");\n" " if(allFnt.length >= 3 && parseInt(allFnt[2])) fontCfg += \"bold \";\n" " if(allFnt.length >= 4 && parseInt(allFnt[3])) fontCfg += \"italic \";\n" " if(allFnt.length >= 2) fontCfg += (parseInt(allFnt[1])*(fSc?fSc:1)).toFixed(0) + (opt==1?\"pt \":\"px \");\n" " if(allFnt.length >= 1) fontCfg += allFnt[0].replace(/_/g,\" \") + \" \";\n" " }\n" "\n" " return fontCfg;\n" "}\n" "\n" "/***************************************************\n" " * getColor - Parse color *\n" " ***************************************************/\n" "function getColor( cStr, getOpacity )\n" "{\n" " var fPos = cStr.indexOf('-');\n" " if(getOpacity) return (fPos >= 0) ? Math.max(0,Math.min(255,parseFloat(cStr.slice(fPos+1))/255)) : 1;\n" " return (fPos >= 0) ? cStr.slice(0,fPos) : cStr;\n" "}\n" "\n" "/*****************************************************\n" " * chkPattern - Check for allow expression to pattern *\n" " *****************************************************/\n" "function chkPattern( val, patt )\n" "{\n" " //Check by regular expression\n" " if(patt.length > 2 && patt.charAt(0) == '/' && patt.charAt(patt.length-1) == '/')\n" " return (new RegExp(patt.slice(1,patt.length-1),'')).test(val);\n" "\n" " //Check by simple pattern\n" " var mult_s = false;\n" " var v_cnt = 0, p_cnt = 0;\n" " var v_bck = -1, p_bck = -1;\n" "\n" " while(true) {\n" " if(p_cnt >= patt.length) return true;\n" " if(patt.charAt(p_cnt) == '?') { v_cnt++; p_cnt++; mult_s = false; continue; }\n" " if(patt.charAt(p_cnt) == '*') { p_cnt++; mult_s = true; v_bck = -1; continue; }\n" " if(patt.charAt(p_cnt) == '\\\\') p_cnt++;\n" " if(v_cnt >= val.length) break;\n" " if(patt.charAt(p_cnt) == val.charAt(v_cnt)) {\n" " if(mult_s && v_bck < 0) { v_bck = v_cnt+1; p_bck = p_cnt; }\n" " v_cnt++; p_cnt++;\n" " }\n" " else {\n" " if(mult_s) {\n" " if(v_bck >= 0) { v_cnt = v_bck; p_cnt = p_bck; v_bck = -1; }\n" " else v_cnt++;\n" " }\n" " else break;\n" " }\n" " }\n" " return false;\n" "}\n" "\n" "/***************************************************\n" " * getTabIndex - Calculate the absolute tab index *\n" " ***************************************************/\n" "function getTabIndex( wdgO, origPos )\n" "{\n" " for(pow = 1, curPar = wdgO.parent; curPar; curPar = curPar.parent)\n" " if(curPar.wPos >= 0) { origPos += curPar.wPos*Math.pow(100,pow); pow++; }\n" "\n" " return origPos;\n" "}\n" "\n" "/***************************************************\n" " * setFocus - Command for set focus *\n" " ***************************************************/\n" "function setFocus( wdg, onlyClr )\n" "{\n" " if(masterPage.focusWdf && masterPage.focusWdf == wdg) return;\n" "\n" " var attrs = new Object();\n" " if(masterPage.focusWdf) { attrs.focus = '0'; attrs.event = 'ws_FocusOut'; setWAttrs(masterPage.focusWdf,attrs); }\n" " masterPage.focusWdf = wdg;\n" " if(!onlyClr) { attrs.focus = '1'; attrs.event = 'ws_FocusIn'; setWAttrs(masterPage.focusWdf,attrs); }\n" "}\n" "\n" "/****************************************************************************\n" " * PageObj pgCacheGet( addr ) - Getting for the page from the cache. *\n" " * addr - address of the page. *\n" " ***************************************************************************/\n" "function pgCacheGet( addr )\n" "{\n" " for(iPg = 0; iPg < pgCache.length; iPg++)\n" " if(pgCache[iPg].addr == addr)\n" " return pgCache.splice(iPg,1)[0];\n" " return null;\n" "}\n" "\n" "/*********************************************************************\n" " * pgCacheProc( page ) - Processing the cache for the or *\n" " * the lifetime fo null *\n" " * addr - address of the page. *\n" " *********************************************************************/\n" "function pgCacheProc( page )\n" "{\n" " if(page) { pgCache.unshift(page); page.cacheTm = (new Date()).getTime()/1000; }\n" " //Removing the limited pages\n" " for(iPg = pgCache.length-1; iPg >= 0; iPg--)\n" " if((cachePgLife > 0.01 && ((((new Date()).getTime()/1000)-pgCache[iPg].cacheTm) > cachePgLife*60*60)) ||\n" " (cachePgSz && pgCache.length > cachePgSz))\n" " delete pgCache.splice(iPg,1)[0];\n" " else break;\n" "}\n" "\n" "/**********************************************************\n" " * callPage - call page 'pgId' for open update and other. *\n" " **********************************************************/\n" "function callPage( pgId, updWdg, pgGrp, pgOpenSrc )\n" "{\n" " if(!pgId) return true;\n" "\n" " //Checking and updating the presented pages\n" " if(this == masterPage)\n" " if((opPg=this.findOpenPage(pgId))) {\n" " opPg.fullUpdCnt = opPg.fullUpdCnt ? Math.max(0,opPg.fullUpdCnt-planePer) : tmFullUpd;\n" " if(updWdg || !opPg.fullUpdCnt)\n" " servGet(pgId, 'com=attrsBr&FullTree='+(opPg.fullUpdCnt?0:1)+'&tm='+tmCnt, makeEl, opPg);\n" " return true;\n" " }\n" "\n" " //Checking pages before opening\n" " if(!pgGrp || !pgOpenSrc) {\n" " reqPgGen = \"\"+\n" " \"\"+\n" " \"\";\n" " // For per-page notification\n" " for(iNtf = 0; iNtf < 8; iNtf++)\n" " reqPgGen += \"\"+\n" " \"\";\n" " reqPgGen += \"\";\n" " reqPgGen = servSet(\"/UI/VCAEngine\"+pgId, 'com=com', reqPgGen, false);\n" " pgGrp = reqPgGen.childNodes[0].textContent;\n" " pgOpenSrc = reqPgGen.childNodes[1].textContent;\n" " }\n" "\n" " //Creating/replacing the main page\n" " if(this == masterPage && (!this.addr.length || pgGrp == 'main' || pgGrp == this.attrs['pgGrp'])) {\n" " if(this.addr.length) {\n" " servSet(this.addr, 'com=pgClose&cacheCntr', '');\n" " this.pwClean(true);\n" " document.body.removeChild(this.window);\n" " }\n" " this.addr = pgId;\n" " this.place = document.createElement('div');\n" " this.place.setAttribute('id', 'mainCntr');\n" "\n" " //Get and activate for specific attributes to the master-page\n" " servSet(\"/UI/VCAEngine\"+this.addr, 'com=com', \"\"+\n" " \"\"+\n" " \"\"+\n" " \"\"+\n" " \"\");\n" "\n" " this.makeEl(servGet(pgId,'com=attrsBr'), false, true);\n" " var centerTag = document.createElement('center');\n" " centerTag.appendChild(this.place);\n" " document.body.appendChild(centerTag);\n" " this.window = centerTag;\n" " //Set project's icon and RunTime page title\n" " document.getElementsByTagName('link')[0].setAttribute('href',location.pathname+'?com=ico');\n" " return true;\n" " }\n" "\n" " //Find for included pages creation\n" " for(var i in this.wdgs)\n" " if(this.wdgs[i].attrs['root'] == 'Box' && this.wdgs[i].isVisible) {\n" " if(pgGrp == this.wdgs[i].attrs['pgGrp']) {\n" " if(pgId != this.wdgs[i].attrs['pgOpenSrc']) {\n" " //this.wdgs[i].attrs['pgOpenSrc'] = pgId;\n" " //this.wdgs[i].makeEl(null, true);\n" " // Changing the pages only through 'pgOpenSrc' but the source page direct update may cause collisions on fast switching\n" " setWAttrs(this.wdgs[i].addr, 'pgOpenSrc', pgId);\n" " }\n" " return true;\n" " }\n" " if(this.wdgs[i].inclOpen && this.wdgs[i].pages[this.wdgs[i].inclOpen].callPage(pgId,updWdg,pgGrp,pgOpenSrc)) return true;\n" " }\n" " //Put checking to child pages\n" " for(var i in this.pages)\n" " if(this.pages[i].callPage(pgId,updWdg,pgGrp,pgOpenSrc)) return true;\n" " //Check for open child page or for unknown and empty source pages open as master page child windows\n" " if((!pgGrp.length && pgOpenSrc == this.addr) || this == masterPage) {\n" " var iPg = new pwDescr(pgId, true, this);\n" " var attrBrVal = servGet(pgId, 'com=attrsBr');\n" "\n" " var winName = null;\n" " var winWidth = 600;\n" " var winHeight = 400;\n" " for(var iCh = 0; iCh < attrBrVal.childNodes.length; iCh++)\n" " if(attrBrVal.childNodes[iCh].nodeName != 'el') continue;\n" " else if(attrBrVal.childNodes[iCh].getAttribute('id') == 'name') winName = attrBrVal.childNodes[iCh].textContent;\n" " else if(attrBrVal.childNodes[iCh].getAttribute('id') == 'geomW') winWidth = parseInt(attrBrVal.childNodes[iCh].textContent);\n" " else if(attrBrVal.childNodes[iCh].getAttribute('id') == 'geomH') winHeight = parseInt(attrBrVal.childNodes[iCh].textContent);\n" "\n" " //New external
window create\n" " if(winWidth < parseInt(masterPage.attrs['geomW']) && winHeight < parseInt(masterPage.attrs['geomH'])) {\n" " iPg.window = document.createElement('table');\n" " iPg.window.iPg = iPg;\n" " iPg.window.id = \"gen-pnl-dlg\";\n" " iPg.window.setAttribute('cellspacing', '0');\n" " iPg.window.setAttribute('style','left: '+((parseInt(masterPage.attrs['geomW'])-winWidth-5)/2)+'px; '+\n" " 'top: '+((parseInt(masterPage.attrs['geomH'])-winHeight-18)/2)+'px; ');\n" " iPg.window.innerHTML = \"\"+\n" " \" \"+winName+\"\"+\n" " \" X\\n\"+\n" " \"
\";\n" " document.getElementById('mainCntr').appendChild(iPg.window);\n" " iPg.place = iPg.window.rows[1].cells[0].children[0];\n" " }\n" " //New external window create\n" " else {\n" " iPg.window = window.open('about:blank',pgId,'width='+(winWidth+20)+',height='+(winHeight+60)+\n" " ',directories=no,menubar=no,toolbar=no,scrollbars=yes,dependent=yes,location=no,locationbar=no,status=no,statusbar=no,alwaysRaised=yes');\n" " if(!iPg.window) return true;\n" " iPg.window.document.open();\n" " iPg.window.document.write(\"
\\n\");\n" " iPg.window.document.close();\n" " iPg.window.document.title = winName;\n" " var mainDiv = iPg.window.document.getElementById('main');\n" " iPg.place = mainDiv;\n" " iPg.windowExt = true;\n" " }\n" "\n" " this.pages[iPg.addr] = iPg;\n" " iPg.makeEl(attrBrVal, false, true);\n" "\n" " return true;\n" " }\n" "\n" " return false;\n" "}\n" "\n" "function findOpenPage( pgId )\n" "{\n" " var opPg;\n" " if(pgId == this.addr) return this;\n" " //Check from included widgets\n" " for(var i in this.wdgs)\n" " if(this.wdgs[i].attrs['root'] == 'Box' && this.wdgs[i].isVisible) {\n" " if(pgId == this.wdgs[i].attrs['pgOpenSrc']) return this.wdgs[i].pages[pgId];\n" " if(this.wdgs[i].inclOpen) {\n" " opPg = this.wdgs[i].pages[this.wdgs[i].inclOpen].findOpenPage(pgId);\n" " if(opPg) return opPg;\n" " }\n" " }\n" " //Put checking to child pages\n" " for(var i in this.pages) {\n" " opPg = this.pages[i].findOpenPage(pgId);\n" " if(opPg) return opPg;\n" " }\n" "\n" " return null;\n" "}\n" "\n" "function makeEl( pgBr, inclPg, full, FullTree )\n" "{\n" " //Callback processing\n" " if(pgBr) {\n" " if(pgBr == -1) { window.location.reload(true); return; } //Try to restore the connection\n" " if(pgBr.getAttribute('FullTree')) FullTree = parseInt(pgBr.getAttribute('FullTree'));\n" " if(pgBr.callBackPrm) {\n" " elO = pgBr.callBackPrm; pgBr.callBackPrm = null;\n" " elO.makeEl(pgBr, inclPg, full, FullTree);\n" " return;\n" " }\n" " }\n" "\n" " //Main processing\n" " var margBrdUpd = false; var newAttr = false;\n" " this.place.wdgLnk = this;\n" " if(!inclPg && pgBr) {\n" " //Clear modify flag for all\n" " for(var aId in this.attrsMdf) this.attrsMdf[aId] = false;\n" " //Updated attributes\n" " for(var iCh = 0; iCh < pgBr.childNodes.length; iCh++) {\n" " if(pgBr.childNodes[iCh].nodeName != 'el') continue;\n" " var aId = pgBr.childNodes[iCh].getAttribute('id');\n" " if((aId == 'bordWidth' || aId == 'geomMargin') && (!this.attrs[aId] || this.attrs[aId] != pgBr.childNodes[iCh].textContent)) margBrdUpd = true;\n" " this.attrsMdf[aId] = !this.attrs[aId] || this.attrs[aId] != pgBr.childNodes[iCh].textContent;\n" " if(this.attrsMdf[aId]) { this.attrs[aId] = pgBr.childNodes[iCh].textContent; newAttr = true; }\n" " }\n" " }\n" "\n" " if(newAttr || inclPg || !pgBr) {\n" " var elWr = (parseInt(this.attrs['active']) && parseInt(this.attrs['perm'])&SEC_WR);\n" " var elMargin = parseInt(this.attrs['geomMargin']);\n" " var elBorder = 0;\n" " if(this.attrs['bordWidth']) elBorder = parseInt(this.attrs['bordWidth']);\n" " var elStyle = '';\n" " this.isVisible = true;\n" " if(!(parseInt(this.attrs['en']) && (this.pg || parseInt(this.attrs['perm'])&SEC_RD)))\n" " { elStyle += 'visibility : hidden; '; this.isVisible = false; }\n" " var geomX = parseFloat(this.attrs['geomX']);\n" " var geomY = parseFloat(this.attrs['geomY']);\n" " if(this.pg) { geomX = geomY = 0; elStyle += 'overflow: hidden; '; }\n" " else { geomX *= this.parent.xScale(true); geomY *= this.parent.yScale(true); }\n" " if(this.parent && !(this.pg && this.parent.pg)) {\n" " geomX -= parseInt(this.parent.attrs['geomMargin'])+parseInt(this.parent.attrs['bordWidth']);\n" " geomY -= parseInt(this.parent.attrs['geomMargin'])+parseInt(this.parent.attrs['bordWidth']);\n" " }\n" " elStyle += 'position: '+((this==masterPage || this.window)?'relative':'absolute')+'; '+\n" " 'left: '+realRound(geomX)+'px; top: '+realRound(geomY)+'px; '+\n" " 'pointer-events: '+((elWr||this == masterPage)?'all':'none')+'; ';\n" "\n" " // Calculation of the main window/page scale\n" " if(this == masterPage) {\n" " sesUser = pgBr.getAttribute('user');\n" "\n" " // Own status bar reserve\n" " var toCrtStBar = false;\n" " if(!parseInt(this.attrs[\"stBarNoShow\"]) && !masterPage.status) {\n" " masterPage.status = document.createElement('div');\n" " masterPage.status.srcHeight = 25;\n" " masterPage.status.setAttribute('id', 'gen-pnl-status');\n" " this.place.appendChild(masterPage.status);\n" " toCrtStBar = true;\n" " }\n" "\n" " var geomW = parseFloat(this.attrs['geomW']);\n" " var geomH = parseFloat(this.attrs['geomH']);\n" " if(window.devicePixelRatio && window.devicePixelRatio != 1) wx_scale = wy_scale = 1;\n" " else {\n" " wx_scale = Math.max(1, window.innerWidth/geomW);\n" " wy_scale = Math.max(1, window.innerHeight/(geomH+(masterPage.status?masterPage.status.srcHeight:0)));\n" " }\n" " if(parseInt(this.attrs['keepAspectRatio']))\n" " wx_scale = wy_scale = Math.min(wx_scale, wy_scale);\n" "\n" " if(masterPage.status) {\n" " masterPage.status.height = Math.floor(masterPage.status.srcHeight*wy_scale);\n" " masterPage.status.style.top = Math.floor(geomH*wy_scale)+\"px\";\n" " masterPage.status.style.width = (Math.floor(geomW*wx_scale)-5)+\"px\";\n" " masterPage.status.style.height = (masterPage.status.height-1)+\"px\";\n" " masterPage.status.style.fontSize = Math.floor(masterPage.status.height*0.7)+\"px\";\n" "\n" " if(toCrtStBar) {\n" " stBar = \"\";\n" " if(modelStyles && parseInt(modelStyles.getAttribute('curStlId')) >= 0 && modelStyles.childNodes.length > 1) {\n" " stBar += \"\";\n" " }\n" " stBar += \"\";\n" " stBar += \"
\";\n" " stBar += \"\"+\n" " \"\";\n" " stBar += \"\"+sesUser+\"
\";\n" " masterPage.status.innerHTML = stBar;\n" " }\n" "\n" " elStyle += \"overflow: visible; \";\n" " }\n" " }\n" "\n" " var xSc = this.xScale(true);\n" " var ySc = this.yScale(true);\n" " var geomW = parseFloat(this.attrs['geomW'])*xSc;\n" " var geomH = parseFloat(this.attrs['geomH'])*ySc;\n" "\n" " this.mousedown = new Array;\n" " this.mouseup = new Array;\n" "\n" " if(this.pg && this.parent && this.parent.inclOpen && this.parent.inclOpen == this.addr) {\n" " var geomWpar = parseFloat(this.parent.attrs['geomW'])*this.parent.xScale(true);\n" " var geomHpar = parseFloat(this.parent.attrs['geomH'])*this.parent.yScale(true);\n" " this.parent.place.style.overflow = (geomW > geomWpar || geomH > geomHpar) ? 'auto' : 'hidden';\n" " geomWScrl = (geomH > geomHpar) ? 20 : 0; geomHScrl = (geomW > geomWpar) ? 20 : 0; //!!!! 20 is most scrollbar width and clientWidth does not work here\n" " geomW = Math.max(geomW, geomWpar-geomWScrl);\n" " geomH = Math.max(geomH, geomHpar-geomHScrl);\n" " }\n" " //else elStyle += 'overflow: hidden; ';\n" "\n" " geomW = realRound(geomX+geomW-xSc) - realRound(geomX) + 1;\n" " geomH = realRound(geomY+geomH-ySc) - realRound(geomY) + 1;\n" "\n" " geomW -= 2*(elMargin+elBorder);\n" " geomH -= 2*(elMargin+elBorder);\n" "\n" " //Set included window geometry to widget size\n" " //if( this == masterPage ) resizeTo(geomW,geomH);\n" " if(this.pg && this.window && this.windowExt) {\n" " if(this.window.innerHeight)\n" " this.window.resizeTo(geomW+(this.window.outerWidth-this.window.innerWidth)+20,\n" " geomH+(this.window.outerHeight-this.window.innerHeight)+20);\n" " else this.window.resizeTo(geomW+20,geomH+40);\n" " }\n" "\n" " if(this.attrs['focus'] && parseInt(this.attrs['focus'])) setFocus(this.addr, true);\n" "\n" " this.place.className = \"Primitive \" + this.attrs['root'];\n" " if(!this.place.getAttribute(\"id\"))\n" " this.place.setAttribute(\"id\", this.addr.slice(this.addr.lastIndexOf(\"/\")+1)); // this.addr.replace(\"/\"+sessId,\"\").replace(/\\//g, \"_\"));\n" "\n" " var isPrim = true;\n" " if(!(parseInt(this.attrs['perm'])&SEC_RD)) {\n" " if(this.pg) {\n" " elStyle += 'background-color: #B0B0B0; border: 1px solid black; color: red; overflow: auto; ';\n" " this.place.innerHTML = \"
###Page###: '\"+this.addr+\"'.
###View access is not permitted.###
\";\n" " }\n" " isPrim = false;\n" " }\n" " else if(this.attrs['root'] == 'ElFigure') {\n" " var toInit = !this.place.childNodes.length;\n" " var figObj = toInit ? this.place.ownerDocument.createElement('img') : this.place.childNodes[0];\n" " figObj.width = geomW; figObj.height = geomH;\n" " // Src update always therefore for any changes is shape update\n" " figObj.src = '/'+MOD_ID+this.addr+'?com=obj&tm='+tmCnt+'&geomX='+geomX.toFixed(3)+'&geomY='+geomY.toFixed(3)+\n" " '&geomW='+geomW.toFixed(3)+'&geomH='+geomH.toFixed(3)+\n" " '&xSc='+xSc.toFixed(3)+'&ySc='+ySc.toFixed(3);\n" " if(elWr != this.place.elWr) {\n" " figObj.onclick = !elWr ? null : function(e) {\n" " if(!e) e = window.event;\n" " servSet(this.wdgLnk.addr,'com=obj&sub=point&geomX='+geomX.toFixed(3)+'&geomY='+geomY.toFixed(3)+\n" " '&xSc='+xSc.toFixed(3)+'&ySc='+ySc.toFixed(3)+\n" " '&x='+(e.offsetX?e.offsetX:(e.clientX-posGetX(this)))+\n" " '&y='+(e.offsetY?e.offsetY:(e.clientY-posGetY(this)))+\n" " '&key='+evMouseGet(e),'');\n" " return false;\n" " }\n" " figObj.ondblclick = !elWr ? null : function(e) {\n" " if(!e) e = window.event;\n" " servSet(this.wdgLnk.addr,'com=obj&sub=point&geomX='+geomX.toFixed(3)+'&geomY='+geomY.toFixed(3)+\n" " '&xSc='+xSc.toFixed(3)+'&ySc='+ySc.toFixed(3)+\n" " '&x='+(e.offsetX?e.offsetX:(e.clientX-posGetX(this)))+\n" " '&y='+(e.offsetY?e.offsetY:(e.clientY-posGetY(this)))+\n" " '&key=DblClick','');\n" " }\n" " }\n" "\n" " if(toInit) {\n" " figObj.border = 0;\n" " figObj.wdgLnk = this;\n" " this.place.appendChild(figObj);\n" " //Disable drag mostly for FireFox\n" " figObj.onmousedown = function(e) { e = e?e:window.event; if(e.preventDefault) e.preventDefault(); }\n" " }\n" " }\n" " else if(this.attrs['root'] == 'Box') {\n" " if(this == masterPage && this.attrs['tipStatus'].length) { setStatus(this.attrs['tipStatus'],10000); this.attrs['tipStatus'] = \"\"; }\n" " elStyle += 'border-style: solid; border-width: '+this.attrs['bordWidth']+'px; ';\n" " if(elWr && this.attrs['backColor'].length && getColor(this.attrs['backColor'],true)) elStyle += 'cursor: pointer; ';\n" "\n" " if(this.attrs['vs_winTitle']) {\n" " if(this == masterPage || (this.pg && this.window && this.windowExt))\n" " window.document.title = this.attrs['vs_winTitle'];\n" " else if(this.pg && this.window && !this.windowExt)\n" " this.place.parentElement.offsetParent.rows[0].cells[0].innerText = this.attrs['vs_winTitle'];\n" " }\n" " if((tVl=this.attrs['userSetVis']) && !full && tVl.length && this.attrsMdf['userSetVis']) {\n" " if(tVl == '*') window.location = '/login'+window.location.pathname;\n" " else { servSet(this.addr, 'com=setUser&user='+tVl, ''); window.location.reload(); }\n" " }\n" " for(iNtf = 0; iNtf < 8; iNtf++)\n" " if((tVl=this.attrs[\"notifyVis\"+MOD_ID+iNtf]) && this.attrsMdf[\"notifyVis\"+MOD_ID+iNtf])\n" " ntfReg(iNtf, tVl, this.addr, true);\n" " else if((tVl=this.attrs[\"notify\"+iNtf]) && this.attrsMdf[\"notify\"+iNtf])\n" " ntfReg(iNtf, tVl, this.addr, false);\n" "\n" " if(!this.pg && ((this.inclOpen && this.attrs['pgOpenSrc'] != this.inclOpen) ||\n" " (!this.inclOpen && this.attrs['pgOpenSrc'].length)))\n" " {\n" " if(this.inclOpen) {\n" " servSet(this.inclOpen, 'com=pgClose&cacheCntr&cachePg', '');\n" " this.pages[this.inclOpen].pwClean();\n" "\n" " this.pages[this.inclOpen].reqTm = tmCnt;\n" " pgCacheProc(this.pages[this.inclOpen]);\n" " //this.place.removeChild(this.pages[this.inclOpen].place);\n" " while(this.place.children.length) this.place.removeChild(this.place.children[0]);\n" " this.pages[this.inclOpen].perUpdtEn(false);\n" " delete this.pages[this.inclOpen];\n" " this.inclOpen = null;\n" " }\n" " if(this.attrs['pgOpenSrc'].length) {\n" " this.inclOpen = this.attrs['pgOpenSrc'];\n" " if((pgO=pgCacheGet(this.inclOpen))) {\n" " this.pages[this.inclOpen] = pgO;\n" " this.place.appendChild(this.pages[this.inclOpen].place);\n" " this.pages[this.inclOpen].perUpdtEn(true);\n" " this.pages[this.inclOpen].makeEl(servGet(this.inclOpen, 'com=attrsBr&tm='+pgO.reqTm));\n" " }\n" " else {\n" " var iPg = new pwDescr(this.inclOpen, true, this);\n" " iPg.place = this.place.ownerDocument.createElement('div');\n" " iPg.makeEl(servGet(this.inclOpen,'com=attrsBr'), false, true);\n" "\n" " this.pages[this.inclOpen] = iPg;\n" " this.place.appendChild(iPg.place);\n" " }\n" " }\n" " }\n" " if(this.inclOpen) elStyle += 'pointer-events: all; ';\n" " this.place.wdgLnk = this;\n" " }\n" " else if(this.attrs['root'] == 'Text') {\n" " elStyle += 'border-style: solid; border-width: '+this.attrs['bordWidth']+'px; overflow: hidden; ';\n" " if(elWr && this.attrs['text'].length && this.attrs['backColor'].length && getColor(this.attrs['backColor'],true)) elStyle += 'cursor: pointer; ';\n" " if(elMargin) { elStyle += 'padding: '+elMargin+'px; '; elMargin = 0; }\n" " //if(parseInt(this.attrs['orient']) == 0) {\n" " var txtAlign = parseInt(this.attrs['alignment']);\n" " var spanStyle = \"display: table-cell; width: \"+geomW+\"px; height: \"+geomH+\"px; line-height: 1; white-space: \"+(parseInt(this.attrs[\"wordWrap\"])?\"pre-wrap\":\"pre\")+\"; \";\n" " switch(txtAlign&0x3) {\n" " case 0: spanStyle += 'text-align: left; '; break;\n" " case 1: spanStyle += 'text-align: right; '; break;\n" " case 2: spanStyle += 'text-align: center; '; break;\n" " case 3: spanStyle += 'text-align: justify; '; break;\n" " }\n" " switch(txtAlign>>2) {\n" " case 0: spanStyle += 'vertical-align: top; '; break;\n" " case 1: spanStyle += 'vertical-align: bottom; '; break;\n" " case 2: spanStyle += 'vertical-align: middle; '; break;\n" " }\n" " if(parseInt(this.attrs['orient']) != 0) spanStyle += \"transform: rotate(\"+parseInt(this.attrs['orient'])+\"deg); \";\n" " spanStyle += getFont(this.attrs['font'], Math.min(xSc, ySc));\n" " spanStyle += 'color: ' + (this.attrs['color']?getColor(this.attrs['color']):'black') + '; ';\n" " var txtVal = this.attrs['text'];\n" " for(var i = 0; i < parseInt(this.attrs['numbArg']); i++) {\n" " var argVal;\n" " var argCfg = new Array();\n" " switch(parseInt(this.attrs['arg'+i+'tp'])) {\n" " case 0:\n" " argCfg[0] = this.attrs['arg'+i+'cfg'];\n" " argVal = parseInt(this.attrs['arg'+i+'val']);\n" " if(isNaN(argVal)) argVal = 0;\n" " argVal = argVal.toString();\n" " break;\n" " case 1:\n" " argCfg = this.attrs['arg'+i+'cfg'].split(';');\n" " if(argCfg[1] == 'g') argVal = parseFloat(this.attrs['arg'+i+'val']).toPrecision(Math.max(0,argCfg[2]));\n" " else if(argCfg[1] == 'e') argVal = parseFloat(this.attrs['arg'+i+'val']).toExponential(Math.max(0,argCfg[2]));\n" " else if(argCfg[1] == 'f') argVal = parseFloat(this.attrs['arg'+i+'val']).toFixed(Math.max(0,argCfg[2]));\n" " else argVal = this.attrs['arg'+i+'val'];\n" " if(isNaN(argVal)) argVal = 0;\n" " argVal = argVal.toString();\n" " break;\n" " case 2:\n" " argCfg[0] = this.attrs['arg'+i+'cfg'];\n" " argVal = this.attrs['arg'+i+'val'];\n" " break;\n" " }\n" " var argSize = Math.max(-1000,Math.min(1000,parseInt(argCfg[0])));\n" " var argPad = '';\n" " for(var j = argVal.length; j < Math.abs(argSize); j++) argPad += ' ';// ';\n" " if(argSize > 0) argVal = argPad+argVal; else argVal += argPad;\n" " txtVal = txtVal.replace('%'+(i+1), argVal);\n" " }\n" " var spEl = this.place.children.length ? this.place.children[0] : this.place.ownerDocument.createElement('span');\n" " this.place.appendChild(spEl);\n" " if(parseInt(this.attrs['inHtml'])) spEl.innerHTML = txtVal;\n" " else spEl.innerText = txtVal;\n" " spEl.setAttribute('style', spanStyle);\n" " //this.place.innerHTML = \"\"+txtVal+\"\";\n" " //}\n" " //else this.place.innerHTML = \"\";\n" "\n" " //this.place.wdgLnk = this;\n" " }\n" " else if(this.attrs['root'] == 'Media') {\n" " elStyle += 'border-width: '+this.attrs['bordWidth']+'px; ';\n" " if(elWr && !parseInt(this.attrs['areas']) && this.attrs['src'].length && this.attrs['backColor'].length && getColor(this.attrs['backColor'],true))\n" " elStyle += 'cursor: pointer; ';\n" " if(this.place.elWr != elWr || (parseInt(this.attrs['areas']) && this.place.children.length <= 1) ||\n" " (!parseInt(this.attrs['areas']) && this.place.children.length > 1) ||\n" " ((this.attrsMdf[\"src\"] || this.attrsMdf[\"fit\"]) && this.attrs['fit'] != 1))\n" " while(this.place.children.length) this.place.removeChild(this.place.children[0]);\n" "\n" " var toInit = !this.place.children.length;\n" " if(this.attrs['type'] == 2) medObjTp = 'video';\n" " else if(this.attrs['type'] == 3) medObjTp = 'audio';\n" " else medObjTp = 'img';\n" " var medObj = toInit ? this.place.ownerDocument.createElement(medObjTp) : this.place.children[0];\n" " if(this.attrs['roll'] && (toInit || this.attrsMdf[\"roll\"])) medObj.loop = parseInt(this.attrs['roll']);\n" " if(this.attrs['pause'] && (toInit || this.attrsMdf[\"pause\"]) && parseInt(this.attrs['play'])) {\n" " if(parseInt(this.attrs['pause'])) medObj.pause();\n" " else medObj.play();\n" " }\n" " if(this.attrs['seek'] && (toInit || this.attrsMdf[\"seek\"]) && Math.abs(parseFloat(this.attrs['seek'])-medObj.currentTime) > 10)\n" " medObj.currentTime = parseFloat(this.attrs['seek']);\n" " if(this.attrs['volume'] && (toInit || this.attrsMdf[\"volume\"])) medObj.volume = parseFloat(this.attrs['volume'])/100;\n" " if(toInit || this.attrsMdf[\"src\"] || this.attrsMdf[\"fit\"] || this.attrsMdf[\"play\"] || !pgBr) {\n" " if(!this.attrs['src'].length || (this.attrs['play'] && !parseInt(this.attrs['play']))) medObj.src = \"\";\n" " else if(this.attrs['src'].indexOf(\"http://\") == 0 || this.attrs['src'].indexOf(\"https://\") == 0)\n" " medObj.src = this.attrs['src'];\n" " else medObj.src = \"/\"+MOD_ID+this.addr+\"?com=res&val=\"+this.attrs['src'];\n" " medObj.hidden = !this.attrs['src'].length;\n" " }\n" " if(this.attrs['play'] && (toInit || this.attrsMdf[\"play\"])) {\n" " if(parseInt(this.attrs['play'])) {\n" " if(toInit) medObj.autoplay = true;\n" " else medObj.play();\n" " }\n" " this.perUpdtEn(parseInt(this.attrs['play']));\n" " }\n" " if(toInit || this.attrsMdf[\"fit\"] || !pgBr) {\n" " if(this.attrs['fit'] == 1) {\n" " medObj.width = geomW; medObj.height = geomH;\n" " // Only for the type \"Image(0)\"\n" " if(this.attrs['src'].length && this.attrs['type'] == 0) medObj.src += \"&size=\"+geomH;\n" " medObj.onload = null;\n" " }\n" " else medObj.onload = function() {\n" " cWdth = this.width;\n" " cHeight = this.height;\n" " this.width = cWdth * this.wdgLnk.xScale(true);\n" " this.height = cHeight * this.wdgLnk.yScale(true);\n" " //this.style.cssText = \"top: \"+((this.parentNode.height-this.height)/2)+\"px; \"+\n" " // \"left: \"+((this.parentNode.width-this.width)/2)+\"px; \";\n" " }\n" " }\n" " if(elWr && (toInit || this.attrsMdf[\"areas\"])) {\n" " var mapObj = toInit ? this.place.ownerDocument.createElement('map') : this.place.children[1];\n" " while(mapObj.children.length) mapObj.removeChild(mapObj.children[0]);\n" " for(var i = 0; i < parseInt(this.attrs['areas']); i++) {\n" " var arObj = this.place.ownerDocument.createElement('area');\n" " switch(parseInt(this.attrs['area'+i+'shp'])) {\n" " case 0: arObj.shape = 'rect'; break;\n" " case 1: arObj.shape = 'poly'; break;\n" " case 2: arObj.shape = 'circle'; break;\n" " }\n" " arObj.coords = this.attrs['area'+i+'coord'];\n" " arObj.title = this.attrs['area'+i+'title'];\n" " arObj.href = '';\n" " arObj.areaId = i;\n" " arObj.onclick = function( ) { setWAttrs(this.wdgLnk.addr,'event','ws_MapAct'+this.areaId+'Left'); return false; }\n" " arObj.wdgLnk = this;\n" " mapObj.appendChild(arObj);\n" " }\n" " }\n" " if(toInit) {\n" " medObj.wdgLnk = this;\n" " if(this.attrs['play']) {\n" " medObj.onloadeddata = function() { setWAttrs(this.wdgLnk.addr,'size',this.duration.toFixed(1)); return false; }\n" " if(this.attrs['type'] == 2) medObj.setAttribute('style','height: inherit; width: inherit; ');\n" " }\n" " //Disable drag mostly for FireFox\n" " medObj.onmousedown = function(e) { e = e?e:window.event; if(e.preventDefault) e.preventDefault(); }\n" " medObj.border = 0;\n" " this.place.appendChild(medObj);\n" " if(elWr) {\n" " this.place.appendChild(mapObj);\n" " mapObj.name = this.addr;\n" " medObj.setAttribute('usemap','#'+this.addr);\n" " }\n" " }\n" " }\n" " else if(this.attrs['root'] == 'FormEl' && !this.place.isModify) {\n" " var elTp = parseInt(this.attrs['elType']);\n" " if(this.attrsMdf['elType'] || this.place.elWr != elWr)\n" " while(this.place.childNodes.length) this.place.removeChild(this.place.childNodes[0]);\n" "\n" " if(this.attrsMdf['font']) this.place.fontCfg = getFontCond(this.attrs['font'], Math.min(xSc,ySc));\n" " var fntSz = Math.min(geomH, (getFont(this.attrs['font'],Math.min(xSc,ySc),2)*1.4).toFixed(0));\n" " var applySz = Math.max(16, fntSz);\n" "\n" " // Processing the custom behaviour attributes\n" " bordStyle = backStyle = null;\n" " if(this.attrs['vs_border']) bordStyle = this.attrs['vs_border'];\n" " if(this.attrs['vs_background']) { //!!!! Must be moved to a separate function for the transparent background of the included items\n" " if((backClr=this.attrs['vs_background'].split(' ')[0]) && (backOp=getColor(backClr,true))) {\n" " if(backOp == 1) {\n" " backStyle = 'background-color: '+getColor(backClr)+'; ';\n" " if(this.placeTr) this.placeTr.style.cssText = elStyle;\n" " }\n" " else {\n" " backStyle = '';\n" " if(!this.placeTr) {\n" " this.placeTr = this.place.ownerDocument.createElement('div');\n" " this.place.parentNode.appendChild(this.placeTr);\n" " }\n" " this.placeTr.style.cssText = elStyle + 'width: ' + geomW + 'px; height: ' + geomH + 'px; background-color: '+getColor(backClr)+'; opacity: '+backOp+\"; z-index: \"+(parseInt(this.attrs['geomZ'])-1)+\"; \";\n" " }\n" " }\n" " if((backImg=this.attrs['vs_background'].split(' ')[1])) backStyle = (backStyle?backStyle:'') + 'background-image: url(\\'/'+MOD_ID+this.addr+'?com=res&val='+backImg+'\\'); ';\n" " }\n" "\n" " var comElMdf = (this.attrs['vs_border'] && this.attrsMdf['vs_border']) || (this.attrs['vs_background'] && this.attrsMdf['vs_background']);\n" "\n" " switch(elTp) {\n" " case 0: //Line edit\n" " var toInit = !this.place.childNodes.length;\n" " var formObj = toInit ? this.place.ownerDocument.createElement('input') : this.place.childNodes[0];\n" " if(toInit || comElMdf || this.attrsMdf['geomH'] || this.attrsMdf['geomW'] || this.attrsMdf['font']) {\n" " brdW = (bordStyle?parseInt(bordStyle):1) + 1;\n" " var geomWint = geomW - 2*brdW;\n" " formObj.className = \"LineEd\";\n" " formObj.style.cssText = 'padding: 1px; top: '+((geomH-fntSz)/2)+'px; width: '+geomWint+'px; '+\n" " 'height: '+(fntSz-brdW)+'px; font: '+this.place.fontCfg+';';\n" " formObj.style.cssText += \"border: \"+(bordStyle?bordStyle:\"1px solid gray\")+\"; \";\n" " formObj.style.cssText += (backStyle == null) ? 'background-color: white; ' : (backStyle.length?backStyle:'');\n" " }\n" " this.place.view = parseInt(this.attrs['view']);\n" " this.place.cfg = this.attrs['cfg'];\n" " if(formObj.valSet && (this.attrsMdf['value'] || this.attrsMdf['cfg'])) formObj.valSet(this.attrs['value']);\n" " if(!toInit) break;\n" " formObj.wdgLnk = this;\n" " formObj.disabled = !elWr;\n" " this.place.appendChild(formObj);\n" " if(elWr) {\n" " switch(this.place.view) {\n" " case 1: //Combo\n" " var combImg = this.place.ownerDocument.createElement('img');\n" " combImg.className = \"cntr\"; combImg.src = '/'+MOD_ID+'/img_combar';\n" " combImg.style.cssText = 'left: '+(geomW-16)+'px; top: '+((geomH-fntSz)/2)+'px; height: '+fntSz+'px; ';\n" " this.place.appendChild(combImg);\n" " formObj.style.width = (geomWint-16)+'px';\n" " combImg.onclick = function( ) {\n" " var formObj = this.parentNode.children[0];\n" " var combList = this.ownerDocument.getElementById('combomenu');\n" " if(!combList) {\n" " combList = this.ownerDocument.createElement('div');\n" " combList.id = 'combomenu';\n" " combList.appendChild(this.ownerDocument.createElement('select'));\n" " combList.childNodes[0].size = '100';\n" " combList.childNodes[0].onclick = function( ) {\n" " //this.formObj.value = this.options[this.selectedIndex].value;\n" " //this.formObj.setModify(true);\n" " this.formObj.valSet(this.options[this.selectedIndex].value);\n" " this.formObj.chApply();\n" " this.parentNode.style.visibility = 'hidden';\n" " this.parentNode.style.top = \"-100px\";\n" " }\n" " combList.childNodes[0].onblur = function( ) {\n" " this.parentNode.style.visibility = 'hidden';\n" " this.parentNode.style.top = \"-100px\";\n" " }\n" " combList.onmouseleave = function( ) { this.style.visibility = 'hidden'; this.style.top = \"-100px\"; }\n" " this.ownerDocument.body.appendChild(combList);\n" " }\n" " while(combList.childNodes[0].childNodes.length)\n" " combList.childNodes[0].removeChild(combList.childNodes[0].childNodes[0]);\n" " var elLst = formObj.parentNode.cfg.split('\\n');\n" " for(var i = 0; i < elLst.length; i++) {\n" " var optEl = this.ownerDocument.createElement('option');\n" " optEl.appendChild(this.ownerDocument.createTextNode(elLst[i]));\n" " if(formObj.valGet() == elLst[i]) optEl.defaultSelected = optEl.selected = true;\n" " combList.childNodes[0].appendChild(optEl);\n" " }\n" " if(combList.childNodes[0].childNodes.length) {\n" " combList.style.cssText = 'left: '+posGetX(formObj,true)+'px; top: '+(posGetY(formObj,true)+formObj.offsetHeight)+'px; '+\n" " 'width: '+formObj.offsetWidth+'px; height: '+(Math.min(elLst.length,10)*parseInt(this.style.height))+'px; ';\n" " combList.childNodes[0].style.cssText = 'width: '+formObj.offsetWidth+'px; height: '+(Math.min(elLst.length,10)*parseInt(this.style.height))+'px; '+\n" " 'font: '+formObj.parentNode.fontCfg+'; ';\n" " combList.childNodes[0].formObj = formObj;\n" " combList.childNodes[0].focus();\n" " }\n" " return false;\n" " }\n" " break;\n" " case 2: case 3: //Integer, Real\n" " if(this.place.childNodes.length >= 2) break;\n" " var spinImg = this.place.ownerDocument.createElement('img');\n" " spinImg.className = \"cntr\"; spinImg.src = '/'+MOD_ID+'/img_spinar';\n" " spinImg.style.cssText = 'left: '+(geomW-16)+'px; top: '+((geomH-fntSz)/2)+'px; height: '+fntSz+'px; ';\n" " spinImg.border = '0';\n" " formObj.style.width = (geomWint-16)+'px';\n" " spinImg.onclick = function(e) {\n" " if(!e) e = window.event;\n" " var formObj = this.parentNode.childNodes[0];\n" " var argCfg = this.parentNode.cfg.split(':');\n" " if((e.clientY-posGetY(this)) < fntSz/2)\n" " formObj.valSet(formObj.valGet()+((argCfg.length>2)?((this.parentNode.view==2)?parseInt(argCfg[2]):parseFloat(argCfg[2])):1), true);\n" " else formObj.valSet(formObj.valGet()-((argCfg.length>2)?((this.parentNode.view==2)?parseInt(argCfg[2]):parseFloat(argCfg[2])):1), true);\n" " formObj.setModify(true);\n" " return false;\n" " }\n" " this.place.appendChild(spinImg);\n" " break;\n" " case 4: break; //Time\n" " case 5: //Date\n" " case 6: //Date and time\n" " formObj.onclick = function( ) {\n" " if((cldrDlg=this.ownerDocument.getElementById('clndrdlg'))) cldrDlg.style.visibility = 'hidden';\n" " }\n" " var cldrImg = this.place.ownerDocument.createElement('img');\n" " cldrImg.className = \"cntr\"; cldrImg.src = '/'+MOD_ID+'/img_combar';\n" " cldrImg.style.cssText = 'left: '+(geomW-16)+'px; top: '+((geomH-fntSz)/2)+'px; height: '+fntSz+'px; ';\n" " this.place.appendChild(cldrImg);\n" " formObj.style.width = (geomWint-16)+'px';\n" " cldrImg.onclick = function( ) {\n" " var formObj = this.parentNode.children[0];\n" " var cldrDlg = this.ownerDocument.getElementById('clndrdlg');\n" " if(!cldrDlg) {\n" " cldrDlg = this.ownerDocument.createElement('div');\n" " cldrDlg.id = 'clndrdlg';\n" " cldrDlg.innerHTML = \"\"+\n" " \"\"+\n" " \"\"+\n" " \"\"+\n" " \"\"+\n" " \"\"+\n" " \"\"+\n" " \"\"+\n" " \"
###Mon######Tue######Wed######Thr######Fri######Sat######Sun###
\";\n" " cldrDlg.children[0].onclick = function( ) {\n" " this.parentElement.formObj.valSet((new Date()).getTime()/1000);\n" " this.parentElement.formObj.chApply();\n" " this.parentElement.style.visibility = 'hidden';\n" " this.parentElement.style.top = \"-100px\";\n" " }\n" " cldrDlg.children[1].onchange = cldrDlg.children[2].onchange = function( ) {\n" " this.parentElement.tmSet((new Date(parseInt(this.parentElement.children[1].options[this.parentElement.children[1].selectedIndex].value),\n" " this.parentElement.children[2].selectedIndex,1)).getTime()/1000);\n" " }\n" " cldrDlg.daySet = function() {\n" " dlgN = this.offsetParent.parentElement;\n" " dtSrc = new Date(dlgN.formObj.valGet()*1000);\n" " dtSrc.setFullYear(parseInt(dlgN.children[1].options[dlgN.children[1].selectedIndex].value));\n" " dtSrc.setMonth(dlgN.children[2].selectedIndex);\n" " dtSrc.setDate(parseInt(this.textContent));\n" " dlgN.formObj.valSet(dtSrc.getTime()/1000);\n" " dlgN.formObj.chApply();\n" " dlgN.style.visibility = 'hidden';\n" " dlgN.style.top = \"-100px\";\n" " dlgN.cldrDlg = null;\n" " }\n" " //Fill and activate the table\n" " cldrDlg.tmSet = function(tm) {\n" " var dtCur = new Date();\n" " var dtSet = new Date(parseInt(tm)*1000);\n" " // Years fill\n" " var optLs = \"\"; hasCur = false;\n" " for(iY = 0; iY < 10; iY++) {\n" " iY_ = (dtCur.getFullYear()-iY);\n" " if(iY_ != dtSet.getFullYear()) optLs += \"\";\n" " else { optLs += \"\"; hasCur = true; }\n" " }\n" " if(!hasCur) optLs += \"\";\n" " this.children[1].innerHTML = optLs;\n" " // Months fill\n" " var optLs = \"\";\n" " for(iM = 0; iM < 12; iM++) {\n" " var mNm = \"\";\n" " if(iM == 0) mNm = \"###January###\";\n" " else if(iM == 1) mNm = \"###February###\";\n" " else if(iM == 2) mNm = \"###March###\";\n" " else if(iM == 3) mNm = \"###April###\";\n" " else if(iM == 4) mNm = \"###May###\";\n" " else if(iM == 5) mNm = \"###June###\";\n" " else if(iM == 6) mNm = \"###July###\";\n" " else if(iM == 7) mNm = \"###August###\";\n" " else if(iM == 8) mNm = \"###September###\";\n" " else if(iM == 9) mNm = \"###October###\";\n" " else if(iM == 10) mNm = \"###November###\";\n" " else if(iM == 11) mNm = \"###December###\";\n" " optLs += \"\"+mNm+\"\";\n" " }\n" " this.children[2].innerHTML = optLs;\n" " // Days fill\n" " dtSetMBeg = new Date(dtSet.getFullYear(), dtSet.getMonth(), 1);\n" " maxDayInMonth = 28;\n" " while((new Date(dtSet.getFullYear(),dtSet.getMonth(),maxDayInMonth+1)).getMonth() == dtSet.getMonth() && maxDayInMonth < 31)\n" " maxDayInMonth++;\n" " for(iW = 0, iD = 1; iW < 6; iW++)\n" " for(iWd = 0; iWd < 7; iWd++) {\n" " tdEl = this.children[3].rows[iW+1].cells[iWd];\n" " if((iW == 0 && iWd < ((tVl=dtSetMBeg.getDay()-1)<0?7+tVl:tVl)) || iD > maxDayInMonth)\n" " { tdEl.innerHTML = \"\"; tdEl.className = \"\"; tdEl.onclick = null; continue; }\n" " tdEl.innerHTML = iD;\n" " tdEl.className = \"active\";\n" " tdEl.onclick = this.daySet;\n" " if(iD == dtSet.getDate()) tdEl.className += \" sel\";\n" " if(iWd == 5 || iWd == 6) tdEl.className += \" end\";\n" " iD++;\n" " }\n" " this.formObj.setModify(true);\n" " }\n" " this.ownerDocument.body.appendChild(cldrDlg);\n" " }\n" " //cldrDlg.onmouseleave = formObj.onclick;\n" " formObj.cldrDlg = cldrDlg;\n" " cldrDlg.formObj = formObj;\n" " cldrDlg.tmSet(formObj.valGet());\n" " cldrDlg.style.cssText = 'left: '+posGetX(formObj,true)+'px; top: '+(posGetY(formObj,true)+formObj.offsetHeight)+'px; '+\n" " 'font: '+formObj.parentNode.fontCfg+'; ';\n" " return false;\n" " }\n" " break;\n" " case 7: //Password\n" " formObj.type = \"password\";\n" " break;\n" " }\n" " formObj.onmousedown = function(e) { this.setModify(true); }\n" " formObj.onkeyup = function(e) {\n" " e.stopImmediatePropagation();\n" " if(this.modify() && e.keyCode == 13) this.chApply();\n" " if(this.modify() && e.keyCode == 27) this.chEscape();\n" " if(this.saveVal != this.value) this.setModify(true);\n" " return true;\n" " }\n" " formObj.onkeydown = function(e) { e.stopImmediatePropagation(); return true; }\n" " formObj.oncontextmenu = function(e) { e.stopImmediatePropagation(); return true; }\n" " formObj.modify = function( )\n" " { return (this.parentNode.children[this.parentNode.children.length-1].style.visibility == 'visible'); }\n" " formObj.setModify = function(on) {\n" " if(on && this.tmClearEdit) this.tmClearEdit = tmClearEdit;\n" " if(this.modify() == on) return;\n" " var posOkImg = this.parentNode.children.length-1;\n" " var okImg = this.parentNode.children[posOkImg];\n" " if(on) {\n" " this.style.width = (parseInt(this.style.width)-applySz)+'px';\n" " if(posOkImg == 2)\n" " this.parentNode.children[1].style.left = (parseInt(this.parentNode.children[1].style.left)-applySz)+'px';\n" " okImg.style.visibility = 'visible';\n" " this.wdgLnk.perUpdtEn(true); this.tmClearEdit = tmClearEdit;\n" " }\n" " else {\n" " this.style.width = (parseInt(this.style.width)+applySz)+'px';\n" " if(posOkImg == 2)\n" " this.parentNode.children[1].style.left = (parseInt(this.parentNode.children[1].style.left)+applySz)+'px';\n" " okImg.style.visibility = 'hidden';\n" " this.wdgLnk.perUpdtEn(false); this.tmClearEdit = 0;\n" " if(this.cldrDlg) this.onclick();\n" " }\n" " this.parentNode.isModify = on;\n" " }\n" " }\n" " formObj.valSet = function(val, noUpSave) {\n" " switch(this.parentNode.view) {\n" " case 0: case 1: case 7: this.value = val; break;\n" " case 2: //Integer\n" " if(isNaN(tVal=parseInt(val))) tVal = 0;\n" " var argCfg = this.parentNode.cfg.split(':');\n" " this.value = ((argCfg.length>3)?argCfg[3]:'')+\n" " Math.max((argCfg.length>1)?parseInt(argCfg[0]):0,Math.min((argCfg.length>1)?parseInt(argCfg[1]):100,parseInt(tVal)))+((argCfg.length>4)?argCfg[4]:'');\n" " break;\n" " case 3: //Real\n" " if(isNaN(tVal=parseFloat(val))) tVal = 0;\n" " var argCfg = this.parentNode.cfg.split(':');\n" " this.value = ((argCfg.length>3)?argCfg[3]:'')+Math.max((argCfg.length>1)?parseFloat(argCfg[0]):0,Math.min((argCfg.length>1)?parseFloat(argCfg[1]):100,parseFloat(tVal))).toFixed((argCfg.length>5)?parseInt(argCfg[5]):2)+((argCfg.length>4)?argCfg[4]:'');\n" " break;\n" " case 4: //Time\n" " var rez = (this.parentNode.cfg.length) ? this.parentNode.cfg : 'hh:mm';\n" " var v = (Math.floor(val/3600)%(ap?12:24)).toString(10); rez = rez.replace('hh',i2s(v,10,2)); rez = rez.replace('h',v);\n" " v = (Math.floor(val/60)%60).toString(10); rez = rez.replace('mm',i2s(v,10,2)); rez = rez.replace('m',v);\n" " v = (val%60).toString(10); rez = rez.replace('ss',i2s(v,10,2)); rez = rez.replace('s',v);\n" " if(rez.indexOf('ap') >= 0) { rez = rez.replace('ap',(val>=43200)?'pm':'am'); var ap = true; }\n" " if(rez.indexOf('AP') >= 0) { rez = rez.replace('AP',(val>=43200)?'PM':'AM'); var ap = true; }\n" " this.value = rez;\n" " break;\n" " case 5: //Date\n" " var rez = (this.parentNode.cfg.length) ? this.parentNode.cfg : 'dd.MM.yy';\n" " var dt = new Date(parseInt(val)*1000);\n" " var v = dt.getDate().toString(10); rez = rez.replace('dddd',i2s(v,10,2)); rez = rez.replace('ddd',i2s(v,10,2)); rez = rez.replace('dd',i2s(v,10,2)); rez = rez.replace('d',v);\n" " v = (dt.getMonth()+1).toString(10); rez = rez.replace('MMMM',i2s(v,10,2)); rez = rez.replace('MMM',i2s(v,10,2)); rez = rez.replace('MM',i2s(v,10,2)); rez = rez.replace('M',v);\n" " v = dt.getFullYear().toString(10); rez = rez.replace('yyyy',i2s(v,10,4)); rez = rez.replace('yy',i2s(v.substr(2,2),10,2));\n" " this.value = rez;\n" " break;\n" " case 6: //Date and time\n" " var rez = (this.parentNode.cfg.length) ? this.parentNode.cfg : 'dd.MM.yy hh:mm';\n" " var dt = new Date(parseInt(val)*1000);\n" " var v = dt.getDate().toString(10); rez = rez.replace('dddd',i2s(v,10,2)); rez = rez.replace('ddd',i2s(v,10,2)); rez = rez.replace('dd',i2s(v,10,2)); rez = rez.replace('d',v);\n" " v = (dt.getMonth()+1).toString(10); rez = rez.replace('MMMM',i2s(v,10,2)); rez = rez.replace('MMM',i2s(v,10,2)); rez = rez.replace('MM',i2s(v,10,2)); rez = rez.replace('M',v);\n" " v = dt.getFullYear().toString(10); rez = rez.replace('yyyy',i2s(v,10,4)); rez = rez.replace('yy',i2s(v.substr(2,2),10,2));\n" " v = dt.getHours().toString(10); rez = rez.replace('hh',i2s(v,10,2)); rez = rez.replace('h',v);\n" " v = dt.getMinutes().toString(10); rez = rez.replace('mm',i2s(v,10,2)); rez = rez.replace('m',v);\n" " v = dt.getSeconds().toString(10); rez = rez.replace('ss',(v.length==1)?'0'+v:v); rez = rez.replace('s',v);\n" " if(rez.indexOf('ap') >= 0) { rez = rez.replace('ap',(val>=43200)?'pm':'am'); var ap = true; }\n" " if(rez.indexOf('AP') >= 0) { rez = rez.replace('AP',(val>=43200)?'PM':'AM'); var ap = true; }\n" " this.value = rez;\n" " break;\n" " }\n" " if(noUpSave == null || !noUpSave) this.saveVal = this.value;\n" " this.srcVal = val;\n" " }\n" " formObj.valGet = function( ) {\n" " switch(this.parentNode.view) {\n" " case 0: case 1: case 7: return this.value;\n" " case 2:\n" " var rez = this.value;\n" " var argCfg = this.parentNode.cfg.split(':');\n" " var tmp = (argCfg&&argCfg.length>3) ? noSpace(argCfg[3]) : '';\n" " if(tmp.length && rez.indexOf(tmp) >= 0) rez = rez.substring(rez.indexOf(tmp)+tmp.length);\n" " tmp = (argCfg&&argCfg.length>4) ? noSpace(argCfg[4]) : '';\n" " if(tmp.length && rez.indexOf(tmp) >= 0) rez = rez.substring(0,rez.indexOf(tmp));\n" " return parseInt(rez);\n" " case 3:\n" " var rez = this.value;\n" " var argCfg = this.parentNode.cfg.split(':');\n" " var tmp = (argCfg&&argCfg.length>3) ? noSpace(argCfg[3]) : '';\n" " if(tmp.length && rez.indexOf(tmp) >= 0) rez = rez.substring(rez.indexOf(tmp)+tmp.length);\n" " tmp = (argCfg&&argCfg.length>4) ? noSpace(argCfg[4]) : '';\n" " if(tmp.length && rez.indexOf(tmp) >= 0) rez = rez.substring(0,rez.indexOf(tmp));\n" " return parseFloat(rez);\n" " case 4:\n" " var cfg = (this.parentNode.cfg.length) ? this.parentNode.cfg : 'hh:mm';\n" " var rez = this.value;\n" " if(cfg.indexOf('ap') >= 0 || cfg.indexOf('AP') >= 0) {\n" " cfg = cfg.replace('ap','');\n" " cfg = cfg.replace('AP','');\n" " rez = rez.replace('am','');\n" " rez = rez.replace('AM','');\n" " rez = rez.replace('pm','');\n" " rez = rez.replace('PM','');\n" " }\n" " var hour = Math.floor(this.srcVal/3600);\n" " var min = Math.floor(this.srcVal/60)%60;\n" " var sec = this.srcVal%60;\n" " var i = 0; var lstS = ''; var lenS = 0;\n" " while(true) {\n" " if(i >= cfg.length || cfg.charAt(i) == 'h' || cfg.charAt(i) == 'm' || cfg.charAt(i) == 's') {\n" " var space = lenS ? noSpace(cfg.substr(i-lenS,lenS)) : '';\n" " if(lenS && !space.length) space = ' ';\n" " if((space.length && lstS != '') || i >= cfg.length) {\n" " if(space.length && rez.indexOf(space) == -1) return 0;\n" " var val = parseInt(space.length?rez.substr(0,rez.indexOf(space)):rez,10);\n" " rez = rez.substr(rez.indexOf(space));\n" " if(lstS == 'h') hour = val;\n" " else if(lstS == 'm')min = val;\n" " else if(lstS == 's')sec = val;\n" " if(i >= cfg.length) break;\n" " }\n" " if(space.length) {\n" " if(rez.indexOf(space) == -1) return 0;\n" " rez = rez.substr(rez.indexOf(space)+space.length);\n" " }\n" " lstS = cfg.charAt(i); lenS = 0;\n" " i++;\n" " continue;\n" " }\n" " lenS++; i++;\n" " }\n" " if(this.value.indexOf('pm') >= 0 || this.value.indexOf('PM') >= 0) hour += 12;\n" " return (hour%24)*3600+(min%60)*60+(sec%60);\n" " case 5:\n" " var cfg = (this.parentNode.cfg.length) ? this.parentNode.cfg : 'd.MM.yy';\n" " var rez = this.value;\n" " var dt = new Date(this.srcVal*1000);\n" " var i = 0; var lstS = ''; var lenS = 0;\n" " while(true) {\n" " if(i >= cfg.length || cfg.charAt(i) == 'd' || cfg.charAt(i) == 'M' || cfg.charAt(i) == 'y') {\n" " var space = lenS ? noSpace(cfg.substr(i-lenS,lenS)) : '';\n" " if(lenS && !space.length) space = ' ';\n" " if((space.length && lstS != '') || i >= cfg.length) {\n" " if(space.length && rez.indexOf(space) == -1) return 0;\n" " var val = parseInt(space.length?rez.substr(0,rez.indexOf(space)):rez,10);\n" " rez = rez.substr(rez.indexOf(space));\n" " if(lstS == 'd') dt.setDate(val);\n" " else if(lstS == 'M')dt.setMonth(val-1);\n" " else if(lstS == 'y')dt.setFullYear((val<100)?2000+val:val);\n" " if(i >= cfg.length) break;\n" " }\n" " if(space.length) {\n" " if(rez.indexOf(space) == -1) return 0;\n" " rez = rez.substr(rez.indexOf(space)+space.length);\n" " }\n" " lstS = cfg.charAt(i); lenS = 0;\n" " i++;\n" " continue;\n" " }\n" " lenS++; i++;\n" " }\n" " rez = dt.getTime()/1000;\n" " return rez;\n" " case 6:\n" " var cfg = (this.parentNode.cfg.length) ? this.parentNode.cfg : 'dd.MM.yy hh:mm';\n" " var rez = this.value;\n" " if(cfg.indexOf('ap') >= 0 || cfg.indexOf('AP') >= 0) {\n" " cfg = cfg.replace('ap','');\n" " cfg = cfg.replace('AP','');\n" " rez = rez.replace('am','');\n" " rez = rez.replace('AM','');\n" " rez = rez.replace('pm','');\n" " rez = rez.replace('PM','');\n" " }\n" " var dt = new Date(this.srcVal*1000);\n" " var i = 0; var lstS = ''; var lenS = 0;\n" " while(true) {\n" " if(i >= cfg.length || cfg.charAt(i) == 'd' || cfg.charAt(i) == 'M' || cfg.charAt(i) == 'y' ||\n" " cfg.charAt(i) == 'h' || cfg.charAt(i) == 'm' || cfg.charAt(i) == 's')\n" " {\n" " var space = lenS ? noSpace(cfg.substr(i-lenS,lenS)) : '';\n" " if(lenS && !space.length) space = ' ';\n" " if((space.length && lstS != '') || i >= cfg.length) {\n" " if(space.length && rez.indexOf(space) == -1) return 0;\n" " var val = parseInt(space.length?rez.substr(0,rez.indexOf(space)):rez,10);\n" " rez = rez.substr(rez.indexOf(space));\n" " if(lstS == 'd') dt.setDate(val);\n" " else if(lstS == 'M')dt.setMonth(val-1);\n" " else if(lstS == 'y')dt.setFullYear((val<100)?2000+val:val);\n" " else if(lstS == 'h')dt.setHours(val);\n" " else if(lstS == 'm')dt.setMinutes(val);\n" " else if(lstS == 's')dt.setSeconds(val);\n" " if(i >= cfg.length) break;\n" " }\n" " if(space.length) {\n" " if(rez.indexOf(space) == -1) return 0;\n" " rez = rez.substr(rez.indexOf(space)+space.length);\n" " }\n" " lstS = cfg.charAt(i); lenS = 0; i++; continue;\n" " }\n" " lenS++; i++;\n" " }\n" " if(this.value.indexOf('pm') >= 0 || this.value.indexOf('PM') >= 0) dt.setHours(dt.getHours()+12);\n" " rez = dt.getTime()/1000;\n" " return rez;\n" " }\n" " return '';\n" " }\n" " formObj.chApply = function( ) {\n" " var val = this.valGet();\n" " this.valSet(val);\n" " this.setModify(false);\n" " var attrs = new Object(); attrs.value = val; attrs.event = 'ws_LnAccept';\n" " setWAttrs(this.wdgLnk.addr, attrs);\n" " }\n" " formObj.chEscape = function( ) {\n" " this.value = this.saveVal;\n" " this.setModify(false);\n" " }\n" " var okImg = this.place.ownerDocument.createElement('img');\n" " okImg.className = \"ok\";\n" " okImg.src = '/'+MOD_ID+'/img_button_ok';\n" " okImg.style.cssText = 'left: '+(geomW-applySz)+'px; top: '+((geomH-applySz)/2)+'px; height: '+applySz+'px; width: '+applySz+'px; ';\n" " okImg.onclick = function() { this.parentNode.childNodes[0].chApply(); return false; };\n" " this.place.appendChild(okImg);\n" " formObj.valSet(this.attrs['value']);\n" " break;\n" " case 1: //Text edit\n" " elStyle += 'pointer-events: all; ';\n" " var fntSz = (getFont(this.attrs['font'],Math.min(xSc,ySc),2)*1.4).toFixed(0);\n" " var applySz = Math.max(16, fntSz);\n" "\n" " var toInit = !this.place.childNodes.length;\n" " var formObj = toInit ? this.place.ownerDocument.createElement('textarea') : this.place.childNodes[0];\n" " if(toInit || comElMdf || this.attrsMdf['geomW'] || this.attrsMdf['geomH'] || this.attrsMdf['font']) {\n" " formObj.style.cssText = 'padding: 1px; width: '+(geomW-5)+'px; height: '+(geomH-5)+'px; font: '+this.place.fontCfg+'; ';\n" " formObj.style.cssText += \"border: \"+(bordStyle?bordStyle:\"1px solid gray\")+\"; \";\n" " formObj.style.cssText += (backStyle == null) ? 'background-color: white; ' : (backStyle.length?backStyle:'');\n" " }\n" " if(this.attrsMdf['value']) formObj.saveVal = formObj.value = this.attrs['value'];\n" " if(!toInit) break;\n" " formObj.disabled = !elWr;\n" " formObj.wdgLnk = this;\n" " formObj.appendChild(this.place.ownerDocument.createTextNode(this.attrs['value']));\n" " formObj.onkeyup = function(e) {\n" " e.stopImmediatePropagation();\n" " if(this.saveVal != this.value) this.setModify(true);\n" " if(this.modify()) {\n" " if(e.keyCode == 13 && e.ctrlKey) this.nextSibling.onclick();\n" " if(e.keyCode == 27) this.nextSibling.nextSibling.onclick();\n" " }\n" " return true;\n" " };\n" " formObj.onkeydown = function(e) { e.stopImmediatePropagation(); return true; }\n" " formObj.oncontextmenu = function(e) { e.stopImmediatePropagation(); return true; }\n" " formObj.modify = function( ) { return (this.parentNode.childNodes[1].style.visibility == 'visible'); }\n" " formObj.setModify = function(on) {\n" " if(this.modify() == on) return;\n" " if(on) {\n" " this.style.height = (parseInt(this.style.height)-applySz)+'px';\n" " this.parentNode.childNodes[1].style.visibility = this.parentNode.childNodes[2].style.visibility = 'visible';\n" " }\n" " else {\n" " this.style.height = (parseInt(this.style.height)+applySz)+'px';\n" " this.parentNode.childNodes[1].style.visibility = this.parentNode.childNodes[2].style.visibility = 'hidden';\n" " }\n" " }\n" " var okImg = this.place.ownerDocument.createElement('img');\n" " okImg.src = '/'+MOD_ID+'/img_button_ok';\n" " okImg.style.cssText = 'visibility: hidden; position: absolute; left: '+(geomW-2*applySz)+'px; '+\n" " 'top: '+(geomH-applySz)+'px; width: '+applySz+'px; height: '+applySz+'px; cursor: pointer;';\n" " okImg.onclick = function( ) {\n" " var attrs = new Object();\n" " attrs.value = this.parentNode.childNodes[0].value; attrs.event = 'ws_TxtAccept';\n" " setWAttrs(this.parentNode.childNodes[0].wdgLnk.addr,attrs);\n" " this.parentNode.childNodes[0].setModify(false);\n" " return false;\n" " };\n" " var cancelImg = this.place.ownerDocument.createElement('img');\n" " cancelImg.src = '/'+MOD_ID+'/img_button_cancel';\n" " cancelImg.style.cssText = 'visibility: hidden; position: absolute; left: '+(geomW-applySz)+'px; top: '+(geomH-applySz)+'px; width: '+applySz+'px; height: '+applySz+'px; cursor: pointer;';\n" " cancelImg.onclick = function( ) {\n" " this.parentNode.childNodes[0].value = this.parentNode.childNodes[0].saveVal;\n" " this.parentNode.childNodes[0].setModify(false);\n" " return false;\n" " };\n" " this.place.appendChild(formObj);\n" " this.place.appendChild(okImg);\n" " this.place.appendChild(cancelImg);\n" " break;\n" " case 2: //Chek box\n" " var toInit = !this.place.childNodes.length;\n" " var tblCell = toInit ? this.place.ownerDocument.createElement('div') : this.place.childNodes[0];\n" " if(toInit || this.attrsMdf['geomH'] || this.attrsMdf['geomW'] || this.attrsMdf['font']) {\n" " tblCell.className = 'vertalign';\n" " tblCell.style.cssText = 'position: absolute; top: '+((geomH-15)/2)+'px; width: '+geomW+'px; '+\n" " 'height: '+Math.min(geomH,15)+'px; text-align: left; font: '+this.place.fontCfg+'; ';\n" " }\n" " var formObj = tblCell.childNodes.length ? tblCell.childNodes[0] : this.place.ownerDocument.createElement('input');\n" " var spanObj = tblCell.childNodes.length > 1 ? tblCell.childNodes[1] : this.place.ownerDocument.createElement('span');\n" " spanObj.style.cssText = 'display: table-cell; white-space: pre-line; word-break: break-word; height: '+geomH+'px; ';\n" "\n" " if(toInit || this.attrsMdf['value']) formObj.checked = parseInt(this.attrs['value']);\n" " if(toInit) {\n" " formObj.type = 'checkbox';\n" " formObj.disabled = !elWr;\n" " formObj.style.cssText = 'width: '+Math.min(geomW,geomH)+'px; height: '+Math.min(geomW,geomH)+'px;';\n" " formObj.wdgLnk = this;\n" " formObj.onclick = function( ) {\n" " var attrs = new Object();\n" " attrs.value = this.checked ? '1' : '0'; attrs.event = 'ws_ChkChange';\n" " setWAttrs(this.wdgLnk.addr,attrs);\n" " return true;\n" " }\n" " tblCell.appendChild(formObj);\n" " tblCell.appendChild(spanObj);\n" " spanObj.textContent = this.attrs['name'];\n" " this.place.appendChild(tblCell);\n" " }\n" " if(this.attrsMdf['name']) spanObj.textContent = this.attrs['name'];\n" " break;\n" " case 3: //Button\n" " var formObj;\n" " var iconImg = this.attrs['img'];\n" " this.place.checkable = (parseInt(this.attrs['mode']) == 1);\n" " this.place.isMenu = (parseInt(this.attrs['mode']) == 2);\n" " this.place.isLoad = (parseInt(this.attrs['mode']) == 3);\n" " this.place.isSave = (parseInt(this.attrs['mode']) == 4);\n" " var custBut = iconImg;\n" " if(custBut != this.place.custBut || this.attrsMdf['mode'])\n" " while(this.place.childNodes.length) this.place.removeChild(this.place.childNodes[0]);\n" " this.place.custBut = custBut;\n" " var toInit = !this.place.childNodes.length;\n" " formObj = toInit ? this.place.ownerDocument.createElement('button') : this.place.childNodes[0];\n" " if(toInit || this.attrsMdf['font']) formObj.style.font = this.place.fontCfg;\n" " if(toInit || this.attrsMdf['color']) formObj.style.backgroundColor = getColor(this.attrs['color']);\n" " if(toInit || this.attrsMdf['colorText']) formObj.style.color = getColor(this.attrs['colorText']);\n" "\n" " this.mouseup[this.mouseup.length] = function(e,el) { el.btUp(); }\n" " this.mousedown[this.mousedown.length] = function(e,el) { el.btDown(); };\n" " if(toInit) {\n" " formObj.style.cursor = elWr ? 'pointer' : '';\n" " formObj.disabled = !elWr;\n" " formObj.wdgLnk = this;\n" " formObj.style.width = geomW+'px'; formObj.style.height = geomH+'px';\n" " formObj.style.padding = \"0\";\n" " this.place.appendChild(formObj);\n" " this.place.btDown = function( ) {\n" " if(this.checkable) {\n" " var attrs = new Object();\n" " if(!this.childNodes[0].classList.contains(\"pressed\"))\n" " { attrs.value = '1'; this.childNodes[0].classList.add(\"pressed\"); setWAttrs(this.wdgLnk.addr,'event','ws_BtPress'); }\n" " else { attrs.value = '0'; this.childNodes[0].classList.remove(\"pressed\"); setWAttrs(this.wdgLnk.addr,'event','ws_BtRelease'); }\n" " setWAttrs(this.wdgLnk.addr,'value',attrs.value);\n" " setWAttrs(this.wdgLnk.addr,'event','ws_BtToggleChange');\n" " return;\n" " }\n" " this.childNodes[0].classList.add(\"pressed\");\n" " this.childNodes[0].focus();\n" " setWAttrs(this.wdgLnk.addr,'event','ws_BtPress');\n" " }\n" " this.place.btUp = function( ) {\n" " if(this.checkable) return;\n" " this.childNodes[0].classList.remove(\"pressed\");\n" " if(this.wdgLnk.attrs[\"vs_goHttpUrl\"]) window.location = this.wdgLnk.attrs[\"vs_goHttpUrl\"];\n" " setWAttrs(this.wdgLnk.addr,'event','ws_BtRelease');\n" " }\n" " formObj.onkeydown = function(e) { if(e.keyCode == 13 || e.keyCode == 32) this.parentNode.btDown(); }\n" " formObj.onkeyup = function(e) { if(e.keyCode == 13 || e.keyCode == 32) this.parentNode.btUp(); }\n" " }\n" "\n" " if(custBut && !this.place.isLoad) {\n" " var stdBordWidth = 2;\n" " var imgObj = formObj.childNodes.length ? formObj.childNodes[0] : this.place.ownerDocument.createElement('img');\n" " var spanObj = formObj.childNodes.length ? formObj.childNodes[1] : this.place.ownerDocument.createElement('span');\n" "\n" " spanObj.style.cssText = \"display: table-cell; height: \"+(geomH-2*stdBordWidth)+\"px; line-height: 1; text-align: center; white-space: pre-line; word-break: break-word; width: \"+(geomW-2*stdBordWidth)+\"px; \";\n" " if(toInit || this.attrsMdf['name']) {\n" " spanObj.disabled = !this.attrs['name'].length;\n" " spanObj.innerText = this.attrs['name'].replace('\\\\n','\\n') + (this.place.isMenu?\" ▾\":\"\");\n" " }\n" " if(toInit || this.attrsMdf['img'] || this.attrsMdf['name']) {\n" " imgObj.hidden = !this.attrs['img'].length;\n" " if(!imgObj.hidden) {\n" " imgObj.className = elWr ? 'active' : 'inactive';\n" " imgObj.src = \"/\"+MOD_ID+this.addr+\"?com=res&val=\"+this.attrs['img']+\"&size=\"+(Math.min(geomW,geomH)-2*stdBordWidth);//+(!elWr?\"&filtr=unact\":\"\");\n" " //imgObj.width = Math.min(geomW, geomH);\n" " imgObj.height = Math.min(geomW, geomH)-2*stdBordWidth;\n" " imgObj.style.float = spanObj.disabled ? null : 'left';\n" " imgObj.style.marginRight = this.attrs['name'].length ? \"2px\" : \"0px\";\n" " }\n" " }\n" "\n" " if(toInit) {\n" " formObj.className = 'vertalign';\n" " //Disable drag mostly for FireFox\n" " imgObj.onmousedown = function(e) { e = e?e:window.event; if(e.preventDefault) e.preventDefault(); }\n" " formObj.appendChild(imgObj);\n" " formObj.appendChild(spanObj);\n" " }\n" " }\n" " else if(toInit || this.attrsMdf['name']) formObj.innerText = this.attrs['name'].replace('\\\\n','\\n') + (this.place.isMenu?\" ▾\":\"\");\n" "\n" " if(this.place.checkable) {\n" " if(parseInt(this.attrs['value'])) formObj.classList.add(\"pressed\"); else formObj.classList.remove(\"pressed\");\n" " }\n" "\n" " if(this.place.isMenu)\n" " formObj.onclick = function( ) {\n" " var menuWin = this.ownerDocument.getElementById('menuwin');\n" " if(!menuWin) {\n" " menuWin = this.ownerDocument.createElement('div');\n" " menuWin.id = 'menuwin';\n" " menuWin.className = \"ItemsTree active\";\n" " menuWin.treeFont = 'font:'+this.wdgLnk.place.fontCfg+'; ';\n" " menuWin.close = function( ) { this.style.visibility = 'hidden'; this.style.top = \"-100px\"; }\n" " menuWin.setList = function(list) {\n" " if(!this.children.length) this.appendChild(getTree());\n" " this.children[0].style.cssText = this.treeFont;\n" " this.children[0].select = function(ipath) {\n" " if(!ipath.length) return;\n" " attrs = new Object();\n" " attrs.event = 'ws_BtMenu='+ipath;\n" " setWAttrs(this.parentNode.formObj.wdgLnk.addr, attrs);\n" " this.parentNode.close();\n" " }\n" " this.children[0].setList(list);\n" " }\n" " this.ownerDocument.body.appendChild(menuWin);\n" " }\n" " menuWin.style.cssText = 'left: '+posGetX(this,true)+'px; top: '+(posGetY(this,true)+this.offsetHeight)+'px; ';\n" " menuWin.onmouseleave = menuWin.close;\n" " menuWin.formObj = this;\n" " menuWin.setList(this.wdgLnk.attrs['value']);\n" " }\n" " else if(this.place.isLoad && toInit) {\n" " iformObj = this.place.ownerDocument.createElement('form');\n" " iformObj.method = 'post';\n" " iformObj.action = \"/\"+MOD_ID+this.addr+\"?com=obj\"\n" " iformObj.enctype = \"multipart/form-data\";\n" " fHeader = this.attrs['value'].split(\"\\n\",1)[0].split(\"|\");\n" " iformObj.innerHTML = \"\";\n" " formObj.iformObj = iformObj;\n" " formObj.onclick = function( ) { this.iformObj.children[0].click(); }\n" " iformObj.children[0].wdgLnk = this;\n" " iformObj.children[0].onchange = function( ) { if(this.value.length) this.form.submit(); }\n" " this.place.appendChild(iformObj);\n" " }\n" " else if(this.place.isSave) {\n" " if(this.attrs['value'].length && this.attrs['value'] != this.valuePrev)\n" " window.open('/'+MOD_ID+this.addr+\"/\"+this.attrs['value'].split(\"\\n\",1)[0].split(\"|\")[2]+'?com=obj');\n" " this.valuePrev = this.attrs['value'];\n" " }\n" " break;\n" " case 4: case 5: //Combo box, List\n" " elStyle += 'pointer-events: all; ';\n" " var toInit = !this.place.childNodes.length;\n" " var formObj = toInit ? this.place.ownerDocument.createElement('select') : this.place.childNodes[0];\n" " if(toInit || comElMdf || this.attrsMdf['geomW'] || this.attrsMdf['geomH'] || this.attrsMdf['font']) {\n" " formObj.style.cssText = 'padding: 0; top: '+((elTp==4)?(geomH-fntSz)/2:0)+'px; '+\n" " 'height: '+((elTp==4)?fntSz:geomH)+'px; width: '+geomW+'px; '+\n" " 'font: '+this.place.fontCfg+'; ';\n" " formObj.style.cssText += \"border: \"+(bordStyle?bordStyle:\"1px solid gray\")+\"; \";\n" " formObj.style.cssText += (backStyle == null) ? 'background-color: white; ' : (backStyle.length?backStyle:'');\n" " }\n" " formObj.multiple = parseInt(this.attrs['mult']) ? true : null;\n" " if(this.attrsMdf['items'] || this.attrsMdf['value']) {\n" " while(formObj.childNodes.length) formObj.removeChild(formObj.childNodes[0]);\n" " var selVal = this.attrs['value'].split('\\n');\n" " var elLst = this.attrs['items'].split('\\n');\n" " for(var i = 0; i < elLst.length; i++) {\n" " var optEl = this.place.ownerDocument.createElement('option');\n" " optEl.appendChild(this.place.ownerDocument.createTextNode(elLst[i]));\n" " if((selId=selVal.indexOf(elLst[i])) >= 0) {\n" " optEl.defaultSelected = optEl.selected = true;\n" " selVal.splice(selId, 1);\n" " }\n" " formObj.appendChild(optEl);\n" " }\n" " for(i = 0; i < selVal.length && elTp == 4; i++) {\n" " var optEl = this.place.ownerDocument.createElement('option');\n" " optEl.textContent = selVal[i];\n" " optEl.selected = optEl.defaultSelected = true;\n" " formObj.appendChild(optEl);\n" " }\n" " }\n" " if(!toInit) break;\n" " formObj.disabled = !elWr;\n" " formObj.wdgLnk = this;\n" " if(elTp == 4)\n" " formObj.onchange = function( ) {\n" " var attrs = new Object();\n" " attrs.value = this.options[this.selectedIndex].value; attrs.event = 'ws_CombChange';\n" " this.wdgLnk.attrs['value'] = attrs.value;\n" " setWAttrs(this.wdgLnk.addr,attrs);\n" " }\n" " else {\n" " formObj.size = 100;\n" " formObj.onclick = function( ) {\n" " var attrs = new Object();\n" " attrs.value = \"\";\n" " for(iO = 0; iO < this.options.length; iO++)\n" " if(this.options[iO].selected) attrs.value += (attrs.value.length?\"\\n\":\"\") + this.options[iO].value;\n" " attrs.event = 'ws_ListChange';\n" " this.wdgLnk.attrs['value'] = attrs.value;\n" " setWAttrs(this.wdgLnk.addr, attrs);\n" " }\n" " }\n" " this.place.appendChild(formObj);\n" " break;\n" " case 6: case 7: //Slider and Scroll bar\n" " isProgr = false; //(elTp == 7);\n" " var applySz = Math.floor(Math.max(16, Math.min(xSc,ySc)*16));\n" " var toInit = !this.place.children.length;\n" " var formObj = toInit ? this.place.ownerDocument.createElement('input') : this.place.children[0];\n" " if(toInit || this.attrsMdf['value']) formObj.value = parseInt(this.attrs['value']);\n" " formObj.vOr = false;\n" " if(toInit || this.attrsMdf['cfg']) {\n" " cfgLst = this.attrs['cfg'].split(':');\n" " formObj.vOr = (cfgLst.length && parseInt(cfgLst[0]));\n" " formObj.setAttribute(\"orient\", formObj.vOr?\"vertical\":\"\");\n" " formObj.setAttribute(\"min\", (cfgLst.length > 1)?parseInt(cfgLst[1]):0);\n" " formObj.setAttribute(\"max\", (cfgLst.length > 2)?parseInt(cfgLst[2]):100);\n" " formObj.setAttribute(\"step\", (cfgLst.length > 3)?parseInt(cfgLst[3]):1);\n" " }\n" " if(!toInit) break;\n" " formObj.type = 'range';\n" " formObj.disabled = !elWr;\n" " formObj.wdgLnk = this;\n" " formObj.style.cssText = \"width: \"+(formObj.vOr?applySz:(isProgr?geomW-2*applySz:geomW))+\"px; \"+\n" " \"height: \"+(formObj.vOr?(isProgr?geomH-2*applySz:geomH):applySz)+\"px; \";\n" " formObj.onclick = formObj.onkeyup = function( ) {\n" " if(this.value == parseInt(this.wdgLnk.attrs['value'])) return;\n" " var attrs = new Object();\n" " attrs.value = this.value; attrs.event = 'ws_SliderChange';\n" " setWAttrs(this.wdgLnk.addr, attrs);\n" " this.defaultValue = this.value;\n" " //return true;\n" " }\n" " this.place.appendChild(formObj);\n" " break;\n" " case 8: //Tree\n" " elStyle += \"pointer-events: all; border: \"+(bordStyle?bordStyle:\"1px solid gray\")+\"; \";\n" " elStyle += (backStyle == null) ? 'background-color: white; ' : (backStyle.length?backStyle:'');\n" " geomW -= 2; geomH -= 2;\n" " //elStyle += \"border: 1px solid gray; padding: 1px; \";\n" " this.place.className += \" ItemsTree\";\n" " if(elWr) this.place.className += \" active\";\n" " var toInit = !this.place.children.length;\n" " var formObj = toInit ? getTree() : this.place.children[0];\n" " formObj.wdgLnk = this;\n" " formObj.elWr = elWr;\n" " if(toInit || this.attrsMdf['font']) formObj.style.cssText = 'font: '+this.place.fontCfg+'; ';\n" " //Events and the processings init\n" " if(toInit)\n" " formObj.select = function(ipath) {\n" " if(!ipath || !ipath.length) return;\n" " attrs = new Object();\n" " attrs.value = ipath;\n" " attrs.event = 'ws_TreeChange';\n" " setWAttrs(this.wdgLnk.addr, attrs);\n" " }\n" " //Processing for fill and changes\n" " if(toInit || this.attrsMdf['items']) formObj.setList(this.attrs['items']);\n" " if(toInit || this.attrsMdf['value'] || this.attrsMdf['items']) formObj.selIt(this.attrs['value']);\n" " if(toInit) this.place.appendChild(formObj);\n" " break;\n" " case 9: //Table\n" " elStyle += \"pointer-events: all; padding: 1px; \";\n" " if(bordStyle) elStyle += \"border: \"+bordStyle+\"; \";\n" " if(backStyle != null) elStyle += backStyle;\n" " geomW -= 4; geomH -= 4;\n" " this.place.className += \" Table\";\n" " if(elWr) this.place.className += \" active\";\n" " var toInit = !this.place.children.length;\n" " var formObj = toInit ? this.place.ownerDocument.createElement('table') : this.place.children[0];\n" " formObj.wdgLnk = this;\n" " formObj.elWr = elWr;\n" " // Events and the processings init\n" " if(toInit) {\n" " formObj.onclick = function( ) {\n" " if(this.nodeName == \"TABLE\" || !(elTbl=this.offsetParent) || !elTbl.elWr) return true;\n" " attrs = null;\n" " if(elTbl.oSel == \"row\" && this.parentNode.rowIndex > 0) {\n" " elTbl.selIt(this.parentNode.rowIndex);\n" " attrs = new Object();\n" " attrs.value = elTbl.getVal(this.parentNode.rowIndex-1, elTbl.oKeyID);\n" " if(this.parentNode.cells[elTbl.oKeyID+1].outTp == \"b\")\n" " attrs.value = (attrs.value == \"true\") ? 1 : 0;\n" " }\n" " else if(elTbl.oSel == \"col\" && this.cellIndex > 0) {\n" " elTbl.selIt(null, this.cellIndex);\n" " attrs = new Object();\n" " attrs.value = elTbl.getVal(elTbl.oKeyID, this.cellIndex-1);\n" " if(elTbl.tBodies[0].rows[elTbl.oKeyID].cells[this.cellIndex].outTp == \"b\")\n" " attrs.value = (attrs.value == \"true\") ? 1 : 0;\n" " }\n" " else if(this.parentNode.rowIndex > 0 && this.cellIndex > 0) {\n" " elTbl.selIt(this.parentNode.rowIndex, this.cellIndex);\n" " attrs = new Object();\n" " if(elTbl.oSel == \"cell\") {\n" " attrs.value = elTbl.getVal(this.parentNode.rowIndex-1, this.cellIndex-1);\n" " if(this.outTp == \"b\") attrs.value = (attrs.value == \"true\") ? 1 : 0;\n" " } else attrs.value = (this.parentNode.rowIndex-1) + \":\" + (this.cellIndex-1);\n" " }\n" " if(attrs) { attrs.event = 'ws_TableChangeSel'; setWAttrs(elTbl.wdgLnk.addr, attrs); }\n" " }\n" " formObj.ondblclick = function( ) {\n" " if(this.nodeName == \"TABLE\" || !(elTbl=this.offsetParent) || !elTbl.elWr || !this.isEdit) return true;\n" " if(this.isEnter) {\n" " this.innerHTML = this.svInnerHTML;\n" " this.isEnter = false; elTbl.edIt = null;\n" " }\n" " else {\n" " if(elTbl.edIt) { elTbl.edIt.innerHTML = elTbl.edIt.svInnerHTML; elTbl.edIt.isEnter = false; }\n" " this.isEnter = true; elTbl.edIt = this;\n" " this.svInnerHTML = this.innerHTML;\n" "\n" " if(this.outTp == \"b\") {\n" " tVl = elTbl.getVal(this.parentNode.rowIndex-1,this.cellIndex-1);\n" " this.innerHTML = \"\";\n" " this.firstChild.checked = tVl;\n" " this.firstChild.onclick = function( ) {\n" " this.parentNode.offsetParent.setVal((this.checked?1:0),\n" " this.parentNode.parentNode.rowIndex-1, this.parentNode.cellIndex-1);\n" " }\n" " this.firstChild.onkeyup = function(e) {\n" " if(e.keyCode == 13 || e.keyCode == 20) {\n" " this.checked = !this.checked;\n" " this.parentNode.offsetParent.setVal((this.checked?1:0), this.parentNode.parentNode.rowIndex-1, this.parentNode.cellIndex-1);\n" " }\n" " if(e.keyCode == 27) {\n" " this.parentNode.isEnter = false; this.parentNode.offsetParent.edIt = null;\n" " this.parentNode.innerHTML = this.parentNode.svInnerHTML;\n" " }\n" " return true;\n" " }\n" " this.firstChild.focus();\n" " }\n" " else if(this.outTp == \"i\" || this.outTp == \"r\" || this.outTp == \"s\" || this.outTp == \"t\") {\n" " tVl = elTbl.getVal(this.parentNode.rowIndex-1, this.cellIndex-1);\n" " this.innerHTML = (this.outTp == \"t\") ? \"