????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.36 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/www.notes-online.se/symbols/notes/stipa/js/ |
Upload File : |
function init(){
var path = extractValue("drawingpath");
var companyid = extractValue("companyid");
if(localStorage.getItem("Synced_"+companyid+"_"+path) == null || localStorage.getItem("Synced_"+companyid+"_"+path) == "Hämta"){
alert("Du måste checka ut filen innan du kan fylla i formuläret \n(Landlord->Checka ut!)");
window.location = "http://www.notes-online.se/symbols/notes/sllas/empty.html";
}else{
// Sets the localStorage based in querystring
setQueryParameters();
// Set symbol topic
document.getElementById("symbolname").innerHTML = localStorage.getItem("symbol") + " - "+ localStorage.getItem("number");
document.getElementById("symboltype").value = localStorage.getItem("symbol");
// Get the localStorage object for the current form
var storedData = localStorage.getItem("SENDTOSERVER_"+localStorage.getItem("companyid")+"_"+localStorage.getItem("drawingpath")+"_"+localStorage.getItem("symbolid")+"_"+localStorage.getItem("number"));
// Check if data was found in localStorage
if(storedData != null){
populateFields(storedData);
}
save();
}
}
// Pupulate the fields with data from localStorage
function populateFields(storedData){
eval("var storedData_obj ="+storedData);
for (i = 0; i < storedData_obj.length; i++) {
var type = storedData_obj[i][1];
var name = storedData_obj[i][0];
var value = storedData_obj[i][2];
if (type == "text" || type == "textarea" || type == "tel") {
document.getElementById(name).value = value;
} else if (type == "select-one") {
var selObj = document.getElementById(name);
for (var j = 0; j < selObj.options.length; j++) {
if (selObj.options[j].text == value) {
selObj.options[j].selected = true;
}
}
} else if (type == "radio") {
var selObj = document.getElementById(name);
if(value == "1"){
selObj.checked = true;
}
if(value == "0"){
selObj.checked = false;
}
} else if (type == "checkbox") {
var selObj = document.getElementById(name);
if(value == "ja"){
selObj.checked = true;
}else{
selObj.checked = false;
}
}
}
document.getElementById("Signatur").value = localStorage.getItem("username");
d = new Date();
document.getElementById("Datum").value = d.yyyymmdd();
}
// Set localStorage objects based on querystring
function setQueryParameters(){
localStorage.setItem("symbol",extractValue("symbol"));
localStorage.setItem("username",extractValue("username"));
localStorage.setItem("drawingpath",extractValue("drawingpath"));
localStorage.setItem("x_position",extractValue("x_position"));
localStorage.setItem("y_position",extractValue("y_position"));
localStorage.setItem("symbolid",extractValue("symbolId"));
localStorage.setItem("companyid",extractValue("companyid"));
localStorage.setItem("number",extractValue("number"));
// Set values to hidden bottom form
document.getElementById("symbol").value = localStorage.getItem("symbol");
document.getElementById("drawingpath").value = localStorage.getItem("drawingpath");
document.getElementById("x_position").value = localStorage.getItem("x_position");
document.getElementById("y_position").value = localStorage.getItem("y_position");
document.getElementById("symbolid").value = localStorage.getItem("symbolid");
document.getElementById("companyid").value = localStorage.getItem("companyid");
document.getElementById("number").value = localStorage.getItem("number");
document.getElementById("localStorageName").value = "SENDTOSERVER_"+localStorage.getItem("companyid")+"_"+localStorage.getItem("drawingpath")+"_"+localStorage.getItem("symbolid")+"_"+localStorage.getItem("number");
document.getElementById("Signatur").value = localStorage.getItem("username");
d = new Date();
document.getElementById("Datum").value = d.yyyymmdd();
}
// Extract variable from url
function extractValue(variable){
var url = decodeURIComponent(document.location.toString());
var value = url.substring(url.indexOf(variable+"=") + variable.length + 1);
var pos = value.indexOf("&");
if(pos !== -1){
return value.substring(0, pos);
}else{
return value;
}
}
function checkIfFilled(){
save();
var ok = true;
for (i = 0; i < document.forms[0].elements.length; i++) {
var value = document.forms[0].elements[i].value;
if(value == "Välj"){
ok = false;
}
}
if(ok == false){
alert("Du måste fylla i alla listor!");
}else{
alert("Sparat!");
}
}
// Save data to localStorage
function save(){
var data = Array();
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;
if(type == "checkbox"){
if(document.getElementById(name).checked){
value = "ja";
}else{
value = "nej";
}
}else if(type == "radio"){
if(document.getElementById(name).checked){
value = "1";
}else{
value = "0";
}
}
var obj = Array(name,type,value);
data.push(obj);
}
localStorage.setItem("SENDTOSERVER_"+localStorage.getItem("companyid")+"_"+localStorage.getItem("drawingpath")+"_"+localStorage.getItem("symbolid")+"_"+localStorage.getItem("number"),JSON.stringify(data));
}
Date.prototype.yyyymmdd = function() {
var yyyy = this.getFullYear().toString();
var mm = (this.getMonth()+1).toString(); // getMonth() is zero-based
var dd = this.getDate().toString();
var H = this.getHours().toString();
var i = this.getMinutes().toString();
var s = this.getSeconds().toString();
return yyyy +"-"+ (mm[1]?mm:"0"+mm[0]) +"-"+ (dd[1]?dd:"0"+dd[0]) + " "+(H[1]?H:"0"+H[0])+":"+(i[1]?i:"0"+i[0])+":"+(s[1]?s:"0"+s[0]); // padding
};