mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-18 18:59:56 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@1664 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
c814771f0f
commit
00c9be280d
18 changed files with 0 additions and 0 deletions
8
modules/widget/conf/info.xml
Normal file
8
modules/widget/conf/info.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module 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>
|
||||
</module>
|
||||
13
modules/widget/conf/module.xml
Normal file
13
modules/widget/conf/module.xml
Normal 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>
|
||||
23
modules/widget/lang/ko.lang.php
Normal file
23
modules/widget/lang/ko.lang.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?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->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의 페이지 모듈이나 레이아웃 모듈을 사용하지 않더라도 [코드생성] 기능을 통해 직접 위젯 추가도 할 수 있습니다";
|
||||
?>
|
||||
29
modules/widget/plugin.admin.view.php
Normal file
29
modules/widget/plugin.admin.view.php
Normal 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');
|
||||
}
|
||||
}
|
||||
?>
|
||||
41
modules/widget/plugin.class.php
Normal file
41
modules/widget/plugin.class.php
Normal 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 moduleIsInstalled() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 업데이트 실행
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
return new Object();
|
||||
}
|
||||
}
|
||||
?>
|
||||
64
modules/widget/plugin.controller.php
Normal file
64
modules/widget/plugin.controller.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?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;
|
||||
|
||||
unset($vars->module);
|
||||
unset($vars->act);
|
||||
unset($vars->selected_widget);
|
||||
|
||||
$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));
|
||||
}
|
||||
}
|
||||
|
||||
$blank_img_path = "./common/tpl/images/blank.gif";
|
||||
$widget_code = sprintf('<img src="%s" class="zbxe_widget_output" widget="%s" %s style="width:100px;height:100px;"/>', $blank_img_path, $widget, implode(' ',$attribute));
|
||||
|
||||
// 코드 출력
|
||||
$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);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
131
modules/widget/plugin.model.php
Normal file
131
modules/widget/plugin.model.php
Normal 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;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
67
modules/widget/plugin.view.php
Normal file
67
modules/widget/plugin.view.php
Normal 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');
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
81
modules/widget/tpl/css/plugin.css
Normal file
81
modules/widget/tpl/css/plugin.css
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
@charset "utf-8";
|
||||
|
||||
.widget_detail_info_window {
|
||||
width:600px;
|
||||
clear:both;
|
||||
}
|
||||
|
||||
.widget_title {
|
||||
font-weight:bold;
|
||||
font-size:10pt;
|
||||
text-align:center;
|
||||
padding:10px 0px 10px 0px;
|
||||
color:#EEEEEE;
|
||||
background-color:#444444;
|
||||
}
|
||||
|
||||
.widget_description {
|
||||
margin:5px 2px 10px 2px;
|
||||
border:1px solid #EEEEEE;
|
||||
color:#444444;
|
||||
clear:both;
|
||||
padding:5px;
|
||||
}
|
||||
|
||||
.widget_header {
|
||||
clear:left;
|
||||
font-weight:bold;
|
||||
float:left;
|
||||
width:90px;
|
||||
margin-left:10px;
|
||||
padding:5px 0px 5px 0px;
|
||||
}
|
||||
|
||||
.widget_body {
|
||||
float:left;
|
||||
width:490px;
|
||||
padding:5px 0px 5px 0px;
|
||||
}
|
||||
|
||||
.widget_var_description {
|
||||
clear:both;
|
||||
padding:5px 0px 5px 0px;
|
||||
margin-left:100px;
|
||||
color:#AAAAAA;
|
||||
}
|
||||
|
||||
.widget_button_area {
|
||||
clear:both;
|
||||
text-align:center;
|
||||
padding:5px 0px 5px 0px;
|
||||
background-color:#EFEFEF;
|
||||
border-top:1px solid #AAAAAA;
|
||||
}
|
||||
|
||||
.widget_button {
|
||||
border:1px solid #AAAAAA;
|
||||
background-color:#FFFFFF;
|
||||
font-weight:bold;
|
||||
height:16px;
|
||||
}
|
||||
|
||||
.widget_code_area {
|
||||
clear:both;
|
||||
padding:4px;
|
||||
border:1px solid #AAAAAA;
|
||||
margin:5px;
|
||||
height:100px;
|
||||
}
|
||||
|
||||
.widget_code_area textarea {
|
||||
border:0px;
|
||||
height:100px;
|
||||
width:570px;
|
||||
font-family:tahoma;
|
||||
font-size:8pt;
|
||||
}
|
||||
|
||||
.widget_mid_list {
|
||||
float:left;
|
||||
margin-right:10px;
|
||||
}
|
||||
38
modules/widget/tpl/downloaded_plugin_list.html
Normal file
38
modules/widget/tpl/downloaded_plugin_list.html
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<!-- 설명 -->
|
||||
<div style="border:1px solid #CCCCCC;margin-bottom:10px;padding:10px;">
|
||||
{nl2br($lang->about_addon)}
|
||||
</div>
|
||||
|
||||
<!-- 위젯의 목록 -->
|
||||
<div>
|
||||
<table border="1" width="100%">
|
||||
<tr>
|
||||
<td>{$lang->widget_name}</td>
|
||||
<td>{$lang->version}</td>
|
||||
<td>{$lang->author}</td>
|
||||
<td>{$lang->date}</td>
|
||||
<td>{$lang->path}</td>
|
||||
<td>{$lang->cmd_generate_code}</td>
|
||||
<td>{$lang->widget_info}</td>
|
||||
</tr>
|
||||
<!--@foreach($widget_list as $key => $val)-->
|
||||
<tr>
|
||||
<td rowspan="2">
|
||||
{$val->title} <br />
|
||||
({$val->widget})
|
||||
</td>
|
||||
<td>{$val->version}</td>
|
||||
<td><a href="#" onclick="window.open('{$val->author->homepage}')">{$val->author->name}</a></td>
|
||||
<td>{$val->author->date}</td>
|
||||
<td>{$val->path}</td>
|
||||
<td><a href="#" onclick="popopen('{getUrl('','module','widget','act','dispWidgetGenerateCode','selected_widget',$val->widget)}','widget_code_generate');return false">{$lang->cmd_generate_code}</a></td>
|
||||
<td><a href="#" onclick="popopen('{getUrl('','module','widget','act','dispWidgetInfo','selected_widget',$val->widget)}','widget_info');return false">{$lang->cmd_view}</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
{nl2br($val->author->description)}
|
||||
</td>
|
||||
</tr>
|
||||
<!--@end-->
|
||||
</table>
|
||||
</div>
|
||||
7
modules/widget/tpl/filter/generate_code.xml
Normal file
7
modules/widget/tpl/filter/generate_code.xml
Normal 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>
|
||||
7
modules/widget/tpl/filter/generate_code_in_page.xml
Normal file
7
modules/widget/tpl/filter/generate_code_in_page.xml
Normal 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>
|
||||
143
modules/widget/tpl/js/plugin_admin.js
Normal file
143
modules/widget/tpl/js/plugin_admin.js
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
var orig_width = 0;
|
||||
var orig_height = 0;
|
||||
var node = opener.editorPrevNode;
|
||||
if(node) {
|
||||
orig_width = parseInt(xWidth(node),10)-6;
|
||||
orig_height = parseInt(xHeight(node),10)-6;
|
||||
|
||||
widget_code = widget_code.replace(/width([^p]+)px/ig,'width:'+orig_width+'px');
|
||||
widget_code = widget_code.replace(/height([^p]+)px/ig,'height:'+orig_height+'px');
|
||||
}
|
||||
|
||||
// 부모창에 에디터가 있으면 에디터에 추가
|
||||
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 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);
|
||||
for(var i=0;i<fo_obj[name].length;i++) {
|
||||
var v = fo_obj[name][i].value;
|
||||
if(val.indexOf(v)!=-1) fo_obj[name][i].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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 컬러셋 설정
|
||||
if(skin && xGetElementById("widget_colorset").options.length<1 && colorset) {
|
||||
doDisplaySkinColorset(xGetElementById("widget_skin"), colorset);
|
||||
}
|
||||
|
||||
}
|
||||
26
modules/widget/tpl/plugin_detail_info.html
Normal file
26
modules/widget/tpl/plugin_detail_info.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<!--%import("css/widget.css")-->
|
||||
|
||||
<div class="widget_detail_info_window">
|
||||
|
||||
<div class="widget_title">{$lang->widget_maker}</div>
|
||||
|
||||
<div class="widget_header">{$lang->title}</div>
|
||||
<div class="widget_body">{$widget_info->title} ver {$widget_info->version}</div>
|
||||
|
||||
<div class="widget_header">{$lang->author}</div>
|
||||
<div class="widget_body"><a href="mailto:{$widget_info->author->email_address}">{$widget_info->author->name}</a></div>
|
||||
|
||||
<div class="widget_header">{$lang->homepage}</div>
|
||||
<div class="widget_body"><a href="#" onclick="window.open('{$widget_info->author->homepage}');return false;">{$widget_info->author->homepage}</a></div>
|
||||
|
||||
<div class="widget_header">{$lang->regdate}</div>
|
||||
<div class="widget_body">{$widget_info->author->date}</div>
|
||||
|
||||
<div class="widget_header">{$lang->description}</div>
|
||||
<div class="widget_body">{nl2br($widget_info->author->description)}</div>
|
||||
|
||||
<div class="widget_button_area">
|
||||
<a href="#" onclick="window.close();">{$lang->cmd_close}</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
73
modules/widget/tpl/plugin_generate_code.html
Normal file
73
modules/widget/tpl/plugin_generate_code.html
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<!--%import("filter/generate_code.xml")-->
|
||||
<!--%import("js/widget_admin.js")-->
|
||||
<!--%import("css/widget.css")-->
|
||||
|
||||
<form action="./" method="get" onsubmit="return procFilter(this, generate_code);" id="fo_widget">
|
||||
<input type="hidden" name="selected_widget" value="{$selected_widget}" />
|
||||
|
||||
<div class="widget_detail_info_window">
|
||||
|
||||
<div class="widget_title">{$lang->cmd_generate_code}</div>
|
||||
|
||||
<div class="widget_description">{$lang->about_widget_code}</div>
|
||||
|
||||
<div class="widget_header">{$lang->widget}</div>
|
||||
<div class="widget_body">{$widget_info->title} ver {$widget_info->version}</div>
|
||||
|
||||
<div class="widget_header">{$lang->skin}</div>
|
||||
<div class="widget_body">
|
||||
<select name="skin" onchange="doDisplaySkinColorset(this);return false;">
|
||||
<option value=""> </option>
|
||||
<!--@foreach($skin_list as $key => $val)-->
|
||||
<option value="{$key}">{$val->title} ({$key})</option>
|
||||
<!--@end-->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="colorset_area" style="display:none">
|
||||
<div class="widget_header">{$lang->colorset}</div>
|
||||
<div class="widget_body">
|
||||
<select name="colorset" id="widget_colorset">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--@foreach($widget_info->extra_var as $id => $var)-->
|
||||
<div class="widget_header">{$var->name}</div>
|
||||
|
||||
<div class="widget_body">
|
||||
<!--@if($var->type == "text")-->
|
||||
<input type="text" name="{$id}" value="" />
|
||||
|
||||
<!--@elseif($var->type == "textarea")-->
|
||||
<textarea name="{$id}"></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-->
|
||||
</div>
|
||||
<div class="widget_var_description">{$var->description}</div>
|
||||
<!--@end-->
|
||||
|
||||
<div class="widget_button_area">
|
||||
<input type="submit" value="{$lang->cmd_generate_code}" class="widget_button" />
|
||||
<input type="button" onclick="self.close()" value="{$lang->cmd_close}" class="widget_button" />
|
||||
</div>
|
||||
|
||||
<div class="widget_code_area"><textarea readonly="true" id="widget_code"></textarea></div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
76
modules/widget/tpl/plugin_generate_code_in_page.html
Normal file
76
modules/widget/tpl/plugin_generate_code_in_page.html
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<!--%import("filter/generate_code_in_page.xml")-->
|
||||
<!--%import("js/widget_admin.js")-->
|
||||
<!--%import("css/widget.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}" />
|
||||
|
||||
<div class="widget_detail_info_window">
|
||||
|
||||
<div class="widget_title">{$widget_info->title} ver {$widget_info->version}</div>
|
||||
|
||||
<div class="widget_description">{$lang->about_widget_code_in_page}</div>
|
||||
|
||||
<div class="widget_header">{$lang->description}</div>
|
||||
<div class="widget_body">{nl2br($widget_info->author->description)}</div>
|
||||
|
||||
<div class="widget_header">{$lang->skin}</div>
|
||||
<div class="widget_body">
|
||||
<select name="skin" onchange="doDisplaySkinColorset(this,'');return false;" id="widget_skin">
|
||||
<option value=""> </option>
|
||||
<!--@foreach($skin_list as $key => $val)-->
|
||||
<option value="{$key}">{$val->title} ({$key})</option>
|
||||
<!--@end-->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="colorset_area" style="display:none">
|
||||
<div class="widget_header">{$lang->colorset}</div>
|
||||
<div class="widget_body">
|
||||
<select name="colorset" id="widget_colorset">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--@foreach($widget_info->extra_var as $id => $var)-->
|
||||
<div class="widget_header">{$var->name}</div>
|
||||
|
||||
<div class="widget_body">
|
||||
<!--@if($var->type == "text")-->
|
||||
<input type="text" name="{$id}" value="" />
|
||||
|
||||
<!--@elseif($var->type == "textarea")-->
|
||||
<textarea name="{$id}"></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-->
|
||||
</div>
|
||||
<div class="widget_var_description">{$var->description}</div>
|
||||
<!--@end-->
|
||||
|
||||
<div class="widget_button_area">
|
||||
<input type="submit" value="{$lang->cmd_insert}" class="widget_button" />
|
||||
<input type="button" onclick="self.close()" value="{$lang->cmd_close}" class="widget_button" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
xAddEventListener(window, "load", doFillWidgetVars);
|
||||
</script>
|
||||
Loading…
Add table
Add a link
Reference in a new issue