refresh updates and staff inactive
authorKilian Saffran <ksaffran@dks.lu>
Tue, 14 May 2019 13:04:18 +0000 (15:04 +0200)
committerKilian Saffran <ksaffran@dks.lu>
Tue, 14 May 2019 13:04:18 +0000 (15:04 +0200)
22 files changed:
apps/api/lib/pgsql.pm
apps/data/db/underatert.sqlite
apps/index.cgi
apps/js/apps.js
apps/tmpl/creorga/index.tt
apps/tmpl/creorga/modules/calendar/calorganisation.tt
apps/tmpl/creorga/modules/calendar/calvacancy.tt
apps/tmpl/creorga/modules/calendar/index.tt
apps/tmpl/creorga/modules/calendar/js/calvacancy.js
apps/tmpl/creorga/modules/childs/child.tt
apps/tmpl/creorga/modules/childs/index.tt
apps/tmpl/creorga/modules/creche/creche.tt
apps/tmpl/creorga/modules/presences/dailypresences.tt
apps/tmpl/creorga/modules/presences/weeklypresences.tt
apps/tmpl/creorga/modules/staff/coworker.tt
apps/tmpl/creorga/modules/staff/js/coworker.js
apps/tmpl/creorga/modules/staff/stafflist.tt
apps/tmpl/skeleton/browser.tt
apps/tmpl/skeleton/error.tt [new file with mode: 0644]
apps/tmpl/skeleton/index.tt
apps/tmpl/skeleton/login.tt
index.cgi

index e36a77c..8d0b622 100644 (file)
@@ -22,11 +22,16 @@ sub new {
     #  $self->{$x} = $p->{$x};
     #}
     $self->{dbtype} = 'PgPP'; #PgPP,SQLite
-    $self->{dbhost} = 'sql629.your-server.de';
-    #$self->{dbhost} = 'localhost';
+    
+    if ($ENV{SERVER_NAME} eq "localhost"){
+      $self->{dbhost} = 'localhost';
+    } else {
+      $self->{dbhost} = 'sql629.your-server.de';
+    }
+    
+    #
     $self->{dbname} = 'dks_lu';
     $self->{dbuser} = 'dks_lu';
-    #$self->{dbpassword} = 'dks_lu';
                $self->{dbpassword} = 'DcrWuLd4KU3u68xd';
     return $self;
 }
index e1a9931..be78aee 100644 (file)
Binary files a/apps/data/db/underatert.sqlite and b/apps/data/db/underatert.sqlite differ
index 5a0d4c5..0937d10 100644 (file)
@@ -31,6 +31,7 @@ my $basepath = substr(dirname($ENV{"SCRIPT_FILENAME"}),length($ENV{"DOCUMENT_ROO
 # my $basepath = $ENV{"DOCUMENT_ROOT"};
 my $filepath = substr($cgi->url({-absolute=>1}),length($basepath)+1); 
 #if (exists($p->{p})){
+
 if ($filepath ne ""){
   $page = $filepath;
   $page =~ s/html$/tt/;
@@ -79,11 +80,19 @@ if (($ENV{HTTP_USER_AGENT} !~ /Chrome/) || ($ENV{HTTP_USER_AGENT} =~ /Edge/) ||
 # if (!exists($sesdata->{usersession})){
 #      $p->{page} = "login";
 # }
-print $cgi->header(-status => $status, -type=>'text/html', -charset=>"utf-8",-cookie => $cookie);
+if ( -d dirname($ENV{"SCRIPT_FILENAME"}).'/tmpl/'.$page){
+  $page = $page.'/index.tt';
+}
 
 my $template = Template->new({INCLUDE_PATH => [dirname($ENV{"SCRIPT_FILENAME"}).'/tmpl']});
 my @lv = split(/\//,$filepath);
-my $absnum = scalar(@lv)-1;
+my $absnum = 0;
+if (scalar(@lv) > 1){
+  $absnum = scalar(@lv)-1;  
+} else {
+  $absnum = scalar(@lv);
+}
+# my $absnum = scalar(@lv)-1;
 my $vars->{abspath} = "";
 for (my $i=0;$i<$absnum;$i++){
   $vars->{abspath} .= "../";
@@ -94,7 +103,9 @@ $vars->{basepath} = $basepath;
 $vars->{page} = $page;
 $vars->{pagename} = basename($page);
 $vars->{pagename} =~ s/\.tt$//;
+
 my ($appname) = $ENV{REQUEST_URI} =~ /.*\/apps\/(\w+)\/.*/;
+
 #$vars->{requri} = $ENV{REQUEST_URI};
 if ($p->{sid} ne ""){
   $vars->{appname} = $appname;
@@ -108,10 +119,17 @@ if ($p->{sid} ne ""){
 if ($skl ne "skeleton/login.tt" && $page ne "index.tt"){
   $skl = "skeleton/app.tt";
 }
+# if ((! -f dirname($ENV{"SCRIPT_FILENAME"}).'/tmpl/'.$page) && ($skl ne "skeleton/login.tt")){
+#   $status = '404 Not Found';
+#   $skl = "skeleton/error.tt";
+# }
+print $cgi->header(-status => $status, -type=>'text/html', -charset=>"utf-8",-cookie => $cookie);
 # print Dumper($template);
 $template->process($skl,$vars) || die "Template process failed: ", $template->error(), "\n";
-# my %headers = map { $_ => $cgi->http($_) } $cgi->http();
-# print "Got the following headers:\n";
-# for my $header ( keys %headers ) {
-#     print "$header: $headers{$header}<br/>";
-# }
+# print '/*';
+# # for my $e ( keys %ENV ) {
+# #     print "$e: ".$ENV{$e}."<br/>";
+# # }
+# print Dumper($vars);
+# print scalar(@lv);
+# print '*/';
index 0a72d71..0c50f42 100644 (file)
@@ -1,6 +1,5 @@
-var https ='http';
 function logout() {
-  myurl = https + '://'+ location.host  + '/apps/';
+  var myurl = location.href;
       $.ajax({
           async: false,
           url: myurl,
index c582742..2141a43 100644 (file)
@@ -5,6 +5,9 @@
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <meta name="description" content="">
     <meta name="author" content="">
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <meta http-equiv="Expires" content="0" />
     <link rel="icon" href="../img/favicon/creorga.png">
 
     <title>Creorga </title>
index 598030b..70d07bd 100644 (file)
@@ -4,7 +4,9 @@
 <head>
   <title>Organisation Personnel</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/datatables.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
index 6871dff..7fbec8b 100644 (file)
@@ -4,7 +4,9 @@
 <head>
   <title>Congé</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <!--<link href="../../../oldvendor/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
   <link href="../../../oldvendor/css/datatables.min.css" rel="stylesheet" type="text/css">
index 26231a8..70611cf 100644 (file)
@@ -3,10 +3,12 @@
 <html lang="fr">
 <head>
   <meta charset="utf-8">
-
   <title>Organisation Enfants</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/datatables.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
index c8a6351..8575faf 100644 (file)
@@ -98,7 +98,7 @@ function load_calendar_data() {
 function setcrechevacancydata(thead,hdays){
        var vacdata = getstaffvacancy();
        
-      var staffsql = "SELECT uuid,prename || ' ' || surname as fullname,color from staff where entrydate <= date('"+initdate.toISOString().substring(0,10)+"','+1 month','-1 day') and (exitdate is null or exitdate >= date('"+initdate.toISOString().substring(0,10)+"'));";
+      var staffsql = "SELECT uuid,prename || ' ' || surname as fullname,color from staff where inactive is null and entrydate <= date('"+initdate.toISOString().substring(0,10)+"','+1 month','-1 day') and (exitdate is null or exitdate >= date('"+initdate.toISOString().substring(0,10)+"'));";
 
       var staffnames = parent.appdb.dbquery(staffsql);   
          staffnames = staffnames.sqldata;
@@ -253,7 +253,7 @@ function invertColor(hexTripletColor) {
                "timefrom,timeto, type "+
                "from vacancycalendar where (datefrom is null or datefrom <= '"+bend.toISOString().substring(0,10)+"') and (dateto is null or dateto >= '"+bdate.toISOString().substring(0,10)+"')) vc "+
                "join ("+drsql+") dd  "+
-               "on (dd.daydate between vc.datefrom and vc.dateto) left join staff st on (st.uuid=vc.staffuuid); ";
+               "on (dd.daydate between vc.datefrom and vc.dateto) left join staff st on (st.uuid=vc.staffuuid and st.inactive is null); ";
                 
                  var vacdata = parent.appdb.dbquery(vacsql);
                  vacdata = vacdata.sqldata;
index 56e26b1..64f1643 100644 (file)
@@ -6,6 +6,9 @@
 
   <title>Détails - Enfant</title>
     <meta name="viewport" content="width=device-width, initial-scale=1">
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   
   <!--<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
index 90658ac..9b65dca 100644 (file)
@@ -6,7 +6,9 @@
 
   <title>Enfants</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/datatables.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
index 370d2c2..5cf104c 100644 (file)
@@ -6,7 +6,9 @@
 
   <title>Crèche</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <!--<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">-->
   <link href="../../../oldvendor/css/datatables.min.css" rel="stylesheet" type="text/css">
index 9c3fbb8..35e53f6 100644 (file)
@@ -6,7 +6,9 @@
   
   <title>Présences par jour</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <!--<link href="css/glyphicons-bootstrap.css" rel="stylesheet">-->
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/datatables.min.css" rel="stylesheet" type="text/css">
index b9771fe..9e59a68 100644 (file)
@@ -6,7 +6,9 @@
   
   <title>Présences par semaine</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <!--<link href="css/glyphicons-bootstrap.css" rel="stylesheet">-->
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/datatables.min.css" rel="stylesheet" type="text/css">
index 154787d..77fd2ba 100644 (file)
@@ -6,7 +6,9 @@
 
   <title>Employé(e)</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <link href="../../../vendor/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css">
index 41f9ebc..2a525ea 100644 (file)
@@ -434,7 +434,8 @@ function save_vacancy() {
   } else {
       savesql = "UPDATE vacancycalendar SET vacyear=" + encodeparam(evsvdata.datefrom, 'year') + ", datefrom = date("+encodeparam(evsvdata.datefrom, 'date')+"), dateto = date("+encodeparam(evsvdata.dateto, 'date')+"), timefrom = "+encodeparam(evsvdata.timefrom, 'text')+", timeto = strftime(\"%H:%M\",time("+encodeparam(evsvdata.timefrom, 'text')+",'+"+evsvdata.hours+" hours')), description = "+encodeparam(evsvdata.description, 'text')+", staffuuid = "+encodeparam(evsvdata.staffuuid, 'text')+", type = "+evsvdata.type+" WHERE uuid = '"+evsvdata.uuid+"';";
   }
-  
+  // console.log("save vacancy");
+  // console.log(savesql);
   parent.appdb.dbexec(savesql);
   load_table_vacancy();
 
index ea68cd1..1a266e2 100644 (file)
@@ -6,7 +6,9 @@
 
   <title>StaffList</title>
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <meta http-equiv="Expires" content="0" />
   <link href="../../../oldvendor/css/bootstrap.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/datatables.min.css" rel="stylesheet" type="text/css">
   <link href="../../../oldvendor/css/dataTables.bootstrap.min.css" rel="stylesheet" type="text/css">
index 6ca80ce..6b2874d 100644 (file)
@@ -4,6 +4,9 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <meta name="generator" content="Own DKS Generator" />
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link rel="apple-touch-icon" sizes="57x57" href="img/favicon/apple-touch-icon-57x57.png">
   <link rel="apple-touch-icon" sizes="60x60" href="img/favicon/apple-touch-icon-60x60.png">
   <link rel="apple-touch-icon" sizes="72x72" href="img/favicon/apple-touch-icon-72x72.png">
diff --git a/apps/tmpl/skeleton/error.tt b/apps/tmpl/skeleton/error.tt
new file mode 100644 (file)
index 0000000..5301a1b
--- /dev/null
@@ -0,0 +1,61 @@
+<!doctype html>
+<html lang="en">
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <meta name="generator" content="Own DKS Generator" />
+  <link rel="apple-touch-icon" sizes="57x57" href="[% abspath %]img/favicon/apple-touch-icon-57x57.png">
+  <link rel="apple-touch-icon" sizes="60x60" href="[% abspath %]img/favicon/apple-touch-icon-60x60.png">
+  <link rel="apple-touch-icon" sizes="72x72" href="[% abspath %]img/favicon/apple-touch-icon-72x72.png">
+  <link rel="apple-touch-icon" sizes="76x76" href="[% abspath %]img/favicon/apple-touch-icon-76x76.png">
+  <link rel="apple-touch-icon" sizes="114x114" href="[% abspath %]img/favicon/apple-touch-icon-114x114.png">
+  <link rel="apple-touch-icon" sizes="120x120" href="[% abspath %]img/favicon/apple-touch-icon-120x120.png">
+  <link rel="apple-touch-icon" sizes="144x144" href="[% abspath %]img/favicon/apple-touch-icon-144x144.png">
+  <link rel="apple-touch-icon" sizes="152x152" href="[% abspath %]img/favicon/apple-touch-icon-152x152.png">
+  <link rel="apple-touch-icon" sizes="180x180" href="[% abspath %]img/favicon/apple-touch-icon-180x180.png">
+  <link rel="icon" type="image/png" href="[% abspath %]img/favicon/favicon-32x32.png" sizes="32x32">
+  <link rel="icon" type="image/png" href="[% abspath %]img/favicon/android-chrome-192x192.png" sizes="192x192">
+  <link rel="icon" type="image/png" href="[% abspath %]imgfavicon/favicon-96x96.png" sizes="96x96">
+  <link rel="icon" type="image/png" href="[% abspath %]img/favicon/favicon-16x16.png" sizes="16x16">
+  <meta name="theme-color" content="#ffffff">
+  <link rel="stylesheet" href="[% abspath %]vendor/bootstrap/css/bootstrap.min.css" >
+  <link rel="stylesheet" href="[% abspath %]css/apps.css" >
+  <link rel="stylesheet" href="[% abspath %]vendor/fontawesome/css/all.min.css" >
+  <link rel="stylesheet" href="[% abspath %]css/shop.css" >
+  <!-- <link rel="stylesheet" href="css/site.css" > -->
+    <title>DKS - Apps</title>
+  </head>
+  <body>
+    <nav class="navbar fixed-top navbar-expand-lg navbar-light bg-topbar">
+      <a class="navbar-brand" href="index.html">
+      <img src="[% abspath %]img/dks_logo.png" alt="dks" style="height:40px; width: 92px;"/>
+      </a>
+      <div class="mr-auto" style="line-height: 14px;">
+        <span style="color: #fff; font-size: 16px;font-weight: bold; font-variant: small-caps;">Database<br/>Knowledge<br/>Solutions</span>    
+      </div>
+      <div class="collapse navbar-collapse" id="navbarNavDropdown" style="padding-left: 50px;">
+      
+        
+    </div>
+    </nav>
+    <div class="container main">
+      <hr>
+    <br/>
+    
+    <div class="container">
+        <h3 class="h3">ERROR</h3>
+        <div class="row">
+        <p class="lead">This Page does not exist!</p><br/>
+        <p class="lead">Diese Seite existiert nicht!</p><br/>
+        <p class="lead">Cette Page n'existe pas!</p><br/>
+    </div>
+    
+    
+    
+    <hr>
+    </div>
+    <script src="[% abspath %]vendor/jquery/jquery.min.js"></script>
+    <script src="[% abspath %]vendor/bootstrap/js/bootstrap.bundle.min.js" ></script>
+    <script src="[% abspath %]js/apps.js"></script>
+</body>
+</html>
\ No newline at end of file
index 44a89b7..6c61b69 100644 (file)
@@ -4,6 +4,9 @@
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
     <meta name="generator" content="Own DKS Generator" />
+    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
   <link rel="apple-touch-icon" sizes="57x57" href="[% abspath %]img/favicon/apple-touch-icon-57x57.png">
   <link rel="apple-touch-icon" sizes="60x60" href="[% abspath %]img/favicon/apple-touch-icon-60x60.png">
   <link rel="apple-touch-icon" sizes="72x72" href="[% abspath %]img/favicon/apple-touch-icon-72x72.png">
index e050b18..d49ce90 100644 (file)
@@ -5,10 +5,13 @@
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
   <title>DKS - Apps - Login</title>
-  <link rel="stylesheet" href="vendors/mdi/css/materialdesignicons.min.css">
-  <link rel="stylesheet" href="vendors/base/vendor.bundle.base.css">
-  <link rel="stylesheet" href="css/style.css">
-  <link rel="shortcut icon" href="images/favicon.png" />
+  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
+<meta http-equiv="Pragma" content="no-cache" />
+<meta http-equiv="Expires" content="0" />
+  <link rel="stylesheet" href="[% abspath %]vendors/mdi/css/materialdesignicons.min.css">
+  <link rel="stylesheet" href="[% abspath %]vendors/base/vendor.bundle.base.css">
+  <link rel="stylesheet" href="[% abspath %]css/style.css">
+  <link rel="shortcut icon" href="[% abspath %]images/favicon.png" />
 </head>
 
 <body>
@@ -19,7 +22,7 @@
           <div class="col-lg-6 d-flex align-items-center justify-content-center">
             <div class="auth-form-transparent text-left p-3">
                 <div class="brand-logo">
-                    <img src="images/toplogo.svg" style="width: 300px;" alt="logo">
+                    <img src="[% abspath %]images/toplogo.svg" style="width: 300px;" alt="logo">
                 </div>
               <h4>Bienvenue de retour!</h4>
               <h6 class="font-weight-light">Nous sommes content de vous revoir!</h6>
@@ -60,7 +63,7 @@
           </div>
           <div class="register-half-bg col-lg-6 d-flex align-items-center justify-content-center">
               <div class="brand-logo">
-                  <img src="images/logo.svg" style="width: 300px;" alt="logo">
+                  <img src="[% abspath %]images/logo.svg" style="width: 300px;" alt="logo">
                 </div>
             
           </div>
index da4ead7..5730c76 100644 (file)
--- a/index.cgi
+++ b/index.cgi
@@ -48,4 +48,7 @@ my $skl = dirname($page);
 print $cgi->header(-status=>$status, -type=>'text/html', -charset=>"utf-8");
 
 $template->process("skeleton/index.tt",$vars) || die "Template process failed X: ", $template->error(), "\n";
+# for my $e ( keys %ENV ) {
+#    print "$e: ".$ENV{$e}."<br/>";
+# }