#274 위젯에서도 애드온/모듈의 설정에서 쓰이는 태그명으로 쓸수 있도록 하였습니다. 다만 기존에 제작된 것들을 위해서 id vs name attribute, name vs title tagname을 같이 쓸 수 있도록 하였습니다

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3513 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-09 05:17:06 +00:00
parent 3b2b9b2265
commit bd0ae1daef

View file

@ -94,7 +94,8 @@
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
if(!is_array($xml_obj->extra_vars->var)) $extra_vars[] = $xml_obj->extra_vars->var;
else $extra_vars = $xml_obj->extra_vars->var;
if($extra_vars[0]->attrs->id) {
if($extra_vars[0]->attrs->id || $extra_vars[0]->attrs->name) {
$extra_var_count = count($extra_vars);
$buff .= sprintf('$widget_info->extra_var_count = "%s";', $extra_var_count);
@ -103,10 +104,14 @@
unset($options);
$var = $extra_vars[$i];
$buff .= sprintf('$widget_info->extra_var->%s->name = "%s";', $var->attrs->id, $var->name->body);
$buff .= sprintf('$widget_info->extra_var->%s->type = "%s";', $var->attrs->id, $var->type->body);
$buff .= sprintf('$widget_info->extra_var->%s->value = $vars->%s;', $var->attrs->id, $var->attrs->id);
$buff .= sprintf('$widget_info->extra_var->%s->description = "%s";', $var->attrs->id, str_replace('"','\"',$var->description->body));
$id = $var->attrs->id?$var->attrs->id:$var->attrs->name;
$name = $var->name->body?$var->name->body:$var->title->body;
$type = $var->attrs->type?$var->attrs->type:$var->type->body;
$buff .= sprintf('$widget_info->extra_var->%s->name = "%s";', $id, $name);
$buff .= sprintf('$widget_info->extra_var->%s->type = "%s";', $id, $type);
$buff .= sprintf('$widget_info->extra_var->%s->value = $vars->%s;', $id, $id);
$buff .= sprintf('$widget_info->extra_var->%s->description = "%s";', $id, str_replace('"','\"',$var->description->body));
$options = $var->options;
if(!$options) continue;
@ -114,7 +119,7 @@
if(!is_array($options)) $options = array($options);
$options_count = count($options);
for($j=0;$j<$options_count;$j++) {
$buff .= sprintf('$widget_info->extra_var->%s->options["%s"] = "%s";', $var->attrs->id, $options[$j]->value->body, $options[$j]->name->body);
$buff .= sprintf('$widget_info->extra_var->%s->options["%s"] = "%s";', $id, $options[$j]->value->body, $options[$j]->name->body);
}
}