cfmgrv4 init...2
This commit is contained in:
parent
3bb12fc83f
commit
f8ebfb7872
@ -57,7 +57,7 @@ class RecordController extends CloudflareController
|
|||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'hosts':
|
case 'hosts':
|
||||||
$formDatas[$field] = explode("\n", $this->request->getVar($field));
|
$formDatas[$field] = explode("\n", $this->request->getPost($field));
|
||||||
if (!is_array($this->formDatas[$field]) || !count($this->formDatas[$field])) {
|
if (!is_array($this->formDatas[$field]) || !count($this->formDatas[$field])) {
|
||||||
throw new \Exception("호스트명이 정의되지 않았습니다.");
|
throw new \Exception("호스트명이 정의되지 않았습니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,13 +62,13 @@ class ZoneController extends CloudflareController
|
|||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'domains':
|
case 'domains':
|
||||||
$formDatas[$field] = explode("\n", $this->request->getVar($field));
|
$formDatas[$field] = explode("\n", $this->request->getPost($field));
|
||||||
if (!is_array($formDatas[$field]) || !count($formDatas[$field])) {
|
if (!is_array($formDatas[$field]) || !count($formDatas[$field])) {
|
||||||
throw new \Exception("도메인명이 정의되지 않았습니다.");
|
throw new \Exception("도메인명이 정의되지 않았습니다.");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'hosts':
|
case 'hosts':
|
||||||
$formDatas[$field] = $this->request->getVar($field);
|
$formDatas[$field] = $this->request->getPost($field);
|
||||||
if (!is_array($formDatas[$field]) || !count($formDatas[$field])) {
|
if (!is_array($formDatas[$field]) || !count($formDatas[$field])) {
|
||||||
throw new \Exception("호스트명이 정의되지 않았습니다");
|
throw new \Exception("호스트명이 정의되지 않았습니다");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,7 +114,7 @@ class UserController extends AdminController
|
|||||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||||
$this->filter_fields = ['role', 'status'];
|
$this->filter_fields = ['role', 'status'];
|
||||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||||
$this->batchjob_fields = ['role', 'status'];
|
$this->batchjob_fields = ['status'];
|
||||||
return $this->list_procedure();
|
return $this->list_procedure();
|
||||||
}
|
}
|
||||||
// Download
|
// Download
|
||||||
|
|||||||
@ -64,7 +64,7 @@ abstract class MVController extends CommonController
|
|||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
default:
|
default:
|
||||||
$formDatas[$field] = $this->request->getVar($field);
|
$formDatas[$field] = $this->request->getPost($field);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $formDatas;
|
return $formDatas;
|
||||||
@ -79,7 +79,7 @@ abstract class MVController extends CommonController
|
|||||||
// 생성
|
// 생성
|
||||||
protected function create_validate(string $action, array $fields): void
|
protected function create_validate(string $action, array $fields): void
|
||||||
{
|
{
|
||||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
|
||||||
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
||||||
if (!$this->validation->withRequest($this->request)->run()) {
|
if (!$this->validation->withRequest($this->request)->run()) {
|
||||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
||||||
@ -137,7 +137,7 @@ abstract class MVController extends CommonController
|
|||||||
// 수정
|
// 수정
|
||||||
protected function modify_validate(string $action, array $fields): void
|
protected function modify_validate(string $action, array $fields): void
|
||||||
{
|
{
|
||||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getVar()보다 먼처 체크필요
|
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPost()보다 먼처 체크필요
|
||||||
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
$this->validation = $this->setFormFieldRules($fields, service('validation'), $action);
|
||||||
if (!$this->validation->withRequest($this->request)->run()) {
|
if (!$this->validation->withRequest($this->request)->run()) {
|
||||||
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
throw new \Exception("{$this->class_name} 작업 데이터 검증 오류발생\n" . implode(
|
||||||
@ -176,7 +176,7 @@ abstract class MVController extends CommonController
|
|||||||
//자신정보정의
|
//자신정보정의
|
||||||
$this->entity = $this->getModel()->getEntityByPK($uid);
|
$this->entity = $this->getModel()->getEntityByPK($uid);
|
||||||
if ($this->entity === null) {
|
if ($this->entity === null) {
|
||||||
throw new \Exception(__FUNCTION__, " => {$uid} 정보를 찾을수 없습니다.");
|
throw new \Exception(__FUNCTION__ . " => {$uid} 정보를 찾을수 없습니다.");
|
||||||
}
|
}
|
||||||
$this->entity = $this->getModel()->modify($this->entity, $this->formDatas);
|
$this->entity = $this->getModel()->modify($this->entity, $this->formDatas);
|
||||||
}
|
}
|
||||||
@ -210,9 +210,9 @@ abstract class MVController extends CommonController
|
|||||||
$this->getModel()->transStart();
|
$this->getModel()->transStart();
|
||||||
try {
|
try {
|
||||||
//변경할 UIDS
|
//변경할 UIDS
|
||||||
$uids = $this->request->getVar('batchjob_uids[]');
|
$uids = $this->request->getPost('batchjob_uids');
|
||||||
if ($uids === null || !count($uids)) {
|
if ($uids === null || !is_array($uids) || count($uids) === 0) {
|
||||||
throw new \Exception("지정된 정보가 없습니다.");
|
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
|
||||||
}
|
}
|
||||||
foreach ($uids as $uid) {
|
foreach ($uids as $uid) {
|
||||||
$this->modify_process($uid);
|
$this->modify_process($uid);
|
||||||
@ -364,7 +364,6 @@ abstract class MVController extends CommonController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
helper(['form']);
|
helper(['form']);
|
||||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
|
||||||
//URL처리
|
//URL처리
|
||||||
$this->uri = $this->request->getUri();
|
$this->uri = $this->request->getUri();
|
||||||
//total 처리
|
//total 처리
|
||||||
|
|||||||
@ -208,7 +208,7 @@ abstract class CommonHelper
|
|||||||
}
|
}
|
||||||
$viewDatas['uri']->addQuery('order_field', $field);
|
$viewDatas['uri']->addQuery('order_field', $field);
|
||||||
$viewDatas['uri']->addQuery('order_value', $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC");
|
$viewDatas['uri']->addQuery('order_value', $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC");
|
||||||
$label = anchor((string) $viewDatas['uri'], $label);
|
$label = anchor(current_url() . ($viewDatas['uri']->getQuery() ? "?" . $viewDatas['uri']->getQuery() : ""), $label);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return $label;
|
return $label;
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
<link href="/css/common/resizeTable.css" media="screen" rel="stylesheet" type="text/css" />
|
<link href="/css/common/resizeTable.css" media="screen" rel="stylesheet" type="text/css" />
|
||||||
<div class="index_body">
|
<div class="index_body">
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
|
<?= $this->include("templates/{$viewDatas['layout']}/index_content_top"); ?>
|
||||||
|
<?= form_open(current_url() . '/batchjob', ['id' => 'batchjob_form', 'method' => "post"]) ?>
|
||||||
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
<table class="index_table data table table-bordered table-hover table-striped" data-rtc-resizable-table="reisze_table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -40,8 +41,9 @@
|
|||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<?= $this->include("templates/{$viewDatas['layout']}/index_content_batchjob"); ?>
|
||||||
|
<?= form_close() ?>
|
||||||
</div>
|
</div>
|
||||||
<?= $this->include("templates/{$viewDatas['layout']}/index_content_batchjob"); ?>
|
|
||||||
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
<div class=" index_pagination"><?= $viewDatas['pagination'] ?></div>
|
||||||
<div class="index_bottom"><?= $this->include("templates/{$viewDatas['layout']}/modal_form"); ?></div>
|
<div class="index_bottom"><?= $this->include("templates/{$viewDatas['layout']}/modal_form"); ?></div>
|
||||||
<script type="text/javascript" src="/js/common/resizeTable.js"></script>
|
<script type="text/javascript" src="/js/common/resizeTable.js"></script>
|
||||||
|
|||||||
@ -1,35 +1,33 @@
|
|||||||
<div class="index_batchjob">
|
<div class="index_batchjob">
|
||||||
<?= form_open(current_url() . '/batchjob', $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
|
|
||||||
<ul class="nav justify-content-center">
|
<ul class="nav justify-content-center">
|
||||||
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
<li class="nav-item"><?= form_checkbox(array("id" => "batchjobuids_checkbox")) ?>ALL</li>
|
||||||
<?php foreach ($viewDatas['batchjob_fields'] as $field): ?>
|
<?php foreach ($viewDatas['batchjob_fields'] as $field): ?>
|
||||||
<?= $viewDatas['helper']->getFieldForm($field, DEFAULTS['EMPTY'], $viewDatas, ["id" => $field]) ?>
|
<?= $viewDatas['helper']->getFieldForm($field, DEFAULTS['EMPTY'], $viewDatas, ['data-batchjob' => 'true']) ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<li class="nav-item"><?= $viewDatas['helper']->getListButton('batchjob', $viewDatas) ?></li>
|
<li class="nav-item"><?= $viewDatas['helper']->getListButton('batchjob', $viewDatas) ?></li>
|
||||||
<li class="nav-item"><?= $viewDatas['helper']->getListButton('create', $viewDatas) ?></li>
|
<li class="nav-item"><?= $viewDatas['helper']->getListButton('create', $viewDatas) ?></li>
|
||||||
</ul>
|
</ul>
|
||||||
<?= form_close() ?>
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
function submitBatchJob() {
|
function submitBatchJob() {
|
||||||
var validate = false;
|
var validate = false;
|
||||||
//batchjob용 선택사항 검증
|
//batchjob용 선택사항 검증
|
||||||
<?php foreach ($viewDatas['batchjob_fields'] as $field): ?>
|
<?php foreach ($viewDatas['batchjob_fields'] as $field): ?>
|
||||||
var element = document.getElementById('<?= $field ?>');
|
var element = document.querySelector('[name="<?= $field ?>"][data-batchjob="true"]');
|
||||||
if (element.options[element.selectedIndex].value != "") {
|
if (element && element.value !== "") {
|
||||||
validate = true;
|
validate = true;
|
||||||
}
|
}
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
if (!validate) {
|
if (!validate) {
|
||||||
alert('변경항목은 하나 이상을 선택하셔야합니다.');
|
alert('변경할 항목을 선택하셔야합니다.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//적용받는 uids가 한개라도 선택되었다면 true
|
//적용받는 uids가 한개라도 선택되었다면 true
|
||||||
var checkboxes = document.querySelectorAll('input[name="batchjob_uids[]"]:checked');
|
var checkboxes = document.querySelectorAll('input[name="batchjob_uids[]"]:checked');
|
||||||
if (checkboxes.length === 0) {
|
if (checkboxes.length === 0) {
|
||||||
alert('적용할 리스트를 선택해주세요.');
|
alert('적용할 리스트를 선택하셔야합니다.');
|
||||||
validate = false;
|
return false;
|
||||||
}
|
}
|
||||||
return validate;
|
return true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user