게시글의 카테고리를 다중 depth를 지원하게 하고 게시판 모듈에서 이 다중 depth를 적용하도록 기본 스킨 수정. 게시글 분류 위젯 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3549 201d5d3c-b55e-5fd7-737f-ddc643e51545
56
widgets/category/category.class.php
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* @class category
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 분류 출력기
|
||||
* @version 0.1
|
||||
**/
|
||||
|
||||
class category extends WidgetHandler {
|
||||
|
||||
/**
|
||||
* @brief 위젯의 실행 부분
|
||||
*
|
||||
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
|
||||
* 결과를 만든후 print가 아니라 return 해주어야 한다
|
||||
**/
|
||||
function proc($args) {
|
||||
// 위젯 자체적으로 설정한 변수들을 체크
|
||||
$pos = strpos($args->mid_list, ',');
|
||||
if($pos === false) $mid = $args->mid_list;
|
||||
else $mid = substr($args->mid_list, 0, $pos);
|
||||
if(!$mid) return;
|
||||
|
||||
// 대상 mid의 module_srl 을 구함
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByMid($mid);
|
||||
|
||||
$module_srl = $module_info->module_srl;
|
||||
|
||||
// 대상 모듈의 카테고리 파일을 불러옴
|
||||
$oDocumentModel = &getModel('document');
|
||||
$category_list = $oDocumentModel->getCategoryList($module_srl);
|
||||
|
||||
// 모듈의 정보를 구함
|
||||
$widget_info->module_info = $module_info;
|
||||
|
||||
$widget_info->mid = $mid;
|
||||
$widget_info->document_category = $document_category;
|
||||
$widget_info->module_info = $module_info;
|
||||
$widget_info->category_list = $category_list;
|
||||
|
||||
// 전체 개수를 구함
|
||||
$total_count = $oDocumentModel->getDocumentCount($module_srl);
|
||||
$widget_info->total_document_count = $total_count;
|
||||
|
||||
Context::set('widget_info', $widget_info);
|
||||
|
||||
// 템플릿 컴파일
|
||||
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
|
||||
$tpl_file = 'category';
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||
}
|
||||
}
|
||||
?>
|
||||
15
widgets/category/conf/info.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<widget version="0.1">
|
||||
<title xml:lang="ko">게시글 분류 출력기</title>
|
||||
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
|
||||
<name xml:lang="ko">제로</name>
|
||||
<description xml:lang="ko">게시판등 문서모듈의 분류를 사용하는 모듈에서 분류를 추출하여 블로그 카테고리와 같이 출력하는 기능입니다.</description>
|
||||
</author>
|
||||
<extra_vars>
|
||||
<var id="mid_list">
|
||||
<name xml:lang="ko">대상 모듈</name>
|
||||
<type>mid_list</type>
|
||||
<description xml:lang="ko">선택하신 모듈을 대상으로 합니다. 꼭 한개의 모듈만 선택해 주세요.</description>
|
||||
</var>
|
||||
</extra_vars>
|
||||
</widget>
|
||||
58
widgets/category/skins/default/category.html
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<!--%import("css/category.css")-->
|
||||
<!--%import("js/category.js")-->
|
||||
|
||||
<div class="categoryWidget">
|
||||
|
||||
<div class="top <!--@if($mid == $widget_info->mid && !$category)-->selected<!--@end-->"><a href="{getUrl('','mid',$widget_info->mid)}">{$widget_info->module_info->browser_title}</a> <strong>[{$widget_info->total_document_count}]</strong></div>
|
||||
|
||||
{@ $prev_depth = 0}
|
||||
{@ $prev_last = false}
|
||||
{@ $prev_srl = 0}
|
||||
{@ $prev_expand = false}
|
||||
|
||||
<!--@foreach($widget_info->category_list as $key => $val)-->
|
||||
|
||||
<!--@if($val->last)-->
|
||||
<!--@if($val->child_count)-->
|
||||
<!--@if(!$val->expand)-->{@ $class = "plusBottom" }<!--@else-->{@ $class = "minusBottom" }<!--@end-->
|
||||
<!--@else-->
|
||||
{@ $class = "joinBottom" }
|
||||
<!--@end-->
|
||||
<!--@elseif($val->first)-->
|
||||
<!--@if($val->child_count)-->
|
||||
<!--@if(!$val->expand)-->{@ $class = "plus" }<!--@else-->{@ $class = "minus" }<!--@end-->
|
||||
<!--@else-->
|
||||
{@ $class = "join" }
|
||||
<!--@end-->
|
||||
<!--@else-->
|
||||
<!--@if($val->child_count)-->
|
||||
<!--@if(!$val->expand)-->{@ $class = "plus" }<!--@else-->{@ $class = "minus" }<!--@end-->
|
||||
<!--@else-->
|
||||
{@ $class = "join" }
|
||||
<!--@end-->
|
||||
<!--@end-->
|
||||
|
||||
<!--@if($prev_depth < $val->depth)-->
|
||||
{@ $prev_depth = $val->depth }
|
||||
<div class="<!--@if(!$prev_last)-->child<!--@else-->childBottom<!--@end-->" id="category_{$prev_srl}" <!--@if(!$prev_expand)-->style="display:none;"<!--@end-->>
|
||||
<!--@elseif($prev_depth > $val->depth)-->
|
||||
<!--@for($i=$val->depth;$i<$prev_depth;$i++)--></div><!--@end-->
|
||||
{@ $prev_depth = $val->depth }
|
||||
<!--@end-->
|
||||
|
||||
<div class="{$class}" id="category_parent_{$val->category_srl}">
|
||||
<div class="item <!--@if($val->selected)-->selected<!--@end-->">
|
||||
<a href="{getUrl('','mid',$widget_info->mid, 'category',$val->category_srl)}">{$val->text}</a>
|
||||
<!--@if($val->document_count)--><strong>[{$val->document_count}]</strong><!--@end-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{@ $prev_last = $val->last}
|
||||
{@ $prev_srl = $val->category_srl}
|
||||
{@ $prev_expand = $val->expand}
|
||||
|
||||
<!--@end-->
|
||||
|
||||
<!--@for($i=0;$i<$prev_depth;$i++)--></div><!--@end-->
|
||||
|
||||
</div>
|
||||
80
widgets/category/skins/default/css/category.css
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
@charset "utf-8";
|
||||
|
||||
.categoryWidget .top {
|
||||
background:url("../images/top.gif") no-repeat left -1px;
|
||||
padding-left:14px;
|
||||
height:18px;
|
||||
}
|
||||
|
||||
.categoryWidget a {
|
||||
text-decoration:none;
|
||||
color:#555555;
|
||||
padding:0 2px 0 2px;
|
||||
}
|
||||
|
||||
.categoryWidget a:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
.categoryWidget strong {
|
||||
font-weight:normal;
|
||||
color:#DF7901;
|
||||
font-size:7pt;
|
||||
font-family:tahoma;
|
||||
}
|
||||
|
||||
.categoryWidget .selected a {
|
||||
background-color:#0A246A;
|
||||
color:#FFFFFF;
|
||||
}
|
||||
|
||||
.categoryWidget .item {
|
||||
background:url("../images/page.gif") no-repeat left 2px;
|
||||
padding-left:13px;
|
||||
height:18px;
|
||||
}
|
||||
|
||||
|
||||
.categoryWidget .child {
|
||||
background:url("../images/line.gif") repeat-y left top;
|
||||
padding-left:16px;
|
||||
}
|
||||
|
||||
.categoryWidget .childBottom {
|
||||
background:none;
|
||||
padding-left:16px;
|
||||
}
|
||||
|
||||
.categoryWidget .plus {
|
||||
background:url("../images/plus.gif") no-repeat left top;
|
||||
padding-left:16px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.categoryWidget .plusBottom {
|
||||
background:url("../images/plusbottom.gif") no-repeat left top;
|
||||
padding-left:16px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.categoryWidget .minus {
|
||||
background:url("../images/minus.gif") no-repeat left top;
|
||||
padding-left:16px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.categoryWidget .minusBottom {
|
||||
background:url("../images/minusbottom.gif") no-repeat left top;
|
||||
padding-left:16px;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
.categoryWidget .joinBottom {
|
||||
background:url("../images/joinbottom.gif") no-repeat left top;
|
||||
padding-left:16px;
|
||||
}
|
||||
|
||||
.categoryWidget .join{
|
||||
background:url("../images/join.gif") no-repeat left top;
|
||||
padding-left:16px;
|
||||
}
|
||||
BIN
widgets/category/skins/default/images/join.gif
Normal file
|
After Width: | Height: | Size: 69 B |
BIN
widgets/category/skins/default/images/joinbottom.gif
Normal file
|
After Width: | Height: | Size: 66 B |
BIN
widgets/category/skins/default/images/line.gif
Normal file
|
After Width: | Height: | Size: 66 B |
BIN
widgets/category/skins/default/images/minus.gif
Normal file
|
After Width: | Height: | Size: 86 B |
BIN
widgets/category/skins/default/images/minusbottom.gif
Normal file
|
After Width: | Height: | Size: 85 B |
BIN
widgets/category/skins/default/images/page.gif
Normal file
|
After Width: | Height: | Size: 301 B |
BIN
widgets/category/skins/default/images/plus.gif
Normal file
|
After Width: | Height: | Size: 89 B |
BIN
widgets/category/skins/default/images/plusbottom.gif
Normal file
|
After Width: | Height: | Size: 88 B |
BIN
widgets/category/skins/default/images/plustop.gif
Normal file
|
After Width: | Height: | Size: 481 B |
BIN
widgets/category/skins/default/images/top.gif
Normal file
|
After Width: | Height: | Size: 88 B |
32
widgets/category/skins/default/js/category.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
function toggleCategory(evt) {
|
||||
var e = new xEvent(evt);
|
||||
var obj = e.target;
|
||||
var srl = null;
|
||||
if(obj.nodeName != 'DIV') return;
|
||||
|
||||
if(obj.id && /^category_parent_/.test(obj.id)) {
|
||||
srl = obj.id.replace(/^category_parent_/,'');
|
||||
} else if(obj.id && /^category_/.test(obj.id)) {
|
||||
srl = obj.id.replace(/^category_parent_/,'');
|
||||
} else if(obj.className && /item/.test(obj.className)) {
|
||||
var pObj = obj.parentNode;
|
||||
srl = pObj.id.replace(/^category_parent_/,'');
|
||||
}
|
||||
|
||||
if(!srl) return;
|
||||
var obj = xGetElementById("category_"+srl);
|
||||
if(!obj) return;
|
||||
|
||||
var selObj = xGetElementById("category_parent_"+srl);
|
||||
if(!selObj) return;
|
||||
|
||||
if(!obj.style.display || obj.style.display == 'block') {
|
||||
obj.style.display = 'none';
|
||||
selObj.className = selObj.className.replace('minus','plus');
|
||||
} else {
|
||||
obj.style.display = 'block';
|
||||
selObj.className = selObj.className.replace('plus','minus');
|
||||
}
|
||||
}
|
||||
|
||||
xAddEventListener(document, 'click', toggleCategory);
|
||||
13
widgets/category/skins/default/skin.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<skin>
|
||||
<title xml:lang="ko">분류 출력 기본 스킨</title>
|
||||
<maker email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
|
||||
<name xml:lang="ko">제로</name>
|
||||
<description xml:lang="ko">게시글 분류를 출력하는 기본 스킨입니다</description>
|
||||
</maker>
|
||||
<colorset>
|
||||
<color name="normal">
|
||||
<title xml:lang="ko">기본 컬러</title>
|
||||
</color>
|
||||
</colorset>
|
||||
</skin>
|
||||