From 3c4b104eb3d9bf4e651dffbbd956985764bcacce Mon Sep 17 00:00:00 2001 From: ulrich <undisclosed> Date: Tue, 28 Feb 2017 07:19:53 +0000 Subject: [PATCH] getBase angepasst --- web/ui/ui.js | 91 ++++++++------------------------------------- 1 files changed, 16 insertions(+), 75 deletions(-) diff --git a/web/ui/ui.js b/web/ui/ui.js index 7457f22..1896636 100644 --- a/web/ui/ui.js +++ b/web/ui/ui.js @@ -49,40 +49,20 @@ $('#modal_ok').attr('onclick','').unbind('click'); }); $('#logout').click(fm_logout); - fm_get_login(); // nach Ermittlung der Benutzerkennung wird TinyMCE initialisert + fm_get_login(); fm_get_list(''); fm_init_uploader(); - //fm_dok_editor_init(''); - /*window.onresize = function() { - fm_resize_editor(); - };*/ } function fm_resize_editor() { - window.clearTimeout(tmo); tmo = window.setTimeout(function () { - //$('.mce-edit-area').height(ht - 100); - try { var myHeight = $('.zentrum').height() - $('.nord').height() - 4; ed.theme.resizeTo('100%', myHeight); // sets the dimensions of the editable area } catch (err) { } - - }, 200); - - - /* - if (ed) { - try { - var myHeight = $('.zentrum').height() - $('.nord').height() - 4; - ed.theme.resizeTo('100%', myHeight); // sets the dimensions of the editable area - } catch (err) { - } - } - */ } function fm_get_path(uid) { @@ -116,17 +96,7 @@ //console.log('base: ' + pdir + uid); return pdir + uid; } -/* - * Initialisierung von TinyMCE als separate Funktion, damit - * die Benutzerkennung nach deren Ermittlung als Teil des - * Basisverzeichnisses dienen kann - * - * Pruefen: Kann man das vor jedem Editor-Aufruf machen oder aber - * Teile wie z.B. das Basisverzeichnis spaeter wieder aendern? - * - * @param {String} uid die userid die auf das Basisverzeichnis verweist - * @returns {undefined} - */ + function fm_dok_editor_init(uid) { var base = fm_get_path(uid); //console.log("calling tinymce.init with base: " + base + "/"); @@ -164,7 +134,6 @@ width: "100%", height: '100%', document_base_url : base + "/", - /*autoresize_bottom_margin : 1,*/ setup: function (editor) { ed = editor; } @@ -210,6 +179,7 @@ } }; fd.append('dateiauswahlfeld', datei); + fd.append('pfad', pfad); xhr.send(fd); } @@ -359,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'; } @@ -425,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); } @@ -587,43 +565,6 @@ }); } -/* -function fm_bcr_step2(dirs, dirList) { - if(dirs.length > 0) { - dirList.push(new BcrFile(rp + '/' + dirs[dirs.length-1], dirs[dirs.length-1])); - $.get('tpl-bcr2.txt', function(template) { - $('#bcnav').append(Mustache.render(template, dirList[dirList.length-1])); - $('#bcnav').append($('#tpl-bcr3').html()); - fm_bcr_end(); - }); - //template = $('#tpl-bcr2').html(); - //Mustache.parse(template); // optional, speeds up future uses - //$('#bcnav').append(Mustache.render(template, dirList[dirList.length-1])); - } else { - $.get('tpl-bcr2.txt', function(template) { - $('#bcnav').append(Mustache.render(template, dirList[0])); - $('#bcnav').append($('#tpl-bcr3').html()); - fm_bcr_end(); - }); - //template = $('#tpl-bcr2').html(); - //Mustache.parse(template); // optional, speeds up future uses - //$('#bcnav').append(Mustache.render(template, dirList[0])); - } -} -*/ - -function fm_bcr_3() { - $.get('tpl-bcr3.txt', function(template) { - $('#bcnav').append(template); - }); -} - -function fm_bcr_end() { - $('.breadcrumb-item').click(fm_bc_click); - $('#ansicht').click(fm_ansicht_umschalten); - fm_set_modus(); -} - function fm_menu_datei_speichern() { //var fname = $('.datei-gewaehlt').text(); var fname = openFileName; @@ -690,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