{include file="page_header.htm"}
{insert_scripts files="../js/utils.js"}

<form enctype="multipart/form-data" name="theForm" action="setting.php" method="post">
    {foreach from=$setting item=group name="body_group"}
    <table width="100%" id="{$group.code}-table" {if $smarty.foreach.body_group.iteration neq 1}style="display:none"{/if} border="0" cellspacing="0" cellpadding="0" class="table_form">
      {foreach from=$group.vars item=var}
      <tr>
	    {if $var.code != 'start_image'}
        <td class="label">
        {if $var.code == 'mail_type'} 
		<a href="#" title="如果您选择了采用服务器内置的 Mail 服务，您不需要填写下面的内容" style="margin-right:5px;" ><img src="images/help.gif" border="0" alt=""/></a>
		{elseif $var.code == 'smtp_host'}
		<a href="#" title="邮件服务器主机地址。如果本机可以发送邮件则设置为localhost" style="margin-right:5px;" ><img src="images/help.gif" border="0" alt=""/></a>
		{elseif $var.code == 'smtp_port'}
		{elseif $var.code == 'smtp_user'}
		<a href="#" title="发送邮件所需的认证帐号，如果没有就为空着" style="margin-right:5px;" ><img src="images/help.gif" border="0" alt=""/></a>
		{elseif $var.code == 'smtp_pass'}
		<a href="#" title="发送邮箱的密码" style="margin-right:5px;" ><img src="images/help.gif" border="0" alt=""/></a>
		{elseif $var.code == 'smtp_mail'}
		<a href="#" title="客户收到邮件后，回复邮件的地址" style="margin-right:5px;" ><img src="images/help.gif" border="0" alt=""/></a>
		{elseif $var.code == 'weburl'}
		<a href="#" title="访问手机网站域名地址" style="margin-right:5px;" ><img src="images/help.gif" border="0" alt=""/></a>
		{/if}
		
		 {$var.title}:
        </td>
		{/if}
        <td>
          {if $var.type eq "text"}
          <input name="value[{$var.id}]" id="{$var.code}" type="text" value="{$var.value}" size="40" class="FormSmall" />

          {elseif $var.type eq "password"}
          <input name="value[{$var.id}]" id="{$var.code}" type="password" value="{$var.value}" size="40" class="FormSmall" />

          {elseif $var.type eq "textarea"}
			  {if $var.code == 'start_image'}
				<table cellspacing="0" cellpadding="0" border="0" width="100%">
				<tr>
				<td align="center" style="border:none;"><img src="images/b_image1.png" border="0" /></td>
				<td align="center" style="border:none;"><img src="images/b_image2.png" border="0" /></td>
				<td align="center" style="border:none;"><img src="images/b_image3.png" border="0" /></td>
				</tr>
				<tr> 
					<td width="33%" style="height:482px;"><div id="file_box_{$var.code}_1" style="width:238px;height:422px;border:1px solid #BCBCBC;padding:3px;">
					{if $var.value.image1 neq ""}
						<a href="../{$var.value.image1}" target="_blank"><img width="238" height="422" src="../{$var.value.image1}" border="0"  /></a>
						<div style="padding-top:5px;text-align:center;">
						{literal}
						<a href="javascript:;" onclick="if(confirm('您确实要删除吗?')){drop_file('{/literal}{$var.code}_1{literal}');}">删除</a>
						{/literal}
						</div>
					{/if}
					</div></td>
					<td width="33%" style="height:482px;"><div id="file_box_{$var.code}_2" style="width:238px;height:422px;border:1px solid #BCBCBC;padding:3px;">
					{if $var.value.image2 neq ""}
						<a href="../{$var.value.image2}" target="_blank"><img width="238" height="422" src="../{$var.value.image2}" border="0"  /></a>
						<div style="padding-top:5px;text-align:center;">
						{literal}
						<a href="javascript:;" onclick="if(confirm('您确实要删除吗?')){drop_file('{/literal}{$var.code}_2{literal}');}">删除</a>
						{/literal}
						</div>
					{/if}
					</div></td>
					<td width="33%" style="height:482px;"><div id="file_box_{$var.code}_3" style="width:238px;height:422px;border:1px solid #BCBCBC;padding:3px;">
					{if $var.value.image3 neq ""}
						<a href="../{$var.value.image3}" target="_blank"><img width="238" height="422" src="../{$var.value.image3}" border="0"  /></a>
						<div style="padding-top:5px;text-align:center;">
						{literal}
						<a href="javascript:;" onclick="if(confirm('您确实要删除吗?')){drop_file('{/literal}{$var.code}_3{literal}');}">删除</a>
						{/literal}
						</div>
					{/if}
					</div></td>
				</tr>
				<tr>
					<td style="border:none;">
						<input name="value[{$var.id}][image1]" type="hidden" value="{$var.value.image1}" id="file_{$var.code}_1" />
						<input class="start_image" id="upload_file_1" name="upload_file_1" type="file" ref="{$var.code}_1" />
						建议图标尺寸：640*960，仅支持png
					</td>
					<td style="border:none;">
					<input name="value[{$var.id}][image2]" type="hidden" value="{$var.value.image2}" id="file_{$var.code}_2" />
					<input class="start_image" id="upload_file_2" name="upload_file_2" type="file" ref="{$var.code}_2" />
					建议图标尺寸：640*960，仅支持png
					</td>
					<td style="border:none;">
					<input name="value[{$var.id}][image3]" type="hidden" value="{$var.value.image3}" id="file_{$var.code}_3" />
					<input class="start_image" id="upload_file_3" name="upload_file_3" type="file" ref="{$var.code}_3" />	
					建议图标尺寸：640*960，仅支持png
					</td>
				</tr>
				</table>

				<script language="javascript" type="text/javascript">
				{literal}
				$('.start_image').each(function(){
						var obj = this;
						$(this).uploadify({
							'formData'     : {
								'rand_str' 	: '{/literal}{$rand_str}{literal}',
								'hash'     	: '{/literal}{$hash}{literal}',
								'session_id' : '{/literal}{$session_id}{literal}',
								'img_type'  : 'image',
							},	
							'multi':false,
							'width':'94',
							'height':'25',
							'buttonText':'',
							'buttonImage':'images/add_image_1.png',
							'swf':'images/uploadify.swf',
							'uploader' : 'uploadify.php',
							'fileTypeDesc' : 'Image Files',
							'fileSizeLimit' : '2048KB',
							'fileTypeExts' : '*.png',
							'itemTemplate' : '<div style="display:none;"></div>',
							'onUploadStart' : function(file) {
								$("#loading").fadeIn("fast");
							},
							'onUploadSuccess' : function(file, data, response) {
								result = $.parseJSON(data);
								if(result.error == 1){
									alert(result.message);
								}else{
									$('#file_box_'+$(obj).attr('ref')).html("<img src=\"../"+result.image+"\" width=\"238\" height=\"422\"  border=\"0\"  /><div style=\"text-align:center;padding-top:5px;\"><a href=\"javascript:;\" onclick=\"if(confirm('您确实要删除吗?')){drop_file('"+$(obj).attr('ref')+"');}\">删除</a></div>");
									$('#file_'+$(obj).attr('ref')).val(result.image);
								}
							 }
						});
					});
				{/literal}
				</script>
			  {else}
				<textarea name="value[{$var.id}]" id="{$var.code}" cols="40" rows="5">{$var.value}</textarea>
			  {/if}
          {elseif $var.type eq "file"}
			
			<input class="upload_file" id="upload_file" name="upload_file" type="file" ref="{$var.code}" />
			<div id="file_box_{$var.code}">
			{if $var.value neq ""}<br />
			<a href="../{$var.value}" target="_blank"><img src="../{$var.value}" border="0"  /></a>
			<div style="text-align:left;margin-top:10px;">
			{literal}
			<a href="javascript:;" onclick="if(confirm('您确实要删除吗?')){drop_file('{/literal}{$var.code}{literal}');}">删除</a>
			{/literal}
			</div>
			{/if}
			</div>

			<input name="value[{$var.id}]" type="hidden" value="{$var.value}" id="file_{$var.code}" />
			{if $var.code == 'app_ico'}
			建议图标尺寸：500*500，仅支持png
			{/if}
		  {elseif $var.type eq "select"}
          	{if $var.code eq "template"}
                <select name="value[{$var.id}]" id="{$var.code}" style="width:150px;">
                {foreach from=$template item=name}
                <option value="{$name}" {if $name == $var.value} selected {/if}>{$name}</option>
                {/foreach}		
                </select>
            {else}
            {foreach from=$var.option key=key item=opt}
		     <label for="value_{$var.id}_{$opt}">
             <input type="radio" name="value[{$var.id}]" {if $var.code == 'mail_type'} onclick="javascript:emailSelect({$opt})" {/if} id="value_{$var.id}_{$opt}" value="{$opt}"  {if $var.value eq $opt} checked="true"{/if} {if $var.code == 'url_rewrite' && $opt==1} onclick="return confirm('URL Rewrite 功能要求您的 Web Server 必须是 Apache，\n并且起用了 rewrite 模块。\n同时请您确认是否已经将htaccess.txt文件重命名为.htaccess。');" {/if} /> {$key}</label>
            {/foreach}
            {/if}
		  
          {/if}
        </td>
      </tr>
      {/foreach}

    </table>
    {/foreach}

	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_form">
		<tr>
			<td class="label" style="border:none;"></td>
			<td style="border:none;">
				<input type="hidden" name="act" value="update" />
				<input type="hidden" name="mail_type" id="mail_type" value="" />
				<input type="hidden" name="source" id="source" value="{$source}" />
				<input name="submit" type="submit" value=" 确定 " class="bginput" />
				<input name="reset" type="reset" value=" 重置 " class="bginput" />
			</td>
		</tr>
	</table>
	
	
	{if $source == 'mobile'}
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_form">
		<tr>
			<td class="label" style="border:none;"></td>
			<td style="border:none;">
				<img src="../qrcode.php?act=qrcode" />
			</td>
		</tr>
	</table>	
	{/if}
	</form>

<script language="javascript" type="text/javascript">
{literal}
$('.upload_file').each(function(){
	var obj = this;
	$(this).uploadify({
		'formData'     : {
			'rand_str' 	: '{/literal}{$rand_str}{literal}',
			'hash'     	: '{/literal}{$hash}{literal}',
			'session_id' : '{/literal}{$session_id}{literal}',
			'img_type'  : 'image'
		},	
		'multi':false,
		'width':'94',
		'height':'25',
		'buttonText':'',
		'buttonImage':'images/add_image_1.png',
		'swf':'images/uploadify.swf',
		'uploader' : 'uploadify.php',
		'fileTypeDesc' : 'Image Files',
		'fileSizeLimit' : '2048KB',
		'fileTypeExts' : '*.gif; *.jpg; *.png',
		'itemTemplate' : '<div style="display:none;"></div>',
		'onUploadStart' : function(file) {
			//$("#loading").fadeIn("fast");
		},
		'onUploadSuccess' : function(file, data, response) {
			result = $.parseJSON(data);
			if(result.error == 1){
				alert(result.message);
			}else{
				$('#file_box_'+$(obj).attr('ref')).html("<img src=\"../"+result.image+"\" border=\"0\"  /><div style=\"text-align:left;margin-top:10px;\"><a href=\"javascript:;\" onclick=\"if(confirm('您确实要删除吗?')){drop_file('"+$(obj).attr('ref')+"');}\">删除</a></div>");
				$('#file_'+$(obj).attr('ref')).val(result.image);
			}
		 }
	});
});



function drop_file(code){
	$('#file_box_'+code).html('');
	$('#file_'+code).val('');
}
{/literal}
</script>
{insert_scripts files="tab.js"}
{include file="page_footer.htm"}