From 03be8f4b788ea50c128bf34cb4ed49b2dc978e1d Mon Sep 17 00:00:00 2001
From: ulrich
Date: Tue, 19 Jan 2021 17:51:20 +0000
Subject: [PATCH] Menue-Teile auf das Hauptmenue uebertragen

---
 web/ui/ui.js |   88 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 77 insertions(+), 11 deletions(-)

diff --git a/web/ui/ui.js b/web/ui/ui.js
index 09ef609..41a006e 100644
--- a/web/ui/ui.js
+++ b/web/ui/ui.js
@@ -31,10 +31,12 @@
 var loc;
 var PERS_DIR = "Persoenlich";
 var PUB_DIR = "Oeffentlich";
+var DAV_DIR = "Austausch";
 var BASE_DIR = "$basis";
 var DATA_DIR = "$daten";
 var WWW_DIR = "www";
 var compilerIssues;
+var fm_slideshow = false;
 
 function fm_init() {
   $("#mce-editor").hide();
@@ -42,10 +44,12 @@
   $('.code-editor-container').hide();
   $('.sued').hide();
   //$('.ost').attr('flex-basis', 0);
+  $('#newTab').on('click', fm_newTab);
   $('#newTextFile').on('click', fm_menu_neue_textdatei);
   $('#newDoc').on('click', fm_menu_neues_dokument);
   $('#newFolder').on('click', fm_get_new_folder);
   $('#viewFile').on('click', fm_view_file);
+  $('#viewSlideshow').on('click', fm_view_slideshow);
   $('#editTextFile').on('click', function() {
     fm_get_file_content('text');
   });
@@ -56,33 +60,54 @@
   $('#saveFileAs').on('click', fm_menu_datei_speichern_unter);
   $('#closeFile').on('click', fm_menu_datei_schliessen);
   $('#renameFile').on('click', fm_menu_datei_umbenennen);
+  $('#m-zip').on('click', fm_menu_ordner_packen);
   $('#m-unzip').on('click', fm_menu_datei_entpacken);
+  $('#m-html-export').on('click', fm_menu_html_export);
   $('#m-del').on('click', fm_menu_delete);
   $('#m-cut').on('click', fm_menu_cut);
   $('#m-copy').on('click', fm_menu_copy);
   $('#m-paste').on('click', fm_menu_paste);
   $('#m-shrink').on('click', fm_menu_shrink);
+  $('#m-rotate').on('click', fm_menu_rotate);
+  $('#m-toggle-slideshow').on('click', fm_toggle_show_slideshow);
   $('#m-test').on('click', fm_menu_test);
   $('#m-test-2').on('click', fm_menu_compile);
   $('#m-test-3').on('click', fm_menu_compile_all);
   $('#m-compile-results').on('click', fm_fusszeile_zeigen);
   $('#m-build-app').on('click', fm_menu_build_app);
+  $('#m-ant-build').on('click', fm_menu_ant_build);
   $('#saveModal').on('hidden.bs.modal', function (e) {
     $('#modal_ok').attr('onclick','').unbind('click');
   });
   $('#logout').click(fm_logout);  
   $('#fusszeile-schliessen').on('click', fm_fusszeile_schliessen);
   fm_get_login();
-  fm_get_list('');
-  fm_init_uploader();
-  /*
-  console.log('href: ' + window.location.href);
-  console.log('host: ' + window.location.host);
-  console.log('hostname: ' + window.location.hostname);
-  console.log('port: ' + window.location.port);
-  console.log('protocol: ' + window.location.protocol);
-  */
+  var parsedUrl = new URL(window.location.href);
+  var wunschPfad = parsedUrl.searchParams.get("pfad");
+  
+  if(wunschPfad !== null && wunschPfad.length > 0) {
+    pfad = wunschPfad;
+    fm_get_list(wunschPfad);
+    fm_init_uploader();
+  } else {
+    fm_get_list('');
+    fm_init_uploader();
+  }
   loc = window.location.protocol + '//' + window.location.host;
+}
+
+function fm_newTab() {
+  window.open('/file-cms/ui/?pfad=' + pfad, '_blank');
+}
+
+function fm_toggle_show_slideshow() {
+  if(fm_slideshow) {
+    $('#m-toggle-slideshow').text('Diashow einschalten');
+    fm_slideshow = false;
+  } else {
+    $('#m-toggle-slideshow').text('Diashow ausschalten');
+    fm_slideshow = true;
+  }
 }
 
 function fm_resize_editor() {
@@ -115,6 +140,8 @@
     restdir = pfad.substr(BASE_DIR.length);
   } else if(pfad.indexOf(DATA_DIR) > -1) {
     restdir = pfad.substr(DATA_DIR.length);
+  } else if(pfad.indexOf(DAV_DIR) > -1) {
+    restdir = pfad.substr(DAV_DIR.length);
   }
   if(restdir !== undefined && restdir.startsWith('/')) {
     restdir = restdir.substr(1);
@@ -173,8 +200,8 @@
     selector: "textarea.text-editor",
     statusbar: false,
     menubar: false,
-    plugins: 'advlist charmap code image link lists media print preview save table textcolor importcss',
-    toolbar: 'undo redo | styleselect | image | link unlink | bullist numlist | outdent indent | code',
+    plugins: 'advlist charmap code image link lists media table print preview save table textcolor importcss',
+    toolbar: 'undo redo | styleselect | image table | link unlink | bullist numlist | outdent indent | code',
     /*
     menu: {
       file: {title: 'File', items: 'savevers | exit'},
@@ -298,6 +325,10 @@
   return liste;
 }
 
+function fm_menu_html_export() {
+  fm_export_html();
+}
+
 /* --------- Dateifunktionen Ende ---------- */
 
 function fm_menu_test() {
@@ -320,6 +351,10 @@
 
 function fm_menu_build_app() {
   fm_build_app();
+}
+
+function fm_menu_ant_build() {
+  fm_ant_build();
 }
 
 function fm_mark_compile_results_in_editor(resp) {
@@ -555,6 +590,25 @@
   window.open(path + '/' + fname, '_blank');
 }
 
+function fm_view_slideshow() {
+  
+  // https://localhost:8443/file-cms/fotos/?o=ulrich/bilder/diashow/ordnername
+
+  
+  var userid = $('#userMenu').text();
+  var gewaehlte = $('.datei-gewaehlt');
+  var fname = $(gewaehlte[0]).text();
+  
+  var path = fm_get_path(userid);
+  var restdir = path;
+  if(path.indexOf('/data/') > -1) {
+    restdir = path.substr('/data/'.length);
+  }
+  
+  //window.open('/file-cms/fotos/?o=' + userid + '/' + path + '/' + fname, '_blank');
+  window.open('/file-cms/fotos/?o=' + restdir + '/' + fname, '_blank');
+}
+
 function fm_menu_datei_umbenennen() {
   var gewaehlte = $('.datei-gewaehlt');
   var fname = $(gewaehlte[0]).text();
@@ -580,6 +634,17 @@
   var gewaehlte = $('.datei-gewaehlt');
   var fname = $(gewaehlte[0]).text();
   fm_unzip_file(fname);
+}
+
+/**
+ * Anname: Man ist in dem Ordner, der gepackt werden soll.
+ * Dann ist das Archiv anschliessend im Eltern-Ordner.
+ */
+function fm_menu_ordner_packen() {
+  //var gewaehlte = $('.datei-gewaehlt');
+  //var fname = $(gewaehlte[0]).text();
+  //console.log("Pfad: " + pfad + ", Datei: " + fname);
+  fm_pack_folder();
 }
 
 /*
@@ -697,6 +762,7 @@
 function fm_code_edit(content, m) {
   cm = CodeMirror.fromTextArea(document.getElementById("editspace"), {
     lineNumbers: true,
+    lineWrapping: true,
     gutters: ["CodeMirror-linenumbers", "breakpoints"],
     mode: m,
     viewportMargin : Infinity,

--
Gitblit v1.9.3