????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.191.73.161 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/labs.astacus.se/POCKETLORD/js/js/ |
Upload File : |
// JavaScript Document // Global variables var hasBeenOffline = false; function init(storageName){ online(); if((navigator.userAgent.match("iPhone"))) { document.getElementsByTagName('html')[0].style.zoom = 0.5; } if(storageName != ""){ xml = localStorage.getItem(storageName); if(xml != null){ // FillForm(storageName); }else{ // Nothing is saved locally, we need to populate forms with data from localAOData var savedString = localStorage.getItem('localAOData'); var JSONdata = JSON.parse(savedString); if(JSONdata != null){ // FillFormJSON(storageName,JSONdata); } } } var registerTemp = localStorage.getItem("registerTemp"); if(registerTemp!= ""){ var JSONdata = JSON.parse(registerTemp); var fCode = document.getElementById(JSONdata.item.qCode); var fDescription = document.getElementById(JSONdata.item.qDescription); fCode.value = JSONdata.item.code; fDescription.value = JSONdata.item.description; localStorage.setItem("registerTemp",""); } } // Returns the array index in arbetsorder for a given aonummer. function getIndexForAONumber(aonummer){ //alert(aonummer); var index = 0; for(ao_item in arbetsordrar.arbetsordrar.arbetsorder) { if(arbetsordrar.arbetsordrar.arbetsorder[index].aonummer == aonummer){ return index; } index++; } return -1; } function setBarcode(barcode,page,target){ //alert("Barcode: "+barcode+" Page: "+page+" Target:"+target); location.href= page+"?mn="+barcode+"&target="+target; } function getJSONData(JSONString){ alert(JSONString); } function newAO(){ var r=confirm("Vill du ärva egenskaper från den senaste arbetsordern?"); if (r==true){ window.location = "uppdrag.html?ao=inherit"; }else{ window.location = "uppdrag.html?ao=null"; } } function landlord_alert(){ alert("Working!") } // Sets the image to offline function offline(){ hasBeenOffline = true; document.getElementById("version").innerHTML = "OFFLINE"; } // Sets the image to online function online(){ document.getElementById("version").innerHTML = "ONLINE"; if(hasBeenOffline == true){ //FillForm(); hasBeenOffline = false; //var r=confirm("Vill du synkronisera all data?"); } } function openRegisterView(code,description){ var ao = getQueryAONummer(); if(code == "artikel_forrad"){ ao = ""; // We dont need ao-number for Förråd! } window.location = "register.html?ao="+ao+"&code="+code+"&description="+description; } // Add Items to a select menu function addSelectItems(selectId, items){ var select = document.getElementById(selectId); select.options.length = 0; for(index in items) { select.options[select.options.length] = new Option(items[index].kod, index); } } // Selects Items to a select menu function selectItem(selectId, items){ var selObj = document.getElementById(selectId); for (i=0; i<selObj.options.length; i++) { if (selObj.options[i].text == items) { selObj.options[i].selected = true; } } } function updateFieldsFromRegister(qCode,qDescription,code,description,aonumber){ if(qCode == "artikel" || qCode == "artikel_forrad" ){ // In artikel (Förråd) we want to add "code" instead of description var registerTemp = { "item": {"qCode": qCode, "qDescription": qDescription, "code": code, "description": code } } }else{ var registerTemp = { "item": {"qCode": qCode, "qDescription": qDescription, "code": code, "description": description } } } localStorage.setItem("registerTemp",JSON.stringify(registerTemp)); if(qCode == "byggnad"){ window.location = "uppdrag.html?ao="+aonumber; }else if(qCode == "plan"){ window.location = "uppdrag.html?ao="+aonumber; }else if(qCode == "rum"){ window.location = "uppdrag.html?ao="+aonumber; }else if(qCode == "installationstyp"){ window.location = "atgard.html?ao="+aonumber; }else if(qCode == "installationsnummer"){ window.location = "atgard.html?ao="+aonumber; }else if(qCode == "kundid"){ window.location = "ovrigt.html?ao="+aonumber; }else if(qCode == "projekt"){ window.location = "ovrigt.html?ao="+aonumber; }else if(qCode == "artikel"){ window.location = "forrad.html?ao="+aonumber; } else if(qCode == "artikel_forrad"){ window.location = "index.html"; // We dont need any ID for Förråd } } // Add Items to a textfield function addFieldItem(selectId, i){ var field = document.getElementById(selectId); field.value = i; } //Update the description based on new option text function updateSelect(selObj,items,field){ var newText = selObj.options[selObj.selectedIndex].text; items = eval(items); for(index in items) { if(items[index].kod == newText){ addFieldItem(field,items[index].beskrivning); } } } // Creates an XML of all fields data and saves it in localStorage called localXML function submit_xml(storageName, page){ var formname = document.forms[0].name; var path = document.location; var formUniqueId = 1; var xml = '<?xml version="1.0" encoding="UTF-8"?>\n<Form>\n<FormName>'+formname+'</FormName>\n<FormPath>'+path+'</FormPath>\n<FormUniqueId>'+formUniqueId+'</FormUniqueId>\n<Fields>\n'; for (i=0; i<document.forms[0].elements.length; i++) { var type = document.forms[0].elements[i].type; var name = document.forms[0].elements[i].name; var value = document.forms[0].elements[i].value; xml += '<Field>\n'; xml += ' <FieldName>'+name+'</FieldName>\n'; xml += ' <FieldType>'+type+'</FieldType>\n'; xml += ' <FieldValue>'+value+'</FieldValue>\n'; xml += '</Field>\n'; } xml += '</Fields></Form>\n'; localStorage.setItem(storageName, xml); alert(xml); if(page != "index.html"){ location.href= page+"?ao="+getQueryAONummer(); }else{ location.href= page; } } // Fills the forms based on saved localStorage called storageName function FillForm(storageName){ xml = localStorage.getItem(storageName); if(xml != null){ if (window.DOMParser) { parser=new DOMParser(); xmlDoc=parser.parseFromString(xml,"text/xml"); } else // Internet Explorer { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.loadXML(xml); } var FormName = xmlDoc.getElementsByTagName("FormName")[0].childNodes[0].nodeValue; var Fields = xmlDoc.getElementsByTagName("Fields"); for (i=0;i<Fields.length;i++){ var Field = Fields[i].getElementsByTagName("Field"); for (j=0;j<Field.length;j++){ var FieldName = Field[j].getElementsByTagName("FieldName")[0].childNodes[0].nodeValue; var FieldType = Field[j].getElementsByTagName("FieldType")[0].childNodes[0].nodeValue; var FieldValue = Field[j].getElementsByTagName("FieldValue")[0].childNodes[0].nodeValue; var oForm = document.forms[FormName]; if(oForm != undefined){ if(FieldType == "checkbox"){ if(FieldValue == "1"){ oForm[FieldName].checked = true; }else{ oForm[FieldName].checked = false; } }else if(FieldType == "radio"){ for(a=0;a<oForm[FieldName].length;a++){ if( oForm[FieldName][a].value == FieldValue){ oForm[FieldName][a].checked = true; } } }else if(FieldType == "text"){ oForm[FieldName].value = FieldValue; }else if(FieldType == "select-one"){ for(a=0;a<oForm[FieldName].length;a++){ if( oForm[FieldName][a].value == FieldValue){ oForm[FieldName][a].selected = true; } } } } } } } } // Fills the forms based on saved localStorage called localAOData function FillFormJSON(storageName, JSONdata){ var x = 0; for(ao_item in JSONdata.arbetsordrar.arbetsorder) { var AONummer = JSONdata.arbetsordrar.arbetsorder[x].AONummer; var path = document.location.toString(); if(path.substring(path.indexOf("?")+4) == AONummer){ var fields = null; if(storageName == "localArbetsorder"){ fields = JSONdata.arbetsordrar.arbetsorder[x].arbetsorder; }else if(storageName == "localUppdrag"){ fields = JSONdata.arbetsordrar.arbetsorder[x].uppdrag; }else if(storageName == "localPlats"){ fields = JSONdata.arbetsordrar.arbetsorder[x].plats; }else if(storageName == "localAtgard"){ fields = JSONdata.arbetsordrar.arbetsorder[x].atgard; }else if(storageName == "localTid"){ fields = JSONdata.arbetsordrar.arbetsorder[x].tid; }else if(storageName == "localForrad"){ fields = JSONdata.arbetsordrar.arbetsorder[x].forrad; } for(field in fields) { var formname = document.forms[0].name; for (i=0; i<document.forms[0].elements.length; i++){ var type = document.forms[0].elements[i].type; var name = document.forms[0].elements[i].name; for(field in fields){ if(field == name){ var v = fields[field]; var oForm = document.forms[FormName]; if(oForm != undefined){ if(type == "checkbox"){ if(v == "1"){ oForm[name].checked = true; }else{ oForm[name].checked = false; } }else if(type == "radio"){ for(a=0;a<oForm[name].length;a++){ if( oForm[name][a].value == v){ oForm[name][a].checked = true; } } }else if(type == "text"){ oForm[name].value = v; }else if(type == "select-one"){ for(a=0;a<oForm[name].length;a++){ if( oForm[name][a].value == v){ oForm[name][a].selected = true; } } } } } } } } } x++; } } function storeAOData(data){ localStorage.setItem("localAOData", JSON.stringify(data)); } function getQueryAONummer(){ var path = document.location.toString(); var qAONummer = path.substring(path.indexOf("?")+4); var pos = qAONummer.indexOf("&"); if(pos === -1){ return qAONummer; }else{ return qAONummer.substring(0,pos); } } function getQueryCode(){ var path = document.location.toString(); var qCode = path.substring(path.indexOf("&code=")+6); var pos = qCode.indexOf("&"); return qCode.substring(0,pos); } function getQueryDescritpion(){ var path = document.location.toString(); return path.substring(path.indexOf("&description=")+13); } function setTopic(x){ var topic = document.getElementById("topic"); var aonummer = getQueryAONummer(); topic.innerHTML = "Arbetsorder: "+ aonummer +" - "+arbetsordrar.arbetsordrar.arbetsorder[x].atgard.status_desc; } function increase(fieldId){ var field = document.getElementById(fieldId); field.value = parseInt(field.value) + parseInt(1); } function decrease(fieldId){ var field = document.getElementById(fieldId); if(field.value > 0){ field.value = parseInt(field.value) - parseInt(1); } } function reloadPage(page){ return page +"?"+Math.random(); }