웹마스터 팁

소스 코드를 수정하는 것이므로 반드시 백업을 해두실 것을 권합니다.


일반적인 댓글 삭제/수정/답글 시 바로 팝업창을 띄워 처리하는 팁입니다.

아래 댓글 새창보기에서 삭제/수정/답글 기능도 넣고자 하시는 분은 이 팁을 적용하시면 됩니다.


우선 첨부 파일을 아래의 경로에 맞추어 풀어줍니다.


popup_etc_layout.html => common/tpl/popup_etc_layout.html


popup_comment_form.html => modules/board/tpl/popup_comment_form.html

popup_delete_comment_form.html => modules/board/tpl/popup_delete_comment_form.html

filter/insert_pop_comment.xml => modules/board/tpl/filter/insert_pop_comment.xml


아래 댓글 새창보기 팁을 적용하지 않으신 분은 common/js/common.js 에서 popopen 함수를 찾아 그 밑에 popopen2 함수를 추가합니다. 이미 추가하셨으면 안 하셔도 됩니다.


function popopen2(url, target, pop_width, pop_height) {

    if(typeof(target) == "undefined") target = "_blank";

    if(typeof(xeVid)!='undefined' && url.indexOf(request_uri)>-1 && !url.getQuery('vid'+ '+ ')) url = url.setQuery('vid',xeVid);

    if(typeof(pop_width) == "undefined") pop_width = "350";

    if(typeof(pop_height) == "undefined") pop_height = "120";

    winopen(url, target, "left=10,top=10,width="+pop_width+",height="+pop_height+",scrollbars=yes,resizable=yes,toolbars=no");

}


이후 설명의 편의를 위해 댓글 삭제 부분과 댓글 수정/답글 부분을 나누어 설명 드리겠습니다.

또 게시판 스킨 수정은 전과 마찬가지로 xe_official 게시판 스킨을 기준으로 합니다.



[댓글 삭제]


1. modules/board/board.view.php 약 550라인쯤에 '* @brief 댓글 삭제 화면 출력' 부분을 찾아 다음과 같이 수정합니다.


$this->setTemplateFile('delete_comment_form');

=>

         // 팝업 레이아웃 선택

        $this->setLayoutPath('./common/tpl');

        $this->setLayoutFile('popup_etc_layout');

            

        $this->setTemplatePath($this->module_path.'tpl');

        $this->setTemplateFile('popup_delete_comment_form');


2. modules/board/tpl/js/board.js 약 84라인 /* 댓글 삭제 */ 부분을 찾아 var url 이하를 아래처럼 수정합니다.


    //var url = current_url.setQuery('mid',mid).setQuery('document_srl',document_srl).setQuery('act','');

    var url = current_url.setQuery('mid',mid).setQuery('document_srl',document_srl);

    if(page) url = url.setQuery('page',page);


    //alert(message);


    opener.location.href = opener.location.href;

    window.close();

}

 

3. 이제 게시판 스킨을 수정합니다. 

modules/board/skins/xe_official/comment.html 에서 댓글 삭제 링크를 찾아 아래처럼 onclick 이하를 추가합니다.


<li><a href="{getUrl("act','dispBoardDeleteComment','comment_srl',$comment->comment_srl)}">{$lang->cmd_delete}</a></li>


=>


<li><a href="{getUrl("act','dispBoardDeleteComment','comment_srl',$comment->comment_srl)}"  onclick="popopen2(this.href,'CommDel',360,120); return false;">{$lang->cmd_delete}</a></li>


다른 스킨에 적용 시에도 comment.html에서 댓글 삭제 링크에 onclick 이하 부분을 추가해주시면 됩니다.



[댓글 수정/답글]


1. modules/board/board.view.php 에서

* @brief 댓글의 답글 화면 출력 함수 function dispBoardReplyComment() 와

* @brief 댓글 수정 폼 출력 함수 function dispBoardModifyComment() 를 찾아 각각 아래와 같이 수정합니다.


            /** 

             * 사용되는 javascript 필터 추가

             **/

            Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml');

       

            $this->setTemplateFile('comment_form');


=>


            /** 

             * 사용되는 javascript 필터 추가

             **/

            Context::addJsFilter($this->module_path.'tpl/filter', 'insert_pop_comment.xml');


            // 팝업 레이아웃 선택

            $this->setLayoutPath('./common/tpl');

            $this->setLayoutFile('popup_etc_layout');

            

            $this->setTemplatePath($this->module_path.'tpl');            

            $this->setTemplateFile('popup_comment_form'+ '); 


2. modules/board/tpl/js/board.js 에서 '/*댓글 작성 후 함수*/' 다음에 아래 함수를 추가합니다.


/* 댓글 새창 답글, 수정 작성후 */

function completePopInsertComment(ret_obj) {

    var error = ret_obj['error'];

    var message = ret_obj['message'];

    var mid = ret_obj['mid'];

    var document_srl = ret_obj['document_srl'];

    var comment_srl = ret_obj['comment_srl'];


    opener.location.href = opener.location.href;

    window.close();

}


3. 이제 게시판 스킨을 수정합니다. 

modules/board/skins/xe_official/comment.html 에서 댓글 수정/답글 링크를 찾아 다음과 같이 onclick 이하를 추가합니다.


<li><a href="{getUrl("act','dispBoardReplyComment','comment_srl',$comment->comment_srl)}">{$lang->cmd_reply}</a></li> 

<!--@if($comment->isGranted() || !$comment->get('member_srl') || $grant->manager)-->

<li><a href="{getUrl("act','dispBoardModifyComment','comment_srl',$comment->comment_srl)}">{$lang->cmd_modify}</a></li>


=>


<li><a href="{getUrl("act','dispBoardReplyComment','comment_srl',$comment->comment_srl)}"onclick="popopen2(this.href,'CommReply',600,300); return false;">{$lang->cmd_reply}</a></li> 

<!--@if($comment->isGranted() || !$comment->get('member_srl') || $grant->manager)-->

<li><a href="{getUrl("act','dispBoardModifyComment','+ 'comment_srl',$comment->comment_srl)}"onclick="popopen2(this.href,'CommModify',600,300); return false;">{$lang->cmd_modify}</a></li>


다른 스킨에서도 comment.html에서 댓글 수정/답글 링크에 'onclick=~' 부분을 추가해주시면 됩니다.



[댓글 새창보기에 적용]


modules/board/tpl/comment_pop.html 에서 아래 부분을 찾아 '<!--//봉인 ' 과 ' -->'을 삭제만 하면 됩니다.

 

<!--//봉인
<li><a href="{getUrl("act'+ ','dispBoardReplyComment','comment_srl',$comment->comment_srl)}" onclick="popopen2(this.href,'CommReply',600,300); return false;">{$lang->cmd_reply}</a></li>
<!--@if($comment->isGranted() || !$comment->get('member_srl') || $grant->manager)-->
<li><a href="{getUrl("act','dispBoardModifyComment','comment_srl',$comment->comment_srl)}" onclick="popopen2(this.href,'CommModify',600,300); return false;">{$lang->cmd_modify}</a></li>
<li><a href="{getUrl("act','dispBoardDeleteComment','+ 'comment_srl',$comment->comment_srl)}"  onclick="popopen2(this.href,'CommDel',300,120); return false;">{$lang->cmd_delete}</a></li>
<!--@end-->
-->

 

제목 글쓴이 날짜
TRAC과 SVN을 참조하여 1.0.5의 애드온 설정 버그 해결하기 Adios 2008.08.04
첨부화일 등록시 사라지는 현상 [2] 0라이트0 2008.08.05
닉네임, 이름 정보변경 못하게 하기. [6] 부엉이 2008.08.06
설치시 초기화면으로 돌아가는 현상 해결 [1] spk 2008.08.07
오픈 아이디(OpenID)로만 로그인 허용하기 [7] withover.com 2008.08.07
댓글 첨부파일부분 닫기/열기 추가 [1] file Gnee 2008.08.09
렙업시 소속그룹 없어지는 문제! 얍실하게 해결.. 쿨럭. [2] file 이슈카ㆀ 2008.08.12
rewrite mod 사용 않될 경우 해결 방법 1가지 블루스카이77 2008.08.13
권한 문제 때문에 생길 수 있는 문제 해결 방안 꽃들 2008.08.14
zbxe에서 piclens 사용하기 [2] 우정진 2008.08.15
미국 yahoo zbxe 설치 및 mysql 연결 [4] mr007 2008.08.15
이미지 좌측 정렬시 내용이 적으면 아래부분 올라오는 문제 해결법 [2] file 대류 2008.08.16
zbxe에 bgm을 설치하자 [11] file 우리아기 2008.08.16
인용구 접기기능 링크이름 Underline 없애기 [4] file 똑디 2008.08.19
[초보팁] 우리말 수정하기(예제: 가입창 이름란 삭제) [3] 블루파티 2008.08.19
한글로 된 이미지 문제 [17] Defy 2008.08.19
로그인 문제 및 첨부파일 안올라가는 문제 해결책(세션 문제일 경우..) [6] file 이홍석295 2008.08.20
[게시판] 이미존재하는 모듈이름 입니다. 오류. [2] 나이스가이212 2008.08.21
방문자수 (카운터) 마음대로 조작하기 [37] file Br_7941 2008.08.23
라이프팟 연동에서 XML 주소 얻기 최재원541 2008.08.23