r8070 보완 - radio 타입추가

- options 노드에 src 속성에 thumbnail 지정할 수 있도록 추가

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@8072 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
bnu 2011-02-02 10:18:53 +00:00
parent b9dac8fad5
commit 64e2f2a4c1
2 changed files with 43 additions and 5 deletions

View file

@ -220,8 +220,21 @@
if(!is_array($options)) $options = array($options);
$options_count = count($options);
for($j=0;$j<$options_count;$j++) {
$buff .= sprintf('$layout_info->extra_var->%s->options["%s"] = "%s";', $var->attrs->name, $options[$j]->attrs->value, $options[$j]->title->body);
$thumbnail_exist = false;
for($j=0; $j < $options_count; $j++) {
$thumbnail = $options[$j]->attrs->src;
if($thumbnail) {
$thumbnail = $layout_path.$thumbnail;
if(file_exists($thumbnail)) {
$buff .= sprintf('$layout_info->extra_var->%s->options["%s"]->thumbnail = "%s";', $var->attrs->name, $options[$j]->attrs->value, $thumbnail);
if(!$thumbnail_exist) {
$buff .= sprintf('$layout_info->extra_var->%s->thumbnail_exist = true;', $var->attrs->name);
$thumbnail_exist = true;
}
}
}
$buff .= sprintf('$layout_info->extra_var->%s->options["%s"]->val = "%s";', $var->attrs->name, $options[$j]->attrs->value, $options[$j]->title->body);
}
}
}

View file

@ -97,11 +97,36 @@
<!--@elseif($var->type == "select")-->
<select name="{$name}">
<!--@foreach($var->options as $key => $val)-->
<option value="{$key}" <!--@if($key==$var->value)-->selected="selected"<!--@end-->>{$val}</option>
<option value="{$key}" <!--@if($key==$var->value)-->selected="selected"<!--@end-->>{$val->val}</option>
<!--@end-->
</select>
<!--@end-->
<p>{$var->description}</p>
<!--@elseif($var->type == "radio")-->
<!--@foreach($var->options as $key => $val)-->
<!--@if($val->thumbnail)-->
{@ $_img_info = getImageSize($val->thumbnail); $_height = $_img_info[1]+40; $_width = $_img_info[0]+20; $_talign = "center"; }
<!--@else-->
{@ $_width = 200; $_height = 20; $_talign = "left"; }
<!--@end-->
<!--@if($var->thumbnail_exist)-->
<div style="float:left;text-align:{$_talign};margin-bottom:1em;width:{$_width}px;height:{$_height}px;margin-right:10px;">
<!--@endif-->
<label>
<input type="radio" name="colorset" value="{$key}" /> {$val->val}
<!--@if($val->thumbnail)-->
<br />
<img src="../../../{$val->thumbnail}" alt="{$val->val}" style="border:1px solid #888888;padding:2px;margin:2px;"/>
<!--@endif-->
</label>
<!--@if($var->thumbnail_exist)-->
</div>
<!--@endif-->
<!--@endforeach-->
<!--@endif-->
<p style="clear:both;">{$var->description}</p>
</td>
</tr>
<!--@end-->