cfmgrv4 init...3
This commit is contained in:
parent
4695ca1284
commit
4bba6ed05d
@ -1,33 +0,0 @@
|
|||||||
<?= $this->extend(LAYOUTS[$viewDatas['layout']]['path']) ?>
|
|
||||||
<?= $this->section('content') ?>
|
|
||||||
<div id="container" class="content">
|
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/form.css" media="screen" rel="stylesheet" type="text/css" />
|
|
||||||
<div class="action_form">
|
|
||||||
<table class="table table-bordered">
|
|
||||||
<tr>
|
|
||||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
|
||||||
<th nowrap class="text-center"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</tr>
|
|
||||||
<?php foreach ($viewDatas['entitys'] as $entity): ?>
|
|
||||||
<?php $viewDatas['entity'] = $entity ?>
|
|
||||||
<tr>
|
|
||||||
<?php foreach ($viewDatas['fields'] as $field): ?>
|
|
||||||
<td nowrap class="text-center"><?= $viewDatas['helper']->getFieldView($field, $viewDatas) ?></td>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</tr>
|
|
||||||
<?php if ($viewDatas['entity']->records): ?>
|
|
||||||
<tr>
|
|
||||||
<td colspan="<?= count($viewDatas['fields']) ?>">
|
|
||||||
<?php foreach ($viewDatas['entity']->records as $record): ?>
|
|
||||||
<div><?= $record->getTitle() ?></div>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<?php endif ?>
|
|
||||||
<?php endforeach ?>
|
|
||||||
</table>
|
|
||||||
<?= isset($viewDatas['message']) ? "<div>{$viewDatas['message']}</div>" : '' ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?= $this->endSection() ?>
|
|
||||||
@ -10,12 +10,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||||
<td nowrap class="text-start">
|
<td nowrap class="text-start">
|
||||||
<?php
|
<?php $extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => ""] : ["class" => "form-control"]; ?>
|
||||||
$extras = ["class" => "form-control"];
|
|
||||||
if (strpos($viewDatas['field_rules'][$field], 'required') !== false) {
|
|
||||||
$extras = ["required" => "", ...$extras];
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field), $viewDatas, $extras) ?>
|
<?= $viewDatas['helper']->getFieldForm($field, old($field), $viewDatas, $extras) ?>
|
||||||
<div><?= validation_show_error($field); ?></div>
|
<div><?= validation_show_error($field); ?></div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -45,7 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||||
<div class="index_bottom"><?= $this->include("templates/common/modal_fetch"); ?></div>
|
<div class="index_bottom"><?= $this->include("templates/common/modal_fetch"); ?></div>
|
||||||
<script type="text/javascript" src="/js/common/resizeTable.js"></script>
|
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/resizeTable.js"></script>
|
||||||
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
|
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/index.js"></script>
|
||||||
</div>
|
</div>
|
||||||
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
<div class="layout_footer"><?= $this->include("templates/{$viewDatas['layout']}/index_footer"); ?></div>
|
||||||
|
|||||||
@ -10,12 +10,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
<th nowrap class="text-end"><?= $viewDatas['helper']->getFieldLabel($field, $viewDatas) ?></th>
|
||||||
<td nowrap class="text-start">
|
<td nowrap class="text-start">
|
||||||
<?php
|
<?php $extras = (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? ["class" => "form-control", "required" => ""] : ["class" => "form-control"]; ?>
|
||||||
$extras = ["class" => 'form-control'];
|
|
||||||
if (strpos($viewDatas['field_rules'][$field], 'required') !== false) {
|
|
||||||
$extras = ["required" => "", ...$extras];
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field, $viewDatas, $extras) ?>
|
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? $viewDatas['entity']->$field, $viewDatas, $extras) ?>
|
||||||
<div><?= validation_show_error($field); ?></div>
|
<div><?= validation_show_error($field); ?></div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
<!-- botto start -->
|
||||||
<nav class="tail navbar navbar-expand-lg">
|
<nav class="tail navbar navbar-expand-lg">
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
|
<!-- bottom end -->
|
||||||
@ -10,4 +10,5 @@
|
|||||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/cloudflare'); ?>
|
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/cloudflare'); ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="menu_button">메뉴열기</div>
|
<div id="menu_button">메뉴열기</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- left menu end -->
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
<!-- top start -->
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<nav class="nav"><a class="navbar-brand" href="#">CFMGR 관리</a></nav>
|
<nav class="nav"><a class="navbar-brand" href="#">CFMGR 관리</a></nav>
|
||||||
@ -30,15 +31,15 @@
|
|||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
<ul class="dropdown-menu dropdown-menu-end">
|
||||||
<li><?= form_label(
|
<li><?= form_label(
|
||||||
ICONS['SETUP'] . "정보수정",
|
ICONS['SETUP'] . "정보수정",
|
||||||
"modify",
|
"modify",
|
||||||
[
|
[
|
||||||
"class" => "dropdown-item",
|
"class" => "dropdown-item",
|
||||||
"data-src" => "/admin/user/modify/" . $viewDatas['myauth']->getAuthInfo('uid'),
|
"data-src" => "/admin/user/modify/" . $viewDatas['myauth']->getAuthInfo('uid'),
|
||||||
"data-bs-toggle" => "modal",
|
"data-bs-toggle" => "modal",
|
||||||
"data-bs-target" => "#index_action_form"
|
"data-bs-target" => "#index_action_form"
|
||||||
]
|
]
|
||||||
) ?></li>
|
) ?></li>
|
||||||
<li>
|
<li>
|
||||||
<hr class="dropdown-divider">
|
<hr class="dropdown-divider">
|
||||||
</li>
|
</li>
|
||||||
@ -50,4 +51,5 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
<!-- top end -->
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
<!-- botto start -->
|
||||||
<nav class="tail navbar navbar-expand-lg">
|
<nav class="tail navbar navbar-expand-lg">
|
||||||
|
|
||||||
</nav>
|
</nav>
|
||||||
|
<!-- bottom end -->
|
||||||
@ -1,13 +1,2 @@
|
|||||||
<!-- left menu start -->
|
<!-- left menu start -->
|
||||||
<link href="/css/<?= $viewDatas['layout'] ?>/left_menu.css" media="screen" rel="stylesheet" type="text/css" />
|
<!-- left menu end -->
|
||||||
<script type="text/javascript" src="/js/<?= $viewDatas['layout'] ?>/left_menu.js"></script>
|
|
||||||
<div id="left_menu" onMouseOver="sideMenuToggle(this);" onMouseOut="sideMenuToggle(this);">
|
|
||||||
<div id="accordion" class="accordion accordion-flush">
|
|
||||||
<div class="main">
|
|
||||||
<a href="/admin/user"><?= ICONS["HOME"] ?> Main</a>
|
|
||||||
</div>
|
|
||||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/base'); ?>
|
|
||||||
<?= $this->include(LAYOUTS[$viewDatas['layout']]['path'] . '/left_menu/cloudflare'); ?>
|
|
||||||
</div>
|
|
||||||
<div id="menu_button">메뉴열기</div>
|
|
||||||
</div>
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/user"><?= ICONS['MEMBER'] ?>계정 관리</a>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/usersns"><?= ICONS['GOOGLE'] ?> SNS 계정 관리</a>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/mapurl"><?= ICONS['FLAG'] ?> MapURL 관리</a>
|
|
||||||
</div>
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
<h2 class="accordion-header">
|
|
||||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
|
|
||||||
data-bs-target="#flush-heading1" aria-expanded="false"
|
|
||||||
aria-controls="flush-heading1"><b><?= ICONS['CLOUD'] ?> Cloudflare API</b>
|
|
||||||
</button>
|
|
||||||
</h2>
|
|
||||||
<div id="flush-heading1" class="accordion-collapse collapse show" aria-labelledby="flush-heading1">
|
|
||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/cloudflare/auth"><?= ICONS['DATABASE'] ?> Auth</a>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/cloudflare/account"><?= ICONS['SIGNPOST'] ?> Account</a>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/cloudflare/zone"><?= ICONS['BOXS'] ?> Zone</a>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/cloudflare/record"><?= ICONS['BOX'] ?> Record</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
<h2 class="accordion-header">
|
|
||||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
|
|
||||||
data-bs-target="#flush-heading2" aria-expanded="false"
|
|
||||||
aria-controls="flush-heading2"><b>사이트관리</b></button>
|
|
||||||
</h2>
|
|
||||||
<div id="flush-heading2" class="accordion-collapse collapse show" aria-labelledby="flush-heading2">
|
|
||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/board"> 게시글 관리</a>
|
|
||||||
</div>
|
|
||||||
<div class="accordion-item">
|
|
||||||
<a href="/admin/sitepage"> SitePage 관리</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@ -1,17 +1,11 @@
|
|||||||
|
<!-- top start -->
|
||||||
<nav class="navbar navbar-expand-lg">
|
<nav class="navbar navbar-expand-lg">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<nav class="nav"><a class="navbar-brand" href="#">관리페이지</a></nav>
|
<nav class="nav"><a class="navbar-brand" href="#">사용자페이지</a></nav>
|
||||||
<ul class="nav justify-content-center">
|
<ul class="nav justify-content-center">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<?= ICONS['LOCK'] ?>
|
<?= ICONS['LOCK'] ?>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
|
||||||
<input type="text" class="form-control" value="<?= $viewDatas['helper']->getPasswordString() ?>" id="makePassword">
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<button class="btn btn-default border border-dark" type="button" id="totSearchBtn"
|
|
||||||
onClick="window.location.reload();"><?= ICONS['SEARCH'] ?></button>
|
|
||||||
</li>
|
|
||||||
<!-- <li class="nav-item">
|
<!-- <li class="nav-item">
|
||||||
<form class="d-flex me-20" role="search">
|
<form class="d-flex me-20" role="search">
|
||||||
<input class="form-control" type="search" placeholder="Search" aria-label="Search">
|
<input class="form-control" type="search" placeholder="Search" aria-label="Search">
|
||||||
@ -21,20 +15,31 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<ul class="nav justify-content-end">
|
<ul class="nav justify-content-end">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<?php if ($viewDatas['session']->get(SESSION_NAMES['ISLOGIN'])): ?>
|
<?php if ($viewDatas['myauth']->isLoggedIn()): ?>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
<button type="button" class="btn btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown"
|
||||||
<b><?= ICONS['LOGIN'] . $viewDatas['session']->get(SESSION_NAMES['AUTH'])['name'] ?></b>
|
aria-expanded="false">
|
||||||
|
<b><?= ICONS['LOGIN'] . $viewDatas['myauth']->getAuthInfo('name') ?></b>
|
||||||
</button>
|
</button>
|
||||||
<ul class="dropdown-menu dropdown-menu-end">
|
<ul class="dropdown-menu dropdown-menu-end">
|
||||||
<li><?= anchor("/admin/user/modify/" . $viewDatas['session']->get(SESSION_NAMES['AUTH'])['uid'], ICONS['SETUP'] . "정보수정", ["class" => "dropdown-item"]) ?></li>
|
<li><?= form_label(
|
||||||
|
ICONS['SETUP'] . "정보수정",
|
||||||
|
"modify",
|
||||||
|
[
|
||||||
|
"class" => "dropdown-item",
|
||||||
|
"data-src" => "/user/modify/" . $viewDatas['myauth']->getAuthInfo('uid'),
|
||||||
|
"data-bs-toggle" => "modal",
|
||||||
|
"data-bs-target" => "#index_action_form"
|
||||||
|
]
|
||||||
|
) ?></li>
|
||||||
<li>
|
<li>
|
||||||
<hr class="dropdown-divider">
|
<hr class="dropdown-divider">
|
||||||
</li>
|
</li>
|
||||||
<li><a class="dropdown-item" href="<?= URLS['LOGOUT'] ?>"><?= ICONS['LOGOUT'] ?>Logout</a></li>
|
<li><a class="dropdown-item" href="<?= URLS['LOGOUT'] ?>"><?= ICONS['LOGOUT'] ?>Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php else: ?><a class="nav-link dropdown-toggle" href="<?= URLS['LOGIN'] ?>" role="button"><?= ICONS['LOGIN'] ?>Login</a><?php endif ?>
|
<?php else: ?><a class="nav-link dropdown-toggle" href="<?= URLS['LOGIN'] ?>"
|
||||||
|
role="button"><?= ICONS['LOGIN'] ?>Login</a><?php endif ?>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -31,25 +31,46 @@
|
|||||||
|
|
||||||
async function loadContent(url) {
|
async function loadContent(url) {
|
||||||
try {
|
try {
|
||||||
|
//console.log('콘텐츠 로딩 시작:', url);
|
||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`HTTP 오류! 상태: ${response.status}`);
|
throw new Error(`HTTP 오류! 상태: ${response.status}`);
|
||||||
}
|
}
|
||||||
const content = await response.text();
|
const content = await response.text();
|
||||||
|
//console.log('받은 콘텐츠:', content.substring(0, 100) + '...'); // 콘텐츠의 처음 100자만 로그
|
||||||
modalBody.innerHTML = content;
|
modalBody.innerHTML = content;
|
||||||
// 새로 추가된 스크립트 실행
|
|
||||||
|
//console.log('form.js 로딩 시작');
|
||||||
|
const formScriptPath = '/js/<?= $viewDatas['layout'] ?>/form.js';
|
||||||
|
//console.log('form.js 경로:', formScriptPath);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await loadScript(formScriptPath);
|
||||||
|
//console.log('form.js 로드 완료');
|
||||||
|
if (typeof window.initializeForm === 'function') {
|
||||||
|
//console.log('initializeForm 함수 실행');
|
||||||
|
window.initializeForm();
|
||||||
|
} else {
|
||||||
|
//console.log('initializeForm 함수를 찾을 수 없음');
|
||||||
|
}
|
||||||
|
} catch (scriptError) {
|
||||||
|
console.error('form.js 로드 중 오류 발생:', scriptError);
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log('추가 스크립트 실행 시작');
|
||||||
const scripts = modalBody.getElementsByTagName('script');
|
const scripts = modalBody.getElementsByTagName('script');
|
||||||
for (let script of scripts) {
|
for (let script of scripts) {
|
||||||
if (script.src) {
|
if (script.src) {
|
||||||
// 외부 스크립트 로드
|
//console.log('외부 스크립트 로드:', script.src);
|
||||||
const newScript = document.createElement('script');
|
const newScript = document.createElement('script');
|
||||||
newScript.src = script.src;
|
newScript.src = script.src;
|
||||||
document.body.appendChild(newScript);
|
document.body.appendChild(newScript);
|
||||||
} else {
|
} else {
|
||||||
// 인라인 스크립트 실행
|
//console.log('인라인 스크립트 실행');
|
||||||
eval(script.innerHTML);
|
eval(script.innerHTML);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//console.log('setupFormSubmission 실행');
|
||||||
setupFormSubmission();
|
setupFormSubmission();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('콘텐츠 로드 중 오류 발생:', error);
|
console.error('콘텐츠 로드 중 오류 발생:', error);
|
||||||
@ -58,9 +79,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setupFormSubmission() {
|
function setupFormSubmission() {
|
||||||
|
//console.log('setupFormSubmission 시작');
|
||||||
const form = modalBody.querySelector('form');
|
const form = modalBody.querySelector('form');
|
||||||
if (form) {
|
if (form) {
|
||||||
|
//console.log('폼 찾음:', form);
|
||||||
form.addEventListener('submit', async (e) => {
|
form.addEventListener('submit', async (e) => {
|
||||||
|
//console.log('폼 제출 이벤트 발생');
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
try {
|
try {
|
||||||
@ -99,6 +123,8 @@
|
|||||||
modalBody.innerHTML = '<p>데이터 저장 중 오류가 발생했습니다. 다시 시도해 주세요.</p>';
|
modalBody.innerHTML = '<p>데이터 저장 중 오류가 발생했습니다. 다시 시도해 주세요.</p>';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
//console.log('폼을 찾을 수 없음');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,4 +142,27 @@
|
|||||||
modal.addEventListener('hidden.bs.modal', () => {
|
modal.addEventListener('hidden.bs.modal', () => {
|
||||||
modalBody.innerHTML = '';
|
modalBody.innerHTML = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function loadScript(src) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.src = src;
|
||||||
|
script.onload = () => {
|
||||||
|
//console.log(`스크립트 로드 완료: ${src}`);
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
script.onerror = () => reject(new Error(`스크립트 로드 실패: ${src}`));
|
||||||
|
document.body.appendChild(script);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 모달이 완전히 표시된 후 form.js 초기화 함수 호출
|
||||||
|
document.getElementById('index_action_form').addEventListener('shown.bs.modal', function() {
|
||||||
|
if (typeof window.initializeForm === 'function') {
|
||||||
|
//console.log('모달 표시 후 initializeForm 함수 실행');
|
||||||
|
window.initializeForm();
|
||||||
|
} else {
|
||||||
|
//console.log('모달 표시 후에도 initializeForm 함수를 찾을 수 없음');
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -70,12 +70,4 @@ async function getElementsByClassNameCopyToClipboard(class_name)
|
|||||||
await navigator.clipboard.writeText(textToCopy)
|
await navigator.clipboard.writeText(textToCopy)
|
||||||
.then(() => { alert("복사가 완료되었습니다."); })
|
.then(() => { alert("복사가 완료되었습니다."); })
|
||||||
.catch(err => { console.log('복사가 오류', err); })
|
.catch(err => { console.log('복사가 오류', err); })
|
||||||
}
|
|
||||||
|
|
||||||
//해당 URL의 페이지를 접속해서 targ의 위치에 표시한다.
|
|
||||||
function loadContentForm(url,target) {
|
|
||||||
fetch(url)
|
|
||||||
.then(response => response.text())
|
|
||||||
.then(data => {target.innerHTML = data})
|
|
||||||
.catch(error => console.error('Error loading form:', error));
|
|
||||||
}
|
}
|
||||||
@ -1,64 +1,119 @@
|
|||||||
$(document).ready(function () {
|
(function() {
|
||||||
//class가 calender인 inputbox용,날짜field용
|
//console.log('form.js가 로드되었습니다.');
|
||||||
$(".calender").datepicker({
|
|
||||||
changeYear: true,
|
function initializeModalComponents(modal) {
|
||||||
changeMonth: true,
|
//console.log('모달 컴포넌트 초기화 시작');
|
||||||
yearRange: "-10:+0",
|
|
||||||
dateFormat: "yy-mm-dd"
|
// 약간의 지연을 주어 모달이 완전히 렌더링되도록 함
|
||||||
});
|
setTimeout(() => {
|
||||||
//id가 batchjobuids_checkbox인 버튼을 클릭시 class가 batchjobuids_checkboxs인 checkbox용
|
initializeCalendar(modal);
|
||||||
$('#batchjobuids_checkbox').click(function (event) {
|
initializeSelectField(modal);
|
||||||
if (this.checked) {
|
initializeTinyMCE(modal);
|
||||||
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
}, 100);
|
||||||
$(this).prop('checked', true); //check
|
}
|
||||||
|
|
||||||
|
function initializeCalendar(container) {
|
||||||
|
const calendarInputs = container.querySelectorAll('.calender');
|
||||||
|
if (calendarInputs.length > 0) {
|
||||||
|
//console.log('달력 초기화 시작');
|
||||||
|
$(calendarInputs).datepicker({
|
||||||
|
changeYear: true,
|
||||||
|
changeMonth: true,
|
||||||
|
yearRange: "-10:+0",
|
||||||
|
dateFormat: "yy-mm-dd"
|
||||||
});
|
});
|
||||||
} else {
|
//console.log('달력 초기화 완료');
|
||||||
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
}
|
||||||
$(this).prop('checked', false); //uncheck
|
}
|
||||||
|
|
||||||
|
function initializeSelectField(container) {
|
||||||
|
const selectFields = container.querySelectorAll('.select-field');
|
||||||
|
if (selectFields.length > 0 && typeof $.fn.select2 !== 'undefined') {
|
||||||
|
//console.log('선택 필드 초기화 시작');
|
||||||
|
$(selectFields).select2({
|
||||||
|
theme: "classic",
|
||||||
|
width: 'style',
|
||||||
|
dropdownAutoWidth: true,
|
||||||
|
dropdownParent: $('#index_action_form'),
|
||||||
|
containerCssClass: 'text-start', // 왼쪽 정렬을 위한 클래스 추가
|
||||||
|
dropdownCssClass: 'text-start' // 드롭다운 메뉴도 왼쪽 정렬
|
||||||
|
});
|
||||||
|
//console.log('선택 필드 초기화 완료');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeTinyMCE(container) {
|
||||||
|
const textareas = container.querySelectorAll('textarea.tinymce');
|
||||||
|
if (textareas.length > 0 && typeof tinymce !== 'undefined') {
|
||||||
|
//console.log('TinyMCE 초기화 시작');
|
||||||
|
tinymce.init({
|
||||||
|
selector: textareas,
|
||||||
|
plugins: ['code', 'image', 'preview', 'table', 'emoticons', 'autoresize'],
|
||||||
|
height: 600,
|
||||||
|
automatic_uploads: false,
|
||||||
|
images_upload_url: '/tinymce_upload.php',
|
||||||
|
images_upload_handler: function (blobInfo, success, failure) {
|
||||||
|
var xhr, formData;
|
||||||
|
xhr = new XMLHttpRequest();
|
||||||
|
xhr.withCredentials = false;
|
||||||
|
xhr.open('POST', '/tinymce_upload.php');
|
||||||
|
xhr.onload = function () {
|
||||||
|
var json;
|
||||||
|
if (xhr.status != 200) {
|
||||||
|
failure('HTTP Error: ' + xhr.status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
json = JSON.parse(xhr.responseText);
|
||||||
|
if (!json || typeof json.file_path != 'string') {
|
||||||
|
failure('Invalid JSON: ' + xhr.responseText);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
success(json.file_path);
|
||||||
|
};
|
||||||
|
formData = new FormData();
|
||||||
|
formData.append('file', blobInfo.blob(), blobInfo.filename());
|
||||||
|
xhr.send(formData);
|
||||||
|
},
|
||||||
|
setup: function(editor) {
|
||||||
|
editor.on('init', function() {
|
||||||
|
//console.log('TinyMCE 에디터 초기화 완료');
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
//class가 select-field인 SelectBox용
|
|
||||||
$(".select-field").select2({
|
// MutationObserver 설정
|
||||||
theme: "bootstrap-5",
|
const observer = new MutationObserver(function(mutations) {
|
||||||
dropdownParent: $('#index_action_form'),
|
mutations.forEach(function(mutation) {
|
||||||
templateResult: function(data) {
|
if (mutation.type === 'childList') {
|
||||||
if (!data.id) return data.text;
|
const addedNodes = mutation.addedNodes;
|
||||||
return $('<span style="text-align: left; display: block;">').text(data.text);
|
for (let i = 0; i < addedNodes.length; i++) {
|
||||||
}
|
if (addedNodes[i].nodeType === 1 && addedNodes[i].matches('.modal')) {
|
||||||
});
|
//console.log('새로운 모달이 추가되었습니다.');
|
||||||
// text editor 초기화
|
initializeModalComponents(addedNodes[i]);
|
||||||
//참고: https://phppot.com/menu/php/learn-php/
|
}
|
||||||
// class가 editor인 textarea용
|
|
||||||
tinymce.init({
|
|
||||||
selector: 'textarea.tinymce',
|
|
||||||
plugins: ['code', 'image', 'preview', 'table', 'emoticons', 'autoresize'],
|
|
||||||
height: 600,
|
|
||||||
// content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
|
|
||||||
automatic_uploads: false,
|
|
||||||
images_upload_url: '/tinymce_upload.php',
|
|
||||||
// images_upload_base_path: '/upload_images',
|
|
||||||
images_upload_handler: function (blobInfo, success, failure) {
|
|
||||||
var xhr, formData;
|
|
||||||
xhr = new XMLHttpRequest();
|
|
||||||
xhr.withCredentials = false;
|
|
||||||
xhr.open('POST', '/tinymce_upload.php');
|
|
||||||
xhr.onload = function () {
|
|
||||||
var json;
|
|
||||||
if (xhr.status != 200) {
|
|
||||||
failure('HTTP Error: ' + xhr.status);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
json = JSON.parse(xhr.responseText);
|
}
|
||||||
if (!json || typeof json.file_path != 'string') {
|
});
|
||||||
failure('Invalid JSON: ' + xhr.responseText);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
success(json.file_path);
|
|
||||||
};
|
|
||||||
formData = new FormData();
|
|
||||||
formData.append('file', blobInfo.blob(), blobInfo.filename());
|
|
||||||
xhr.send(formData);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
// 전체 문서에 대해 MutationObserver 시작
|
||||||
|
observer.observe(document.body, { childList: true, subtree: true });
|
||||||
|
|
||||||
|
// 모달 표시 이벤트 리스너
|
||||||
|
document.body.addEventListener('shown.bs.modal', function(event) {
|
||||||
|
//console.log('모달이 표시되었습니다.');
|
||||||
|
initializeModalComponents(event.target);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 페이지 로드 시 전체 문서에 대해 초기화 실행
|
||||||
|
//console.log('페이지 로드 시 초기화 시작');
|
||||||
|
initializeModalComponents(document.body);
|
||||||
|
|
||||||
|
// 전역 스코프에 함수 노출
|
||||||
|
window.initializeForm = function() {
|
||||||
|
//console.log('initializeForm 함수가 호출되었습니다.');
|
||||||
|
initializeModalComponents(document.body);
|
||||||
|
};
|
||||||
|
})();
|
||||||
@ -1,61 +1,33 @@
|
|||||||
$(document).ready(function () {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
//class가 calender인 inputbox용,날짜field용
|
//class가 calender인 inputbox용,날짜field용
|
||||||
$(".calender").datepicker({
|
if (document.querySelector(".calender")) {
|
||||||
changeYear: true,
|
$(".calender").datepicker({
|
||||||
changeMonth: true,
|
changeYear: true,
|
||||||
yearRange: "-10:+0",
|
changeMonth: true,
|
||||||
dateFormat: "yy-mm-dd"
|
yearRange: "-10:+0",
|
||||||
});
|
dateFormat: "yy-mm-dd"
|
||||||
//id가 batchjobuids_checkbox인 버튼을 클릭시 class가 batchjobuids_checkboxs인 checkbox용
|
});
|
||||||
$('#batchjobuids_checkbox').click(function (event) {
|
}
|
||||||
if (this.checked) {
|
if (document.querySelector(".batchjobuids_checkboxs")) {
|
||||||
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
//id가 batchjobuids_checkbox인 버튼을 클릭시 class가 batchjobuids_checkboxs인 checkbox용
|
||||||
$(this).prop('checked', true); //check
|
$('#batchjobuids_checkbox').click(function (event) {
|
||||||
});
|
if (this.checked) {
|
||||||
} else {
|
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
||||||
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
$(this).prop('checked', true); //check
|
||||||
$(this).prop('checked', false); //uncheck
|
});
|
||||||
});
|
} else {
|
||||||
}
|
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
||||||
});
|
$(this).prop('checked', false); //uncheck
|
||||||
//class가 select-field인 SelectBox용
|
});
|
||||||
$(".select-field").select2({
|
}
|
||||||
theme: "classic",
|
});
|
||||||
width: 'style',
|
}
|
||||||
dropdownAutoWidth: true
|
if (document.querySelector(".select-field")) {
|
||||||
});
|
//class가 select-field인 SelectBox용
|
||||||
// text editor 초기화
|
$(".select-field").select2({
|
||||||
//참고: https://phppot.com/menu/php/learn-php/
|
theme: "classic",
|
||||||
// class가 editor인 textarea용
|
width: 'style',
|
||||||
tinymce.init({
|
dropdownAutoWidth: true
|
||||||
selector: 'textarea.tinymce',
|
});
|
||||||
plugins: ['code', 'image', 'preview', 'table', 'emoticons', 'autoresize'],
|
}
|
||||||
height: 600,
|
|
||||||
// content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
|
|
||||||
automatic_uploads: false,
|
|
||||||
images_upload_url: '/tinymce_upload.php',
|
|
||||||
// images_upload_base_path: '/upload_images',
|
|
||||||
images_upload_handler: function (blobInfo, success, failure) {
|
|
||||||
var xhr, formData;
|
|
||||||
xhr = new XMLHttpRequest();
|
|
||||||
xhr.withCredentials = false;
|
|
||||||
xhr.open('POST', '/tinymce_upload.php');
|
|
||||||
xhr.onload = function () {
|
|
||||||
var json;
|
|
||||||
if (xhr.status != 200) {
|
|
||||||
failure('HTTP Error: ' + xhr.status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
json = JSON.parse(xhr.responseText);
|
|
||||||
if (!json || typeof json.file_path != 'string') {
|
|
||||||
failure('Invalid JSON: ' + xhr.responseText);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
success(json.file_path);
|
|
||||||
};
|
|
||||||
formData = new FormData();
|
|
||||||
formData.append('file', blobInfo.blob(), blobInfo.filename());
|
|
||||||
xhr.send(formData);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
@ -1,61 +1,33 @@
|
|||||||
$(document).ready(function () {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
//class가 calender인 inputbox용,날짜field용
|
//class가 calender인 inputbox용,날짜field용
|
||||||
$(".calender").datepicker({
|
if (document.querySelector(".calender")) {
|
||||||
changeYear: true,
|
$(".calender").datepicker({
|
||||||
changeMonth: true,
|
changeYear: true,
|
||||||
yearRange: "-10:+0",
|
changeMonth: true,
|
||||||
dateFormat: "yy-mm-dd"
|
yearRange: "-10:+0",
|
||||||
});
|
dateFormat: "yy-mm-dd"
|
||||||
//id가 batchjobuids_checkbox인 버튼을 클릭시 class가 batchjobuids_checkboxs인 checkbox용
|
});
|
||||||
$('#batchjobuids_checkbox').click(function (event) {
|
}
|
||||||
if (this.checked) {
|
if (document.querySelector(".batchjobuids_checkboxs")) {
|
||||||
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
//id가 batchjobuids_checkbox인 버튼을 클릭시 class가 batchjobuids_checkboxs인 checkbox용
|
||||||
$(this).prop('checked', true); //check
|
$('#batchjobuids_checkbox').click(function (event) {
|
||||||
});
|
if (this.checked) {
|
||||||
} else {
|
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
||||||
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
$(this).prop('checked', true); //check
|
||||||
$(this).prop('checked', false); //uncheck
|
});
|
||||||
});
|
} else {
|
||||||
}
|
$('.batchjobuids_checkboxs').each(function () { //loop checkbox
|
||||||
});
|
$(this).prop('checked', false); //uncheck
|
||||||
//class가 select-field인 SelectBox용
|
});
|
||||||
$(".select-field").select2({
|
}
|
||||||
theme: "classic",
|
});
|
||||||
width: 'style',
|
}
|
||||||
dropdownAutoWidth: true
|
if (document.querySelector(".select-field")) {
|
||||||
});
|
//class가 select-field인 SelectBox용
|
||||||
// text editor 초기화
|
$(".select-field").select2({
|
||||||
//참고: https://phppot.com/menu/php/learn-php/
|
theme: "classic",
|
||||||
// class가 editor인 textarea용
|
width: 'style',
|
||||||
tinymce.init({
|
dropdownAutoWidth: true
|
||||||
selector: 'textarea.tinymce',
|
});
|
||||||
plugins: ['code', 'image', 'preview', 'table', 'emoticons', 'autoresize'],
|
}
|
||||||
height: 600,
|
|
||||||
// content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
|
|
||||||
automatic_uploads: false,
|
|
||||||
images_upload_url: '/tinymce_upload.php',
|
|
||||||
// images_upload_base_path: '/upload_images',
|
|
||||||
images_upload_handler: function (blobInfo, success, failure) {
|
|
||||||
var xhr, formData;
|
|
||||||
xhr = new XMLHttpRequest();
|
|
||||||
xhr.withCredentials = false;
|
|
||||||
xhr.open('POST', '/tinymce_upload.php');
|
|
||||||
xhr.onload = function () {
|
|
||||||
var json;
|
|
||||||
if (xhr.status != 200) {
|
|
||||||
failure('HTTP Error: ' + xhr.status);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
json = JSON.parse(xhr.responseText);
|
|
||||||
if (!json || typeof json.file_path != 'string') {
|
|
||||||
failure('Invalid JSON: ' + xhr.responseText);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
success(json.file_path);
|
|
||||||
};
|
|
||||||
formData = new FormData();
|
|
||||||
formData.append('file', blobInfo.blob(), blobInfo.filename());
|
|
||||||
xhr.send(formData);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
@ -1,93 +0,0 @@
|
|||||||
/* ------------------------------------------------------------
|
|
||||||
* Name : front.js
|
|
||||||
* Desc : Front Javascrip
|
|
||||||
* Created : 2016/9/11 Tri-aBility by Junheum,Choi
|
|
||||||
* Updated :
|
|
||||||
------------------------------------------------------------ */
|
|
||||||
|
|
||||||
function trim(str){
|
|
||||||
return this.replace(/(^\s*)|(\s*$)/gi, "");
|
|
||||||
}//
|
|
||||||
|
|
||||||
function bookmarksite(title,url) {
|
|
||||||
if (window.sidebar) // firefox
|
|
||||||
window.sidebar.addPanel(title, url, "");
|
|
||||||
else if(window.opera && window.print){ // opera
|
|
||||||
var elem = document.createElement('a');
|
|
||||||
elem.setAttribute('href',url);
|
|
||||||
elem.setAttribute('title',title);
|
|
||||||
elem.setAttribute('rel','sidebar');
|
|
||||||
elem.click();
|
|
||||||
}
|
|
||||||
else if(document.all) // ie
|
|
||||||
window.external.AddFavorite(url, title);
|
|
||||||
}//
|
|
||||||
|
|
||||||
function captcha_refresh(refresh_url) {
|
|
||||||
$.ajax({
|
|
||||||
type: 'POST',
|
|
||||||
url: refresh_url,
|
|
||||||
success: function(data, status, xhr){
|
|
||||||
if(data)
|
|
||||||
$('#captcha_span').html(data);
|
|
||||||
},
|
|
||||||
error: function(jqXHR, textStatus, errorThrown) {
|
|
||||||
console.log(jqXHR.responseText);
|
|
||||||
console.log(textStatus+'=>'+errorThrown);
|
|
||||||
}
|
|
||||||
});//ajax
|
|
||||||
}//
|
|
||||||
|
|
||||||
function is_NumericKey(evt,obj){
|
|
||||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
|
||||||
switch(charCode){
|
|
||||||
case 48://0
|
|
||||||
case 49://1
|
|
||||||
case 50://2
|
|
||||||
case 51://3
|
|
||||||
case 52://4
|
|
||||||
case 53://5
|
|
||||||
case 54://6
|
|
||||||
case 55://7
|
|
||||||
case 56://8
|
|
||||||
case 57://9
|
|
||||||
case 96://KeyPad:0
|
|
||||||
case 97://KeyPad:1
|
|
||||||
case 98://KeyPad:2
|
|
||||||
case 99://KeyPad:3
|
|
||||||
case 100://KeyPad:4
|
|
||||||
case 101://KeyPad:5
|
|
||||||
case 102://KeyPad:6
|
|
||||||
case 103://KeyPad:7
|
|
||||||
case 104://KeyPad:8
|
|
||||||
case 105://KeyPad:9
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
alert('숫자만 가능합니다['+charCode+']');
|
|
||||||
obj.value = obj.value.substring(0,obj.value.length-1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function is_NumericType(data){
|
|
||||||
if(!data.match(/^[0-9]+$/)){
|
|
||||||
throw (new Error('숫자가 아닌값['+data+']이 있습니다'));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}//
|
|
||||||
function change_CurrencyFormat(obj,currencies){
|
|
||||||
//var currencies = document.getElementsByClassName("currency");
|
|
||||||
var total_currency = 0;
|
|
||||||
for(i=0; i<currencies.length; i+2){
|
|
||||||
try {
|
|
||||||
is_NumericType(currencies[i].value)//값이 숫자형식인지 판단
|
|
||||||
} catch(err) {
|
|
||||||
alert(err.message);
|
|
||||||
currencies[i].focus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
total_currency += parseInt(currencies[i].value);
|
|
||||||
currencies[i].parentElement.innerHTML=currencies[i].value.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+'원';
|
|
||||||
}
|
|
||||||
obj.parentElement.innerHTML=total_currency.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+'원'
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user