#275 addon모듈의 확장변수 입력 방식 다양화

- mid_list, select, textarea 타입 추가.
- 기존 호환성을 위해 type이 설정되어 있지 않을 경우 기본 값 'text'

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3261 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
bnu 2007-12-07 18:25:40 +00:00
parent f3e6d2843a
commit 364f7acef0
3 changed files with 51 additions and 6 deletions

View file

@ -18,7 +18,7 @@
**/
function getAddonPath($addon_name) {
$class_path = sprintf('./addons/%s/', $addon_name);
if(is_dir($class_path)) return $class_path;
if(is_dir($class_path)) return $class_path;
return "";
}
@ -95,7 +95,7 @@
$addon_info->author->date = $xml_obj->author->attrs->date;
$addon_info->author->description = trim($xml_obj->author->description->body);
// history
// history
if(!is_array($xml_obj->history->author)) $history[] = $xml_obj->history->author;
else $history = $xml_obj->history->author;
@ -123,10 +123,25 @@
foreach($extra_vars as $key => $val) {
unset($obj);
if(!$val->type->body) { $val->type->body = 'text'; }
$obj->name = $val->attrs->name;
$obj->title = $val->title->body;
$obj->type = $val->type->body;
$obj->description = $val->description->body;
$obj->value = $extra_vals->{$obj->name};
if(strpos($obj->value, '|@|') != 0) { $obj->value = explode('|@|', $obj->value); }
// 'select'type에서 option목록을 구한다.
if(is_array($val->options)) {
$option_count = count($val->options);
for($i = 0; $i < $option_count; $i++) {
$obj->options[$i]->title = $val->options[$i]->title->body;
$obj->options[$i]->value = $val->options[$i]->value->body;
}
}
$addon_info->extra_vars[] = $obj;
}
}

View file

@ -39,6 +39,11 @@
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon);
Context::set('addon_info', $addon_info);
// mid 목록을 가져옴
$oModuleModel = &getModel('module');
$mid_list = $oModuleModel->getMidList();
Context::set('mid_list', $mid_list);
// 레이아웃을 팝업으로 지정
$this->setLayoutFile('popup_layout');

View file

@ -24,12 +24,37 @@
<td><a href="{$addon_info->author->homepage}" onclick="window.open(this.href);return false;">{$addon_info->author->homepage}</a></td>
</tr>
<!--@foreach($addon_info->extra_vars as $key => $val)-->
<!--@foreach($addon_info->extra_vars as $id => $var)-->
<tr>
<th scope="row">{$val->title}</th>
<th scope="row">
{$var->title}
<!--@if($var->type == 'mid_list')-->
<input type="checkbox" onclick="checkboxSelectAll(this.form, '{$var->name}'); return false;" />
<!--@end-->
</th>
<td>
<input type="text" name="{$val->name}" value="{$val->value}" class="inputTypeText w400" />
<!--@if($val->description)--><p>{$val->description}</p><!--@end-->
<!--@if($var->type == 'text')-->
<input type="text" name="{$var->name}" value="{$var->value}" class="inputTypeText w400" />
<!--@elseif($var->type == 'textarea')-->
<textarea name="{$var->name}" class="inputTypeTextArea">{$var->value}</textarea>
<!--@elseif($var->type == 'select')-->
<select name="{$var->name}">
<!--@foreach($var->options as $val)-->
<option value="{$val->value}"<!--@if($var->value == $val->value)--> selected="selected"<!--@end-->>{$val->title}</option>
<!--@end-->
</select>
<!--@elseif($var->type == 'mid_list')-->
<!--@foreach($mid_list as $key => $val)-->
<div class="addon_mid_list">
<input type="checkbox" value="{$key}" name="{$var->name}" id="chk_mid_list_{$key}" <!--@if(in_array($key, $var->value))-->checked="checkde" <!--@end-->/>
<label for="chk_mid_list_{$key}">{$key} ({$val->browser_title})</label>
</div>
<!--@end-->
<!--@end-->
<p class="clear">{nl2br($var->description)}</p>
</td>
</tr>
<!--@end-->