<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="{$BASE_V}layout.css" rel="stylesheet" type="text/css" />
<title>酒店分销联盟管理系统</title>
<script language="javascript">
var php_self = '{PHP_SELF}';
var webpath='{$BASE}';
</script>
<script type="text/javascript" src="{$BASE}js/tools.js"></script>
<script type="text/javascript" src="{$BASE_V}config.js"></script>
<script type="text/javascript" src="{$BASE}js/calendar/jquery.min.js"></script>
</head>
<body>

<div style="z-index: 1; right: 20px; top: 30px; color: rgb(255, 255, 255); position: absolute; display: none;" id="loading"><img src="{$BASE_V}images/loader.gif"></div>

<div id="main">
  <div class="main_box">    
<!--{if $action == 'add' }-->
<h2>添加系统配置参数新变量</h2>
<form name="modform" id="forms" action="{PHP_SELF}?m=config.save" method="post"  onSubmit="return chkForm();">    
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="t_list">
      <tbody><tr>
        <td width="100" class="td_right">变量名称：</td>
        <td class="td_left"><input type="text" size="40" value="$editinfo[varname]" id="nvarname" name="nvarname">
         </td>
      </tr>
       <tr>
        <td width="100" class="td_right">变量值：</td>
        <td class="td_left"><textarea name="nvarvalue" id="nvarvalue" rows="6" cols="62">$editinfo[value]</textarea>
         </td>
      </tr>
      <tr>
        <td class="td_right">变量类型：</td>
        <td class="td_left">
        $vartype_ary_radio
        <div style="display:{if $editinfo[type] == 'select' || $editinfo[type] == 'radio'}block{else}none{/if};" id="changetype">nameacton：<input type="text" size="60" value="$editinfo[nameaction]" id="nameaction" name="nameaction">&nbsp;acton事件 选填<br />
        数据值：<textarea name="item" id="item" cols="52" rows="5" style="margin-top:10px">$editinfo[item]</textarea>&nbsp;两数据之间用{|}来分隔
        </div>
        </td>
      </tr>
      <tr>
        <td class="td_right">参数说明：</td>
        <td class="td_left"><input type="text" value="$editinfo[info]" id="varmsg" name="varmsg" size="80">
          </td>
      </tr>
      
      <tr>
        <td class="td_right">参数说明帮助：</td>
        <td class="td_left"><input type="text" value="$editinfo[help]" id="help" name="help" size="80">
          </td>
      </tr>      
      
      <tr>
        <td class="td_right">排序：</td>
        <td class="td_left"><input type="text" value="$editinfo[order]" id="order" name="order" size="10">
          </td>
      </tr>            
     
      <tr>
        <td class="td_right">&nbsp;</td>
        <td class="td_left">
	      <input type="hidden" value="$editinfo[sysid]" name="sysid">
          <input type="submit" value="提交" id="submit" onmouseout="this.className='btn05'" onmouseover="this.className='btn06'" class="btn05" name="submit">
          <input type="reset" class="btn05"  onmouseout="this.className='btn05'" onmouseover="this.className='btn06'" value="清除" name="reset_button">
          <input type="button" value="返回"  onmouseout="this.className='btn05'" onmouseover="this.className='btn06'" onclick="history.back(1);" class="btn05" id="backbutton" name="backbutton"></td>
      </tr>
    
    </tbody></table>
</form>    
<!--{/if}-->
    
<!--{if $action == 'index' }-->
<SCRIPT src="{$BASE_V}drag_drop.js" type=text/javascript></SCRIPT>
<script language="javascript">
window.onload = function(){CreateDragContainer(document.getElementById('cityList'));}
</script>

<h2>修改网站设置</h2>
<form name="list_form" method="POST" action="{PHP_SELF}?m=config.savelist" onSubmit="return fillcitylist();">
    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="t_list">
      <tbody>
          <tr>
            <td width="20%">参数说明</td>
            <td width='60%'>参数值</td>
            <td width="20%">变量名</td>                
          </tr>  
      
      {loop $rs $k $v}
          <tr>
            <td class="td_right">$v[info]：</td>
            <td class="td_left">
            {if $v[type] == 'string'}<input type="text" size="40" value="$v[value]" id="value" name="$v[varname]">
            {elseif $v[type] == 'bstring'}<textarea name="$v[varname]" id="$v[varname]" rows="6" cols="62">$v[value]</textarea>
            {elseif $v[type] == 'select'}$v[select]
            {elseif $v[type] == 'radio'}$v[radio]
            {/if}
    		$v[help]
            </td>
            <td>$v[varname]</td>                
          </tr>  
      {/loop}   
<script language="javascript">
var dragHelper = document.createElement('DIV');
dragHelper.style.cssText = 'position:absolute;display:none;';
document.getElementById("cityList").appendChild(dragHelper);
function changtag(val)
{
	CreateDragContainer(document.getElementById('cityList'));
	var root=document.getElementById("cityList")
	var oNote=root.getElementsByTagName("span");
	var isthere=false;
	for(i=0;i<oNote.length;i++){
	if(oNote[i].attributes.getNamedItem("id"))
	var id=oNote[i].attributes.getNamedItem("id").nodeValue;
	if(oNote[i].attributes.getNamedItem("value"))
	var value=oNote[i].attributes.getNamedItem("value").nodeValue;
	if((id+"|"+value)==val)isthere=true;
	}
	if(!isthere){
	var val=val.split('|');
		document.getElementById("cityList").innerHTML+="<span ondblclick=\"return updatename(this,'"+val[1]+"');\" style=\"border:#CCC solid 1px; padding:3px;cursor:move;\" value=\""+val[1]+"\" id=\""+val[0]+"\">"+val[1]+"<em style=\"cursor:pointer\" onclick=\"return delCity("+val[0]+");\">×</em></span>";
	}	
}

function fillcitylist()
{
	var root=document.getElementById("cityList")
	var oNote=root.getElementsByTagName("span");
	var liststr="";
	for(i=0;i<oNote.length;i++){
		if(oNote[i].parentNode.style.display!="none"){
		if(oNote[i].attributes.getNamedItem("id")){
			var id=oNote[i].attributes.getNamedItem("id").nodeValue;
			liststr+=id+"|";
		}
		if(oNote[i].attributes.getNamedItem("value")){
			var value=oNote[i].attributes.getNamedItem("value").nodeValue;
			liststr+=value+",";
		}
		}
	}
	if(liststr.length>0){
	document.getElementById("cfg_indexCitylist").value=liststr.substr(0,liststr.length-1);}
	else{
	alert("首页城市选项卡不能为空！");
	return false;}
}
function delCity(val)
{
	document.getElementById(val).parentNode.removeChild(document.getElementById(val));
}
function updatename(val,itemval)
{
	if(val.innerHTML.indexOf("input")==-1)
	val.innerHTML=val.innerHTML.replace(itemval,"<input onblur='return changvals(this);' style='' size=4 value="+itemval+">");
}
function changvals(val)
{
	val.parentNode.setAttribute("value",val.value);
}


function getrewrite(servertype)
{
	var url = "{PHP_SELF}?m=config.getServerRewrite&cfg_servertype="+servertype;
    $.ajax({
        url : url,
        type : 'GET',
        dataType: "html",
        success : 
            function(data)
            {
              $("#cfg_rewrite_rule").val(data);
            }
        ,
        error: 
            function () {
                alert("请求超时请重试!");
            }
});     
}
</script>      
          <tr>
              <td class="td_right">&nbsp;</td>
              <td class="td_left">
              <input type="submit" value="提交" id="submit" onmouseout="this.className='btn05'" onmouseover="this.className='btn06'" class="btn05" name="submit">
              <input type="button" value="返回" onclick="history.back(1);" class="btn05" id="backbutton" name="backbutton" onmouseout="this.className='btn05'" onmouseover="this.className='btn06'"></td>
          </tr>          
      </tbody>
	</table>
      </form>

      
<!--{/if}-->
	</div>
</div>
</body>
</html>