english comments added

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0_english@8278 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
mosmartin 2011-04-06 16:48:06 +00:00
parent 693e215bc1
commit 4d272994dd
219 changed files with 6407 additions and 8705 deletions

View file

@ -12,11 +12,11 @@
* <form> <-- code to validate data in the form
* <node target="name" required="true" minlength="1" maxlength="5" filter="email,userid,alpha,number" equalto="target" />
* </form>
* <parameter> <-- 항목을 조합하여 key=val js array로 return, act는 필수
* <parameter> "- A form of key = val combination of items to js array return, act required
* <param name="key" target="target" />
* </parameter>
* <response callback_func="callback 받게 될 js function 이름 지정" > <-- 서버에 ajax로 전송하여 받을 결과값
* <tag name="error" /> <-- error이름의 결과값을 받겠다는
* <response callback_func="specifying the name of js function to callback" > "- Result to get by sending ajax to the server
* <tag name="error" /> <- get the result of error name
* </response>
* </filter>
* }
@ -36,7 +36,7 @@
*
* - parameter - param
* name = key : indicate that a new array, 'key' will be created and a value will be assigned to it
* target = target_name : target form element값을 가져옴
* target = target_name: get the value of the target form element
*
* - response
* tag = key : name of variable that will contain the result of the execution
@ -45,9 +45,9 @@
class XmlJsFilter extends XmlParser {
var $version = '0.2.5';
var $compiled_path = './files/cache/js_filter_compiled/'; ///< 컴파일된 캐시 파일이 놓일 위치
var $xml_file = NULL; ///< 대상 xml 파일
var $js_file = NULL; ///< 컴파일된 js 파일
var $compiled_path = './files/cache/js_filter_compiled/'; // / directory path for compiled cache file
var $xml_file = NULL; // / Target xml file
var $js_file = NULL; // / Compiled js file
/**
* @brief constructor
@ -75,7 +75,7 @@
function _compile() {
global $lang;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile($this->xml_file);
// xml parsing
@ -84,7 +84,7 @@
$attrs = $xml_obj->filter->attrs;
$rules = $xml_obj->filter->rules;
// XmlJsFilter는 filter_name, field, parameter 3개의 데이터를 핸들링
// XmlJsFilter handles three data; filter_name, field, and parameter
$filter_name = $attrs->name;
$confirm_msg_code = $attrs->confirm_msg_code;
$module = $attrs->module;
@ -101,27 +101,27 @@
$response_tag = $xml_obj->filter->response->tag;
if($response_tag && !is_array($response_tag)) $response_tag = array($response_tag);
// extend_filter가 있을 경우 해당 method를 호출하여 결과를 받음
// If extend_filter exists, result returned by calling the method
if($extend_filter) {
// extend_filter가 있을 경우 캐시 사용을 못하도록 js 캐시 파일명을 변경
// If extend_filter exists, it changes the name of cache not to use cache
$this->js_file .= '.nocache.js';
// extend_filter는 module.method 로 지칭되어 이를 분리
// Separate the extend_filter
list($module_name, $method) = explode('.',$extend_filter);
// 모듈 이름과 method가 있을 경우 진행
// contibue if both module_name and methos exist.
if($module_name&&$method) {
// 해당 module의 model 객체를 받음
// get model object of the module
$oExtendFilter = &getModel($module_name);
// method가 존재하면 실행
// execute if method exists
if(method_exists($oExtendFilter, $method)) {
// 결과를 받음
// get the result
$extend_filter_list = $oExtendFilter->{$method}(true);
$extend_filter_count = count($extend_filter_list);
// 결과에서 lang값을 이용 문서 변수에 적용
// apply lang_value from the result to the variable
for($i=0; $i < $extend_filter_count; $i++) {
$name = $extend_filter_list[$i]->name;
$lang_value = $extend_filter_list[$i]->lang;
@ -132,7 +132,7 @@
}
}
// 언어 입력을 위한 사용되는 필드 조사
// search the field to be used for entering language
$target_list = array();
$target_type_list = array();
@ -152,7 +152,7 @@
}
}
// field, 즉 체크항목의 script 생성
// generates a field, which is a script of the checked item
$node_count = count($field_node);
if($node_count) {
foreach($field_node as $key =>$node) {
@ -179,7 +179,7 @@
}
}
// extend_filter_item 체크
// Check extend_filter_item
$rule_types = array('homepage'=>'homepage', 'email_address'=>'email');
for($i=0;$i<$extend_filter_count;$i++) {
@ -188,7 +188,7 @@
if(!$target) continue;
// extend filter item의 type으로 rule을 구함
// get the filter from the type of extend filter item
$type = $filter_item->type;
$rule = $rule_types[$type]?$rule_types[$type]:'';
$required = ($filter_item->required == 'true');
@ -202,11 +202,11 @@
if(!$target_type_list[$target]) $target_type_list[$target] = $type;
}
// 데이터를 만들기 위한 parameter script 생성
// generates parameter script to create dbata
$rename_params = array();
$parameter_count = count($parameter_param);
if($parameter_count) {
// 기본 필터 내용의 parameter로 구성
// contains parameter of the default filter contents
foreach($parameter_param as $key =>$param) {
$attrs = $param->attrs;
$name = trim($attrs->name);
@ -217,7 +217,7 @@
if($name && !in_array($name, $target_list)) $target_list[] = $name;
}
// extend_filter_item 체크
// Check extend_filter_item
for($i=0;$i<$extend_filter_count;$i++) {
$filter_item = $extend_filter_list[$i];
$target = $name = trim($filter_item->name);
@ -227,7 +227,7 @@
}
}
// response script 생성
// generates the response script
$response_count = count($response_tag);
$responses = array();
for($i=0;$i<$response_count;$i++) {
@ -236,7 +236,7 @@
$responses[] = "'{$name}'";
}
// lang : form field description
// writes lang values of the form field
$target_count = count($target_list);
for($i=0;$i<$target_count;$i++) {
$target = $target_list[$i];
@ -244,7 +244,7 @@
$js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $target, addslashes($lang->{$target}));
}
// target type을 기록
// writes the target type
/*
$target_type_count = count($target_type_list);
if($target_type_count) {
@ -254,7 +254,7 @@
}
*/
// lang : error message
// writes error messages
foreach($lang->filter as $key => $val) {
if(!$val) $val = $key;
$js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $key, $val);
@ -276,7 +276,7 @@
$jsdoc[] = '})(jQuery);';
$jsdoc = implode("\n", $jsdoc);
// js파일 생성
// generates the js file
FileHandler::writeFile($this->js_file, $jsdoc);
}

View file

@ -19,10 +19,10 @@
var $input = NULL; ///< input xml
var $output = array(); ///< output object
var $lang = "en"; ///< 기본 언어타입
var $lang = "en"; // /< The default language type
/**
* @brief load a xml file specified by a filename and parse it to return the resultant data object
* @brief load a xml file specified by a filename and parse it to Return the resultant data object
* @param[in] $filename a file path of file
* @return Returns a data object containing data extracted from a xml file or NULL if a specified file does not exist
**/
@ -40,7 +40,7 @@
* @return Returns a resultant data object or NULL in case of error
**/
function parse($input = '') {
// 디버그를 위한 컴파일 시작 시간 저장
// Save the compile starting time for debugging
if(__DEBUG__==3) $start = getMicroTime();
$this->lang = Context::getLangType();
@ -48,12 +48,12 @@
$this->input = $input?$input:$GLOBALS['HTTP_RAW_POST_DATA'];
$this->input = str_replace(array('',''),array('',''),$this->input);
// 지원언어 종류를 뽑음
// extracts a supported language
preg_match_all("/xml:lang=\"([^\"].+)\"/i", $this->input, $matches);
// xml:lang이 쓰였을 경우 지원하는 언어종류를 뽑음
// extracts the supported lanuage when xml:lang is used
if(count($matches[1]) && $supported_lang = array_unique($matches[1])) {
// supported_lang에 현재 접속자의 lang이 없으면 en이 있는지 확인하여 en이 있으면 en을 기본, 아니면 첫번째것을..
// if lang of the first log-in user doesn't exist, apply en by default if exists. Otherwise apply the first lang.
if(!in_array($this->lang, $supported_lang)) {
if(in_array('en', $supported_lang)) {
$this->lang = 'en';
@ -61,7 +61,7 @@
$this->lang = array_shift($supported_lang);
}
}
// 특별한 언어가 지정되지 않았다면 언어체크를 하지 않음
// uncheck the language if no specific language is set.
} else {
unset($this->lang);
}
@ -78,8 +78,7 @@
if(!count($this->output)) return;
$output = array_shift($this->output);
// 디버그를 위한 컴파일 시작 시간 저장
// Save compile starting time for debugging
if(__DEBUG__==3) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
return $output;

View file

@ -23,7 +23,7 @@
* @remarks {there should be a way to report an error}
**/
function parse($query_id, $xml_file, $cache_file) {
// query xml 파일을 찾아서 파싱, 결과가 없으면 return
// parse the query xml file. Return if get no result
$buff = FileHandler::readFile($xml_file);
$xml_obj = parent::parse($buff);
if(!$xml_obj) return;
@ -40,12 +40,10 @@
$module = $id_args[1];
$id = $id_args[2];
}
// insert, update, delete, select등의 action
// actions like insert, update, delete, select and so on
$action = strtolower($xml_obj->query->attrs->action);
if(!$action) return;
// 테이블 정리 (배열코드로 변환)
// get the table list(converting an array code)
$tables = $xml_obj->query->tables->table;
$output->left_tables = array();
@ -54,8 +52,7 @@
if(!$tables) return;
if(!is_array($tables)) $tables = array($tables);
foreach($tables as $key => $val) {
// 테이블과 alias의 이름을 구함
// get the name of tables and aliases
$table_name = $val->attrs->name;
$alias = $val->attrs->alias;
if(!$alias) $alias = $table_name;
@ -66,8 +63,7 @@
$output->left_tables[$alias] = $val->attrs->type;
$left_conditions[$alias] = $val->conditions;
}
// 테이블을 찾아서 컬럼의 속성을 구함
// get column properties from the table
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
if(!file_exists($table_file)) {
$searched_list = FileHandler::readDir(_XE_PATH_.'modules');
@ -93,9 +89,7 @@
}
}
}
// 컬럼 정리
// Column list
$columns = $xml_obj->query->columns->column;
$out = $this->_setColumn($columns);
$output->columns = $out->columns;
@ -114,8 +108,7 @@
$group_list = $xml_obj->query->groups->group;
$out = $this->_setGroup($group_list);
$output->groups = $out->groups;
// 네비게이션 정리
// Navigation
$out = $this->_setNavigation($xml_obj);
$output->order = $out->order;
$output->list_count = $out->list_count;
@ -132,8 +125,7 @@
}
}
$buff .= ' );'."\n";
// php script 생성
// generates a php script
$buff .= '$output->_tables = array( ';
foreach($output->tables as $key => $val) {
$buff .= sprintf('"%s"=>"%s",', $key, $val);
@ -147,22 +139,19 @@
}
$buff .= ' );'."\n";
}
// column 정리
// column info
if($column_count) {
$buff .= '$output->columns = array ( ';
$buff .= $this->_getColumn($output->columns);
$buff .= ' );'."\n";
}
// conditions 정리
// get conditions
if($condition_count) {
$buff .= '$output->conditions = array ( ';
$buff .= $this->_getConditions($output->conditions);
$buff .= ' );'."\n";
}
// conditions 정리
// get conditions
if(count($output->left_conditions)) {
$buff .= '$output->left_conditions = array ( ';
foreach($output->left_conditions as $key => $val){
@ -173,7 +162,7 @@
$buff .= ' );'."\n";
}
// args 변수 확인
// get arguments
$arg_list = $this->getArguments();
if($arg_list)
{
@ -184,7 +173,7 @@
}
}
// order 정리
// order
if($output->order) {
$buff .= '$output->order = array(';
foreach($output->order as $key => $val) {
@ -193,22 +182,22 @@
$buff .= ');'."\n";
}
// list_count 정리
// list_count
if($output->list_count) {
$buff .= sprintf('$output->list_count = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->list_count->var, $output->list_count->var, $output->list_count->var, $output->list_count->default,"\n");
}
// page_count 정리
// page_count
if($output->page_count) {
$buff .= sprintf('$output->page_count = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->page_count->var, $output->page_count->var, $output->page_count->var, $output->list_count->default,"\n");
}
// page 정리
// page order
if($output->page) {
$buff .= sprintf('$output->page = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->page->var, $output->page->var, $output->page->var, $output->list->default,"\n");
}
// group by 정리
// group by
if($output->groups) {
$buff .= sprintf('$output->groups = array("%s");%s', implode('","',$output->groups),"\n");
}
@ -255,7 +244,7 @@
. $buff
. 'return $output; ?>';
// 저장
// Save
FileHandler::writeFile($cache_file, $buff);
}
@ -301,8 +290,7 @@
* @result Returns $output
*/
function _setConditions($conditions){
// 조건절 정리
// Conditional clause
$condition = $conditions->condition;
if($condition) {
$obj->condition = $condition;
@ -344,7 +332,7 @@
* @result Returns $output
*/
function _setGroup($group_list){
// group 정리
// group list
if($group_list) {
if(!is_array($group_list)) $group_list = array($group_list);