add: stand configs

This commit is contained in:
“Naeel”
2026-06-30 15:46:24 +04:00
parent ca276d200f
commit 1a52506fb1
91 changed files with 10766 additions and 0 deletions
@@ -0,0 +1,58 @@
<cfcomponent displayname="Application" output="true">
<!--- Базовая конфигурация Lucee и datasource. --->
<cfset this.Name = "nubes-app-v8" />
<cfset this.sessionmanagement = "Yes" />
<cfset this.datasource = "testds" />
<!--- Инициализируем datasource из переменных окружения. --->
<cfset getDS(this.datasource) />
<!--- Собираем datasource из *_field переменных окружения. --->
<cffunction name="getDS" access="private" returntype="void">
<cfargument name="dsname" type="string" required="true"/>
<cfset var system = createObject("java", "java.lang.System")/>
<cfset var ds = {} />
<cfloop list="class,connectionString,database,driver,host,port,type,url,username,password,bundleName,bundleVersion,connectionLimit,liveTimeout,validate" item="field">
<cfset var envVal = system.getEnv("#arguments.dsname#_#field#") />
<cfif isDefined("envVal") AND len(envVal)><cfset ds[field] = envVal /></cfif>
</cfloop>
<cfset this.datasources[arguments.dsname] = ds />
</cffunction>
<!--- CRUD над таблицей nubes_test_table по POST запросам. --->
<cffunction name="OnRequest" access="public" returntype="void" output="true">
<cfargument name="template" type="string" required="true" />
<cfset request.DS = this.datasource />
<!--- Обработка insert/update/delete через form.crud_action. --->
<cfif CGI.REQUEST_METHOD EQ "POST" AND structKeyExists(form, "crud_action")>
<cftry>
<cfswitch expression="#form.crud_action#">
<cfcase value="insert">
<cfquery datasource="#request.DS#">
INSERT INTO nubes_test_table (test_data) VALUES (<cfqueryparam value="#form.txt_content#" cfsqltype="cf_sql_varchar">)
</cfquery>
</cfcase>
<cfcase value="update">
<cfquery datasource="#request.DS#">
UPDATE nubes_test_table SET test_data = <cfqueryparam value="#form.txt_content#" cfsqltype="cf_sql_varchar"> WHERE id = <cfqueryparam value="#form.id#" cfsqltype="cf_sql_integer">
</cfquery>
</cfcase>
<cfcase value="delete">
<cfquery datasource="#request.DS#">
DELETE FROM nubes_test_table WHERE id = <cfqueryparam value="#form.id#" cfsqltype="cf_sql_integer">
</cfquery>
</cfcase>
</cfswitch>
<cflocation url="#CGI.SCRIPT_NAME#" addtoken="false">
<cfcatch><cfset request.db_error = cfcatch.message /></cfcatch>
</cftry>
</cfif>
<!--- Гарантируем наличие таблицы при первом заходе. --->
<cftry>
<cfquery datasource="#request.DS#">CREATE TABLE IF NOT EXISTS nubes_test_table (id SERIAL PRIMARY KEY, test_data TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP);</cfquery>
<cfcatch><cfset request.db_error = cfcatch.message /></cfcatch>
</cftry>
<cfinclude template="#arguments.template#" />
</cffunction>
</cfcomponent>
+11
View File
@@ -0,0 +1,11 @@
# Тестовое приложение by Terraform - Lucee & Postgres
### Что здесь можно делать:
* **Просмотр:** Список последних записей загружается автоматически при открытии страницы.
* **Добавление:** Введите текст в верхнее поле и нажмите кнопку «Добавить», чтобы сохранить данные в базу.
* **Редактирование:** Вы можете изменить текст любой записи прямо в таблице. Не забудьте нажать на кнопку с дискетой (💾), чтобы сохранить изменения.
* **Удаление:** Нажмите на иконку корзины (🗑), чтобы навсегда удалить запись из базы данных.
Примечание: таблица создается автоматически при первом открытии страницы.
+2
View File
@@ -0,0 +1,2 @@
<!--- Редирект на основной UI экран. --->
<cflocation addtoken="No" url="query.cfm##q"/>
+77
View File
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<title>Nubes | Управление данными</title>
<link rel="icon" href="https://nubes.ru/themes/custom/nubes/images/nubes-ico.svg" type="image/svg+xml">
<style>
:root { --nubes-blue: #005BFF; --nubes-dark: #1A1A1A; --nubes-grey: #F8F9FA; --nubes-border: #E5E7EB; }
body { font-family: 'Segoe UI', Tahoma, sans-serif; margin: 0; padding: 0; background: var(--nubes-grey); color: var(--nubes-dark); }
.header-bg { position: sticky; top: 0; z-index: 1000; background: #fff; border-bottom: 1px solid var(--nubes-border); padding: 15px 0; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.container { max-width: 1000px; margin: auto; padding: 0 20px; }
.header-content { display: flex; align-items: center; justify-content: space-between; }
.logo { height: 40px; }
.main-content { padding: 40px 0; }
.card { background: #fff; padding: 32px; border-radius: 16px; box-shadow: 0 4px 20px rgba(0,0,0,0.04); }
.btn { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 12px 24px; border: none; border-radius: 8px; font-weight: 600; font-size: 14px; }
.btn-primary { background: var(--nubes-blue); color: #fff; }
/* Увеличенные кнопки действий */
.btn-action { padding: 12px; background: #fff; border: 1px solid var(--nubes-border); border-radius: 8px; font-size: 24px; line-height: 1; cursor: pointer; min-width: 50px; }
.btn-action:hover { background: var(--nubes-grey); border-color: var(--nubes-blue); }
.input-group { display: flex; gap: 12px; margin-bottom: 32px; }
input[type="text"] { flex-grow: 1; padding: 12px 16px; border: 1px solid var(--nubes-border); border-radius: 8px; font-size: 14px; }
/* Полосатая таблица */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 16px; font-size: 12px; text-transform: uppercase; color: #6B7280; border-bottom: 1px solid var(--nubes-border); }
td { padding: 16px; border-bottom: 1px solid var(--nubes-border); }
tbody tr:nth-child(even) { background-color: #FAFBFC; }
tbody tr:hover { background-color: #F3F4F6; }
.id-cell { font-family: monospace; color: #9CA3AF; width: 60px; }
.actions-cell { display: flex; gap: 12px; width: 130px; }
</style>
</head>
<body>
<!--- Верхняя панель с брендингом. --->
<div class="header-bg">
<div class="container header-content">
<img src="https://nubes.ru/themes/custom/nubes_2025/logo.svg" alt="Nubes" class="logo">
<div style="font-size: 14px; color: var(--nubes-blue); font-weight: 600;">Lucee + Postgres Demo</div>
</div>
</div>
<div class="container main-content">
<!--- Форма добавления записи. --->
<div class="card">
<form method="post" class="input-group">
<input type="hidden" name="crud_action" value="insert">
<input type="text" name="txt_content" placeholder="Новое сообщение..." required>
<button type="submit" class="btn btn-primary">Добавить</button>
</form>
<!--- Читаем последние записи для отображения. --->
<cfquery name="qGet" datasource="#request.DS#">SELECT * FROM nubes_test_table ORDER BY id DESC LIMIT 20</cfquery>
<table>
<thead><tr><th>ID</th><th>Содержимое</th><th>Действия</th></tr></thead>
<tbody>
<cfoutput query="qGet">
<tr>
<td class="id-cell">#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)#" style="width:100%; border:none; background:transparent;">
</form>
</td>
<td class="actions-cell">
<button type="submit" form="upd_#id#" class="btn-action">💾</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-action">🗑</button>
</form>
</td>
</tr>
</cfoutput>
</tbody>
</table>
</div>
</div>
</body>
</html>
+1
View File
@@ -0,0 +1 @@
again test hello