From 8b49f6fc57e53839ba4182c26377373f061316fd Mon Sep 17 00:00:00 2001 From: zero Date: Thu, 19 Jun 2008 04:01:16 +0000 Subject: [PATCH] =?UTF-8?q?=EC=9D=91=EB=8B=B5=ED=98=95=20=EB=8C=93?= =?UTF-8?q?=EA=B8=80=EC=9D=98=20=EC=9E=98=EB=AA=BB=EB=90=9C=20=EB=B0=98?= =?UTF-8?q?=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4299 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/comment/comment.controller.php | 25 +++++++++++++++---- .../comment/queries/getCommentListItem.xml | 7 ++++-- .../comment/queries/getCommentPageList.xml | 7 +++--- .../queries/getCommentParentNextSibling.xml | 13 ++++++++++ .../queries/updateCommentListArrange.xml | 2 +- 5 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 modules/comment/queries/getCommentParentNextSibling.xml diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 26b934827..b8fc647fe 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -159,11 +159,26 @@ $list_args->head = $parent->head; $list_args->depth = $parent->depth+1; - if($list_args->depth<2) $list_args->arrange = $obj->comment_srl; - else { - $list_args->arrange = $parent->arrange; - $output = executeQuery('comment.updateCommentListArrange', $list_args); - if(!$output->toBool()) return $output; + + // depth가 2단계 미만이면 별도의 update문 없이 insert만으로 쓰레드 정리 + if($list_args->depth<2) { + $list_args->arrange = $obj->comment_srl; + + // depth가 2단계 이상이면 반업데이트 실행 + } else { + // 부모 댓글과 같은 head를 가지고 depth가 같거나 작은 댓글중 제일 위 댓글을 구함 + $p_args->head = $parent->head; + $p_args->arrange = $parent->arrange; + $p_args->depth = $parent->depth; + $output = executeQuery('comment.getCommentParentNextSibling', $p_args); + + if($output->data->arrange) { + $list_args->arrange = $output->data->arrange; + $output = executeQuery('comment.updateCommentListArrange', $list_args); + } else { + $list_args->arrange = $obj->comment_srl; + } + } } diff --git a/modules/comment/queries/getCommentListItem.xml b/modules/comment/queries/getCommentListItem.xml index e964057c2..c46b514cc 100644 --- a/modules/comment/queries/getCommentListItem.xml +++ b/modules/comment/queries/getCommentListItem.xml @@ -1,11 +1,14 @@ +
- + + - + + diff --git a/modules/comment/queries/getCommentPageList.xml b/modules/comment/queries/getCommentPageList.xml index de7020db8..496a4905e 100644 --- a/modules/comment/queries/getCommentPageList.xml +++ b/modules/comment/queries/getCommentPageList.xml @@ -5,16 +5,15 @@ - + + + - - - diff --git a/modules/comment/queries/getCommentParentNextSibling.xml b/modules/comment/queries/getCommentParentNextSibling.xml new file mode 100644 index 000000000..5347bd7e5 --- /dev/null +++ b/modules/comment/queries/getCommentParentNextSibling.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/comment/queries/updateCommentListArrange.xml b/modules/comment/queries/updateCommentListArrange.xml index 53d40f71a..0e5f0bdb6 100644 --- a/modules/comment/queries/updateCommentListArrange.xml +++ b/modules/comment/queries/updateCommentListArrange.xml @@ -8,6 +8,6 @@ - +