var dialog;
var polygon;
var tempChartReloadTimer;
var update_timer, tableReloadTimer, tableIgnCut_timer, mapUpdateTimer, update_timer, geofence_layer, rectangleFeature, modifyControl, currentFeature;
var wss=0;
let isResizing = false;
function resizeView(id)
{
console.log(id);
console.log($("#view_" + id ).attr('data-status'));
}
function highlight(){
}
function getTable_ajax(section){
switch(section) {
case 'userTable':
url = '../mobil/xml/xmlUserTable.php';
break;
}
$.ajax({
url: url,
context: document.body,
dataType: 'xml'
}).success(function(data) {
//console.log(data);
//$( '#' + div ).html(data);
$(data).find('response').each(function () {
var html = $(this).find(section).text();
$('#' + section).html(html);
})
});
}
function min_to_hour(minutes)
{
hours = Math.floor((minutes)/60);
return hours;
}
function min_to_minutes(minutes_src)
{
minutes = minutes_src - (Math.floor((minutes_src)/60))*60;
return minutes;
}
function editGroupFromMenu(grp_id){
jq_modal('actions/editGroup.php?grp_id=' + encodeURIComponent(grp_id),'','dialog', 0, 0);
}
function spinner(timeout, steps, message_array, message_container)
{
single_step_duration = timeout / steps;
var xmlHttp = xml_request();
url = "../mobil/xml/xmlGetSpinner.php";
nachricht = "timeout=" + timeout;
// alert(nachricht);
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
// console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
spinner_html = response.getElementsByTagName('spinner')[0].firstChild.data;
$('#spinner').html(spinner_html);
Object.keys(message_array).forEach(function(propertyName, i) {
setTimeout(function() {
console.log(message_array[propertyName]);
$('#' + message_container).html(message_array[propertyName]);
}, i * single_step_duration);
});
}
}
}
function storeLat()
{
lat1 = $('#lat1').val();
lng1 = $('#lng1').val();
lat2 = $('#lat2').val();
lng2 = $('#lng2').val();
var xmlHttp = xml_request();
url = "../mobil/xml/xml_storeLat.php";
nachricht = "lat1="+ lat1 + "&lng1=" + lng1 + "&lat2=" + lat2 + "&lng2=" + lng2;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
// alert(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
state = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
$('#result').html(message);
if(state=='1')
{
setTimeout(function(){
}, 1500);
}
}
}
}
function getTrackerPosition(id)
{
var xmlHttp = xml_request();
url = "system/frontend/trackingportal/mobil/xml/xml_getTrackerPosition.php";
nachricht = "id="+ encodeURIComponent(id);
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
lat = response.getElementsByTagName('lat')[0].firstChild.data;
lng = response.getElementsByTagName('lng')[0].firstChild.data;
state = response.getElementsByTagName('state')[0].firstChild.data;
var lonLat=new OpenLayers.LonLat(lng, lat).transform(map.displayProjection, map.getProjectionObject());
//map.setCenter(lonLat,map.getZoom());
map.panTo(lonLat);
if(state=='1')
{
setTimeout(function(){
}, 1500);
}
}
}
}
function sendNewPassword(v,l,e,h){
var xmlHttp = xml_request();
url = "../../mobil/xml/xmlSendNewPassword.php";
nachricht = "v="+ v + "&l=" + l + "&e=" + e + "&h=" + h;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
// alert(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
state = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
$('#result').html(message);
if(state=='1')
{
setTimeout(function(){
}, 1500);
}
}
}
}
function registerSocketConnectionId(c,t){
var xmlHttp = xml_request();
url = "/system/frontend/trackingportal/mobil/xml/xmlRegisterSocketConnectionId.php";
nachricht = "c=" + encodeURIComponent(c) + '&t=' + t;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
// alert(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
state = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
$('#result').html(message);
if(state=='1')
{
setTimeout(function(){
}, 1500);
}
}
}
}
function GroupFilter(id){
followDevice('0','0','0','0','0');
var xmlHttp = xml_request();
url = "xml/xmlSetGroupFilterCookie.php";
nachricht = "id="+id;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
item = response.getElementsByTagName('item')[0].firstChild.data;
result = response.getElementsByTagName('result')[0].firstChild.data;
//alert(result);
console.log(item);
if(result=='1')
{
//document.getElementById(id).innerHTML = (item);
update();
setTimeout(function(){
extent();
update();
}, 1500);
}
}
}
}
function get_ranges(tr_id){
try
{
xmlHttp = new xml_request();
if (xmlHttp) {
var tuesday_stop1 = 0;
url_getAlertValues = 'xml/xml_get_timeranges.php5';
content_getAlertValues = "tr_id="+tr_id;
xmlHttp.open("POST", url_getAlertValues, true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(content_getAlertValues);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
response = xmlHttp.responseXML.documentElement;
//alert(xmlHttp.responseText);
monday_start = parseInt(response.getElementsByTagName('monday_start')[0].firstChild.data);
monday_stop = parseInt(response.getElementsByTagName('monday_stop')[0].firstChild.data);
//alert(monday_start);
if(((monday_start==0) && (monday_stop==0)) || (monday_start==-1))
{
$('#tr_monday').css("text-decoration", "line-through").css("color", "#CCCCCC");
}
else
{
$('#tr_monday').css("text-decoration", "none").css("color", "black");
}
tuesday_start = parseInt(response.getElementsByTagName('tuesday_start')[0].firstChild.data);
tuesday_stop = parseInt(response.getElementsByTagName('tuesday_stop')[0].firstChild.data);
if(((tuesday_start==0) && (tuesday_stop==0)) || (tuesday_start==-1))
{
$('#tr_tuesday').css("text-decoration", "line-through").css("color", "#CCCCCC");
}
else
{
$('#tr_tuesday').css("text-decoration", "none").css("color", "black");
}
wednesday_start = parseInt(response.getElementsByTagName('wednesday_start')[0].firstChild.data);
wednesday_stop = parseInt(response.getElementsByTagName('wednesday_stop')[0].firstChild.data);
if(((wednesday_start==0) && (wednesday_stop==0)) || (wednesday_start==-1))
{
$('#tr_wednesday').css("text-decoration", "line-through").css("color", "#CCCCCC");
}
else
{
$('#tr_wednesday').css("text-decoration", "none").css("color", "black");
}
thursday_start = parseInt(response.getElementsByTagName('thursday_start')[0].firstChild.data);
thursday_stop = parseInt(response.getElementsByTagName('thursday_stop')[0].firstChild.data);
if(((thursday_start==0) && (thursday_stop==0)) || (thursday_start==-1))
{
$('#tr_thursday').css("text-decoration", "line-through").css("color", "#CCCCCC");
}
else
{
$('#tr_thursday').css("text-decoration", "none").css("color", "black");
}
friday_start = parseInt(response.getElementsByTagName('friday_start')[0].firstChild.data);
friday_stop = parseInt(response.getElementsByTagName('friday_stop')[0].firstChild.data);
if(((friday_start==0) && (friday_stop==0)) || (friday_start==-1))
{
$('#tr_friday').css("text-decoration", "line-through").css("color", "#CCCCCC");
}
else
{
$('#tr_friday').css("text-decoration", "none").css("color", "black");
}
saturday_start = parseInt(response.getElementsByTagName('saturday_start')[0].firstChild.data);
saturday_stop = parseInt(response.getElementsByTagName('saturday_stop')[0].firstChild.data);
if(((saturday_start==0) && (saturday_stop==0)) || (saturday_start==-1))
{
$('#tr_saturday').css("text-decoration", "line-through").css("color", "#CCCCCC");
}
else
{
$('#tr_saturday').css("text-decoration", "none").css("color", "black");
}
sunday_start = parseInt(response.getElementsByTagName('sunday_start')[0].firstChild.data);
sunday_stop = parseInt(response.getElementsByTagName('sunday_stop')[0].firstChild.data);
if(((sunday_start==0) && (sunday_stop==0)) || (sunday_start==-1))
{
$('#tr_sunday').css("text-decoration", "line-through").css("color", "#CCCCCC");
}
else
{
$('#tr_sunday').css("text-decoration", "none").css("color", "black");
}
$("#0_hour_start option").filter(function() { return $(this).text() == min_to_hour(monday_start); }).prop("selected", true);
$("#0_hour_stop option").filter(function() { return $(this).text() == min_to_hour(monday_stop); }).prop("selected", true);
$("#0_minute_start option").filter(function() { return $(this).text() == min_to_minutes(monday_start); }).prop("selected", true);
$("#1_hour_start option").filter(function() { return $(this).text() == min_to_hour(tuesday_start); }).prop("selected", true);
$("#1_hour_stop option").filter(function() { return $(this).text() == min_to_hour(tuesday_stop); }).prop("selected", true);
$("#1_minute_start option").filter(function() { return $(this).text() == min_to_minutes(tuesday_start); }).prop("selected", true);
$("#2_hour_start option").filter(function() { return $(this).text() == min_to_hour(wednesday_start); }).prop("selected", true);
$("#2_hour_stop option").filter(function() { return $(this).text() == min_to_hour(wednesday_stop); }).prop("selected", true);
$("#2_minute_start option").filter(function() { return $(this).text() == min_to_minutes(wednesday_start); }).prop("selected", true);
$("#3_hour_start option").filter(function() { return $(this).text() == min_to_hour(thursday_start); }).prop("selected", true);
$("#3_hour_stop option").filter(function() { return $(this).text() == min_to_hour(thursday_stop); }).prop("selected", true);
$("#3_minute_start option").filter(function() { return $(this).text() == min_to_minutes(thursday_start); }).prop("selected", true);
$("#4_hour_start option").filter(function() { return $(this).text() == min_to_hour(friday_start); }).prop("selected", true);
$("#4_hour_stop option").filter(function() { return $(this).text() == min_to_hour(friday_stop); }).prop("selected", true);
$("#4_minute_start option").filter(function() { return $(this).text() == min_to_minutes(friday_start); }).prop("selected", true);
$("#5_hour_start option").filter(function() { return $(this).text() == min_to_hour(saturday_start); }).prop("selected", true);
$("#5_hour_stop option").filter(function() { return $(this).text() == min_to_hour(saturday_stop); }).prop("selected", true);
$("#5_minute_start option").filter(function() { return $(this).text() == min_to_minutes(saturday_start); }).prop("selected", true);
$("#6_hour_start option").filter(function() { return $(this).text() == min_to_hour(sunday_start); }).prop("selected", true);
$("#6_hour_stop option").filter(function() { return $(this).text() == min_to_hour(sunday_stop); }).prop("selected", true);
$("#6_minute_start option").filter(function() { return $(this).text() == min_to_minutes(sunday_start); }).prop("selected", true);
if(monday_start=='-1')
{
monday_start = 0;
monday_stop = 0;
}
if(tuesday_start=='-1')
{
tuesday_start = 0;
tuesday_stop = 0;
}
if(wednesday_start=='-1')
{
wednesday_start = 0;
wednesday_stop = 0;
}
if(thursday_start=='-1')
{
thursday_start = 0;
thursday_stop = 0;
}
if(friday_start=='-1')
{
friday_start = 0;
friday_stop = 0;
}
if(saturday_start=='-1')
{
saturday_start = 0;
saturday_stop = 0;
}
if(sunday_start=='-1')
{
sunday_start = 0;
sunday_stop = 0;
}
// alert(sunday_start);
is_next_day_to_monday = '';
if((parseInt(monday_start + monday_stop)) >= 1440)
{
//alert(parseInt(monday_start + monday_stop));
// alert(monday_start + monday_stop);
monday_stop = (1440-monday_stop-(monday_start))*(-1);
//monday_stop = monday_stop * (-1);
$("#0_hour_stop option").filter(function() { return $(this).text() == min_to_hour(monday_stop); }).prop("selected", true);
//$("#0_hour_stop option").filter(function() { return $(this).text() == min_to_hour(monday_stop); }).prop("selected", true);
document.getElementById('monday_overnight').innerHTML = '';
}
else
{
monday_stop = (monday_start + monday_stop);
// alert(monday_stop);
$("#0_hour_stop option").filter(function() { return $(this).text() == min_to_hour(monday_stop); }).prop("selected", true);
//$("#0_hour_stop option").filter(function() { return $(this).text() == min_to_hour(monday_stop); }).prop("selected", true);
//document.getElementById('monday_follow').innerHTML = '';
document.getElementById('monday_overnight').innerHTML = '';
}
//alert(min_to_hour(monday_stop));
if((tuesday_start + tuesday_stop) >= 1440)
{
tuesday_stop = (1440 - tuesday_stop - (tuesday_start))*(-1);
document.getElementById('tuesday_overnight').innerHTML = '';
//document.getElementById('tuesday_follow').innerHTML = '';
$("#1_hour_stop option").filter(function() { return $(this).text() == min_to_hour(tuesday_stop); }).prop("selected", true);
//$("#1_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(tuesday_stop); }).prop("selected", true);
}
else
{
tuesday_stop = (tuesday_start + tuesday_stop);
$("#1_hour_stop option").filter(function() { return $(this).text() == min_to_hour(tuesday_stop); }).prop("selected", true);
//$("#1_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(tuesday_stop); }).prop("selected", true);
//document.getElementById('tuesday_follow').innerHTML = '';
document.getElementById('tuesday_overnight').innerHTML = '';
}
if((wednesday_start + wednesday_stop) >= 1440)
{
wednesday_stop = (1440 - wednesday_stop - (wednesday_start))*(-1);
$("#2_hour_stop option").filter(function() { return $(this).text() == min_to_hour(wednesday_stop); }).prop("selected", true);
//$("#2_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(wednesday_stop); }).prop("selected", true);
//document.getElementById('wednesday_follow').innerHTML = '';
document.getElementById('wednesday_overnight').innerHTML = '';
}
else
{
wednesday_stop = (wednesday_start + wednesday_stop);
$("#2_hour_stop option").filter(function() { return $(this).text() == min_to_hour(wednesday_stop); }).prop("selected", true);
//$("#2_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(wednesday_stop); }).prop("selected", true);
//document.getElementById('wednesday_follow').innerHTML = '';
document.getElementById('wednesday_overnight').innerHTML = '';
}
if((thursday_start + thursday_stop) >= 1440)
{
thursday_stop = (1440 - thursday_stop - (thursday_start))*(-1);
$("#3_hour_stop option").filter(function() { return $(this).text() == min_to_hour(thursday_stop); }).prop("selected", true);
//$("#3_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(thursday_stop); }).prop("selected", true);
document.getElementById('thursday_overnight').innerHTML = '';
//document.getElementById('thursday_follow').innerHTML = '';
}
else
{
thursday_stop = (thursday_start + thursday_stop);
$("#3_hour_stop option").filter(function() { return $(this).text() == min_to_hour(thursday_stop); }).prop("selected", true);
//$("#3_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(thursday_stop); }).prop("selected", true);
//document.getElementById('thursday_follow').innerHTML = '';
document.getElementById('thursday_overnight').innerHTML = '';
}
if((friday_start + friday_stop) >= 1440)
{
friday_stop = (1440 - friday_stop - (friday_start))*(-1);
$("#4_hour_stop option").filter(function() { return $(this).text() == min_to_hour(friday_stop); }).prop("selected", true);
//$("#4_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(friday_stop); }).prop("selected", true);
//document.getElementById('friday_follow').innerHTML = '';
document.getElementById('friday_overnight').innerHTML = '';
}
else
{
friday_stop = (friday_start + friday_stop);
$("#4_hour_stop option").filter(function() { return $(this).text() == min_to_hour(friday_stop); }).prop("selected", true);
//$("#4_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(friday_stop); }).prop("selected", true);
//document.getElementById('friday_follow').innerHTML = '';
document.getElementById('friday_overnight').innerHTML = '';
}
if((saturday_start + saturday_stop) >= 1440)
{
saturday_stop = (1440 - saturday_stop - (saturday_start))*(-1);
$("#5_hour_stop option").filter(function() { return $(this).text() == min_to_hour(saturday_stop); }).prop("selected", true);
//$("#5_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(saturday_stop); }).prop("selected", true);
document.getElementById('saturday_overnight').innerHTML = '';
//document.getElementById('saturday_follow').innerHTML = '';
}
else
{
saturday_stop = (saturday_start + saturday_stop);
$("#5_hour_stop option").filter(function() { return $(this).text() == min_to_hour(saturday_stop); }).prop("selected", true);
//$("#5_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(saturday_stop); }).prop("selected", true);
//document.getElementById('saturday_follow').innerHTML = '';
document.getElementById('saturday_overnight').innerHTML = '';
}
if((sunday_start + sunday_stop) >= 1440)
{
sunday_stop = (1440 - sunday_stop - (sunday_start))*(-1);
$("#6_hour_stop option").filter(function() { return $(this).text() == min_to_hour(sunday_stop); }).prop("selected", true);
//$("#6_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(sunday_stop); }).prop("selected", true);
//document.getElementById('sunday_follow').innerHTML = '';
document.getElementById('sunday_overnight').innerHTML = '';
}
else
{
sunday_stop = (sunday_start + sunday_stop);
$("#6_hour_stop option").filter(function() { return $(this).text() == min_to_hour(sunday_stop); }).prop("selected", true);
//$("#6_hour_stop option").filter(function() { return $(this).text() == min_to_minutes(sunday_stop); }).prop("selected", true);
//document.getElementById('sunday_follow').innerHTML = '';
document.getElementById('sunday_overnight').innerHTML = '';
}
$("#0_minute_stop option").filter(function() { return $(this).text() == min_to_minutes(monday_stop); }).prop("selected", true);
$("#1_minute_stop option").filter(function() { return $(this).text() == min_to_minutes(tuesday_stop); }).prop("selected", true);
$("#2_minute_stop option").filter(function() { return $(this).text() == min_to_minutes(wednesday_stop); }).prop("selected", true);
$("#3_minute_stop option").filter(function() { return $(this).text() == min_to_minutes(thursday_stop); }).prop("selected", true);
$("#4_minute_stop option").filter(function() { return $(this).text() == min_to_minutes(friday_stop); }).prop("selected", true);
$("#5_minute_stop option").filter(function() { return $(this).text() == min_to_minutes(saturday_stop); }).prop("selected", true);
$("#6_minute_stop option").filter(function() { return $(this).text() == min_to_minutes(sunday_stop); }).prop("selected", true);
}
}
}
}catch(e){
}
}
function sorting(icon_id,section,sort_item){
//$(".sorting_icon").css('color', '#FFFFFF');
$( "#" + $("#latest").val() ).css('color', '#DBDBDB');
state = $("#" + icon_id).attr('value');
//console.log(sort_item);
try{$("#openFenceOrderBy").attr('value', sort_item);}catch(e){}
try{$("#openFenceOrder").attr('value', state);}catch(e){}
if(state=="ASC"){
$("#" + icon_id).attr("value", 'DESC');
$("#" + icon_id).attr("class", "fa fa-arrow-up");
}else
{
$("#" + icon_id).attr("value", 'ASC');
$("#" + icon_id).attr("class", "fa fa-arrow-down");
}
$("#" + icon_id).css('color', '#25CC51');
getTable(section,sort_item,state);
$("#latest").attr("value", icon_id);
//alert($("#latest").val());
}
function getCheckedItems(item_class)
{
var favorite = [];
$.each($("input[class~='" + item_class + "']:checked"), function(){
favorite.push(this.id);
});
return favorite;
}
function getCheckedNames(item_class)
{
var favorite = [];
$.each($("input[class='" + item_class + "']:checked"), function(){
favorite.push(this.name);
});
return favorite;
}
function resizeLabel(x,y)
{
try{
if(y==1)
{
$('#extended_' + x).show();
$('#caret_' + x).hide();
// $('#tooltipWidth').val('212');
// $('#tooltipHeight').val('40');
$('#tooltip_foreground_view_' + x).css({'width':'212px','z-index': '1000','height': '40px'});
//$('#tooltip_foreground_view_' + x).css('height', '40px');
}
else
{
$('#extended_' + x).hide();
$('#caret_' + x).show();
// $('#tooltipWidth').val('120');
// $('#tooltipHeight').val('20');
$('#tooltip_foreground_view_' + x).css({'width':'120px','z-index': '1','height': '20px'});
}
} catch(e) { }
}
var tableReloadTimer;
var mapUpdateTimer;
var remote_responses;
var xxxx;
function load_remote_responses(){
//document.getElementById('sms').innerHTML = 'Konto: 4 SMS';
var remote_responses_request = new xml_request();
url_remote_responses = 'xml/xml_remoteResponses.php';
remote_responses_request.open('GET', url_remote_responses, true);
remote_responses_request.send("");
remote_responses_request.onreadystatechange = function ()
{
if (remote_responses_request.readyState == 4)
{
try{
responseA = remote_responses_request.responseXML.documentElement;
//console.log(responseA);
command_response = responseA.getElementsByTagName('command_response')[0].firstChild.data;
configured = responseA.getElementsByTagName('configured')[0].firstChild.data;
sent = responseA.getElementsByTagName('sent')[0].firstChild.data;
reply = responseA.getElementsByTagName('reply')[0].firstChild.data;
command_value = responseA.getElementsByTagName('command_sent')[0].firstChild.data;
success = responseA.getElementsByTagName('success')[0].firstChild.data;
//0=no response (no open / un-notified remote commands)
//1=okay
//2=failed
if(command_response != '0')
{
if(success == 1)
{
image = '../images/green_hook.png';
document.getElementsByTagName("audio")[0].play();
}
if(success == 2)
{
image = '../images/exclam.png';
document.getElementsByTagName("audio")[1].play();
}
growl('Remotebefehl','Befehl: '+command_value+'
Antwort: '+command_response+'
Befehl gesetzt: '+configured+'
Übertragen: '+sent+'
Rückmeldung Gerät: '+reply,image,'10000','false');
}
//longitude = remote_responses_request.getElementsByTagName('lng')[0].firstChild.data;
//follow = remote_responses_request.getElementsByTagName('follow')[0].firstChild.data;
}catch(e){
//alert('Fehler' + e.toString());
}
};
try{
remote_responses_request.send(null);
} catch(e) { }
}
}
function reloadCaptcha(){
document.getElementById("captcha_span").innerHTML = '
';
}
function enableMap(){
try{ clearInterval(tableReloadTimer);} catch (e) {}
try{ clearInterval(tableReloadTimer2);} catch (e) {}
try{ clearInterval(mapUpdateTimer);} catch (e) {} //xml-realtime
try{ clearInterval(xxxx);} catch (e) {}
try{ clearInterval(tableRemoteTimer);} catch (e) {} //remote result table in modules / remote
try{ clearInterval(tempChartReloadTimer);plot.destroy();} catch (e) {} //remote result table in modules / remote
try{ clearInterval(tableIgnCut_timer);} catch (e) {} //remote ign cut result table
$('#content_wrapper').html('');
$('#map1234').show();$('.control-sidebar').addClass('control-sidebar-open');
try{ $('#sidebar_right_spinner').show();} catch (e) {};
tableReloadTimer = setInterval(function(){ getTable('infoFrame'); }, 60000);
mapUpdateTimer = setInterval(function(){ update(); }, update_timer);
update();
$('#tree-checkable').jstree(true).refresh();
try{$( "#dialog").dialog( 'close');} catch (e) {}
}
var isSmall = window.matchMedia("(max-width: 699px)");
var isMiddle = window.matchMedia("(min-width: 700px) AND (max-width: 1023px)");
var isLarge = window.matchMedia("(min-width: 1024px)");
function load_module(file, div, rightbar, message, language){
$('#calendar_header').html('');
//console.log( $('.static-sidebar').css('width') );
try{geofence_layer.removeAllFeatures();} catch (e) {console.log(e);}
try{map.removeLayer(geofence_layer);} catch (e) {console.log(e);}
try{ clearInterval(deviceUpgradeTimer);} catch (e) {}
try{ clearInterval(subscriptions_reload_timer);} catch (e) {}
try{ clearInterval(tableReloadTimer);} catch (e) {}
try{ clearInterval(tableReloadTimer2);} catch (e) {}
try{ clearInterval(mapUpdateTimer);} catch (e) {} //xml-realtime
try{ clearInterval(xxxx);} catch (e) {}
try{ clearInterval(tableRemoteTimer);} catch (e) {} //remote result table in modules / remote
try{ clearInterval(tempChartReloadTimer);plot.destroy();} catch (e) {} //remote result table in modules / remote
try{ clearInterval(AIN_reload_timer);} catch (e) {}
try{ clearInterval(tableIgnCut_timer);} catch (e) {} //remote ign cut result table
//try{ setTimeout(fetchData, 3600000);} catch (e) {}
$.ajaxSetup({
timeout: 30000
});
//alert(right_bar);
if(rightbar==1)
{
try{ $('#sidebar_right_spinner').show();} catch (e) {}
var isMobile = window.matchMedia("only screen and (max-width: 1260px)");
if (isMobile.matches) {
//Conditional script here
//alert('<1260');
$('#right_bar').hide();
$('#rect_ad2').show();
$('#wide_ad').hide('2000');
}
else
{
$('#right_bar').show();
$('#rect_ad2').hide();
$('#wide_ad').show('2000');
}
update();
$('#extent_map').show();
$('#btn_zoom_in').show();
$('#btn_zoom_out').show();
$('#groupFilterDropdown').show();
//$('#color_left').show();
$('#tooltip').show();
$('#testaaaa').show();
$('#autoCenter_value').show();
$('#trigger-infobar').show();
$('#refresh_btn').show();
$("#map1234").css("overflow-x", "");
try{$( "#right_veh_bar").attr("value", "1");} catch (e) {}
tableReloadTimer = setInterval(function(){ getTable('infoFrame'); }, 60000);
mapUpdateTimer = setInterval(function(){ update(); }, update_timer);
$('#tree-checkable').jstree(true).refresh();
tableReloadTimer2 = setInterval(function(){
$('#tree-checkable').jstree(true).refresh();
}, 300000);
}
else
{
try{ $('#sidebar_right_spinner').hide();} catch (e) {}
try{ $('.control-sidebar').removeClass('control-sidebar-open');} catch (e) {}
$('#wide_ad').hide();
$('#rect_ad').hide();
$('#rect_ad2').hide();
$('#testaaaa').hide();
$('#extent_map').hide();
$('#btn_zoom_in').hide();
$('#btn_zoom_out').hide();
$('#refresh_btn').hide();
//$('#color_left').hide();
$('#tooltip').hide();
$('#autoCenter_value').hide();
$('#trigger-infobar').hide();
$("#map1234").css("overflow-x", "hidden");
$('#groupFilterDropdown').hide();
try{$( "#right_veh_bar").attr("value", "0");} catch (e) {}
}
try{$( "#dialog").dialog( 'close');} catch (e) {}
try{$( "#help").dialog( 'close');} catch (e) {}
$( "#" + div ).html( '
Bitte warten... ' + message + '
' );
if(rightbar==1)
{
$('.infobar-wrapper').show();
}
else
{
$('.infobar-wrapper').hide();
}
try{ if (isSmall.matches) { $('.infobar-wrapper').hide('750');$('body').toggleClass('sidebar-collapsed');$('#right_bar').hide(); } } catch (e) {}
var signature = $('a[id="' + file + '"]').attr('data-signature');
//console.log("Siggi: " + signature);
if(file=='mod_user_management')
{
$.ajax({
url: 'xml/module_loader.php?signature=' + encodeURIComponent(signature),
xhrFields: {
withCredentials: true
},
dataType: "text",
success: function(data) {
console.log(data);
$( "#" + div ).html(data);
$(data).find("response").each(function () {
var _name = 'State: ' + $(this).find('state').text();
var signature = 'signature: ' + $(this).find('signature').text();
var html = $(this).find('html').text();
var fileName = $(this).find('html').text();
console.log(fileName);
if(file.indexOf("?")>=0)
{
newPath = fileName + '&rand=' + uniqueId();
}
else
{
newPath = fileName + '?rand=' + uniqueId();
}
/* $( "#" + div ).load(newPath, function(responseText, statusText, xhr)
{
// if(statusText == "success")
// alert("Successfully loaded the content!");
// if(statusText == "error")
//console.log("An error occurred: " + xhr.status + " - " + xhr.statusText);
}); */
});
}
});
return;
}
if(file.indexOf("?")>=0)
{
newPath = file + '&rand=' + uniqueId();
}
else
{
newPath = file + '?rand=' + uniqueId();
}
$( "#footer").html( 'gps.my-gps.org');
$( "#" + div ).load(newPath, function(responseText, statusText, xhr)
{
// if(statusText == "success")
// alert("Successfully loaded the content!");
// if(statusText == "error")
//console.log("An error occurred: " + xhr.status + " - " + xhr.statusText);
});
//alert(uniqueId());
$("#" + div ).css('z-index', 1);
}
function adClick(id, ad_topic, ad_class, ad_subclass){
var xmlHttp = xml_request();
url = "xml/xmlAdClick.php";
nachricht = "id="+id +
'&ad_topic=' + ad_topic +
'&ad_class=' + ad_class +
'&ad_subclass=' + ad_subclass;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
item = response.getElementsByTagName('item')[0].firstChild.data;
result = response.getElementsByTagName('result')[0].firstChild.data;
//alert(result);
console.log(item);
if(result=='1')
{
document.getElementById(id).innerHTML = (item);
}
}
}
}
function getLanguageItem(id){
var xmlHttp = xml_request();
url = "xml/xmlGetLanguageItem.php";
nachricht = "id="+id;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
item = response.getElementsByTagName('item')[0].firstChild.data;
result = response.getElementsByTagName('result')[0].firstChild.data;
//alert(result);
if(result=='1')
{
document.getElementById(id).innerHTML = (item);
}
}
}
}
function changeXHRlanguage(language){
var expires = new Date();
expires.setTime(expires.getTime() + (365 * 24 * 60 * 60 * 1000));
document.cookie = 'language=' + language +';path=/'+ ';expires=' + expires.toUTCString();
getLanguageItem('LOA_LNG');
setTimeout(function(){
document.getElementById('LOA_LNG').innerHTML = '';
}, 2500);
setTimeout(function(){
reload_menu('modules/menu.php?language=' + language,'menu',0,(''));
getTable('infoFrame');
$('#tree-checkable').jstree(true).refresh();
getLanguageItem('INF_FRAME_YOUR_OBJECTS');
getLanguageItem('SPEC_OFF_EBAY');
getLanguageItem('MAP_AUTOCENTER');
}, 3000);
}
function reload_menu(file, div, rightbar, message, language){
$.ajaxSetup({
timeout: 30000
});
$( "#menu").html( '' );
$( "#menu").load( file + '&rand=' + uniqueId(), function(responseText, statusText, xhr)
{
//if(statusText == "success")
// alert("Successfully loaded the content!");
//if(statusText == "error")
//console.log("An error occurred: " + xhr.status + " - " + xhr.statusText);
});
$("#menu").css('z-index', 1);
}
function createInvoice(user_id, imei_id, plan_id){
//$('#invoice_content').empty();
//$('#invoice_content').html('Bitte warten, Ihre Bestellung wird verarbeitet
');
var xmlHttp = xml_request();
url = "xml/xmlCreateInvoice.php";
nachricht = "user_id=" + user_id + "&imei_id=" + imei_id+ "&plan_id=" + plan_id;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
////console.log(xmlHttp.responseText);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
value = response.getElementsByTagName('value')[0].firstChild.data;
if(result == '-1')
{
toaster('2', message);
}
else
{
if(result=='1')
{
conversion_sale_invoice(value);
//toaster('1',message);
}
else {
}
}
setTimeout(function(){
$("#invoice_content").html('');
}, 2500);
}
}
}
function removeHiDriveKey()
{
var xmlHttp = xml_request();
url = "../mobil/xml/xmlRemoveHiDriveKey.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
////console.log(xmlHttp.responseText);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
else
{
if(result=='1')
{
setTimeout(function(){
$("#authorizeHiDrive").removeClass("disabled");
$("#delAuthHiDrive").addClass("disabled");
$( "#fa_connect_hidrive" ).removeClass( "fa-refresh fa-spin " );
getHiDrive();
}, 500);
}
else {
}
}
}
}
}
function pieHover(event, pos, obj)
{
if (!obj)
return;
percent = parseFloat(obj.series.percent).toFixed(2);
$("#hover").html(''+obj.series.label+' ('+percent+'%)');
}
function getDropbox(){
$("#authorizeDropbox").addClass("disabled");
$("#authorizeDropboxDelete").addClass("disabled");
$("input[name=toggle-dropbox]").bootstrapSwitch("disabled",true);
var xmlHttp = xml_request();
url = "../mobil/xml/xmlGetDropbox.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
// console.log(xmlHttp.responseText);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
try{quota = response.getElementsByTagName('quota')[0].firstChild.data;} catch (e) {}
message = response.getElementsByTagName('message')[0].firstChild.data;
//alert(message);
//alert('Dropbox:'+result)
if(result=='0')
{
$("input[name=toggle-dropbox]").bootstrapSwitch("disabled",true);
setTimeout(function(){
$("#authorizeDropbox").removeClass("disabled");
$("#authorizeDropboxDelete").addClass("disabled");
// document.getElementById('alias').innerHTML = '';
$('#interactive').hide();
// $('#hidriveChartHeadline').hide();
//document.getElementById('authorizeHiDrive').innerHTML = ign_on;
}, 100);
}
else
{
$("input[name=toggle-dropbox]").bootstrapSwitch("disabled",false);
try{$('#quota').html(quota);} catch (e) {}
$('#interactive').show();
// $('#hidriveChartHeadline').show('slow');
setTimeout(function(){
$("#authorizeDropbox").addClass("disabled");
$("#authorizeDropboxDelete").removeClass("disabled");
}, 100);
}
// $("input[name=toggle-dropbox]").bootstrapSwitch("state", false);
// $("input[name=toggle-dropbox]").bootstrapSwitch('toggleDisabled',true,true);
}
}
}
function disconnectDropbox(){
$('#disconnectDropbox').addClass('disabled');
var xmlHttp = xml_request();
url = "../mobil/xml/xmlDisconnectDropbox.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
// console.log(xmlHttp.responseText);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
// $("#authorizeDropbox").addClass("disabled");
if(result=='0')
{
}
setTimeout(function(){
try{$( "#dialog").dialog( 'close');} catch (e) {}
getDropbox();
},2500);
}
}
}
function disconnectHidrive(){
$('#disconnectHidrive').addClass('disabled');
var xmlHttp = xml_request();
url = "../mobil/xml/xmlDisconnectHidrive.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
// console.log(xmlHttp.responseText);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
// $("#authorizeDropbox").addClass("disabled");
if(result=='0')
{
}
else
{
try{$( "#dialog").dialog( 'close');} catch (e) {}
try{$( "#quota_hidrive").html('');} catch (e) {}
getHiDrive();
}
setTimeout(function(){
//getHidrive();
},2500);
}
}
}
function getHiDrive(){
$("#authorizeHidrive").addClass("disabled");
$("#authorizeHidrive2").addClass("disabled");
$("#authorizeHidriveDelete").addClass("disabled");
$("input[name=toggle-Hidrive]").bootstrapSwitch("disabled",true);
var xmlHttp = xml_request();
url = "../mobil/xml/xmlGetHiDrive.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
// console.log(xmlHttp.responseText);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
try{quota = response.getElementsByTagName('quota')[0].firstChild.data;} catch (e) {}
message = response.getElementsByTagName('message')[0].firstChild.data;
//alert(message);
//alert('Hidrive:'+result)
try{available = response.getElementsByTagName('available')[0].firstChild.data;} catch (e) {}
try{percentage_usage_free = response.getElementsByTagName('percentage_usage_free')[0].firstChild.data;} catch (e) {}
if(result=='0')
{
//console.log(result);
$("input[name=toggle-Hidrive]").bootstrapSwitch("disabled",true);
$("#authorizeHiDrive2").removeClass("disabled");
$("#authorizeHidrive").removeClass("disabled");
$("#authorizeHidriveDelete").addClass("disabled");
setTimeout(function(){
// document.getElementById('alias').innerHTML = '';
//$('#interactive').hide();
// $('#hidriveChartHeadline').hide();
//document.getElementById('authorizeHiDrive').innerHTML = ign_on;
}, 1000);
}
else
{
$("input[name=toggle-Hidrive]").bootstrapSwitch("disabled",false);
try{$('#quota_hidrive').html(quota);} catch (e) {}
$('#interactive').show();
$("#authorizeHidrive").addClass("disabled");
$("#authorizeHidrive2").addClass("disabled");
$("#authorizeHidriveDelete").removeClass("disabled");
// $('#hidriveChartHeadline').show('slow');
setTimeout(function(){
}, 100);
percentage_usage_free = parseFloat(percentage_usage_free).toFixed(2);
used = 100 - percentage_usage_free;
used = parseFloat(used).toFixed(2);
available = quota - available;
available_space_formatted = parseFloat(available/1024/1024/1024).toFixed(2);
quota = parseFloat(quota/1024/1024/1024).toFixed(2);
document.getElementById('quota_hidrive').innerHTML = 'Ihr Hidrive ist verbunden ('+available_space_formatted+'GB von '+quota+'GB belegt)';
}
// $("input[name=toggle-Hidrive]").bootstrapSwitch("state", false);
// $("input[name=toggle-Hidrive]").bootstrapSwitch('toggleDisabled',true,true);
}
}
}
function getHiDriveOld(){
var xmlHttp = xml_request();
url = "../mobil/xml/xmlGetHiDrive.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
////console.log(xmlHttp.responseText);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
alias = response.getElementsByTagName('alias')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
//alert(message);
if(alias=='-1')
{
setTimeout(function(){
$("#authorizeHiDrive").removeClass("disabled");
$("#delAuthHiDrive").addClass("disabled");
//document.getElementById('alias').innerHTML = '';
$('#interactive').hide();
$('#hidriveChartHeadline').hide();
//document.getElementById('authorizeHiDrive').innerHTML = ign_on;
}, 100);
}
else
{
$('#interactive').show();
$('#hidriveChartHeadline').show('slow');
setTimeout(function(){
$("#authorizeHiDrive").addClass("disabled");
$("#delAuthHiDrive").removeClass("disabled");
//document.getElementById('alias').innerHTML = alias;
quota = response.getElementsByTagName('quota')[0].firstChild.data;
available = response.getElementsByTagName('available')[0].firstChild.data;
percentage_usage_free = response.getElementsByTagName('percentage_usage_free')[0].firstChild.data;
percentage_usage_free = parseFloat(percentage_usage_free).toFixed(2);
used = 100 - percentage_usage_free;
used = parseFloat(used).toFixed(2);
available = quota - available;
available_space_formatted = parseFloat(available/1024/1024/1024).toFixed(2);
quota = parseFloat(quota/1024/1024/1024).toFixed(2);
document.getElementById('quota_hidrive').innerHTML = 'Ihr Hidrive ist verbunden ('+available_space_formatted+'GB von '+quota+'GB belegt)';
//$("#authorizeHiDrive").attr("disabled", true);
// data
var datax = [
{ label: "USED", data: used, color: '#FF0505'},
{ label: "FREE", data: percentage_usage_free, color: '#4EBF24'}
];
// INTERACTIVE
$.plot($("#interactive"), datax,
{
series: {
pie: {
show: true
}
},
grid: {
hoverable: true,
clickable: true
},
legend: {
show: false
},
tooltip: true,
tooltipOpts: {
content: "%p.0%, %s"
}
});
$("#interactive").bind("plothover", pieHover);
}, 100);
}
}
}
}
function changeInvoiceAddress(){
$("#btn_chg_addr").addClass("disabled");
document.getElementById('circle').innerHTML = '
';
abfrage = new xml_request();
zip = document.getElementById('zip').value;
street = document.getElementById('street').value;
street_nbr = document.getElementById('street_nbr').value;
town = document.getElementById('town').value;
company = document.getElementById('company').value;
country_code = document.getElementById('country_code').value;
account_type = document.getElementById('account_type').value;
try
{
url = "../mobil/xml/xmlChangeInvoiceAddress.php?random=" + Math.random();
message = "zip=" + encodeURIComponent(zip) + "&street=" + encodeURIComponent(street) + "&street_nbr=" + encodeURIComponent(street_nbr) + "&town=" + encodeURIComponent(town) + "&country_code=" + encodeURIComponent(country_code) + "&account_type=" + account_type + "&company=" + encodeURIComponent(company);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message_txt = response.getElementsByTagName('message_txt')[0].firstChild.data;
message_html = response.getElementsByTagName('message_html')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message_txt);
}
if(result == '0')
{
toaster('2',message_txt);
}
if(result == '1')
{
toaster('1',message_txt);
}
if(result == '-1')
{
//toaster('2',msg);
//window.parent.permissionWindow(0);
}
else
{
setTimeout(function(){
},500);
// dialog.close();
}
setTimeout(function(){
$("#btn_chg_addr").removeClass("disabled");
document.getElementById('chgAddressResult').innerHTML = message_html;
getTable('user_account_info','x','x','x');
document.getElementById('circle').innerHTML = '';
},500);
}
}
} catch (e) {
alert(e);
}
}
function validateDropboxKey(){
abfrage = new xml_request();
dropboxKey = document.getElementById('dropboxKey').value;
//alert(dropboxKey);
try
{
url = "xml/validateDropboxKey.php?random=" + Math.random();
message = "dropboxKey=" + (dropboxKey);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
msg = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',msg);
}
if(result == '0')
{
toaster('2',msg);
}
if(result == '1')
{
toaster('1',msg);
}
if(result == '-1')
{
//toaster('2',msg);
//window.parent.permissionWindow(0);
}
else
{
setTimeout(function(){
},500);
dialog.close();
}
}
}
} catch (e) {
alert(e);
}
}
function chg2(container,content){
try
{
//$('.loader_circle').removeClass( '' ).addClass( 'fa-li fa fa-spinner fa-spin' );
// document.getElementById(container).innerHTML = '
';
setTimeout(function(){
document.getElementById(container).innerHTML = ((content));
$('.loader_circle').removeClass( 'fa-li fa fa-spinner fa-spin' ).addClass( '' );
},500);
}catch(e){
}
}
function chg(container,content){
try
{
//console.log(container);
document.getElementById(container).innerHTML = '
';
setTimeout(function(){
document.getElementById(container).innerHTML = ((content));
},500);
}catch(e){
}
}
function setInfoFrame(id){
//alert(id);
var xmlHttp = xml_request();
url = "../mobil/xml/xmlSetInfoFrame.php";
nachricht = "id="+id;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
//fenceTable = response.getElementsByTagName('fenceTable')[0].firstChild.data;
// alert(xmlHttp.responseText);
getTable('infoFrame');
if(result=='1')
{
$('.menu_device_item').css('text-decoration', 'none');
$('#singleDevice'+id).css('text-decoration', 'underline');
// $('#singleDevice'+id).removeClass( 'fa-check-square-o' ).addClass( 'fa-cog' ).addClass( 'red' );
}
}
}
}
function storeLanguage(language){
var xmlHttp = xml_request();
url = "xml/xml_storeLanguage.php";
nachricht = "language="+language;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
////console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
//fenceTable = response.getElementsByTagName('fenceTable')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": true,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
switch(language) {
case 'de':
toastr["warning"]("Sprache geändert");
break;
case 'en':
toastr["warning"]("Language changed");
break;
case 'es':
toastr["warning"]("Language changed");
break;
case 'fr':
toastr["warning"]("Language changed");
break;
default:
toastr["warning"]("Language changed");
break;
}
try{
update();
}catch(e){
}
}, 100);
try{getAlertRules();}catch(e){}
}
}
}
}
function changeLanguage (section,language){
try{
try{storeLanguage(language);}catch(e){ }
}catch(e){
}
setTimeout(function(){
try{
try{$('#dialog').dialog('close');}catch(e){ }
}catch(e){
}
try{
try{$('#help').dialog('close');}catch(e){ }
}catch(e){
}
$('#tree-checkable').css("height", "1000");
$('#tree-checkable').css("height", "50%");
switch (section){
case 'history':
switch (language){
case 'de':
chg('headline_history','Abfrage zurückgelegter Wegstrecken');
chg('sub_headline_history','Fragen Sie hier die zurückgelegten Wegstrecken Ihrer Ortungsgeräte ab. Das Ergebnis können Sie auf einer Karte betrachten, aber auch als CSV, KML und GPX Datei herunterladen.');
chg('btn_request_track','Strecke laden');
chg('btn_request_track_lb','Geringe Bandbreite');
break;
case 'en':
chg('headline_history','Request track history');
chg('sub_headline_history','Request the track history of your tracking objects / vehicles. You can review the results on a map and download them as kml / csv or gpx file.');
chg('btn_request_track','Load track');
chg('btn_request_track_lb','Low bandwidth');
break;
}
break;
case 'menu_left':
switch (language){
case 'en':
chg('div_menu_map','Objects on map');
//chg('div_menu_history','Track history');
chg('div_menu_device_admin','Device admin');
chg('div_menu_alert_admin','Alert admin');
chg('div_menu_addressbook_admin','Addressbook admin');
chg('div_menu_geofence_admin','Geofence admin');
chg('div_menu_daily_distance','Daily distance');
chg('div_menu_temperature','Temperature log');
chg('div_menu_extended','Extended');
chg('div_menu_live_share','Share location');
chg('div_menu_area_log','Area log');
chg('alert_popup','Latest alert messages');
chg('div_menu_remote','Remote config');
chg('div_menu_start_stop','Start/stop log');
chg('div_menu_driving_logbook','Driving logbook');
chg('div_menu_watchman','Patrol assist');
chg('div_menu_traffic','SIM Traffic');
chg('div_menu_account','Your account');
chg('div_menu_faq','FAQ / help');
chg('div_menu_Support','Support tickets');
chg('div_menu_imprint','Imprint/contact');
chg('div_menu_area_log','Area control log');
chg('div_menu_new_device','Add device');
chg('div_menu_upgrade','Upgrade');
chg('div_menu_register','Register');
chg('INF_FRAME_YOUR_OBJECTS','Your devices');
chg('lang_img','
');
chg2('tooltip',' Tooltip');
chg2('autoCenter_value',' Auto center');
chg('osm_contrib','Openstreetmap Contributors');
chg('div_menu_sim','GPS Tracker SIM');
chg('div_menu_smartphone','Smartphone Tracking');
chg('edit_btn','Edit');
//chg('dropdown_menu_hdl','test');
$('#dropdown_menu_hdl').html('Main menu');
chg('SPEC_OFF_EBAY','Plans at eBay');
$('.lbl_new').removeClass( '' ).html('New');
// $('#faq_help_menu').hide();
break;
case 'de':
chg('div_menu_map','Geräte auf Karte');
//chg('div_menu_history','Streckenabfrage');
chg('div_menu_device_admin','Geräteverwaltung');
chg('div_menu_alert_admin','Alarme verwalten');
chg('div_menu_addressbook_admin','Adressbuch verwalten');
chg('div_menu_geofence_admin','Geozäune verwalten');
chg('div_menu_daily_distance','Tageskilometer');
chg('div_menu_temperature','Temperaturdoku.');
chg('div_menu_extended','Erweitert');
chg('div_menu_live_share','Freigabe');
chg('div_menu_remote','Befehle');
chg('div_menu_start_stop','Standzeiten');
chg('div_menu_driving_logbook','Fahrtenbuch');
chg('div_menu_area_log','Flächenlog');
chg('div_menu_watchman','GPS Wächter');
chg('div_menu_traffic','SIM Transfer');
chg('div_menu_account','Ihr Zugang');
chg('div_menu_faq','FAQ / Hilfe');
chg('div_menu_Support','Supportanfrage');
chg('div_menu_imprint','Impressum / Kontakt');
chg('div_menu_new_device','Neues Gerät?');
chg('div_menu_upgrade','Upgrade');
chg('div_menu_register','Registrieren');
chg('INF_FRAME_YOUR_OBJECTS','Ihre Geräte');
chg('lang_img','
');
chg2('tooltip',' Tooltip');
chg2('autoCenter_value',' Auto zentrieren');
chg('osm_contrib','Openstreetmap Mitwirkende');
chg('alert_popup','Ihre letzten Alarme');
chg('div_menu_sim','GPS Tracker SIM');
chg('div_menu_smartphone','Smartphone Ortung');
chg('edit_btn','Anpassen');
chg('SPEC_OFF_EBAY','Tarife auf eBay');
$('#dropdown_menu_hdl').html('Hauptmenü');
$('.lbl_new').removeClass( '' ).html('Neu');
$('#faq_help_menu').show();
break;
}
break;
}
},500);
try
{
document.getElementById('infoFrame').innerHTML = '
';
setTimeout(function(){
document.getElementById('infoFrame').innerHTML = '';
getTable('infoFrame');
},500);
}catch(e){
}
}
function toggleSomething(id, opp, section, section_id, orderBy, order){
abfrage = new xml_request();
switch (section){
case "autoTimezone":
url = "../mobil/xml/xml_toggleSomething.php";
params = "id="+id + "&opp="+opp+"§ion="+section+"§ion_id="+section_id;
break;
case "areaLog":
url = "../mobil/xml/xml_toggleSomething.php";
params = "id="+id + "&opp="+opp+"§ion="+section+"§ion_id="+section_id;
break;
case "showDriverOnMap":
url = "../mobil/xml/xml_toggleSomething.php";
params = "id="+id + "&opp="+opp+"§ion="+section+"§ion_id="+section_id;
//alert(params);
break;
default:
return;
break;
}
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(params);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
switch (section){
case "showDriverOnMap":
dashboardVehicleTable();
break;
case "autoTimezone":
setTimeout(function(){
try{$('#dialog').dialog('close');dashboardVehicleTable();}catch(e){ }
},200);
break;
case "areaLog":
getTable('area_log_objects',orderBy,order);
break;
default:
return;
break;
}
}
if(abfrage.responseText == '0')
{
}
}
}
}
}
function toggleSmsRule(id,state){
abfrage = new xml_request();
try
{
url = "../mobil/xml/toggleSmsRule.php";
message = "id=" + id + "&state=" + state;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
//alert(message);
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
getTable('sms_rules');
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function toggleDevicesOnTreemenu(id, old){
var old = $('#device'+id).data("mainmap");
if(old=='1')
{
$('#device'+id).data('mainmap',0);
}
else
{
$('#device'+id).data('mainmap',1);
}
setTimeout(function(){
$('#device'+id).removeClass( 'fa-cog' ).removeClass( 'red' );
if(old=='1')
{
$('#device'+id).removeClass( 'fa-check-square-o' ).addClass( 'fa-square-o' );
}else
{
$('#device'+id).removeClass( 'fa-square-o' ).addClass( 'fa-check-square-o' );
}
}, 1000);
}
function hups(id, old,subKey){
var old = $('#device'+id).data("mainmap");
setTimeout(function(){
//update();
if(old=='1')
{
showOnMap(id,old,subKey, '0');
}else
{
showOnMap(id,old,subKey, '1');
}
followDevice(0,0,0,0,0);
extent();
}, 300);
}
function addDriver(){
$("#btn_create_Driver").addClass("disabled");
$( "#load_spin_driver_list" ).addClass( "fa-spin " );
abfrage = new xml_request();
new_driver_firstname = document.getElementById('new_driver_firstname').value;
new_driver_lastname = document.getElementById('new_driver_lastname').value;
try
{
url = "../mobil/xml/xmlAddDriver.php";
message = "new_driver_firstname=" + encodeURIComponent(new_driver_firstname) + "&new_driver_lastname=" + encodeURIComponent(new_driver_lastname);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
// document.getElementById('result').innerHTML = abfrage.responseText;
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
msg = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',msg);
}
else
{
setTimeout(function(){
createDropdown('driver', 'id' , 'DESC' );
$( "#load_spin_driver_list" ).removeClass( "fa-spin " );
$("#btn_create_Driver").removeClass("disabled");
},250);
toaster('1',msg);
$('#new_driver_lastname').val('');
$('#new_driver_firstname').val('');
}
$("#btn_create_Driver").removeClass("disabled");
}
}
} catch (e) {
alert(e);
}
}
function delSmsRule(id){
abfrage = new xml_request();
try
{
url = "../mobil/xml/xmlDelSmsRule.php";
message = "id=" + encodeURIComponent(id);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
// document.getElementById('result').innerHTML = abfrage.responseText;
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
msg = response.getElementsByTagName('msg')[0].firstChild.data;
if(result == '-1')
{
toaster('2',msg);
}
else
{
setTimeout(function(){
getTable('sms_recp');
getTable('sms_rules');
},500);
$('#dialog').dialog('close');
}
}
}
} catch (e) {
alert(e);
}
}
function storeNewNumber(){
document.getElementById('result').innerHTML = '';
spin('btn_save');
newNumber = document.getElementById('newNumber').value;
newName = document.getElementById('newName').value;
//document.getElementById('rotate').innerHTML = "
";
url = "../mobil/xml/storeNewNumber.php";
var abfrage = xml_request();
nachricht = "newNumber="+newNumber+
"&newName="+newName;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
if(result == '-1')
{
toaster('2',msg);
//document.getElementById('rotate').innerHTML = "";
}
else
{
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
msg = response.getElementsByTagName('msg')[0].firstChild.data;
setTimeout(function(){
if(result=='1')
{
document.getElementById('result').innerHTML = '' + msg + '';
//document.getElementById('rotate').innerHTML = "
";
//$('#grid_add_org_user').jqxGrid('updatebounddata');
setTimeout(function(){
document.getElementById('result').innerHTML = '';
//document.getElementById('rotate').innerHTML = "";
//parent.frames.close_third_popup();
//parent.frames['SMS'].knut1234(newNumber);
},500);
}
else
{
toaster('2',msg);
document.getElementById('result').innerHTML = '' + msg + '';
//document.getElementById('rotate').innerHTML = "
";
//$('#grid_add_org_user').jqxGrid('updatebounddata');
}
},1500);
setTimeout(function(){
getTable('sms_recp');
},1500);
}
}
}
}
function confirmNumber(){
number = document.getElementById('newNumber').value;
pin = document.getElementById('pin').value;
spin('btn_confirm');
url = "../mobil/xml/confirmPin.php";
var abfrage = xml_request();
nachricht = "number="+number+
"&pin="+pin;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
msg = response.getElementsByTagName('msg')[0].firstChild.data;
if(result == '-1')
{
toaster('2',msg);
}
else
{
setTimeout(function(){
if(result=="1")
{
// parent.frames.close_third_popup();
document.getElementById('result').innerHTML = '' + msg + '';
setTimeout(function(){
try{$('#dialog').dialog('close');}catch(e){ }
},200);
setTimeout(function(){
getTable('sms_recp');
},500);
document.getElementById('result').innerHTML = '';
//document.getElementById('rotate').innerHTML = "";
}
else
{
toaster('2',msg);
document.getElementById('result').innerHTML = '' + msg + '';
//document.getElementById('rotate').innerHTML = "
";
}
},1500);
}
}
}
}
function delSms(id){
abfrage = new xml_request();
try
{
url = "../mobil/xml/xmlDelSms.php";
message = "id=" + encodeURIComponent(id);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
// document.getElementById('result').innerHTML = abfrage.responseText;
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
msg = response.getElementsByTagName('msg')[0].firstChild.data;
if(result == '-1')
{
toaster('2',msg);
//window.parent.permissionWindow(0);
}
else
{
setTimeout(function(){
getTable('sms_recp');
getTable('sms_rules');
},1500);
dialog.close();
}
}
}
} catch (e) {
alert(e);
}
}
function storeSmsRule(){
$("#btn_save_sms").addClass("disabled");
document.getElementById('result').innerHTML = '';
spin('btn_save');
device = document.getElementById('device').value;
number = document.getElementById('number').value;
alert = document.getElementById('alert').value;
interval = document.getElementById('interval').value;
//document.getElementById('rotate').innerHTML = "
";
url = "../mobil/xml/storeNewSmsRule.php";
var abfrage = xml_request();
nachricht = "device="+device+
"&number="+number+
"&alert="+alert+
"&interval="+interval;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
if(result == '-1')
{
toaster('2',msg);
//document.getElementById('rotate').innerHTML = "";
}
else
{
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
msg = response.getElementsByTagName('msg')[0].firstChild.data;
setTimeout(function(){
if(result=='1')
{
toaster('1',msg);
// dialog.close();
setTimeout(function(){
getTable('sms_rules');
$("#btn_save_sms").removeClass("disabled");
},250);
}
else
{
toaster('2',msg);
document.getElementById('result').innerHTML = '' + msg + '';
$("#btn_save_sms").removeClass("disabled");
//document.getElementById('rotate').innerHTML = "
";
//$('#grid_add_org_user').jqxGrid('updatebounddata');
}
},250);
setTimeout(function(){
getTable('sms_recp');
},250);
}
}
}
}
function spin(className){
$("#" + className).attr("disabled", true);
$("#" + className).addClass("fa-spin");
setTimeout(function(){
$("#" + className).removeClass("fa-spin");
$("#" + className).attr("disabled", false);
}, 1500);
}
function changePasswd()
{
$( "#btn_chg_pw" ).addClass( "disabled" );
passOld = document.getElementById('passOld').value;
passNew = document.getElementById('passNew').value;
passNewConfirm = document.getElementById('passNewConfirm').value;
//document.getElementById('insert_response').innerHTML = '
';
var xmlHttp = xml_request();
url = "../mobil/xml/changePassword.php";
nachricht = "passOld="+encodeURIComponent(passOld)+"&passNew="+encodeURIComponent(passNew)+"&passNewConfirm="+encodeURIComponent(passNewConfirm);
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
//alert(nachricht);
xmlHttp.onreadystatechange=function()
{
response = xmlHttp.responseText;
//alert(response);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
document.getElementById('result').innerHTML = message;
if(result=='1')
{
document.getElementById('passOld').value = '';
document.getElementById('passNew').value = '';
document.getElementById('passNewConfirm').value = '';
toaster('1',message);
}
else
{
if(result=='-1')
{
toaster('2',message);
}
}
}
}
setTimeout(function(){
$( "#btn_chg_pw" ).removeClass( "disabled" );
},550);
}
function disCheckAll(id)
{
document.getElementById(id).checked = false;
}
//importFence
function storeObject(name, polygon)
{
url = "../mobil/xml/xmlStoreObject.php";
params = "name=" + name + "&polygon="+polygon ;
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
document.getElementById('resultText').innerHTML = message;
if(result=='1')
{
try{
}catch(e)
{
}
}
}
}
}
function changeTriggerValue(rule_id){
trigger = document.getElementById('triggerValues').value;
url = "xml/xmlChangeTriggerValue.php";
params = "rule_id=" + rule_id + "&trigger=" + trigger;
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
document.getElementById('result_changeTriggerValue').innerHTML = message;
if(result=='1')
{
try{
$('#changeTriggerValue').modal('hide');
getTable('watchers');
}catch(e)
{
}
}
}
}
}
function changeTimerangeRule(rule_id){
tr_id = document.getElementById('tr_grp_popup').value;
url = "xml/xmlChangeTimerangeRule.php";
params = "rule_id=" + rule_id + "&tr_id=" + tr_id;
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
document.getElementById('resultText').innerHTML = message;
if(result=='1')
{
try{
$('#changeTimerangeRule').modal('hide');
getTable('watchers');
}catch(e)
{
}
}
}
}
}
function removeTimerangeRule(rule_id){
url = "xml/xmlRemoveTimerangeRule.php";
params = "rule_id=" + rule_id;
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
document.getElementById('resultText').innerHTML = message;
if(result=='1')
{
try{
$('#removeTimerangeRule').modal('hide');
getTable('watchers');
}catch(e)
{
}
}
}
}
}
function changeFenceColor(fence_id){
color = document.getElementById('FenceColor').value;
color = color.replace("#", "");
color = color.toUpperCase();
url = "xml/xmlChangeFenceColor.php";
params = "fence_id=" + fence_id + "&color="+color;
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
document.getElementById('resultText').innerHTML = message;
if(result=='1')
{
try{
$('#changeFenceColor').modal('hide');
showFence(fence_id,'1','1');
//alert(fence_id);
tempFenceTable();
toaster('1',message);
}catch(e)
{
}
}
else
{
toaster('2',message);
}
}
}
}
function importFence(id,callback){
var multi = 0;
if(id=='*')
{
multi = '1';
id = getCheckedItems('editFenceGroupCheckbox');
//alert(id);
//return;
}
else
{
multi = '0';
}
$("#" + callback).prop('disabled', true);
url = "../mobil/xml/xmlImportFence.php";
params = "id=" + id + "&multi=" + multi;
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
//document.getElementById('resultText').innerHTML = message;
if(result=='1')
{
try{
toaster(1,message);
$('#'+callback).modal('hide');
$('#dialog').dialog('close');
tempFenceTable();
setTimeout(function(){
getTable('area_log_objects','name','DESC');
getTable('fence_group_dropdown','name','DESC');
}, 250);
}catch(e)
{
}
}
$("#" + callback).prop('disabled', false);
}
}
}
function load(){
$(document).skylo('start');
setTimeout(function(){
$(document).skylo('set',75);
},250);
setTimeout(function(){
$(document).skylo('end');
},500);
setTimeout(function(){
$( "#ajaxContainer" ).load( "modules/premium.php" );
},700);
}
function xml_request() {
var xml_anfrage = null;
if(window.XMLHttpRequest) { // Generiere XML Objekt
xml_anfrage = new XMLHttpRequest(); //für Mozilla, Opera, IE > 7, Safari
}
else if(window.ActiveXObject) { //Für IE 5,6
xml_anfrage = new ActiveXObject("Microsoft.XMLHTTP");
}
//Gibt das XML objekt rurück
return xml_anfrage;
}
function createWatchman(){
tr_grp = document.getElementById('tr_grp').value;
tracker = document.getElementById('tracker').value;
object_id = document.getElementById('object_id').value;
params = "tr_grp=" + tr_grp + "&tracker=" + tracker +"&object_id=" + object_id;
var xmlHttp = xml_request();
url = "xml/xmlStoreWatchman.php";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
////console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result=='1')
{
try{
getTable('watchers');
setTimeout(function(){
$(function(){$('html, body').animate({scrollTop: $('#top').offset().top}, 1000);return false;});}, 250);
//document.getElementById(section).innerHTML = response.getElementsByTagName(section)[0].firstChild.data;
}catch(e)
{
}
}
else
{
toaster('2',message);
}
}
}
}
function delObjectRule(id){
var xmlHttp = xml_request();
url = "xml/xmlDelObjectRule.php";
params = "object_id=" + id;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
////console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result=='1')
{
try{
getTable('watchers');
setTimeout(function(){
$('#delWatchManObject').modal('hide');
$(function(){$('html, body').animate({scrollTop: $('#top').offset().top}, 1000);return false;});}, 250);
}catch(e)
{
}
}
else
{
toaster('2',message);
}
}
}
}
function getTable(section, orderBy , order, filter ){
//alert(filter);
try
{
if(orderBy=='')
{
orderBy = 'id';
}
}catch(e)
{
orderBy = 'id';
}
try
{
if(order=='')
{
order = 'DESC';
}
}catch(e)
{
order = 'DESC';
}
switch (section){
case "user_management":
url = "../mobil/xml/SAP3.php";
params = "";
break;
case "ign_test":
url = "../mobil/xml/xmlIgn_test.php";
params = "";
break;
case "iconSet":
iconNameGroup = $('#iconNameGroup').val();
url = "../mobil/xml/xml_icon_sets.php";
params = "orderBy="+orderBy+"&order="+order + "&iconNameGroup=" + iconNameGroup;
break;
case "getSubscriptions":
url = "../mobil/xml/xmlGetSubscriptions.php";
params = "orderBy="+orderBy+"&order="+order;
break;
case "alert_dropdown_table":
url = "../mobil/xml/xml_alert_dropdown_table.php";
params = "orderBy="+orderBy+"&order="+order;
break;
case "sim_table":
url = "../mobil/xml/xml_sim_table.php";
params = "orderBy="+orderBy+"&order="+order;
break;
case "upload_matrix":
url = "../mobil/xml/xml_upload_matrix.php";
params = "channel=upload_matrix";
break;
case "upload_matrix_temp_pdf":
url = "../mobil/xml/xml_upload_matrix.php";
params = "channel=upload_matrix_temp_pdf";
break;
case "export_formats":
url = "../mobil/xml/xml_export_formats.php";
params = "";
break;
case "temperature_log":
url = "../mobil/xml/xmlTemperature_log.php";
params = "";
break;
case "open_fence_log":
try
{
fence_object_filter = document.getElementById('fence_object_filter').value;
}catch(e)
{
fence_object_filter = "*";
}
try
{
fence_driver_filter = document.getElementById('fence_driver_filter').value;
}catch(e)
{
fence_driver_filter = "*";
}
try
{
object_devices_filter = document.getElementById('object_devices').value;
}catch(e)
{
object_devices_filter = "*";
}
try
{
output = document.getElementById('output').value;
}catch(e)
{
output = "0";
}
try
{
startDate = document.getElementById('startDate').value;
}catch(e)
{
startDate = $.datepicker.formatDate( "dd.mm.yy",new Date(new Date(Date()).setDate( new Date(Date()).getDate() - 7 )))
}
try
{
stopDate = document.getElementById('stopDate').value;
}catch(e)
{
stopDate = $.datepicker.formatDate( "dd.mm.yy",new Date(new Date(Date()).setDate( new Date(Date()).getDate() - 0 )))
}
try
{
orderBy = document.getElementById('openFenceOrderBy').value;
}catch(e)
{
orderBy = "date_start_asc";
}
try
{
order = document.getElementById('openFenceOrder').value;
}catch(e)
{
order = "DESC";
}
url = "../mobil/xml/xmlOpenFence.php";
params = "orderBy="+orderBy+"&order="+order+"&objectFilter="+fence_object_filter+"&object_devices_filter="+object_devices_filter+"&startDate="+startDate+"&stopDate="+stopDate+"&output="+output+"&fence_driver_filter="+fence_driver_filter;
break;
case "getReceivedGeoFences":
//area_log_order = $("#area_log_order").attr('value');
fence_object_filter = document.getElementById('fence_object_filter').value;
object_devices_filter = document.getElementById('object_devices').value;
fence_driver_filter = document.getElementById('fence_driver_filter').value;
startDate = document.getElementById('startDate').value;
stopDate = document.getElementById('stopDate').value;
//output = document.getElementById('output').value;
url = "../mobil/xml/getReceivedGeoFences.php";
params = "orderBy="+orderBy+"&order="+order+"&objectFilter="+fence_object_filter+"&object_devices_filter="+object_devices_filter+"&startDate="+startDate+"&stopDate="+stopDate+"&output=*&fence_driver_filter="+fence_driver_filter;
//params = "orderBy=*&order=*&objectFilter=*&object_devices_filter=*&startDate=*&stopDate=*&output=*&fence_driver_filter=*";
//params ="";
break;
case "getReceivedFencesLog":
try
{
fence_object_filter = document.getElementById('fence_object_filter').value;
}catch(e)
{
fence_object_filter = "*";
}
console.log(fence_object_filter);
try
{
object_devices_filter = document.getElementById('object_devices').value;
}catch(e)
{
object_devices_filter ="*";
}
try
{
fence_driver_filter = document.getElementById('fence_driver_filter').value;
}catch(e)
{
fence_driver_filter = "*";
}
try
{
startDate = document.getElementById('startDate').value;
}catch(e)
{
startDate = $.datepicker.formatDate( "dd.mm.yy",new Date(new Date(Date()).setDate( new Date(Date()).getDate() - 7 )))
}
try
{
stopDate = document.getElementById('stopDate').value;
}catch(e)
{
stopDate = $.datepicker.formatDate( "dd.mm.yy",new Date(new Date(Date()).setDate( new Date(Date()).getDate() - 0 )))
}
try
{
output = document.getElementById('output').value;
}catch(e)
{
output = "0";
}
try
{
grp_filter = document.getElementById('fence_object_grp_filter').value;
}catch(e)
{
grp_filter = "*";
}
try
{
closedLogsPerPage = document.getElementById('closedLogsPerPage').value;
}catch(e)
{
closedLogsPerPage = "0";
}
//area_log_order = $("#area_log_order").attr('value');
//fence_driver_filter = document.getElementById('fence_driver_filter').value;
if(output=="1")
{
//$('#getReceivedFencesLog').hide();
}
else
{
//$('#getReceivedFencesLog').show();
}
url = "../mobil/xml/getReceivedFences.php";
params = "orderBy="+orderBy+"&order="+order+"&objectFilter="+fence_object_filter+"&object_devices_filter="+object_devices_filter+"&startDate="+startDate+"&stopDate="+stopDate+"&output="+output+"&fence_driver_filter="+fence_driver_filter+"&grp_filter="+grp_filter+"&closedLogsPerPage="+closedLogsPerPage;
//params ="";
break;
case "infoFrame":
url = "../mobil/xml/xmlGetInfoFrame.php";
params ="";
break;
case "AIN":
devices = $('#devices').val();
url = "../mobil/xml/xmlGetAIN.php";
params ="devices=" + encodeURIComponent(devices);
break;
case "kmz_archives":
url = "../mobil/xml/xmlGetKMZ.php";
params ="";
break;
case "DIN":
devices = $('#devices').val();
url = "../mobil/xml/xmlGetDIN.php";
params ="devices=" + encodeURIComponent(devices);
break;
case "io":
url = "../mobil/xml/xmlGet_io.php";
params ="";
break;
case "temperature":
url = "../mobil/xml/xmlGet_temperature.php";
params ="";
break;
case "sms_credit":
url = "../mobil/xml/getInfo.php";
params = "task=sms_credit";
break;
case "user_account_info":
url = "../mobil/xml/getInfo.php";
params = "task=user_account_info";
break;
case "vehicleGrid":
url = "../mobil/xml/xmlGetVehicleGrid.php";
params ="";
break;
case "area_log_objects":
areaObjectsPerPage = document.getElementById('areaObjectsPerPage').value;
area_log_order = $("#area_log_order").attr('value');
if(typeof filter !== "undefined")
{
}
else
{
filter = -1;
}
url = "../mobil/xml/xml_area_log_objects.php";
params = "orderBy="+orderBy+"&order="+order + '&filter=' + filter + "&areaObjectsPerPage=" + areaObjectsPerPage;
break;
case "distance":
start_date = document.getElementById('start_date').value;
stop_date = document.getElementById('stop_date').value;
device_filter = document.getElementById('device_filter').value;
if(typeof device_filter !== "undefined")
{
}
else
{
device_filter = -1;
}
showNullDays = $('input[name="toggle-welcomebox"]').bootstrapSwitch('state');
url = "../mobil/xml/xml_area_daily_distance.php";
//alert($('input[name="toggle-welcomebox"]').bootstrapSwitch('state') );
params = "orderBy=" + orderBy + "&order=" + order + '&device_filter=' + encodeURIComponent(device_filter) + "&start_date=" + start_date + "&stop_date=" + stop_date + "&showNullDays=" + showNullDays;
document.getElementById('cirlce').innerHTML = '
';
//alert(params) ;
break;
case "sms_history_5":
url = "../mobil/xml/xml_sms_history_5.php";
params = "";
break;
case "fence_group_dropdown":
url = "../mobil/xml/xml_fence_group_dropdown.php";
params = "orderBy=" + orderBy + "&order=" + order;
break;
case "fence_group_dropdown_move":
url = "../mobil/xml/xml_fence_group_dropdown_move.php";
params = "";
break;
case "load_possible_commands":
document.getElementById('load_possible_commands').innerHTML = '
';
key = document.getElementById('tracker').value;
url = "../mobil/xml/xml_possible_remote_commands.php";
params = "key=" + encodeURIComponent(key);
break;
case "loadShortAlertList":
url = "../mobil/xml/xmlLoadShortAlertList.php";
params = "";
break;
case "sms_rules":
url = "../mobil/xml/xml_sms_rules.php";
params = "";
break;
case "sms_recp":
url = "../mobil/xml/xml_getSms_recp.php";
params = "";
break;
case "getJournal":
url = "../mobil/xml/xmlGetJournal.php";
params = "";
break;
case "externalTickets":
url = "../mobil/xml/xmlGetExternalTickets.php";
params = "";
break;
case "timerangeGroups":
url = "../mobil/xml/xmlGetTimerangeGroups.php";
params = "";
break;
case "timerangeGroupsPopup":
url = "../mobil/xml/xmlGetTimerangeGroupsPopup.php";
params = "";
break;
case "objects":
url = "../mobil/xml/xmlGetObjects.php";
params = "";
break;
case "devices":
url = "../mobil/xml/xmlGetDevices.php";
params = "";
break;
case "addDevices":
url = "../mobil/xml/xmlAddDevices.php";
params = "";
break;
case "getTracker":
url = "../mobil/xml/xml_trackDeviceName.php";
params = "";
break;
case "watchers":
url = "../mobil/xml/xmlGetWatchers.php";
params = "";
break;
case "watcher_events":
device_filter = $("#device_filter").prop('value');
object_filter = $("#object_filter").prop('value');
marker_filter = $("#marker_filter").is(':checked');
startDate = $("#startDate").prop('value');
stopDate = $("#stopDate").prop('value');
url = "../mobil/xml/xmlGetWatcherEvents.php";
params = "device_filter=" + device_filter + "&object_filter=" + object_filter + "&marker_filter=" + marker_filter + "&startDate=" + startDate + "&stopDate=" + stopDate;
break;
case "triggerValueTable":
url = "../mobil/xml/xmlTriggerValueTable.php";
params = "";
break;
case "chatxx":
url = "../mobil/xml/chat.php";
params = "";
break;
case "chatxxx":
url = "../mobil/xml/chatx.php";
params = "";
break;
default:
return;
break;
}
var xmlHttp = xml_request();
//$( "#chat" ).hide();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
////console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
////console.log(xmlHttp.responseText);
if(result=='1')
{
try{
if(section=='open_fence_log')
{
current_open = response.getElementsByTagName('current_open')[0].firstChild.data;
console.log(': ' + current_open);
if(current_open.toString() != $('#openFenceLogCurrentlyOpen').val().toString())
{
$('#openFenceLogCurrentlyOpen').val(current_open.toString());
// console.log('change2: ' + current_open);
getTable('getReceivedFencesLog','name','ASC');
}
else
{
}
//try{ document.getElementById('paging_items_top').innerHTML = paging_items; } catch(pv){}
//try{ document.getElementById('paging_items_bottom').innerHTML = paging_items; } catch(pv){}
////console.log(paging_items);
}
if(section=='getReceivedFencesLog')
{
paging_items = response.getElementsByTagName('paging_items')[0].firstChild.data;
try{ document.getElementById('paging_items_top').innerHTML = paging_items; } catch(pv){}
try{ document.getElementById('paging_items_bottom').innerHTML = paging_items; } catch(pv){}
//& console.log(params);
}
if(section=='alert_dropdown_table')
{
item_count = response.getElementsByTagName('contingent')[0].firstChild.data;
try{ document.getElementById('alert_count').innerHTML = item_count; } catch(pv){}
//try{ document.getElementById('paging_items_bottom').innerHTML = paging_items; } catch(pv){}
document.getElementById(section).innerHTML = response.getElementsByTagName(section)[0].firstChild.data;
console.log( response.getElementsByTagName(section)[0].firstChild.data);
}
if(section=='distance')
{
setTimeout(function(){
try{ paging_items = response.getElementsByTagName('paging_items')[0].firstChild.data; } catch(pv){}
try{ document.getElementById('paging_items_top').innerHTML = paging_items; } catch(pv){}
try{ document.getElementById('paging_items_bottom').innerHTML = paging_items; } catch(pv){}
try{ document.getElementById('cirlce').innerHTML = ''; } catch(pv){}
},1000);
}
if(section=='infoFrame')
{
//infoKey = response.getElementsByTagName('infoKey')[0].firstChild.data;
//$('input[id="follow_id"]').attr('value',infoKey);
document.getElementById(section).innerHTML = response.getElementsByTagName(section)[0].firstChild.data;
//return infoKey;
}
if(section=='area_log_objects')
{
paging_items = response.getElementsByTagName('paging_items_objects')[0].firstChild.data;
try{ document.getElementById('paging_items_objects_top').innerHTML = paging_items; } catch(pv){}
try{ document.getElementById('paging_items_objects_bottom').innerHTML = paging_items; } catch(pv){}
try{ counted_areas = response.getElementsByTagName('counted')[0].firstChild.data; } catch(pv){}
try{ document.getElementById('counted_areas').innerHTML = counted_areas; } catch(pv){}
}
//alert(xmlHttp.responseText);
document.getElementById(section).innerHTML = response.getElementsByTagName(section)[0].firstChild.data;
if(section=='chatxx')
{
//document.getElementById('narayan-prusty').innerHTML = response.getElementsByTagName(section)[0].firstChild.data;
// inner_height = (((($(window).innerHeight()))) - $( "#chat-right" ).offset().top)-50;
//document.getElementById('chatxx').style.height= inner_height + "px";
div.animate({scrollTop: height}, 500);
height += div.height();
}
if(section=='chatxxx')
{
document.getElementById('chatxxx').innerHTML = response.getElementsByTagName(section)[0].firstChild.data;
// inner_height = (((($(window).innerHeight()))) - $( "#chat-right" ).offset().top)-50;
//document.getElementById('chatxx').style.height= inner_height + "px";
return 1;
}
if(section=='getSubscriptions')
{
$('.icheck').iCheck({
checkboxClass: 'icheckbox_minimal-blue',
radioClass: 'iradio_minimal-blue'
});
try{ subscriptionCount = response.getElementsByTagName('subscriptionCount')[0].firstChild.data;
if(subscriptionCount==1)
{
$('.checkbox_subscription').hide();
$('.search_device_subscription').attr("disabled", true);
$('.navigate_btns').attr("disabled", true);
//$('.inbox-mail-heading').hide();
//$('.inbox-mail-footer').hide();
$('#check_header').html(' ');
}
$('.bulk_admin_btns').attr("disabled", true);
$('.countSubs').html(subscriptionCount);
} catch(pv){}
}
}catch(e)
{
//console.log("Fehler: " + e.toString() + "/" +xmlHttp.responseText);
}
}
}
}
}
function change_subuser(section_id, channel, state, subuser, privilege){
//get the old state before change
url = "../mobil/xml/xml_changeValue.php";
params = "channel="+ encodeURIComponent(channel) +
"§ion_id=" + encodeURIComponent(section_id) +
"&state=" + encodeURIComponent(state) +
"&subuser=" + encodeURIComponent(subuser) +
"&newValue=*" +
"&privilege=" + encodeURIComponent(privilege) ;
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
////console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result==-1)
{
toaster('2',message);
}
else
{
if(result==0)
{
toaster('2',message);
}
else
{
toaster('1',message);
getTable_ajax('userTable');
}
}
//console.log(message);
}
}
}
function change_upload_matrix(section_id, channel, state, imei_id, report_type){
url = "../mobil/xml/xml_changeValue.php";
params = "channel="+ encodeURIComponent(channel) +
"§ion_id=" + encodeURIComponent(section_id) +
"&state=" + encodeURIComponent(state) +
"&imei_id=" + encodeURIComponent(imei_id) +
"&newValue=*" +
"&report_type=" + encodeURIComponent(report_type) ;
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
////console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result==1)
{
toaster('1',message);
}
else
{
toaster('2',message);
}
//console.log(message);
}
}
}
function changeValue(section, changeId, section_id, oldValue){
switch (section){
case "create_fleet_group":
create_fleet_group_name = $('#create_fleet_group_name').val();
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id + "&oldValue=*&newValue=*&create_fleet_group_name=" + create_fleet_group_name;
break;
case "create_company_location":
create_company_location_name = $('#create_company_location_name').val();
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id + "&oldValue=*&newValue=*&create_company_location_name=" + create_company_location_name;
break;
case "storeSubuser":
salutation = $('#salutation').val();
firstname = $('#firstname').val();
lastname = $('#lastname').val();
emailAddress_1 = $('#emailAddress_1').val();
emailAddress_2 = $('#emailAddress_2').val();
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&salutation=" + salutation + "&firstname="+ encodeURIComponent(firstname) + "&lastname="+ encodeURIComponent(lastname) + "&emailAddress_1="+ encodeURIComponent(emailAddress_1) + "&emailAddress_2="+ encodeURIComponent(emailAddress_2) + "&oldValue=*&newValue=*";
break;
case "changeUserRight":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&subuser="+ encodeURIComponent(oldValue) + "&newValue=" + changeId;
break;
case "assignAlertRuleToAllDevices":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "addArchiveDescription":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "assign_share_devices":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "assign_calendar_devices":
var calendar_id = $('#calendar_id').val();
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=x"+ encodeURIComponent(oldValue) + "&calendar=" + encodeURIComponent(calendar_id);
break;
case "assign_fence_devices":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "copy_sms_rule":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "toggleTrackAutoExportDataFormat":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "deleteVehicleImage":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "editGroupName":
oldValue = $('#new_grp_name').val();
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
setTimeout(function(){
try{$('#tree-checkable').jstree(true).refresh();}catch(e){ }
},250);
break;
case "toggleShareFacebookButton":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "clearAreaLogTable":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "deleteArchive":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue);
break;
case "changeFenceOpacity":
opacity = $('#fenceOpacity').val();
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue) + "&opacity=" + encodeURIComponent(opacity);
break;
case "execute_sepa_net_subscription":
plan_id = $('#plan_id').val();
sepa_iban = $('#sepa_iban').val();
sepa_blz = $('#sepa_blz').val();
sepa_kto = $('#sepa_kto').val();
sepa_sms_tan = $('#sepa_sms_tan').val();
first_last_name = $('#first_last_name').val();
phone_number = $('#phone_number').val();
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue) + "&plan_id=" + encodeURIComponent(plan_id) + "&sepa_iban=" + encodeURIComponent(sepa_iban) + "&sepa_blz=" + encodeURIComponent(sepa_blz) + "&sepa_kto=" + encodeURIComponent(sepa_kto) + "&sepa_sms_tan=" + encodeURIComponent(sepa_sms_tan) + "&first_last_name=" + encodeURIComponent(first_last_name) + "&phone_number=" + encodeURIComponent(phone_number);
break;
case "confirm_sepa_net_tan":
sepa_net_tan = document.getElementById('sepa_net_tan').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue) + "&sepa_net_tan="+ encodeURIComponent(sepa_net_tan);
break;
case "request_sepa_net_tan":
phone_number = document.getElementById('phone_number').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue) + "&phone_number="+ encodeURIComponent(phone_number);
break;
case "configToolTeltonika":
io_element = $('#filter_movement_source input:radio:checked').attr('io_element');
io_value = $('#filter_movement_source input:radio:checked').attr('io_value');
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue) + "&io_element=" + io_element + "&io_value=" + io_value;
break;
case "treeGroup":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue="+ encodeURIComponent(oldValue) + "";
break;
case "downloadDailyDistance":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=*";
break;
case "downloadAlerts":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=*";
break;
case "delArchive":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=*";
break;
case "changeSimCard":
sim_operator = document.getElementById('sim_operator').value;
iccid = document.getElementById('iccid').value;
alternate_operator = document.getElementById('alternate_operator').value;
phone_number = document.getElementById('phone_number').value;
tracker_for_sim = document.getElementById('tracker_for_sim').value;
expire_date = document.getElementById('expire_date').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=*" +
"&sim_operator=" + encodeURIComponent(sim_operator) +
"&phone_number=" + encodeURIComponent(phone_number) +
"&expire_date=" + encodeURIComponent(expire_date) +
"&alternate_operator=" + encodeURIComponent(alternate_operator) +
"&tracker_for_sim=" + encodeURIComponent(tracker_for_sim) +
"&iccid=" + encodeURIComponent(iccid);
$( "#btn_change_sim" ).addClass( "disabled" );
break;
case "editMileage":
mileage = document.getElementById('mileage').value;
tracker_for_mileage = document.getElementById('tracker_for_mileage').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=*" +
"&mileage=" + encodeURIComponent(mileage) +
"&tracker_for_mileage=" + encodeURIComponent(tracker_for_mileage);
$( "#btn_change_mileage" ).addClass( "disabled" );
break;
case "help_review_feedback":
feedback = document.getElementById('feedback').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=" + encodeURIComponent(feedback);
//$("#btn_send_feedback").prop('disabled', true);
$( "#btn_send_feedback" ).addClass( "disabled" );
$( "#btn_review_no" ).addClass( "disabled" );
break;
case "delete_driver":
driver_id = document.getElementById('driver_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(driver_id) +"&oldValue=*&newValue=" + encodeURIComponent(oldValue);
break;
case "help_review":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=" + encodeURIComponent(oldValue);
break;
case "delTr":
delTr = document.getElementById('tr_grp2').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=" + encodeURIComponent(delTr);
break;
case "removeTimeruleToFence":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=*";
break;
case "assignTimeruleToFence":
assign_trgrp = document.getElementById('assign_trgrp').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=" + encodeURIComponent(assign_trgrp);
break;
case "delShare":
//changeId = which share to delete
//changeId = privilege section (22=del)
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=" + oldValue;
break;
case "areaLogCombine":
//fence_id = document.getElementById('fence_id').value;
combineItems = getCheckedItems('closedAreaLogs');
combineNames = getCheckedNames('closedAreaLogs');
if(combineNames=='')
{
combineNames = '-1';
}
if(combineItems=='')
{
combineItems = '-1';
}
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(combineItems) +"&oldValue=*&newValue=" + combineNames;
//alert(params);
break;
case "mvGrpFromTree":
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=" + oldValue;
break;
case "pauseArea":
fence_id = document.getElementById('fence_id').value;
fence_name = document.getElementById('fence_name').value;
is_multi= $('#is_multi').val();
if(is_multi=='1')
{
changeId = getCheckedItems('editFenceGroupCheckbox');
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=" + encodeURIComponent(changeId) + "&is_multi=" + is_multi + "&state=" + oldValue;
}
else
{
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(fence_id) +"&oldValue=*&newValue=" + encodeURIComponent(fence_name);
}
url = "../mobil/xml/xml_changeValue.php";
break;
case "delArea":
fence_id = document.getElementById('fence_id').value;
fence_name = document.getElementById('fence_name').value;
is_multi= $('#is_multi').val();
if(is_multi=='1')
{
changeId = getCheckedItems('editFenceGroupCheckbox');
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(changeId) +"&oldValue=*&newValue=" + encodeURIComponent(changeId) + "&is_multi=" + is_multi;
}
else
{
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(fence_id) +"&oldValue=*&newValue=" + encodeURIComponent(fence_name);
}
url = "../mobil/xml/xml_changeValue.php";
break;
case "fenceName":
fence_id = document.getElementById('fence_id').value;
fence_name = document.getElementById('fence_name').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(fence_id) +"&oldValue=*&newValue=" + encodeURIComponent(fence_name);
//alert(params);
break;
case "fenceMode":
fence_id = document.getElementById('fence_id').value;
fence_mode = document.getElementById('change_fence_mode').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(fence_id) +"&oldValue=*&newValue=" + encodeURIComponent(fence_mode);
//alert(params);
break;
case "chgAgrarArea":
coords = document.getElementById('coords').value;
fence_id = document.getElementById('fence_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(fence_id) +"&oldValue=*&newValue=" + coords;
//alert(params);
break;
case "addLogArea":
coords = document.getElementById('coords').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId=*&oldValue=*&newValue=" + coords;
//alert(params);
break;
case "drawAgrarArea":
coords = document.getElementById('coords').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent("") +"&oldValue=*&newValue=" + coords;
//alert(params);
break;
case "bindMailToAlert":
alert_id = document.getElementById('alert_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(alert_id) +"&oldValue=*&newValue=" + oldValue;
//alert(params);
break;
case "chgAddrLang":
language = document.getElementById('language').value;
add_b_id = document.getElementById('add_b_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(add_b_id) +"&oldValue=*&newValue=" + language;
break;
case "chgFuelCons":
fuel_per_100 = document.getElementById('fuel_per_100').value;
fuel_type = document.getElementById('fuel_type').value;
veh_id_raw = document.getElementById('veh_id_raw').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+ encodeURIComponent(fuel_per_100) +"&oldValue=*&newValue=" + fuel_type + "&vid=" + encodeURIComponent(veh_id_raw);
break;
case "temperature_range":
sensor = document.getElementById('sensor').value;
from = $('#slider-range').slider('values', 0);
to = $('#slider-range').slider('values', 1);
imei_id = document.getElementById('imei_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+imei_id+"&oldValue="+sensor+"&newValue=" + from + "," +to;
break;
case "addSensorName":
sensor_name = document.getElementById('sensor_name').value;
imei_id = document.getElementById('imei_id').value;
sensor = document.getElementById('sensor').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+sensor+"&oldValue=" + imei_id + "&newValue="+sensor_name;
break;
case "addEngineTracker":
newValue = document.getElementById('tracker_AddDevice').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
//alert(params);
break;
case "addLogBookTracker":
newValue = document.getElementById('tracker_AddDevice').value;
mileage = document.getElementById('mileage').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue+"&mileage="+mileage;
//alert(params);
break;
case "chgSound":
newValue = 0;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "tempHistory":
newValue = document.getElementById('tempHistoryLength').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "fenceLbl":
newValue = document.getElementById('hidden_grp_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "tempHistoryOpacity":
newValue = document.getElementById('tempHistoryOpacity').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "tempHistoryThickness":
newValue = document.getElementById('tempHistoryThickness').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "tempLayout":
newValue = document.getElementById('tempLayoutValue').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "liveLineColor":
newValue = document.getElementById('liveLineColorValue').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "changeFenceColor":
newValue = document.getElementById('FenceColor').value;
hidden_grp_id = document.getElementById('hidden_grp_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+hidden_grp_id+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "changeFenceColorPreset":
newValue = document.getElementById('changeFenceColorPreset').value;
hidden_grp_id = document.getElementById('hidden_grp_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+hidden_grp_id+"&oldValue="+oldValue+"&newValue="+newValue;
break;
case "driver":
newValue = document.getElementById('driver_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId=" + encodeURIComponent(changeId) +"&oldValue="+oldValue+"&newValue="+newValue;
//alert(params);
break;
case "groups":
newValue = document.getElementById('group_id').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+newValue;
//alert(params);
break;
case "addGroup":
newValue = document.getElementById('new_grp_name').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+ encodeURIComponent(newValue);
break;
case "removeGrp":
newValue = $('#group_id').val();
//alert(newValue);
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+ encodeURIComponent(newValue);
break;
case "addFenceGroup":
newValue = document.getElementById('new_grp_name').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+ encodeURIComponent(newValue);
break;
case "delFenceGroup":
newValue = document.getElementById('dropdown_fence_groups').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+ encodeURIComponent(newValue);
break;
case "changeFenceGroup":
changeId = getCheckedItems('editFenceGroupCheckbox');
newValue = document.getElementById('dropdown_fence_groups_move').value;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue="+oldValue+"&newValue="+ encodeURIComponent(newValue);
break;
case "chgAreaLogLbl":
changeId = getCheckedItems('editFenceGroupCheckbox');
newValue = oldValue;
url = "../mobil/xml/xml_changeValue.php";
params = "section="+section+"§ion_id="+section_id+"&changeId="+changeId+"&oldValue=*&newValue="+ encodeURIComponent(newValue);
//alert(params);
//return;
break;
default:
return;
break;
}
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
////console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
try{optionVal = response.getElementsByTagName('optionVal')[0].firstChild.data;
}catch(e)
{
}
$('#resultId_'+section).val(result);
if(result=='1')
{
try{
dashboardVehicleTable();
document.getElementById("result_"+section).innerHTML = message;
}catch(e)
{
//console.log("Fehler: " + e.toString());
}
switch (section){
case "create_company_location":
case "create_fleet_group":
try{ getFleet();}catch(e){ console.log(e); }
break;
case "storeSubuser":
setTimeout(function(){
try{getTable_ajax('userTable');}catch(e){ }
$('#firstname').val('');
$('#lastname').val('');
$('#emailAddress_1').val('');
$('#emailAddress_2').val('');
},250);
break;
case "clearAreaLogTable":
try{tempFenceTable();}catch(e){ }
break;
case "deleteArchive":
case "delArchive":
setTimeout(function(){
try{getTable('kmz_archives');}catch(e){ }
try{$('#dialog').dialog('close');}catch(e){ }
},250);
getTable('kmz_archives');
break;
case "removeGrp":
createDropdown('groups', 'x' , 'x' );
try{$('#tree-checkable').jstree(true).refresh();}catch(e){ }
break;
case "request_sepa_net_tan":
$( "#continue_sepa_bank_data_after_tan_suc" ).removeClass( "disabled" );
break;
case "deleteVehicleImage":
update();
$("#device_image").attr('src', 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
$('#delVehicleImageBtn').hide();
break;
case "delete_driver":
setTimeout(function(){
//try{dashboardFenceTable();}catch(e){ }
try{createDropdown('driver', 'firstname' , 'ASC' );}catch(e){ }
},250);
break;
case "delTr":
$('#confirmOverlayDialog').hide();$('#contentToEdit').show();$('#output_tr_edit').hide();$('#tr_step').show();$('#navBarAssist').show();
if($('#closeDialogWindow').val()==="true")
{
try{$('#dialog').dialog('close');}catch(e){ }
}
else
{
}
setTimeout(function(){
try{dashboardFenceTable();}catch(e){ }
try{getTable('timerangeGroups');}catch(e){ }
$('#tr_grp2').val('1');
$('#tr_grp').val('1');
//
},250);
break;
case "delShare":
setTimeout(function(){ getdeviceTableCheckboxes(); },250);
break;
case "delArchive":
setTimeout(function(){ getTable('kmz_archives'); },250);
try{$('#dialog').dialog('close');}catch(e){ }
break;
case "mvGrpFromTree":
setTimeout(function(){ $('#tree-checkable').jstree(true).refresh(); },250);
break;
case "treeGroup":
setTimeout(function(){ $('#tree-checkable').jstree(true).refresh(); },250);
return;
break;
case "chgFuelCons":
setTimeout(function(){ getTable('distance','name','ASC'); },1000);
break;
case "chgAddrLang":
setTimeout(function(){ getAddressbookTable(); },1000);
break;
case "changeSimCard":
setTimeout(function(){ getTable('sim_table'); try{$('#dialog').dialog('close');$('#phone_number').val('');}catch(e){ }},250);
break;
case "editMileage":
$( "#btn_change_mileage" ).removeClass( "disabled" );
setTimeout(function(){ try{getTable('distance','name','ASC');$('#mileage').val('');}catch(e){ }},250);
break;
case "removeTimeruleToFence":
case "assignTimeruleToFence":
setTimeout(function(){
try{$('#dialog').dialog('close');}catch(e){ }
},250);
setTimeout(function(){ dashboardFenceTable(); },550);
break;
case "areaLogCombine":
getTable('getReceivedFencesLog','name','ASC');
break;
case "addGroup":
case "tempHistory":
createDropdown('groups', 'x' , 'x' );
try{$('#tree-checkable').jstree(true).refresh();}catch(e){ }
setTimeout(function(){
//$('#group_id option[value="' + optionVal + '"]').attr('selected', true)
//newValue = document.getElementById('group_id').value;
//alert(optionVal + '/' + newValue);
//$('select:has(option:contains(abc))')
$("#group_id option").filter(function() {
return $(this).text() ==optionVal;
}).prop("selected", true);
document.getElementById("new_grp_name").value = '';
//$('#group_id option:contains(www)').val();
//$("#group_id").find("option:contains('www')");
//$('#group_id option:contains(' + optionVal + ')')
//$('#group_id').find('option[text=' + optionVal + ']').val();
// $('#group_id').val(optionVal).change();
dashboardVehicleTable();
}, 500);
break;
case "addFenceGroup":
getTable('fence_group_dropdown','id','DESC');
setTimeout(function(){
$("#dropdown_fence_groups option").filter(function() {
return $(this).text() ==optionVal;
}).prop("selected", true);
document.getElementById("new_grp_name").value = '';
}, 1500);
break;
case "bindMailToAlert":
getAlertRules();
break;
case "changeFenceGroup":
case "delFenceGroup":
case "delArea":
case "addLogArea":
case "chgAgrarArea":
case "pauseArea":
getTable('area_log_objects','name','DESC');
getTable('fence_group_dropdown','name','DESC');
try{$('#dialog').dialog('close');}catch(e){ }
break;
case "addLogBookTracker":
document.getElementById("result_" + section ).innerHTML = message;
setTimeout(function(){
getTable('getTracker');
document.getElementById("result_" + section ).innerHTML = '';
}, 1500);
break;
case "fenceName":
case "fenceMode":
//$('#dialog').dialog('close');
setTimeout(function(){
try{$('#dialog').dialog('close');}catch(e){ }
try{dashboardFenceTable();}catch(e){ }
try{getTable('area_log_objects','name','DESC');}catch(e){ }
}, 250);
break;
case "mvGrpFromTree":
setTimeout(function(){ $('#tree-checkable').jstree(true).refresh(); },250);
toaster('1',message);
break;
default:
//dialog.close();
break;
}
toaster('1',message);
}
else
{
toaster('2',message);
$('#result_' + section).html(message);
switch (section){
case "mvGrpFromTree":
setTimeout(function(){ $('#tree-checkable').jstree(true).refresh(); },250);
//toaster('1',message);
return;
break;
case "editMileage":
setTimeout(function(){ $( "#btn_change_mileage" ).removeClass( "disabled" ); },250);
return;
break;
}
}
setTimeout(function(){
$('#btn_change_sim').removeClass('disabled');
},250);
}
}
}
function createDropdown(section, orderBy , order ){
switch (section){
case "dropdownVehicles":
var vehicle_grp_id = '*';
try{
vehicle_grp_id = document.getElementById('dropdown_group_filter').value;
}catch(e){
}
url = "../mobil/xml/dropdownVehicles.php";
params = "vehicle_grp_id=" + vehicle_grp_id;
break;
case "driver":
url = "../mobil/xml/createDropdownDriver.php";
params = "orderBy=" + orderBy + "&order=" + order;
break;
case "tempHistory":
url = "../mobil/xml/xml_create_dropDownTempHistory.php";
params = "";
break;
case "tempLayout":
url = "../mobil/xml/xml_create_dropDownTempLayout.php";
params = "";
break;
case "groups":
url = "../mobil/xml/getGroups.php";
params = "";
break;
case "vehicle_group_filter":
document.getElementById('vehicle_group_filter').innerHTML = '
';
document.getElementById('dropdownVehicles').innerHTML = '
';
url = "../mobil/xml/getGroupFilter.php";
params = "";
break;
default:
return;
break;
}
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
// console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
if(result=='1')
{
try{
if(section=='getReceivedFencesLog')
{
//console.log(xmlHttp.responseText);
}
if(section=='driver')
{
try{
contingent = response.getElementsByTagName('contingent')[0].firstChild.data;
if(contingent=='0')
{
//$('#dialog').dialog('close');
}
}catch(e){}
}
document.getElementById(section).innerHTML = response.getElementsByTagName(section)[0].firstChild.data;
}catch(e)
{
//console.log("Fehler: " + e.toString());
}
}
}
}
}
function addTicket(callback){
text = document.getElementById('text').value;
queue = document.getElementById('queue').value;
subject = document.getElementById('subject').value;
$("#addTicket").prop('disabled', true);
url = "xml/xmlAddTicket.php";
params = "queue="+encodeURIComponent(queue) + "&text="+encodeURIComponent(text) + "&subject="+encodeURIComponent(subject);
var xmlHttp = xml_request();
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(params);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
if(result=='1')
{
try{
//document.getElementById('imei').value = '';
$("#addTicket").prop('disabled', false);
message = response.getElementsByTagName('message')[0].firstChild.data;
// resultText
document.getElementById('resultText').innerHTML = message;
document.getElementById('subject').value = '';
document.getElementById('text').value = '';
getTable('externalTickets');
toaster('1',message);
setTimeout(function(){
$('#'+callback).modal('hide');
}, 2500);
}catch(e)
{
}
}
if(result=='0')
{
message = response.getElementsByTagName('message')[0].firstChild.data;
document.getElementById('resultText').innerHTML = message;
toaster('2',message);
}
}
}
}
function selectFromAddrBook(){
addressbook = document.getElementById('addressbook').value;
firstname = addressbook.split(",")[2];
lastname = addressbook.split(",")[1];
email = addressbook.split(",")[3];
x=$("tr.add_content").length;
//alert($("tr.add_content").length);
//Prüfe vor dem hinzufügen, ob die Mail Adresse schon in einem Feld steht
cvcv=$("tr.add_content input[value='" + email +"']").length;
if(cvcv>0)
{
return;
};
max_fields = 3;
if(x < max_fields){ //max input box allowed
x++; //text box increment
$(".input_fields_wrap").append(''); //add input box
}
$(".input_fields_wrap > tr").each(function() {
var fields = $(this).find(":text");
var first = fields.eq(0).val();
var last = fields.eq(1).val();
var mail = fields.eq(1).val();
if(first){
//alert("dfbdfb" + first + '/' + last + '/' + mail);
}
});
$("input[class='form-control send_share']").prop('disabled', true);
$(".input_fields_wrap").on("click",".remove_field", function(e){ //user click on remove text
//e.preventDefault(); $(this).parent('div').remove(); x--;
//alert($(".input_fields_wrap tr").length);
$(this).closest('table').remove();
x=$("tr.add_content").length;
if(x==0)
{
$("#send_share_by_mail").prop('disabled', true);
}else
{
$("#send_share_by_mail").prop('disabled', false);
}
if(x==0)
{
$('#headline_recp').hide();
}
else
{
$('#headline_recp').show();
}
})
$("#submit").click(function() {
$(".input_fields_wrap > tr").each(function() {
var fields = $(this).find(":text");
var first = fields.eq(0).val();
var last = fields.eq(1).val();
var mail = fields.eq(1).val();
if(first){
//alert("dfbdfb" + first + '/' + last + '/' + mail);
//cvcv=$("tr.add_content input[value='" + mail +"']").length;
}
});
});
if(x==0)
{
$("#send_share_by_mail").prop('disabled', true);
}else
{
$("#send_share_by_mail").prop('disabled', false);
}
if(x==0)
{
$('#headline_recp').hide();
}
else
{
$('#headline_recp').show();
}
}
function autoCenter(){
autoCenter_value = document.getElementById('autoCenter_value').value;
if(autoCenter_value==999)
{
$("#autoCenter_value").attr("value", "10");
$("#autoCenter_value").attr("class", "btn btn-danger btn-flat");
$("#icon_follow").attr("class", "fa fa-ban");
wert = 999;
}else
{
$("#autoCenter_value").attr("value", "999");
$("#autoCenter_value").attr("class", "btn btn-success btn-flat");
$("#icon_follow").attr("class", "fa fa-crosshairs");
wert = 10;
}
url = "xml/toggleCenter.php";
var abfrage = xml_request();
nachricht = "wert=" + wert;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//response = abfrage.responseXML.documentElement;
setTimeout(function(){
update();
}, 500);
}
}
}
function tooltip(){
tooltip_value = document.getElementById('tooltip').value;
if(tooltip_value==999)
{
$("#tooltip").attr("value", "10");
$("#tooltip").attr("class", "btn btn-danger btn-flat");
$("#icon_tooltip").attr("class", "fa fa-ban");
wert = 999;
}else
{
$("#tooltip").attr("value", "999");
$("#tooltip").attr("class", "btn btn-success btn-flat");
$("#icon_tooltip").attr("class", "fa fa-comment-o");
wert = 10;
}
url = "xml/toggleTooltip.php";
var abfrage = xml_request();
nachricht = "wert=" + wert;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//response = abfrage.responseXML.documentElement;
setTimeout(function(){
update();
}, 500);
}
}
}
function editTimezone(key,task){
url = "../mobil/xml/xml_editTimezone.php";
var abfrage = xml_request();
nachricht = "task=" + task + "&key=" + key;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
}
setTimeout(function(){
try{
dashboardVehicleTable();
}catch(e){
}
try{
update();
}catch(e){
}
}, 500);
}
}
}
function reloadLanguage(language,container,content){
alert(content);
url = "xml/reloadLanguage.php";
var abfrage = xml_request();
nachricht = "";
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
response = abfrage.responseXML.documentElement;
for(i=0;i0)
{
document.getElementById('alert_report').selectedIndex = 1;
}
alert_report = document.getElementById('alert_report').value;
download = document.getElementById('download').value;
liveshare = document.getElementById('liveshare').value;
tracker_buy_plan = document.getElementById('tracker_buy_plan').value;
//alert(tracker_buy_plan);
url = "xml/calculateCustomPlan.php";
var abfrage = xml_request();
nachricht = "runtime=" + runtime +
"&interval=" + sending_interval +
"&refresh_interval=" + refresh_interval +
"&storage_lifetime=" + storage_lifetime +
"&session_lifetime=" + session_lifetime +
"&alert_report=" + alert_report +
"&lastdayroute_report=" + lastdayroute_report +
"&breadcrumbs=" + breadcrumbs +
"&serverfences=" + serverfences +
"&logbook=" + logbook +
"&watchman=" + watchman +
"&iolog=" + iolog +
"&api=" + api +
"&bypass=" + bypass +
"&logfile=" + logfile +
"&email_recp=" + email_recp +
"&download=" + download +
"&liveshare=" + liveshare +
"&subtask=" + subtask +
"&ignition_log=" + ignition_log +
"&tracker_buy_plan=" + encodeURIComponent(tracker_buy_plan);
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
plan_table = response.getElementsByTagName('plan_table')[0].firstChild.data;
sum_total = response.getElementsByTagName('sum')[0].firstChild.data;
saved = parseFloat(response.getElementsByTagName('saved')[0].firstChild.data);
//alert(saved);
saved_text = response.getElementsByTagName('saved_text')[0].firstChild.data;
btn = response.getElementsByTagName('btn')[0].firstChild.data;
// alert(saved_text);
if(result==0)
{
document.getElementById('saved_text').innerHTML = plan_table;
$("#saved_text").removeClass("alert alert-success");
$("#saved_text").addClass("alert alert-danger");
document.getElementById('btn').innerHTML = '';
document.getElementById('subtask').selectedIndex = 0;
return;
}
//document.getElementById('actual_plan').innerHTML = sum_total;
document.getElementById('saved_text').innerHTML = saved_text;
document.getElementById('plan_table').innerHTML = plan_table;
document.getElementById('btn').innerHTML = btn;
if(saved>0)
{
$("#saved_text").removeClass("alert alert-danger");
$("#saved_text").addClass("alert alert-success");
}
if(saved>0.00)
{
$("#saved_text").removeClass("alert alert-danger");
$("#saved_text").addClass("alert alert-success");
}
if(saved==0.00)
{
$("#saved_text").removeClass("alert alert-danger");
$("#saved_text").addClass("alert alert-success");
}
if(saved==0)
{
$("#saved_text").removeClass("alert alert-danger");
$("#saved_text").addClass("alert alert-success");
}
if(saved<0.00)
{
$("#saved_text").removeClass("alert alert-success");
$("#saved_text").addClass("alert alert-danger");
}
if(saved<0)
{
$("#saved_text").removeClass("alert alert-success");
$("#saved_text").addClass("alert alert-danger");
}
//alert(plan_table);
if(result == '-1')
{
}
if(result == '1')
{
$("#pre_calc").removeClass("disabled");
}
}
}
}
function sendShareByMail(release_id)
{
document.getElementById('error_result').innerHTML = "
";
str = "";
$(".input_fields_wrap > table tr").each(function() {
var fields = $(this).find(":text");
var first = fields.eq(0).val();
var last = fields.eq(1).val();
var mail = fields.eq(2).val();
if(first){
str += first + '/' + last + '/' + mail + ",";
//alert("dfbdfb" + first + '/' + last + '/' + mail);
//cvcv=$("tr.add_content input[value='" + mail +"']").length;
}
});
url = "xml/sendShareByMail.php";
var abfrage = xml_request();
nachricht = "recipients=" + str + "&release_id=" + release_id;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
$("#send_share_by_mail").prop('disabled', true);
add_file('modules/addEmailRecipient.php');
//
document.getElementById('error_result').innerHTML = "";
}
}
}
//alert(str);
}
function add_file(file){
//$( '#result' ).append( "
");
$( "#result" ).load( file, function() {});
//alert($(".form-control add").length);
//liveReleaseData('share/send.php',encodeURIComponent('Freigabe per E-Mail versenden'),1);
}
function checkSession(){
url = "../mobil/xml/xmlCheckSession.php";
var abfrage = xml_request();
nachricht = "";
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
if(abfrage.responseText == 'exit')
{
console.log('Logout');
window.top.location="/system/frontend/logout.php?from=auto&where=mobile";
}
}
}
}
function selectDropdown(data, term) {
var markup = data.add_info;
document.getElementById('suggest').value = markup;
return markup;
}
function repoFormatResult(data) {
var markup = '';
return markup;
}
function movieFormatSelection(data) {
return data.tracking_id;
}
function fahrtenbuchAdresseAendern(id,ident,goal,title){
// alert(ident);
BootstrapDialog.show({
message: $('').load('fahrtenbuchAdresseAendern.php?id=' + id + '&ident=' + ident),
animate: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: title,
type: BootstrapDialog.TYPE_INFO,
onhide: function(dialogRef){
var fruit = dialogRef.getModalBody().find('input').val();
if($.trim(fruit.toLowerCase()) == '') {
document.getElementById("new_address").style.borderColor = "red";
toaster('2','?');
return false;
}
},
buttons: [{
label: 'Schließen/Abbrechen',
action: function(dialogRef){
dialogRef.close();
},icon: 'glyphicon glyphicon-ban-circle',
cssClass: 'btn-warning'
}]
});
}
function changeStep1_fence()
{
if(document.getElementById('tracker').value=='-1')
{
$("#choose_device").removeClass("alert alert-success");
$("#choose_device").addClass("alert alert-danger");
$("#choose_device_fa").removeClass("fa fa-check");
$("#choose_device_fa").addClass("fa fa-exclamation");
$("#map_button").addClass("disabled");
}
else
{
$('#step_1').hide();
$('#step_2').show();
$('#round_fence_box').show();
$('html, body').animate({ scrollTop: $('#step_2').offset().top}, 1000);
$("#choose_device").removeClass("alert alert-danger");
$("#choose_device").addClass("alert alert-success");
$("#choose_device_fa").removeClass("fa fa-exclamation");
$("#choose_device_fa").addClass("fa fa-check");
$("#map_button").removeClass("disabled");
//alert($("#tracker option:selected").text());
$("#object_name").val("Geofence " + $("#tracker option:selected").text());
}
}
function changeStep2_fence()
{
$('#step_1').hide();
$('#step_2').hide();
$('#step_3').show();
$('html, body').animate({ scrollTop: $('#step_2').offset().top}, 1000);
$("#map_open").removeClass("alert alert-danger");
$("#map_open").addClass("alert alert-success");
$("#map_open_fa").removeClass("fa fa-exclamation");
$("#map_open_fa").addClass("fa fa-check");
}
function changeStep3_fence()
{
//if((document.getElementById('fence_type').value=='-1') || (document.getElementById('fence_alert').value=='-1') || (document.getElementById('fence_interval').value=='-1') || (document.getElementById('object_name').value=='')|| (document.getElementById('object_name').value.length <=2))
if((document.getElementById('fence_type').value=='-1') || (document.getElementById('fence_alert').value=='-1') || (document.getElementById('object_name').value=='')|| (document.getElementById('object_name').value.length <=2))
{
$("#alert_params").removeClass("alert alert-success");
$("#alert_params").addClass("alert alert-danger");
$("#alert_params_fa").removeClass("fa fa-check");
$("#alert_params_fa").addClass("fa fa-exclamation");
$("#save").addClass("disabled");
}else
{
$("#alert_params").removeClass("alert-success");
$("#alert_params").removeClass("alert-danger");
$("#alert_params").addClass("alert-success");
$("#alert_params_fa").removeClass("fa fa-exclamation");
$("#alert_params_fa").addClass("fa fa-check");
$("#save").removeClass("disabled");
}
}
function scrollNav() {
$('.scrollTop a').scrollTop();
}
function store_polyfence(){
//boundaries = document.getElementById('results').innerHTML;
//timeRangeRule = $("#dropdown_timerange_groups").val();
//if(timeRangeRule=='')
//{
timeRangeRule = '0';
//}
//document.getElementById('circle').innerHTML = '';
//document.getElementById('error_result').innerHTML = "
";
fence_type = document.getElementById('fence_type').value; //art, verlassen = 0, befahren = 1
object_name = document.getElementById('object_name').value; //Zaun Name
key = document.getElementById('tracker').value; //id tracker verschlüsselt
fence_alert = document.getElementById('fence_alert').value; //intervall, statisch 0
polyfence_preset = document.getElementById('polyfence_preset').value; //landesvorlage (-1 = keine)
var polygon_from_drawer;
try{
polygon_from_drawer = $('#polygon').val();
}catch(e_tr)
{
polygon_from_drawer = '-1';
}
try{
polyfence_tr_grp = document.getElementById('tr_grp').value;
}catch(e_tr)
{
polyfence_tr_grp = 0;
}
//alert(polyfence_tr_grp);
var query_store_object = xml_request();
try {
xmlHttp = new xml_request();
url_store_object = "../mobil/xml/xml_setPolyfence.php";
content = "object_name="+object_name+"&fence_type="+fence_type+"&key="+key+"&timeRangeRule="+timeRangeRule+"&fence_alert="+fence_alert + "&polyfence_preset="+polyfence_preset + "&polyfence_tr_grp=" + polyfence_tr_grp + '&polygon_from_drawer=' + polygon_from_drawer;
xmlHttp.open("POST", url_store_object, true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(content);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//alert(xmlHttp.responseText);
try
{
setTimeout(function(){
if(xmlHttp.responseText == '123456')
{
//window.parent.permissionWindow(0);
document.getElementById('error_result').innerHTML = "";
}
else
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
object = response.getElementsByTagName('object')[0].firstChild.data;
ref = response.getElementsByTagName('ref')[0].firstChild.data;
url = "FENCE_VIEW_NOW";
if(result=="1")
{
setTimeout(function(){
try{
geofence_layer.removeAllFeatures();
kmllayer.refresh({ force: true, params: { 'key': Math.random()} });
}catch(e)
{
}
try{$('#dialog').dialog('close');}catch(e){ }
//document.getElementById('circle').innerHTML = "
";
toaster("1",message);
document.getElementById('object_name').value = '';
dashboardFenceTable();
//$("#alert_params").removeClass("alert alert-info");
//$("#map_open").removeClass("alert alert-success");
$("#save").removeClass("btn btn-info");
$("#save").addClass("btn btn-success");
$("#save_check").addClass("fa fa-check");
$("#save_check").attr("disabled");
$("#save").addClass("disabled");
//$('.map-content').animate({scrollTop: $('#top').offset().top - 20 }, 'slow');
changeStep1_fence();
resetFenceGenerator();
changeStep1_fence();
}, 1500);
}
else
{
toaster("2",message);
setTimeout(function(){
document.getElementById('error_result').innerHTML = '';
//document.getElementById('circle').innerHTML = "
";
}, 1500);
}
}
},500);
}
catch (e) {
setTimeout(function(){
document.getElementById('error_result').innerHTML = "";
document.getElementById('circle').innerHTML = "
";
}, 1500);
}
}
}
} catch (e) {
toaster('2','Fehler 0x00-store_polyfence');
}
try{
xmlHttp.send(null);
} catch (e) {
}
}
function showTempFence(id,typ)
{
if(typ=='0'){
//Roundfence
file = '../mobil/polyfence/showRoundFence.php?id='+id;
msg = ' ';
}else
{
if(typ=='1'){
//Roundfence
file = '../mobil/polyfence/showPolyFence.php?id='+id;
msg = ' ';
}else
{
//temp fence
file = '../mobil/polyfence/showTempFence.php?id='+id;
msg = ' ';
}
}
jq_modal(file,msg,'dialog', 0, 0);
}
function showFence(id,typ,backBtn)
{
if(typ=='0'){
//Roundfence
file = '../mobil/polyfence/showRoundFence.php?id='+id;
msg = ' ';
}else
{
//polyfence
if(typ=='2'){
//Roundfence
file = '../mobil/polyfence/showWatcherObject.php?id='+id;
msg = ' ';
}
else
{
try
{
if(backBtn=="1")
{
file = '../mobil/polyfence/showPolyFence.php?id='+id + '&backBtn=1';
}
else
{
file = '../mobil/polyfence/showPolyFence.php?id='+id + '&backBtn=0';
}
} catch (e) {
file = '../mobil/polyfence/showPolyFence.php?id='+id + '&backBtn=0';
}
}
msg = ' ';
}
//alert(file);
jq_modal(file,msg,'dialog', 0, 0);
}
function addressbook(lat1,lng1,lat2,lng2)
{
file = 'fahrtenbuch/addressbook.php?lat1='+lat1 + '&lng1='+lng1+ '&lat2='+lat2+ '&lng2='+lng2;
BootstrapDialog.show({
message: $('').load(file),
animate: false,
title: 'Aus Adressbuch übernehmen',
type: BootstrapDialog.TYPE_INFO,
buttons: [{
label: 'Schließen',
action: function(dialogRef){
dialogRef.close();
},icon: 'glyphicon glyphicon-ban-circle',
cssClass: 'btn-info'
}]
});
}
function createWindow2(file, title, callback){
//alert(size);
title = decodeURIComponent(title);
type = BootstrapDialog.TYPE_INFO;
dialog = new BootstrapDialog({
message: $('').load(file),
animate: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: title,
type: type,
draggable: true,
buttons: [{
label: 'OK',
action: function(dialogRef){
dialogRef.close();
switch(callback){
case 'addressbookTable':
getAddressbookTable();
break;
default:
return;
}
},icon: 'glyphicon glyphicon-check',
cssClass: 'btn-info'
}]
});
dialog.realize();
//dialog.getModalHeader().hide();
//dialog.getModalHeader().hide();
dialog.getModalFooter().hide();
//dialog.getModalBody().css('background-color', '#0088cc');
dialog.getModalBody().css('color', '#000');
// dialog.setSize(BootstrapDialog.SIZE_LARGE);
//alert(dialog.getModal());
dialog.open();
}
function createWindow(file, title, callback){
//alert(size);
title = decodeURIComponent(title);
type = BootstrapDialog.TYPE_INFO;
BootstrapDialog.show({
id: callback,
message: $('').load(file),
animate: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: title,
type: type,
draggable: true,
//(function(){
//if(callback=="createObject")
//{
// alert('fine');
// }
// }),
buttons: [{
id: 'btn_' + callback,
label: 'OK',
disabled: true,
action: function(dialogRef){
switch(callback){
case 'addressbookTable':
getAddressbookTable();
break;
case 'createObject':
return_val = checkFence();
if(return_val==0)
{
toaster('2','Fehlerhafter Zaun');
}
else
{
if(return_val.substring(0, 5) == "NAME:")
{
//document.getElementById('polygon_object').innerHTML = checkFence();
//alert(return_val);
object_name = return_val.split(';')[0].split(':')[1];
polygon = return_val.split(';')[1];
//alert(polygon);
storeObject(object_name, polygon)
//alert(document.getElementById('object_name').value);
dialogRef.close();
getTable('objects');
}
else
{
toaster('2','Bitte einen Namen vergeben');
}
}
break;
default:
dialogRef.close();
return;
}
},icon: 'glyphicon glyphicon-ban-circle',
cssClass: 'btn-info'
}]
});
if(callback=='createObject')
{
document.getElementById('btn_' + callback).disabled = true;
}
}
function liveReleaseData(file, title,id){
jq_modal(file + '?id=' + id,title,'dialog', 0, 0);
return;
//alert(size);
title = decodeURIComponent(title);
type = BootstrapDialog.TYPE_INFO;
BootstrapDialog.show({
message: $('').load(file + '?id=' + id),
animate: false,
title: title,
type: type,
draggable: true,
buttons: [{
label: 'Schließen',
action: function(dialogRef){
dialogRef.close();
},icon: 'glyphicon glyphicon-ban-circle',
cssClass: 'btn-info'
}]
});
}
function modalWindow(file, title,type,size,key){
//alert(size);
title = decodeURIComponent(title);
if(type==1)
{
type = BootstrapDialog.TYPE_INFO;
}
else
{
type = BootstrapDialog.TYPE_INFO;
}
BootstrapDialog.show({
message: $('').load(file + '?key=' + key),
animate: false,
closeByBackdrop: false,
closeByKeyboard: false,
title: title,
type: type,
buttons: [{
label: 'Abbruch',
action: function(dialogRef){
dialogRef.close();
},icon: 'glyphicon glyphicon-ban-circle',
cssClass: 'btn-info'
},{
label: 'Weiter mit Zaunkonfiguration',
action: function(dialogRef){
var result = checkFence();
if(result==0)
{
toaster('2','Fehlerhafter Zaun');
}else
{
setFenceToSession(result);
$("#save").removeClass("disabled");
$('#tracker').removeAttr("disabled");
changeStep2_fence();
dialogRef.close();
changeStep3_fence();
}
},icon: 'glyphicon glyphicon-ban-circle',
cssClass: 'btn-info'
}]
});
}
function make_a_fence(){
var result = checkFence();
if(result==0)
{
toaster('2','Fehlerhafter Zaun');
}else
{
setFenceToSession(result);
$('#dialog').dialog('close');
$("#save").removeClass("disabled");
$('#tracker').removeAttr("disabled");
changeStep2_fence();
changeStep3_fence();
}
}
function markSound(id, where){
abfrage = new xml_request();
try
{
url = "xml/markSound.php";
message = "id=" + id + "&where=" + where;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
// document.getElementById('result').innerHTML = abfrage.responseText;
}}} catch (e) {}
}
function markAsRead(id, where){
abfrage = new xml_request();
try
{
url = "xml/markAsRead.php";
message = "id=" + id + "&where=" + where;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
// document.getElementById('result').innerHTML = abfrage.responseText;
}}} catch (e) {}
}
function stickyToaster(task,message, id, section)
{
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": false,
"progressBar": true,
"positionClass": "toast-top-right",
"preventDuplicates": true,
"onclick": function(){
markAsRead(id, section);
},
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "3600000",
"extendedTimeOut": "3600000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
say = '';
switch(task){
case '0':
say='warning';
break;
case '1':
say='success';
break;
case '2':
say='error';
break;
default:
say='success';
}
toastr[say](message);
}
function toaster(task,message, timeout){
if (typeof timeout !== 'undefined') {
}
else
{
timeout = 5000;
}
toastr.options = {
"closeButton": false,
"debug": false,
"newestOnTop": true,
"progressBar": true,
"positionClass": "toast-top-right",
"preventDuplicates": false,
"onclick": null,
"showDuration": "300",
"hideDuration": "1000",
"timeOut": timeout,
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
say = '';
switch(task){
case '0':
say='warning';
break;
case '1':
say='success';
break;
case '2':
say='error';
break;
default:
say='success';
}
toastr[say](message);
}
function setOwnPos(lat,lng, speed){
abfrage = new xml_request();
try
{
url = "xml/setOwnPos.php";
message = "lat=" + lat + '&lng=' + lng + '&speed=' + speed;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
// document.getElementById('result').innerHTML = abfrage.responseText;
if(abfrage.responseText == '123456')
{
//window.parent.permissionWindow(0);
}
if(abfrage.responseText == '1')
{
toaster('1','Jetzt bitte die Alarmparameter eingeben.');
//parent.frames.growl('Vorgang gespeichert','Das Fenster wird bis zur
nächsten Änderung nicht
mehr angezeigt.','../images/green_hook.png','7000','false');
}
if(abfrage.responseText == '0')
{
//growl('Aktion fehlerhaft','','../images/red_x.png','5000','false');
}
}
}
} catch (e) {
alert(e);
}
}
function setFenceToSession(linestring){
abfrage = new xml_request();
try
{
url = "../mobil/xml/setFenceToSession.php";
message = "linestring=" + encodeURIComponent(linestring);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
// document.getElementById('result').innerHTML = abfrage.responseText;
if(abfrage.responseText == '123456')
{
//window.parent.permissionWindow(0);
}
if(abfrage.responseText == '1')
{
toaster('1','Jetzt bitte die Alarmparameter eingeben.');
//parent.frames.growl('Vorgang gespeichert','Das Fenster wird bis zur
nächsten Änderung nicht
mehr angezeigt.','../images/green_hook.png','7000','false');
$('#step_2').hide();
$('#round_fence_box').hide();
$('#step_1').hide();
$('html, body').animate({ scrollTop: $('#step_3').offset().top}, 1000);
}
if(abfrage.responseText == '0')
{
//growl('Aktion fehlerhaft','','../images/red_x.png','5000','false');
}
}
}
} catch (e) {
alert(e);
}
}
function getd2Track(version)
{
var url='';
$('#buttons').hide();
$('#circle').html('
Verbinde mit Streckendatenbank
');
$('#low_bandwidth_hint').hide();
document.getElementById('result_track').innerHTML = '';
try{
direction_icon = document.getElementById('direction_icon').checked;
} catch (e) {
direction_icon = 1;
}
try{
stop_icon = document.getElementById('stop_icon').checked;
} catch (e) {
stop_icon = 1;
}
try{
extended = document.getElementById('extended').value;
} catch (e) {
extended = 1;
}
//alert(extended);
//
trackDeviceName = document.getElementById('trackDeviceName').value;
icon_layout = 'headingicons.';
show_fence = $('#show_fence').is(':checked');
//alert(show_fence);
startTime = document.getElementById('startTime').value;
stopTime = document.getElementById('stopTime').value;
startDate = document.getElementById('startDate').value;
stopDate = document.getElementById('stopDate').value;
d1 = startDate.split(".")[0];
m1 = startDate.split(".")[1];
y1 = startDate.split(".")[2];
d2 = stopDate.split(".")[0];
m2 = stopDate.split(".")[1];
y2 = stopDate.split(".")[2];
startDate = m1 + '/' + d1 + '/' + y1;
stopDate = m2 + '/' + d2 + '/' + y2;
dateRange = startDate + ' - ' + stopDate;
//alert(dateRange);
if(dateRange=='')
{
alert('Kein Datum ausgewählt');
return;
}
abfrage = new xml_request();
try
{
url = "../mobil/xml/xml_getMobileTrack.php";
message = "trackDeviceName=" + trackDeviceName + "&dateRange=" + dateRange + "&startTime=" + startTime + "&stopTime=" + stopTime + "&version=" + version + "&icon_layout="+icon_layout+"&extended="+extended +"&direction_icon="+direction_icon +"&stop_icon="+stop_icon +"&show_fence="+show_fence;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
if (abfrage.readyState==4 && abfrage.status==200)
{
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
url = response.getElementsByTagName('url')[0].firstChild.data;
path_kml = response.getElementsByTagName('path_kml')[0].firstChild.data;
path_gpx = response.getElementsByTagName('path_gpx')[0].firstChild.data;
fileName = response.getElementsByTagName('fileName')[0].firstChild.data;
dropbox = response.getElementsByTagName('dropbox')[0].firstChild.data;
if(result==1)
{
//alert('1');
setTimeout(function(){
$('#buttons').show();
$('#circle').html('');
if(version=='normal')
{
document.getElementById('result_track').innerHTML = url;
$('#db_saver_kml').show();
$('#kml_db').show();
$('#db_saver_kml').prop('href', path_kml);
$('#db_saver_gpx').show();
$('#gpx_db').show();
$('#db_saver_gpx').prop('href', path_gpx);
if(dropbox=='0')
{
$('#db_saver_kml').hide();
$('#db_saver_gpx').hide();
document.getElementById('kml_db_substitute').innerHTML = '
';
document.getElementById('gpx_db_substitute').innerHTML = '
';
getLanguageItem('PRE_14_DAY');
getLanguageItem('ATTENTION');
getLanguageItem('HIS_KML_DB');
getLanguageItem('HIS_GPX_DB');
}
//$('#db_saver').prop('class', 'disbaled');
$( "#db_saver" ).addClass( "disabled" );
//$('a#db_saver').text('Ab dafür');
//$('#db_saver').prop('data-filename', 'sdvsdfv.kml');
//alert(fileName);
}
else
{
document.getElementById('result_track').innerHTML = url;
//window.open(url,'_blank');
}
}, 250);
}
else
{
$('#db_saver_kml').hide();
$('#db_saver_gpx').hide();
$( "#db_saver" ).addClass( "disabled" );
$('#btn_request_track_lb').hide();
document.getElementById('result_track').innerHTML = url;
//toaster('2',url);
}
setTimeout(function(){
$('#dialog').animate({
scrollTop: $("#bottom1").offset().top+1000
}, 150);
}, 250);
if(abfrage.responseText == '123456')
{
//window.parent.permissionWindow(0);
}
if(abfrage.responseText == '1')
{
//parent.frames.growl('Vorgang gespeichert','Das Fenster wird bis zur
nächsten Änderung nicht
mehr angezeigt.','../images/green_hook.png','7000','false');
}
if(abfrage.responseText == '0')
{
//growl('Aktion fehlerhaft','','../images/red_x.png','5000','false');
}
}
}
}
} catch (e) {
alert(e);
}
try{
abfrage.send(null);
} catch (e) {
}
//alert(dateRange + ',' + startTime + ',' + stopTime);
}
function speichereFahrtenbuchAdresse(id,ident){
new_address = document.getElementById('new_address').value;
try {
url = "xml/speichereFahrtenbuchAdresse.php";
var abfrage = xml_request();
nachricht = "new_address="+new_address + "&id="+id + "&ident="+ident;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
fahrtenbuch(0);
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
}
function delFence(fence_id,fence_type,fence)
{
if(fence_id=='0')
{
alert('Kein Zaun ausgewählt.');
return;
}
try {
url = "../mobil/xml/xml_delFence.php";
var abfrage = xml_request();
nachricht = "fence_id="+fence_id+'&fence_type='+fence_type+'&fence='+fence;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
dashboardFenceTable();
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
}
function jq_modal(fileName,title, container, offset_x, offset_y){
// var custom_dialog_title;
try{ clearInterval(tempChartReloadTimer);plot.destroy();} catch (e) {}
try{ clearInterval(deviceUpgradeTimer);} catch (e) {}
$('#' + container).empty();
//var isMobile = window.matchMedia("only screen and (max-width: 900px)");
var isSmall = window.matchMedia("(max-width: 699px)");
var isMiddle = window.matchMedia("(min-width: 700px) AND (max-width: 1023px)");
var isLarge = window.matchMedia("(min-width: 1024px)");
if (isSmall.matches) {
popup_width = $(window).width();
}
else
{
popup_width = '724px';
}
//$('#dialog').dialog({fluid: true, width: $(window).width() > 600 ? 600 : 'auto', maxWidth: '700', modal:true, height: 300, title: title,position: {my: "center top+" + offset_x,at: "center top+"+offset_y},resizable: false});
//$('#dialog').load(fileName);
//$('#dialog').dialog({modal: true,maxHeight:500}).prev('.ui-dialog-titlebar').css('background','#00bcd4');
$('#' + container).css({'z-index':'1000001','overflow-x':'hidden'});
//$('.container').css({'width':'724px'});
if(offset_x=="0")
{
//$('#' + container).dialog({draggable: false, modal:false, width: popup_width, maxWidth: '600', height: 450, title: title,position: { my: 'center center', at: 'center center', of: event} });
$('#' + container).dialog({draggable: false, modal:false, width: popup_width, maxWidth: '600', height: 450, title: title,position: { my: 'center center', at: 'center center'} });
}else
{
var modal_pos = $(this),
dialog_pos = modal_pos.find('.modal-dialog');
$('#' + container).dialog({draggable: false, modal:false, width: popup_width, maxWidth: '600', height: 450, title: title,position: {my: "top+" + offset_x,at: "left+"+offset_y, of: '#topnav'}});
//dialog_pos.css("margin-top", "50px");
}
newCon='#' + container;
//$('.containerxx').addClass('importantRule');
$('#' + container).siblings().find(".ui-dialog-title").html("
" + title + "");
setTimeout(function(){
if(typeof $('#custom_dialog_title').val() !=='undefined'){
title = $('#custom_dialog_title').val();
$('#dialog_title_bar').html(title);
// console.log(title);
// $('#' + container).siblings().find(".ui-dialog-title").html("
" + title + "");
}
}, 250);
$( "#closeBTN_" + container).click(function() {
try{ clearInterval(tempChartReloadTimer);plot.destroy();} catch (e) {}
var identifier = $('#identifier').val();
if (identifier === undefined) {
//return 'Undefined value!';
}else
{
$('#' + container).attr("identifier",identifier);
//console.log( $('#' + container).attr("identifier"));
switch(identifier) {
case 'payPalSubscriptionLastStep':
getTable('getSubscriptions');
break;
}
// $('#' + container).dialog({ close: alert( $('#dialogName').val()) } );
}
$('#' + container).dialog('close');
});
// onclick=$(" + '#dialog' + ").dialog('close');
if(fileName.indexOf("?")=="-1")
{
$('#' + container).load(fileName + "?container=" + container + '&rand=' + uniqueId());
}
else
{
$('#' + container).load(fileName + "&container=" + container + '&rand=' + uniqueId());
}
//$('#' + container).dialog({draggable: false, modal: true,maxHeight:500}).prev('.ui-dialog-titlebar');
if (typeof modal_title_bar_color == 'undefined')
{
modal_title_bar_color = '#00bcd4';
}
$('#' + container).dialog({draggable: false, modal: true,maxHeight:500}).prev('.ui-dialog-titlebar').css({'background':modal_title_bar_color});
$('#' + container).dialog( "moveToTop" );
//$('.containerxx').attr('style', 'width: 74px !important');
}
function uniqueId() { return new Date().getTime(); }
function resetFenceGenerator(){
$('#step_1').show();
$('#step_2').hide();
$('#round_fence_box').hide();
$('#step_3').hide();
$('#tracker').val('-1');
$('html, body').animate({ scrollTop: $('#step_1').offset().top}, 1000);
}
function instantFence(key, diameter){
if(key=='0')
{
alert('Bitte zunächst Fahrzeug auswählen (verfolgen).');
return;
}
try {
url = "../mobil/xml/xml_roundfence.php";
var abfrage = xml_request();
nachricht = "key="+key+"&diameter="+diameter;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
response = abfrage.responseXML.documentElement;
result_ff = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
//alert(result_ff);
if(result_ff == '-1')
{
toaster('2',message);
return result_ff;
}
if(result_ff == '0')
{
toaster('2',message);
return "0";
}
if(result_ff == '1')
{
toaster('1',message);
try {
resetFenceGenerator();
}catch(ec5){}
try {
dashboardFenceTable();
}catch(ec3){}
try {
update();
map.zoomTo(15);
}catch(ec4){}
}
}
}
} catch (e) {
//alert(e);
}
}
function enableFence(fence_id,fence_type, fence)
{
if(fence_id=='0')
{
alert('Bitte zunächst Zaun auswählen.');
return;
}
//document.getElementById('fence_dropdown').innerHTML = "
";
try {
url = "../mobil/xml/xml_enableFence.php";
var abfrage = xml_request();
nachricht = "fence_id="+fence_id+'&fence_type='+fence_type+'&fence='+fence;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
dashboardFenceTable();
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
}
function pauseFence(fence_id,fence_type,fence)
{
if(fence_id=='0')
{
alert('Bitte zunächst Zaun auswählen.');
return;
}
//document.getElementById('fence_dropdown').innerHTML = "
";
try {
url = "../mobil/xml/xml_pauseFence.php";
var abfrage = xml_request();
nachricht = "fence_id="+fence_id+'&fence_type='+fence_type+'&fence='+fence;
//alert(nachricht);
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
dashboardFenceTable();
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
}
function dashboardFenceTable(){
var xmlHttp = xml_request();
var dbft_result;
url = "../mobil/xml/dashboardFenceTable.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
var response = xmlHttp.responseXML.documentElement;
dbft_result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
fenceTable = response.getElementsByTagName('fenceTable')[0].firstChild.data;
if(dbft_result=='1')
{
setTimeout(function(){
//document.getElementById('alertCount').innerHTML = alertCount;
try{
document.getElementById('fenceTable').innerHTML = fenceTable;
contingent = response.getElementsByTagName('contingent')[0].firstChild.data;
document.getElementById('contingent').innerHTML = contingent;
}catch(e){ }
}, 500);
}
}
}
}
function engineStartStopAnalyzer(sortBy,order){
startDate = document.getElementById('startDate').value;
stopDate = document.getElementById('stopDate').value;
ign_filter = document.getElementById('filter_ignition_state').value;
devices = document.getElementById('devices').value;
filter_ignition_state_duration = document.getElementById('filter_ignition_state_duration').value;
var xmlHttp = xml_request();
url = "xml/engineStartStopAnalyzerOverview.php";
nachricht = "sortBy=" + sortBy + "&order=" + order + "&startDate=" + startDate + "&stopDate=" + stopDate + "&ign_filter=" + ign_filter + "&devices=" + devices + "&filter_ignition_state_duration=" + filter_ignition_state_duration;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
////console.log(xmlHttp.responseText);
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
engineStartStopTable = response.getElementsByTagName('engineStartStopTable')[0].firstChild.data;
ign_on = response.getElementsByTagName('ign_on')[0].firstChild.data;
ign_off = response.getElementsByTagName('ign_off')[0].firstChild.data;
days = response.getElementsByTagName('days')[0].firstChild.data;
sekunden_ign_on = response.getElementsByTagName('sekunden_ign_on')[0].firstChild.data;
sekunden_ign_off = response.getElementsByTagName('sekunden_ign_off')[0].firstChild.data;
sekunden_ign_on_total = response.getElementsByTagName('sekunden_ign_on_total')[0].firstChild.data;
progress = response.getElementsByTagName('progress')[0].firstChild.data;
$('#ign_on_total').html(sekunden_ign_on_total);
if(result=='1')
{
setTimeout(function(){
document.getElementById('engineStartStopTable').innerHTML = engineStartStopTable;
document.getElementById('ign_on').innerHTML = ign_on;
document.getElementById('ign_off').innerHTML = ign_off;
document.getElementById('progress').innerHTML = progress;
//$(function(){
// Morris.Donut({
// element: 'donut-example',
// data: [
// {label: "an in % in " + days + " Tagen", value: Math.round((sekunden_ign_on / (86400*days))*100)},
// {label: "aus in %", value: Math.round((sekunden_ign_off / (86400*days))*100)},
// ],
// colors: [Utility.getBrandColor('grape'), Utility.getBrandColor('inverse'), Utility.getBrandColor('green')]
// });
// });
}, 100);
}
}
}
}
function loadIgnCutResults(){
var xmlHttp = xml_request();
//loadRemoteCommandos
url = "../mobil/xml/loadIgnCutResult.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
commandTableIgnCutResults = response.getElementsByTagName('commandTableIgnCutResults')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
try
{
$('#ignCutCommandTable').html(commandTableIgnCutResults);
} catch (e) {
//alert('fehler');
}
//contingent = response.getElementsByTagName('contingent')[0].firstChild.data;
//document.getElementById('contingent').innerHTML = contingent;
}, 100);
}
}
}
}
function loadRemoteCommandos(){
var xmlHttp = xml_request();
//loadRemoteCommandos
url = "../mobil/xml/loadRemoteCommandos.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
commandTable = response.getElementsByTagName('commandTable')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
try
{
document.getElementById('commandTable').innerHTML = commandTable;
} catch (e) {
//alert('fehler');
}
//contingent = response.getElementsByTagName('contingent')[0].firstChild.data;
//document.getElementById('contingent').innerHTML = contingent;
}, 100);
}
}
}
}
function readRemoteResponse(){
try
{
url = "xml/readRemoteResponse.php";
message = "";
//alert(message);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
success = response.getElementsByTagName('success')[0].firstChild.data;
remote_id = response.getElementsByTagName('remote_id')[0].firstChild.data;
$('#countdown2').html(remote_id);
// alert(success);
if(success.toString()=='0')
{
return '0,' + remote_id.toString();
}
else
{
return '1'.toString();
}
}
}
} catch (e) {
//alert('fehler');
}
try{ abfrage.send(null); } catch (e) {}
}
function reset_command(id){
alert('reset id ' + id);
try
{
url = "xml/reset_command.php";
message = "id=" + encodeURIComponent(id);
//alert(message);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
success = response.getElementsByTagName('success')[0].firstChild.data;
$('#countdown2').html('reset');
if(success=='0')
{
return '0';
}
else
{
return '1';
}
}
}
} catch (e) {
}
try{ abfrage.send(null); } catch (e) {}
}
var command_retry = 0;
function store_command(label,command_value, key){
if(label =='console')
{
}
else
{
$('#send_remote_command_btn').addClass('disabled');
}
if(label=='extended_interval')
{
interval = document.getElementById('interval').value;
curve = document.getElementById('curve').value;
tracking_mode = document.getElementById('tracking_mode').value;
distance = document.getElementById('distance').value;
//alert('test erweitert, Funktion noch inaktiv: ' + tracking_mode + '|' + interval + '|' + curve + '|' + distance);
command_value = tracking_mode + '|' + interval + '|' + curve + '|' + distance;
}
else
{
//command_value = $('#setdigout_timeout').val();
}
timeout = $('#setdigout_timeout').val();
timeout2 = $('#setdigout2_timeout').val();
timeout3 = $('#setdigout3_timeout').val();
closeWindow = $('#closeWindow').val();
if(closeWindow=='')
{
closeWindow=1;
}
else
{
closeWindow = $('#closeWindow').val();
}
abfrage = new xml_request();
// key = document.getElementById('tracker').value;
try
{
url = "../mobil/xml/storeRemoteCommand.php";
message = "label=" + encodeURIComponent(label) + "&key=" + encodeURIComponent(key) + "&value=" + command_value + "&timeout=" + timeout + "&timeout2=" + timeout2 + "&timeout3=" + timeout3;
//alert(message);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
protocol = response.getElementsByTagName('protocol')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '0')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
/*
if(protocol=='FM11')
{
// remote_id = response.getElementsByTagName('remote_id')[0].firstChild.data;
//alert(remote_id);
var timeleft = 3;
var remote_response1;
var checkRemoteResponseCountdown = setInterval(function(){
timeleft -= 1;
if(timeleft <= 0){
// alert('Pruefe ' + remote_id);
// alert(readRemoteResponse().toString());
clearInterval(checkRemoteResponseCountdown);
remote_response1 = readRemoteResponse();
// console.log("remote_response1: " + remote_response1);
if(remote_response1!='1')
{
// alert(remote_response1);
remote_id2 = remote_response1.split(',')[1];
//alert(readRemoteResponse(remote_id));
//deleteRemoteCommands(remote_id);
// remote_id = response.getElementsByTagName('remote_id')[0].firstChild.data;
reset_command(remote_id2);
// alert('reset ' + remote_id2);
loadRemoteCommandos();
if(command_retry<=3)
{
var timeleft2 = 3;
var checkRemoteResponseCountdown2 = setInterval(function(){
timeleft2 -= 1;
if(timeleft2 <= 0){
clearInterval(checkRemoteResponseCountdown2);
deleteRemoteCommands(remote_id);
store_command(label,command_value, key);
if(readRemoteResponse(remote_id)=='0')
{
if(command_retry<=3)
{
command_retry += 1;
alert('Retry ' + command_retry);
}
}
}
}, 1000);
}
}
}
}, 1000);
} */
if(closeWindow==1)
{
$('#dialog').dialog('close');
}
$(function(){
$('.map-content').animate({scrollTop: $('#top').offset().top - 20 }, 'slow');
setTimeout(function(){
loadRemoteCommandos();
console.log('500');
refreshPageHeader();
}, 500);
setTimeout(function(){
loadRemoteCommandos();
console.log('2000');
refreshPageHeader();
}, 2000);
setTimeout(function(){
loadRemoteCommandos();
refreshPageHeader();
console.log('7000');
}, 7000);
setTimeout(function(){
loadRemoteCommandos();
refreshPageHeader();
console.log('15000');
}, 15000);
//return false;
});
}
}
}
} catch (e) {
}
try{ abfrage.send(null); } catch (e) {}
}
function addSomeTrackersToLiveRelease(){
var favorite = [];
$.each($("input[class~='addLiveReleaseTracker']:checked"), function(){
favorite.push(this.id);
});
//alert(favorite);
abfrage = new xml_request();
shareName = document.getElementById('shareName').value;
share_short_url = ($('#share_short_url').val() || "-1");
//document.getElementById('share_short_url').value;
try
{
url = "../mobil/xml/storeLiveRelease.php";
//nachricht = "devices="+devices+"&title="+encodeURIComponent('sdvsv');
message = "title=" + encodeURIComponent(shareName) + "&devices=" + favorite + "&share_short_url=" + share_short_url;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
// console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
url = response.getElementsByTagName('url')[0].firstChild.data;
url2 = response.getElementsByTagName('url2')[0].firstChild.data;
id = response.getElementsByTagName('id')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '0')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
$(function(){
//$('html, body').animate({
// scrollTop: $('#top').offset().top - 100
//}, 1000);
setTimeout(function(){
liveReleaseData('../mobil/share/share.php',('Freigabedaten abrufen'),id);
}, 2000);
return false;
});
getdeviceTableCheckboxes();
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function addEmailRecp(){
abfrage = new xml_request();
firstname = document.getElementById('firstname').value;
lastname = document.getElementById('lastname').value;
email = document.getElementById('email').value;
gender = document.getElementById('gender').value;
language = document.getElementById('language').value;
try
{
url = "../mobil/xml/addEmailRecp.php";
//nachricht = "devices="+devices+"&title="+encodeURIComponent('sdvsv');
message = "firstname=" + encodeURIComponent(firstname) + "&lastname=" + encodeURIComponent(lastname) +"&email=" + encodeURIComponent(email) +"&language=" + encodeURIComponent(language) +"&gender=" + encodeURIComponent(gender);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '0')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
$(function(){
$('html, body').animate({
scrollTop: $('#top').offset().top - 100
}, 1000);
setTimeout(function(){
//liveReleaseData('share/share.php',encodeURIComponent('Freigabedaten abrufen'),id);
}, 2000);
return false;
});
getAddressbookTable();
document.getElementById('firstname').value = '';
document.getElementById('lastname').value = '';
document.getElementById('email').value = '';
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function deleteRemoteCommands(id){
if(id=="")
{
return;
}
abfrage = new xml_request();
try
{
url = "xml/deleteRemoteCommands.php";
message = "id=" + id;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
loadRemoteCommandos();
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function getTrackLength(){
tracking_device = $('#trackDeviceNameDrDo').val();
tracking_device2 = encodeURIComponent(tracking_device);
startTrackDate = $('#startDate').val();
stopTrackDate = $('#stopDate').val();
startTrackTime = $('#startTime').val();
stopTrackTime = $('#stopTime').val();
startRange = startTrackDate + ' ' + startTrackTime;
stopRange = stopTrackDate + ' ' + stopTrackTime;
abfrage = new xml_request();
try
{
url = "system/frontend/trackingportal/mobil/xml/xml_getTrackLength.php";
message = "startDate=" + startRange + "&stopDate=" + stopRange + "&tracker=" + encodeURIComponent(tracking_device2);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(parseFloat(message)>0)
{
$('#dialog').dialog('close');
}
else
{
document.getElementById('result').innerHTML = 'Keine Punkte gefunden'+message;
setTimeout(function(){
document.getElementById('result').innerHTML = "";
$('#btn_request_track_lb').removeClass('disabled');
}, 5000);
}
}
}
} catch (e) {
}
try{ abfrage.send(null); } catch (e) {}
}
function markAlertsAsRead(){
var favorite = [];
$.each($("input[name='receivedAlerts']:checked"), function(){
favorite.push(this.id);
});
abfrage = new xml_request();
try
{
url = "../mobil/xml/xml_markAlertsAsRead.php";
message = "alertArray=" + favorite.join(",");
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
getReceivedAlerts();
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function get_timeranges(tr_id){
x = new xml_request();
if (x) {
u = 'xml/tr.php';
p = "tr_id="+tr_id;
x.open("POST", u, true);
x.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
x.send(p);
x.onreadystatechange = function() {
if (x.readyState == 4) {
//alert(x.responseText);
r = x.responseXML.documentElement;
var root = r.getElementsByTagName('hour_start');
for (i = 0; i < root.length; i++) { // line 1
$("#" + i + "_hour_start").val(root[i].childNodes[0].nodeValue);
}
var root1 = r.getElementsByTagName('minute_start');
for (i = 0; i < root1.length; i++) { // line 1
$("#" + i + "_minute_start").val(root1[i].childNodes[0].nodeValue);
}
var root2 = r.getElementsByTagName('hour_stop');
for (i = 0; i < root2.length; i++) { // line 1
$("#" + i + "_hour_stop").val(root2[i].childNodes[0].nodeValue);
}
var root3 = r.getElementsByTagName('minute_stop');
for (i = 0; i < root3.length; i++) { // line 1
$("#" + i + "_minute_stop").val(root3[i].childNodes[0].nodeValue);
}
}}}}
function new_timerange(){
try{
new_tr_name = $('#new_tr_name').val();
}catch(e)
{
new_tr_name = '-';
}
try{
tr_id = document.getElementById('tr_grp2').value;
}catch(e)
{
tr_id = '-1';
}
//alert($('#new_tr_name').val());
$("#btn_save_tr").prop('disabled', true);
var params="";
for (ix = 0; ix < 7; ix++) {
minutes_start = (parseInt($("#" + ix + "_hour_start").val())*60) + parseInt($("#" + ix + "_minute_start").val());
minutes_stop = (parseInt($("#" + ix + "_hour_stop").val())*60) + parseInt($("#" + ix + "_minute_stop").val());
range = minutes_stop - minutes_start;
if(range<0)
{
range = 1440 - ((minutes_stop - minutes_start)*-1);
}
add= "";
if(ix!=6)
{
add= ";";
}
else
{
add="";
}
params += "" +ix + "," + minutes_start + "," + range + add;
}
//alert("params=" + params);
abfrage = new xml_request();
try
{
url = "xml/xml_new_timerange.php";
message = "params=" + params + "&tr_grp=" + tr_id + "&new_tr_name=" + new_tr_name;
// alert(message);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
try{
tr_grp = response.getElementsByTagName('tr_grp')[0].firstChild.data;
}catch(e2){
tr_grp = 0;
}
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
//getAlertRules();
get_timeranges(tr_grp);
$('#navBarAssist').show();
document.getElementById('resultTextCreateTimerange').innerHTML = message;
// document.getElementById('result_tr_save_button').innerHTML = "
";
setTimeout(function(){
$('#resultTextCreateTimerange').html("Bitte warten");
}, 1000);
setTimeout(function(){
$('#resultTextCreateTimerange').html("");
//document.getElementById('resultTextCreateTimerange').innerHTML = "";
get_ranges(tr_grp);
//document.getElementById('result_tr_save_button').innerHTML = "";
}, 1500);
setTimeout(function(){
if($('#closeDialogWindow').val()==="true")
{
try{$('#dialog').dialog('close');}catch(e){ }
}
else
{
$('#output_tr_edit').empty();$('#output_tr_edit').hide();$('#tr_step').show();
getTable('timerangeGroups','id','DESC');
$('#tr_grp2').val(tr_grp);
}
},250);
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
}
try{ abfrage.send(null); } catch (e) {}
setTimeout(function(){
$("#btn_save_tr").prop('disabled', false)
}, 3000);
}
function store_timeranges(){
tr_id = document.getElementById('tr_grp2').value;
$("#btn_save_tr").prop('disabled', true);
var params="";
for (ix = 0; ix < 7; ix++) {
minutes_start = (parseInt($("#" + ix + "_hour_start").val())*60) + parseInt($("#" + ix + "_minute_start").val());
minutes_stop = (parseInt($("#" + ix + "_hour_stop").val())*60) + parseInt($("#" + ix + "_minute_stop").val());
range = minutes_stop - minutes_start;
if(range<0)
{
range = 1440 - ((minutes_stop - minutes_start)*-1);
}
add= "";
if(ix!=6)
{
add= ";";
}
else
{
add="";
}
params += "" +ix + "," + minutes_start + "," + range + add;
}
//alert("params=" + params);
abfrage = new xml_request();
try
{
url = "xml/xml_save_timerange.php";
message = "params=" + params + "&tr_grp=" + tr_id;
// alert(message);
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
//toaster('2',message);
}
if(result == '1')
{
//toaster('1',message);
//getAlertRules();
get_timeranges(tr_id);
document.getElementById('resultText').innerHTML = message;
document.getElementById('result_tr_save_button').innerHTML = "
";
setTimeout(function(){
document.getElementById('resultText').innerHTML = "Bitte warten";
}, 1000);
setTimeout(function(){
document.getElementById('resultText').innerHTML = "";
get_ranges(tr_id);
document.getElementById('result_tr_save_button').innerHTML = "";
}, 1500);
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
}
try{ abfrage.send(null); } catch (e) {}
setTimeout(function(){
$("#btn_save_tr").prop('disabled', false)
}, 3000);
}
function move_fence_to_grp(){
var favorite = [];
$.each($("input[class='editFenceGroupCheckbox']:checked"), function(){
favorite.push(this.id);
});
dropdown_fence_groups = document.getElementById('dropdown_fence_groups').value;
//interval = document.getElementById('dropdown_interval').value;
alert(favorite + ' to group ' + dropdown_fence_groups);
return;
abfrage = new xml_request();
try
{
url = "xml/xml_changeInterval.php";
message = "trackDeviceName=" + tracker + "&interval=" + interval + "&alertArray=" + favorite.join(",");
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
getAlertRules();
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function editAlertsCheckbox(mode){
if(mode==1)
{
jq_modal('actions/change_alert_settings_all_devices.php','Alarm-Einstellungen (alle Geräte)','dialog',0,0);
}else
{
var favorite = [];
$.each($("input[class~='editAlertsCheckbox']:checked"), function(){
favorite.push(this.id);
});
tracker = document.getElementById('trackDeviceName').value;
interval = document.getElementById('dropdown_interval').value;
abfrage = new xml_request();
try
{
url = "../mobil/xml/xml_changeInterval.php";
message = "trackDeviceName=" + tracker + "&interval=" + interval + "&alertArray=" + favorite.join(",");
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
getAlertRules();
$('#checkAll').iCheck('uncheck');
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function checkAllBoxes(class_state,class_name){
if(class_state==1)
{
$.each($("input[class~='" + class_name + "']"), function(){
this.checked = true;
});
}else
{
$.each($("input[class~='" + class_name + "']"), function(){
this.checked = false;
});
}
}
function checkAllShares(){
var favorite = [];
$.each($("input[class='editLiveReleaseCheckBoxes']:checked"), function(){
favorite.push(this.id);
});
if(favorite.length==0){
document.getElementById('checkAllShares').checked = false;
}
}
function checkAllDevices(){
var favorite = [];
$.each($("input[class='addLiveReleaseTracker']:checked"), function(){
favorite.push(this.id);
});
if(favorite.length==0){
document.getElementById('checkAllDevices').checked = false;
}
}
function bulkAdressbook(state){
document.getElementById('checkAllRecp').checked = false;
dropdown_liveReleaseCheckBoxes = document.getElementById('dropdown_action_addressbook').value;
var favorite = [];
$.each($("input[class~='addressbookRecp']:checked"), function(){
favorite.push(this.id);
});
if(favorite=='')
{
//alert('leer');
return;
}
toggleAddressbookEntry(favorite,dropdown_liveReleaseCheckBoxes);
}
function checkBoxes(state){
dropdown_liveReleaseCheckBoxes = document.getElementById('dropdown_liveReleaseCheckBoxes').value;
var favorite = [];
$.each($("input[class~='editLiveReleaseCheckBoxes']:checked"), function(){
favorite.push(this.id);
});
if(favorite=='')
{
//alert('leer');
return;
}
toggleliveRelease(favorite,dropdown_liveReleaseCheckBoxes);
}
function toggleliveRelease(release_id,state){
abfrage = new xml_request();
try
{
url = "../mobil/xml/toggleliveRelease.php";
message = "release_id=" + release_id + "&state=" + state;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
//alert(message);
if (abfrage.readyState == 4) {
// //console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
getdeviceTableCheckboxes();
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function toggleAddressbookEntry(entry_id,state){
//alert(entry_id + ' - ' + state);
abfrage = new xml_request();
try
{
url = "../mobil/xml/toggleAddressbookEntry.php";
message = "entry_id=" + entry_id + "&state=" + state;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
//alert(message);
if (abfrage.readyState == 4) {
console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '0')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
getAddressbookTable();
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
function toggleAlert(fence_id,state){
tracker = document.getElementById('trackDeviceName').value;
abfrage = new xml_request();
try
{
url = "../mobil/xml/xml_toggleAlertActivity.php";
message = "trackDeviceName=" + tracker + "&interval=" + state + "&fence_id=" + fence_id;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
//alert(message);
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
getAlertRules();
}
if(abfrage.responseText == '0')
{
}
}
}
} catch (e) {
//alert(e);
}
try{ abfrage.send(null); } catch (e) {}
//alert("Tracker: " + tracker + '/' + favorite.join(",") + ', Interval: ' + interval);
}
//addressbookTable
function getAddressbookTable(){
//document.getElementById('addressbookRecp').checked = false;
//document.getElementById('checkAllShares').checked = false;
abfrage = new xml_request();
try
{
url = "../mobil/xml/getAddressbookTable.php";
message = "";
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
abfrage.onreadystatechange=function()
{
if (abfrage.readyState==4 && abfrage.status==200)
{
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
addressbookTable = response.getElementsByTagName('addressbookTable')[0].firstChild.data;
//shareTable = response.getElementsByTagName('shareTable')[0].firstChild.data;
contingent = response.getElementsByTagName('contingent')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
document.getElementById('addressbookTable').innerHTML = addressbookTable;
//document.getElementById('shareTable').innerHTML = shareTable;
document.getElementById('contingent').innerHTML = contingent;
}, 100);
}
}
}
}
} catch (e) {}
try{
abfrage.send(null);
} catch (e) {
}
}
function getdeviceTableCheckboxes(){
document.getElementById('checkAllDevices').checked = false;
document.getElementById('checkAllShares').checked = false;
abfrage = new xml_request();
try
{
url = "../mobil/xml/deviceTable.php";
message = "";
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(message);
abfrage.onreadystatechange = function() {
abfrage.onreadystatechange=function()
{
if (abfrage.readyState==4 && abfrage.status==200)
{
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
deviceTable = response.getElementsByTagName('deviceTable')[0].firstChild.data;
shareTable = response.getElementsByTagName('shareTable')[0].firstChild.data;
contingent = response.getElementsByTagName('contingent')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
document.getElementById('deviceTable').innerHTML = deviceTable;
document.getElementById('shareTable').innerHTML = shareTable;
document.getElementById('contingent').innerHTML = contingent;
}, 100);
}
}
}
}
} catch (e) {}
try{
abfrage.send(null);
} catch (e) {
}
}
function getAlertRules()
{
//document.getElementById('result').innerHTML = '';
trackDeviceName = document.getElementById('trackDeviceName').value;
abfrage = new xml_request();
try
{
url = "../mobil/xml/xml_getAlertRules.php";
nachricht = "trackDeviceName=" + trackDeviceName;
abfrage.open("POST", url, true);
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht);
abfrage.onreadystatechange = function() {
abfrage.onreadystatechange=function()
{
if (abfrage.readyState==4 && abfrage.status==200)
{
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
objectData = response.getElementsByTagName('objectData')[0].firstChild.data;
editAlertTable = response.getElementsByTagName('editAlertTable')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
//document.getElementById('alertCount').innerHTML = alertCount;
document.getElementById('editAlertTable').innerHTML = editAlertTable;
document.getElementById('objectData').innerHTML = objectData;
try{ $('.scrollbar-outer').scrollbars();} catch (e) {}
}, 100);
}
}
}
}
} catch (e) {
//alert(e);
}
try{
abfrage.send(null);
} catch (e) {
}
//alert(dateRange + ',' + startTime + ',' + stopTime);
}
function daily_export(key, state){
// alert(veh + '/' + filename);
var xmlHttp = xml_request();
url = "../mobil/xml/xml_daily_export.php";
nachricht = "key=" + key + "&value=" + state;
//alert(nachricht);
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '0')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
setTimeout(function(){
refreshVehicleDailyReportTable();
},250);
}
if(xmlHttp.responseText == '0')
{
}
}
}
}
function refreshVehicleDailyReportTable(){
var xmlHttp = xml_request();
url = "../mobil/xml/vehicleDailyReport.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
vehicleDailyReport = response.getElementsByTagName('vehicleTable')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
document.getElementById('vehicleDailyReportTable').innerHTML = vehicleDailyReport;
}, 100);
}
}
}
}
function getIcon(filename){
var veh;
try{
veh = document.getElementById('dropdown_vehicles_f_icon').value;
} catch(e){
veh = document.getElementById('icon_hidden').value;
}
// alert(veh + '/' + filename);
var xmlHttp = xml_request();
url = "../mobil/xml/xml_changeIcon.php";
nachricht = "key=" + veh + "&value=" + filename;
//alert(nachricht);
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
//console.log(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '0')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
setTimeout(function(){
//document.getElementById('circle_'+id).innerHTML = '';
//document.getElementById('newName_'+id).value = '';
//document.getElementById('object_'+id).innerHTML = newName;
dashboardVehicleTable();
//alert(newName);
},250);
}
if(xmlHttp.responseText == '0')
{
}
}
}
}
function toggleFahrtenbuchEintrag(id){
state = (document.getElementById('purpose_' + id).value);
if((state=='2') || (state=='3'))
{
document.getElementById('reason_' + id).style.borderColor = "";
document.getElementById('reason_' + id).disabled = true;
document.getElementById('ziel_' + id).style.borderColor = "";
document.getElementById('ziel_' + id).disabled = true;
document.getElementById('ansprechpartner_' + id).style.borderColor = "";
document.getElementById('ansprechpartner_' + id).disabled = true;
}
if((state=='1') || (state=='-1'))
{
document.getElementById('reason_' + id).style.borderColor = "";
document.getElementById('reason_' + id).disabled = false;
document.getElementById('ziel_' + id).style.borderColor = "";
document.getElementById('ziel_' + id).disabled = false;
document.getElementById('ansprechpartner_' + id).style.borderColor = "";
document.getElementById('ansprechpartner_' + id).disabled = false;
}
}
function fahrtenbuch(filter){
//document.getElementById('cirlce_request').innerHTML = '
';
var xmlHttp = xml_request();
key = document.getElementById('trackDeviceName').value;
url = "xml/fahrtenbuch.php";
nachricht = "key=" + key + "&filter=" + filter;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
//alert(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
responseA = xmlHttp.responseXML.documentElement;
resultA = responseA.getElementsByTagName('state')[0].firstChild.data;
message = responseA.getElementsByTagName('message')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
fahrtenbuchTabelle = responseA.getElementsByTagName('fahrtenbuch')[0].firstChild.data;
if(resultA=='1')
{
setTimeout(function(){
//document.getElementById('alertCount').innerHTML = alertCount;
document.getElementById('fahrtenbuch').innerHTML = fahrtenbuchTabelle;
unconfirmed = responseA.getElementsByTagName('unconfirmed')[0].firstChild.data;
urgent = responseA.getElementsByTagName('urgent')[0].firstChild.data;
if(unconfirmed>0)
{
document.getElementById('unconfirmed').innerHTML = ' ';
}
else
{
document.getElementById('unconfirmed').innerHTML = unconfirmed;
}
}, 100);
}
else
{
document.getElementById('result_fahrtenbuch').innerHTML = message;
toaster('0',message);
}
}
}
setTimeout(function(){
document.getElementById('cirlce_request').innerHTML = '';
}, 1000);
}
function editFahrtenbuch(id){
ziel = document.getElementById('ziel_' + id).value;
ansprechpartner = document.getElementById('ansprechpartner_' + id).value;
reason = document.getElementById('reason_' + id).value;
document.getElementById('circle_'+id).innerHTML = '
';
purpose = document.getElementById('purpose_' + id).value;
if(reason=='') {
document.getElementById('reason_' + id).style.borderColor = "red";
}
else
{
document.getElementById('reason_' + id).style.borderColor = "";
}
if(ziel=='') {
document.getElementById('ziel_' + id).style.borderColor = "red";
}
else
{
document.getElementById('ziel_' + id).style.borderColor = "";
}
if(ansprechpartner=='') {
document.getElementById('ansprechpartner_' + id).style.borderColor = "red";
}
else
{
document.getElementById('ansprechpartner_' + id).style.borderColor = "";
}
var xmlHttp = xml_request();
url = "xml/editFahrtenbuch.php";
nachricht = "id=" + id + "&ziel=" + encodeURIComponent(ziel) + "&ansprechpartner=" + encodeURIComponent(ansprechpartner) + "&purpose=" + purpose + "&reason=" + encodeURIComponent(reason);
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
// alert(xmlHttp.responseText);
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('success')[0].firstChild.data;
errorMessage = response.getElementsByTagName('errorMessage')[0].firstChild.data;
//alert(result);
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
//alertTable = response.getElementsByTagName('alertTable')[0].firstChild.data;
setTimeout(function(){
document.getElementById('circle_'+id).innerHTML = '';
}, 1100);
if(result == '-1')
{
toaster('2',errorMessage);
}
if(result=='1')
{
toaster('1',errorMessage);
setTimeout(function(){
fahrtenbuch();
}, 100);
}
if(result=='0')
{
toaster('0',errorMessage);
setTimeout(function(){
}, 100);
}
}
}
}
function formatAMPM() {
var date = new Date();
var hours = date.getHours();
var days = date.getDay();
var minutes = date.getMinutes();
var ms = date.getMilliseconds();
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = date + ' ' + hours + ':' + minutes + ' ' + ms;
var date = new Date();
var n = date.toDateString();
var time = date.toLocaleTimeString();
return time + '.' + ms;
}
function showOnMap(id, old, subKey, task)
{
query_change_vehicleName = new xml_request();
try
{
url_change_vehicleName = "../mobil/xml/xmlToggleMap.php";
content_change_vehicleName = "key=" + encodeURIComponent(subKey) + '&task='+task;
query_change_vehicleName.open("POST", url_change_vehicleName, true);
query_change_vehicleName.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
query_change_vehicleName.send(content_change_vehicleName);
query_change_vehicleName.onreadystatechange = function() {
if (query_change_vehicleName.readyState == 4) {
//alert(query_change_vehicleName.responseText);
response = query_change_vehicleName.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
errorMessage = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '3')
{
toaster('2',errorMessage);
}
if(result=='1')
{
setTimeout(function(){
toggleDevicesOnTreemenu(id, old);
update();
}, 250);
}
}
}
} catch (e) {
// alert(e);
}
try{
query_change_vehicleName.send(null);
} catch (e) {
}
//top.frames[2].updateListBox(0);
//
}
function getLatestCoordinate(key) {
return new Promise((resolve, reject) => {
var xmlHttp = new XMLHttpRequest();
var url = "../mobil/xml/zoomToTracker.php";
var nachricht = "key=" + key;
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var response = xmlHttp.responseXML.documentElement;
var result = response.getElementsByTagName('state')[0].firstChild.data;
if (result == '1') {
var last_coord_lat = response.getElementsByTagName('last_coord_lat')[0].firstChild.data;
var last_coord_lng = response.getElementsByTagName('last_coord_lng')[0].firstChild.data;
resolve({ lat: last_coord_lat, lng: last_coord_lng });
} else {
//reject("Kein gültiges Ergebnis");
}
} else {
//reject("Fehler beim Abrufen der Daten");
}
}
};
});
}
function zoomToTracker(key){
var xmlHttp = xml_request();
url = "../mobil/xml/zoomToTracker.php";
nachricht = "key=" + key;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alert(result);
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
//alertTable = response.getElementsByTagName('alertTable')[0].firstChild.data;
if(result=='1')
{
last_coord_lat = response.getElementsByTagName('last_coord_lat')[0].firstChild.data;
last_coord_lng = response.getElementsByTagName('last_coord_lng')[0].firstChild.data;
var lonLat=new OpenLayers.LonLat(last_coord_lng, last_coord_lat).transform(map.displayProjection, map.getProjectionObject());
//showOnMap(key,'1');
setTimeout(function(){
//document.getElementById('alertCount').innerHTML = alertCount;
//document.getElementById('alertTable').innerHTML = alertTable;
map.setCenter(lonLat,16);
}, 300);
}
followDevice(0,0,0,0,0);
}
}
}
function tempFenceTable(){
var xmlHttp = xml_request();
url = "../mobil/xml/xmlTempFenceTable.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
TempFenceTable = response.getElementsByTagName('TempFenceTable')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
//document.getElementById('alertCount').innerHTML = alertCount;
document.getElementById('TempFenceTable').innerHTML = TempFenceTable;
}, 100);
}
}
}
}
function dashboardVehicleTable(){
var vehicle_grp_id = '*';
try{
vehicle_grp_id = document.getElementById('dropdown_group_filter').value;
}catch(e){
}
var xmlHttp = xml_request();
url = "../mobil/xml/vehicleTable.php";
nachricht = "vehicle_grp_id=" + vehicle_grp_id;
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
try{
vehicleTable = response.getElementsByTagName('vehicleTable')[0].firstChild.data;
}catch(e){
}
// alert(vehicleTable);
if(result=='1')
{
setTimeout(function(){
//document.getElementById('alertCount').innerHTML = alertCount;
try{
document.getElementById('vehicleTable').innerHTML = vehicleTable;
}catch(e){
}
}, 100);
}
}
}
}
function changeName(id,key){
newName = document.getElementById('newName_'+id).value;
document.getElementById('circle_'+id).innerHTML = '
';
setTimeout(function(){
document.getElementById('circle_'+id).innerHTML = '';
//alert(newName);
},1500);
//return;
var abfrage = xml_request();
url = "../mobil/xml/changeVehicleName.php";
nachricht = "key="+key+"&value="+newName;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht);
abfrage.onreadystatechange=function()
{
if (abfrage.readyState==4 && abfrage.status==200)
{
if (abfrage.readyState == 4) {
//console.log(abfrage.responseText);
response = abfrage.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
message = response.getElementsByTagName('message')[0].firstChild.data;
if(result == '-1')
{
toaster('2',message);
}
if(result == '0')
{
toaster('2',message);
}
if(result == '1')
{
toaster('1',message);
setTimeout(function(){
document.getElementById('circle_'+id).innerHTML = '';
document.getElementById('newName_'+id).value = '';
document.getElementById('object_'+id).innerHTML = newName;
//alert(newName);
},1500);
}
if(abfrage.responseText == '0')
{
}
}
}
}
//document.getElementById('circle').innerHTML = "";
// document.getElementById('button').style.visibility = 'hidden';
}
function dashboardAlertTable(){
var xmlHttp = xml_request();
url = "xml/dashboardAlertTable.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
alertTable = response.getElementsByTagName('alertTable')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
//document.getElementById('alertCount').innerHTML = alertCount;
document.getElementById('editAlertTable').innerHTML = alertTable;
}, 100);
}
}
}
}
function getReceivedAlerts(){
var xmlHttp = xml_request();
url = "../mobil/xml/getReceivedAlerts.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
receivedAlerts = response.getElementsByTagName('receivedAlerts')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
//document.getElementById('alertCount').innerHTML = alertCount;
document.getElementById('receivedAlerts').innerHTML = receivedAlerts;
}, 100);
}
}
}
}
function refreshPageHeader(){
var xmlHttp = xml_request();
url = "xml/refreshPageHeader.php";
nachricht = "";
xmlHttp.open("POST", url, true); // set the request
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.send(nachricht);
xmlHttp.onreadystatechange=function()
{
if (xmlHttp.readyState==4 && xmlHttp.status==200)
{
response = xmlHttp.responseXML.documentElement;
result = response.getElementsByTagName('state')[0].firstChild.data;
//messageCount = response.getElementsByTagName('messageCount')[0].firstChild.data;
//messageContent = response.getElementsByTagName('messageContent')[0].firstChild.data;
alertCount = response.getElementsByTagName('alertCount')[0].firstChild.data;
alertContent = response.getElementsByTagName('alertContent')[0].firstChild.data;
has_sos = response.getElementsByTagName('has_sos')[0].firstChild.data;
try{
has_wake = response.getElementsByTagName('has_wake')[0].firstChild.data;
has_wake_id = response.getElementsByTagName('has_wake_id')[0].firstChild.data;
if(has_wake>0)
{
sound_allowed = response.getElementsByTagName('sound_allowed')[0].firstChild.data;
setTimeout(function(){
if(sound_allowed==1)
{
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', '../../sounds/TK5000_Tracker_aufgewacht.ogg');
audioElement.setAttribute('autoplay', 'autoplay');
audioElement.play();
}
}, 3500);
stickyToaster('2','Ihr Tracker ist aufgewacht. Um diese Meldung auszublenden und den abgespielten Ton zu deaktivieren klicken Sie einfach auf dieses Fenster. ' , has_wake_id, 'wake');
}
}catch(e){
//console.log(e);
}
if(has_sos>0)
{
has_sos_id = response.getElementsByTagName('has_sos_id')[0].firstChild.data;
has_sos_dt = response.getElementsByTagName('has_sos_dt')[0].firstChild.data;
has_sos_sound = response.getElementsByTagName('has_sos_sound')[0].firstChild.data;
stickyToaster('2','SOS: ' + has_sos_dt, has_sos_id, 'sos');
if(has_sos_sound==1)
{
sound_allowed = response.getElementsByTagName('sound_allowed')[0].firstChild.data;
if(sound_allowed==1)
{
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', '../../sounds/alien_siren.ogg');
audioElement.setAttribute('autoplay', 'autoplay');
audioElement.play();
}
}
}
try{
activated = response.getElementsByTagName('activated')[0].firstChild.data;
if(activated =="0")
{
try{
if ($('#activation_dialog').dialog('isOpen') === true) {
// alert('open');
} else {
// $( "body" ).append('Ihr Zugang wurde noch nicht von Ihnen aktiviert.
');
jq_modal('actions/not_activated.php','Keine Aktivierung', 'activation_dialog', 0, 0);
}
}catch(exs_activated){
// $( "body" ).append('
Ihr Zugang wurde noch nicht von Ihnen aktiviert.
');
jq_modal('actions/not_activated.php','Keine Aktivierung', 'activation_dialog', 0, 0);
}
}
else
{
$( "#activation_dialog" ).dialog( "close" );
// $( "#no_act").remove();
}
}catch(ex_activated){
// $( "#no_act").remove();
}
try{
addressbookId = response.getElementsByTagName('addressbookId')[0].firstChild.data;
addressbookState = response.getElementsByTagName('addressbookState')[0].firstChild.data;
addressbookMessage = response.getElementsByTagName('addressbookMessage')[0].firstChild.data;
if(addressbookState==0)
{
stickyToaster('1',addressbookMessage, addressbookId, 'addressbook');
}
if(addressbookState==1)
{
stickyToaster('2',addressbookMessage, addressbookId, 'addressbook');
}
getAddressbookTable();
}catch(e){
////console.log(e.toString());
}
try{
remote_id = response.getElementsByTagName('remote_id')[0].firstChild.data;
remote_state = response.getElementsByTagName('remote_state')[0].firstChild.data;
remote_message = response.getElementsByTagName('remote_message')[0].firstChild.data;
remote_sound = response.getElementsByTagName('remote_sound')[0].firstChild.data;
if(remote_state==1)
{
stickyToaster('1',remote_message, remote_id, 'remote');
if(remote_sound==0)
{
var audio = new Audio('../../sounds/de/GPS-Fernkonfiguration-erfolgreich.ogg');
audio.play();
markSound(remote_id,'remote');
try{
setTimeout(function(){
loadRemoteCommandos();
}, 500);
} catch(e){
////console.log(e.toString());
}
}
}
if(remote_state==0)
{
stickyToaster('2',remote_message, remote_id, 'remote');
if(remote_sound==0)
{
var audio = new Audio('../../sounds/de/GPS-Fernkonfiguration-fehlgeschlagen.ogg');
audio.play();
markSound(remote_id,'remote');
try{
setTimeout(function(){
loadRemoteCommandos();
}, 500);
} catch(e){
////console.log(e.toString());
}
}
}
}catch(e){
////console.log(e.toString());
}
//deviceCount = response.getElementsByTagName('deviceCount')[0].firstChild.data;
//deviceContent = response.getElementsByTagName('deviceContent')[0].firstChild.data;
if(result=='1')
{
setTimeout(function(){
//document.getElementById('messageContent').innerHTML = messageContent;
//document.getElementById('alertContent').innerHTML = alertContent;
document.getElementById('alertCount').innerHTML = alertCount;
//document.getElementById('deviceCount').innerHTML = deviceCount;
//document.getElementById('deviceContent').innerHTML = deviceContent;
}, 100);
}
}
}
}
function followDevice(imei,lon,lat,toZoom,key){
// loading('1');
try{
if(key == '0')
{
map.removeLayer(newLineLayer);
}
else
{
map.addLayer(newLineLayer);
setTimeout(function(){
//newLineLayer.refresh({ force: true, params: { 'key': Math.random()} });
update();
setInfoFrame(key);
}, 1100);
}
}catch(x1){
}
var lonLat=new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject());
if (window.XMLHttpRequest) {
request = new XMLHttpRequest(); // Mozilla, Safari, Opera
} else if (window.ActiveXObject) {
try {
request = new ActiveXObject('Msxml2.XMLHTTP'); // IE 5
} catch (e) {
try {
request = new ActiveXObject('Microsoft.XMLHTTP'); // IE 6
} catch (e) {}
}
}
if (!request) {
alert('Kann keine XMLHTTP-Instanz erzeugen');
alert('fehler');
return false;
} else {
var url = '../mobil/xml/xml_setSession.php';
request.open('post', url, true);
request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
//alert(key);
request.send('imei='+imei+'&task=0&key='+key);
request.onreadystatechange = function(){
if (request.readyState == 4) {
var content = request.responseText;
//console.log(content);
if(request.responseText == '123456')
{
permission(0);
}
else
{
if(key==0)
{
}
}
}
}
}
setTimeout(function(){
update();
}, 200);
// update();
}
function update() {
try{
marker_array =[];
if((socket.readyState==1) && (wss==1))
{
console.log("socket.readyState: " + socket.readyState + " / wss: " + wss);
console.log('update timer wird nicht ausgeführt');
return;
}
}catch(e){
}
//$('.tooltip_background').hide();
//$('#infoFrame_2').html('test');
markerLayer.request(markerLayer.location); //xml-realtime
track.request(track.location); //points.php
// kmllayer.refresh({ force: true, params: { 'key': Math.random()} });
try
{
newLineLayer.refresh({ force: true, params: { 'key': Math.random()} });
}
catch(e)
{
}
//getTable('infoFrame');
//data_lines.request(data_lines.location);
//followLayer.request(followLayer.location);
//data_lines.request(data_lines.location);
//lon = map.getCenter().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326")).lon;
//lat = map.getCenter().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326")).lat;
xyz = new Date().toLocaleString();
//console.log("Map updated: " + xyz);
//extent();
////console.log("NewLineLayer1: " + newLineLayer);
//kmllayer.refresh({ force: true, params: { 'key': Math.random()} });
extender = map.getExtent().transform(map.getProjectionObject(),map.displayProjection);
//alert(extender) ;
// document.getElementById('bbox').value = extender.left;
//$('#bbox').prop('value',extender);
////console.log(extender.left);
//document.cookie = "bbox=" + extender + "; expires=Thu, 18 Dec 2012 12:00:00 UTC; path=/";
document.cookie = "bbox=" + extender + "; expires=Thu, 18 Dec 2025 12:00:00 UTC; path=/";
document.cookie = "zoom=" + map.getZoom() + "; expires=Thu, 18 Dec 2025 12:00:00 UTC; path=/";
// modal_title_bar_color = '#FF9600';
// $('.tooltip_background').css("border","2px dashed #ff6f00 !important");
// console.log("Extender: " + extender);
}
function createHtml(container, task){
document.getElementById('fence_dropdown').innerHTML = "

";
try {
url = "../data/xml/createHtml.php";
var abfrage = xml_request();
nachricht = "task="+task;
abfrage.open("POST", url, true); // set the request
abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
abfrage.send(nachricht); // calls the send() method with datas as parameter
abfrage.onreadystatechange = function() {
if (abfrage.readyState == 4) {
//alert(abfrage.responseText);
//update();
if(abfrage.responseText == '123456')
{
alert('Keine ausreichenden Rechte.');
}
else
{
setTimeout(function(){
document.getElementById(container).innerHTML = abfrage.responseText;
update();
}, 1500);
}
}
}
} catch (e) {
//alert(e);
}
}