From 012d5f911dc6f0e5a64f9cebad9aeeebaa50ef27 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Sat, 23 Jan 2021 13:07:59 +0000
Subject: [PATCH] Bedienoberflaeche komplett nach ui2 ueberfuehrt, Bootstrap und FontAwesome komplett ausgebaut

---
 web/ui2/js/app.js                                      |   44 ++++++++++++++++++++++
 web/ui2/data/menu/misc.json                            |    4 +-
 src/java/de/uhilger/filecms/api/HtmlExportService.java |   14 ++++--
 3 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/src/java/de/uhilger/filecms/api/HtmlExportService.java b/src/java/de/uhilger/filecms/api/HtmlExportService.java
index 9dbee4a..8f03618 100644
--- a/src/java/de/uhilger/filecms/api/HtmlExportService.java
+++ b/src/java/de/uhilger/filecms/api/HtmlExportService.java
@@ -43,6 +43,8 @@
   
   private static final Logger logger = Logger.getLogger(HtmlExportService.class.getName());
   
+  public static final String WBX_APPS_DIR = "wbx.apps";
+  
   /**
    * Den Inhalt eines Ordners als HTML exportieren
    * 
@@ -121,8 +123,9 @@
         }
       }
     }
-    File catalinaBase = new File(getCatalinaBase(getServletContext()));
-    File bsDir = new File(catalinaBase, "webapps/jslib/bootstrap/css/");
+    //File catalinaBase = new File(getCatalinaBase(getServletContext()));
+    File catalinaBase = new File(System.getProperty(WBX_APPS_DIR));
+    File bsDir = new File(catalinaBase, "jslib/bootstrap/css/");
     try {
       FileUtils.copyFile(new File(bsDir, "bootstrap.min.css"), new File(outDir, "bootstrap.min.css"), true);
       File stile = new File(dir, "stile.css");
@@ -131,13 +134,13 @@
       }
       buildThumbnailImages(outDir, new Bild());
       
-      File lbDir = new File(catalinaBase, "webapps/jslib/lightbox/");
+      File lbDir = new File(catalinaBase, "jslib/lightbox/");
       FileUtils.copyDirectoryToDirectory(lbDir, outDir);
       
-      File jqDir = new File(catalinaBase, "webapps/jslib/jquery/");
+      File jqDir = new File(catalinaBase, "jslib/jquery/");
       FileUtils.copyDirectoryToDirectory(jqDir, outDir);
       
-      File lbimgDir = new File(catalinaBase, "webapps/jslib/lightbox/img");
+      File lbimgDir = new File(catalinaBase, "jslib/lightbox/img");
       FileUtils.copyDirectoryToDirectory(lbimgDir, outDir);
       
       
@@ -262,6 +265,7 @@
   
   private void printHeader(PrintWriter out) throws IOException {
     out.print("<!DOCTYPE html><html><head>\r\n");
+    out.print("<meta charset=\"UTF-8\">\r\n");
     out.print("<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"/>");
     out.print("<link rel=\"stylesheet\" type=\"text/css\" href=\"bootstrap.min.css\">\r\n");
     out.print("<link rel=\"stylesheet\" type=\"text/css\" href=\"lightbox/lightbox.css\">\r\n");
diff --git a/web/ui2/data/menu/misc.json b/web/ui2/data/menu/misc.json
index 3a5b01b..fdef86d 100644
--- a/web/ui2/data/menu/misc.json
+++ b/web/ui2/data/menu/misc.json
@@ -10,7 +10,7 @@
       {
         "titel": "Ordner packen",
         "umenue": false,
-        "funktion": ""
+        "funktion": "app.fm_pack_folder"
       },
       {
         "titel": "Entpacken",
@@ -25,7 +25,7 @@
       {
         "titel": "Export HTML",
         "umenue": false,
-        "funktion": ""
+        "funktion": "app.fm_menu_html_export"
       },      
       {
         "titel": "",
diff --git a/web/ui2/js/app.js b/web/ui2/js/app.js
index 5817d1b..f28d721 100644
--- a/web/ui2/js/app.js
+++ b/web/ui2/js/app.js
@@ -783,6 +783,13 @@
   this.fm_menu_html_export = function() {
     self.fm_export_html();
   };
+  
+  this.sued_schliessen = function() {
+    var suedDiv = document.querySelector('.sued');
+    document.querySelector('.close-btn-fuss').removeEventListener('click', this);
+    suedDiv.classList.remove('sued-open');
+    suedDiv.style.height = '0';
+  };
 
   /* --------- Dateifunktionen Ende ---------- */
 
@@ -943,17 +950,54 @@
         //console.log(html);
         var elem = document.querySelector('.sued');
         elem.innerHTML = html;
+        document.querySelector('.close-btn-fuss').addEventListener('click', self.sued_schliessen);
+        
+        /*
         document.querySelector('.close-btn-fuss').addEventListener('click', function(){
           var suedDiv = document.querySelector('.sued');
           document.querySelector('.close-btn-fuss').removeEventListener('click', this);
           suedDiv.classList.remove('sued-open');
           suedDiv.style.height = '0';
         });
+        */
         self.fm_fusszeile_zeigen();
         self.fm_get_list(self.pfad);
       });
     });  
   };
+  
+  this.fm_pack_folder = function() {
+    //var liste = fm_gewaehlte_dateien();
+    var m = '?c=de.uhilger.filecms.api.FileMgr&m=packFolder&p=' + self.pfad;
+    var u = '../svc' + m;
+    self.fm_get(u, "text", function(resp) {
+      // console.log('deleteFiles gab folgendes zurueck: ' + resp);
+      self.fm_get_list(self.pfad);
+    });
+  };  
+  
+  this.fm_export_html = function() {
+    var m = '?c=de.uhilger.filecms.api.HtmlExportService&m=exportHtml';
+    m = m + '&p=' + self.pfad; 
+    var u = '../svc' + m;
+    self.fm_get(u, "text", function(resp) {
+      var mtx = new Meldung('Rueckmeldung vom HTML-Export: ' + resp);
+      //console.log(mtx);
+      self.html_erzeugen("data/tpl/fuss.tpl", mtx, function(html) {
+        var elem = document.querySelector('.sued');
+        elem.innerHTML = html;
+        document.querySelector('.close-btn-fuss').addEventListener('click', self.sued_schliessen);
+        self.fm_fusszeile_zeigen();
+        //self.fm_get_list(self.pfad);
+        /*
+        $('.system-out').empty();
+        $('.system-out').append('Rueckmeldung vom HTML-Export: ' + resp);
+        fm_fusszeile_zeigen();
+        */
+      });
+    });  
+  };
+  
 
   /* -------- upload ----------- */
 

--
Gitblit v1.9.3