dbms_init...1

This commit is contained in:
choi.jh 2025-07-07 09:55:24 +09:00
parent 348433857f
commit 3835fd85ac
4 changed files with 68 additions and 32 deletions

View File

@ -45,6 +45,9 @@ class DomainController extends PartController
$view_file = $this->view_path . 'domain' . DIRECTORY_SEPARATOR . 'view';
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
break;
case 'create_form':
$result = parent::getResultSuccess($message, $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'domain');
break;
default:
$result = parent::getResultSuccess($message, $actionTemplate);
break;

View File

@ -19,7 +19,7 @@ class DomainHelper extends PartHelper
}
switch ($field) {
case 'domain':
$form = form_input($field, "", ['id' => $field, "placeholder" => "예)domain.co.kr", ...$extras]);
$form = form_input($field, $value ?? "", ['id' => $field, "placeholder" => "예)domain.co.kr", ...$extras]);
$form .= "<div id=\"domain-errors\" style=\"color:red; margin-top:5px;\"></div>";
break;
default:

View File

@ -0,0 +1,64 @@
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
<?= $this->section('content') ?>
<?php if ($error = session('error')): echo $viewDatas['helper']->alert($error) ?><?php endif ?>
<div id="container" class="content">
<div class="form_top"><?= $this->include("templates/{$viewDatas['layout']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<div class="action_form">
<table class="table table-bordered">
<?php foreach ($viewDatas['control']['form_fields'] as $field): ?>
<tr>
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, lang("{$viewDatas['class_path']}.label.{$field}"), $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas[$field] ?? null), $viewDatas) ?>
<span><?= validation_show_error($field); ?></span>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
</div>
<div class="form_bottom"><?= $this->include("templates/{$viewDatas['layout']}/form_content_bottom"); ?></div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
if (document.querySelector('#domain')) {
const domainSelecor = document.querySelector('#domain')
const errorBox = document.getElementById('domain-errors');
const tagify = new Tagify(domainSelecor, {
enforceWhitelist: false,
whitelist: [],
duplicates: false,
delimiters: ", ",
pattern: /[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/ // 도메인주소 패턴
});
// ✅ 패턴이 맞지 않을 때
tagify.on('invalid', e => {
const value = e.detail.data.value;
errorBox.innerText = `"${value}" 은(는) 유효한 도메인 형식이 아닙니다. 예: domain.co.kr`;
});
// ✅ 서버에서 존재 여부 확인
tagify.on('add', async e => {
const domain = e.detail.data.value;
const res = await fetch('/admin/equipment/part/domain/confirm', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
domain
})
});
const results = await res.json();
// 이미 존재하는 도메인인지 확인 결과처리
if (exists = results.exists === true || results.exists === 'true') {
tagify.removeTag(domain);
errorBox.innerText = results.message;
}
});
}
});
</script>
<?= $this->endSection() ?>

View File

@ -31,35 +31,4 @@ document.addEventListener('DOMContentLoaded', function() {
dropdownAutoWidth: true
});
}
if (document.querySelector('#domain')) {
const domainSelecor = document.querySelector('#domain')
const errorBox = document.getElementById('domain-errors');
const tagify = new Tagify(domainSelecor, {
enforceWhitelist: false,
whitelist: [],
duplicates: false,
delimiters: ", ",
pattern: /[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/ // 도메인주소 패턴
});
// ✅ 패턴이 맞지 않을 때
tagify.on('invalid', e => {
const value = e.detail.data.value;
errorBox.innerText = `"${value}" 은(는) 유효한 도메인 형식이 아니거나 중복됩니다. 예: domain.co.kr`;
});
// ✅ 서버에서 존재 여부 확인
tagify.on('add', async e => {
const domain = e.detail.data.value;
const res = await fetch('/admin/equipment/part/domain/confirm', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({domain})
});
const results = await res.json();
if (exists = results.exists === true || results.exists === 'true') {
tagify.removeTag(domain); // 이미 존재하는 도메인 제거
errorBox.innerText = results.message;
}
});
}
});