mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-25 06:09:55 +09:00
최근 게시물에서 이미지를 추출하여 출력하는 위젯 추가
git-svn-id: http://xe-core.googlecode.com/svn/trunk@2018 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ccc2ebf04d
commit
41810e2140
6 changed files with 140 additions and 0 deletions
30
widgets/newest_images/conf/info.xml
Normal file
30
widgets/newest_images/conf/info.xml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?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. 7. 25">
|
||||
<name xml:lang="ko">제로</name>
|
||||
<description xml:lang="ko">작성된 글의 내용에 포함된 이미지를 출력하는 위젯입니다.</description>
|
||||
</author>
|
||||
<extra_vars>
|
||||
<var id="title_length">
|
||||
<name xml:lang="ko">글 제목 길이</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">정한 글자수만큼 글 제목을 잘라서 출력합니다. (기본 10자)</description>
|
||||
</var>
|
||||
<var id="thumbnail_width">
|
||||
<name xml:lang="ko">이미지 가로크기</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">출력될 이미지의 가로크기를 정하실 수 있습니다. (기본 100)</description>
|
||||
</var>
|
||||
<var id="list_count">
|
||||
<name xml:lang="ko">이미지 수</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">출력될 이미지의 수를 정하실 수 있습니다. (기본 5개)</description>
|
||||
</var>
|
||||
<var id="mid_list">
|
||||
<name xml:lang="ko">대상 모듈</name>
|
||||
<type>mid_list</type>
|
||||
<description xml:lang="ko">선택하신 모듈에 등록된 글을 대상으로 합니다.</description>
|
||||
</var>
|
||||
</extra_vars>
|
||||
</widget>
|
||||
60
widgets/newest_images/newest_images.class.php
Normal file
60
widgets/newest_images/newest_images.class.php
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
/**
|
||||
* @class newest_images
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 최근 이미지를 출력하는 위젯
|
||||
* @version 0.1
|
||||
**/
|
||||
|
||||
class newest_images extends WidgetHandler {
|
||||
|
||||
/**
|
||||
* @brief 위젯의 실행 부분
|
||||
*
|
||||
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
|
||||
* 결과를 만든후 print가 아니라 return 해주어야 한다
|
||||
**/
|
||||
function proc($args) {
|
||||
// 위젯 자체적으로 설정한 변수들을 체크
|
||||
$title_length = (int)$args->title_length;
|
||||
if(!$title_length) $title_length = 10;
|
||||
$thumbnail_width = (int)$args->thumbnail_width;
|
||||
if(!$thumbnail_width) $thumbnail_width = 100;
|
||||
|
||||
$list_count = (int)$args->list_count;
|
||||
if(!$list_count) $list_count = 5;
|
||||
$mid_list = explode(",",$args->mid_list);
|
||||
|
||||
// DocumentModel::getDocumentList()를 이용하기 위한 변수 정리
|
||||
$obj->mid = $mid_list;
|
||||
$obj->sort_index = $order_target;
|
||||
$obj->list_count = $list_count*2;
|
||||
|
||||
// document 모듈의 model 객체를 받아서 getDocumentList() method를 실행
|
||||
$oDocumentModel = &getModel('document');
|
||||
$output = $oDocumentModel->getDocumentList($obj);
|
||||
|
||||
// 템플릿 파일에서 사용할 변수들을 세팅
|
||||
if(count($mid_list)==1) $widget_info->module_name = $mid_list[0];
|
||||
|
||||
$widget_info->document_list = $output->data;
|
||||
$widget_info->title_length = $title_length;
|
||||
$widget_info->thumbnail_width = $thumbnail_width;
|
||||
$widget_info->list_count = $list_count;
|
||||
|
||||
Context::set('widget_info', $widget_info);
|
||||
|
||||
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
|
||||
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
|
||||
Context::set('colorset', $args->colorset);
|
||||
|
||||
// 템플릿 파일을 지정
|
||||
$tpl_file = 'list';
|
||||
|
||||
// 템플릿 컴파일
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$output = $oTemplate->compile($tpl_path, $tpl_file);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
7
widgets/newest_images/skins/default/css/normal.css
Normal file
7
widgets/newest_images/skins/default/css/normal.css
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
.ni_box { border:1px solid #EEEEEE; padding:5px; }
|
||||
.ni_box .ni_item { float:left; margin:3px; list-style:none; text-align:center;}
|
||||
.ni_box .ni_item a { color:#444444; text-decoration:none; }
|
||||
.ni_box .ni_item a:visited { color:#AAAAAA; text-decoration:none; }
|
||||
.ni_box .ni_item a:hover { font-weight:bold; letter-spacing:-1px; }
|
||||
.ni_box .ni_item img { padding:5px; }
|
||||
.ni_box .ni_item img:hover { border:1px solid #888888; padding:4px;}
|
||||
BIN
widgets/newest_images/skins/default/images/blank.gif
Normal file
BIN
widgets/newest_images/skins/default/images/blank.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 B |
30
widgets/newest_images/skins/default/list.html
Normal file
30
widgets/newest_images/skins/default/list.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!-- 설정된 컬러셋의 종류에 따라서 css파일을 import 합니다 -->
|
||||
|
||||
<!--@if($colorset=="normal"||!$colorset)-->
|
||||
<!--%import("css/normal.css")-->
|
||||
<!--@end-->
|
||||
|
||||
<div class="ni_box">
|
||||
<ul>
|
||||
|
||||
{@ $count = 0; }
|
||||
<!--@foreach($widget_info->document_list as $oDocument)-->
|
||||
<!--@if($count <= $widget_info->list_count && $oDocument->thumbnailExists($widget_info->thumbnail_width) )-->
|
||||
|
||||
<li class="ni_item">
|
||||
<!--@if($oDocument->thumbnailExists($widget_info->thumbnail_width))-->
|
||||
<a href="{getUrl('','document_srl',$oDocument->document_srl)}"><img src="{$oDocument->getThumbnail($widget_info->thumbnail_width)}" width="{$widget_info->thumbnail_width}" height="{$widget_info->thumbnail_width}" border="0" alt="" /></a>
|
||||
<!--@else-->
|
||||
<img src="./images/blank.gif" border="0" width="{$widget_info->thumbnail_width}" height="{$widget_info->thumbnail_width}" />
|
||||
<!--@end-->
|
||||
|
||||
<br /><a href="{$oDocument->getPermanentUrl()}#{$oDocument->getCommentCount()}">{$oDocument->getTitleText($widget_info->title_length)}</a>
|
||||
</li>
|
||||
|
||||
{@ $count++}
|
||||
<!--@end-->
|
||||
<!--@end-->
|
||||
|
||||
</ul>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
13
widgets/newest_images/skins/default/skin.xml
Normal file
13
widgets/newest_images/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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue