From: Kilian Saffran Date: Tue, 2 Apr 2019 08:30:15 +0000 (+0200) Subject: creorga web modification X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=02e9a732a9ecfe4f3e760f0fb78e34c2a46aee2a;p=apps_dks_lu.git creorga web modification --- diff --git a/api/prefs.cgi b/api/prefs.cgi index 262ddf9..d6bff9e 100644 --- a/api/prefs.cgi +++ b/api/prefs.cgi @@ -36,24 +36,38 @@ if (exists($p->{get}) ){ } } if (exists($p->{set}) && (exists($p->{page}))){ - my $nd = JSON::PP::decode_json($p->{set}); - if (-e $datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'){ - my $strget = ""; - open(CFG,$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'); - while (my $l = ){ - $strget .= $l; + if ($p->{set} ne ""){ + my $nd = JSON::PP::decode_json($p->{set}); + if (-e $datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'){ + my $strget = ""; + open(CFG,$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'); + while (my $l = ){ + $strget .= $l; + } + close(CFG); + if (($strget =~ /^{/) && ($strget =~ /}$/)){ + $html = JSON::PP::decode_json($strget); + } } - close(CFG); - if (($strget =~ /^{/) && ($strget =~ /}$/)){ - $html = JSON::PP::decode_json($strget); - } + foreach my $k (keys(%{$nd})){ + $html->{$k} = $nd->{$k}; + } + # if (keys(%{$html}) == 0){ + # unlink($datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'); + # } else { + # open(CFG,">".$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'); + # print CFG JSON::PP::encode_json($html); + # close(CFG); + # } + open(CFG,">".$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'); + print CFG JSON::PP::encode_json($html); + close(CFG); } - foreach my $k (keys(%{$nd})){ - $html->{$k} = $nd->{$k}; + else { + if (-e $datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'){ + unlink($datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'); + } } - open(CFG,">".$datapath.'/user/'.$ENV{REMOTE_USER}.'.'.$p->{page}.'.json'); - print CFG JSON::PP::encode_json($html); - close(CFG); $html= (); $html->{result} = 1; } diff --git a/api/sqlite.cgi b/api/sqlite.cgi index 6de18f4..5896331 100644 --- a/api/sqlite.cgi +++ b/api/sqlite.cgi @@ -90,7 +90,7 @@ sub dbquerysorted(){ while(my $data = $sth->fetchrow_hashref()) { foreach my $k (keys %{$data}){ - $retdata->{$count}->{$k} = decode( "utf8", $data->{$k}); + $retdata->{$count}->{$k} = (($data->{$k} eq "")?'':decode( "utf8", $data->{$k})); } $count++; } diff --git a/apps/creorga/css/creorga.css b/apps/creorga/css/creorga.css index e98027f..7de57d4 100644 --- a/apps/creorga/css/creorga.css +++ b/apps/creorga/css/creorga.css @@ -270,4 +270,16 @@ input[type="date"]::-webkit-inner-spin-button, input[type="date"]::-webkit-calendar-picker-indicator { display: none; -webkit-appearance: none; -} \ No newline at end of file +} + +input[type="month"]::-webkit-inner-spin-button, +input[type="month"]::-webkit-calendar-picker-indicator { + display: none; + -webkit-appearance: none; +} + +// ::-webkit-datetime-edit-year-field:not([aria-valuenow]), +// ::-webkit-datetime-edit-month-field:not([aria-valuenow]), +// ::-webkit-datetime-edit-day-field:not([aria-valuenow]) { +// color: transparent; +// } \ No newline at end of file diff --git a/apps/creorga/js/app.js b/apps/creorga/js/app.js index 0bc93ef..8184b43 100644 --- a/apps/creorga/js/app.js +++ b/apps/creorga/js/app.js @@ -44,11 +44,35 @@ document.addEventListener("keydown", function(e) { return false; } + var app = { url: location.protocol + '//' + location.host + '/apps_dks_lu/apps/creorga/', api: location.protocol + '//' + location.host + '/apps_dks_lu/api/', - currentdb: null, - info: null, + browser: function(){ + console.log(navigator.userAgent); + var brx = "unknown"; + if (/Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)){ + brx = "Safari"; + } + if (/Chrome/.test(navigator.userAgent)){ + brx ="Chrome"; + } + if (/Edge/.test(navigator.userAgent)){ + brx ="Edge"; + } + if (/Firefox/.test(navigator.userAgent)){ + brx ="Firefox"; + } + if (/OPR/.test(navigator.userAgent)){ + brx ="Opera"; + } + if (/Trident/.test(navigator.userAgent)){ + brx ="IE"; + } + return brx; + }, + currentdb: null, + info: null, loadpage: function(page,data = null){ // console.log("load Page => " + page); // console.log(app); diff --git a/apps/creorga/js/creorga.js b/apps/creorga/js/creorga.js index 430b712..b52be76 100644 --- a/apps/creorga/js/creorga.js +++ b/apps/creorga/js/creorga.js @@ -334,11 +334,16 @@ function load_helpers(){ }); //dump("load month helper\n"); - $(".input-group.month input[type='date']").datetimepicker({ + $(".input-group.month input[type='text']").datetimepicker({ locale: 'fr', format: 'MM.YYYY', viewMode:'months' }); + // $(".input-group.month input[type='date']").datetimepicker({ + // locale: 'fr', + // format: 'MM.YYYY', + // viewMode:'months' + // }); //dump("load week helper\n"); $(".input-group.week input[type='date']").datetimepicker({ locale: 'fr', @@ -360,7 +365,8 @@ function load_helpers(){ } function set_infoheader(strinfoheader) { - $("#pagehead").html(strinfoheader) + console.log("Set Header:" + strinfoheader); + $("#pagehead").html(strinfoheader); //globelreq.send_request({page:'infoheader',header:strinfoheader}); } @@ -442,3 +448,10 @@ function htmlUnescape(str){ jQuery.fn.exists = function(){ return this.length > 0; } +Date.prototype.getWeekNumber = function(){ + var d = new Date(Date.UTC(this.getFullYear(), this.getMonth(), this.getDate())); + var dayNum = d.getUTCDay() || 7; + d.setUTCDate(d.getUTCDate() + 4 - dayNum); + var yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1)); + return Math.ceil((((d - yearStart) / 86400000) + 1)/7) +}; \ No newline at end of file diff --git a/apps/creorga/js/webdatabase.js b/apps/creorga/js/webdatabase.js index 1190201..6003c6a 100644 --- a/apps/creorga/js/webdatabase.js +++ b/apps/creorga/js/webdatabase.js @@ -3,13 +3,16 @@ var appdb = { url: 'http://' + location.host + '/apps_dks_lu/api/sqlite.cgi?', dbquery: function(sQuery){ var type='querysorted'; - var result= {sqldata:[]}; + var result= {sqldata:[]}; + //console.log(sQuery); //console.log(this.url + 'db=' + this.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery)); //dump(this.url + 'db=' + this.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) + "\n"); $.ajax({ - encoding:"UTF-8", - url:appdb.url + 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) , - crossDomain: true, + encoding:"UTF-8", + method: "POST", + url:appdb.url, + data: 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery), + //crossDomain: true, success: function (data){ //dump(data + "\n"); result=data.result; @@ -49,11 +52,12 @@ var appdb = { var type='exec'; var result= {sqldata:[]}; //dump(this.url + 'db=' + this.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) + "\n"); - console.log(appdb.url + 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) ); + //console.log(appdb.url + 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) ); $.ajax({ encoding:"UTF-8", - url:appdb.url + 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery) , - crossDomain: true, + method: "POST", + url:appdb.url, + data: 'db=' + appdb.dbfile + '&type=' + type + '&sql=' +encodeURIComponent(sQuery), success: function (data){ result=data.result; }, diff --git a/apps/creorga/js/webpreferences.js b/apps/creorga/js/webpreferences.js index 6a7495e..0190ccf 100644 --- a/apps/creorga/js/webpreferences.js +++ b/apps/creorga/js/webpreferences.js @@ -72,7 +72,8 @@ var apppref ={ //var page = location.pathname.substring(location.pathname.lastIndexOf("/")); - //page = page.replace(/\.html/,''); + //page = page.replace(/\.html/,''); + $.ajax({ encoding:"UTF-8", url: apppref.api + 'prefs.cgi?page=' + key + '&set=' +encodeURIComponent(JSON.stringify(value)) , @@ -88,25 +89,18 @@ var apppref ={ }); }, getpreference: function(key){ - // if ((apppref) && (apppref.curcfg)){ - // apppref.curcfg['pageconfig'] = {}; - // }else { - // apppref['curcfg']['pageconfig'] = {}; - // } + console.log("getpref:" + key); var retdata = null; $.ajax({ encoding:"UTF-8", url: apppref.api + 'prefs.cgi?get=' + key , - crossDomain: true, - success: function (data){ - retdata = data.result; - // console.log("DATA"); - // console.log(data); - // if (data.result){ - - // apppref.curcfg.pageconfig = data.result; - // } + success: function (data){ + if (!data.result){ + retdata = {}; + }else { + retdata = data.result; + } }, error: function(data){ alert("Error:" + JSON.stringify(data)); diff --git a/apps/creorga/modules/calendar/index.html b/apps/creorga/modules/calendar/index.html index af49a97..4fa038b 100644 --- a/apps/creorga/modules/calendar/index.html +++ b/apps/creorga/modules/calendar/index.html @@ -35,7 +35,7 @@
du mois: - +
@@ -94,12 +94,10 @@ - - - - - - + + + + diff --git a/apps/creorga/modules/calendar/js/calchilds.js b/apps/creorga/modules/calendar/js/calchilds.js index 12b0fb2..e40fb0b 100644 --- a/apps/creorga/modules/calendar/js/calchilds.js +++ b/apps/creorga/modules/calendar/js/calchilds.js @@ -11,31 +11,29 @@ var drsql = ""; function initdata() { load_helpers(); - var configdata = apppref.getpreference("pageconfig.calchilds"); - if (!configdata) { - apppref.setpreference("pageconfig.calchilds", ''); - } - if (configdata !== '') { - pconfig = JSON.parse(configdata); + pconfig = apppref.getpreference("calchilds"); + if (!pconfig){ + pconfig = {}; } + console.log(pconfig); //if (!pconfig.printlayout) { pconfig.printlayout = 'table'; - apppref.setpreference("pageconfig.calchilds",pconfig); + apppref.setpreference("calchilds",pconfig); //} if (pconfig.calmonth) { initdate = new Date(encodeparam(pconfig.calmonth, 'month').replace(/'/g, '')); $("#calmonth").val(pconfig.calmonth); } else { - $("#calmonth").val(initdate.toLocaleFormat('%m.%Y')); - pconfig.calmonth = initdate.toLocaleFormat('%m.%Y'); + $("#calmonth").val(initdate.getMonth() + '.' + initdate.getFullYear()); + pconfig.calmonth = initdate.getMonth() + '.' + initdate.getFullYear(); } var infogrp ="Nombre d'enfants"; if (!pconfig.calendar){ pconfig.calendar = "childsbyplan"; } - - set_infoheader(infogrp+" - " + amonth[parseInt(pconfig.calmonth.substring(0, 3))] + " " + pconfig.calmonth.substring(3, 8)); + console.log("initdate loaded:" + initdate); + //set_infoheader(infogrp+" - " + amonth[parseInt(pconfig.calmonth.substring(0, 3))] + " " + pconfig.calmonth.substring(3, 8)); drsql = getdaterangesql(); $('#calmonth').on('dp.hide', function() { @@ -115,7 +113,7 @@ function load_calendar_weekhours(){ //enfants par heures contractuelles } for (var t in ttdata){ var rdata = ttdata[t]; - var ctday = rdata.daydate.substring(8,10); + var ctday = parseInt(rdata.daydate.substring(8,10)); if (alltr[rdata.weekhours]){ if (alltr[rdata.weekhours][ctday]){ alltr[rdata.weekhours][ctday] = ttdata[t].childcnt; @@ -135,7 +133,7 @@ function load_calendar_weekhours(){ //enfants par heures contractuelles trn += '' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ ''; trn +=''; if (alltr[a][coldays[h]] != 0){ - tfooter[parseInt(coldays[h])] += alltr[a][coldays[h]]; + tfooter[parseInt(coldays[h])] += parseInt(alltr[a][coldays[h]]); } } trn += ''; @@ -205,7 +203,7 @@ function load_calendar_plan(){ for (var t in ttdata){ var rdata = ttdata[t]; - var ctday = rdata.daydate.substring(8,10); + var ctday = parseInt(rdata.daydate.substring(8,10)); if (alltr[rdata.daytime]){ if (alltr[rdata.daytime][ctday]){ alltr[rdata.daytime][ctday] = ttdata[t].childcnt; @@ -234,10 +232,10 @@ function load_calendar_plan(){ trn += ''; continue; } - trn += '' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ ''; + trn += '' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ ''; trn +=''; if (alltr[a][coldays[h]] != 0){ - tfooter[parseInt(coldays[h])] += alltr[a][coldays[h]]; + tfooter[parseInt(coldays[h])] += parseInt(alltr[a][coldays[h]]); } } trn += ''; @@ -332,38 +330,23 @@ function load_calendar_plan(){ function set_calmonth(){ pconfig.calmonth =$("#calmonth").val(); - apppref.setpreference("pageconfig.calchilds",pconfig); - globelreq.send_request({ - page: 'calchilds', - module: 'calendar', - data: null, - header: 'Organisation Enfants' - }); + apppref.setpreference("calchilds",pconfig); + parent.app.loadpage('modules/calendar/index.html',{calmonth:pconfig.calmonth}); } function onnextmonth() { - var tmpmonth = new Date(encodeparam(pconfig.calmonth, 'month').replace(/'/g, '')); - var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() + 1, tmpmonth.getDate()); - pconfig.calmonth = nmonth.toLocaleFormat('%m.%Y'); - apppref.setpreference("pageconfig.calchilds", pconfig); - globelreq.send_request({ - page: 'calchilds', - module: 'calendar', - header: 'Organisation Enfants' - }, null); + var xdate = appdb.dbquery("select STRFTIME('%m.%Y',date('"+initdate.toISOString().substring(0,10)+"','+1 month')) as ndate"); + pconfig.calmonth = xdate.sqldata[0].ndate; + apppref.setpreference("calchilds", pconfig); + parent.app.loadpage('modules/calendar/index.html',{calmonth:pconfig.calmonth}); } function onpreviousmonth() { - var tmpmonth = new Date(encodeparam(pconfig.calmonth, 'month').replace(/'/g, '')); - var nmonth = new Date(tmpmonth.getFullYear(), tmpmonth.getMonth() - 1, tmpmonth.getDate()); - pconfig.calmonth = nmonth.toLocaleFormat('%m.%Y'); - apppref.setpreference("pageconfig.calchilds", pconfig); - globelreq.send_request({ - page: 'calchilds', - module: 'calendar', - header: 'Organisation Enfants' - }, null); + var xdate = appdb.dbquery("select STRFTIME('%m.%Y',date('"+initdate.toISOString().substring(0,10)+"','-1 month')) as ndate"); + pconfig.calmonth = xdate.sqldata[0].ndate; + apppref.setpreference("calchilds", pconfig); + parent.app.loadpage('modules/calendar/index.html',{calmonth:pconfig.calmonth}); } //get childs planning with exact hours (planning) @@ -521,13 +504,13 @@ function getcolumndays(){ //dump (initdate + ": " + firstmonday + " -> " + lastmonthday + "\n"); for (var cdt = firstmonday; cdt < lastmonthday; cdt.setDate(cdt.getDate() + 1)) { if ((cdt.getDay() !== 0)){ - if ((lwr === -1) || (!wrs[parseInt(cdt.toLocaleFormat('%W'))])) { - wrs[parseInt(cdt.toLocaleFormat('%W'))] = 1; + if ((lwr === -1) || (!wrs[cdt.getWeekNumber()])) { + wrs[cdt.getWeekNumber()] = 1; }else { - wrs[parseInt(cdt.toLocaleFormat('%W'))] += 1; + wrs[cdt.getWeekNumber()] += 1; } - lwr = parseInt(cdt.toLocaleFormat('%W')); - adays.push(cdt.toLocaleFormat('%d')); + lwr = cdt.getWeekNumber(); + adays.push(cdt.getDate()); } } @@ -610,12 +593,13 @@ function get_vacancydays(){ function onselcalendar(objid){ //$('#' + objid).val() + "\n"); pconfig.calendar = $('#' + objid).val(); - apppref.setpreference("pageconfig.calchilds",pconfig); - globelreq.send_request({ - page: 'calchilds', - module: 'calendar', - header: 'Organisation Enfants' - }, null); + apppref.setpreference("calchilds", pconfig); + parent.app.loadpage('modules/calendar/index.html',{}); + // globelreq.send_request({ + // page: 'calchilds', + // module: 'calendar', + // header: 'Organisation Enfants' + // }, null); } diff --git a/apps/creorga/modules/childs/js/child.js b/apps/creorga/modules/childs/js/child.js index df1891c..4a5b20e 100644 --- a/apps/creorga/modules/childs/js/child.js +++ b/apps/creorga/modules/childs/js/child.js @@ -21,22 +21,28 @@ function validate_plan_proposals() { function initdata() { load_helpers(); - curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num")); - var configdata = apppref.getpreference("pageconfig.child"); - if (configdata != '') { - pconfig = JSON.parse(configdata); - } + pconfig = getSearchParams(); + //curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num")); + //var configdata = apppref.getpreference("pageconfig.child"); + //if (configdata != '') { + //pconfig = JSON.parse(configdata); + //} var cname = appdb.dbquery("select uuid from creche LIMIT 1;"); cruuid = cname.sqldata[0].uuid; - if (!pconfig.printlayout) { + //if (!pconfig.printlayout) { pconfig.printlayout = 'child'; - apppref.setpreference("pageconfig.child",pconfig); - } - var cdatasql = "select uuid,clientnumber,prename,surname,strftime('%d.%m.%Y',birthday) as birthday,address,city,zip,country,strftime('%d.%m.%Y',entrydate) as entrydate,checkservicenumber,strftime('%d.%m.%Y',checkserviceexpiration) as checkserviceexpiration,strftime('%d.%m.%Y',leavedate) as leavedate,nationality,nativelanguage,bankaccount,bankbic,cautionamount,cautionremark,remark ,infohealth from childs where uuid='" + pconfig.uuid + "';"; + // apppref.setpreference("child",pconfig); + //} + //console.log(parent.app.browser.isChromiumBased); + var cdatasql = "select uuid,clientnumber,prename,surname,strftime('%d.%m.%Y',birthday) as birthday,address,city,zip,country,strftime('%d.%m.%Y',entrydate) as entrydate,checkservicenumber,strftime('%d.%m.%Y',checkserviceexpiration) as checkserviceexpiration,strftime('%d.%m.%Y',leavedate) as leavedate,nationality,nativelanguage,bankaccount,bankbic,cautionamount,cautionremark,remark ,infohealth from childs where uuid='" + pconfig.uuid + "';"; + console.log("Browser:" + parent.app.browser()); + if (parent.app.browser() == "Chrome"){ + cdatasql = "select uuid,clientnumber,prename,surname,birthday,address,city,zip,country,entrydate,checkservicenumber,checkserviceexpiration,leavedate,nationality,nativelanguage,bankaccount,bankbic,cautionamount,cautionremark,remark ,infohealth from childs where uuid='" + pconfig.uuid + "';"; + } var cdata = appdb.dbquery(cdatasql); cdata = cdata.sqldata[0]; - set_infoheader(cdata.prename + " " + cdata.surname); + //set_infoheader(cdata.prename + " " + cdata.surname); for (var ci in cdata) { if (document.getElementById("childs_" + ci)) { if (document.getElementById("childs_" + ci).tagName == "TEXTAREA"){ @@ -165,7 +171,7 @@ function load_table_presence() { var plandata = appdb.dbqueryarray(plandatasql); var headerdata = getlabels(plandata.sqlhead.join(",")); - dump("Header" + JSON.stringify(headerdata) + "\n"); + //dump("Header" + JSON.stringify(headerdata) + "\n"); $("#tbl_planning").html(""); var tblplan = $("#tbl_planning").dataTable({ "language": { @@ -215,9 +221,18 @@ function load_table_refperson() { for (var x in row){ //jsdump(x); if (x == 7){ - tr += ""+ htmlUnescape(row[x])+""; + if (row[x] == null){ + tr += ""; + } else { + tr += ""+ htmlUnescape(row[x])+""; + } } else { - tr += ""+ row[x]+""; + if (row[x] == null){ + tr += ""; + }else { + tr += ""+ row[x]+""; + } + } } tr += ""; diff --git a/apps/creorga/modules/childs/js/childs.js b/apps/creorga/modules/childs/js/childs.js index 3e4db1d..e60d6ed 100644 --- a/apps/creorga/modules/childs/js/childs.js +++ b/apps/creorga/modules/childs/js/childs.js @@ -15,8 +15,8 @@ var candelete = 0; function initdata(){ //appdb.dbfile=parent.app.currentdb; var pconfig = apppref.getpreference("childs"); - console.log("CFG"); - //console.log(configdata); + //console.log("CFG"); + //console.log(pconfig); // if (configdata) { // pconfig = JSON.parse(configdata); // } @@ -24,32 +24,29 @@ function initdata(){ pconfig.printlayout = 'list'; apppref.setpreference("childs",pconfig); } - console.log("get appinfo"); - console.log(parent.app.info); + //console.log("get appinfo"); + //console.log(parent.app.info); if (parent.app.info.modules.childs.delete === true){ candelete = 1; } var filters = getallfilters(); - console.log(filters); + //console.log(filters); var strfilters = ""; - for (var f in filters) { - if (!pconfig.filterid) { - idfilter = 0; - filter = filters[0]; - set_infoheader(filter.description); - - pconfig.idfilter = 0; - apppref.setpreference("pageconfig.childs",pconfig); - } else { - idfilter = f; - filter = filters[f]; - set_infoheader(filter.description); - - } + for (var f in filters) { strfilters += '
  • ' + filters[f].description + '
  • '; } - - + if (pconfig.filterid) { + // console.log("id Filter:" + pconfig.filterid); + // idfilter = f; + filter = filters[pconfig.filterid]; + } else { + pconfig.filterid = 0; + filter = filters[0]; + apppref.setpreference("childs",pconfig); + } + //console.log("Filter"); + //console.log(filter); + set_infoheader(filter.description); $("#cmb_childsfilter").html(strfilters); loadtable(); diff --git a/apps/creorga/modules/creche/creche.html b/apps/creorga/modules/creche/creche.html index b1d898d..a11998d 100644 --- a/apps/creorga/modules/creche/creche.html +++ b/apps/creorga/modules/creche/creche.html @@ -54,7 +54,6 @@
    + Apps
    -
    +
    ... -
    -
    Creorga
    -

    Application pour crèches au Luxembourg

    -
    - +
    Creorga
    -
    +
    ... -
    -
    Hourtrax
    -

    Gérance de disponibilité et du congé du personnel

    -
    - +
    Hourtrax
    -
    +
    ... -
    -
    Invoice Journal
    -

    Gérance des Factures et Rappels

    -
    - +
    Invoice Journal
    - + \ No newline at end of file diff --git a/js/apps.js b/js/apps.js new file mode 100644 index 0000000..44b087e --- /dev/null +++ b/js/apps.js @@ -0,0 +1,55 @@ +// function logout(){ +// alert(('https:' == document.location.protocol ? 'https' : 'http') + '://'+ location.host + '/apps_dks_lu'); +// //location.href=location.protocol + "://nouser:nopwd@" + location.host + '/apps_dks_lu'; +// } +function logout() { + //alert("TEST"); + secUrl = ('https:' == document.location.protocol ? 'https' : 'http') + '://'+ location.host + '/apps_dks_lu'; + redirUrl= 'https://www.dks.lu' + var bowser = getBrowser(); + console.log(bowser); + if (bowser == "IE") { + document.execCommand('ClearAuthenticationCache', 'false'); + } else if (bowser == "Firefox") { + $.ajax({ + async: false, + url: secUrl, + type: 'GET', + username: 'logout' + }); + } else if (bowser == "Safari" || bowser == "Chrome") { + var xmlhttp = new XMLHttpRequest(); + xmlhttp.open("GET", secUrl, true); + xmlhttp.setRequestHeader("Authorization", "Basic logout"); + xmlhttp.send(); + } else { + alert("Logging out automatically is unsupported for " + bowser + + "\nYou must close the browser to log out."); + } + setTimeout(function () { + window.location.href = redirUrl; + }, 200); +} + +function getBrowser(){ + var brx = "unknown"; + if (/Safari/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent)){ + brx = "Safari"; + } + if (/Chrome/.test(navigator.userAgent)){ + brx ="Chrome"; + } + if (/Edge/.test(navigator.userAgent)){ + brx ="Edge"; + } + if (/Firefox/.test(navigator.userAgent)){ + brx ="Firefox"; + } + if (/OPR/.test(navigator.userAgent)){ + brx ="Opera"; + } + if (/Trident|msie/.test(navigator.userAgent)){ + brx ="IE"; + } + return brx; +} \ No newline at end of file