From 6bd2c116db33972d971235120d9fa9107f2b4525 Mon Sep 17 00:00:00 2001 From: ulrich <undisclosed> Date: Tue, 21 Mar 2017 11:17:48 +0000 Subject: [PATCH] Entpacken --- web/ui/ui.js | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 115 insertions(+), 3 deletions(-) diff --git a/web/ui/ui.js b/web/ui/ui.js index 8182c68..49c1a92 100644 --- a/web/ui/ui.js +++ b/web/ui/ui.js @@ -40,6 +40,7 @@ $("#mce-editor").hide(); $('.codeeditor-space').hide(); $('.code-editor-container').hide(); + $('.sued').hide(); //$('.ost').attr('flex-basis', 0); $('#newTextFile').on('click', fm_menu_neue_textdatei); $('#newDoc').on('click', fm_menu_neues_dokument); @@ -55,6 +56,7 @@ $('#saveFileAs').on('click', fm_menu_datei_speichern_unter); $('#closeFile').on('click', fm_menu_datei_schliessen); $('#renameFile').on('click', fm_menu_datei_umbenennen); + $('#m-unzip').on('click', fm_menu_datei_entpacken); $('#m-del').on('click', fm_menu_delete); $('#m-cut').on('click', fm_menu_cut); $('#m-copy').on('click', fm_menu_copy); @@ -63,10 +65,13 @@ $('#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); $('#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(); @@ -89,6 +94,14 @@ } catch (err) { } }, 200); +} + +function fm_fusszeile_schliessen() { + $('.sued').hide(); +} + +function fm_fusszeile_zeigen() { + $('.sued').show(); } function fm_get_path(uid) { @@ -266,6 +279,7 @@ */ function fm_gewaehlte_dateien() { var gewaehlte = $('.datei-gewaehlt'); + /* //console.log('anzahl: ' + gewaehlte.length); var fnames = new Array(); var i = 0; @@ -281,7 +295,27 @@ // {"List":[{"java.lang.String":"test3.txt"},{"java.lang.String":"Test1.txt"},{"java.lang.String":"Test2.txt"}]} // und wird auf dem Server zu einer List[ArrayList<String>] bei der jede ArrayList<String> nur ein Element hat return liste; + */ + return fm_dateiliste_bilden(gewaehlte); } + +function fm_dateiliste_bilden(gewaehlte) { + var fnames = new Array(); + var i = 0; + while(i < gewaehlte.length) { + var str = { "java.lang.String": $(gewaehlte[i]).text()}; + fnames.push(str); + //console.log('loeschen ' + pfad + ' ' + $(gewaehlte[i]).text()); + //i += 2; + i++; + } + var liste = '{"List":' + JSON.stringify(fnames) + '}'; + // 'liste' enthaelt: + // {"List":[{"java.lang.String":"test3.txt"},{"java.lang.String":"Test1.txt"},{"java.lang.String":"Test2.txt"}]} + // und wird auf dem Server zu einer List[ArrayList<String>] bei der jede ArrayList<String> nur ein Element hat + return liste; +} + /* --------- Dateifunktionen Ende ---------- */ function fm_menu_test() { @@ -302,10 +336,15 @@ fm_compile_all(); } +function fm_menu_build_app() { + fm_build_app(); +} + function fm_mark_compile_results_in_editor(resp) { cm.clearGutter("breakpoints"); if(resp.List[0].CompilerIssue !== undefined) { + cm.setGutterMarker(0, "breakpoints", makeMarker("Code hat Fehler")); var lno; var eMsg; if(resp.List[0].CompilerIssue instanceof Array) { @@ -328,6 +367,16 @@ } } +function fm_build_app() { + var m = '?c=de.uhilger.filecms.api.CompileService&m=buildApp&p=' + pfad; + var u = '../svc' + m; + fm_get(u, "text", function(resp) { + $('.system-out').empty(); + $('.system-out').append('Ergebnis von Build app: ' + resp); + fm_fusszeile_zeigen(); + }); +} + function fm_compile_all() { var m = '?c=de.uhilger.filecms.api.CompileService&m=compileAll&p=' + pfad; var u = '../svc' + m; @@ -335,21 +384,53 @@ if(resp.List[0].CompilerIssue !== undefined) { var lno; var eMsg; + var issueList = new Array(); if(resp.List[0].CompilerIssue instanceof Array) { var issueNo = 0; while(issueNo < resp.List[0].CompilerIssue.length) { + /* + $('.system-out').append(' +++ ---- +++ '); + $('.system-out').append(resp.List[0].CompilerIssue[issueNo].kind); + $('.system-out').append(resp.List[0].CompilerIssue[issueNo].lineNumber); + $('.system-out').append(resp.List[0].CompilerIssue[issueNo].sourceName); + $('.system-out').append(resp.List[0].CompilerIssue[issueNo].message); + */ + var issue = new CompilerIssue( + resp.List[0].CompilerIssue[issueNo].sourceName, + resp.List[0].CompilerIssue[issueNo].message, + resp.List[0].CompilerIssue[issueNo].kind, + resp.List[0].CompilerIssue[issueNo].lineNumber + ); + issueList.push(issue); + + /* console.log(' +++ ---- +++ '); console.log(resp.List[0].CompilerIssue[issueNo].kind); console.log(resp.List[0].CompilerIssue[issueNo].lineNumber); console.log(resp.List[0].CompilerIssue[issueNo].sourceName); console.log(resp.List[0].CompilerIssue[issueNo].message); + */ issueNo++; } } else { - lno = resp.List[0].CompilerIssue.lineNumber; - eMsg = resp.List[0].CompilerIssue.kind + ' ' + resp.List[0].CompilerIssue.message; - console.log(lno + ' ' + eMsg); + //lno = resp.List[0].CompilerIssue.lineNumber; + //eMsg = resp.List[0].CompilerIssue.kind + ' ' + resp.List[0].CompilerIssue.message; + //$('.system-out').append(lno + ' ' + eMsg); + //console.log(lno + ' ' + eMsg); + var issue = new CompilerIssue( + resp.List[0].CompilerIssue.sourceName, + resp.List[0].CompilerIssue.message, + resp.List[0].CompilerIssue.kind, + resp.List[0].CompilerIssue.lineNumber + ); + issueList.push(issue); } + var theList = new IssueList(issueList); + var template = $('#tpl-ci').html(); + Mustache.parse(template); // optional, speeds up future uses + $('.system-out').empty(); + $('.system-out').html(Mustache.render(template, theList)); + $('.sued').show(); } }); } @@ -641,6 +722,25 @@ show: true }); } +} + +function fm_menu_datei_entpacken() { + var gewaehlte = $('.datei-gewaehlt'); + var fname = $(gewaehlte[0]).text(); + fm_unzip_file(fname); +} + +function fm_unzip_file(fn) { + var m = '?c=de.uhilger.filecms.api.FileMgr&m=extractZipfile'; + m = m + '&p=' + pfad; + m = m + '&p=' + fn; + var u = '../svc' + m; + fm_get(u, "text", function(resp) { + $('.system-out').empty(); + $('.system-out').append('Rueckmeldung vom Entpacken: ' + resp); + fm_fusszeile_zeigen(); + fm_get_list(pfad); + }); } function fm_rename_file(fn, p, neuerName) { @@ -1045,6 +1145,18 @@ /* ----- Objekte ----- */ +function IssueList(il) { + this.issues = il; +} + +function CompilerIssue(sn, ms, ki, ln) { + var self = this; + this.sourceName = sn; + this.message = ms; + this.kind = ki; + this.lineNumber = ln; +} + function FileList(fl) { this.files = fl; } -- Gitblit v1.9.3