update 20260308
This commit is contained in:
314
API_NetFramework/JSONViewer.aspx
Normal file
314
API_NetFramework/JSONViewer.aspx
Normal file
@@ -0,0 +1,314 @@
|
||||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JSONViewer.aspx.cs" Inherits="WebApp.JSONViewer" %>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head runat="server">
|
||||
<%--<title>Daten & JSON Editor</title>--%>
|
||||
<script src="/Scripts/ace/ace.js"></script>
|
||||
<script src="/Scripts/ace/mode-json.min.js"></script>
|
||||
<script src="/Scripts/ace/theme-tomorrow.min.js"></script>
|
||||
<script src="/Scripts/ace/worker-json.js"></script>
|
||||
<script src="/Scripts/jquery.min.js"></script>
|
||||
<script src="/Scripts/ace/ext-searchbox.js"></script>
|
||||
<script src="/Scripts/bootstrap.min.js"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.23.4/ace.js"></script>
|
||||
|
||||
<style>
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
font-family: Arial;
|
||||
background: #f4f6f8;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
background-color: #2563eb;
|
||||
color: #fff;
|
||||
padding: 15px 30px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.8rem;
|
||||
}
|
||||
|
||||
.page-header p {
|
||||
margin: 4px 0 0 0;
|
||||
font-size: 0.95rem;
|
||||
color: #dbeafe;
|
||||
}
|
||||
|
||||
.layout {
|
||||
display: flex;
|
||||
height: calc(100% - 70px);
|
||||
}
|
||||
/* 70px für header */
|
||||
.left {
|
||||
width: 45%;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-right: 1px solid #ddd;
|
||||
overflow: auto;
|
||||
}
|
||||
.leftfull {
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-right: 1px solid #ddd;
|
||||
overflow: auto;
|
||||
}
|
||||
.right {
|
||||
width: 55%;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#editor {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 8px;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
.pager a, .pager span {
|
||||
padding: 5px 9px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
margin-left: 4px;
|
||||
text-decoration: none;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.pager span {
|
||||
background: #2563eb;
|
||||
color: #fff;
|
||||
border-color: #2563eb;
|
||||
}
|
||||
|
||||
a.open {
|
||||
color: #2563eb;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.open:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#pdfFrame {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
.leftpanel {
|
||||
border-right: 1px solid #ccc;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.navbar-custom {
|
||||
background-color: #0d6efd;
|
||||
padding-top:20px;
|
||||
padding-bottom:20px;
|
||||
}
|
||||
|
||||
.navbar-custom .navbar-brand {
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.navbar-custom .btn {
|
||||
border-color: white;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.navbar-custom .btn:hover {
|
||||
background: white;
|
||||
color: #0d6efd;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<nav class="navbar navbar-expand-lg navbar-custom">
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- TITEL LINKS -->
|
||||
<span class="navbar-brand">OnDoc-JSON-Viewer
|
||||
</span>
|
||||
|
||||
|
||||
<div class="ms-auto d-flex gap-2">
|
||||
|
||||
<!-- BUTTON -->
|
||||
<button class="btn btn-outline-light" onclick="generateFromJson()">
|
||||
Generieren
|
||||
</button>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
<%--<div class="page-header">
|
||||
<h1>OnDoc-Json-Viewer</h1>
|
||||
<p>Tabellen auswählen, Datensätze ansehen und JSON anzeigen</p>
|
||||
</div>--%>
|
||||
|
||||
<!-- LAYOUT -->
|
||||
<div class="layout">
|
||||
<form runat="server" class="left" id="masterform">
|
||||
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
|
||||
|
||||
<h2>Tabellen & Datensätze</h2>
|
||||
<asp:DropDownList
|
||||
Width="300"
|
||||
ID="ddlTables"
|
||||
runat="server"
|
||||
AutoPostBack="true"
|
||||
OnSelectedIndexChanged="ddlTables_SelectedIndexChanged" />
|
||||
|
||||
|
||||
|
||||
<asp:Label ID="lblFilter" runat="server" Text="Filter:"></asp:Label>
|
||||
<asp:TextBox ID="txtfilter" runat="server" Width="207px"></asp:TextBox>
|
||||
|
||||
|
||||
<asp:Button ID="btnRefresh" runat="server" Text="Aktualisieren" OnClick="ddlTables_SelectedIndexChanged" />
|
||||
<asp:Button ID="Button1" runat="server" Text="Filter löschen" OnClick="ddlTables_clearfilter" />
|
||||
|
||||
<asp:GridView
|
||||
ID="gvData"
|
||||
runat="server"
|
||||
AutoGenerateColumns="true"
|
||||
AllowPaging="true"
|
||||
PageSize="15"
|
||||
PagerStyle-CssClass="pager"
|
||||
OnPageIndexChanging="gvData_PageIndexChanging"
|
||||
OnRowCreated="gvData_RowCreated"
|
||||
OnRowDataBound="gvData_RowDataBound" />
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<div id="editor"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
const editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
editor.session.setMode("ace/mode/json");
|
||||
editor.setShowPrintMargin(false);
|
||||
editor.session.setTabSize(2);
|
||||
editor.session.setUseSoftTabs(true);
|
||||
editor.session.doc
|
||||
|
||||
//let editor;
|
||||
//$(function () {
|
||||
// editor = ace.edit("editor");
|
||||
// editor.setTheme("ace/theme/tomorrow");
|
||||
// editor.session.setMode("ace/mode/json");
|
||||
// editor.setShowPrintMargin(false);
|
||||
// editor.session.setTabSize(2);
|
||||
// editor.session.setUseSoftTabs(true);
|
||||
|
||||
// editor.commands.addCommand({
|
||||
// name: "find",
|
||||
// bindKey: { win: "Ctrl-F", mac: "Command-F" },
|
||||
// exec: function (ed) {
|
||||
// ace.require("ace/ext/searchbox").Search(ed);
|
||||
// }
|
||||
// });
|
||||
//});
|
||||
function generateFromJson() {
|
||||
|
||||
var jsonText = editor.getValue();
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/API/DokumentGenerator",
|
||||
data: jsonText,
|
||||
contentType: "application/json; charset=utf-8",
|
||||
dataType: "json",
|
||||
headers: {
|
||||
"Authorization": "Bearer " + "pZkuG6l6ORCEckqQimPK58PO1A9EnkMtL5oCgRX9WiWnD4xeH7ikGzhWnTBy/vk8J4Iiz8gCSx9uFHA4+DvITG0roO97sk82d/0BCjVlwLWINpXlJfGYEF3X96AdoCQvb3ruwv/tVqEHsSU5aNfyxBAe+EhLTHQ8t7ysgJZWh98="
|
||||
},
|
||||
success: function (response) {
|
||||
var pdfWindow = window.open("");
|
||||
pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64," + response.file + "'></iframe>");
|
||||
//alert("Server Response: " + response.file);
|
||||
},
|
||||
|
||||
error: function (err) {
|
||||
alert("Error: " + err.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showDoc(tableKey, id) {
|
||||
PageMethods.GetDoc(
|
||||
tableKey,
|
||||
id,
|
||||
function (result) {
|
||||
var pdfWindow = window.open("");
|
||||
pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64," + result + "'></iframe>");
|
||||
},
|
||||
function (err) {
|
||||
|
||||
alert(err.get_message())
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
function loadJson(tableKey, id) {
|
||||
|
||||
editor.setValue("// lade JSON ...", -1);
|
||||
|
||||
PageMethods.GetJson(
|
||||
tableKey,
|
||||
id,
|
||||
function (result) {
|
||||
editor.setValue(result, -1);
|
||||
},
|
||||
function (err) {
|
||||
|
||||
editor.setValue(JSON.stringify({ error: err.get_message() }, null, 2), -1);
|
||||
}
|
||||
);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user