<!-- $Id: payment_edit.htm 14401 2008-04-15 02:41:32Z zhuwenyuan $ -->
{include file="pageheader.htm"}
{insert_scripts files="../js/utils.js,validator.js"}
<form action="payment.php" method="post" enctype="multipart/form-data">
<div class="main-div">
<table cellspacing="1" cellpadding="3" width="100%">
  <tr>
    <td class="label">{$lang.payment_name}</td>
    <td><input name="pay_name" type="text" value="{$pay.pay_name|escape}" size="40" /></td>
  </tr>
  <tr>
    <td class="label">{$lang.payment_desc}</td>
    <td><textarea name="pay_desc" cols="60" rows="8">{$pay.pay_desc|escape}</textarea></td>
  </tr>
  {foreach from=$pay.pay_config item=config key=key}
  <tr>
    <td class="label">
      {if $config.desc && $pay.pay_code!='yunqi'}
      <a href="javascript:showNotice('notice{$config.name}');" title="{$lang.form_notice}"><img src="images/notice.svg" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>
      {/if}
      {if $pay.pay_code == 'upop'}
        {if $config.name == 'upop_cert'}
        <span class="label" id="upop_cert">{$config.label}
        {elseif $config.name == 'upop_cert_pwd'}
        <span class="label" id="upop_cert_pwd">{$config.label}
        {else}
        <span class="label">{$config.label}
        {/if}
      {else}
        <span class="label">{$config.label}
      {/if}
    </td>
    <td>
      <!-- {if $config.type == "text"} -->
      <input name="cfg_value[]" type="{$config.type}" value="{$config.value}" size="40" /><br />
      <!-- {elseif $config.type == "textarea"} -->
      <textarea name="cfg_value[]" cols="80" rows="5">{$config.value}</textarea><br />
      <!-- {elseif $config.type == "select"} -->
      <select id="config_select" name="cfg_value[]">{html_options options=$config.range selected=$config.value}</select><br />
      <!-- {elseif $config.type == "file"} -->
          <input type="hidden" name="cfg_value[]" value="{$config.value}">
          <input type="file" id="config_file" name="{$config.name}">
      <!-- {/if} -->
      <input name="cfg_name[]" type="hidden" value="{$config.name}" />
      <input name="cfg_type[]" type="hidden" value="{$config.type}" />
      <input name="cfg_lang[]" type="hidden" value="{$config.lang}" />
      {if $config.desc}
      <span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="notice{$config.name}">{$config.desc}</span>
      {/if}
      
      <!--the tenpay code -->
      {if $key eq "0"}
      {if $smarty.get.code eq "tenpay"}<input align=""type="button" value="{$lang.ctenpay}" onclick="javascript:window.open('{$lang.ctenpay_url}')"/>
      {elseif $smarty.get.code eq "tenpayc2c"} <input align=""type="button" value="{$lang.ctenpay}" onclick="javascript:window.open('{$lang.ctenpayc2c_url}')"/>
      {/if}
      
      {/if}
      <!--the tenpay code -->
    </td>
  </tr>
  {/foreach}
  <tr>
    <td class="label">{$lang.pay_fee}</td>
    <td>{if $pay.is_cod }<input name="pay_fee" type="hidden" value="{$pay.pay_fee|default:0}" />{$lang.decide_by_ship}
        {else}<input name="pay_fee" type="text" value="{$pay.pay_fee|default:0}" />{/if}
    </td>

  </tr>
  <tr>
    <td class="label">{$lang.payment_is_cod}</td>
    <td>{if $pay.is_cod == "1"}{$lang.yes}{else}{$lang.no}{/if}</td>
  </tr>
  <tr>
    <td class="label">{$lang.payment_is_online}</td>
    <td>{if $pay.is_online == "1"}{$lang.yes}{else}{$lang.no}{/if}</td>
  </tr>
  <tr align="center">
    <td colspan="2">
      <input type="hidden"  name="pay_id"       value="{$pay.pay_id}" />
      <input type="hidden"  name="pay_code"     value="{$pay.pay_code}" />
      <input type="hidden"  name="is_cod"       value="{$pay.is_cod}" />
      <input type="hidden"  name="is_online"    value="{$pay.is_online}" />
      <input type="submit" class="button" name="Submit"       value="{$lang.button_submit}" />
      <input type="reset" class="button"  name="Reset"        value="{$lang.button_reset}" />
    </td>
  </tr>
</table>
</div>
</form>
<script type="Text/Javascript" language="JavaScript">
<!--
{literal}
onload = function()
{
    // 开始检查订单
    startCheckOrder();
    var pay_code = '{$pay.pay_code}';
    if (pay_code == 'upop') {
      var configSelect = document.getElementById('config_select');
      var selectedIndex = config_select.selectedIndex;
      var optionsVal = configSelect.options[selectedIndex].value;
      // alert(optionsVal);
      var configFile = document.getElementById('config_file');
      var upopCert = document.getElementById('upop_cert');
      var upopCertPwd = document.getElementById('upop_cert_pwd');
      // 密钥方式隐藏证书文件
      if (optionsVal == 1) {
        configFile.style.display = 'none';
        upopCert.style.display = 'none';
        upopCertPwd.innerText = '商户密钥';
      }
      configSelect.onchange=function(){
        var selectedIndex = config_select.selectedIndex;
        var optionsVal = configSelect.options[selectedIndex].value;
        // alert(optionsVal);
        if (optionsVal == 1) {
          configFile.style.display = 'none';
          upopCert.style.display = 'none';
          upopCertPwd.innerText = '商户密钥';
        } else {
          configFile.style.display = 'inline';
          upopCert.style.display = 'inline';
          upopCertPwd.innerHTML = '签名证书密码';
        }
      }
    }
}
{/literal}
//-->
</script>
{include file="pagefooter.htm"}