diff --git a/modules/admin/tpl/js/admin.js b/modules/admin/tpl/js/admin.js
index 4d3d52c45..6ee132312 100644
--- a/modules/admin/tpl/js/admin.js
+++ b/modules/admin/tpl/js/admin.js
@@ -347,9 +347,14 @@ jQuery(function($){
$.fn.checkToggle = function(){
function check(){
setTimeout(function(){
- $(':checked').parent('label').addClass('checked');
- $(':not(":checked")').parent('label').removeClass('checked');
- },0);
+ $(':radio, :checkbox').each(function() {
+ if ($(this).is(':checked')) {
+ $(this).parent('label').addClass('checked');
+ } else {
+ $(this).parent('label').removeClass('checked');
+ }
+ });
+ }, 0);
}
this.change(check);
check();
diff --git a/modules/board/board.admin.controller.php b/modules/board/board.admin.controller.php
index d1f0c329c..b6c35ca40 100644
--- a/modules/board/board.admin.controller.php
+++ b/modules/board/board.admin.controller.php
@@ -58,7 +58,21 @@ class BoardAdminController extends Board {
if($args->use_anonymous != 'Y') $args->use_anonymous = 'N';
if($args->anonymous_except_admin != 'Y') $args->anonymous_except_admin = 'N';
if($args->consultation != 'Y') $args->consultation = 'N';
- if($args->protect_content != 'Y') $args->protect_content = 'N';
+
+ // Protection settings
+ if ($args->protect_content != 'Y') $args->protect_content = 'N';
+ if ($args->protect_document_regdate === 'Y')
+ {
+ $args->protect_document_regdate = intval($args->protect_document_regdate_limit ?? 0) ?: null;
+ }
+ if ($args->protect_comment_regdate === 'Y')
+ {
+ $args->protect_comment_regdate = intval($args->protect_comment_regdate_limit ?? 0) ?: null;
+ }
+ unset($args->protect_document_regdate_limit);
+ unset($args->protect_comment_regdate_limit);
+
+ // Admin protection settings
if($this->user->isAdmin())
{
if($args->protect_admin_content_update != 'Y') $args->protect_admin_content_update = 'N';
diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php
index 8bed7c029..12f873ef0 100644
--- a/modules/board/board.controller.php
+++ b/modules/board/board.controller.php
@@ -171,9 +171,10 @@ class BoardController extends Board
// Protect document by comment
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_update_content == 'Y')
{
- if($oDocument->get('comment_count') > 0 && !$this->grant->manager)
+ $comment_limit = $this->module_info->protect_update_content_limit ?? 1;
+ if($oDocument->get('comment_count') >= $comment_limit && !$this->grant->manager)
{
- throw new Rhymix\Framework\Exception('msg_protect_update_content');
+ throw new Rhymix\Framework\Exception(sprintf(lang('msg_protect_update_content'), $comment_limit));
}
}
@@ -358,9 +359,10 @@ class BoardController extends Board
// check protect content
if($this->module_info->protect_content == 'Y' || $this->module_info->protect_delete_content == 'Y')
{
- if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
+ $comment_limit = $this->module_info->protect_delete_content_limit ?? 1;
+ if($oDocument->get('comment_count') >= $comment_limit && $this->grant->manager == false)
{
- throw new Rhymix\Framework\Exception('msg_protect_delete_content');
+ throw new Rhymix\Framework\Exception(sprintf(lang('msg_protect_delete_content'), $comment_limit));
}
}
@@ -538,10 +540,11 @@ class BoardController extends Board
$comment = CommentModel::getComment($obj->comment_srl);
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
{
+ $childs_limit = $this->module_info->protect_update_comment_limit ?? 1;
$childs = CommentModel::getChildComments($obj->comment_srl);
- if(count($childs) > 0)
+ if(count($childs) >= $childs_limit)
{
- throw new Rhymix\Framework\Exception('msg_board_update_protect_comment');
+ throw new Rhymix\Framework\Exception(sprintf(lang('msg_board_update_protect_comment'), $childs_limit));
}
}
}
@@ -656,10 +659,11 @@ class BoardController extends Board
$childs = null;
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
{
+ $childs_limit = $this->module_info->protect_delete_comment_limit ?? 1;
$childs = CommentModel::getChildComments($comment_srl);
- if(count($childs) > 0)
+ if(count($childs) >= $childs_limit)
{
- throw new Rhymix\Framework\Exception('msg_board_delete_protect_comment');
+ throw new Rhymix\Framework\Exception(sprintf(lang('msg_board_delete_protect_comment'), $childs_limit));
}
}
diff --git a/modules/board/board.view.php b/modules/board/board.view.php
index e6cd6ee2d..e9f19b1e9 100644
--- a/modules/board/board.view.php
+++ b/modules/board/board.view.php
@@ -878,9 +878,10 @@ class BoardView extends Board
}
if ($this->module_info->protect_content === 'Y' || $this->module_info->protect_update_content === 'Y')
{
- if($oDocument->get('comment_count') > 0 && $this->grant->manager == false)
+ $comment_limit = $this->module_info->protect_update_content_limit ?? 1;
+ if($oDocument->get('comment_count') >= $comment_limit && $this->grant->manager == false)
{
- throw new Rhymix\Framework\Exception('msg_protect_update_content');
+ throw new Rhymix\Framework\Exception(sprintf(lang('msg_protect_update_content'), $comment_limit));
}
}
@@ -1103,9 +1104,10 @@ class BoardView extends Board
if($this->module_info->protect_content == "Y" || $this->module_info->protect_delete_content == 'Y')
{
+ $comment_limit = $this->module_info->protect_delete_content_limit ?? 1;
if($oDocument->get('comment_count')>0 && $this->grant->manager == false)
{
- throw new Rhymix\Framework\Exception('msg_protect_delete_content');
+ throw new Rhymix\Framework\Exception(sprintf(lang('msg_protect_delete_content'), $comment_limit));
}
}
@@ -1299,10 +1301,11 @@ class BoardView extends Board
}
if($this->module_info->protect_update_comment === 'Y' && $this->grant->manager == false)
{
+ $childs_limit = $this->module_info->protect_update_comment_limit ?? 1;
$childs = CommentModel::getChildComments($comment_srl);
- if(count($childs) > 0)
+ if(count($childs) >= $childs_limit)
{
- throw new Rhymix\Framework\Exception('msg_board_update_protect_comment');
+ throw new Rhymix\Framework\Exception(sprintf(lang('msg_board_update_protect_comment'), $childs_limit));
}
}
@@ -1387,10 +1390,11 @@ class BoardView extends Board
if($this->module_info->protect_delete_comment === 'Y' && $this->grant->manager == false)
{
+ $childs_limit = $this->module_info->protect_delete_comment_limit ?? 1;
$childs = CommentModel::getChildComments($comment_srl);
- if(count($childs) > 0)
+ if(count($childs) >= $childs_limit)
{
- throw new Rhymix\Framework\Exception('msg_board_delete_protect_comment');
+ throw new Rhymix\Framework\Exception(sprintf(lang('msg_board_delete_protect_comment'), $childs_limit));
}
}
diff --git a/modules/board/lang/en.php b/modules/board/lang/en.php
index 9c9b4f9b0..88f07c98b 100644
--- a/modules/board/lang/en.php
+++ b/modules/board/lang/en.php
@@ -44,7 +44,6 @@ $lang->about_secret = 'Users will be able to write secret posts or comments.';
$lang->about_admin_mail = 'Send an e-mail when a new post or comment is submitted. Separate multiple recipients with a comma.';
$lang->about_list_config = 'If using list-style skin, you may arrange items to display. However, this feature might not be availble for non-official skins. If you double-click target items and display items, then you can add / remove them';
$lang->about_use_status = 'Please select status that can be selected when you write a post.';
-$lang->about_protect_comment = 'Prevent updating or deleting a comment if it has children.';
$lang->about_update_log = 'Store a log of every version of a post every time it is updated.';
$lang->skip_bottom_list_for_olddoc = 'Do not calculate the bottom list exactly when viewing an old post.';
$lang->skip_bottom_list_for_robot = 'Do not calculate the bottom list exactly when a robot is visiting.';
@@ -59,7 +58,7 @@ $lang->hide_category = 'Hide categories';
$lang->about_hide_category = 'Temporarily disable categories. Existing categories will not be deleted.
Unless you select the option below, users may not be able to write anymore.';
$lang->allow_no_category = 'Do not require category';
$lang->about_allow_no_category = 'Allow posting without selecting a category.
Admins are never required to select a category.';
-$lang->protect_content = 'Protect Content';
+$lang->protect_content = 'Protect Post';
$lang->protect_comment = 'Protect Comment';
$lang->protect_admin_content = 'Protect Admin Content';
$lang->protect_regdate = 'Update/Delete Time Limit';
@@ -73,15 +72,19 @@ $lang->about_inline_data_url_limit = 'Restrict data: URLs that can be used to ev
$lang->update_order_on_comment = 'Update Post on New Comment';
$lang->about_update_order_on_comment = 'When a new comment is posted, update the update timestamp of the parent post. This is needed for forums.';
$lang->about_filter_specialchars = 'Prevent use of excessive Unicode accents, RLO characters, and other symbols that hinder readability.';
-$lang->about_protect_regdate = 'Prevent updating or deleting a post or comment after a certain amount of time has passed. (Unit: day)';
-$lang->about_protect_content = 'Prevent updating a post if there are comments on it.';
+$lang->about_protect_content_update = 'Prevent updating a post if it has %d or more comments.';
+$lang->about_protect_content_delete = 'Prevent deleting a post if it has %d or more comments.';
+$lang->about_protect_comment_update = 'Prevent updating a comment if it has %d or more replies.';
+$lang->about_protect_comment_delete = 'Prevent deleting a comment if it has %d or more replies.';
+$lang->about_protect_document_regdate = 'Prevent updating or deleting a post after %d days.';
+$lang->about_protect_comment_regdate = 'Prevent updating or deleting a comment after %d days.';
$lang->about_protect_admin_content = 'Prevent updating or deleting a post or comment written by the administrator, even by a user who is permitted to manage the board.';
-$lang->msg_protect_delete_content = 'You cannot delete a post with comments on it.';
-$lang->msg_protect_update_content = 'You cannot update a post with comments on it.';
+$lang->msg_protect_update_content = 'You cannot update a post with %d or more comments on it.';
+$lang->msg_protect_delete_content = 'You cannot delete a post with %d or more comments on it.';
+$lang->msg_board_update_protect_comment = 'You cannot update a comment with %d or more replies on it.';
+$lang->msg_board_delete_protect_comment = 'You cannot delete a comment with %d or more replies on it.';
$lang->msg_admin_document_no_modify = 'You cannot edit the administrator\'s post.';
$lang->msg_admin_comment_no_modify = 'You cannot edit the administrator\'s comment.';
-$lang->msg_board_delete_protect_comment = 'You cannot delete a comment when there are replies.';
-$lang->msg_board_update_protect_comment = 'You cannot update a comment when there are replies.';
$lang->msg_protect_regdate_document = 'You cannot update or delete a post after %d days.';
$lang->msg_protect_regdate_comment = 'You cannot update or delete a comment after %d days.';
$lang->msg_dont_have_update_log = 'This post has no update log.';
diff --git a/modules/board/lang/ko.php b/modules/board/lang/ko.php
index 0820f57ed..f53cf5db6 100644
--- a/modules/board/lang/ko.php
+++ b/modules/board/lang/ko.php
@@ -44,7 +44,6 @@ $lang->about_secret = '게시판 및 댓글의 비밀글 기능을 사용할 수
$lang->about_admin_mail = '새 글이나 댓글이 등록되면 지정된 메일 주소로 알림을 받습니다. 여러 메일 주소를 지정하려면 쉼표(,)로 구분하세요.';
$lang->about_list_config = '게시판의 목록형식 사용시 원하는 항목들로 배치를 할 수 있습니다. 단 스킨에서 지원하지 않는 경우 불가능합니다. 대상항목/ 표시항목의 항목을 더블클릭하면 추가/ 제거가 됩니다.';
$lang->about_use_status = '글 작성 시 선택할 수 있는 상태를 지정해주세요.';
-$lang->about_protect_comment = '댓글의 댓글이 있을경우 해당댓글을 삭제 및 수정을 할 수 없도록 합니다.';
$lang->about_update_log = '게시글을 수정할 경우 수정한 내역을 저장하도록 합니다.';
$lang->skip_bottom_list_for_olddoc = '오래된 게시물 열람시 하단 목록을 정확하게 계산하지 않음';
$lang->skip_bottom_list_for_robot = '로봇 방문시 하단 목록을 정확하게 계산하지 않음';
@@ -73,15 +72,19 @@ $lang->about_inline_data_url_limit = 'data: URL을 사용하여 첨부 제한을
$lang->update_order_on_comment = '댓글 작성시 글 수정 시각 갱신';
$lang->about_update_order_on_comment = '댓글이 작성되면 해당 글의 수정 시각을 갱신합니다. 포럼형 게시판, 최근 댓글 표시 기능 등에 필요합니다.';
$lang->about_filter_specialchars = '가독성에 악영향을 주는 과도한 유니코드 악센트 기호의 조합, RLO 문자 등의 사용을 금지합니다.';
-$lang->about_protect_regdate = '글이나 댓글을 작성한 후 일정 기간이 지나면 수정 또는 삭제할 수 없도록 합니다. (단위 : day)';
-$lang->about_protect_content = '댓글이 달린 글은 수정 또는 삭제할 수 없도록 합니다.';
+$lang->about_protect_content_update = '댓글이 %d개 이상 달린 글은 수정할 수 없도록 합니다.';
+$lang->about_protect_content_delete = '댓글이 %d개 이상 달린 글은 삭제할 수 없도록 합니다.';
+$lang->about_protect_comment_update = '대댓글이 %d개 이상 달린 댓글은 수정할 수 없도록 합니다.';
+$lang->about_protect_comment_delete = '대댓글이 %d개 이상 달린 댓글은 삭제할 수 없도록 합니다.';
+$lang->about_protect_document_regdate = '작성 후 %d일 이상 지난 글은 수정 또는 삭제할 수 없도록 합니다.';
+$lang->about_protect_comment_regdate = '작성 후 %d일 이상 지난 댓글은 수정 또는 삭제할 수 없도록 합니다.';
$lang->about_protect_admin_content = '최고관리자가 작성한 글이나 댓글은 게시판 관리 권한이 있는 회원이라도 수정 또는 삭제할 수 없도록 합니다.';
-$lang->msg_protect_delete_content = '댓글이 달린 글은 삭제할 수 없습니다.';
-$lang->msg_protect_update_content = '댓글이 달린 글은 수정할 수 없습니다.';
+$lang->msg_protect_update_content = '댓글이 %d개 이상 달린 글은 수정할 수 없습니다.';
+$lang->msg_protect_delete_content = '댓글이 %d개 이상 달린 글은 삭제할 수 없습니다.';
+$lang->msg_board_update_protect_comment = '대댓글이 %d개 이상 달린 댓글은 수정할 수 없습니다.';
+$lang->msg_board_delete_protect_comment = '대댓글이 %d개 이상 달린 댓글은 삭제할 수 없습니다.';
$lang->msg_admin_document_no_modify = '최고관리자의 게시물을 수정할 권한이 없습니다.';
$lang->msg_admin_comment_no_modify = '최고관리자의 댓글을 수정할 권한이 없습니다.';
-$lang->msg_board_delete_protect_comment = '대댓글이 달린 댓글은 삭제할 수 없습니다.';
-$lang->msg_board_update_protect_comment = '대댓글이 달린 댓글은 수정할 수 없습니다.';
$lang->msg_protect_regdate_document = '%d일 이상 지난 글은 수정 또는 삭제할 수 없습니다.';
$lang->msg_protect_regdate_comment = '%d일 이상 지난 댓글은 수정 또는 삭제할 수 없습니다.';
$lang->msg_dont_have_update_log = '업데이트 로그가 기록되어 있지 않은 게시글입니다.';
diff --git a/modules/board/lang/zh-CN.php b/modules/board/lang/zh-CN.php
index 1f9196da7..c399112cb 100644
--- a/modules/board/lang/zh-CN.php
+++ b/modules/board/lang/zh-CN.php
@@ -72,8 +72,8 @@ $lang->about_filter_specialchars = '禁止使用影响阅读的内容的符号
$lang->about_non_login_vote = '非会员也可以推荐。';
$lang->about_protect_regdate = '发布帖子或回复过一定时间的话无法修改或删除。(单位:天)';
$lang->about_protect_content = '无法删除或修改有回复的帖子。';
-$lang->msg_protect_delete_content = '无法删除有回复的帖子。';
-$lang->msg_protect_update_content = '无法修改有回复的帖子。';
+$lang->msg_protect_delete_content = '评论数超过 %d 条的帖子无法删除。';
+$lang->msg_protect_update_content = '评论数超过 %d 条的帖子无法编辑。';
$lang->msg_admin_document_no_modify = '无法修改管理员的帖子。';
$lang->msg_admin_comment_no_modify = '无法修改管理员的回复。';
$lang->msg_board_delete_protect_comment = '回复里有他人回复的时候无法删除。';
diff --git a/modules/board/tpl/board_insert.html b/modules/board/tpl/board_insert.html
index 0478aa728..97b429794 100644
--- a/modules/board/tpl/board_insert.html
+++ b/modules/board/tpl/board_insert.html
@@ -362,17 +362,52 @@
{$lang->about_protect_content}
+ +{$lang->about_protect_comment}
+ + +{$lang->about_protect_regdate}
-