git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2327 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-08-12 03:59:52 +00:00
commit 8326004cb2
2773 changed files with 91485 additions and 0 deletions

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<module version="0.1">
<title xml:lang="ko">위젯</title>
<title xml:lang="zh-CN">控件</title>
<title xml:lang="jp">ウィジェット</title>
<title xml:lang="en">Widget</title>
<author email_address="zero@zeroboard.com" link="http://www.zeroboard.com" date="2007. 2. 28">
<name xml:lang="ko">제로</name>
<name xml:lang="zh-CN">zero</name>
<name xml:lang="jp">Zero</name>
<name xml:lang="en">Zero</name>
<description xml:lang="ko">위젯 관리 모듈</description>
<description xml:lang="zh-CN">控件管理模块。</description>
<description xml:lang="ko">ウィジェット管理モジュール</description>
<description xml:lang="en">Module for managing widgets</description>
</author>
</module>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<actions>
<action name="dispWidgetInfo" type="view" standalone="true" />
<action name="dispWidgetGenerateCode" type="view" standalone="true" />
<action name="dispWidgetGenerateCodeInPage" type="view" standalone="true" />
<action name="dispWidgetAdminDownloadedList" type="view" standalone="true" admin_index="true" />
<action name="procWidgetGenerateCode" type="controller" standalone="true" />
<action name="procWidgetGetColorsetList" type="controller" standalone="true" />
</actions>
</module>

View file

@ -0,0 +1,43 @@
<?php
/**
* @file modules/widget/lang/en.lang.php
* @author zero <zero@nzeo.com>
* @brief widget module- basic language pack
**/
$lang->cmd_generate_code = 'Generate Code';
$lang->widget_name = 'Widget Name';
$lang->widget_maker = 'Widget Developer';
$lang->widget_history = 'Update History';
$lang->widget_info = 'Widget Info';
$lang->widget_code = 'Code';
$lang->widget_cache = 'Cache';
$lang->widget_fix_width = 'Fix Width';
$lang->widget_width = 'Width';
$lang->widget_position = 'Position';
$lang->widget_position_none = 'Next Line';
$lang->widget_position_left = 'Left';
$lang->widget_position_right = 'Right';
$lang->widget_margin = 'Margin';
$lang->widget_margin_top = 'Top Margin';
$lang->widget_margin_right = 'Right Margin';
$lang->widget_margin_bottom = 'Bottom Margin';
$lang->widget_margin_left= 'Left Margin';
$lang->about_widget_fix_width = 'Please check to fix the width.';
$lang->about_widget_width = 'Please set the width of widget.';
$lang->about_widget_position = 'Please select the position if you want to display many widgets in one line.';
$lang->about_widget_margin = "You may set the margin of widgets' top, bottom, right and left.";
$lang->about_widget_cache = 'Cached data can be used during the time you have set.';
$lang->generated_code = 'Generated Code';
$lang->msg_widget_is_not_exists = '%s widget does not exist.';
$lang->msg_widget_object_is_null = 'Object of %s widget cannot be created.';
$lang->msg_widget_proc_is_null = 'proc() of %s widget cannot be executed.';
$lang->about_widget_code = 'Please input required value first, and click [Generate Code] button to generate code to add to the template file.';
$lang->about_widget_code_in_page = 'After entering the required values, click the [Add] button to insert the widget code into the page.';
$lang->about_addon = "A widget is a small free-standing application used in a layout or page module.\n It can be linked with internal module or external open api. Through its configuration setting, wide application is possible. \n You can directly add a widget by using the [Generate Code] function without using the Zeroboard XE page module or layout module.";
?>

View file

@ -0,0 +1,43 @@
<?php
/**
* @file modules/widget/lang/ko.lang.php
* @author zero <zero@nzeo.com> 翻訳RisaPapa
* @brief ウィジェットwidgetモジュール基本言語パッケージ
**/
$lang->cmd_generate_code = 'コード生成';
$lang->widget_name = 'ウィジェット名';
$lang->widget_maker = 'ウィジェット作者';
$lang->widget_history = '変更内容';
$lang->widget_info = 'ウィジェット情報';
$lang->widget_code = 'コード';
$lang->widget_cache = 'キャッシュ';
$lang->widget_fix_width = '横幅固定';
$lang->widget_width = '縦幅サイズ';
$lang->widget_position = 'ポジッション';
$lang->widget_position_none = '改行';
$lang->widget_position_left = '左へ';
$lang->widget_position_right = '右へ';
$lang->widget_margin = '余白';
$lang->widget_margin_top = '上';
$lang->widget_margin_right = '右';
$lang->widget_margin_bottom = '下 ';
$lang->widget_margin_left= '左';
$lang->about_widget_fix_width = 'チェックすると横幅が固定されます。';
$lang->about_widget_width = '縦幅サイズを選択してください。';
$lang->about_widget_position = '一つのラインに多数のウィジェットを羅列したい場合は、ポジッションを選択してください。';
$lang->about_widget_margin = '一つのラインに多数のウィジェットを羅列したい場合は、ポジッションを選択してください。';
$lang->about_widget_cache = '指定された時間内にキャッシュされたデータが利用できます。';
$lang->generated_code = '生成コード';
$lang->msg_widget_is_not_exists = '%s ウィジェットが見つかりません。';
$lang->msg_widget_object_is_null = '%s ウィジェットのオブジェクトが生成できません。';
$lang->msg_widget_proc_is_null = '%s ウィセットの proc() が実行できません。';
$lang->about_widget_code = '選択されたウィゼットで求められる下の項目の値を入力し、「コード生成」ボタンをクリックすると、<br />一番下にテンプレートファイルに適用できるコードが出力されます。';
$lang->about_widget_code_in_page = '下に必要な値を入力した後、追加ボタンをクリックするとページ内にウィジェットが挿入されます。';
$lang->about_addon = "ウィジェットまたはページモジュールに用いられる小単位の構成要素です。内部モジュールまたは外部の OPEN API と連動でき、設定によって様々な応用が利きます。ゼロボードXEのページモジュールまたはレイアウトモジュールを使用しなくても、「コード生成」機能で直接ウィジェットも追加できます。";
?>

View file

@ -0,0 +1,43 @@
<?php
/**
* @file modules/widget/lang/ko.lang.php
* @author zero <zero@nzeo.com>
* @brief 위젯(widget) 모듈의 기본 언어팩
**/
$lang->cmd_generate_code = '코드생성';
$lang->widget_name = '위젯 이름';
$lang->widget_maker = '위젯 제작자';
$lang->widget_history = '변경사항';
$lang->widget_info = '위젯 정보';
$lang->widget_code = '코드';
$lang->widget_cache = '캐시';
$lang->widget_fix_width = '크기 고정';
$lang->widget_width = '가로크기';
$lang->widget_position = '위치';
$lang->widget_position_none = '줄바꿈';
$lang->widget_position_left = '왼쪽';
$lang->widget_position_right = '오른쪽';
$lang->widget_margin = '여백';
$lang->widget_margin_top = '위';
$lang->widget_margin_right = '오른쪽';
$lang->widget_margin_bottom = '아래 ';
$lang->widget_margin_left= '왼쪽';
$lang->about_widget_fix_width = '선택하시면 가로크기가 고정됩니다.';
$lang->about_widget_width = '가로 크기를 입력해주세요.';
$lang->about_widget_position = '한 줄에 여러개의 위젯을 나열하고 싶을때에는 위치를 선택해주세요.';
$lang->about_widget_margin = '지정된 위젯의 상하좌우 여백을 지정할 수 있습니다';
$lang->about_widget_cache = '지정된 시간동안 캐시된 데이터를 이용할 수 있습니다.';
$lang->generated_code = '생성된 코드';
$lang->msg_widget_is_not_exists = '%s 위젯을 찾을 수 없습니다';
$lang->msg_widget_object_is_null = '%s 위젯의 객체 생성을 할 수가 없습니다';
$lang->msg_widget_proc_is_null = '%s 위젯의 proc() 를 실행할 수가 없습니다';
$lang->about_widget_code = '선택하신 위젯에서 요구하는 아래 항목들의 값을 넣고 [코드생성]버튼을 누르시면 제일 아래 칸에 템플릿 파일에 적용할 수 있는 코드가 출력 됩니다';
$lang->about_widget_code_in_page = '아래 필요한 값들을 입력하신 후 추가 버튼을 누르시면 페이지 내에 위젯이 삽입이 됩니다';
$lang->about_addon = "위젯은 레이아웃이나 페이지 모듈에서 사용되는 작은 구성요소입니다.\n내부 모듈 또는 외부 open api와 연동될 수도 있고 설정을 통해서 다양한 응용이 가능합니다.\n제로보드XE의 페이지 모듈이나 레이아웃 모듈을 사용하지 않더라도 [코드생성] 기능을 통해 직접 위젯 추가도 할 수 있습니다";
?>

View file

@ -0,0 +1,43 @@
<?php
/**
* @file modules/widget/lang/zh-CN.lang.php
* @author zero <zero@nzeo.com>
* @brief 控件(widget) 模块语言包
**/
$lang->cmd_generate_code = '生成代码';
$lang->widget_name = '控件名称';
$lang->widget_maker = '控件作者';
$lang->widget_history = '更新事项';
$lang->widget_info = '控件信息';
$lang->widget_code = '代码';
$lang->widget_cache = '缓冲';
$lang->widget_fix_width = '固定大小';
$lang->widget_width = '宽度';
$lang->widget_position = '位置';
$lang->widget_position_none = '换行';
$lang->widget_position_left = '左对齐';
$lang->widget_position_right = '右对齐';
$lang->widget_margin = '边距';
$lang->widget_margin_top = '上';
$lang->widget_margin_right = '右';
$lang->widget_margin_bottom = '下';
$lang->widget_margin_left= '左';
$lang->about_widget_fix_width = '选择此项将固定控件显示宽度。';
$lang->about_widget_width = '请输入宽度大小。';
$lang->about_widget_position = '想要横向显示多个控件时,请选择位置。';
$lang->about_widget_margin = '想要横向显示多个控件时,请设置边距。';
$lang->about_widget_cache = '指定的时间内可以利用已缓冲的数据。';
$lang->generated_code = '已生成的代码';
$lang->msg_widget_is_not_exists = '找不到%s控件';
$lang->msg_widget_object_is_null = '无法生成%s控件对象';
$lang->msg_widget_proc_is_null = '不能执行%s控件的 proc()';
$lang->about_widget_code = '输入被选控件所需要的下列各项后,按『代码生成』按钮,即可在页面下方获得可以用在布局模版代码片断。';
$lang->about_widget_code_in_page = '输入下列各项必要值后,按“添加”按钮,即可把控件插入到页面当中。';
$lang->about_addon = "控件是在布局或页面模块中使用的一个小部件。\n不仅可以关联内部模块或外部open api而且通过设置可以用在多种用途。\n即使不使用Zeroboard XE的页面模块或布局模块也可以通过『代码生成』功能直接可以添加相应控件。";
?>

View file

@ -0,0 +1,8 @@
@charset "utf-8";
.widget_mid_list { margin-bottom:.3em; }
#colorset_area { margin-top:.5em; }
#colorset_area .header { float:left; margin-right:.5em; padding-top:.2em;}
#colorset_area .footer { float:left; }

View file

@ -0,0 +1,38 @@
<h3>{$lang->widget} <span class="gray">{$lang->cmd_management}</span></h3>
<!-- 설명 -->
<div class="infoText">{nl2br($lang->about_addon)}</div>
<!-- 위젯의 목록 -->
<table cellspacing="0" class="tableType3">
<thead>
<tr>
<th scope="col">{$lang->widget_name}</th>
<th scope="col">{$lang->version}</th>
<th scope="col">{$lang->author}</th>
<th scope="col">{$lang->date}</th>
<th scope="col">{$lang->path}</th>
<th scope="col">{$lang->cmd_generate_code}</th>
</tr>
</thead>
<tbody>
<!--@foreach($widget_list as $key => $val)-->
<tr>
<th scope="row" rowspan="2">
<a href="{getUrl('','module','widget','act','dispWidgetInfo','selected_widget',$val->widget)}" onclick="popopen(this.href,'widget_info');return false" class="blue">{$val->title}</a><br />
({$val->widget})
</th>
<td class="tahoma">{$val->version}</td>
<td class="blue"><a href="{$val->author->homepage}" onclick="window.open(this.href);return false;">{$val->author->name}</a></td>
<td class="tahoma">{$val->author->date}</td>
<td class="tahoma left">{$val->path}</td>
<td class="blue"><a href="{getUrl('','module','widget','act','dispWidgetGenerateCode','selected_widget',$val->widget)}" onclick="popopen(this.href,'widget_code_generate');return false">{$lang->cmd_generate_code}</a></td>
</tr>
<tr>
<td colspan="5" class="left">
{nl2br($val->author->description)}
</td>
</tr>
<!--@end-->
</tbody>
</table>

View file

@ -0,0 +1,7 @@
<filter name="generate_code" module="widget" act="procWidgetGenerateCode">
<response callback_func="completeGenerateCode">
<tag name="error" />
<tag name="message" />
<tag name="widget_code" />
</response>
</filter>

View file

@ -0,0 +1,7 @@
<filter name="generate_code_in_page" module="widget" act="procWidgetGenerateCode">
<response callback_func="completeGenerateCodeInPage">
<tag name="error" />
<tag name="message" />
<tag name="widget_code" />
</response>
</filter>

View file

@ -0,0 +1,165 @@
/**
* @file modules/widget/js/widget_admin.js
* @author zero (zero@nzeo.com)
* @brief widget 모듈의 관리자용 javascript
**/
/* 생성된 코드를 textarea에 출력 */
function completeGenerateCode(ret_obj) {
var widget_code = ret_obj["widget_code"];
var zone = xGetElementById("widget_code");
zone.value = widget_code;
}
/* 생성된 코드를 에디터에 출력 */
function completeGenerateCodeInPage(ret_obj,response_tags,params,fo_obj) {
var widget_code = ret_obj["widget_code"];
var module_srl = fo_obj.module_srl.value;
if(!opener || !widget_code || !module_srl) {
window.close();
return;
}
// 부모창에 에디터가 있으면 에디터에 추가
if(opener.editorGetIFrame) {
var iframe_obj = opener.editorGetIFrame(module_srl);
if(iframe_obj) {
opener.editorFocus(module_srl);
opener.editorReplaceHTML(iframe_obj, widget_code);
opener.editorFocus(module_srl);
}
}
window.close();
}
/* 위젯 코드 생성시 스킨을 고르면 컬러셋의 정보를 표시 */
function doDisplaySkinColorset(sel, colorset) {
var skin = sel.options[sel.selectedIndex].value;
if(!skin) {
xGetElementById("colorset_area").style.display = "none";
setFixedPopupSize();
return;
}
var params = new Array();
params["selected_widget"] = xGetElementById("fo_widget").selected_widget.value;
params["skin"] = skin;
params["colorset"] = colorset;
var response_tags = new Array("error","message","colorset_list");
exec_xml("widget", "procWidgetGetColorsetList", params, completeGetSkinColorset, response_tags, params);
}
/* 서버에서 받아온 컬러셋을 표시 */
function completeGetSkinColorset(ret_obj, response_tags, params, fo_obj) {
var sel = xGetElementById("fo_widget").widget_colorset;
var length = sel.options.length;
var selected_colorset = params["colorset"];
for(var i=0;i<length;i++) sel.remove(0);
var colorset_list = ret_obj["colorset_list"].split("\n");
var selected_index = 0;
for(var i=0;i<colorset_list.length;i++) {
var tmp = colorset_list[i].split("|@|");
if(selected_colorset && selected_colorset==tmp[0]) selected_index = i;
var opt = new Option(tmp[1], tmp[0], false, false);
sel.options.add(opt);
}
sel.selectedIndex = selected_index;
xGetElementById("colorset_area").style.display = "block";
setFixedPopupSize();
}
/* 페이지 모듈에서 내용의 위젯을 더블클릭하여 수정하려고 할 경우 */
var selected_node = null;
function doFillWidgetVars() {
if(!opener || !opener.editorPrevNode || !opener.editorPrevNode.getAttribute("widget")) return;
selected_node = opener.editorPrevNode;
// 스킨과 컬러셋은 기본
var skin = selected_node.getAttribute("skin");
var colorset = selected_node.getAttribute("colorset");
var widget_sequence = parseInt(selected_node.getAttribute("widget_sequence"),10);
var fo_obj = xGetElementById("fo_widget");
for(var name in fo_obj) {
var node = fo_obj[name];
if(!node || typeof(node)=="undefined") continue;
var length = node.length;
var type = node.type;
if((typeof(type)=='undefined'||!type) && typeof(length)!='undefined' && typeof(node[0])!='undefined' && length>0) type = node[0].type;
else length = 0;
switch(type) {
case "text" :
case "textarea" :
var val = selected_node.getAttribute(name);
node.value = val;
break;
case "checkbox" :
var val = selected_node.getAttribute(name).split(',');
if(fo_obj[name].length) {
for(var i=0;i<fo_obj[name].length;i++) {
var v = fo_obj[name][i].value;
for(var j=0;j<val.length;j++) {
if(v == val[j]) {
fo_obj[name][i].checked=true;
break;
}
}
}
} else {
if(fo_obj[name].value == val) fo_obj[name].checked =true;
}
break;
case "select" :
case "select-one" :
var val = selected_node.getAttribute(name);
var sel = fo_obj[name];
if(!val) break;
for(var i=0;i<sel.options.length;i++) {
if(sel.options[i].value == val) sel.options[i].selected = true;
else sel.options[i].selected = false;
}
break;
}
}
/*
var marginLeft = 0;
if(selected_node.style.marginLeft) marginLeft = parseInt(selected_node.style.marginLeft.replace(/px$/,''),10);
var marginRight = 0;
if(selected_node.style.marginRight) marginRight = parseInt(selected_node.style.marginRight.replace(/px$/,''),10);
var border = 0;
if(selected_node.style.border) border= parseInt(selected_node.style.boarder.replace(/px$/,''),10);
*/
var width_type = "px";
if(selected_node.getAttribute("widget_width_type")=="%") width_type = "%";
else fo_obj.widget_width.value = xWidth(selected_node);
// 컬러셋 설정
if(skin && xGetElementById("widget_colorset").options.length<1 && colorset) {
doDisplaySkinColorset(xGetElementById("widget_skin"), colorset);
}
// widget sequence 설정
fo_obj.widget_sequence.value = widget_sequence;
}
function checkFixType(obj) {
var val = obj.options[obj.selectedIndex].value;
if(val != "px") {
var fo_obj = xGetElementById("fo_widget");
var width = fo_obj.widget_width.value;
if(width>100) fo_obj.widget_width.value = 100;
}
}

View file

@ -0,0 +1,37 @@
<!--%import("css/widget.css")-->
<!--%import("../../admin/tpl/css/admin.css")-->
<div id="popHeadder">
<h1>{$lang->widget_maker}</h1>
</div>
<div id="popBody">
<table cellspacing="0" class="tableType5">
<col width="100" />
<col />
<tr>
<th scope="row">{$lang->title}</th>
<td>{$widget_info->title} ver {$widget_info->version}</td>
</tr>
<tr>
<th scope="row">{$lang->author}</th>
<td><a href="mailto:{$widget_info->author->email_address}">{$widget_info->author->name}</a></td>
</tr>
<tr>
<th scope="row">{$lang->homepage}</th>
<td><a href="{$widget_info->author->homepage}" onclick="window.open(this.href);return false;">{$widget_info->author->homepage}</a></td>
</tr>
<tr>
<th scope="row">{$lang->regdate}</th>
<td>{$widget_info->author->date}</td>
</tr>
<tr>
<th scope="row">{$lang->description}</th>
<td>{nl2br($widget_info->author->description)}</td>
</tr>
</table>
</div>
<div id="popFooter" class="tCenter gap1">
<a href="#" onclick="window.close(); return false;" class="button"><span>{$lang->cmd_close}</span></a>
</div>

View file

@ -0,0 +1,137 @@
<!--%import("filter/generate_code.xml")-->
<!--%import("js/widget_admin.js")-->
<!--%import("css/widget.css")-->
<!--%import("../../admin/tpl/css/admin.css")-->
<form action="./" method="get" onsubmit="return procFilter(this, generate_code);" id="fo_widget">
<input type="hidden" name="selected_widget" value="{$selected_widget}" />
<div id="popHeadder">
<h1>{$lang->cmd_generate_code}</h1>
</div>
<div id="popBody">
<div class="infoText">{nl2br($lang->about_widget_code)}</div>
<table cellspacing="0" class="tableType5">
<col width="100" />
<col />
<tr>
<th scope="row">{$lang->widget}</th>
<td>{$widget_info->title} ver {$widget_info->version}</td>
</tr>
<tr>
<th scope="row">{$lang->skin}</th>
<td>
<select name="skin" onchange="doDisplaySkinColorset(this);return false;">
<option value="">&nbsp;</option>
<!--@foreach($skin_list as $key => $val)-->
<option value="{$key}">{$val->title} ({$key})</option>
<!--@end-->
</select>
<div id="colorset_area" style="display:none">
<div class="header">{$lang->colorset}</div>
<div class="footer">
<select name="colorset" id="widget_colorset">
</select>
</div>
</div>
</td>
</tr>
<tr>
<th scope="row">{$lang->widget_cache}</th>
<td>
<input type="text" name="widget_cache" value="0" class="inputTypeText" size="2" />{$lang->unit_min}
<p>{$lang->about_widget_cache}</p>
</td>
</tr>
<!--@foreach($widget_info->extra_var as $id => $var)-->
<tr>
<th scope="row">{$var->name}</th>
<td>
<!--@if($var->type == "text")-->
<input type="text" name="{$id}" value="" class="inputTypeText" />
<!--@elseif($var->type == "textarea")-->
<textarea name="{$id}" class="inputTypeTextArea w100"></textarea>
<!--@elseif($var->type == "select")-->
<select name="{$id}">
<!--@foreach($var->options as $key => $val)-->
<option value="{$key}">{$val}</option>
<!--@end-->
</select>
<!--@elseif($var->type == "mid_list")-->
<!--@foreach($mid_list as $key => $val)-->
<div class="widget_mid_list">
<input type="checkbox" value="{$key}" name="{$id}" id="chk_mid_list_{$key}" />
<label for="chk_mid_list_{$key}">{$key} ({$val->browser_title})</label>
</div>
<!--@end-->
<!--@end-->
<p class="clear">{$var->description}</p>
</td>
</tr>
<!--@end-->
<tr>
<th scope="row">{$lang->widget_margin}</th>
<td>
<table border="0" cellspacing="1">
<tr>
<td colspan="2" align="center">{$lang->widget_margin_top} <input type="text" name="widget_margin_top" value="0" size="2" class="inputTypeText" />px</td>
</tr>
<tr>
<td>{$lang->widget_margin_left} <input type="text" name="widget_margin_left" value="0" size="2" class="inputTypeText"/>px</td>
<td align="right">{$lang->widget_margin_right} <input type="text" name="widget_margin_right" value="0" size="2" class="inputTypeText" />px</td>
</tr>
<tr>
<td colspan="2" align="center">{$lang->widget_margin_bottom} <input type="text" name="widget_margin_bottom" value="0" size="2" class="inputTypeText" />px</td>
</tr>
</table>
<p>{$lang->about_widget_margin}</p>
</td>
</tr>
<tr>
<th scope="row">{$lang->widget_fix_width}</th>
<td>
<input type="checkbox" value="Y" name="widget_fix_width" /> {$lang->about_widget_fix_width}
</td>
</tr>
<tr>
<th scope="row">{$lang->widget_width}</th>
<td>
<input type="text" value="50" name="widget_width" size="3" class="inputTypeText" />
<select name="widget_width_type" onchange="checkFixType(this)">
<option value="%">%</option>
<option value="px">px</option>
</select>
<p>{$lang->about_widget_width}</p>
</td>
</tr>
<tr>
<th scope="row">{$lang->widget_position}</th>
<td>
<select name="widget_position">
<option value="">{$lang->widget_position_none}</option>
<option value="left">{$lang->widget_position_left}</option>
<option value="right">{$lang->widget_position_right}</option>
</select>
<p>{$lang->about_widget_position}</p>
</td>
</tr>
<tr>
<th>{$lang->widget_code}</th>
<td><textarea readonly="true" id="widget_code" class="inputTypeTextArea w100"></textarea></td>
</tr>
</table>
</div>
<div id="popFooter" class="tCenter gap1">
<span class="button"><input type="submit" value="{$lang->cmd_generate_code}" /></span>
<a href="#" onclick="window.close(); return false;" class="button"><span>{$lang->cmd_close}</span></a>
</div>
</form>

View file

@ -0,0 +1,142 @@
<!--%import("filter/generate_code_in_page.xml")-->
<!--%import("js/widget_admin.js")-->
<!--%import("css/widget.css")-->
<!--%import("../../admin/tpl/css/admin.css")-->
<form action="./" method="get" onsubmit="return procFilter(this, generate_code_in_page);" id="fo_widget">
<input type="hidden" name="selected_widget" value="{$selected_widget}" />
<input type="hidden" name="module_srl" value="{$module_srl}" />
<input type="hidden" name="widget_sequence" value="" />
<div id="popHeadder">
<h1>{$lang->cmd_generate_code}</h1>
</div>
<div id="popBody">
<div class="infoText">{nl2br($lang->about_widget_code_in_page)}</div>
<table cellspacing="0" class="tableType5">
<col width="100" />
<col />
<tr>
<th scope="row">{$lang->widget}</th>
<td>{$widget_info->title} ver {$widget_info->version}</td>
</tr>
<tr>
<th scope="row">{$lang->skin}</th>
<td>
<select name="skin" onchange="doDisplaySkinColorset(this);return false;" id="widget_skin">
<option value="">&nbsp;</option>
<!--@foreach($skin_list as $key => $val)-->
<option value="{$key}">{$val->title} ({$key})</option>
<!--@end-->
</select>
<div id="colorset_area" style="display:none">
<div class="header">{$lang->colorset}</div>
<div class="footer">
<select name="colorset" id="widget_colorset">
</select>
</div>
</div>
</td>
</tr>
<tr>
<th scope="row">{$lang->widget_cache}</th>
<td>
<input type="text" name="widget_cache" value="0" class="inputTypeText" size="2" />{$lang->unit_min}
<p>{$lang->about_widget_cache}</p>
</td>
</tr>
<!--@foreach($widget_info->extra_var as $id => $var)-->
<tr>
<th scope="row">{$var->name}</th>
<td>
<!--@if($var->type == "text")-->
<input type="text" name="{$id}" value="" class="inputTypeText" />
<!--@elseif($var->type == "textarea")-->
<textarea name="{$id}" class="inputTypeTextArea w100"></textarea>
<!--@elseif($var->type == "select")-->
<select name="{$id}">
<!--@foreach($var->options as $key => $val)-->
<option value="{$key}">{$val}</option>
<!--@end-->
</select>
<!--@elseif($var->type == "mid_list")-->
<!--@foreach($mid_list as $key => $val)-->
<div class="widget_mid_list">
<input type="checkbox" value="{$key}" name="{$id}" id="chk_mid_list_{$key}" />
<label for="chk_mid_list_{$key}">{$key} ({$val->browser_title})</label>
</div>
<!--@end-->
<!--@end-->
<p class="clear">{$var->description}</p>
</td>
</tr>
<!--@end-->
<tr>
<th scope="row">{$lang->widget_margin}</th>
<td>
<table border="0" cellspacing="1">
<tr>
<td colspan="2" align="center">{$lang->widget_margin_top} <input type="text" name="widget_margin_top" value="0" size="2" class="inputTypeText" />px</td>
</tr>
<tr>
<td>{$lang->widget_margin_left} <input type="text" name="widget_margin_left" value="0" size="2" class="inputTypeText"/>px</td>
<td align="right">{$lang->widget_margin_right} <input type="text" name="widget_margin_right" value="0" size="2" class="inputTypeText" />px</td>
</tr>
<tr>
<td colspan="2" align="center">{$lang->widget_margin_bottom} <input type="text" name="widget_margin_bottom" value="0" size="2" class="inputTypeText" />px</td>
</tr>
</table>
<p>{$lang->about_widget_margin}</p>
</td>
</tr>
</table>
<table cellspacing="0" class="tableType5 gap1">
<col width="100" />
<col />
<tr>
<th scope="row">{$lang->widget_fix_width}</th>
<td>
<input type="checkbox" value="Y" name="widget_fix_width" /> {$lang->about_widget_fix_width}
</td>
</tr>
<tr>
<th scope="row">{$lang->widget_width}</th>
<td>
<input type="text" value="50" name="widget_width" size="3" class="inputTypeText" />
<select name="widget_width_type" onchange="checkFixType(this)">
<option value="%">%</option>
<option value="px">px</option>
</select>
<p>{$lang->about_widget_width}</p>
</td>
</tr>
<tr>
<th scope="row">{$lang->widget_position}</th>
<td>
<select name="widget_position">
<option value="">{$lang->widget_position_none}</option>
<option value="left">{$lang->widget_position_left}</option>
<option value="right">{$lang->widget_position_right}</option>
</select>
<p>{$lang->about_widget_position}</p>
</td>
</tr>
</table>
</div>
<div id="popFooter" class="tCenter gap1">
<span class="button"><input type="submit" value="{$lang->cmd_generate_code}" /></span>
<a href="#" onclick="window.close(); return false;" class="button"><span>{$lang->cmd_close}</span></a>
</div>
</form>
<script type="text/javascript">
xAddEventListener(window, "load", doFillWidgetVars);
</script>

View file

@ -0,0 +1,29 @@
<?php
/**
* @class widgetAdminView
* @author zero (zero@nzeo.com)
* @brief widget 모듈의 admin view class
**/
class widgetAdminView extends widget {
/**
* @brief 초기화
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 위젯 목록을 보여줌
**/
function dispWidgetAdminDownloadedList() {
// 위젯 목록을 세팅
$oWidgetModel = &getModel('widget');
$widget_list = $oWidgetModel->getDownloadedWidgetList();
Context::set('widget_list', $widget_list);
$this->setTemplateFile('downloaded_widget_list');
}
}
?>

View file

@ -0,0 +1,41 @@
<?php
/**
* @class widget
* @author zero (zero@nzeo.com)
* @brief widget 모듈의 high class
**/
class widget extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
$oModuleController = &getController('module');
$oModuleController->insertActionForward('widget', 'view', 'dispWidgetInfo');
$oModuleController->insertActionForward('widget', 'view', 'dispWidgetGenerateCode');
$oModuleController->insertActionForward('widget', 'view', 'dispWidgetGenerateCodePage');
$oModuleController->insertActionForward('widget', 'view', 'dispWidgetAdminDownloadedList');
// widget 에서 사용할 cache디렉토리 생성
FileHandler::makeDir('./files/cache/widget');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
**/
function moduleUpdate() {
return new Object();
}
}
?>

View file

@ -0,0 +1,90 @@
<?php
/**
* @class widgetController
* @author zero (zero@nzeo.com)
* @brief widget 모듈의 Controller class
**/
class widgetController extends widget {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 위젯의 생성된 코드를 return
**/
function procWidgetGenerateCode() {
// 변수 정리
$vars = Context::getRequestVars();
$widget = $vars->selected_widget;
$blank_img_path = Context::getRequestUri()."common/tpl/images/widget_bg.jpg";
unset($vars->module);
unset($vars->act);
unset($vars->selected_widget);
if($vars->widget_sequence) {
$cache_path = './files/cache/widget_cache/';
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $vars->widget_sequence, Context::getLangType());
@unlink($cache_file);
}
$vars->widget_sequence = getNextSequence();
if(!$vars->widget_cache) $vars->widget_cache = 0;
$attribute = array();
if($vars) {
foreach($vars as $key => $val) {
if(strpos($val,'|@|')>0) $val = str_replace('|@|',',',$val);
$attribute[] = sprintf('%s="%s"', $key, str_replace('"','\"',$val));
}
}
if($vars->widget_fix_width == 'Y') {
$widget_width_type = strtolower($vars->widget_width_type);
if(!$widget_width_type||!in_array($widget_width_type,array("px","%"))) $widget_width_type = "px";
$style .= sprintf("%s:%s%s;", "width", trim($vars->widget_width), $widget_width_type);
if($vars->widget_position) $style .= sprintf("%s:%s;", "float", trim($vars->widget_position));
else $style .= "float:left;";
$widget_code = sprintf('<img src="%s" height="100" class="zbxe_widget_output" widget="%s" %s style="%s" />', $blank_img_path, $widget, implode(' ',$attribute), $style);
} else {
$style = "clear:both;";
$widget_code = sprintf('<img width="%s" height="100" src="%s" class="zbxe_widget_output" style="%s" widget="%s" %s />', "100%", $blank_img_path, $style, $widget, implode(' ',$attribute));
}
$cache_path = './files/cache/widget_cache/';
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $vars->widget_sequence, Context::getLangType());
@unlink($cache_file);
// 코드 출력
$this->add('widget_code', $widget_code);
}
/**
* @brief 선택된 위젯 - 스킨의 컬러셋을 return
**/
function procWidgetGetColorsetList() {
$widget = Context::get('selected_widget');
$skin = Context::get('skin');
$path = sprintf('./widgets/%s/', $widget);
$oModuleModel = &getModel('module');
$skin_info = $oModuleModel->loadSkinInfo($path, $skin);
for($i=0;$i<count($skin_info->colorset);$i++) {
$colorset = sprintf('%s|@|%s', $skin_info->colorset[$i]->name, $skin_info->colorset[$i]->title);
$colorset_list[] = $colorset;
}
if(count($colorset_list)) $colorsets = implode("\n", $colorset_list);
$this->add('colorset_list', $colorsets);
}
}
?>

View file

@ -0,0 +1,131 @@
<?php
/**
* @class widgetModel
* @author zero (zero@nzeo.com)
* @version 0.1
* @brief widget 모듈의 Model class
**/
class widgetModel extends widget {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief 위젯의 경로를 구함
**/
function getWidgetPath($widget_name) {
$path = sprintf('./widgets/%s/', $widget_name);
if(is_dir($path)) return $path;
return "";
}
/**
* @brief 위젯의 종류와 정보를 구함
* 다운로드되어 있는 위젯의 종류 (생성과 다른 의미)
**/
function getDownloadedWidgetList() {
// 다운받은 위젯과 설치된 위젯의 목록을 구함
$searched_list = FileHandler::readDir('./widgets');
$searched_count = count($searched_list);
if(!$searched_count) return;
// 찾아진 위젯 목록을 loop돌면서 필요한 정보를 간추려 return
for($i=0;$i<$searched_count;$i++) {
// 위젯의 이름
$widget = $searched_list[$i];
// 해당 위젯의 정보를 구함
$widget_info = $this->getWidgetInfo($widget);
$list[] = $widget_info;
}
return $list;
}
/**
* @brief 모듈의 conf/info.xml 읽어서 정보를 구함
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
**/
function getWidgetInfo($widget) {
// 요청된 모듈의 경로를 구한다. 없으면 return
$widget_path = $this->getWidgetPath($widget);
if(!$widget_path) return;
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
$xml_file = sprintf("%sconf/info.xml", $widget_path);
if(!file_exists($xml_file)) return;
// cache 파일을 비교하여 문제 없으면 include하고 $widget_info 변수를 return
$cache_file = sprintf('./files/cache/widget/%s.%s.cache.php', $widget, Context::getLangType());
if(file_exists($cache_file)&&filectime($cache_file)>filectime($xml_file)) {
@include($cache_file);
return $widget_info;
}
// cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
$xml_obj = $tmp_xml_obj->widget;
if(!$xml_obj) return;
$buff = '';
// 위젯의 제목, 버전
$buff .= sprintf('$widget_info->widget = "%s";', $widget);
$buff .= sprintf('$widget_info->path = "%s";', $widget_path);
$buff .= sprintf('$widget_info->title = "%s";', $xml_obj->title->body);
$buff .= sprintf('$widget_info->version = "%s";', $xml_obj->attrs->version);
$buff .= sprintf('$widget_info->widget_srl = $widget_srl;');
$buff .= sprintf('$widget_info->widget_title = $widget_title;');
// 작성자 정보
$buff .= sprintf('$widget_info->author->name = "%s";', $xml_obj->author->name->body);
$buff .= sprintf('$widget_info->author->email_address = "%s";', $xml_obj->author->attrs->email_address);
$buff .= sprintf('$widget_info->author->homepage = "%s";', $xml_obj->author->attrs->link);
$buff .= sprintf('$widget_info->author->date = "%s";', $xml_obj->author->attrs->date);
$buff .= sprintf('$widget_info->author->description = "%s";', $xml_obj->author->description->body);
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
if(!is_array($xml_obj->extra_vars->var)) $extra_vars[] = $xml_obj->extra_vars->var;
else $extra_vars = $xml_obj->extra_vars->var;
if($extra_vars[0]->attrs->id) {
$extra_var_count = count($extra_vars);
$buff .= sprintf('$widget_info->extra_var_count = "%s";', $extra_var_count);
for($i=0;$i<$extra_var_count;$i++) {
unset($var);
unset($options);
$var = $extra_vars[$i];
$buff .= sprintf('$widget_info->extra_var->%s->name = "%s";', $var->attrs->id, $var->name->body);
$buff .= sprintf('$widget_info->extra_var->%s->type = "%s";', $var->attrs->id, $var->type->body);
$buff .= sprintf('$widget_info->extra_var->%s->value = $vars->%s;', $var->attrs->id, $var->attrs->id);
$buff .= sprintf('$widget_info->extra_var->%s->description = "%s";', $var->attrs->id, str_replace('"','\"',$var->description->body));
$options = $var->options;
if(!$options) continue;
if(!is_array($options)) $options = array($options);
$options_count = count($options);
for($j=0;$j<$options_count;$j++) {
$buff .= sprintf('$widget_info->extra_var->%s->options["%s"] = "%s";', $var->attrs->id, $options[$j]->value->body, $options[$j]->name->body);
}
}
}
$buff = '<?php if(!defined("__ZBXE__")) exit(); '.$buff.' ?>';
FileHandler::writeFile($cache_file, $buff);
if(file_exists($cache_file)) @include($cache_file);
return $widget_info;
}
}
?>

View file

@ -0,0 +1,67 @@
<?php
/**
* @class widgetView
* @author zero (zero@nzeo.com)
* @brief widget 모듈의 View class
**/
class widgetView extends widget {
/**
* @brief 초기화
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 위젯의 상세 정보(conf/info.xml) 팝업 출력
**/
function dispWidgetInfo() {
// 선택된 위젯 정보를 구함
$oWidgetModel = &getModel('widget');
$widget_info = $oWidgetModel->getWidgetInfo(Context::get('selected_widget'));
Context::set('widget_info', $widget_info);
// 위젯을 팝업으로 지정
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
$this->setTemplateFile('widget_detail_info');
}
/**
* @brief 위젯의 코드 생성기
**/
function dispWidgetGenerateCode() {
// 선택된 위젯 정보를 구함
$oWidgetModel = &getModel('widget');
$widget_info = $oWidgetModel->getWidgetInfo(Context::get('selected_widget'));
Context::set('widget_info', $widget_info);
// mid 목록을 가져옴
$oModuleModel = &getModel('module');
$mid_list = $oModuleModel->getMidList();
Context::set('mid_list', $mid_list);
// 스킨의 정보를 구함
$skin_list = $oModuleModel->getSkins($widget_info->path);
Context::set('skin_list', $skin_list);
// 위젯을 팝업으로 지정
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
$this->setTemplateFile('widget_generate_code');
}
/**
* @brief 페이지 관리에서 사용될 코드 생성 팝업
**/
function dispWidgetGenerateCodeInPage() {
$this->dispWidgetGenerateCode();
$this->setTemplateFile('widget_generate_code_in_page');
}
}
?>