git-svn-id: http://xe-core.googlecode.com/svn/trunk@662 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-03-26 09:32:45 +00:00
parent 062bca7301
commit d45cbb04a7
9 changed files with 93 additions and 39 deletions

View file

@ -7,6 +7,23 @@
class EditorHandler extends Object {
/**
* @brief 컴포넌트의 xml및 관련 정보들을 설정
**/
function setInfo($info) {
$this->component_name = $info->component_name;
$this->version = $info->version;
$this->title = $info->title;
$this->author = $info->author;
$this->description = $info->description;
if($info->extra_vars) {
foreach($info->extra_vars as $key => $val) {
$this->{$key} = trim($val->value);
}
}
}
}
?>

View file

@ -18,5 +18,5 @@
$lang->msg_fail_to_socket_open = "우편번호 검색 대상 서버 접속이 실패하였습니다";
$lang->msg_no_result = "검색 결과가 없습니다";
$lang->msg_no_apikey = "네이버맵 사용을 위해서는 네이버맵 open api key가 있어야 합니다.\nopen api key를 관리자 > 위지윅에디터 > 네이버 지도 연동 컴포넌트 설정을 선택한 후 입력하여 주세요";
$lang->msg_no_apikey = "네이버맵 사용을 위해서는 네이버맵 open api key가 있어야 합니다.\nopen api key를 관리자 > 위지윅에디터 > <a href=\"#\" onclick=\"winopen('./?module=editor&amp;act=setupComponent&amp;component_name=naver_map','SetupComponent','width=10,height=10,scrollbars=no,resizable=no,toolbars=no');return false;\">네이버 지도 연동 컴포넌트 설정</a>을 선택한 후 입력하여 주세요";
?>

View file

@ -12,8 +12,8 @@
var $component_path = '';
// 네이버맵 openapi 키 값
//var $open_api_key = '22b1f5391a6970e03935444897334066';
var $open_api_key = '';
//var $api_key = '22b1f5391a6970e03935444897334066';
var $api_key = '';
/**
* @brief upload_target_srl과 컴포넌트의 경로를 받음
@ -30,7 +30,7 @@
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
$tpl_path = $this->component_path.'tpl';
if(!$this->open_api_key) $tpl_file = 'error.html';
if(!$this->api_key) $tpl_file = 'error.html';
else $tpl_file = 'popup.html';
Context::set("tpl_path", $tpl_path);
@ -50,7 +50,7 @@
Context::loadLang($this->component_path."lang");
// 지정된 서버에 요청을 시도한다
$query_string = iconv("UTF-8","EUC-KR",sprintf('/api/geocode.php?key=%s&query=%s', $this->open_api_key, $address));
$query_string = iconv("UTF-8","EUC-KR",sprintf('/api/geocode.php?key=%s&query=%s', $this->api_key, $address));
$fp = fsockopen('maps.naver.com', 80, $errno, $errstr);
if(!$fp) return new Object(-1, 'msg_fail_to_socket_open');
@ -129,7 +129,7 @@
'<title></title>'.
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'.
'<script type="text/javascript" src="./common/js/x.js"></script>'.
'<script type="text/javascript" src="http://maps.naver.com/js/naverMap.naver?key='.$this->open_api_key.'"></script>'.
'<script type="text/javascript" src="http://maps.naver.com/js/naverMap.naver?key='.$this->api_key.'"></script>'.
'<script type="text/javascript">'.
'function moveMap(x,y,scale) {mapObj.setCenterAndZoom(new NPoint(x,y),scale);}'.
'</script>'.

View file

@ -10,5 +10,6 @@
<action name="procEnableComponent" type="controller" standalone="true" />
<action name="procDisableComponent" type="controller" standalone="true" />
<action name="procMoveListOrder" type="controller" standalone="true" />
<action name="procSetupComponent" type="controller" standalone="true" />
</actions>
</module>

View file

@ -103,6 +103,26 @@
$this->setMessage('success_updated');
}
/**
* @brief 컴포넌트 설정
**/
function procSetupComponent() {
$component_name = Context::get('component_name');
$extra_vars = Context::getRequestVars();
unset($extra_vars->component_name);
unset($extra_vars->module);
unset($extra_vars->act);
$args->component_name = $component_name;
$args->extra_vars = serialize($extra_vars);
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('editor.updateComponent', $args);
if(!$output->toBool()) return $output;
$this->setMessage('success_updated');
}
/**
* @brief 컴포넌트에서 ajax요청시 해당 컴포넌트의 method를 실행
**/

View file

@ -16,11 +16,16 @@
$class_file = sprintf('%s%s.class.php', $class_path, $component);
if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
// 클래스 파일을 읽은 후 객체 생성
require_once($class_file);
$eval_str = sprintf('$oComponent = new %s("%s","%s");', $component, $upload_target_srl, $class_path);
@eval($eval_str);
if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
// 설정 정보를 추가
$component_info = $this->getComponent($component);
$oComponent->setInfo($component_info);
return $oComponent;
}

View file

@ -36,7 +36,6 @@
$oEditorModel = &getModel('editor');
$component = $oEditorModel->getComponent($component_name);
debugPrint($component);
Context::set('component', $component);
$this->setTemplatePath($this->module_path.'tpl');

View file

@ -0,0 +1,8 @@
<filter name="setup_component" module="editor" act="procSetupComponent" confirm_msg_code="confirm_submit">
<form />
<parameter />
<response>
<tag name="error" />
<tag name="message" />
</response>
</filter>

View file

@ -1,36 +1,40 @@
<!--%import("css/editor.css")-->
<!--%import("filter/setup_component.xml")-->
<div class="component_setup_window">
<table border="1" width="100%">
<tr>
<th>{$lang->component_name}</th>
<td>{$component->component_name} ver. {$component->version}</td>
</tr>
<tr>
<th>{$lang->component_author}</th>
<td>{$component->author->name}</td>
</tr>
<tr>
<th>{$lang->component_link}</th>
<td><a href="#" onclick="winopen('{$component->author->link}');return false;">{$component->author->link}</a></td>
</tr>
<tr>
<th colspan="2">{$lang->component_extra_vars}</th>
</tr>
<!--@foreach($component->extra_vars as $key => $val)-->
<tr>
<th rowspan="2">{$val->title}</th>
<td><input type="text" name="{$key}" value="{$val->value}" class="editor_input" /></td>
</tr>
<tr>
<td>{$val->description}</td>
</tr>
<!--@end-->
<tr>
<td colspan="2">
<input type="submit" value="{$lang->cmd_apply}" class="editor_button" />
<input type="button" value="{$lang->cmd_close}" class="editor_button" onclick="window.close();"/>
</td>
</tr>
</table>
<form action="./" method="get" onsubmit="return procFilter(this, setup_component);">
<input type="hidden" name="component_name" value="{$component_name}" />
<table border="1" width="100%">
<tr>
<th>{$lang->component_name}</th>
<td>{$component->component_name} ver. {$component->version}</td>
</tr>
<tr>
<th>{$lang->component_author}</th>
<td>{$component->author->name}</td>
</tr>
<tr>
<th>{$lang->component_link}</th>
<td><a href="#" onclick="winopen('{$component->author->link}');return false;">{$component->author->link}</a></td>
</tr>
<tr>
<th colspan="2">{$lang->component_extra_vars}</th>
</tr>
<!--@foreach($component->extra_vars as $key => $val)-->
<tr>
<th rowspan="2">{$val->title}</th>
<td><input type="text" name="{$key}" value="{$val->value}" class="editor_input" /></td>
</tr>
<tr>
<td>{$val->description}</td>
</tr>
<!--@end-->
<tr>
<td colspan="2">
<input type="submit" value="{$lang->cmd_apply}" class="editor_button" />
<input type="button" value="{$lang->cmd_close}" class="editor_button" onclick="window.close();"/>
</td>
</tr>
</table>
</form>
</div>