dhxmvp
Version:
A complete boilerplate for building online, offline and syncable MVP Single Page Applications using DHTMLX.
2 lines • 32.3 kB
JavaScript
!function(e){"use strict"}(window.$dhx=window.$dhx||{version:"1.0.3",cdn1URL:"//cdn.dhtmlx.com.br/",_enable_log:!1,_enable_benchmark:!1,windowWidth:0,windowHeight:0,uid:function(){return(32767&Date.now()).toString(32)+(4294967296*Math.random()).toString(32)},S4:function(){return(65536*(1+Math.random())|0).toString(16).substring(1)},guid:function(){var e=this;return e.S4()+e.S4()+"-"+e.S4()+"-"+e.S4()+"-"+e.S4()+"-"+e.S4()+e.S4()+e.S4()},getRandomColor:function(){for(var e="0123456789ABCDEF",t="#",n=0;n<6;n++)t+=e[Math.floor(16*Math.random())];return t},loadScript:function(e,t){e+=".js";var n=document.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){$dhx.debug.log(n.readyState),"loaded"!=n.readyState&&"complete"!=n.readyState||(n.onreadystatechange=null,t())}:n.onload=function(){t()},n.src=e,document.getElementsByTagName("head")[0].appendChild(n)},environment:"test",onDemand:{queue:[],load:function(e,t){var n=$dhx.onDemand,i=$dhx.guid();n.queue[i]=[],$dhx.isArray(e)?e.forEach(function(e,t,o){"production"!=$dhx.environment?n.queue[i].push(e+"?uistring="+$dhx.guid()):n.queue[i].push(e)}):"production"!=$dhx.environment?n.queue[i].push(e+"?uistring="+$dhx.guid()):n.queue[i].push(e),$dhx.showDirections("Loading_Files"),n.process_queue(t,i)},require:function(e,t){var n=$dhx.onDemand,i=$dhx.guid();n.queue[i]=[],$dhx.isArray(e)?e.forEach(function(e,t,o){"production"!=$dhx.environment?n.queue[i].push(e+"?uistring="+$dhx.guid()):n.queue[i].push(e)}):"production"!=$dhx.environment?n.queue[i].push(e+"?uistring="+$dhx.guid()):n.queue[i].push(e),$dhx.showDirections("Loading_Files"),n.process_queue(t,i)},process_queue:function(e,t){var n=$dhx.onDemand;if(n.queue[t].length>0){var i=n.queue[t].shift();$dhx.lScript(i,function(){n.process_queue(e,t)})}else $dhx.hideDirections(),e()}},lScript:function(e,t){var n,i,o,r;e.split("?")[0];null===document.getElementById(e)?(n=e.split("."),i=n[n.length-1],e.indexOf(".css")!=-1?(o="link",r=document.createElement(o),r.setAttribute("rel","stylesheet"),r.setAttribute("type","text/css"),e.indexOf("?")!=-1?r.setAttribute("href",e):r.setAttribute("href",e)):(o="script",r=document.createElement(o),r.setAttribute("type","text/javascript"),r.async="true",e.indexOf("?")!=-1?r.setAttribute("src",e):r.setAttribute("src",e)),r.setAttribute("id",e),r.readyState?r.onreadystatechange=function(){"loaded"!=r.readyState&&"complete"!=r.readyState||($dhx.debug.log(r.readyState),r.onreadystatechange=null,t())}:e.indexOf(".css")!=-1?t():(r.onload=function(){t()},r.onerror=function(e){$dhx.debug.log("error on loading file: "+e.target.src.split("/")[e.target.src.split("/").length-1]),document.getElementById("$dhx_splash_div_file_info").innerHTML="<br>error</b> when loading the file: <br>"+e.target.src.split("/")[e.target.src.split("/").length-1]}),document.getElementsByTagName("head")[0].appendChild(r)):t()},getPagePosition:function(e,t,n){var i=0,o=0;return window.pageYOffset?(o=window.pageYOffset,i=window.innerWidth):0!==document.documentElement.scrollTop?(o=document.documentElement.scrollTop,i=document.documentElement.clientWidth):(o=document.body.scrollTop,i=document.body.clientWidth),i=i/2-t/2,o=window.innerHeight?o+window.innerHeight/2-n/2:o+document.body.clientHeight/2-n/2,"y"==e?o:i},Browser:{init:function(){this.name=this.searchString(this.dataBrowser)||"An unknown browser",this.onLine=navigator.onLine||"Unknow connection status",this.cookieEnabled=navigator.cookieEnabled||"Unknow cookies permission",this.plugins=navigator.plugins||"Unknow plugins",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version",this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(e){for(var t=0;t<e.length;t++){var n=e[t].string,i=e[t].prop;if(this.versionSearchString=e[t].versionSearch||e[t].identity,n){if(n.indexOf(e[t].subString)!=-1)return e[t].identity}else if(i)return e[t].identity}},searchVersion:function(e){var t=e.indexOf(this.versionSearchString);if(t!=-1)return parseFloat(e.substring(t+this.versionSearchString.length+1))},isPlugin:function(e){"undefined"==typeof e&&(e="notspecified");for(var t in $dhx.Browser.plugins)if($dhx.Browser.plugins.hasOwnProperty(t)){"undefined"==typeof $dhx.Browser.plugins[t].name&&($dhx.Browser.plugins[t].name="Unknow plugin");var n=new RegExp(""+e.toString(),"g");if("undefined"!=typeof $dhx.Browser.plugins[t].name&&$dhx.Browser.plugins[t].name.match(n))return!0}return!1},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera",versionSearch:"Version"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]},getAndSetWindowDimension:function(){var e=$dhx,t=document,n=window;n.innerWidth?(e.windowWidth=n.innerWidth,e.windowHeight=n.innerHeight):0!==t.documentElement.scrollTop?($dhx.windowWidth=t.documentElement.clientWidth,$dhx.windowHeight=t.documentElement.clientHeight):($dhx.windowWidth=t.body.clientWidth,$dhx.windowHeight=t.body.clientHeight)},hideDirections:function(){try{document.getElementById("$dhx_wrapper_splash").parentNode.removeChild(document.getElementById("$dhx_wrapper_splash")),document.getElementById("$dhx_splash").parentNode.removeChild(document.getElementById("$dhx_splash")),document.getElementById("$dhx_splash_div_file_info").parentNode.removeChild(document.getElementById("$dhx_splash_div_file_info"))}catch(e){}},showDirections:function(e){var t,n,i,o=this,r="";if(t=document.createElement("DIV"),t.setAttribute("style",'-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: alpha(opacity=50);'),t.setAttribute("id","$dhx_wrapper_splash"),t.style.width="100%",t.style.height="100%",t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.zIndex="9999",t.style.backgroundColor="#5190D1",t.style.opacity="0.5",n=document.createElement("DIV"),n.setAttribute("style","font-family:Tahoma, Geneva, sans-serif; font-size:11px; color:#069; text-align:center; padding-top:30px;padding-left:20px;"),n.setAttribute("id","$dhx_splash"),n.style.width="233px",n.style.height="21px",n.style.position="fixed",0===o.windowHeight&&o.getAndSetWindowDimension(),n.style.top=o.windowHeight/2-28+"px",n.style.left=o.windowWidth/2-105+"px",n.style.zIndex="999999",n.style.backgroundImage="url('"+loading_gif+"')",n.style.backgroundRepeat="no-repeat",n.style.opacity="1",n.style.textAlign="left",i=document.createElement("DIV"),i.setAttribute("style","white-space:nowrap;font-size:11px; color:#069; "),i.setAttribute("id","$dhx_splash_div_file_info"),i.style.width="400px",i.style.height="30px",i.style.position="fixed",i.style.top=o.windowHeight/2-27+"px",i.style.left=o.windowWidth/2-100+"px",i.style.zIndex="999999","MSXML"==e?(r+="<b>Your browser is out of date</b> <br>",r+="Your computer does not have a necessary component installed <br>",r+='<b>Please click <a target="_blank" style="color:#003399;" href="http://www.microsoft.com/en-us/download/details.aspx?id=19662" title="download">here</a> to install the component or use Firefox or Google Chrome</b>'):"COMPONENTS_DISABLED"==e?(r+='You are running Internet Explorer under <b>"no add-ons"</b> mode, <br>',r+="or ActiveXs are disabled <br>",r+="Close your browser and open the Internet Explorer again by reaching:<br><b>Start menu -> All Programs -> Internet Explorer</b>"):"PDF_MISSING"==e?(r+="The Acrobat Reader plugin could not be found! <br>",r+="If you are running IE, the ActiveXs may be disabled. Try to enable it. <br>",r+='You can also try to install Acrobat reader. <b>Please click <a target="_blank" style="color:#003399;" href="http://get.adobe.com/br/reader/" title="download">here</a> to download and install free Acrobat Reader</b>'):"BROWSER_VERSION_OUT_TO_DATE"==e?(r=r+"You are running "+$dhx.Browser.name+" "+$dhx.Browser.version+".<br>",r+="This version is not supported anymore.<br>",r+="Please download and install a new version of it."):"BROWSER_NOT_ALLOWED"==e?(r=r+"You are running "+$dhx.Browser.name+" "+$dhx.Browser.version+".<br>",r+="This Browser vendor is not supported.<br>",r+="List of supported browsers: <b>Internet Explorer 8+, Safari, Chrome 13+, Firefox 5+</b>"):"Loading_Files"==e?(r+="",r+="<b>Loading ... please wait!</b>"):"undefined"==typeof e?(r+="",r+="<b> ...</b><br>",r+="please wait!"):(r+="",r+=e),n.innerHTML=r,null===document.getElementById("$dhx_wrapper_splash"))try{document.body.appendChild(t),document.body.appendChild(n),document.body.appendChild(i)}catch(a){document.getElementsByTagName("body")[0].appendChild(t),document.getElementsByTagName("body")[0].appendChild(n),document.getElementsByTagName("body")[0].appendChild(i)}else document.getElementById("$dhx_wrapper_splash").style.display="block",document.getElementById("$dhx_splash").style.display="block",document.getElementById("$dhx_splash_div_file_info").style.display="block"},progressOff:function(){try{document.getElementById("$dhx_wrapper_loading_wheel").parentNode.removeChild(document.getElementById("$dhx_wrapper_loading_wheel")),document.getElementById("$dhx_loading_wheel").parentNode.removeChild(document.getElementById("$dhx_loading_wheel"))}catch(e){}},progressOn:function(e){var t,n,i=this;if(t=document.createElement("DIV"),t.setAttribute("style","filter: alpha(opacity=15); -moz-opacity: 0.15; opacity: 0.15; background-color: #93C0E7;"),t.setAttribute("id","$dhx_wrapper_loading_wheel"),t.style.width="100%",t.style.height="100%",t.style.position="fixed",t.style.top="0",t.style.left="0",t.style.zIndex="999888",n=document.createElement("DIV"),n.setAttribute("style","font-family:Tahoma, Geneva, sans-serif; font-size:11px; color:#069; text-align:center; padding-top:30px;padding-left:10px;"),n.setAttribute("id","$dhx_loading_wheel"),n.style.width="233px",n.style.height="21px",n.style.position="fixed",0===i.windowHeight&&i.getAndSetWindowDimension(),n.style.top=i.windowHeight/2-25+"px",n.style.left=i.windowWidth/2-121+"px",n.style.zIndex="999999",n.style.backgroundImage="url('"+loading_gif+"')",n.style.backgroundRepeat="no-repeat",n.style.opacity="1",n.style.textAlign="left",n.innerHTML=e,null===document.getElementById("$dhx_wrapper_loading_wheel"))try{document.body.appendChild(t),document.body.appendChild(n)}catch(o){document.getElementsByTagName("body")[0].appendChild(t),document.getElementsByTagName("body")[0].appendChild(n)}else{document.getElementById("$dhx_wrapper_loading_wheel").parentNode.removeChild(document.getElementById("$dhx_wrapper_loading_wheel")),document.getElementById("$dhx_loading_wheel").parentNode.removeChild(document.getElementById("$dhx_loading_wheel"));try{document.body.appendChild(t),document.body.appendChild(n)}catch(o){document.getElementsByTagName("body")[0].appendChild(t),document.getElementsByTagName("body")[0].appendChild(n)}}},toWords:function(e){var t=["","thousand","million","billion","trillion"],n=["zero","one","two","three","four","five","six","seven","eight","nine"],i=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],o=["twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e=e.toString(),e=e.replace(/[\, ]/g,""),e!=parseFloat(e))return"not a number";var r=e.indexOf(".");if(r==-1&&(r=e.length),r>15)return"too big";for(var a=e.split(""),d="",l=0,s=0;s<r;s++)(r-s)%3==2?"1"==a[s]?(d+=i[Number(a[s+1])]+" ",s++,l=1):0!==a[s]&&(d+=o[a[s]-2]+" ",l=1):0!==a[s]&&(d+=n[a[s]]+" ",(r-s)%3===0&&(d+="hundred "),l=1),(r-s)%3==1&&(l&&(d+=t[(r-s-1)/3]+" "),l=0);if(r!=e.length){var u=e.length;for(d+="point ",s=r+1;s<u;s++)d+=n[a[s]]+" "}return d.replace(/\s+/g," ")},isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},isObject:function(e){return"object"==typeof e&&null!==e&&"[object Array]"!==Object.prototype.toString.call(e)},isNumber:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},isValidDate:function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},isDate:function(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.getTime())},isFunction:function(e){return!!(e&&e.constructor&&e.call&&e.apply)},toCurrency:function(e){x=0,e<0&&(e=Math.abs(e),x=1),isNaN(e)&&(e="0"),cents=Math.floor((100*e+.5)%100),e=Math.floor((100*e+.5)/100).toString(),cents<10&&(cents="0"+cents);for(var t=0;t<Math.floor((e.length-(1+t))/3);t++)e=e.substring(0,e.length-(4*t+3))+","+e.substring(e.length-(4*t+3));return ret=e+"."+cents,1==x&&(ret=" - "+ret),ret},getParentByID:function(e){try{return document.getElementById(e).parentNode}catch(t){return!1}},parseFloat:function(e,t){return"undefined"==typeof t&&(t=2),e=e.replace(",",""),parseFloat(e).toFixed(t)},ext:function(e,t,n){var i,o,r,a;"undefined"==typeof n&&(n=!1);for(var d in t)if(n){o=!0,r="";for(var l=n.split("."),s=0;s<l.length;s++){var u=l[s];o?(window[u]=window[u]||{},r=window[u],o=!1):(r[u]=r[u]||{},r=r[u])}e&&null!==e?r[d]=Object.create(e):r[d]={},i=r[d];for(a in t[d])r[d][a]=r[a]||{},r[d][a]=t[d][a],i[a]=r[d][a]}else{e&&null!==e?window[d]=Object.create(e):window[d]={},i=window[d];for(a in t[d])i[a]=t[d][a]}return i},addEvent:function(){return document.addEventListener?function(e,t,n){if(e&&e.nodeName||e===window)e.addEventListener(t,n,!1);else if(e&&e.length)for(var i=0;i<e.length;i++)addEvent(e[i],t,n)}:function(e,t,n){if(e&&e.nodeName||e===window)e.attachEvent("on"+t,function(){return n.call(e,window.event)});else if(e&&e.length)for(var i=0;i<e.length;i++)addEvent(e[i],t,n)}}(),UTF8:{encode:function(e){for(var t,n=-1,i=(e=e.split("")).length,o=String.fromCharCode;++n<i;e[n]=(t=e[n].charCodeAt(0))>=127?o(192|t>>>6)+o(128|63&t):e[n]);return e.join("")},decode:function(e){for(var t,n,i=-1,o=(e=e.split("")).length,r=String.fromCharCode,a="charCodeAt";++i<o;128&(t=e[i][a](0))&&(e[i]=r(192===(252&t)&&128===(192&(n=e[i+1][a](0)))?((3&t)<<6)+(63&n):128),e[++i]=""));return e.join("")}},notify:function(e,t,n){if(n=n||"http://cdn.dhtmlx.com.br/dhx/notify.png","Notification"in window)if("granted"===Notification.permission){new Notification(e,{body:t,icon:n})}else"denied"!==Notification.permission&&Notification.requestPermission(function(i){if("permission"in Notification||(Notification.permission=i),"granted"===i){new Notification(e,{body:t,icon:n})}});else $dhx.debug.log("This browser does not support notifications.")},jDBdStorage:{storeObject:function(e,t){$dhx.debug.time("storeObject "+e),localStorage.setItem(e,JSON.stringify(t)),$dhx.debug.timeEnd("storeObject "+e)},insertRecord:function(e,t,n){var i=localStorage[e],o=JSON.parse(i);o.push(t),$dhx.jDBdStorage.saveDatabase(e,currently_data_array)},saveDatabase:function(e,t){$dhx.debug.time("save dataset "+e),localStorage.setItem(e,JSON.stringify(t)),$dhx.debug.timeEnd("save dataset "+e)},deleteDatabase:function(e){$dhx.debug.time("delete dataset "+e),localStorage.removeItem(e),$dhx.debug.timeEnd("delete dataset "+e)},get:function(e){$dhx.debug.time("get local storage "+e);var t=localStorage[e];if($dhx.debug.timeEnd("get local storage "+e),localStorage[e]){$dhx.debug.time("parse dataset "+e);var n=JSON.parse(t);return $dhx.debug.timeEnd("parse dataset "+e),n}return localStorage[e]},getTotalRecords:function(e){var t=localStorage[e];if(localStorage[e]){var n=JSON.parse(t);return n.length}return 0}},strip_tags:function(e,t){var n="",i=!1,o=[],r=[],a="",d=0,l="",s="",u=function(e,t,n){return n.split(e).join(t)};t&&(r=t.match(/([a-zA-Z0-9]+)/gi)),e+="",o=e.match(/(<\/?[\S][^>]*>)/gi);for(n in o)if(!isNaN(n)){s=o[n].toString(),i=!1;for(l in r)if(a=r[l],d=-1,0!==d&&(d=s.toLowerCase().indexOf("<"+a+">")),0!==d&&(d=s.toLowerCase().indexOf("<"+a+" ")),0!==d&&(d=s.toLowerCase().indexOf("</"+a)),0===d){i=!0;break}i||(e=u(s,"",e))}return e},isDHTMLXmodified:!1,modifyDHTMLXloader:function(){var e=this;e.isDHTMLXmodified||window.dhx4&&window.dhx&&(dhtmlXForm.prototype.items.vault={render:function(e,t){var n=this,i={parent:"",uploadUrl:t.uploadUrl||null,swfUrl:t.swfUrl||null,slUrl:t.slUrl||null,swfPath:t.swfPath||"dhxvault.swf",slXap:t.slXap||"dhxvault.xap",maxFileSize:t.maxFileSize||16777216},o=dhx.guid();this._vault_wrapper=$dhx.createElement({tag_name:"DIV",style:"min-height:100px;","class":"",id:"vault_wrapper_"+o,height:t.inputHeight,width:t.inputWidth}),i.parent=this._vault_wrapper.id,i.skin="dhx_skyblue",i.autoStart="undefined"!=typeof t.autoStart&&t.autoStart,i.autoRemove="undefined"!=typeof t.autoRemove&&t.autoRemove,i.buttonUpload="undefined"==typeof t.buttonUpload||t.buttonUpload,i.buttonClear="undefined"==typeof t.buttonClear||t.buttonClear,i.filesLimit="undefined"!=typeof t.filesLimit?t.filesLimit:0,this._vault[o]=new dhtmlXVaultObject(i),t.note?t.note.text?t.note.text=t.note.text+"<br> <span style='color:red;'>Max file size: "+this._vault[o].readableSize(i.maxFileSize)+". Allowed files: "+t.allowedExtensions+"</span>":t.note.text="<span style='color:red;'>Max file size: "+this._vault[o].readableSize(i.maxFileSize)+". Allowed files: "+t.allowedExtensions+"</span>":t.note={text:"<span style='color:red;'>Max file size: "+this._vault[o].readableSize(i.maxFileSize)+". Allowed files: "+t.allowedExtensions+"</span>"},e._type="vault",e.uid=o,e._enabled=!0,this.doAddLabel(e,t),this.doAddInput(e,t,"DIV",null,!0,!0,"dhxform_container"),this.doAttachEvents(e),this.setValue(e,t.value),this._uploadedFilesList[e.uid]=[];var r=e.childNodes[e._ll?1:0].childNodes[0];return r.style.height=t.inputHeight+"px",r.appendChild(this._vault_wrapper),t.allowedExtensions&&""!==t.allowedExtensions&&this._vault[o].attachEvent("onBeforeFileAdd",function(e){var n=this.getFileExtension(e.name);return"undefined"==typeof n?(dhtmlx.message({type:"error",text:"files without an extension are not allowed."}),!1):""===n||null===n?(dhtmlx.message({type:"error",text:"files without an extension are not allowed."}),!1):t.allowedExtensions.indexOf(n)>-1||(dhtmlx.message({type:"error",text:"the extension ' "+n+" ' is not allowed."}),!1)}),this._vault[o].attachEvent("onUploadComplete",function(t){t.forEach(function(t){t.uploaded&&(i.filesLimit&&1==i.filesLimit?(n._uploadedFilesList[e.uid]=[],n._uploadedFilesList[e.uid].push(t.serverName)):n._uploadedFilesList[e.uid].push(t.serverName))})}),this},_vault:[],_vault_wrapper:null,_uploadedFiles:[],_uploadedFilesList:[],getContainer:function(e){return this._vault[e.uid]},getVault:function(e){return this._vault[e.uid]},enable:function(e){e._enabled=!0,String(e.className).search("disabled")>=0&&(e.className=String(e.className).replace(/disabled/gi,"")),e.callEvent("onEnable",[e._idd]),this._vault[e.uid].enable()},disable:function(e){e._enabled=!1,String(e.className).search("disabled")<0&&(e.className+=" disabled"),e.callEvent("onDisable",[e._idd]),this._vault[e.uid].disable()},doAttachEvents:function(){},setValue:function(e,t){"string"==typeof t&&t.length>0&&(t=t.replace(/ /g,""),this._uploadedFilesList[e.uid]=t.split(","))},getValue:function(e){return this._uploadedFilesList[e.uid].join(",")}},dhtmlXForm.prototype.getVault=function(e){return this.doWithItem(e,"getVault")},function(){for(var e in dhtmlXForm.prototype.items.input)dhtmlXForm.prototype.items.vault[e]||(dhtmlXForm.prototype.items.vault[e]=dhtmlXForm.prototype.items.input[e])}(),dhtmlXForm.prototype.setFormData=function(e){for(var t in e){var n=this.getItemType(t);switch(n){case"checkbox":this[e[t]===!0||1==parseInt(e[t])||"true"==e[t]||e[t]==this.getItemValue(t,"realvalue")?"checkItem":"uncheckItem"](t);break;case"radio":this.checkItem(t,e[t]);break;case"input":case"textarea":case"password":case"select":case"multiselect":case"hidden":case"template":case"combo":case"calendar":case"vault":case"colorpicker":case"editor":this.setItemValue(t,e[t]);break;default:this["setFormData_"+n]?this["setFormData_"+n](t,e[t]):(this.hId||(this.hId=this._genStr(12)),this.setUserData(this.hId,t,e[t]))}}},dhtmlXForm.prototype.getFormData=function(e,t){var n,i={};for(n in this.itemPull){var o=this.itemPull[n]._idd,r=this.itemPull[n]._type;if("ch"==r&&(i[o]=this.isItemChecked(o)?this.getItemValue(o):0),"ra"!=r||i[this.itemPull[n]._group]||(i[this.itemPull[n]._group]=this.getCheckedValue(this.itemPull[n]._group)),r in{se:1,ta:1,pw:1,hd:1,tp:1,fl:1,calendar:1,combo:1,editor:1,colorpicker:1,vault:1}&&(i[o]=this.getItemValue(o,e)),this["getFormData_"+r]&&(i[o]=this["getFormData_"+r](o)),"up"==r){var a=this.getItemValue(o);for(var d in a)i[d]=a[d]}if(this.itemPull[n]._list)for(var l=0;l<this.itemPull[n]._list.length;l++){var s=this.itemPull[n]._list[l].getFormData(e,t);for(var u in s)i[u]=s[u]}}if(!t&&this.hId&&this._userdata[this.hId])for(n in this._userdata[this.hId])i[n]||(i[n]=this._userdata[this.hId][n]);return i},dhtmlXGridObject.prototype.dhxPDF=function(e,t,n,i,o,r,a){function d(e){var t,o,r=[];for(t=1;t<x.hdr.rows.length;t++)for(r[t]=[],o=0;o<x._cCount;o++){var a=x.hdr.rows[t].childNodes[o];r[t][o]||(r[t][o]=[0,0]),a&&(r[t][a._cellIndexS]=[a.colSpan,a.rowSpan])}var d="<rows profile='"+e+"'";for(n&&(d+=" header='"+n+"'"),i&&(d+=" footer='"+i+"'"),d+="><head>"+x._serialiseExportConfig(r).replace(/^<head/,"<columns").replace(/head>$/,"columns>"),t=2;t<x.hdr.rows.length;t++){var l=0,u=x.hdr.rows[t],h="";for(o=0;o<x._cCount;o++)if(x._srClmn&&!x._srClmn[o]||x._hrrar[o]&&(!x._fake||o>=x._fake.hdrLabels.length))l++;else{var c=r[t][o],p=c[0]&&c[0]>1?' colspan="'+c[0]+'" ':"";c[1]&&c[1]>1&&(p+=' rowspan="'+c[1]+'" ',l=-1);var g="",m=u;x._fake&&o<x._fake._cCount&&(m=x._fake.hdr.rows[t]);for(var f=0;f<m.cells.length;f++)if(m.cells[f]._cellIndexS==o){g=m.cells[f].getElementsByTagName("SELECT").length?"":_isIE?m.cells[f].innerText:m.cells[f].textContent,g=g.replace(/[ \n\r\t\xA0]+/," ");break}g&&" "!=g||l++,h+="<column"+p+"><![CDATA["+g+"]]></column>"}l!=x._cCount&&(d+="\n<columns>"+h+"</columns>")}return d+="</head>\n",d+=s()}function l(){var e,t=[];if(o)for(e=0;e<o.length;e++)t.push(h(x.getRowIndex(o[e])));else for(e=0;e<x.getRowsNum();e++)t.push(h(e));return t.join("\n")}function s(){var e=["<foot>"];if(!x.ftr)return"";for(var t=1;t<x.ftr.rows.length;t++){e.push("<columns>");for(var n=x.ftr.rows[t],i=0;i<x._cCount;i++)if((!x._srClmn||x._srClmn[i])&&(!x._hrrar[i]||x._fake&&!(i>=x._fake.hdrLabels.length))){for(var o,r,a=0;a<n.cells.length;a++)if(o="",r="",n.cells[a]._cellIndexS==i){o=_isIE?n.cells[a].innerText:n.cells[a].textContent,o=o.replace(/[ \n\r\t\xA0]+/," "),n.cells[a].colSpan&&1!=n.cells[a].colSpan&&(r=" colspan='"+n.cells[a].colSpan+"' "),n.cells[a].rowSpan&&1!=n.cells[a].rowSpan&&(r=" rowspan='"+n.cells[a].rowSpan+"' ");break}e.push("<column"+r+"><![CDATA["+o+"]]></column>")}e.push("</columns>")}return e.push("</foot>"),e.join("\n")}function u(e,t){return(window.getComputedStyle?window.getComputedStyle(e,null)[t]:e.currentStyle?e.currentStyle[t]:null)||""}function h(e){if(!x.rowsBuffer[e])return"";var t=x.render_row(e);if("none"==t.style.display)return"";for(var n=x.isTreeGrid()?' level="'+x.getLevel(t.idd)+'"':"",i="<row"+n+">",o=0;o<x._cCount;o++)if((!x._srClmn||x._srClmn[o])&&(!x._hrrar[o]||x._fake&&o<x._fake.hdrLabels.length)){var r=x.cells(t.idd,o);if(f){var a=u(r.cell,"color"),d=u(r.cell,"backgroundColor"),l=u(r.cell,"font-weight")||u(r.cell,"fontWeight"),s=u(r.cell,"font-style")||u(r.cell,"fontStyle"),h=u(r.cell,"text-align")||u(r.cell,"textAlign"),c=u(r.cell,"font-family")||u(r.cell,"fontFamily");"transparent"!=d&&"rgba(0, 0, 0, 0)"!=d||(d="rgb(255,255,255)"),i+="<cell bgColor='"+d+"' textColor='"+a+"' bold='"+l+"' italic='"+s+"' align='"+h+"' font='"+c+"'>"}else i+="<cell>";i+="<![CDATA["+(r.getContent?r.getContent():r.getTitle())+"]]></cell>"}return i+"</row>"}function c(){var e="</rows>";return e}function p(){var n=document.createElement("div");n.style.height="100%",n.style.width="100%";var i="grid_"+a+".pdf";n.id=(new Date).getTime();var o=new $dhx.ui.window({id:(new Date).getTime()-1e3,left:$dhx.ui.crud.simple.View.settings.app_generic.window.left,top:$dhx.ui.crud.simple.View.settings.app_generic.window.top,width:800,height:500});o.button("park").hide(),o.button("minmax").hide(),o.button("stick").hide(),o.setText("Grid PDF version");var r=o.attachStatusBar();r.setText("Press ctrl+p (cmd+p Mac) to print it"),document.body.appendChild(n);var s="form_"+x.uid();n.innerHTML='<iframe name="pdfFrame" width="100%" height="100%" frameborder="0"></iframe><form style="display:none;" id="'+s+'" method="post" action="'+e+'" accept-charset="utf-8" enctype="application/x-www-form-urlencoded" target="pdfFrame"><input type="hidden" name="grid_xml" id="grid_xml"/><input type="hidden" name="viewer" id="viewer" value="'+$dhx.ui.cdn_address+"dhx/ui/pdfjs/web/viewer.php?pdf_name="+$dhx.ui.cdn_address+"dhx/ui/bin/2pdf/"+i+'"/><input type="hidden" name="pdf_name" id="pdf_name" value="'+i+'"/> </form>',o.attachObject(n.id),document.getElementById(s).firstChild.value=encodeURIComponent(d(t).replace("–","-")+l()+c()),document.getElementById(s).submit(),x=null,g&&(g.el.parentNode.className+=" rowselected",g.el.className+=" cellselected"),g=null}var g={row:this.getSelectedRowId(),col:this.getSelectedCellIndex()};if(null===g.row||g.col===-1)g=!1;else if(g.row&&g.row.indexOf(this.delim)!==-1){var m=this.cells(g.row,g.col).cell;m.parentNode.className=m.parentNode.className.replace(" rowselected",""),m.className=m.className.replace(" cellselected",""),g.el=m}else g=!1;t=t||"color";var f="full_color"==t,x=this;x._asCDATA=!0,"undefined"==typeof r?this.target=' target="_blank"':this.target=r,eXcell_ch.prototype.getContent=function(){return this.getValue()},eXcell_ra.prototype.getContent=function(){return this.getValue()},p()},e.isDHTMLXmodified=!0,$dhx.debug.log("some dhtmlx methods were modified"))},init:function(e){var t=this;"undefined"!=typeof $dhx.Request&&(null!==$dhx.$_GET("_enable_log")&&("true"==$dhx.$_GET("_enable_log")&&($dhx._enable_log=!0),$dhx.debug.log("%c $dhx framework started ","background: #00ebbe; color: #fff; font-size: 12px; padding: 12px; line-height: 36px; font-family: Helvetica, Arial, sans-serif;")),null!==$dhx.$_GET("_enable_benchmark")&&"true"==$dhx.$_GET("_enable_benchmark")&&($dhx._enable_benchmark=!0)),$dhx.debug.info("starting $dhx"),t.Browser.init(),"undefined"!=typeof e&&e.plugins,t.isDHTMLXmodified||t.modifyDHTMLXloader()},toArray:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(e[n]);return t},extend:function(e,t){"undefined"==typeof t&&(t={}),$dhx.isObject(t)||(t={}),"undefined"==typeof e&&(e={}),$dhx.isObject(e)||(e={});for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},dhx_elements:{},_ppc:!1,popup:function(){return $dhx._ppc===!1&&($dhx._ppc=new dhtmlXPopup),$dhx._ppc},createElement:function(e){var t=document.createElement(e.tag_name),n=e.id||"el_"+window.dhx4.newId();return t.setAttribute("style",e.style||""),t.setAttribute("class",e["class"]||""),$dhx.dhx_elements[n]=e,t.setAttribute("id",n),"undefined"!=typeof $dhx.dhx_elements[n].parent&&$dhx.dhx_elements[n].parent!==!1?$dhx.dhx_elements[n].parent.appendChild(t):"undefined"!=typeof $dhx.dhx_elements[n].parent&&$dhx.dhx_elements[n].parent===!1||document.body.appendChild(t),e.title&&(t.addEventListener("mouseover",function(n){$dhx.popup().attachHTML(e.title),$dhx.popup().show(n.clientX,n.clientY,t.style.width.replace(/px/,""),t.style.height.replace(/px/,""))}),t.addEventListener("mouseout",function(){$dhx.popup().hide()})),$dhx.dhx_elements[n].html&&(t.innerHTML=$dhx.dhx_elements[n].html),$dhx.dhx_elements[n].dnd&&(t.draggable=!0),$dhx.dhx_elements[n].width&&(t.style.width=$dhx.dhx_elements[n].width+"px"),$dhx.dhx_elements[n].height&&(t.style.height=$dhx.dhx_elements[n].height+"px"),window.addEventListener("resize",function(){for(var e in $dhx.dhx_elements){var t=document.getElementById(e);"undefined"==typeof $dhx.dhx_elements[e].resize_width&&($dhx.dhx_elements[e].resize_width=!1),"undefined"==typeof $dhx.dhx_elements[e].resize_height&&($dhx.dhx_elements[e].resize_height=!1),$dhx.dhx_elements[e].resize_width===!0?t.style.width=window.innerWidth+"px":$dhx.isNumber($dhx.dhx_elements[e].resize_width)&&$dhx.dhx_elements[e].resize_width!==!1&&(t.style.width=window.innerWidth+$dhx.dhx_elements[e].resize_width+"px"),$dhx.dhx_elements[e].resize_height===!0?t.style.height=window.innerHeight+"px":$dhx.isNumber($dhx.dhx_elements[e].resize_height)&&$dhx.dhx_elements[e].resize_height!==!1&&(t.style.height=window.innerHeight+$dhx.dhx_elements[e].resize_height+"px")}},!0),t},defined:function(e,t){return e=e||!1,t=t||!1,!!e&&(t?"string"==typeof t&&typeof e==t:"undefined"!=typeof e&&(null!==e&&e!==!1))},queryString:function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),i=n.exec(t);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},debug:{log:function(){$dhx.queryString("_enable_log")&&console.log(arguments)},info:function(){$dhx.queryString("_enable_log")&&console.info(arguments)},debug:function(){$dhx.queryString("_enable_log")&&console.debug(arguments)},error:function(){$dhx.queryString("_enable_log")&&console.error(arguments)},dir:function(){$dhx.queryString("_enable_log")&&console.dir(arguments)},time:function(e){$dhx._enable_benchmark&&console.time(e)},timeEnd:function(e){$dhx._enable_benchmark&&console.timeEnd(e)},warn:function(){$dhx.queryString("_enable_log")&&console.warn(arguments)}}}),Object.defineProperty($dhx,"CDN",{value:"//cdn.dhtmlx.com.br/",enumerable:!0,configurable:!1,writable:!1}),Object.defineProperty($dhx,"version",{value:"1.0.0",enumerable:!0,configurable:!1,writable:!1}),Object.defineProperty($dhx,"Author",{value:"José Eduardo Perotta de Almeida (www.web2solutions.com.br)",enumerable:!0,configurable:!1,writable:!1}),window.onload=function(){$dhx.init()},$dhx.cookie={set:function(e,t,n,i){var o=!1,r=window.location.hostname;if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var a="";if(n)switch(n.constructor){case Number:a=n===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+n;break;case String:a="; expires="+n;break;case Date:a="; expires="+n.toUTCString()}return document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+a+(r?"; domain=."+r:"")+(o?"; path="+o:"")+(i?"; secure":""),!0},del:function(e,t,n){var i=$dhx.cookie;return t=t||!1,n=n||window.location.hostname,!!i.hasItem(e)&&(document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(n?"; domain="+n:"")+(t?"; path="+t:""),!0)},hasItem:function(e){return!!e&&new RegExp("(?:^|;\\s*)"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},setByKey:function(e,t,n,i){var o=$dhx.cookie;try{var r=unescape(o.get(e));if(r){r=r.split("&"),r.forEach(function(e,n,i){e=e.split("="),e[0]==t});var a=o.get(e)+"&"+t+"="+n;o.set(e,a,i)}else o.set(e,""+t+"="+n,360);return!0}catch(d){return!1}},get:function(e){return e?decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null:null},getByKey:function(e,t){var n=$dhx.cookie;try{var i=n.get(e);if(""===i)return!1;try{cookievaluesep=i.split("&")}catch(o){
return!1}for(c=0;c<cookievaluesep.length;c++){if(cookienamevalue=cookievaluesep[c].split("="),!(cookienamevalue.length>1))return!1;if(cookienamevalue[0]==t)return unescape(cookienamevalue[1].toString().replace(/\+/gi," "))}return!1}catch(o){return!1}}};