위젯 검출 정규 표현식을 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2892 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-11-01 10:28:42 +00:00
parent f9896fe51a
commit 90aa62a6ac
993 changed files with 9190 additions and 10457 deletions

View file

@ -13,6 +13,48 @@
function init() {
}
/**
* @brief 선택된 게시물의 팝업메뉴 표시
*
* 인쇄, 스크랩, 추천, 비추천, 신고 기능 추가
**/
function getCommentMenu() {
// 요청된 게시물 번호와 현재 로그인 정보 구함
$comment_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
$logged_info = Context::get('logged_info');
$act = Context::get('cur_act');
// menu_list 에 "표시할글,target,url" 을 배열로 넣는다
$menu_list = array();
// trigger 호출
ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
// 추천 버튼 추가
$menu_str = Context::getLang('cmd_vote');
$menu_link = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
$menu_list[] = sprintf("\n%s,%s,%s", '', $menu_str, $menu_link);
// 비추천 버튼 추가
$menu_str = Context::getLang('cmd_vote_down');
$menu_link = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
$menu_list[] = sprintf("\n%s,%s,%s", '', $menu_str, $menu_link);
// 신고 기능 추가
$menu_str = Context::getLang('cmd_declare');
$menu_link = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
$menu_list[] = sprintf("\n%s,%s,%s", '', $menu_str, $menu_link);
// trigger 호출 (after)
ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
// 정보를 저장
$this->add("menu_list", implode("\n",$menu_list));
}
/**
* @brief comment_srl에 권한이 있는지 체크
*
@ -34,24 +76,11 @@
/**
* @brief 댓글 가져오기
**/
function getComment($comment_srl, $is_admin = false) {
if(!$comment_srl) return;
$args->comment_srl = $comment_srl;
$output = executeQuery('comment.getComment', $args);
$comment = $output->data;
function getComment($comment_srl=0, $is_admin = false) {
$oComment = new commentItem($comment_srl);
if($is_admin) $oComment->setGrant();
// 첨부파일 가져오기
if($comment->uploaded_count) {
$oFileModel = &getModel('file');
$file_list = $oFileModel->getFiles($comment_srl, $is_admin);
$comment->uploaded_list = $file_list;
}
// 로그인 사용자의 경우 로그인 정보를 일단 구해 놓음
$logged_info = Context::get('logged_info');
if($is_admin || $this->isGranted($comment_srl) || $comment->member_srl == $logged_info->member_srl) $comment->is_granted = true;
return $comment;
return $oComment;
}
/**
@ -60,9 +89,25 @@
function getComments($comment_srl_list) {
if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list);
// DB에서 가져옴
$args->comment_srls = $comment_srls;
$output = executeQuery('comment.getComments', $args);
return $output->data;
if(!$output->toBool()) return;
$comment_list = $output->data;
if(!$comment_list) return;
if(!is_array($comment_list)) $comment_list = array($comment_list);
$comment_count = count($comment_list);
foreach($comment_list as $key => $attribute) {
if(!$attribute->comment_srl) continue;
$oComment = null;
$oComment = new commentItem();
$oComment->setAttribute($attribute);
if($is_admin) $oComment->setGrant();
$result[$attribute->comment_srl] = $oComment;
}
return $result;
}
/**
@ -93,7 +138,22 @@
$output = executeQuery('comment.getNewestCommentList', $args);
if(!$output->toBool()) return $output;
return $output;
$comment_list = $output->data;
if($comment_list) {
if(!is_array($comment_list)) $comment_list = array($comment_list);
$comment_count = count($comment_list);
foreach($comment_list as $key => $attribute) {
if(!$attribute->comment_srl) continue;
$oComment = null;
$oComment = new commentItem();
$oComment->setAttribute($attribute);
$oComment->setGrant();
$result[$key] = $oComment;
}
$output->data = $result;
}
return $result;
}
/**
@ -117,9 +177,6 @@
// 로그인 사용자의 경우 로그인 정보를 일단 구해 놓음
$logged_info = Context::get('logged_info');
// 첨부파일이 있을 경우를 대비한 File 모듈의 model객체 미리 생성
$oFileModel = &getModel('file');
// loop를 돌면서 코멘트의 계층 구조 만듬
for($i=$comment_count-1;$i>=0;$i--) {
$comment_srl = $source_list[$i]->comment_srl;
@ -136,12 +193,6 @@
if($is_admin || $this->isGranted($comment_srl) || $member_srl == $logged_info->member_srl) $source_list[$i]->is_granted = true;
// 첨부파일 가져오기
if($source_list[$i]->uploaded_count) {
$file_list = $oFileModel->getFiles($comment_srl, $is_admin);
$source_list[$i]->uploaded_list = $file_list;
}
// 목록을 만듬
$list[$comment_srl] = $source_list[$i];
@ -161,14 +212,20 @@
function _arrangeComment(&$comment_list, $list, $depth) {
if(!count($list)) return;
foreach($list as $key => $val) {
$oCommentItem = new commentItem();
if($val->child) {
$tmp = $val;
$tmp->depth = $depth;
$comment_list[$tmp->comment_srl] = $tmp;
$oCommentItem->setAttribute($tmp);
$comment_list[$tmp->comment_srl] = $oCommentItem;
$this->_arrangeComment($comment_list,$val->child,$depth+1);
} else {
$val->depth = $depth;
$comment_list[$val->comment_srl] = $val;
$oCommentItem->setAttribute($val);
$comment_list[$val->comment_srl] = $oCommentItem;
}
}
}