creorga web modification
authorKilian Saffran <ksaffran@dks.lu>
Tue, 2 Apr 2019 08:30:15 +0000 (10:30 +0200)
committerKilian Saffran <ksaffran@dks.lu>
Tue, 2 Apr 2019 08:30:15 +0000 (10:30 +0200)
25 files changed:
api/prefs.cgi
api/sqlite.cgi
apps/creorga/css/creorga.css
apps/creorga/js/app.js
apps/creorga/js/creorga.js
apps/creorga/js/webdatabase.js
apps/creorga/js/webpreferences.js
apps/creorga/modules/calendar/index.html
apps/creorga/modules/calendar/js/calchilds.js
apps/creorga/modules/childs/js/child.js
apps/creorga/modules/childs/js/childs.js
apps/creorga/modules/creche/creche.html
apps/creorga/modules/creche/js/creche.js [moved from apps/creorga/modules/creche/creche.js with 82% similarity]
apps/creorga/modules/presences/js/dailypresences.js
data/db/lechatpotte.sqlite
data/db/underatert.sqlite
data/user/kilian.calchilds.json [new file with mode: 0644]
data/user/kilian.childs.json
data/user/kilian.creche.json [new file with mode: 0644]
data/user/kilian.dailypresences.json
data/user/kilian.pageconfig.childs.json
data/user/kilian.pageconfig.weeklypresences.json [deleted file]
data/user/kilian.weeklypresences.json
index.html
js/apps.js [new file with mode: 0644]

index 262ddf9..d6bff9e 100644 (file)
@@ -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 = <CFG>){
-      $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 = <CFG>){
+        $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;
 }
index 6de18f4..5896331 100644 (file)
@@ -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++;
    }
index e98027f..7de57d4 100644 (file)
@@ -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
index 0bc93ef..8184b43 100644 (file)
@@ -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);
index 430b712..b52be76 100644 (file)
@@ -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
index 1190201..6003c6a 100644 (file)
@@ -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;
                                        },
index 6a7495e..0190ccf 100644 (file)
@@ -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));
index af49a97..4fa038b 100644 (file)
@@ -35,7 +35,7 @@
             <div id="frmchart_child" class="form-inline" style="margin-bottom: 7px;">
               <div class="input-group month btn-group">
                 <span class="input-group-addon">du mois:</span>
-                <input type="date" class="form-control" value="" placeholder="mm.yyyy" style="width: 120px;" id="calmonth">
+                <input type="text" class="form-control" value="" style="width: 120px;" id="calmonth">
                 <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
               </div>
                 <button class="btn btn-primary" onclick="onpreviousmonth();"><span class="glyphicon glyphicon-chevron-left"></span></button>
   <script src="../../js/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
   <!-- <script src="../../js/bootstrap-timepicker.min.js" type="text/javascript"></script> -->
   <script src="../../js/bootstrap-multiselect.js" type="text/javascript"></script>
-  <script src="js/rrule.js" type="text/javascript"></script>
-  <script src="js/nlp.js" type="text/javascript"></script>
-  <script src="chrome://creorga/content/js/preferences.js" type="text/javascript"></script>
-  <script src="chrome://creorga/content/js/navigation.js" type="text/javascript"></script>
-  <script src="chrome://creorga/content/js/database.js" type="text/javascript"></script>
-  <script src="chrome://creorga/content/js/system.js" type="text/javascript"></script>
+  <script src="../../vendor/rrule/rrule.js" type="text/javascript"></script>
+  <script src="../../vendor/rrule/nlp.js" type="text/javascript"></script>
+  <script src="../../js/webpreferences.js" type="text/javascript"></script>
+  <script src="../../js/webdatabase.js" type="text/javascript"></script>
   <script src="../../js/creorga.js" type="text/javascript"></script>
   <script src="../../js/labels.js" type="text/javascript"></script>
   <script src="js/calchilds.js" type="text/javascript"></script>
index 12b0fb2..e40fb0b 100644 (file)
@@ -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 += '<td class="alignright" ><span>' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ '</span>';
       trn +='</td>';
       if (alltr[a][coldays[h]] != 0){
-        tfooter[parseInt(coldays[h])] += alltr[a][coldays[h]];
+        tfooter[parseInt(coldays[h])] += parseInt(alltr[a][coldays[h]]);
       }
     }
     trn += '</tr>';
@@ -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 += '<td style="background-color: #6D6D6D !important"></td>';
           continue;
         }
-        trn += '<td class="alignright" ><span>' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ '</span>';
+        trn += '<td class="alignright"><span>' +((alltr[a][coldays[h]] != 0)?alltr[a][coldays[h]]:'')+ '</span>';
         trn +='</td>';
         if (alltr[a][coldays[h]] != 0){
-          tfooter[parseInt(coldays[h])] += alltr[a][coldays[h]];
+          tfooter[parseInt(coldays[h])] += parseInt(alltr[a][coldays[h]]);
         }
       }
       trn += '</tr>';
@@ -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);
 }
 
 
index df1891c..4a5b20e 100644 (file)
@@ -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 += "<td>"+ htmlUnescape(row[x])+"</td>";
+        if (row[x] == null){
+          tr += "<td></td>";
+        } else {
+          tr += "<td>"+ htmlUnescape(row[x])+"</td>";
+        }
       } else {
-        tr += "<td>"+ row[x]+"</td>";
+        if (row[x] == null){
+          tr += "<td></td>";
+        }else {
+          tr += "<td>"+ row[x]+"</td>";
+        }
+        
       }
     }
     tr += "</tr>";
index 3e4db1d..e60d6ed 100644 (file)
@@ -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 += '<li><a href="javascript:setfilter(\'' + f + '\');">' + filters[f].description + '</a></li>';
     }
-    
-  
+    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();
index b1d898d..a11998d 100644 (file)
@@ -54,7 +54,6 @@
         <div class="tabbable">
             <ul class="nav nav-tabs" id="tabgrouphead">
               <li><a data-toggle="tab" href="#openinghours">Heures d'ouvertures</a></li>
-
               <li><a data-toggle="tab" href="#groups">Groupes d'enfants</a></li>
               <li><a data-toggle="tab" href="#planningtemplate">modèles planification</a></li>
 
similarity index 82%
rename from apps/creorga/modules/creche/creche.js
rename to apps/creorga/modules/creche/js/creche.js
index d5dfee1..1b8145a 100644 (file)
@@ -7,16 +7,16 @@ var delplanning = null;
 var delgroups = null;
 var winh = window.innerHeight - 360;
 var weekdays = ['mon','tue','wed','thu','fri','sat'];
-
+var pconfig ={};
 function initdata() {
   load_helpers();
-  check_crechetable();
-  var sql = "SELECT uuid,crechename, adress, city, country, zip,maxchilds,minage,maxage,stafflist,idcheckservice FROM creche LIMIT 1;";
+  //check_crechetable();
+  var sql = "SELECT uuid,crechename, adress, city, country, zip,maxchilds,minage,maxage,idcheckservice FROM creche LIMIT 1;";
   var crdata = appdb.dbquery(sql);
-  set_infoheader("");
+  //set_infoheader("");
   //dump(JSON.stringify(crdata) + "\n");
   if (crdata.sqldata.length == 0){
-      check_defaultdata();
+      //check_defaultdata();
       crdata = appdb.dbquery(sql);
   }
   crident = crdata.sqldata[0].uuid;
@@ -24,36 +24,21 @@ function initdata() {
   for (var ci in cdata) {
 
     if (document.getElementById("creche_" + ci)) {
-        if (ci == "stafflist"){
-               $("#creche_stafflist").prop('checked', true);
-        } else {
+        // if (ci == "stafflist"){
+        //     $("#creche_stafflist").prop('checked', true);
+        // } else {
                document.getElementById("creche_" + ci).setAttribute('value', cdata[ci]);
-        }
+        // }
 
     }
   }
-  var configdata = apppref.getpreference("pageconfig.creche");
-
-  if (configdata != '') {
-    pconfig = JSON.parse(configdata);
+  pconfig = apppref.getpreference("creche");
+  if (!pconfig) {
+    pconfig = {};
+    //   pconfig = JSON.parse(configdata);
   }
 
-  $('#tabgrouphead a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
-    var tn = e.target.toString();
-    pconfig.activetab = tn.substring(tn.lastIndexOf("#") + 1);
-    apppref.setpreference("pageconfig.creche", pconfig);
-
-    if (pconfig.activetab == 'openinghours') {
-      load_table_workinghours();
-    }
-    if (pconfig.activetab == 'groups') {
-      load_table_groups();
-    }
-    if (pconfig.activetab == 'planningtemplate') {
-      load_table_planningtemplate();
-    }
-
-  });
+  
   $('#frmeditgroups #color').minicolors({theme:'bootstrap',position: 'bottom right'});
   if (pconfig && pconfig.activetab) {
     $('#tabgrouphead a[href="#' + pconfig.activetab + '"]').tab('show');
@@ -62,14 +47,32 @@ function initdata() {
   }
 }
 
-$('#creche_stafflist').on('change', function() {
-    // From the other examples
-    if (this.checked) {
-        appdb.dbexec("update creche set stafflist='1';");
-    } else {
-       appdb.dbexec("update creche set stafflist=null;");
-    }
+
+$('#tabgrouphead a[data-toggle="tab"]').on('shown.bs.tab', function(e) {
+  var tn = e.target.toString();
+  console.log("tab:" + tn);
+  pconfig.activetab = tn.substring(tn.lastIndexOf("#") + 1);
+  //apppref.setpreference("creche", pconfig);
+
+  if (pconfig.activetab == 'openinghours') {
+    load_table_workinghours();
+  }
+  if (pconfig.activetab == 'groups') {
+    load_table_groups();
+  }
+  if (pconfig.activetab == 'planningtemplate') {
+    load_table_planningtemplate();
+  }
+
 });
+// $('#creche_stafflist').on('change', function() {
+//     // From the other examples
+//     if (this.checked) {
+//         appdb.dbexec("update creche set stafflist='1';");
+//     } else {
+//             appdb.dbexec("update creche set stafflist=null;");
+//     }
+// });
 
 function load_table_workinghours() {
 
@@ -466,48 +469,48 @@ function hide_tblrow(trid) {
 }
 
 function check_defaultdata() {
-       curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
-       var tables = ['creche','groups','workinghours','vacancy','planningtemplate'];
-       for (var t in tables) {
-               var sql = "select count(*) as cnt from "+ tables[t]+";";
+//     curcfg.loadconfig(apppref.getpreference("support.database.currentdb.num"));
+//     var tables = ['creche','groups','workinghours','vacancy','planningtemplate'];
+//     for (var t in tables) {
+//             var sql = "select count(*) as cnt from "+ tables[t]+";";
 
-               var res = appdb.dbquery(sql);
+//             var res = appdb.dbquery(sql);
 
-               if ((res) && (res.sqldata[0].cnt == '0')) {
+//             if ((res) && (res.sqldata[0].cnt == '0')) {
        
-var inssql = [];
-if (tables[t] == 'creche') {
-  inssql.push("INSERT INTO creche (crechename, adress, city, country, zip, maxchilds, uuid, minage, maxage) VALUES ('Crèche', '', '', 'Luxembourg', '', 28, '"+ curcfg.uuid +"', 2, 84);");
-} else if (tables[t] == 'groups') {
-  var sinssql = "INSERT INTO groups (grpname, maxchilds, minage, maxage, uuid) VALUES ";
-  sinssql +=  "('Groupe Bébé', 6, 2, 12, '"+ appdb.generate_uuid() +"'),";
-  sinssql +=  "('Groupe plus 1 an ', 6, 12, 24, '"+ appdb.generate_uuid() +"'),";
-  sinssql +=  "('Groupe de 2 ans à 3 ans', 8, 24, 36, '"+ appdb.generate_uuid() +"'),";
-  sinssql +=  "('Groupe de 3 à 4 ans ', 8, 36, 48, '"+ appdb.generate_uuid() +"'),";
-  sinssql +=  "('Groupe plus 4 ans ( Scolaires)', 11, 48, 84, '"+ appdb.generate_uuid() +"');"
-  inssql.push(sinssql);
-} else if (tables[t] == 'workinghours') {
-  inssql.push("INSERT INTO workinghours (uuid, datestart, montimeopen, montimeclose, tuetimeopen, tuetimeclose, wedtimeopen, wedtimeclose, thutimeopen, thutimeclose, fritimeopen, fritimeclose, sattimeopen, sattimeclose, suntimeopen, suntimeclose, crecheuuid) VALUES ('"+appdb.generate_uuid()+"', strftime(\"%Y\",date('now','-1 year')) || '-01-01', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', null, null, null, null, '"+ curcfg.uuid+"');");
-
-}
-
-else if (tables[t] == 'planningtemplate') {
-
-  var sinssql = "INSERT INTO planningtemplate (uuid, montimebegin, montimeend, monlunch, tuetimebegin, tuetimeend, tuelunch, wedtimebegin, wedtimeend, wedlunch, thutimebegin, thutimeend, thulunch, fritimebegin, fritimeend, frilunch, templatename) VALUES ";
-  sinssql += "('"+ appdb.generate_uuid()+"', '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00',1, 'plain temps (60h)'),";
-  sinssql += "('"+ appdb.generate_uuid()+"', '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00',1,'matin (30h)'),";
-  sinssql += "('"+ appdb.generate_uuid()+"', '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00',1, 'après-midi (30h)');";
-  inssql.push(sinssql);
-
-}
-for (var i in inssql){
-
-       appdb.dbexec(inssql[i]);
-}
-
-
-}
-}
+// var inssql = [];
+// if (tables[t] == 'creche') {
+//   inssql.push("INSERT INTO creche (crechename, adress, city, country, zip, maxchilds, uuid, minage, maxage) VALUES ('Crèche', '', '', 'Luxembourg', '', 28, '"+ curcfg.uuid +"', 2, 84);");
+// } else if (tables[t] == 'groups') {
+//   var sinssql = "INSERT INTO groups (grpname, maxchilds, minage, maxage, uuid) VALUES ";
+//   sinssql +=  "('Groupe Bébé', 6, 2, 12, '"+ appdb.generate_uuid() +"'),";
+//   sinssql +=  "('Groupe plus 1 an ', 6, 12, 24, '"+ appdb.generate_uuid() +"'),";
+//   sinssql +=  "('Groupe de 2 ans à 3 ans', 8, 24, 36, '"+ appdb.generate_uuid() +"'),";
+//   sinssql +=  "('Groupe de 3 à 4 ans ', 8, 36, 48, '"+ appdb.generate_uuid() +"'),";
+//   sinssql +=  "('Groupe plus 4 ans ( Scolaires)', 11, 48, 84, '"+ appdb.generate_uuid() +"');"
+//   inssql.push(sinssql);
+// } else if (tables[t] == 'workinghours') {
+//   inssql.push("INSERT INTO workinghours (uuid, datestart, montimeopen, montimeclose, tuetimeopen, tuetimeclose, wedtimeopen, wedtimeclose, thutimeopen, thutimeclose, fritimeopen, fritimeclose, sattimeopen, sattimeclose, suntimeopen, suntimeclose, crecheuuid) VALUES ('"+appdb.generate_uuid()+"', strftime(\"%Y\",date('now','-1 year')) || '-01-01', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', '07:00', '19:00', null, null, null, null, '"+ curcfg.uuid+"');");
+
+// }
+
+// else if (tables[t] == 'planningtemplate') {
+
+//   var sinssql = "INSERT INTO planningtemplate (uuid, montimebegin, montimeend, monlunch, tuetimebegin, tuetimeend, tuelunch, wedtimebegin, wedtimeend, wedlunch, thutimebegin, thutimeend, thulunch, fritimebegin, fritimeend, frilunch, templatename) VALUES ";
+//   sinssql += "('"+ appdb.generate_uuid()+"', '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00', 1, '08:00', '18:00',1, 'plain temps (60h)'),";
+//   sinssql += "('"+ appdb.generate_uuid()+"', '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00', 1, '08:00', '13:00',1,'matin (30h)'),";
+//   sinssql += "('"+ appdb.generate_uuid()+"', '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00', 1, '13:00', '18:00',1, 'après-midi (30h)');";
+//   inssql.push(sinssql);
+
+// }
+// for (var i in inssql){
+
+//     appdb.dbexec(inssql[i]);
+// }
+
+
+// }
+// }
 }
 
 function check_crechetable(){
index c667540..63a5006 100644 (file)
@@ -353,9 +353,9 @@ function onpreviousday() {
   pconfig.presday = $('#presday').val();
   console.log(pconfig);
   var tmpweek = new Date(pconfig.presday);
-  var nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-2);
+  var nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-1);
   if (nweek.getDay() == 0){
-      nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-3);
+      nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-2);
   }
 //   if (nweek.getDay() == 6){
 //       nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()-2);
@@ -378,7 +378,7 @@ function onnextday() {
   var tmpweek = new Date(pconfig.presday);
   var nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()+2);
    if (nweek.getDay() == 0){
-      nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()+3);
+      nweek = new Date(tmpweek.getFullYear(), tmpweek.getMonth(), tmpweek.getDate()+4);
   }
   console.log("new next Date");
   console.log(nweek);
@@ -394,7 +394,7 @@ parent.app.loadpage('modules/presences/dailypresences.html',{presday:pconfig.pre
 function timefocus(obj){
       if (!obj.value || obj.value == ''){
             var currentdate = new Date(); 
-            obj.value=currentdate.toLocaleFormat("%H:%M");
+            obj.value=currentdate.getHours() + ":" +currentdate.getMinutes();
       }
       obj.select();
 }
index 57f400b..cb31cf9 100644 (file)
Binary files a/data/db/lechatpotte.sqlite and b/data/db/lechatpotte.sqlite differ
index 4cb5ad3..6d99204 100644 (file)
Binary files a/data/db/underatert.sqlite and b/data/db/underatert.sqlite differ
diff --git a/data/user/kilian.calchilds.json b/data/user/kilian.calchilds.json
new file mode 100644 (file)
index 0000000..7200b6e
--- /dev/null
@@ -0,0 +1 @@
+{"printlayout":"table","calmonth":"11.2018","calendar":"childsbyplan"}
\ No newline at end of file
index aec1b1a..515366b 100644 (file)
@@ -1 +1 @@
-{"printlayout":"list"}
\ No newline at end of file
+{"order":[[0,"asc"]],"filterid":"4","printlayout":"list"}
\ No newline at end of file
diff --git a/data/user/kilian.creche.json b/data/user/kilian.creche.json
new file mode 100644 (file)
index 0000000..9e26dfe
--- /dev/null
@@ -0,0 +1 @@
+{}
\ No newline at end of file
index 8a9d540..e878a40 100644 (file)
@@ -1 +1 @@
-{"presday":"2019-04-02","db":"underatert"}
\ No newline at end of file
+{"presday":"2019-04-12","db":"underatert"}
\ No newline at end of file
index 1c229f4..ab872ec 100644 (file)
@@ -1 +1 @@
-{"idfilter":0,"order":[[0,"asc"]],"printlayout":"list"}
\ No newline at end of file
+{"order":[[0,"asc"]]}
\ No newline at end of file
diff --git a/data/user/kilian.pageconfig.weeklypresences.json b/data/user/kilian.pageconfig.weeklypresences.json
deleted file mode 100644 (file)
index e5e3f9f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{"groupuuid":"9cd95522-acab-a24a-87ee-74a2f0825401","printlayout":"multilist","presweek":null,"activetab":"tblgrp_9cd95522-acab-a24a-87ee-74a2f0825401"}
\ No newline at end of file
index ba871e5..e5e3f9f 100644 (file)
@@ -1 +1 @@
-{"presweek":null,"activetab":"tblgrp_null","groupuuid":"null","printlayout":"multilist"}
\ No newline at end of file
+{"groupuuid":"9cd95522-acab-a24a-87ee-74a2f0825401","printlayout":"multilist","presweek":null,"activetab":"tblgrp_9cd95522-acab-a24a-87ee-74a2f0825401"}
\ No newline at end of file
index f846d7a..5b46ea4 100644 (file)
   <link rel="icon" type="image/png" href="img/favicon/android-chrome-192x192.png" sizes="192x192">
   <link rel="icon" type="image/png" href="imgfavicon/favicon-96x96.png" sizes="96x96">
   <link rel="icon" type="image/png" href="img/favicon/favicon-16x16.png" sizes="16x16">
-  <link rel="manifest" href="img/favicon/manifest.json">
+  <!-- <link rel="manifest" href="img/favicon/manifest.json">
   <link rel="mask-icon" href="img/favicon/safari-pinned-tab.svg" color="#5BBAD5">
   <meta name="msapplication-TileColor" content="#ffffff">
-  <meta name="msapplication-TileImage" content="img/favicon/mstile-144x144.png">
+  <meta name="msapplication-TileImage" content="img/favicon/mstile-144x144.png"> -->
   <meta name="theme-color" content="#ffffff">
   <link rel="stylesheet" href="vendor/bootstrap/css/bootstrap.min.css" >
   <link rel="stylesheet" href="css/apps.css" >
         
     </div>
       <div class="ml-auto text-white lead" >
+        <button onclick="logout();">Logout</button>
         Apps
       </div>
     </nav>
     <div class="container main">
       <div class="row">
-        <div class="col-sm-3">
+        <div class="col-sm-2" style="cursor: pointer;" onclick="window.open('apps/creorga/index.html','_blank');">
           <div class="card">
             <img src="img/apps/creorgalogo.svg" class="card-img-top" style="padding: 5px;" alt="...">
-            <div class="card-body">
-              <h5 class="card-title">Creorga</h5>
-              <p class="card-text">Application pour crèches au Luxembourg</p>
-            </div>
-            <div class="card-footer">
-              <a class="btn btn-secondary text-white" target="_blank" href="apps/creorga/index.html">Lancer</a>
-            </div>
+            <div class="card-header align-items-center bg-white"><h5>Creorga</h5></div>
           </div>
         </div>
-        <div class="col-sm-3">
+        <div class="col-sm-2" style="cursor: pointer;" onclick="window.open('apps/hourtrax/index.html','_blank');">
             <div class="card">
               <img src="img/apps/hourtraxlogo.svg" class="card-img-top" style="padding: 5px;" alt="...">
-              <div class="card-body">
-                <h5 class="card-title">Hourtrax</h5>
-                <p class="card-text">Gérance de disponibilité et du congé du personnel</p>
-              </div>
-              <div class="card-footer">
-                <a class="btn btn-secondary text-white">Lancer</a>
-              </div>
+              <div class="card-header align-items-center bg-white"><h5>Hourtrax</h5></div>
             </div>
           </div>
-          <div class="col-sm-3">
+          <div class="col-sm-2"  style="cursor: pointer;" onclick="window.open('apps/invoicejournal_co/index.html','_blank');">
               <div class="card">
                 <img src="img/apps/invoicejournallogo.svg" class="card-img-top" style="padding: 5px;" alt="...">
-                <div class="card-body">
-                  <h5 class="card-title">Invoice Journal</h5>
-                  <p class="card-text">Gérance des Factures et Rappels</p>
-                </div>
-                <div class="card-footer">
-                  <a class="btn btn-secondary text-white">Lancer</a>
-                </div>
+                <div class="card-header align-items-center bg-white"><h5>Invoice Journal</h5></div>
               </div>
             </div>
       </div>
     </div>
     <script src="vendor/jquery/jquery.min.js"></script>
     <script src="vendor/bootstrap/js/bootstrap.bundle.min.js" ></script>
-    
+    <script src="js/apps.js"></script>
 </body>
 </html>
\ No newline at end of file
diff --git a/js/apps.js b/js/apps.js
new file mode 100644 (file)
index 0000000..44b087e
--- /dev/null
@@ -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