<!-- $Id: attribute_info.htm 5294 2007-02-07 03:13:12Z paulgao $ -->
{include file="pageheader.htm"}
<div class="main-div">
  <form action="attribute.php"  method="post" name="theForm" onsubmit="return validate();">
  <table width="100%" id="general-table">
      <tr>
        <td class="label">{$lang.label_attr_name}</td>
        <td>
          <input type='text' name='attr_name' value="{$attr.attr_name}" size='30' />
          {$lang.require_field}
        </td>
      </tr>
      <tr>
        <td class="label">{$lang.label_cat_id}</td>
        <td>
          <select name="cat_id">
          <option value="0">{$lang.select_please}</option>
            {$goods_type_list}
          </select> {$lang.require_field}
        </td>
      </tr>
      <tr>
        <td class="label"><a href="javascript:showNotice('noticeindex');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.label_attr_index}</td>
        <td>
          <input type="radio" name="attr_index" value="0" {if $attr.attr_index eq 0} checked="true" {/if} />
          {$lang.no_index}
          <input type="radio" name="attr_index" value="1" {if $attr.attr_index eq 1} checked="true" {/if} />
          {$lang.keywords_index}
          <input type="radio" name="attr_index" value="2" {if $attr.attr_index eq 2} checked="true" {/if} />
          {$lang.range_index}
          <br /><span class="notice-span" id="noticeindex">{$lang.note_attr_index}</span>
        </td>
      </tr>
      <tr>
        <td class="label">{$lang.label_is_linked}</td>
        <td>
          <input type="radio" name="is_linked" value="0" {if $attr.is_linked eq 0} checked="true" {/if} /> {$lang.no}
          <input type="radio" name="is_linked" value="1" {if $attr.is_linked eq 1} checked="true" {/if} /> {$lang.yes}
        </td>
      </tr>
      <tr>
        <td class="label">{$lang.label_attr_select}</td>
        <td>
          <input type="radio" name="attr_select" value="0" {if $attr.attr_select eq 0} checked="true" {/if} onclick="radioClicked(0)"/>
          {$lang.text}
          <input type="radio" name="attr_select" value="1" {if $attr.attr_select eq 1} checked="true" {/if} onclick="radioClicked(1)"/>
          {$lang.select}
          <input type="radio" name="attr_select" value="2" {if $attr.attr_select eq 2} checked="true" {/if} onclick="radioClicked(0)"/>
          {$lang.text_area}
        </td>
      </tr>
        <tr>
          <td class="label">{$lang.label_attr_values}</td>
          <td>
            <textarea name="attr_values" cols="30" rows="5">{$attr.attr_values}</textarea>
          </td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><input name="attr_type" type="checkbox" id="attr_type" value="1" {if $attr.attr_type eq 1}checked{/if} />
          {$lang.label_attr_type}</td>
        </tr>
      <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.attr_id}" />
  </form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{literal}
<script language="JavaScript">
<!--
onload = function()
{
{/literal}
  radioClicked({$attr.attr_select});
  // 开始检查订单
  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_select'][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;
}
//-->
</script>
{/literal}
{include file="pagefooter.htm"}