You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
145 lines
3.5 KiB
145 lines
3.5 KiB
{include file="pageheader.htm"}
|
|
<div class="main-div">
|
|
<form action="attribute.php" method="post" name="theForm" enctype="multipart/form-data" onsubmit="return validate();">
|
|
<table width="100%" id="general-table">
|
|
<tr>
|
|
<td class="label">{$lang.label_attr_name}</td>
|
|
<td>{$attr_name}</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="label">{$lang.label_attr_values}</td>
|
|
<td></td>
|
|
</tr>
|
|
{if $attr_values}
|
|
{foreach from=$attr_values item=attr key=key}
|
|
<tr>
|
|
<td class="label">{$attr.values}</td>
|
|
<td><input name="attr_img_{$key}" type="file" />
|
|
{if $attr.attr_img}
|
|
<a href="../{$attr.attr_img}" target="_blank">查看</a>
|
|
{/if}
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="label" style="border-bottom:1px #e2e2e2 solid; height:27px; vertical-align:middle">外链地址</td>
|
|
<td style="border-bottom:1px #e2e2e2 solid; height:27px;"><input name="attr_site_{$key}" value="{$attr.attr_site}" type="text" size="60" />
|
|
</td>
|
|
</tr>
|
|
{/foreach}
|
|
{/if}
|
|
<tr>
|
|
<td colspan="2">
|
|
<div class="button-div">
|
|
<input type="submit" value="{$lang.button_submit}" class="button"/>
|
|
<input type="reset" value="{$lang.button_reset}" class="button" />
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<input type="hidden" name="act" value="{$form_act}" />
|
|
<input type="hidden" name="attr_id" value="{$attr_id}" />
|
|
<input type="hidden" name="attr_name" value="{$attr_name}" />
|
|
</form>
|
|
</div>
|
|
{insert_scripts files="../js/utils.js,validator.js"}
|
|
{literal}
|
|
<script language="JavaScript">
|
|
<!--
|
|
onload = function()
|
|
{
|
|
{/literal}
|
|
radioClicked({$attr.attr_input_type});
|
|
onChangeGoodsType({$attr.cat_id});
|
|
// 开始检查订单
|
|
startCheckOrder();
|
|
{literal}
|
|
}
|
|
|
|
/**
|
|
* 检查表单输入的数据
|
|
*/
|
|
function validate()
|
|
{
|
|
var ele = document.forms['theForm'].elements;
|
|
var msg = '';
|
|
|
|
if (Utils.trim(ele['attr_name'].value) == '')
|
|
{
|
|
msg += name_not_null + '\n';
|
|
}
|
|
|
|
if (ele['cat_id'].value == 0)
|
|
{
|
|
msg += cat_id_not_null + '\n';
|
|
}
|
|
|
|
if (ele['attr_input_type'][1].checked && Utils.trim(ele['attr_values'].value) == '')
|
|
{
|
|
msg += values_not_null + '\n';
|
|
}
|
|
|
|
if (msg.length > 0)
|
|
{
|
|
alert(msg);
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 点击类型按钮时切换选项的禁用状态
|
|
*/
|
|
function radioClicked(n)
|
|
{
|
|
document.forms['theForm'].elements["attr_values"].disabled = n > 0 ? false : true;
|
|
}
|
|
|
|
/**
|
|
* 改变商品类型的处理函数
|
|
*/
|
|
function onChangeGoodsType(catId)
|
|
{
|
|
Ajax.call('attribute.php?act=get_attr_groups&cat_id=' + catId, '', changeGoodsTypeResponse, 'GET', 'JSON');
|
|
}
|
|
|
|
function changeGoodsTypeResponse(res)
|
|
{
|
|
if (res.error == 0)
|
|
{
|
|
var row = document.getElementById('attrGroups');
|
|
if (res.content.length == 0) {
|
|
row.style.display = 'none';
|
|
} else {
|
|
row.style.display = document.all ? 'block' : 'table-row';
|
|
|
|
var sel = document.forms['theForm'].elements['attr_group'];
|
|
|
|
sel.length = 0;
|
|
|
|
for (var i = 0; i < res.content.length; i++)
|
|
{
|
|
var opt = document.createElement('OPTION');
|
|
opt.value = i;
|
|
opt.text = res.content[i];
|
|
sel.options.add(opt);
|
|
if (i == '{$attr.attr_group}')
|
|
{
|
|
opt.selected=true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (res.message)
|
|
{
|
|
alert(res.message);
|
|
}
|
|
}
|
|
|
|
//-->
|
|
</script>
|
|
{/literal}
|
|
{include file="pagefooter.htm"}
|
|
|