testlucee/query.cfm
2026-02-17 08:31:39 +03:00

86 lines
4.3 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Nubes Lucee CRUD</title>
<style>
body { font-family: 'Segoe UI', Tahoma, sans-serif; margin: 0; padding: 40px; background: #f0f2f5; color: #1c1e21; }
.box { background: #fff; padding: 30px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.08); max-width: 900px; margin: auto; }
.header { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid #005bff; padding-bottom: 15px; margin-bottom: 25px; }
.logo { height: 40px; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ebedf0; }
th { background: #f8f9fa; color: #606770; font-size: 0.9em; text-transform: uppercase; }
.btn { cursor: pointer; padding: 7px 14px; border: none; border-radius: 6px; color: #fff; font-weight: 600; transition: opacity 0.2s; }
.btn:hover { opacity: 0.8; }
.btn-add { background: #005bff; }
.btn-upd { background: #28a745; }
.btn-del { background: #dc3545; }
.input-text { padding: 10px; border: 1px solid #ddd; border-radius: 6px; width: 300px; }
.input-inline { padding: 5px; border: 1px solid #eee; border-radius: 4px; width: 90%; font-family: inherit; }
.err { background: #fff1f0; border: 1px solid #ffa39e; padding: 10px; border-radius: 6px; color: #cf1322; margin-bottom: 20px; }
</style>
</head>
<body>
<div class="box">
<div class="header">
<img src="https://nubes.ru/themes/custom/nubes_2025/logo.svg" alt="Nubes Logo" class="logo">
<h2 style="margin:0; color: #005bff;">Lucee CRUD Demo</h2>
</div>
<cfif structKeyExists(request, "db_error")>
<div class="err"><strong>Ошибка базы данных:</strong><br><cfoutput>#request.db_error#</cfoutput></div>
</cfif>
<form method="post" style="display: flex; gap: 10px; margin-bottom: 30px;">
<input type="hidden" name="crud_action" value="insert">
<input type="text" name="txt_content" placeholder="Введите данные для записи в БД..." required class="input-text" style="flex-grow: 1;">
<button type="submit" class="btn btn-add">Добавить запись</button>
</form>
<cfquery name="qGet" datasource="#request.DS#">
SELECT * FROM nubes_test_table ORDER BY id DESC LIMIT 15
</cfquery>
<table>
<thead>
<tr>
<th style="width: 50px;">ID</th>
<th>Данные в PostgreSQL</th>
<th style="width: 120px;">Действия</th>
</tr>
</thead>
<tbody>
<cfoutput query="qGet">
<tr>
<td>#id#</td>
<td>
<form method="post" id="upd_#id#" style="margin:0">
<input type="hidden" name="crud_action" value="update">
<input type="hidden" name="id" value="#id#">
<input type="text" name="txt_content" value="#HTMLEditFormat(test_data)#" class="input-inline">
</form>
</td>
<td style="display: flex; gap: 5px;">
<button type="submit" form="upd_#id#" class="btn btn-upd" title="Сохранить изменения">💾</button>
<form method="post" style="margin:0" onsubmit="return confirm('Удалить эту запись?')">
<input type="hidden" name="crud_action" value="delete">
<input type="hidden" name="id" value="#id#">
<button type="submit" class="btn btn-del" title="Удалить">🗑</button>
</form>
</td>
</tr>
</cfoutput>
</tbody>
</table>
<div style="margin-top: 30px; padding-top: 15px; border-top: 1px solid #eee; font-size: 0.8em; color: #999; display: flex; justify-content: space-between;">
<span>DS: <strong><cfoutput>#request.DS#</cfoutput></strong></span>
<span>Pod: <cfoutput>$(kubectl get pods -l app=nifiregistry-sample -o name | head -1)</cfoutput></span>
</div>
</div>
</body>
</html>