게시글/댓글의 getContent()에 1. 팝업메뉴(이 게시글을.. 등), 2. 추가정보 (zone, 주석감싸기)에 대한 옵션을 두어서 스킨 제작시 보다 자유스러운 기능 구현할 수 있도록 하고 이를 바탕으로 게시글의 인쇄시에 제목/글쓴이/날자/본문만 나오도록 기능 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3499 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-08 06:15:13 +00:00
parent 7d99958ff4
commit 120b53b109
4 changed files with 35 additions and 34 deletions

View file

@ -154,7 +154,7 @@
return htmlspecialchars($content); return htmlspecialchars($content);
} }
function getContent($add_comment_info = true) { function getContent($add_popup_menu = true, $add_content_info = true) {
if($this->isSecret() && !$this->isAccessible()) return Context::getLang('msg_is_secret'); if($this->isSecret() && !$this->isAccessible()) return Context::getLang('msg_is_secret');
$content = $this->get('content'); $content = $this->get('content');
@ -162,25 +162,22 @@
// url에 대해서 정규표현식으로 치환 // url에 대해서 정규표현식으로 치환
$content = preg_replace('!([^>^"^\'^=])(http|https|ftp|mms):\/\/([^ ^<^"^\']*)!is','$1<a href="$2://$3" onclick="window.open(this.href);return false;">$2://$3</a>',' '.$content); $content = preg_replace('!([^>^"^\'^=])(http|https|ftp|mms):\/\/([^ ^<^"^\']*)!is','$1<a href="$2://$3" onclick="window.open(this.href);return false;">$2://$3</a>',' '.$content);
// 추가 정보 출력을 하지 않는 경우 // 이 댓글을... 팝업메뉴를 출력할 경우
if(!$add_comment_info) { if($add_popup_menu) {
$content = sprintf(
'%s<div class="comment_popup_menu"><span class="comment_popup_menu comment_%d">%s</span></div>',
$content,
$this->comment_srl, Context::getLang('cmd_comment_do')
);
}
// 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우
if($add_content_info) {
$content = sprintf( $content = sprintf(
'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->', '<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->',
$this->comment_srl, $this->get('member_srl'), $this->comment_srl, $this->get('member_srl'),
$this->comment_srl, $this->get('member_srl'), $this->comment_srl, $this->get('member_srl'),
$content, $content,
$this->comment_srl, $this->get('member_srl'),
$this->comment_srl, $this->get('member_srl')
);
// 추가 정보 출력을 하지 않는 경우 "이 댓글을.." 메뉴 추가
} else {
$content = sprintf(
'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><div class="comment_popup_menu"><span class="comment_popup_menu comment_%d">%s</span></div><!--AfterComment(%d,%d)-->',
$this->comment_srl, $this->get('member_srl'),
$this->comment_srl, $this->get('member_srl'),
$content,
$this->comment_srl, Context::getLang('cmd_comment_do'),
$this->comment_srl, $this->get('member_srl'),
$this->comment_srl, $this->get('member_srl') $this->comment_srl, $this->get('member_srl')
); );
} }

View file

@ -209,7 +209,7 @@
return htmlspecialchars($content); return htmlspecialchars($content);
} }
function getContent($add_document_info = true) { function getContent($add_popup_menu = true, $add_content_info = true) {
if(!$this->document_srl) return; if(!$this->document_srl) return;
if($this->isSecret() && !$this->isGranted()) return Context::getLang('msg_is_secret'); if($this->isSecret() && !$this->isGranted()) return Context::getLang('msg_is_secret');
@ -221,8 +221,17 @@
// url에 대해서 정규표현식으로 치환 // url에 대해서 정규표현식으로 치환
$content = preg_replace('!([^>^"^\'^=])(http|https|ftp|mms):\/\/([^ ^<^"^\']*)!is','$1<a href="$2://$3" onclick="window.open(this.href);return false;">$2://$3</a>',' '.$content); $content = preg_replace('!([^>^"^\'^=])(http|https|ftp|mms):\/\/([^ ^<^"^\']*)!is','$1<a href="$2://$3" onclick="window.open(this.href);return false;">$2://$3</a>',' '.$content);
// 추가 정보 출력을 하지 않는 경우 // 이 게시글을... 팝업메뉴를 출력할 경우
if(!$add_document_info) { if($add_popup_menu) {
$content = sprintf(
'%s<div class="document_popup_menu"><span class="document_popup_menu document_%d">%s</span></div>',
$content,
$this->document_srl, Context::getLang('cmd_document_do')
);
}
// 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우
if($add_content_info) {
$content = sprintf( $content = sprintf(
'<!--BeforeDocument(%d,%d)--><div class="document_%d_%d xe_content">%s</div><!--AfterDocument(%d,%d)-->', '<!--BeforeDocument(%d,%d)--><div class="document_%d_%d xe_content">%s</div><!--AfterDocument(%d,%d)-->',
$this->document_srl, $this->get('member_srl'), $this->document_srl, $this->get('member_srl'),
@ -231,18 +240,8 @@
$this->document_srl, $this->get('member_srl'), $this->document_srl, $this->get('member_srl'),
$this->document_srl, $this->get('member_srl') $this->document_srl, $this->get('member_srl')
); );
// 추가 정보를 출력시 "이 게시물을..'이라는 메뉴 추가
} else {
$content = sprintf(
'<!--BeforeDocument(%d,%d)--><div class="document_%d_%d xe_content">%s</div><div class="document_popup_menu"><span class="document_popup_menu document_%d">%s</span></div><!--AfterDocument(%d,%d)-->',
$this->document_srl, $this->get('member_srl'),
$this->document_srl, $this->get('member_srl'),
$content,
$this->document_srl, Context::getLang('cmd_document_do'),
$this->document_srl, $this->get('member_srl'),
$this->document_srl, $this->get('member_srl')
);
} }
return $content; return $content;
} }

View file

@ -3,3 +3,5 @@
.document_list input { float:left; margin-right:10px; } .document_list input { float:left; margin-right:10px; }
.document_list address { float:left; width:100px; margin-right:10px; overflow:hidden; white-space:nowrap;} .document_list address { float:left; width:100px; margin-right:10px; overflow:hidden; white-space:nowrap;}
.document_list .document_title { } .document_list .document_title { }
div.printContent { padding:20px; }

View file

@ -1,15 +1,18 @@
<!--%import("./js/document_admin.js")--> <!--%import("./js/document_admin.js")-->
<!--%import("./css/document.css")--> <!--%import("./css/document.css")-->
<div><h3>{$oDocument->getTitleText()}</h3></div> <div class="printContent">
<div class="member_{$oDocument->get('member_srl')} gap1 fl">{$oDocument->get('nick_name')}</div> <div><h3>{$oDocument->getTitleText()}</h3></div>
<div class="gap1 fr">{$oDocument->getRegdate()}</div>
<div class="clear"></div> <div class="member_{$oDocument->get('member_srl')} gap1 fl">{$oDocument->get('nick_name')}</div>
<div class="gap1 fr">{$oDocument->getRegdate()}</div>
<div class="gap1">{$oDocument->getContent(false)}</div> <div class="clear"></div>
<div class="gap1">{$oDocument->getContent(false, false)}</div>
</div>
<script type="text/javascript">//<![CDATA[ <script type="text/javascript">//<![CDATA[
xAddEventListener(window,'load',function() { window.print(); } ); xAddEventListener(window,'load',function() { window.print(); } );