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

This commit is contained in:
zero 2007-03-30 06:01:24 +00:00
parent 84d0a85ebb
commit df75151c85
79 changed files with 1972 additions and 1919 deletions

View file

@ -16,7 +16,7 @@
/**
* @brief 자동 저장
**/
function procSaveDoc() {
function procEditorSaveDoc() {
$this->deleteSavedDoc();
@ -41,6 +41,120 @@
$this->setMessage('msg_auto_saved');
}
/**
* @brief 컴포넌트에서 ajax요청시 해당 컴포넌트의 method를 실행
**/
function procEditorCall() {
$component = Context::get('component');
$method = Context::get('method');
if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($component);
if(!$oComponent->toBool()) return $oComponent;
if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
$output = call_user_method($method, $oComponent);
if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output;
$this->setError($oComponent->getError());
$this->setMessage($oComponent->getMessage());
$vars = $oComponent->getVariables();
if(count($vars)) {
foreach($vars as $key=>$val) $this->add($key, $val);
}
}
/**
* @brief 컴포넌트의 활성화
**/
function procEditorAdminEnableComponent() {
$args->component_name = Context::get('component_name');
$args->enabled = 'Y';
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('editor.updateComponent', $args);
if(!$output->toBool()) return $output;
$this->setMessage('success_updated');
}
/**
* @brief 컴포넌트의 비활성화
**/
function procEditorAdminDisableComponent() {
$args->component_name = Context::get('component_name');
$args->enabled = 'N';
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('editor.updateComponent', $args);
if(!$output->toBool()) return $output;
$this->setMessage('success_updated');
}
/**
* @brief 컴포넌트의 위치 변경
**/
function procEditorAdminMoveListOrder() {
$args->component_name = Context::get('component_name');
$mode = Context::get('mode');
// DB에서 전체 목록 가져옴
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('editor.getComponentList', $args);
$db_list = $output->data;
foreach($db_list as $key => $val) {
if($val->component_name == $args->component_name) break;
}
if($mode=="up") {
if($key == 2) return new Object(-1,'msg_component_is_first_order');
$prev_args->component_name = $db_list[$key-1]->component_name;
$prev_args->list_order = $db_list[$key]->list_order;
$oDB->executeQuery('editor.updateComponent', $prev_args);
$cur_args->component_name = $db_list[$key]->component_name;
$cur_args->list_order = $db_list[$key-1]->list_order;
$oDB->executeQuery('editor.updateComponent', $cur_args);
} else {
if($key == count($db_list)-1) return new Object(-1,'msg_component_is_last_order');
$next_args->component_name = $db_list[$key+1]->component_name;
$next_args->list_order = $db_list[$key]->list_order;
$oDB->executeQuery('editor.updateComponent', $next_args);
$cur_args->component_name = $db_list[$key]->component_name;
$cur_args->list_order = $db_list[$key+1]->list_order;
$oDB->executeQuery('editor.updateComponent', $cur_args);
}
$this->setMessage('success_updated');
}
/**
* @brief 컴포넌트 설정
**/
function procEditorAdminSetupComponent() {
$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 자동 저장된 글을 삭제
* 현재 접속한 사용자를 기준
@ -79,119 +193,5 @@
$output = $oDB->executeQuery('editor.insertComponent', $args);
return $output;
}
/**
* @brief 컴포넌트의 활성화
**/
function procEnableComponent() {
$args->component_name = Context::get('component_name');
$args->enabled = 'Y';
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('editor.updateComponent', $args);
if(!$output->toBool()) return $output;
$this->setMessage('success_updated');
}
/**
* @brief 컴포넌트의 비활성화
**/
function procDisableComponent() {
$args->component_name = Context::get('component_name');
$args->enabled = 'N';
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('editor.updateComponent', $args);
if(!$output->toBool()) return $output;
$this->setMessage('success_updated');
}
/**
* @brief 컴포넌트의 위치 변경
**/
function procMoveListOrder() {
$args->component_name = Context::get('component_name');
$mode = Context::get('mode');
// DB에서 전체 목록 가져옴
$oDB = &DB::getInstance();
$output = $oDB->executeQuery('editor.getComponentList', $args);
$db_list = $output->data;
foreach($db_list as $key => $val) {
if($val->component_name == $args->component_name) break;
}
if($mode=="up") {
if($key == 2) return new Object(-1,'msg_component_is_first_order');
$prev_args->component_name = $db_list[$key-1]->component_name;
$prev_args->list_order = $db_list[$key]->list_order;
$oDB->executeQuery('editor.updateComponent', $prev_args);
$cur_args->component_name = $db_list[$key]->component_name;
$cur_args->list_order = $db_list[$key-1]->list_order;
$oDB->executeQuery('editor.updateComponent', $cur_args);
} else {
if($key == count($db_list)-1) return new Object(-1,'msg_component_is_last_order');
$next_args->component_name = $db_list[$key+1]->component_name;
$next_args->list_order = $db_list[$key]->list_order;
$oDB->executeQuery('editor.updateComponent', $next_args);
$cur_args->component_name = $db_list[$key]->component_name;
$cur_args->list_order = $db_list[$key+1]->list_order;
$oDB->executeQuery('editor.updateComponent', $cur_args);
}
$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를 실행
**/
function procCall() {
$component = Context::get('component');
$method = Context::get('method');
if(!$component) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($component);
if(!$oComponent->toBool()) return $oComponent;
if(!method_exists($oComponent, $method)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
$output = call_user_method($method, $oComponent);
if((is_a($output, 'Object') || is_subclass_of($output, 'Object')) && !$output->toBool()) return $output;
$this->setError($oComponent->getError());
$this->setMessage($oComponent->getMessage());
$vars = $oComponent->getVariables();
if(count($vars)) {
foreach($vars as $key=>$val) $this->add($key, $val);
}
}
}
?>