mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 19:21:40 +09:00
simulz님의 다운로드 랭킹 위젯 추가
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3077 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
9a8a1d50bf
commit
dcd67cf711
15 changed files with 327 additions and 0 deletions
55
widgets/rank_download/conf/info.xml
Normal file
55
widgets/rank_download/conf/info.xml
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<widget version="0.1">
|
||||
<title xml:lang="ko">다운로드 랭킹 출력</title>
|
||||
<author email_address="k10206@naver.com" link="http://www.simulz.com" date="2007. 8. 29">
|
||||
<name xml:lang="ko">Simulz</name>
|
||||
<description xml:lang="ko">자료 내려받기 순위를 출력합니다.</description>
|
||||
</author>
|
||||
<extra_vars>
|
||||
<var id="title">
|
||||
<name xml:lang="ko">제목</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">위젯의 제목으로 출력됩니다.</description>
|
||||
</var>
|
||||
<var id="list_count">
|
||||
<name xml:lang="ko">목록수</name>
|
||||
<type>text</type>
|
||||
<description xml:lang="ko">출력될 목록의 수를 정하실 수 있습니다. (기본 5개)</description>
|
||||
</var>
|
||||
<var id="attach_type">
|
||||
<name xml:lang="ko">파일 종류</name>
|
||||
<type>select</type>
|
||||
<description xml:lang="ko">순위에 포함할 파일 종류를 선택하세요.</description>
|
||||
<options>
|
||||
<name xml:lang="ko">모두</name>
|
||||
<value>all</value>
|
||||
</options>
|
||||
<options>
|
||||
<name xml:lang="ko">이미지 제외</name>
|
||||
<value>noimage</value>
|
||||
</options>
|
||||
<options>
|
||||
<name xml:lang="ko">이미지만</name>
|
||||
<value>image</value>
|
||||
</options>
|
||||
</var>
|
||||
<var id="download">
|
||||
<name xml:lang="ko">내려 받기</name>
|
||||
<type>select</type>
|
||||
<description xml:lang="ko">바로 내려 받는 링크를 보여줍니다.</description>
|
||||
<options>
|
||||
<name xml:lang="ko">링크 보임</name>
|
||||
<value>Y</value>
|
||||
</options>
|
||||
<options>
|
||||
<name xml:lang="ko">링크 숨김</name>
|
||||
<value>N</value>
|
||||
</options>
|
||||
</var>
|
||||
<var id="mid_list">
|
||||
<name xml:lang="ko">대상 모듈</name>
|
||||
<type>mid_list</type>
|
||||
<description xml:lang="ko">선택하신 모듈에 등록된 글을 대상으로 합니다.</description>
|
||||
</var>
|
||||
</extra_vars>
|
||||
</widget>
|
||||
18
widgets/rank_download/queries/getFileList.xml
Normal file
18
widgets/rank_download/queries/getFileList.xml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<query id="getFileList" action="select">
|
||||
<tables>
|
||||
<table name="files" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="module_srl" var="s_module_srl" />
|
||||
<condition operation="equal" column="isvalid" var="isvalid" pipe="and" />
|
||||
<condition operation="more" column="download_count" var="s_download_count" pipe="and" />
|
||||
<condition operation="equal" column="direct_download" var="direct_download" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="download_count" order="desc" />
|
||||
<list_count var="list_count" default="20" />
|
||||
</navigation>
|
||||
</query>
|
||||
87
widgets/rank_download/rank_download.class.php
Normal file
87
widgets/rank_download/rank_download.class.php
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<?php
|
||||
/**
|
||||
* @class rank_download
|
||||
* @author Simulz.com (k10206@naver.com)
|
||||
* @brief 파일 다운로드 랭킹
|
||||
* @version 0.1
|
||||
**/
|
||||
|
||||
class rank_download extends WidgetHandler {
|
||||
|
||||
/**
|
||||
* @brief 위젯의 실행 부분
|
||||
*
|
||||
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
|
||||
* 결과를 만든후 print가 아니라 return 해주어야 한다
|
||||
**/
|
||||
function proc($args) {
|
||||
// 위젯 자체적으로 설정한 변수들을 체크
|
||||
$title = $args->title;
|
||||
$order_target = 'download_count';
|
||||
$args->order_type = 'desc';
|
||||
$list_count = (int)$args->list_count;
|
||||
if(!$list_count) $list_count = 5;
|
||||
$mid_list = explode(",",$args->mid_list);
|
||||
$subject_cut_size = $args->subject_cut_size;
|
||||
if(!$subject_cut_size) $subject_cut_size = 0;
|
||||
|
||||
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
|
||||
if($mid_list) {
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_srl = $oModuleModel->getModuleSrlByMid($mid_list);
|
||||
}
|
||||
|
||||
// FileModel::getFileList()를 이용하기 위한 변수 정리
|
||||
$obj->s_module_srl = (is_array($module_srl)) ? implode(',',$module_srl) : "";
|
||||
$obj->direct_download = ($args->attach_type == "noimage") ? "N": (($args->attach_type == "image") ? "Y" : "");
|
||||
|
||||
if($args->without_image == "true") $obj->direct_download = "N";
|
||||
$obj->list_count = $list_count;
|
||||
$obj->sort_index = $order_target;
|
||||
$obj->order_type = $args->order_type;
|
||||
|
||||
// 다운로드 횟수 1이상만 검색
|
||||
$obj->s_download_count = 1;
|
||||
|
||||
$output = executeQuery('widgets.rank_download.getFileList', $obj);
|
||||
|
||||
// 오류가 생기면 그냥 무시
|
||||
if(!$output->toBool()) ;
|
||||
|
||||
$oFileModel = &getModel('file');
|
||||
|
||||
if(count($output->data)) {
|
||||
foreach($output->data as $key => $val) {
|
||||
$file = $val;
|
||||
$file->download_url = $oFileModel->getDownloadUrl($val->file_srl, $val->sid);
|
||||
|
||||
$file->source_filename = htmlspecialchars($val->source_filename);
|
||||
$file_list[$key] = $file;
|
||||
}
|
||||
}
|
||||
|
||||
// 템플릿 파일에서 사용할 변수들을 세팅
|
||||
if(count($mid_list)==1) $widget_info->module_name = $mid_list[0];
|
||||
|
||||
$widget_info->title = $title;
|
||||
$widget_info->list_count = $list_count;
|
||||
$widget_info->file_list = $file_list;
|
||||
$widget_info->download = $args->download == "Y" ? true : false;
|
||||
$widget_info->subject_cut_size = $subject_cut_size;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
21
widgets/rank_download/skins/sz_xe/css/default.css
Normal file
21
widgets/rank_download/skins/sz_xe/css/default.css
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
.sz_download { margin-right:10px; width:100%; position:relative;}
|
||||
.sz_download h2 { display:block; height:21px; padding:9px 0 0 9px; margin-bottom:12px; color:#000000; font-size:1em;}
|
||||
|
||||
.sz_download ul li { position:relative; height:21px; background:url(../images/default/bullet.gif) no-repeat left; padding-left:15px; overflow:hidden; }
|
||||
|
||||
.sz_download ul li .title { position:relative; z-index:0; overflow:hidden; width:100%; white-space:nowrap;}
|
||||
|
||||
.sz_download .sz_Box_000{border:solid 0;padding:0;}
|
||||
.sz_download .sz_Box_001{width:100%;border:solid 1px;border-color:#E7E7E7;padding:5px 5px 2px 5px;background-color:#F4F4F4;color:#696969;}
|
||||
.sz_download .sz_Box_002{width:100%;border:solid 1px;border-color:#DDEAA8;padding:5px 5px 2px 5px;background-color:#FBFDF1;color:#99B81A;}
|
||||
.sz_download .sz_Box_003{width:100%;border:solid 1px;border-color:#F9D5D5;padding:5px 5px 2px 5px;background-color:#FEF6F6;color:#D98383;}
|
||||
.sz_download .sz_Box_004{width:100%;border:solid 1px;border-color:#EFDAF4;padding:5px 5px 2px 5px;background-color:#FCF7FD;color:#AF69C0;}
|
||||
.sz_download .sz_Box_005{width:100%;border:solid 1px;border-color:#DCDFF6;padding:5px 5px 2px 5px;background-color:#F6F7FE;color:#7381EA;}
|
||||
.sz_download .sz_Box_006{width:100%;border:solid 1px;border-color:#DAEAEE;padding:5px 5px 2px 5px;background-color:#F0F6F8;color:#619DAC;}
|
||||
.sz_download .sz_Box_007{width:100%;border:solid 1px;border-color:#D5EDDD;padding:5px 5px 2px 5px;background-color:#EFF9F2;color:#6FB587;}
|
||||
.sz_download .sz_Box_008{width:100%;border:solid 1px;border-color:#FFEC15;padding:5px 5px 2px 5px;background-color:#FFFCDF;color:#FF9900;}
|
||||
.sz_download .sz_Box_009{width:100%;border:solid 1px;border-color:#9DD7E8;padding:5px 5px 2px 5px;background-color:#F8FDFF;color:#0A8DBD;}
|
||||
|
||||
.sz_download a {color: #000000; text-decoration:none;}
|
||||
.sz_download a:hover {color: #000000;}
|
||||
.sz_download a:visit {color: #000000;}
|
||||
BIN
widgets/rank_download/skins/sz_xe/images/default/bullet.gif
Normal file
BIN
widgets/rank_download/skins/sz_xe/images/default/bullet.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 282 B |
BIN
widgets/rank_download/skins/sz_xe/images/default/bulletD0.gif
Normal file
BIN
widgets/rank_download/skins/sz_xe/images/default/bulletD0.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 B |
BIN
widgets/rank_download/skins/sz_xe/images/default/lineNotice.gif
Normal file
BIN
widgets/rank_download/skins/sz_xe/images/default/lineNotice.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 B |
21
widgets/rank_download/skins/sz_xe/list.html
Normal file
21
widgets/rank_download/skins/sz_xe/list.html
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<!-- 설정된 컬러셋의 종류에 따라서 css파일을 import 합니다 -->
|
||||
|
||||
<!--%import("css/default.css")-->
|
||||
|
||||
<div class="sz_download">
|
||||
<div class="sz_{$colorset}">
|
||||
<!--@if($widget_info->title)-->
|
||||
<h2>{$widget_info->title} Top {$widget_info->list_count}</h2>
|
||||
<!--@end-->
|
||||
<ul>
|
||||
<!--@foreach($widget_info->file_list as $val)-->
|
||||
<li>
|
||||
<div class="title">
|
||||
<a href="{getUrl('','document_srl',$val->upload_target_srl)}">{$val->source_filename} ({FileHandler::filesize($val->file_size)})</a>: {$val->download_count}회
|
||||
<!--@if($widget_info->download)--><a href="{$val->download_url}">[Download]</a><!--@end-->
|
||||
</div>
|
||||
</li>
|
||||
<!--@end-->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
42
widgets/rank_download/skins/sz_xe/skin.xml
Normal file
42
widgets/rank_download/skins/sz_xe/skin.xml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<skin>
|
||||
<title xml:lang="ko">Simulz 랭킹 스킨</title>
|
||||
<maker email_address="k10206@naver.com" link="http://www.simulz.com" date="2007. 8. 29">
|
||||
<name xml:lang="ko">Simulz</name>
|
||||
<description xml:lang="ko">
|
||||
Simulz 랭킹 스킨입니다.
|
||||
</description>
|
||||
</maker>
|
||||
<colorset>
|
||||
<color name="Box_000">
|
||||
<title xml:lang="ko">기본</title>
|
||||
</color>
|
||||
<color name="Box_001">
|
||||
<title xml:lang="ko">회색</title>
|
||||
</color>
|
||||
<color name="Box_002">
|
||||
<title xml:lang="ko">연두</title>
|
||||
</color>
|
||||
<color name="Box_003">
|
||||
<title xml:lang="ko">분홍</title>
|
||||
</color>
|
||||
<color name="Box_004">
|
||||
<title xml:lang="ko">보라</title>
|
||||
</color>
|
||||
<color name="Box_005">
|
||||
<title xml:lang="ko">밝은 파랑</title>
|
||||
</color>
|
||||
<color name="Box_006">
|
||||
<title xml:lang="ko">청록</title>
|
||||
</color>
|
||||
<color name="Box_007">
|
||||
<title xml:lang="ko">초록</title>
|
||||
</color>
|
||||
<color name="Box_008">
|
||||
<title xml:lang="ko">노랑</title>
|
||||
</color>
|
||||
<color name="Box_009">
|
||||
<title xml:lang="ko">파랑</title>
|
||||
</color>
|
||||
</colorset>
|
||||
</skin>
|
||||
25
widgets/rank_download/skins/sz_xe2/css/default.css
Normal file
25
widgets/rank_download/skins/sz_xe2/css/default.css
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
.sz_download { margin-right:10px; width:100%; position:relative;}
|
||||
.sz_download h2 { display:block; height:21px; padding:9px 0 0 9px; margin-bottom:12px; color:#000000; font-size:1em;}
|
||||
|
||||
.sz_download ul li { position:relative; background:url(../images/default/bullet.gif) no-repeat left; padding-left:15px; overflow:hidden; }
|
||||
|
||||
.sz_download ul li .title { position:relative; z-index:0; overflow:hidden; width:100%; white-space:nowrap;}
|
||||
|
||||
.sz_download .sz_Box_001 {border: #dacaae solid 1px; width:100%;background-color:#f5f1e8;}
|
||||
.sz_download .sz_Box_001 td { padding:7px;}
|
||||
.sz_download .sz_Box_001_2 {width:100%;}
|
||||
.sz_download .sz_Box_001_2 td {background-color:#fcfaf7;color:#977334;}
|
||||
|
||||
.sz_download .sz_Box_002 {BORDER: #dce4fd solid 1px; width:100%;background-color:#eff2fe;}
|
||||
.sz_download .sz_Box_002 td { padding:7px;}
|
||||
.sz_download .sz_Box_002_2 {width:100%;}
|
||||
.sz_download .sz_Box_002_2 td {background-color:#f7f9fe;color:#7187CA;}
|
||||
|
||||
.sz_download .sz_Box_003 {BORDER: #ffdceb solid 1px; width:100%;background-color:#ffeff6;}
|
||||
.sz_download .sz_Box_003 td { padding:7px;}
|
||||
.sz_download .sz_Box_003_2 {width:100%;}
|
||||
.sz_download .sz_Box_003_2 td {background-color:#fff9fd;color:#E8649D;}
|
||||
|
||||
.sz_download a {color: #000000; text-decoration:none;}
|
||||
.sz_download a:hover {color: #000000;}
|
||||
.sz_download a:visit {color: #000000;}
|
||||
BIN
widgets/rank_download/skins/sz_xe2/images/default/bullet.gif
Normal file
BIN
widgets/rank_download/skins/sz_xe2/images/default/bullet.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 282 B |
BIN
widgets/rank_download/skins/sz_xe2/images/default/bulletD0.gif
Normal file
BIN
widgets/rank_download/skins/sz_xe2/images/default/bulletD0.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 B |
BIN
widgets/rank_download/skins/sz_xe2/images/default/lineNotice.gif
Normal file
BIN
widgets/rank_download/skins/sz_xe2/images/default/lineNotice.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 139 B |
37
widgets/rank_download/skins/sz_xe2/list.html
Normal file
37
widgets/rank_download/skins/sz_xe2/list.html
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!-- 설정된 컬러셋의 종류에 따라서 css파일을 import 합니다 -->
|
||||
|
||||
<!--%import("css/default.css")-->
|
||||
|
||||
<div class="sz_download">
|
||||
|
||||
<TABLE class="sz_{$colorset}">
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD style="">
|
||||
<TABLE class="sz_{$colorset}_2">
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD>
|
||||
<!--@if($widget_info->title)-->
|
||||
<h2>{$widget_info->title} Top {$widget_info->list_count}</h2>
|
||||
<!--@end-->
|
||||
<ul>
|
||||
<!--@foreach($widget_info->file_list as $val)-->
|
||||
<li>
|
||||
<div class="title">
|
||||
<a href="{getUrl('','document_srl',$val->upload_target_srl)}">{$val->source_filename} ({FileHandler::filesize($val->file_size)})</a>: {$val->download_count}회
|
||||
<!--@if($widget_info->download)--><a href="{$val->download_url}">[Download]</a><!--@end-->
|
||||
</div>
|
||||
</li>
|
||||
<!--@end-->
|
||||
</ul>
|
||||
</TD>
|
||||
</TR>
|
||||
</TBODY>
|
||||
</TABLE>
|
||||
</TD>
|
||||
</TR>
|
||||
</TBODY>
|
||||
</TABLE>
|
||||
|
||||
</div>
|
||||
21
widgets/rank_download/skins/sz_xe2/skin.xml
Normal file
21
widgets/rank_download/skins/sz_xe2/skin.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<skin>
|
||||
<title xml:lang="ko">Simulz 랭킹 스킨</title>
|
||||
<maker email_address="k10206@naver.com" link="http://www.simulz.com" date="2007. 8. 29">
|
||||
<name xml:lang="ko">Simulz</name>
|
||||
<description xml:lang="ko">
|
||||
Simulz 랭킹 스킨입니다.
|
||||
</description>
|
||||
</maker>
|
||||
<colorset>
|
||||
<color name="Box_001">
|
||||
<title xml:lang="ko">갈색</title>
|
||||
</color>
|
||||
<color name="Box_002">
|
||||
<title xml:lang="ko">파랑</title>
|
||||
</color>
|
||||
<color name="Box_003">
|
||||
<title xml:lang="ko">빨강</title>
|
||||
</color>
|
||||
</colorset>
|
||||
</skin>
|
||||
Loading…
Add table
Add a link
Reference in a new issue