v20191203
authorkilian (ksmachome) <ksaffran@dks.lu>
Wed, 4 Dec 2019 09:42:59 +0000 (10:42 +0100)
committerkilian (ksmachome) <ksaffran@dks.lu>
Wed, 4 Dec 2019 09:42:59 +0000 (10:42 +0100)
15 files changed:
.vscode/settings.json [new file with mode: 0644]
backoffice/api/db.cgi
backoffice/api/file.cgi
backoffice/api/index.cgi
backoffice/api/upload.cgi
backoffice/index.cgi
backoffice/tmpl/module/companies/index.js
backoffice/tmpl/module/planning/index.js [new file with mode: 0644]
backoffice/tmpl/module/planning/index.tt [new file with mode: 0644]
backoffice/tmpl/module/sites/index.js [new file with mode: 0644]
backoffice/tmpl/module/sites/index.tt [new file with mode: 0644]
backoffice/tmpl/module/staff/index.js [new file with mode: 0644]
backoffice/tmpl/module/staff/index.tt [new file with mode: 0644]
backoffice/tmpl/skeleton/index.tt
index.cgi

diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644 (file)
index 0000000..d1b19e1
--- /dev/null
@@ -0,0 +1,3 @@
+{
+  "pretty-formatter.formatting": false
+}
\ No newline at end of file
index 5e52949..c913387 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl
 use strict;
 use lib ('./lib/perl5');
 use lib ('./lib');
index 33d3bee..f0af54d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl
 
 use strict;
 use lib ('./lib/perl5');
index 833a85d..619b1ac 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl
 use strict;
 use lib ('./lib/perl5');
 use lib ('./lib');
index 47c62fb..194fca8 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl
 
 use strict;
 use lib ('./lib/perl5');
index 91b7ce8..69ca671 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl
 
 use strict;
 use lib ('api/lib/perl5');
index 8abcef9..fa6309a 100644 (file)
 var tbl = null;
 [% sid = session.id %]
-[% IF (session.usergroups.search('admin') != 1) %]
+[% IF(session.usergroups.search('admin') != 1) %]
 [% qcompany = dksdb.query("select id_company from vw_userlist where id=$sid;") %]
 [% company = qcompany.get_all() %]
-var idcompany = "[% company.0.id_company %]"; 
+var idcompany = "[% company.0.id_company %]";
 [% ELSE %]
-var idcompany=null;  
+var idcompany = null;
 [% END %]
 //var choice = {"submissionaccess":{"projects":null,"cdm":null,"cdm_requests":null}};
 var tab_id_projects = null;
 var tab_id_cdms = null;
 var tab_id_cdm_requests = null;
-function initpage(){
-  [% IF (session.usergroups.search('admin') == 1) %]
-  // choice["submissionaccess"]["projects"] = new Choices('#projects',{
-  //   searchEnabled: false,
-  //   itemSelectText: 'sélectionner...',
-  //   removeItemButton: true,
-  //   choices : []
-  // });
-  
-  // choice["submissionaccess"]["cdm"] = new Choices('#cdm',{
-  //   searchEnabled: false,
-  //   itemSelectText: 'sélectionner...',
-  //   removeItemButton: true,
-  //   choices : []
-  // });
-  // [% END %]
-  // choice["submissionaccess"]["cdm_requests"] = new Choices('#cdm_requests',{
-  //   searchEnabled: false,
-  //   itemSelectText: 'sélectionner...',
-  //   removeItemButton: true,
-  //   choices : []
-  // });
-  getprojects();
-  getcdms();
-  [% IF (session.usergroups.search('admin') == 1) %]
-  tbl = new Tabulator("#tbl_companies", {
-    headerFilterPlaceholder:"filter...",
-    height: "95vh",
-    layout:"fitDataFill",
-    selectable:1,
-    responsiveLayout:"collapse",
-    columns:[
-    {title:"entreprise", field:"company",headerFilter:"input"},  
-    {title:"address", field:"address",headerFilter:"input"},
-    {title:"nbr. utilsateurs",field:"num_members"},
-    {title:"pointeuese",field:"num_timeclocks"},
-    ]});
-  gettbldata();
-
-  [% ELSE %]
-  getcompanydata(idcompany);  
-  [% END %]
-  
-  
-}
-[% IF (session.usergroups.search('admin') == 1) %]
-function gettbldata(){
-  req.reqdata("POST","db.cgi",{"get":"companylist"},loadtbldata);
-  
-}
 
-function loadtbldata(data){
-  if (data && data.sqldata){
-    tbl.setData(data.sqldata);
-  }
-}
+function initpage() {
+    [% IF(session.usergroups.search('admin') == 1) %]
+    // choice["submissionaccess"]["projects"] = new Choices('#projects',{
+    //   searchEnabled: false,
+    //   itemSelectText: 'sélectionner...',
+    //   removeItemButton: true,
+    //   choices : []
+    // });
+
+    // choice["submissionaccess"]["cdm"] = new Choices('#cdm',{
+    //   searchEnabled: false,
+    //   itemSelectText: 'sélectionner...',
+    //   removeItemButton: true,
+    //   choices : []
+    // });
+    // [% END %]
+    // choice["submissionaccess"]["cdm_requests"] = new Choices('#cdm_requests',{
+    //   searchEnabled: false,
+    //   itemSelectText: 'sélectionner...',
+    //   removeItemButton: true,
+    //   choices : []
+    // });
+    //getprojects();
+    //getcdms();
+    [% IF(session.usergroups.search('admin') == 1) %]
+    tbl = new Tabulator("#tbl_companies", {
+        headerFilterPlaceholder: "filter...",
+        height: "95vh",
+        layout: "fitDataFill",
+        selectable: 1,
+        responsiveLayout: "collapse",
+        columns: [{
+            title: "entreprise",
+            field: "company",
+            headerFilter: "input"
+        }, {
+            title: "address",
+            field: "address",
+            headerFilter: "input"
+        }, {
+            title: "cp",
+            field: "zip",
+            headerFilter: "input"
+        }, {
+            title: "ville",
+            field: "city",
+            headerFilter: "input"
+        }, {
+            title: "pays",
+            field: "country",
+            headerFilter: "input"
+        }]
+    });
+    gettbldata();
+
+    [% ELSE %]
+    getcompanydata(idcompany);
+    [% END %]
+
 
-function edit(){
-  var udata = tbl.getSelectedData();
-  if (udata[0]){
-    var uid = udata[0].id;
-    getcompanydata(uid);
-    document.getElementById("pnl_table").style.display = 'none';
-    document.getElementById("pnl_company").style.display = 'block';
-  }
-  
 }
+[% IF(session.usergroups.search('admin') == 1) %]
+
+function gettbldata() {
+    req.reqdata("POST", "db.cgi", {
+        "get": "companylist"
+    }, loadtbldata);
 
-function add(){
-  cleanform('companies');
-  viewtable();
 }
 
-function remove(){
-  var udata = tbl.getSelectedData();
-  if (udata[0]){
-    if (confirm("Êtes vous sûre de supprimer l'entreprise selectionné?")){
-      req.reqdata("POST","db.cgi",{"del":"1","ident_companies_id":udata[0].id},gettbldata);
+function loadtbldata(data) {
+    if (data && data.sqldata) {
+        tbl.setData(data.sqldata);
     }
-  }
-  
 }
-[% END %]
 
+function edit() {
+    var udata = tbl.getSelectedData();
+    if (udata[0]) {
+        var uid = udata[0].id;
+        getcompanydata(uid);
+        document.getElementById("pnl_table").style.display = 'none';
+        document.getElementById("pnl_company").style.display = 'block';
+    }
 
-function getcompanydata(id){
-  req.reqdata("POST","db.cgi",{"get":"companydata","filter":"id=" + id},fillformcompany);
-  //req.reqdata("POST","db.cgi",{"get":"submissionaccess","filter":"id_company=" + id},fillsubmissionaccess);
 }
 
-
-function fillsubmissionaccess(data){
-  console.log("FILL Submission Access!");
-  console.log(data);
-  cleanform('submissionaccess');
-  if (data && data.sqldata){
-    //var frm = document.querySelectorAll('.data_submissionaccess');
-    fillformbydataclass('submissionaccess',data.sqldata[0],false);
-    
-  }
+function add() {
+    cleanform('companies');
+    viewtable();
 }
 
-function fillformcompany(data){
-  // console.log(data);
-  cleanform('companies');
-  var isreadonly = false;
-  [% IF (session.usergroups.search('admin') != 1) %]
-  if (data.sqldata[0]["validated"] == 1){isreadonly = true;} 
-  [% END %]
-  if (data && data.sqldata){
-    fillformbydataclass('companies',data.sqldata[0],isreadonly);
-  }
-  if (isreadonly == true){
-    document.getElementById("btnsave_companies").style.display = 'none';
-  }
-}
+function remove() {
+    var udata = tbl.getSelectedData();
+    if (udata[0]) {
+        if (confirm("Êtes vous sûre de supprimer l'entreprise selectionné?")) {
+            req.reqdata("POST", "db.cgi", {
+                "del": "1",
+                "ident_companies_id": udata[0].id
+            }, gettbldata);
+        }
+    }
 
-function viewtable(){
-  gettbldata();
-  document.getElementById("pnl_table").style.display = 'block';
-  document.getElementById("pnl_company").style.display = 'none';
 }
+[% END %]
 
-[% IF (session.usergroups.search('admin') == 1) %]
-function getprojects(){
-  req.reqdata("POST","db.cgi",{"get":"projectlist"},fillprojectlist);
-}
 
-function fillprojectlist(data){
-  console.log("fill projectlist");
-  fillselectlist(choice["submissionaccess"]["projects"],data.sqldata,'id','project');
-  return false;
+function getcompanydata(id) {
+    req.reqdata("POST", "db.cgi", {
+        "get": "companydata",
+        "filter": "id=" + id
+    }, fillformcompany);
+    //req.reqdata("POST","db.cgi",{"get":"submissionaccess","filter":"id_company=" + id},fillsubmissionaccess);
 }
 
-[% END %]
 
-function getcdms(){
-  req.reqdata("POST","db.cgi",{"get":"cdmlist"},fillcdmlist);
+// function fillsubmissionaccess(data){
+//   console.log("FILL Submission Access!");
+//   console.log(data);
+//   cleanform('submissionaccess');
+//   if (data && data.sqldata){
+//     //var frm = document.querySelectorAll('.data_submissionaccess');
+//     fillformbydataclass('submissionaccess',data.sqldata[0],false);
+
+//   }
+// }
+
+function fillformcompany(data) {
+    // console.log(data);
+    cleanform('companies');
+    var isreadonly = false;
+    [% IF(session.usergroups.search('admin') != 1) %]
+    if (data.sqldata[0]["validated"] == 1) {
+        isreadonly = true;
+    }
+    [% END %]
+    if (data && data.sqldata) {
+        fillformbydataclass('companies', data.sqldata[0], isreadonly);
+    }
+    if (isreadonly == true) {
+        document.getElementById("btnsave_companies").style.display = 'none';
+    }
+}
+
+function viewtable() {
+    gettbldata();
+    document.getElementById("pnl_table").style.display = 'block';
+    document.getElementById("pnl_company").style.display = 'none';
 }
 
-function fillcdmlist(data){
-  console.log("fill cdmlist");
-  fillselectlist(choice["submissionaccess"]["cdm_requests"],data.sqldata,'id','cdm');
-  //var cdmlist = [];
-  [% IF (session.usergroups.search('admin') == 1) %]
-  fillselectlist(choice["submissionaccess"]["cdm"],data.sqldata,'id','cdm');
-  //choice["submissionaccess"]["cdm"].clearStore();
-  [% END %]
-
-  return false;
-}
\ No newline at end of file
+//[% IF(session.usergroups.search('admin') == 1) %]
+// function getprojects(){
+//   req.reqdata("POST","db.cgi",{"get":"projectlist"},fillprojectlist);
+// }
+
+// function fillprojectlist(data){
+//   console.log("fill projectlist");
+//   fillselectlist(choice["submissionaccess"]["projects"],data.sqldata,'id','project');
+//   return false;
+// }
+
+//[% END %]
+
+// function getcdms(){
+//   req.reqdata("POST","db.cgi",{"get":"cdmlist"},fillcdmlist);
+// }
+
+// function fillcdmlist(data){
+//   console.log("fill cdmlist");
+//   fillselectlist(choice["submissionaccess"]["cdm_requests"],data.sqldata,'id','cdm');
+//   //var cdmlist = [];
+//   [% IF (session.usergroups.search('admin') == 1) %]
+//   fillselectlist(choice["submissionaccess"]["cdm"],data.sqldata,'id','cdm');
+//   //choice["submissionaccess"]["cdm"].clearStore();
+//   [% END %]
+
+//   return false;
+// }
\ No newline at end of file
diff --git a/backoffice/tmpl/module/planning/index.js b/backoffice/tmpl/module/planning/index.js
new file mode 100644 (file)
index 0000000..5929632
--- /dev/null
@@ -0,0 +1,4 @@
+var tbl_planning = null;
+function initpage() {
+  
+}
\ No newline at end of file
diff --git a/backoffice/tmpl/module/planning/index.tt b/backoffice/tmpl/module/planning/index.tt
new file mode 100644 (file)
index 0000000..03211b3
--- /dev/null
@@ -0,0 +1,15 @@
+<div class="w3-top w3-border-bottom w3-white">
+<div class="w3-bar">
+    <!--<button class="w3-bar-item w3-button w3-border w3-blue-grey" onclick="viewtable();"><img src="[% abspath%]img/icons/company_white.svg" style="height: 24px;"/>Entreprises</button>-->
+    <!--<button class="w3-bar-item w3-button w3-border w3-right w3-orange" onclick="xlsxexport(); return false;"><img src="[% abspath%]img/icons/excel_white.svg" style="height: 24px;"/></button>
+    <button class="w3-bar-item w3-button w3-border w3-right w3-orange" onclick="pdfexport(); return false;"><img src="[% abspath%]img/icons/pdf_white.svg" style="height: 24px;"/></button>-->
+    
+    <!--<button class="w3-bar-item w3-button w3-border w3-right w3-red" onclick="remove();"><img src="[% abspath%]img/icons/remove_white.svg" style="height: 24px;"/></button>
+    <button class="w3-bar-item w3-button w3-border w3-right w3-blue-grey" onclick="edit();"><img src="[% abspath%]img/icons/edit_white.svg" style="height: 24px;"/></button>
+    <button class="w3-bar-item w3-button w3-border w3-right w3-blue-grey" onclick="add();"><img src="[% abspath%]img/icons/plus_white.svg" style="height: 24px;"/></button> -->
+    
+</div>
+</div>
+<div id="pnl_table" class="w3-display-container" style="margin-top: 50px;">
+<div id="tbl_planning"></div>
+</div>
\ No newline at end of file
diff --git a/backoffice/tmpl/module/sites/index.js b/backoffice/tmpl/module/sites/index.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/backoffice/tmpl/module/sites/index.tt b/backoffice/tmpl/module/sites/index.tt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/backoffice/tmpl/module/staff/index.js b/backoffice/tmpl/module/staff/index.js
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/backoffice/tmpl/module/staff/index.tt b/backoffice/tmpl/module/staff/index.tt
new file mode 100644 (file)
index 0000000..e69de29
index 8b347c2..282dc68 100644 (file)
@@ -1,5 +1,5 @@
 [% USE dksdb = DBI(dsn, dbuser, dbpassword) %] [% appgaccess = dksdb.prepare("select ap.icon,ap.app,ap.name,ug.usergroup from useringroups uig join apps ap on (uig.id_group=ap.id_usergroup) join usergroups ug on (uig.id_group=ug.id) where uig.id_user=?
- group by ap.id,ug.id order by ap.sort;")%] 
+group by ap.id,ug.id order by ap.sort;")%]
 <!DOCTYPE html>
 <html lang="en">
 [% INCLUDE block/head.tt %]
     </div>
     <nav class="w3-sidebar w3-collapse w3-theme-light w3-animate-left" id="mySidebar" style="z-index:3;width:200px; padding-top: 35px;">
         <div class="w3-bar-block">
-            <a class="w3-bar-item w3-button w3-padding-16 w3-hide-large w3-dark-grey w3-hover-black" href="#" onclick="w3_close()" title="close menu">Close Menu</a>
-            <a class="w3-bar-item w3-button w3-padding-16 w3-dark-grey w3-hover-black" href="#" onclick="" title="close menu">Logout</a>[% FOREACH ap = appgaccess.execute(session.id) %]
+            <a class="w3-bar-item w3-button w3-padding-16 w3-hide-large w3-dark-grey w3-hover-black" href="javascript:w3_close();" title="close menu">Close Menu</a>
+            <a class="w3-bar-item w3-button w3-padding-16 w3-dark-grey w3-hover-black" href="javascript:admin.logout();" title="Logout">Logout</a> [% FOREACH ap = appgaccess.execute(session.id) %]
             <a href="javascript:admin.loadpage('module/[% ap.app %]/index.html','[% ap.name %]');" class="w3-bar-item w3-button w3-padding">
                 <img src="[% abspath %]img/icons/[% ap.icon %]" style="width: 24px;">&nbsp;[% ap.name %]
             </a>
             [% END %]
-            
+
         </div>
     </nav>
     <div class="w3-overlay w3-hide-large w3-animate-opacity" id="myOverlay" onclick="w3_close()" style="cursor:pointer" title="close side menu"></div>
index 38180d8..81e5075 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/Users/kilian/perl5/perlbrew/perls/perl-5.24.1/bin/perl
 
 use strict;
 use lib ('backoffice/api/lib/perl5');