From 42fecef285c712f2a8d9b1b6371edc6ea9d9fac6 Mon Sep 17 00:00:00 2001
From: ulrich <undisclosed>
Date: Mon, 27 Feb 2017 22:26:21 +0000
Subject: [PATCH] Upload in gewaehltes Verzeichnis eingebaut und einige Modes bei Codemirror hinzugefuegt

---
 web/ui/ui.js |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/web/ui/ui.js b/web/ui/ui.js
index ef2382b..1896636 100644
--- a/web/ui/ui.js
+++ b/web/ui/ui.js
@@ -179,6 +179,7 @@
     }  
   };  
   fd.append('dateiauswahlfeld', datei);  
+  fd.append('pfad', pfad);
   xhr.send(fd);          
 }
 
@@ -328,11 +329,11 @@
   }
 }
 
-function fm_text_edit(content) {
+function fm_text_edit(content, mode) {
   fm_filectls_hide();
   $('.codeeditor-space').show();
   $('.code-editor-container').show();
-  fm_code_edit(content);  
+  fm_code_edit(content, mode);  
   openEditor = 'text';
 }
 
@@ -394,7 +395,15 @@
   var u = '../svc' + m;
   fm_get(u, "text", function(resp) {
     if(typ == 'text') {
-      fm_text_edit(resp);
+      var mode = "text/x-java";
+      if(fname.endsWith('js')) {
+        mode = 'javascript';
+      } else if(fname.endsWith('xml')) {
+        mode = 'xml';
+      } else if(fname.endsWith('properties')) {
+        mode = 'xml';
+      }
+      fm_text_edit(resp, mode);
     } else {
       fm_dok_edit(resp);
     }
@@ -622,10 +631,10 @@
 
 /* ---- codemirror editor handling -------- */
 
-function fm_code_edit(content) {
+function fm_code_edit(content, m) {
   cm = CodeMirror.fromTextArea(document.getElementById("editspace"), {
     lineNumbers: true,
-    mode: "xml",
+    mode: m,
     viewportMargin : Infinity,
     extraKeys: {
         "F9": function(cm) {

--
Gitblit v1.9.3