TblEditor working
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
BIN
bin/EnquettarM.exe
Normal file
BIN
res/95assets/Samsung Galaxy S9.png
Normal file
After Width: | Height: | Size: 92 KiB |
BIN
res/95assets/Study-and-Relax.mp3
Normal file
BIN
res/95assets/Svidetel.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
res/95assets/background.bmp
Normal file
After Width: | Height: | Size: 824 B |
62
res/95assets/clippy/clippy.css
Normal 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
BIN
res/95assets/clouds2.jpg
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
res/95assets/combo.png
Normal file
After Width: | Height: | Size: 89 B |
BIN
res/95assets/comboleft.png
Normal file
After Width: | Height: | Size: 91 B |
BIN
res/95assets/comboright.png
Normal file
After Width: | Height: | Size: 91 B |
BIN
res/95assets/comboup.png
Normal file
After Width: | Height: | Size: 89 B |
BIN
res/95assets/confused_travolta.gif
Normal file
After Width: | Height: | Size: 1.9 MiB |
BIN
res/95assets/icons/ac_plug-0.png
Normal file
After Width: | Height: | Size: 460 B |
BIN
res/95assets/icons/ac_plug-1.png
Normal file
After Width: | Height: | Size: 370 B |
BIN
res/95assets/icons/accesibility_window_abc.png
Normal file
After Width: | Height: | Size: 457 B |
BIN
res/95assets/icons/access_wheelchair_big.png
Normal file
After Width: | Height: | Size: 573 B |
BIN
res/95assets/icons/accessibility-0.png
Normal file
After Width: | Height: | Size: 482 B |
BIN
res/95assets/icons/accessibility-1.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
res/95assets/icons/accessibility-2.png
Normal file
After Width: | Height: | Size: 542 B |
BIN
res/95assets/icons/accessibility-3.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
res/95assets/icons/accessibility-4.png
Normal file
After Width: | Height: | Size: 671 B |
BIN
res/95assets/icons/accessibility-5.png
Normal file
After Width: | Height: | Size: 384 B |
BIN
res/95assets/icons/accessibility_big_keys.png
Normal file
After Width: | Height: | Size: 384 B |
BIN
res/95assets/icons/accessibility_contrast.png
Normal file
After Width: | Height: | Size: 443 B |
BIN
res/95assets/icons/accessibility_kbd_mouse.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
res/95assets/icons/accessibility_key_pointer.png
Normal file
After Width: | Height: | Size: 448 B |
BIN
res/95assets/icons/accessibility_stopwatch.png
Normal file
After Width: | Height: | Size: 513 B |
BIN
res/95assets/icons/accessibility_toggle.png
Normal file
After Width: | Height: | Size: 478 B |
BIN
res/95assets/icons/accessibility_toggle2.png
Normal file
After Width: | Height: | Size: 447 B |
BIN
res/95assets/icons/accessibility_toggle3.png
Normal file
After Width: | Height: | Size: 529 B |
BIN
res/95assets/icons/accessibility_two_windows.png
Normal file
After Width: | Height: | Size: 447 B |
BIN
res/95assets/icons/accessibility_window_objs.png
Normal file
After Width: | Height: | Size: 494 B |
BIN
res/95assets/icons/accessibility_window_signal.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
res/95assets/icons/accessibility_window_speak.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
res/95assets/icons/active_movie-0.png
Normal file
After Width: | Height: | Size: 397 B |
BIN
res/95assets/icons/active_movie-1.png
Normal file
After Width: | Height: | Size: 526 B |
BIN
res/95assets/icons/address_book-0.png
Normal file
After Width: | Height: | Size: 512 B |
BIN
res/95assets/icons/address_book-1.png
Normal file
After Width: | Height: | Size: 398 B |
BIN
res/95assets/icons/address_book_card.png
Normal file
After Width: | Height: | Size: 406 B |
BIN
res/95assets/icons/address_book_card_copy-0.png
Normal file
After Width: | Height: | Size: 455 B |
BIN
res/95assets/icons/address_book_card_copy-1.png
Normal file
After Width: | Height: | Size: 388 B |
BIN
res/95assets/icons/address_book_card_users.png
Normal file
After Width: | Height: | Size: 491 B |
BIN
res/95assets/icons/address_book_cards.png
Normal file
After Width: | Height: | Size: 427 B |
BIN
res/95assets/icons/address_book_copy.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
res/95assets/icons/address_book_home.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
res/95assets/icons/address_book_pad.png
Normal file
After Width: | Height: | Size: 455 B |
BIN
res/95assets/icons/address_book_pad_users.png
Normal file
After Width: | Height: | Size: 552 B |
BIN
res/95assets/icons/address_book_user.png
Normal file
After Width: | Height: | Size: 428 B |
BIN
res/95assets/icons/address_book_users.png
Normal file
After Width: | Height: | Size: 499 B |
BIN
res/95assets/icons/amplify.png
Normal file
After Width: | Height: | Size: 438 B |
BIN
res/95assets/icons/application_hammer_grouppol-0.png
Normal file
After Width: | Height: | Size: 397 B |
BIN
res/95assets/icons/application_hammer_grouppol-1.png
Normal file
After Width: | Height: | Size: 493 B |
BIN
res/95assets/icons/application_hourglass-0.png
Normal file
After Width: | Height: | Size: 492 B |
BIN
res/95assets/icons/application_hourglass-1.png
Normal file
After Width: | Height: | Size: 394 B |
BIN
res/95assets/icons/application_hourglass_small-0.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
res/95assets/icons/application_hourglass_small-1.png
Normal file
After Width: | Height: | Size: 394 B |
BIN
res/95assets/icons/application_hourglass_small-2.png
Normal file
After Width: | Height: | Size: 503 B |
BIN
res/95assets/icons/application_hourglass_small-3.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
res/95assets/icons/application_hourglass_small-4.png
Normal file
After Width: | Height: | Size: 666 B |
BIN
res/95assets/icons/application_hourglass_small-5.png
Normal file
After Width: | Height: | Size: 452 B |
BIN
res/95assets/icons/application_hourglass_small_cool-0.png
Normal file
After Width: | Height: | Size: 695 B |
BIN
res/95assets/icons/application_hourglass_small_cool-1.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
res/95assets/icons/application_hourglass_small_cool-2.png
Normal file
After Width: | Height: | Size: 485 B |
BIN
res/95assets/icons/application_hourglass_small_cool-3.png
Normal file
After Width: | Height: | Size: 394 B |
BIN
res/95assets/icons/application_hourglass_small_cool-4.png
Normal file
After Width: | Height: | Size: 463 B |
BIN
res/95assets/icons/application_hourglass_small_cool-5.png
Normal file
After Width: | Height: | Size: 503 B |
BIN
res/95assets/icons/appwiz_file-0.png
Normal file
After Width: | Height: | Size: 474 B |
BIN
res/95assets/icons/appwiz_file-1.png
Normal file
After Width: | Height: | Size: 396 B |
BIN
res/95assets/icons/appwizard-0.png
Normal file
After Width: | Height: | Size: 397 B |
BIN
res/95assets/icons/appwizard-1.png
Normal file
After Width: | Height: | Size: 424 B |
BIN
res/95assets/icons/appwizard-2.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
res/95assets/icons/appwizard-3.png
Normal file
After Width: | Height: | Size: 594 B |
BIN
res/95assets/icons/appwizard-4.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
res/95assets/icons/appwizard-5.png
Normal file
After Width: | Height: | Size: 747 B |
BIN
res/95assets/icons/appwizard_list.png
Normal file
After Width: | Height: | Size: 525 B |
BIN
res/95assets/icons/audio_compression-0.png
Normal file
After Width: | Height: | Size: 494 B |
BIN
res/95assets/icons/audio_compression-1.png
Normal file
After Width: | Height: | Size: 397 B |
BIN
res/95assets/icons/backup_devices.png
Normal file
After Width: | Height: | Size: 475 B |
BIN
res/95assets/icons/backup_devices_2-0.png
Normal file
After Width: | Height: | Size: 448 B |
BIN
res/95assets/icons/backup_devices_2-1.png
Normal file
After Width: | Height: | Size: 366 B |
BIN
res/95assets/icons/bar_graph-0.png
Normal file
After Width: | Height: | Size: 371 B |
BIN
res/95assets/icons/bar_graph-1.png
Normal file
After Width: | Height: | Size: 421 B |
BIN
res/95assets/icons/bar_graph_default-0.png
Normal file
After Width: | Height: | Size: 384 B |
BIN
res/95assets/icons/bar_graph_default-1.png
Normal file
After Width: | Height: | Size: 470 B |
BIN
res/95assets/icons/battery.png
Normal file
After Width: | Height: | Size: 419 B |
BIN
res/95assets/icons/battery_alt-0.png
Normal file
After Width: | Height: | Size: 563 B |
BIN
res/95assets/icons/battery_alt-1.png
Normal file
After Width: | Height: | Size: 411 B |
BIN
res/95assets/icons/briefcase-0.png
Normal file
After Width: | Height: | Size: 438 B |
BIN
res/95assets/icons/briefcase-1.png
Normal file
After Width: | Height: | Size: 379 B |
BIN
res/95assets/icons/briefcase-2.png
Normal file
After Width: | Height: | Size: 503 B |
BIN
res/95assets/icons/briefcase-3.png
Normal file
After Width: | Height: | Size: 576 B |
BIN
res/95assets/icons/briefcase-4.png
Normal file
After Width: | Height: | Size: 636 B |
BIN
res/95assets/icons/briefcase-5.png
Normal file
After Width: | Height: | Size: 421 B |
BIN
res/95assets/icons/c_clamp-0.png
Normal file
After Width: | Height: | Size: 353 B |
BIN
res/95assets/icons/c_clamp-1.png
Normal file
After Width: | Height: | Size: 430 B |
BIN
res/95assets/icons/cable-0.png
Normal file
After Width: | Height: | Size: 385 B |