TblEditor working

This commit is contained in:
Hash Borgir 2023-06-13 21:15:23 -06:00
parent 3ce842b52d
commit 29621fa46c
1779 changed files with 888 additions and 157 deletions

0
' Normal file
View File

View File

@ -24,6 +24,32 @@ try {
$cmd = $_REQUEST['cmd'];
$tableName = $_REQUEST['tableName'];
function dumpAndProcessTable($tableName) {
// Set the path to the SQLite3 executable
$sqlitePath = "bin\sqlite3.exe";
// Dump the SQLite table to a TSV file
$tsvFile = $tableName . ".txt";
$dumpCommand = "bin\sqlite3.exe {$_SESSION['modname']}.db \"SELECT * FROM string\" -separator \"\t\" -cmd \".mode tabs\" -cmd \".headers off\" > \"{$_SESSION['tbl']}{$tsvFile}\"";
shell_exec($dumpCommand);
// Run the executable with the TSV file as input
$executablePath = "bin\EnquettarM.exe";
$processCommand = "{$executablePath} -i \"{$_SESSION['tbl']}{$tsvFile}\"";
$etxt = 'ModString.txt';
$etbl = 'ModString.tbl';
shell_exec($processCommand);
// now file is generated in rootdir, etbl, which we need to move to session tbl
rename($etbl, "{$_SESSION['tbl']}/$tableName.tbl");
// Remove the generated ModString.tbl
//unlink($etbl);
}
if ($cmd == "getTable") {
$query = "SELECT ROWID,* FROM $tableName";
$rows = PDO_Execute($query);
@ -37,16 +63,16 @@ if ($cmd == "getTable") {
$tableMarkup .= "<tr class='row-{$row['rowid']}'>";
$tableMarkup .= "<td>{$row['rowid']}</td>";
$tableMarkup .= "<td style='width: 64px;'>{$row['rowid']}</td>";
// Display the Key column as a text input with Bootstrap form-control class
$tableMarkup .= "<td><input type='text' value='{$row['Key']}' class='form-control'><span style='visibility: hidden;'>{$row['Key']}</span></td>";
$tableMarkup .= "<td style='width: 20%;'><input type='text' value='{$row['Key']}' class='form-control'><span style='visibility: hidden;'>{$row['Key']}</span></td>";
// Display the String column as a textarea with Bootstrap form-control class
$tableMarkup .= "<td><textarea class='form-control'>{$string}</textarea></td>";
// Add the Update and Delete links within a single td element
$tableMarkup .= "<td><div>";
$tableMarkup .= "<td style='width: 100px;'><div>";
// Add the Update link with Bootstrap btn and btn-primary classes
$tableMarkup .= "<a href='#' class='update-link btn btn-primary' data-rowid='{$row['rowid']}'>Update</a>";
@ -67,13 +93,14 @@ if ($cmd == "getTable") {
if ($cmd == "update") {
$query = "UPDATE $tableName SET Key = ?, String = ? WHERE ROWID = ?";
PDO_Execute($query, [$_REQUEST['key'], $_REQUEST['string'], $_REQUEST['rowid']]);
dumpAndProcessTable($tableName);
echo $_REQUEST['key'] . " updated";
}
if ($cmd == "delete") {
$query = "DELETE FROM $tableName WHERE ROWID = ?";
PDO_Execute($query, [$_REQUEST['rowid']]);
dumpAndProcessTable($tableName);
echo $_REQUEST['rowid'] . " deleted";
}
@ -94,4 +121,5 @@ if ($cmd == "add") {
$result = PDO_FetchOne($query);
echo $result;
dumpAndProcessTable($tableName);
}

View File

@ -52,21 +52,27 @@ foreach (glob($tbl . "*.tbl") as $filename) {
<script src="https://cdn.datatables.net/1.11.4/js/dataTables.bootstrap4.min.js"></script>
<title>Editable Tables</title>
<link rel="stylesheet" href="https://bootswatch.com/4/lumen/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="res/95assets/win95.css">
</head>
<body>
<div style="padding:10px; border: 1px solid #eee;">
<div class="container">
<h2>Select .tbl File</h2>
<div class="row">
<div class="col-md-6">
<select name="tableName" id="tableName" class="form-control">
<option value="" selected></option>
<option value="" disabled selected>_______________SELECT TBL FILE_______________</option>
<?php foreach ($tableNames as $tableName): ?>
<option value="<?php echo $tableName; ?>" <?php echo ($tableName == "") ? "selected" : ""; ?>><?php echo $tableName; ?></option>
<?php endforeach; ?>
</select>
<h2>Table</h2>
<div>
</div>
<div class="col-md-6">
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseForm" aria-expanded="false" aria-controls="collapseForm">
Add new String Key
</button>
</div>
</div>
<div class="collapse" id="collapseForm">
<div class="form-group">
<label for="inputKey">Key</label>
@ -87,10 +93,10 @@ foreach (glob($tbl . "*.tbl") as $filename) {
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Key</th>
<th style="width: 64px;">ID</th>
<th style='width: 20%;'>Key</th>
<th>String</th>
<th></th>
<th style="width: 100px;"></th>
</tr>
</thead>
<tbody>
@ -102,8 +108,6 @@ foreach (glob($tbl . "*.tbl") as $filename) {
</div>
<script>
function resizeTextarea() {
this.style.height = 'auto';
@ -138,6 +142,7 @@ foreach (glob($tbl . "*.tbl") as $filename) {
$('.table tbody').html('');
var selectedTable = $(this).val();
if (selectedTable !== '') {
// Send GET request to TblEditor.php?getTable with selected table name
var request = $.get('TblEditor.php', {cmd: 'getTable', tableName: selectedTable});
@ -165,6 +170,7 @@ foreach (glob($tbl . "*.tbl") as $filename) {
});
});
});
}
});
@ -276,6 +282,12 @@ foreach (glob($tbl . "*.tbl") as $filename) {
</script>
<style>
body {
background: #f8f8f8;
margin: 10px;
border: 1px solid #eee;
border-radius: 5px;
}
div.dataTables_wrapper div.dataTables_length select {
width: 75px !important;
}
@ -286,5 +298,5 @@ foreach (glob($tbl . "*.tbl") as $filename) {
-ms-overflow-style: none; /* For Internet Explorer and Edge */
}
</style>
</body>
</body>
</html>

BIN
bin/EnquettarM.exe Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

BIN
res/95assets/Svidetel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
res/95assets/background.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

View File

@ -0,0 +1,62 @@
.clippy, .clippy-balloon {
position: fixed;
z-index: 1000;
cursor: pointer;
}
.clippy-balloon {
background: #FFC;
color: black;
padding: 8px;
border: 1px solid black;
border-radius: 5px;
}
.clippy-content {
max-width: 200px;
min-width: 120px;
font-family: "Microsoft Sans", sans-serif;
font-size: 10pt;
}
.clippy-tip {
width: 10px;
height: 16px;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAgCAMAAAAlvKiEAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRF///MAAAA////52QwgAAAAAN0Uk5T//8A18oNQQAAAGxJREFUeNqs0kEOwCAIRFHn3//QTUU6xMyyxii+jQosrTPkyPEM6IN3FtzIRk1U4dFeKWQiH6pRRowMVKEmvronEynkwj0uZJgR22+YLopPSo9P34wJSamLSU7lSIWLJU7NkNomNlhqxUeAAQC+TQLZyEuJBwAAAABJRU5ErkJggg==) no-repeat;
position: absolute;
}
.clippy-top-left .clippy-tip {
top: 100%;
margin-top: 0px;
left: 100%;
margin-left: -50px;
}
.clippy-top-right .clippy-tip {
top: 100%;
margin-top: 0px;
left: 0;
margin-left: 50px;
background-position: -10px 0;
}
.clippy-bottom-right .clippy-tip {
top: 0;
margin-top: -16px;
left: 0;
margin-left: 50px;
background-position: -10px -16px;
}
.clippy-bottom-left .clippy-tip {
top: 0;
margin-top: -16px;
left: 100%;
margin-left: -50px;
background-position: 0px -16px;
}

1
res/95assets/clippy/clippy.min.js vendored Normal file

File diff suppressed because one or more lines are too long

BIN
res/95assets/clouds2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
res/95assets/combo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

BIN
res/95assets/comboleft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

BIN
res/95assets/comboright.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

BIN
res/95assets/comboup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 491 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 493 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 695 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 485 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 747 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Some files were not shown because too many files have changed in this diff Show More