servermgrv2 init...

This commit is contained in:
최준흠 2023-08-04 10:44:33 +09:00
parent 0e168f667b
commit 7f1aa0e0b0
11 changed files with 41 additions and 42 deletions

View File

@ -78,20 +78,20 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->get('toggle/(:num)/(:hash)', 'CategoryController::toggle/$1/$2');
$routes->post('batchjob', 'CategoryController::batchjob');
});
$routes->group('hpilo', static function ($routes) {
$routes->get('', 'HPILOController::index');
$routes->get('excel', 'HPILOController::excel');
$routes->get('insert', 'HPILOController::insert_form');
$routes->post('insert', 'HPILOController::insert');
$routes->get('update/(:num)', 'HPILOController::update_form/$1');
$routes->post('update/(:num)', 'HPILOController::update/$1');
$routes->get('view/(:num)', 'HPILOController::view/$1');
$routes->get('delete/(:num)', 'HPILOController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('toggle/(:num)/(:hash)', 'HPILOController::toggle/$1/$2');
$routes->post('batchjob', 'HPILOController::batchjob');
$routes->get('console/(:num)', 'HPILOController::console/$1');
$routes->get('reset/(:num)/(:alpha)', 'HPILOController::reset/$1/$2');
$routes->get('reload/(:num)', 'HPILOController::reload/$1');
$routes->group('board', static function ($routes) {
$routes->get('', 'BoardController::index');
$routes->get('excel', 'BoardController::excel/$1');
$routes->get('insert', 'BoardController::insert_form');
$routes->post('insert', 'BoardController::insert');
$routes->get('update/(:num)', 'BoardController::update_form/$1');
$routes->post('update/(:num)', 'BoardController::update/$1');
$routes->get('view/(:num)', 'BoardController::view/$1');
$routes->get('reply/(:num)', 'BoardController::reply_form/$1');
$routes->post('reply/(:num)', 'BoardController::reply/$1');
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('toggle/(:num)/(:hash)', 'BoardController::toggle/$1/$2');
$routes->post('batchjob', 'BoardController::batchjob');
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
});
});
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {

View File

@ -2,7 +2,6 @@
namespace App\Controllers\Admin;
use App\Models\BoardConfigModel;
use App\Models\BoardModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;

View File

@ -21,14 +21,14 @@ class CategoryController extends AdminController
public function getFields(string $action = ""): array
{
$fields = [
'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"status", "head", "tail",
];
switch ($action) {
case "index":
case "excel":
return [
'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"status", "created_at"
];
break;

View File

@ -20,14 +20,14 @@ class BoardController extends FrontController
public function getFields(string $action = ""): array
{
$fields = ["category_uid", 'title', "board_file", "passwd", "content"];
$fields = ['title', "board_file", "passwd", "content"];
switch ($action) {
case "index":
case "excel":
return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at"];
return ['title', "board_file", "view_cnt", "created_at"];
break;
case "view":
return ["category_uid", "user_uid", 'title', "board_file", "view_cnt", "created_at", "content"];
return ['title', "board_file", "view_cnt", "created_at", "content"];
break;
default:
return $fields;
@ -36,7 +36,7 @@ class BoardController extends FrontController
}
public function getFieldFilters(): array
{
return ["category_uid", "user_uid"];
return [];
}
public function getFieldBatchFilters(): array
{

View File

@ -51,7 +51,6 @@ CREATE TABLE servermgr.tw_category (
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요',
name varchar(255) NOT NULL COMMENT '범주명',
linkurl varchar(255) NULL COMMENT '연결URL',
isaccess varchar(30) NOT NULL DEFAULT 'guest' COMMENT '접근권한',
isread varchar(30) NOT NULL DEFAULT 'guest' COMMENT '읽기권한',
iswrite varchar(30) NOT NULL DEFAULT 'guest' COMMENT '쓰기권한',
@ -79,7 +78,7 @@ CREATE TABLE servermgr.tw_board (
grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함',
grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작',
grpdepth int(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group깊이: 상위가없을시 1부터시작 , 상위 grpdepth+1씩 추가필요',
cartory_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID',
category_uid int(10) UNSIGNED NOT NULL COMMENT '범주 UID',
user_uid varchar(36) NULL COMMENT '작성자 정보',
title varchar(255) NOT NULL COMMENT '제목',
content text NOT NULL COMMENT '내용',

View File

@ -23,6 +23,14 @@ class BoardEntity extends BaseHierarchyEntity
}
//추가기능
public function getCategory_Uid()
{
return $this->attributes['category_uid'];
}
public function getUser_Uid()
{
return $this->attributes['user_uid'];
}
public function getPassword()
{
return $this->attributes['passwd'];
@ -31,8 +39,4 @@ class BoardEntity extends BaseHierarchyEntity
{
return $this->attributes['view_cnt'];
}
public function getUser_Uid()
{
return $this->attributes['user_uid'];
}
}

View File

@ -23,10 +23,6 @@ class CategoryEntity extends BaseHierarchyEntity
}
//추가기능
public function getLinkURL()
{
return $this->attributes['linkurl'];
}
public function getHead()
{
return $this->attributes['head'];

View File

@ -15,7 +15,7 @@ function getFieldLabel_BoardHelper($field, array $fieldRules, array $attributes
function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array $attributes = array())
{
switch ($field) {
case "board_config_uid":
case "category_uid":
case "user_uid":
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
@ -59,6 +59,15 @@ function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $f
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'category_uid':
$categorys = array();
foreach (array_values($fieldFormOptions[$field]) as $category_2depth) {
foreach ($category_2depth as $key => $label) {
$categorys[$key] = $label;
}
}
return $categorys[$value];
break;
case 'title':
return sprintf(
"<div style=\"text-align:left;\">%s %s</div>",

View File

@ -56,9 +56,6 @@ function getFieldForm_CategoryHelper($field, $value, array $fieldFormOptions, ar
case 'name':
return form_input($field, $value, [...$attributes, "placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]);
break;
case 'linkurl':
return form_input($field, $value, [...$attributes, "placeholder" => "예)/front/board", "style" => "width:100%; ::placeholder{ color:silver; opacity: 1; }"]);
break;
default:
return form_input($field, $value, [...$attributes]);
break;

View File

@ -9,7 +9,6 @@ return [
'label' => [
'uid' => "번호",
'name' => "범주제목",
'linkurl' => "연결URL",
'isaccess' => "접속권한",
'isread' => "읽기권한",
'iswrite' => "쓰기권한",

View File

@ -13,7 +13,7 @@ class CategoryModel extends BaseHierarchyModel
parent::__construct('Category');
$this->allowedFields = [
...$this->allowedFields,
'name', "linkurl", "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
'name', "isaccess", "isread", "iswrite", "isreply", "isupload", "isdownload",
"head", "tail", "status"
];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
@ -33,10 +33,6 @@ class CategoryModel extends BaseHierarchyModel
$rules[$field] = "required|trim|string";
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "linkurl":
$rules[$field] = "if_exist|trim|string";
$rules[$field] .= $action == "insert" ? "|is_unique[{$this->table}.{$field}]" : "";
break;
case "isaccess":
case "isread":
case "iswrite":
@ -119,7 +115,7 @@ class CategoryModel extends BaseHierarchyModel
{
parent::setIndexWordFilter($word);
$this->orLike($this->getTitle(), $word, "both"); //befor , after , both
$this->orLike("linkurl", $word, "both"); //befor , after , both
$this->orLike($word, "both"); //befor , after , both
$this->orLike("head", $word, "both"); //befor , after , both
$this->orLike("tail", $word, "both"); //befor , after , both
$this->orLike("isaccess", $word, "both"); //befor , after , both