mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@34 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
679e241d4f
commit
976f4f4074
8 changed files with 118 additions and 97 deletions
|
|
@ -318,7 +318,6 @@
|
|||
$oXml = new XmlParser();
|
||||
$xml_obj = $oXml->parse();
|
||||
|
||||
$method_name = $xml_obj->methodcall->methodname->body;
|
||||
$params = $xml_obj->methodcall->params;
|
||||
unset($params->node_name);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,9 @@
|
|||
* Request Argument에서 $mid, $act값으로 객체를 찾는다.\n
|
||||
* 단 유연한 처리를 위해 $document_srl 을 이용하기도 한다.
|
||||
**/
|
||||
function ModuleHandler($module = NULL, $act = NULL) {
|
||||
function ModuleHandler() {
|
||||
$module = Context::get('module');
|
||||
$act = Context::get('act');
|
||||
|
||||
// 설치가 안되어 있다면 설치를 위한 준비를 한다
|
||||
if(!Context::isInstalled()) {
|
||||
|
|
@ -53,7 +55,6 @@
|
|||
}
|
||||
|
||||
// 해당 모듈의 conf/action.xml 을 분석하여 act 값을 체크
|
||||
if(!$act) $act = Context::get('act');
|
||||
$type = $this->getActionType($module, $act);
|
||||
|
||||
// 모듈 객체 생성
|
||||
|
|
|
|||
|
|
@ -1,41 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* @class XmlJsFilter
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief filter xml문서를 해석하여 js파일로 만듬
|
||||
* @version 0.1
|
||||
*
|
||||
* filter xml은 tpl 파일과 같은 위치에 있어야 함
|
||||
* <filter id='js function 이름'>
|
||||
* <field> <-- 폼 항목의 체크
|
||||
* <item target="name" required="true" minlength="1" maxlength="5"
|
||||
* filter="email,userid,alpha,number" reualto="target" />
|
||||
* </field>
|
||||
* <parameter> <-- 폼 항목을 조합하여 key=val 의 js array로 return, act는 필수
|
||||
* <item param="key" value="target" concat="'@',target2..." />
|
||||
* </parameter>
|
||||
* <response> <-- 서버에 ajax로 전송하여 받을 결과값
|
||||
* <item name="error" /> <-- error이름의 결과값을 받겠다는 것
|
||||
* </response>
|
||||
* </filter>
|
||||
*
|
||||
* - field
|
||||
* target = 폼 element의 이름
|
||||
* required = true/ false 꼭 있어야 하는지에 대한 체크
|
||||
* minlength, maxlength = 최소/최대 길이
|
||||
* filter = javascript로 체크하기 위한 체크 필터
|
||||
* email : email의 형식 ( aaa.aaa@aaa.com)
|
||||
* userid : 영문+숫자+_, 첫 글자는 영문, 소문자
|
||||
* alpha : 영문값만 허용
|
||||
* number : 숫자만 허용
|
||||
* equalto = target , 현재 폼과 지정 target의 값이 동일해야 함
|
||||
* - parameter
|
||||
* param = key : key를 이름으로 가지고 value의 값을 가지는 array 값 생성
|
||||
* value = target : target form element의 값을 가져옴
|
||||
* concat = str1,str2,target2... : 값들의 string 또는 form element value를 연결
|
||||
* - response
|
||||
* name = key : return받을 결과값의 변수명
|
||||
**/
|
||||
* @class XmlJsFilter
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief filter xml문서를 해석하여 js파일로 만듬
|
||||
* @version 0.1
|
||||
*
|
||||
* xml filter 파일은 js script로 컴파일 되어 캐싱됨\n
|
||||
* \n
|
||||
* <filter name="js function 이름" method_name="서버에 요청할 action 이름" confirm_msg_code="submit시에 prompt로 물어볼 메세지의 코드" >\n
|
||||
* <form> <-- 폼 항목의 체크\n
|
||||
* <node target="name" required="true" minlength="1" maxlength="5" filter="email,userid,alpha,number" equalto="target" />\n
|
||||
* </form>\n
|
||||
* <parameter> <-- 폼 항목을 조합하여 key=val 의 js array로 return, act는 필수\n
|
||||
* <param param="key" value="target" concat="'@',target2..." />\n
|
||||
* </parameter>\n
|
||||
* <response callback_func="callback 받게 될 js function 이름 지정" > <-- 서버에 ajax로 전송하여 받을 결과값\n
|
||||
* <tag name="error" /> <-- error이름의 결과값을 받겠다는 것\n
|
||||
* </response>\n
|
||||
* </filter>\n
|
||||
* \n
|
||||
* - form - node\n
|
||||
* target = 폼 element의 이름\n
|
||||
* required = true/ false 꼭 있어야 하는지에 대한 체크\n
|
||||
* minlength, maxlength = 최소/최대 길이\n
|
||||
* filter = javascript로 체크하기 위한 체크 필터\n
|
||||
* email : email의 형식 ( aaa.aaa@aaa.com)\n
|
||||
* userid : 영문+숫자+_, 첫 글자는 영문, 소문자\n
|
||||
* alpha : 영문값만 허용\n
|
||||
* number : 숫자만 허용\n
|
||||
* equalto = target , 현재 폼과 지정 target의 값이 동일해야 함\n
|
||||
* \n
|
||||
* - parameter - param\n
|
||||
* param = key : key를 이름으로 가지고 value의 값을 가지는 array 값 생성\n
|
||||
* value = target : target form element의 값을 가져옴\n
|
||||
* concat = str1,str2,target2... : 값들의 string 또는 form element value를 연결\n
|
||||
* \n
|
||||
* - response\n
|
||||
* tag = key : return받을 결과값의 변수명\n
|
||||
**/
|
||||
|
||||
class XmlJsFilter {
|
||||
var $compiled_path = './files/js_filter_compiled/'; ///< 컴파일된 캐시 파일이 놓일 위치
|
||||
|
|
@ -74,25 +76,33 @@
|
|||
$oXml = new XmlParser();
|
||||
$xml_obj = $oXml->parse($buff);
|
||||
|
||||
// XmlJsFilter는 filter_id, field, parameter 3개의 데이터를 핸들링
|
||||
$filter_id = $xml_obj->filter->attrs->id;
|
||||
// XmlJsFilter는 filter_name, field, parameter 3개의 데이터를 핸들링
|
||||
$filter_name = $xml_obj->filter->attrs->name;
|
||||
$confirm_msg_code = $xml_obj->filter->attrs->confirm_msg_code;
|
||||
$field_item = $xml_obj->filter->field->item;
|
||||
$parameter_item = $xml_obj->filter->parameter->item;
|
||||
$response_item = $xml_obj->filter->response->item;
|
||||
$module = $xml_obj->filter->attrs->module;
|
||||
$method_name = $xml_obj->filter->attrs->method_name;
|
||||
|
||||
$field_node = $xml_obj->filter->form->node;
|
||||
|
||||
$parameter_param = $xml_obj->filter->parameter->param;
|
||||
|
||||
$response_tag = $xml_obj->filter->response->tag;
|
||||
|
||||
$callback_func = $xml_obj->filter->response->attrs->callback_func;
|
||||
if(!$callback_func) $callback_func = "filterAlertMessage";
|
||||
|
||||
// 언어 입력을 위한 사용되는 필드 조사
|
||||
$target_list = array();
|
||||
|
||||
// js function 을 만들기 시작
|
||||
$js_doc = sprintf("function %s(fo_obj, callback_user_func) {\n", $filter_id);
|
||||
$js_doc .= "\tvar oFilter = new XmlJsFilter(fo_obj, callback_user_func);\n";
|
||||
$js_doc = sprintf("function %s(fo_obj) {\n", $filter_name);
|
||||
$js_doc .= sprintf("\tvar oFilter = new XmlJsFilter(fo_obj, \"%s\", \"%s\", %s);\n", $module, $method_name, $callback_func);
|
||||
|
||||
// field, 즉 체크항목의 script 생성
|
||||
$field_cnt = count($field_item);
|
||||
if($field_cnt) {
|
||||
foreach($field_item as $key =>$field_obj) {
|
||||
$attrs = $field_obj->attrs;
|
||||
$node_count = count($field_node);
|
||||
if($node_count) {
|
||||
foreach($field_node as $key =>$node) {
|
||||
$attrs = $node->attrs;
|
||||
$target = trim($attrs->target);
|
||||
if(!$target) continue;
|
||||
$required = $attrs->required=='true'?'true':'false';
|
||||
|
|
@ -111,26 +121,26 @@
|
|||
}
|
||||
|
||||
// 데이터를 만들기 위한 parameter script 생성
|
||||
$parameter_cnt = count($parameter_item);
|
||||
if($parameter_cnt) {
|
||||
foreach($parameter_item as $key =>$parameter_obj) {
|
||||
$attrs = $parameter_obj->attrs;
|
||||
$param = trim($attrs->param);
|
||||
$parameter_count = count($parameter_param);
|
||||
if($parameter_count) {
|
||||
foreach($parameter_param as $key =>$param) {
|
||||
$attrs = $param->attrs;
|
||||
$name = trim($attrs->name);
|
||||
$target = trim($attrs->target);
|
||||
if(!$param || !$target) continue;
|
||||
if(!$name || !$target) continue;
|
||||
$target = htmlentities($target,ENT_QUOTES);
|
||||
$js_doc .= sprintf(
|
||||
"\toFilter.addParameterItem(\"%s\",\"%s\");\n",
|
||||
$param, $target
|
||||
$name, $target
|
||||
);
|
||||
if(!in_array($param, $target_list)) $target_list[] = $param;
|
||||
if(!in_array($name, $target_list)) $target_list[] = $name;
|
||||
}
|
||||
}
|
||||
|
||||
// response script 생성
|
||||
$response_cnt = count($response_item);
|
||||
for($i=0;$i<$response_cnt;$i++) {
|
||||
$attrs = $response_item[$i]->attrs;
|
||||
$response_count = count($response_tag);
|
||||
for($i=0;$i<$response_count;$i++) {
|
||||
$attrs = $response_tag[$i]->attrs;
|
||||
$name = $attrs->name;
|
||||
$js_doc .= sprintf("\toFilter.addResponseItem(\"%s\");\n", $name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,15 @@
|
|||
**/
|
||||
|
||||
// xml handler을 이용하는 user function
|
||||
function exec_xml(method_name, act, params, callback_func, response_tags, callback_func_arg) {
|
||||
function exec_xml(module, act, params, callback_func, response_tags, callback_func_arg) {
|
||||
var oXml = new xml_handler();
|
||||
oXml.reset();
|
||||
oXml.setMethod(method_name);
|
||||
oXml.addParam('act', act);
|
||||
for(var key in params) {
|
||||
var val = params[key];
|
||||
oXml.addParam(key, val);
|
||||
}
|
||||
oXml.addParam('module', module);
|
||||
oXml.addParam('act', act);
|
||||
|
||||
var waiting_obj = document.getElementById('waitingforserverresponse');
|
||||
waiting_obj.style.visibility = 'visible';
|
||||
|
|
@ -49,7 +49,6 @@ function xml_handler() {
|
|||
this.getXmlHttp = zGetXmlHttp;
|
||||
this.request = xml_handlerRequest;
|
||||
this.setPath = xml_handlerSetPath;
|
||||
this.setMethod = xml_handlerSetMethod;
|
||||
this.addParam = xml_handlerAddParam;
|
||||
this.getResponseXml = xml_handlerGetResponseXML;
|
||||
this.toZMsgObject = xml_handlerToZMsgObject;
|
||||
|
|
@ -74,7 +73,6 @@ function xml_handlerRequest(callBackFunc, xmlObj, callBackFunc2, response_tags,
|
|||
var rd = "";
|
||||
rd += "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
|
||||
+ "<methodCall>\n"
|
||||
+ "<methodName>"+this.method_name+"</methodName>\n"
|
||||
+ "<params>\n"
|
||||
|
||||
for (var key in this.params) {
|
||||
|
|
@ -97,9 +95,6 @@ function xml_handlerSetPath(path) {
|
|||
this.xml_path = "./"+path;
|
||||
}
|
||||
|
||||
function xml_handlerSetMethod(method_name) {
|
||||
this.method_name = method_name;
|
||||
}
|
||||
|
||||
function xml_handlerReset() {
|
||||
this.obj_xmlHttp = this.getXmlHttp();
|
||||
|
|
|
|||
|
|
@ -6,16 +6,23 @@
|
|||
|
||||
var alertMsg = new Array();
|
||||
|
||||
// filtering
|
||||
function XmlJsFilter(form_object, callback_user_func) {
|
||||
function filterAlertMessage(ret_obj) {
|
||||
var error = ret_obj["error"];
|
||||
var message = ret_obj["message"];
|
||||
if(typeof(message)!='undefined'&&message) alert(message);
|
||||
location.href = location.href;
|
||||
}
|
||||
|
||||
// filtering
|
||||
function XmlJsFilter(form_object, module, act, callback_user_func) {
|
||||
|
||||
this.fo_obj = null;
|
||||
this.user_func = null;
|
||||
this.field = new Array();
|
||||
this.parameter = new Array();
|
||||
this.response = new Array();
|
||||
|
||||
this.fo_obj = form_object;
|
||||
this.module = module;
|
||||
this.act = act;
|
||||
this.user_func = callback_user_func;
|
||||
|
||||
this.addFieldItem = XmlJsFilterAddFieldItem;
|
||||
|
|
@ -210,21 +217,19 @@ function XmlJsFilterProc(confirm_msg) {
|
|||
|
||||
var params = this.getParameterParam();
|
||||
var response = this.response;
|
||||
var mid = params['mid'];
|
||||
var act = params['act'];
|
||||
|
||||
if(confirm_msg && !confirm(confirm_msg)) return false;
|
||||
|
||||
if(!act) {
|
||||
if(!this.act) {
|
||||
this.user_func(this.fo_obj, params);
|
||||
return true;
|
||||
}
|
||||
|
||||
exec_xml(mid, act, params, this.user_func, response, params);
|
||||
exec_xml(this.module, this.act, params, this.user_func, response, params);
|
||||
}
|
||||
|
||||
// form proc
|
||||
function procFormFilter(fo_obj, filter_func, user_func) {
|
||||
filter_func(fo_obj, user_func);
|
||||
function procFilter(fo_obj, filter_func) {
|
||||
filter_func(fo_obj);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<filter id="install_filter" method="doInstall">
|
||||
<filter name="install" module="install" method_name="doInstall">
|
||||
<form>
|
||||
<node target="db_type" required="true" />
|
||||
<node target="db_hostname" required="true" minlength="1" maxlength="250" />
|
||||
|
|
@ -14,21 +14,21 @@
|
|||
<node target="email_address" required="true" minlength="1" maxlength="200" filter="email"/>
|
||||
</form>
|
||||
<parameter>
|
||||
<param param="mid" target="mid" />
|
||||
<param param="act" target="act" />
|
||||
<param param="db_type" target="db_type" />
|
||||
<param param="db_hostname" target="db_hostname" />
|
||||
<param param="db_userid" target="db_userid" />
|
||||
<param param="db_password" target="db_password" />
|
||||
<param param="db_database" target="db_database" />
|
||||
<param param="db_table_prefix" target="db_table_prefix" />
|
||||
<param param="user_id" target="user_id" />
|
||||
<param param="password" target="password1" />
|
||||
<param param="user_name" target="user_name" />
|
||||
<param param="nick_name" target="nick_name" />
|
||||
<param param="email_address" target="email_address" />
|
||||
<param name="mid" target="mid" />
|
||||
<param name="act" target="act" />
|
||||
<param name="db_type" target="db_type" />
|
||||
<param name="db_hostname" target="db_hostname" />
|
||||
<param name="db_userid" target="db_userid" />
|
||||
<param name="db_password" target="db_password" />
|
||||
<param name="db_database" target="db_database" />
|
||||
<param name="db_table_prefix" target="db_table_prefix" />
|
||||
<param name="user_id" target="user_id" />
|
||||
<param name="password" target="password1" />
|
||||
<param name="user_name" target="user_name" />
|
||||
<param name="nick_name" target="nick_name" />
|
||||
<param name="email_address" target="email_address" />
|
||||
</parameter>
|
||||
<response>
|
||||
<response callback_func="installCompleted">
|
||||
<tag name="error" />
|
||||
<tag name="message" />
|
||||
</response>
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<!--%import("js/install.js")-->
|
||||
<!--%import("filter/filter.mysql_form.xml")-->
|
||||
<!--%import("filter/mysql.xml")-->
|
||||
|
||||
<form action="./" method="post" onsubmit="return procFormFilter(this, install_filter, procInstall)">
|
||||
<form action="./" method="post" onsubmit="return procFilter(this, install)">
|
||||
<input type="hidden" name="db_type" value="{$db_type}" />
|
||||
<table border="1">
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,15 @@
|
|||
function procInstall(ret_obj) {
|
||||
/**
|
||||
* @file install.js
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief 초기 설치시 사용되는 script file
|
||||
**/
|
||||
|
||||
/**
|
||||
* @function installCompleted
|
||||
* @param ret_obj ajax로 서버 call을 한후 return 받는 변수명
|
||||
* @brief 설치 성공 후 서버에서 보내주는 메세지를 출력한 후 / 로 redirect
|
||||
**/
|
||||
function installCompleted(ret_obj) {
|
||||
var error = ret_obj["error"];
|
||||
var message = ret_obj["message"];
|
||||
alert(message);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue