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