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

This commit is contained in:
zero 2007-03-26 07:20:23 +00:00
parent bc732c3f34
commit 4d976f2bdc
11 changed files with 193 additions and 55 deletions

View file

@ -5,46 +5,45 @@
<form action="./" method="get" onSubmit="return false" id="fo">
<div class="editor_window">
<div class="editor_title">{$lang->table_title}</div>
<div class="editor_title">{$lang->table_title}</div>
<div class="editor_option" id="table_option" style="display:none">
<input name="attr" type="radio" value="table" id="table_attribute_select" onclick="doSelectOption('table');"/> <label for="table_attribute_select">{$lang->table_attribute}</label>
<input name="attr" type="radio" value="cell" id="cell_attribute_select" onclick="doSelectOption('cell');"/> <label for="cell_attribute_select">{$lang->cell_attribute}</label>
<div class="editor_option" id="table_option" style="display:none">
<input name="attr" type="radio" value="table" id="table_attribute_select" onclick="doSelectOption('table');"/> <label for="table_attribute_select">{$lang->table_attribute}</label>
<input name="attr" type="radio" value="cell" id="cell_attribute_select" onclick="doSelectOption('cell');"/> <label for="cell_attribute_select">{$lang->cell_attribute}</label>
</div>
<div id="table_attribute" style="display:none">
<div class="item_area" id="col_row_area" style="display:none" >
<div class="header">{$lang->table_cols_count} :</div>
<div class="body"><input type="text" class="table_input" id="cols_count" value="3" /></div>
<div class="header">{$lang->table_rows_count} :</div>
<div class="body"><input type="text" class="table_input" id="rows_count" value="3" /></div>
</div>
<div id="table_attribute" style="display:none">
<div class="item_area">
<div class="header">{$lang->table_width} :</div>
<div class="body"><input type="text" class="table_input" id="width" value="600" />px</div>
<div class="item_area" id="col_row_area" style="display:none" >
<div class="header">{$lang->table_cols_count} :</div>
<div class="body"><input type="text" class="table_input" id="cols_count" value="3" /></div>
<div class="header">{$lang->table_cellspacing} :</div>
<div class="body"><input type="text" class="table_input" id="cellspacing" value="0" />px</div>
<div class="header">{$lang->table_rows_count} :</div>
<div class="body"><input type="text" class="table_input" id="rows_count" value="3" /></div>
</div>
<div class="header">{$lang->table_cellpadding} :</div>
<div class="body"><input type="text" class="table_input" id="cellpadding" value="1" />px</div>
</div>
<div class="item_area">
<div class="header">{$lang->table_width} :</div>
<div class="body"><input type="text" class="table_input" id="width" value="600" />px</div>
<div class="item_area">
<div class="header">{$lang->table_border} :</div>
<div class="body"><input type="text" class="table_input" id="border" value="1" />px</div>
<div class="header">{$lang->table_cellspacing} :</div>
<div class="body"><input type="text" class="table_input" id="cellspacing" value="0" />px</div>
<div class="header">{$lang->table_cellpadding} :</div>
<div class="body"><input type="text" class="table_input" id="cellpadding" value="1" />px</div>
</div>
<div class="item_area">
<div class="header">{$lang->table_border} :</div>
<div class="body"><input type="text" class="table_input" id="border" value="1" />px</div>
<div class="header">{$lang->table_inner_border} :</div>
<div class="body"><input type="text" class="table_input" id="inner_border" value="0" />px</div>
</div>
<div class="header">{$lang->table_inner_border} :</div>
<div class="body"><input type="text" class="table_input" id="inner_border" value="0" />px</div>
</div>
</div>
<div id="cell_attribute" style="display:none">
<div class="item_area">
<div class="header">{$lang->cell_width} :</div>
<div class="body"><input type="text" class="table_input" id="cell_width" value="0" />px</div>
@ -59,18 +58,18 @@
<div class="body">
<div class="editor_color_box">
<script type="text/javascript">
printColor("border", "{$tpl_path}/images/blank.gif");
printColor("border", "{$tpl_path}/images/blank.gif");
</script>
</div>
<div class="editor_color_input">
<table border="0" cellspacing="0">
<tr>
<td><img src="./images/border_solid.gif" alt="blank" class="border_preview_color" id="border_preview_color" /></td>
<td>#</td>
<td><input type="text" id="border_color_input" size="6" maxlength="6" class="table_input" value="000000" onkeyup="manual_select_color('border',this)"/></td>
</tr>
</table>
</div>
<div class="editor_color_input">
<table border="0" cellspacing="0">
<tr>
<td><img src="./images/border_solid.gif" alt="blank" class="border_preview_color" id="border_preview_color" /></td>
<td>#</td>
<td><input type="text" id="border_color_input" size="6" maxlength="6" class="table_input" value="000000" onkeyup="manual_select_color('border',this)"/></td>
</tr>
</table>
</div>
</div>
</div>
@ -79,18 +78,19 @@
<div class="body">
<div class="editor_color_box">
<script type="text/javascript">
printColor("bg", "{$tpl_path}/images/blank.gif");
printColor("bg", "{$tpl_path}/images/blank.gif");
</script>
</div>
<div class="editor_color_input">
<table border="0" cellspacing="0">
<tr>
<td><img src="./images/blank.gif" alt="blank" class="bg_preview_color" id="bg_preview_color" /></td>
<td>#</td>
<td><input type="text" id="bg_color_input" size="6" maxlength="6" class="table_input" value="FFFFFF" onkeyup="manual_select_color('bg',this)"/></td>
<td><img src="./images/blank.gif" alt="blank" class="bg_preview_color" id="bg_preview_color" /></td>
<td>#</td>
<td><input type="text" id="bg_color_input" size="6" maxlength="6" class="table_input" value="FFFFFF" onkeyup="manual_select_color('bg',this)"/></td>
</tr>
</table>
</div>
</div>
</div>
<div class="editor_button_area">

View file

@ -14,6 +14,18 @@
// 에디터 모듈에서 사용할 디렉토리 생성
FileHandler::makeDir('./files/cache/editor');
// 기본 에디터 컴포넌트를 추가
$oEditorController = &getController('editor');
$oEditorController->insertComponent('colorpicker_text',true);
$oEditorController->insertComponent('colorpicker_bg',true);
$oEditorController->insertComponent('emoticon',true);
$oEditorController->insertComponent('url_link',true);
$oEditorController->insertComponent('image_link',true);
$oEditorController->insertComponent('multimedia_link',true);
$oEditorController->insertComponent('image_gallery',true);
$oEditorController->insertComponent('quotation',true);
$oEditorController->insertComponent('table_maker',true);
return new Object();
}

View file

@ -13,6 +13,28 @@
function init() {
}
/**
* @brief 컴포넌트를 DB에 추가
**/
function insertComponent($component_name, $enabled = false) {
if($enabled) $enabled = 'Y';
else $enabled = 'N';
$oDB = &DB::getInstance();
$args->component_name = $component_name;
$args->enabled = $enabled;
// 컴포넌트가 있는지 확인
$output = $oDB->executeQuery('editor.isComponentInserted', $args);
if($output->data->count) return new Object(-1, 'msg_component_is_not_founded');
// 입력
$args->list_order = $oDB->getNextSequence();
$output = $oDB->executeQuery('editor.insertComponent', $args);
return $output;
}
/**
* @brief 컴포넌트에서 ajax요청시 해당 컴포넌트의 method를 실행

View file

@ -24,6 +24,64 @@
return $oComponent;
}
/**
* @brief component 목록을 return (DB정보 보함)
**/
function getComponentList($filter_enabled = true) {
if($filter_enabled) $args->enabled = "Y";
// DB에서 가져옴
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('editor.getComponentList', $args);
$db_list = $output->data;
// 파일목록을 구함
$downloaded_list = FileHandler::readDir($this->module_path.'components');
// DB 목록을 loop돌면서 xml정보까지 구함
if(!is_array($db_list)) $db_list = array($db_list);
foreach($db_list as $component) {
if(!$component->component_name) continue;
$component_name = $component->component_name;
unset($xml_info);
$xml_info = $this->getComponentXmlInfo($component_name);
$xml_info->enabled = $component->enabled;
if($component->extra_vars) {
$extra_vars = unserialize($component->extra_vars);
foreach($xml_info->extra_vars as $key => $val) {
$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
}
}
$component_list->{$component_name} = $xml_info;
}
// enabled만 체크하도록 하였으면 그냥 return
if($filter_enabled) return $component_list;
// 다운로드된 목록의 xml_info를 마저 구함
foreach($downloaded_list as $component_name) {
// 설정된 것이라면 패스
if($component_list->{$component_name}) continue;
// DB에 입력
$oEditorController = &getController('editor');
$oEditorController->insertComponent($component_name, false);
// component_list에 추가
unset($xml_info);
$xml_info = $this->getComponentXmlInfo($component_name);
$xml_info->enabled = 'N';
$component_list->{$component_name} = $xml_info;
}
return $component_list;
}
/**
* @brief component의 xml정보를 읽음
**/

View file

@ -19,14 +19,10 @@
**/
function adminIndex() {
// 컴포넌트의 종류를 구해옴
$component_list = FileHandler::readDir($this->module_path.'components');
arsort($component_list);
$oEditorModel = &getModel('editor');
foreach($component_list as $component) {
$list[$component] = $xml_doc = $oEditorModel->getComponentXmlInfo($component);
}
Context::set('component_list', $list);
$component_list = $oEditorModel->getComponentList(false);
Context::set('component_list', $component_list);
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('admin_index');
@ -42,8 +38,9 @@
// 에디터 컴포넌트를 구함
if(!Context::get('component_list')) {
$component_list = FileHandler::readDir($this->module_path.'components');
arsort($component_list);
$oEditorModel = &getModel('editor');
$component_list = $oEditorModel->getComponentList();
debugPrint($component_list);
Context::set('component_list', $component_list);
}

View file

@ -13,4 +13,5 @@
$lang->component_description = "설명";
$lang->msg_component_is_not_founded = '%s 에디터 컴포넌트를 찾을 수 없습니다';
$lang->msg_component_is_inserted = '선택하신 컴포넌트는 이미 입력되어 있습니다';
?>

View file

@ -0,0 +1,14 @@
<query id="getComponentList" action="select">
<tables>
<table name="editor_components" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="enabled" var="enabled" />
</conditions>
<navigation>
<index var="sort_index" default="list_order" order="asc" />
</navigation>
</query>

View file

@ -0,0 +1,10 @@
<query id="insertComponent" action="insert">
<tables>
<table name="editor_components" />
</tables>
<columns>
<column name="component_name" var="component_name" notnull="notnull" />
<column name="enabled" var="enabled" default="N" />
<column name="list_order" var="list_order" default="sequence()" />
</columns>
</query>

View file

@ -0,0 +1,11 @@
<query id="isComponentInserted" action="select">
<tables>
<table name="editor_components" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="component_name" var="component_name" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,13 @@
<query id="updateComponent" action="update">
<tables>
<table name="editor_components" />
</tables>
<columns>
<column name="enabled" var="enabled" default="N" />
<column name="extra_vars" var="extra_vars" default="N" />
<column name="list_order" var="list_order"/>
</columns>
<conditions>
<condition operation="equal" column="component_name" var="component_name" notnull="notnull" />
</conditions>
</query>

View file

@ -66,9 +66,9 @@
<div class="editor_area_2">
<!-- 컴포넌트 -->
<div id="editor_component_{$upload_target_srl}" class="editor_iconbox">
<!--@foreach($component_list as $component)-->
<!--@if(substr($component,0,11)!="colorpicker")-->
<img src="../components/{$component}/icon.gif" alt="{$component}" class="editor_icon" id="component_{$upload_target_srl}_{$component}" />
<!--@foreach($component_list as $component_name => $component)-->
<!--@if(substr($component_name,0,11)!="colorpicker")-->
<img src="../components/{$component_name}/icon.gif" alt="{$component->title}" title="{$component->title}" class="editor_icon" id="component_{$upload_target_srl}_{$component_name}" />
<!--@end-->
<!--@end-->
</div>