From: Kilian Saffran Date: Tue, 14 May 2019 13:04:18 +0000 (+0200) Subject: refresh updates and staff inactive X-Git-Url: http://cloud.dks.lu/git/?a=commitdiff_plain;h=5c431d0e83010c5bebbb496087630564208b01dd;p=dks_lu.git refresh updates and staff inactive --- diff --git a/apps/api/lib/pgsql.pm b/apps/api/lib/pgsql.pm index e36a77c..8d0b622 100644 --- a/apps/api/lib/pgsql.pm +++ b/apps/api/lib/pgsql.pm @@ -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; } diff --git a/apps/data/db/underatert.sqlite b/apps/data/db/underatert.sqlite index e1a9931..be78aee 100644 Binary files a/apps/data/db/underatert.sqlite and b/apps/data/db/underatert.sqlite differ diff --git a/apps/index.cgi b/apps/index.cgi index 5a0d4c5..0937d10 100644 --- a/apps/index.cgi +++ b/apps/index.cgi @@ -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}
"; -# } +# print '/*'; +# # for my $e ( keys %ENV ) { +# # print "$e: ".$ENV{$e}."
"; +# # } +# print Dumper($vars); +# print scalar(@lv); +# print '*/'; diff --git a/apps/js/apps.js b/apps/js/apps.js index 0a72d71..0c50f42 100644 --- a/apps/js/apps.js +++ b/apps/js/apps.js @@ -1,6 +1,5 @@ -var https ='http'; function logout() { - myurl = https + '://'+ location.host + '/apps/'; + var myurl = location.href; $.ajax({ async: false, url: myurl, diff --git a/apps/tmpl/creorga/index.tt b/apps/tmpl/creorga/index.tt index c582742..2141a43 100644 --- a/apps/tmpl/creorga/index.tt +++ b/apps/tmpl/creorga/index.tt @@ -5,6 +5,9 @@ + + + Creorga diff --git a/apps/tmpl/creorga/modules/calendar/calorganisation.tt b/apps/tmpl/creorga/modules/calendar/calorganisation.tt index 598030b..70d07bd 100644 --- a/apps/tmpl/creorga/modules/calendar/calorganisation.tt +++ b/apps/tmpl/creorga/modules/calendar/calorganisation.tt @@ -4,7 +4,9 @@ Organisation Personnel - + + + diff --git a/apps/tmpl/creorga/modules/calendar/calvacancy.tt b/apps/tmpl/creorga/modules/calendar/calvacancy.tt index 6871dff..7fbec8b 100644 --- a/apps/tmpl/creorga/modules/calendar/calvacancy.tt +++ b/apps/tmpl/creorga/modules/calendar/calvacancy.tt @@ -4,7 +4,9 @@ Congé - + + + diff --git a/apps/tmpl/creorga/modules/calendar/index.tt b/apps/tmpl/creorga/modules/calendar/index.tt index 26231a8..70611cf 100644 --- a/apps/tmpl/creorga/modules/calendar/index.tt +++ b/apps/tmpl/creorga/modules/calendar/index.tt @@ -3,10 +3,12 @@ - + Organisation Enfants - + + + diff --git a/apps/tmpl/creorga/modules/calendar/js/calvacancy.js b/apps/tmpl/creorga/modules/calendar/js/calvacancy.js index c8a6351..8575faf 100644 --- a/apps/tmpl/creorga/modules/calendar/js/calvacancy.js +++ b/apps/tmpl/creorga/modules/calendar/js/calvacancy.js @@ -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; diff --git a/apps/tmpl/creorga/modules/childs/child.tt b/apps/tmpl/creorga/modules/childs/child.tt index 56e26b1..64f1643 100644 --- a/apps/tmpl/creorga/modules/childs/child.tt +++ b/apps/tmpl/creorga/modules/childs/child.tt @@ -6,6 +6,9 @@ Détails - Enfant + + + diff --git a/apps/tmpl/creorga/modules/childs/index.tt b/apps/tmpl/creorga/modules/childs/index.tt index 90658ac..9b65dca 100644 --- a/apps/tmpl/creorga/modules/childs/index.tt +++ b/apps/tmpl/creorga/modules/childs/index.tt @@ -6,7 +6,9 @@ Enfants - + + + diff --git a/apps/tmpl/creorga/modules/creche/creche.tt b/apps/tmpl/creorga/modules/creche/creche.tt index 370d2c2..5cf104c 100644 --- a/apps/tmpl/creorga/modules/creche/creche.tt +++ b/apps/tmpl/creorga/modules/creche/creche.tt @@ -6,7 +6,9 @@ Crèche - + + + diff --git a/apps/tmpl/creorga/modules/presences/dailypresences.tt b/apps/tmpl/creorga/modules/presences/dailypresences.tt index 9c3fbb8..35e53f6 100644 --- a/apps/tmpl/creorga/modules/presences/dailypresences.tt +++ b/apps/tmpl/creorga/modules/presences/dailypresences.tt @@ -6,7 +6,9 @@ Présences par jour - + + + diff --git a/apps/tmpl/creorga/modules/presences/weeklypresences.tt b/apps/tmpl/creorga/modules/presences/weeklypresences.tt index b9771fe..9e59a68 100644 --- a/apps/tmpl/creorga/modules/presences/weeklypresences.tt +++ b/apps/tmpl/creorga/modules/presences/weeklypresences.tt @@ -6,7 +6,9 @@ Présences par semaine - + + + diff --git a/apps/tmpl/creorga/modules/staff/coworker.tt b/apps/tmpl/creorga/modules/staff/coworker.tt index 154787d..77fd2ba 100644 --- a/apps/tmpl/creorga/modules/staff/coworker.tt +++ b/apps/tmpl/creorga/modules/staff/coworker.tt @@ -6,7 +6,9 @@ Employé(e) - + + + diff --git a/apps/tmpl/creorga/modules/staff/js/coworker.js b/apps/tmpl/creorga/modules/staff/js/coworker.js index 41f9ebc..2a525ea 100644 --- a/apps/tmpl/creorga/modules/staff/js/coworker.js +++ b/apps/tmpl/creorga/modules/staff/js/coworker.js @@ -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(); diff --git a/apps/tmpl/creorga/modules/staff/stafflist.tt b/apps/tmpl/creorga/modules/staff/stafflist.tt index ea68cd1..1a266e2 100644 --- a/apps/tmpl/creorga/modules/staff/stafflist.tt +++ b/apps/tmpl/creorga/modules/staff/stafflist.tt @@ -6,7 +6,9 @@ StaffList - + + + diff --git a/apps/tmpl/skeleton/browser.tt b/apps/tmpl/skeleton/browser.tt index 6ca80ce..6b2874d 100644 --- a/apps/tmpl/skeleton/browser.tt +++ b/apps/tmpl/skeleton/browser.tt @@ -4,6 +4,9 @@ + + + diff --git a/apps/tmpl/skeleton/error.tt b/apps/tmpl/skeleton/error.tt new file mode 100644 index 0000000..5301a1b --- /dev/null +++ b/apps/tmpl/skeleton/error.tt @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + DKS - Apps + + + +
+
+
+ +
+

ERROR

+
+

This Page does not exist!


+

Diese Seite existiert nicht!


+

Cette Page n'existe pas!


+
+ + + +
+
+ + + + + \ No newline at end of file diff --git a/apps/tmpl/skeleton/index.tt b/apps/tmpl/skeleton/index.tt index 44a89b7..6c61b69 100644 --- a/apps/tmpl/skeleton/index.tt +++ b/apps/tmpl/skeleton/index.tt @@ -4,6 +4,9 @@ + + + diff --git a/apps/tmpl/skeleton/login.tt b/apps/tmpl/skeleton/login.tt index e050b18..d49ce90 100644 --- a/apps/tmpl/skeleton/login.tt +++ b/apps/tmpl/skeleton/login.tt @@ -5,10 +5,13 @@ DKS - Apps - Login - - - - + + + + + + + @@ -19,7 +22,7 @@

Bienvenue de retour!

Nous sommes content de vous revoir!
@@ -60,7 +63,7 @@
diff --git a/index.cgi b/index.cgi index da4ead7..5730c76 100644 --- 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}."
"; +# }