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

This commit is contained in:
zero 2007-04-12 10:24:19 +00:00
parent 7586d9a27d
commit 77a0d87dfc
10 changed files with 69 additions and 29 deletions

View file

@ -260,6 +260,16 @@
return new Object(); return new Object();
} }
/**
* @brief 컬럼의 타입을 구해옴
* 컬럼의 경우 a.b 같이 되어 있는 경우가 있어서 별도 함수가 필요
**/
function getColumnType($column_type_list, $name) {
if(strpos($name,'.')===false) return $column_type_list[$name];
list($prefix, $name) = explode('.',$name);
return $column_type_list[$name];
}
/** /**
* @brief 이름, , operation, type으로 값을 변경 * @brief 이름, , operation, type으로 값을 변경
* like, like_prefix의 경우 value자체가 변경됨 * like, like_prefix의 경우 value자체가 변경됨

View file

@ -91,7 +91,7 @@
**/ **/
function close() { function close() {
if(!$this->isConnected()) return; if(!$this->isConnected()) return;
cubrid_commit($this->fd); @cubrid_commit($this->fd);
@cubrid_disconnect($this->fd); @cubrid_disconnect($this->fd);
} }
@ -309,6 +309,7 @@
function getCondition($output) { function getCondition($output) {
if(!$output->conditions) return; if(!$output->conditions) return;
$condition = "";
foreach($output->conditions as $key => $val) { foreach($output->conditions as $key => $val) {
$sub_condition = ''; $sub_condition = '';
foreach($val['condition'] as $k =>$v) { foreach($val['condition'] as $k =>$v) {
@ -317,15 +318,19 @@
$name = $v['column']; $name = $v['column'];
$operation = $v['operation']; $operation = $v['operation'];
$value = $v['value']; $value = $v['value'];
$type = $output->column_type[$name]; $type = $this->getColumnType($output->column_type,$name);
$pipe = $v['pipe']; $pipe = $v['pipe'];
$value = $this->getConditionValue($name, $value, $operation, $type); $value = $this->getConditionValue($name, $value, $operation, $type);
if(!$value) $value = $v['value'];
if(strpos($name,'.')===false) $name = '"'.$name.'"';
$str = $this->getConditionPart($name, $value, $operation); $str = $this->getConditionPart($name, $value, $operation);
if($sub_condition) $sub_condition .= ' '.$pipe.' '; if($sub_condition) $sub_condition .= ' '.$pipe.' ';
$sub_condition .= $str; $sub_condition .= $str;
} }
if($sub_condition) { if($sub_condition) {
if($condition && $val['pipe']) $condition .= ' '.$val['pipe'].' '; if($condition && $val['pipe']) $condition .= ' '.$val['pipe'].' ';
$condition .= '('.$sub_condition.')'; $condition .= '('.$sub_condition.')';
@ -349,14 +354,15 @@
foreach($output->columns as $key => $val) { foreach($output->columns as $key => $val) {
$name = $val['name']; $name = $val['name'];
$value = $val['value']; $value = $val['value'];
if($output->column_type[$name]!='number') { if($this->getColumnType($output->column_type,$name)!='number') {
$value = "'".$this->addQuotes($value)."'"; $value = "'".$this->addQuotes($value)."'";
if(!$value) $value = 'null'; if(!$value) $value = 'null';
} else { } else {
if(!$value) $value = 0; if(!$value) $value = 0;
} }
$column_list[] = '"'.$name.'"'; if(strpos($name,'.')===false) $column_list[] = '"'.$name.'"';
else $column_list[] = $name;
$value_list[] = $value; $value_list[] = $value;
} }
@ -376,12 +382,15 @@
// 컬럼 정리 // 컬럼 정리
foreach($output->columns as $key => $val) { foreach($output->columns as $key => $val) {
if(!isset($val['value'])) continue; if(!isset($val['value'])) continue;
$name = $val['name']; $name = $val['name'];
$value = $val['value']; $value = $val['value'];
if($output->column_type[$name]!='number') $value = "'".$this->addQuotes($value)."'"; if($this->getColumnType($output->column_type,$name)!='number') $value = "'".$this->addQuotes($value)."'";
else $value = (int)$value; else $value = (int)$value;
$column_list[] = sprintf('"%s" = %s', $name, $value); if(strpos($name,'.')===false) $name = '"'.$name.'"';
$column_list[] = sprintf('%s = %s', $name, $value);
} }
// 조건절 정리 // 조건절 정리
@ -435,8 +444,14 @@
if($alias) $column_list[] = sprintf('"%s" as "%s"', $name, $alias); if($alias) $column_list[] = sprintf('"%s" as "%s"', $name, $alias);
else $column_list[] = sprintf('"%s"',$name); else $column_list[] = sprintf('"%s"',$name);
} else { } else {
if($alias) $column_list[] = sprintf('%s as "%s"', $name, $alias); if(strpos($name,'.')!=false) {
else $column_list[] = sprintf('%s',$name); list($prefix, $name) = explode('.',$name);
if($alias) $column_list[] = sprintf('%s."%s" as "%s"', $prefix, $name, $alias);
else $column_list[] = sprintf('%s."%s"',$prefix,$name);
} else {
if($alias) $column_list[] = sprintf('%s as "%s"', $name, $alias);
else $column_list[] = sprintf('%s',$name);
}
} }
} }
$columns = implode(',',$column_list); $columns = implode(',',$column_list);
@ -473,7 +488,7 @@
require_once('./classes/page/PageHandler.class.php'); require_once('./classes/page/PageHandler.class.php');
// 전체 개수를 구함 // 전체 개수를 구함
$count_query = sprintf("select count(*) as count from %s %s", implode(',',$table_list), $condition); $count_query = sprintf('select count(*) as "count" from %s %s', implode(',',$table_list), $condition);
$result = $this->_query($count_query); $result = $this->_query($count_query);
$count_output = $this->_fetch($result); $count_output = $this->_fetch($result);
$total_count = (int)$count_output->count; $total_count = (int)$count_output->count;
@ -501,7 +516,7 @@
if(count($index_list)) $query .= ' order by '.implode(',',$index_list); if(count($index_list)) $query .= ' order by '.implode(',',$index_list);
} }
$query = sprintf('%s for ordery_num() between %d and %d', $query, $start_count, $list_count); $query = sprintf('%s for orderby_num() between %d and %d', $query, $start_count, $list_count);
$result = $this->_query($query); $result = $this->_query($query);
if($this->isError()) { if($this->isError()) {

View file

@ -288,7 +288,7 @@
$type = $output->column_type[$name]; $type = $output->column_type[$name];
$pipe = $v['pipe']; $pipe = $v['pipe'];
$value = $this->getConditionValue($name, $value, $operation, $type); if(strpos($value,'.')===false) $value = $this->getConditionValue($name, $value, $operation, $type);
$str = $this->getConditionPart($name, $value, $operation); $str = $this->getConditionPart($name, $value, $operation);
if($sub_condition) $sub_condition .= ' '.$pipe.' '; if($sub_condition) $sub_condition .= ' '.$pipe.' ';
$sub_condition .= $str; $sub_condition .= $str;

View file

@ -297,7 +297,7 @@
$type = $output->column_type[$name]; $type = $output->column_type[$name];
$pipe = $v['pipe']; $pipe = $v['pipe'];
$value = $this->getConditionValue($name, $value, $operation, $type); if(strpos($value,'.')===false) $value = $this->getConditionValue($name, $value, $operation, $type);
$str = $this->getConditionPart($name, $value, $operation); $str = $this->getConditionPart($name, $value, $operation);
if($sub_condition) $sub_condition .= ' '.$pipe.' '; if($sub_condition) $sub_condition .= ' '.$pipe.' ';
$sub_condition .= $str; $sub_condition .= $str;

View file

@ -292,7 +292,7 @@
$type = $output->column_type[$name]; $type = $output->column_type[$name];
$pipe = $v['pipe']; $pipe = $v['pipe'];
$value = $this->getConditionValue($name, $value, $operation, $type); if(strpos($value,'.')===false) $value = $this->getConditionValue($name, $value, $operation, $type);
$str = $this->getConditionPart($name, $value, $operation); $str = $this->getConditionPart($name, $value, $operation);
if($sub_condition) $sub_condition .= ' '.$pipe.' '; if($sub_condition) $sub_condition .= ' '.$pipe.' ';
$sub_condition .= $str; $sub_condition .= $str;

View file

@ -319,7 +319,7 @@
$type = $output->column_type[$name]; $type = $output->column_type[$name];
$pipe = $v['pipe']; $pipe = $v['pipe'];
$value = $this->getConditionValue($name, $value, $operation, $type); if(strpos($value,'.')===false) $value = $this->getConditionValue($name, $value, $operation, $type);
$str = $this->getConditionPart($name, $value, $operation); $str = $this->getConditionPart($name, $value, $operation);
if($sub_condition) $sub_condition .= ' '.$pipe.' '; if($sub_condition) $sub_condition .= ' '.$pipe.' ';
$sub_condition .= $str; $sub_condition .= $str;

View file

@ -18,6 +18,9 @@
* @brief 모듈객체를 받아서 content 출력 * @brief 모듈객체를 받아서 content 출력
**/ **/
function printContent(&$oModule) { function printContent(&$oModule) {
if(!$oModule->getTemplateFile()) return;
// header 출력 // header 출력
$this->_printHeader(); $this->_printHeader();

View file

@ -40,11 +40,22 @@
// 테이블을 찾아서 컬럼의 속성을 구함 // 테이블을 찾아서 컬럼의 속성을 구함
$table_file = sprintf('./modules/%s/schemas/%s.xml', $module, $table_name); $table_file = sprintf('./modules/%s/schemas/%s.xml', $module, $table_name);
$table_xml = FileHandler::readFile($table_file); if(!file_exists($table_file)) {
$table_obj = parent::parse($table_xml); $searched_list = FileHandler::readDir('./modules');
if($table_obj->table) { $searched_count = count($searched_list);
foreach($table_obj->table->column as $k => $v) { for($i=0;$i<$searched_count;$i++) {
$buff .= sprintf('$output->column_type["%s"] = "%s";%s', $v->attrs->name, $v->attrs->type, "\n"); $table_file = sprintf('./modules/%s/schemas/%s.xml', $searched_list[$i], $table_name);
if(file_exists($table_file)) break;
}
}
if(file_exists($table_file)) {
$table_xml = FileHandler::readFile($table_file);
$table_obj = parent::parse($table_xml);
if($table_obj->table) {
foreach($table_obj->table->column as $k => $v) {
$buff .= sprintf('$output->column_type["%s"] = "%s";%s', $v->attrs->name, $v->attrs->type, "\n");
}
} }
} }
} }

View file

@ -251,16 +251,11 @@
$buff .= sprintf("parent.editor_insert_uploaded_file(\"%d\", \"%d\",\"%s\", \"%d\", \"%s\", \"%s\", \"%s\");\n", $upload_target_srl, $file_info->file_srl, $file_info->source_filename, $file_info->file_size, FileHandler::filesize($file_info->file_size), $file_info->direct_download=='Y'?$uploaded_filename:'', $file_info->sid); $buff .= sprintf("parent.editor_insert_uploaded_file(\"%d\", \"%d\",\"%s\", \"%d\", \"%s\", \"%s\", \"%s\");\n", $upload_target_srl, $file_info->file_srl, $file_info->source_filename, $file_info->file_size, FileHandler::filesize($file_info->file_size), $file_info->direct_download=='Y'?$uploaded_filename:'', $file_info->sid);
} }
header("Content-Type: text/html; charset=UTF-8"); Context::set('upload_target_srl', $upload_target_srl);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); Context::set('buff', $buff);
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$buff = sprintf("<script type=\"text/javascript\">\nparent.editor_upload_clear_list(\"%s\");\n%s</script>", $upload_target_srl, $buff); $this->setTemplatePath($this->module_path.'tpl');
print $buff; $this->setTemplateFile('print_uploaded_file_list.html');
exit();
} }
/** /**
@ -327,7 +322,6 @@
header("Content-Transfer-Encoding: binary\n"); header("Content-Transfer-Encoding: binary\n");
fpassthru($fp); fpassthru($fp);
exit();
} }
} }

View file

@ -0,0 +1,7 @@
<script type="text/javascript">
parent.editor_upload_clear_list("{$upload_target_srl}");
{$buff}
</script>