<?php if (!defined('APP_PATH')) exit;?><!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" />
<title></title>
<link href="http://127.0.0.5/Magic/Data/Public/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://127.0.0.5/Magic/Data/Public/js/jquery.js"></script>
<script src="http://127.0.0.5/Magic/Data/Public/js/main.js"></script>
</head>
<body>
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="/">首页</a></li>
		<li><a href="#">字段管理</a></li>
		<li><a href="#">编辑字段</a></li>
	</ul>
</div>


<div class="container">
<iframe id="blank" name="blank"  style="display:none"></iframe>
<form method="post" target="blank" action="?r=fields-index-save&type=<?php echo Q('get.type');?>&value=<?php echo Q('get.value');?>">
<input type="hidden" name="type"      value="<?php echo Q('get.type');?>">
<input type="hidden" name="value"     value="<?php echo Q('get.value');?>">
<input type="hidden" name="sorter"    value="<?php echo $field['sorter'];?>">
<input type="hidden" name="fieldid"   value="<?php echo $field['fieldid'];?>">
<input type="hidden" name="oldfield"  value="<?php echo $field['field'];?>">
<input type="hidden" name="issystem"  value="<?php echo $field['issystem'];?>">
<input type="hidden" name="reurl"  value="<?php echo $_SERVER['HTTP_REFERER'];?>">
	<table border="0" cellspacing="0" cellpadding="0" class="forminfo">
	<tr><td width="100%" colspan="2" style="border:none">
		<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
		  <tr>
			<td width="150">&nbsp;</td>
			<td width="100">字段类型：</td>
			<td align="left">
				<select name="formtype" <?php if (!empty($field['fieldid'])){ ?>disabled <?php $formtype=1;?><?php }?> onchange="javascript:field_setting(this.value);" class="selectbox" style="height:28px;">
						<option value="">请选择字段类型</option>
						<option value="text" <?php if($field['formtype']=='text'){ ?>selected<?php }?>>输入域</option>
						<option value="textarea" <?php if($field['formtype']=='textarea'){ ?>selected<?php }?>>文本域</option>
						<option value="select" <?php if($field['formtype']=='select'){ ?>selected<?php }?>>列表框</option>
						<option value="radio" <?php if($field['formtype']=='radio'){ ?>selected<?php }?>>单选按钮</option>
						<option value="checkbox" <?php if($field['formtype']=='checkbox'){ ?>selected<?php }?>>复选框</option>
						<option value="password" <?php if($field['formtype']=='password'){ ?>selected<?php }?>>密码域</option>
						<option value="hidden" <?php if($field['formtype']=='hidden'){ ?>selected<?php }?>>隐藏域</option>
						<option value="editor" <?php if($field['formtype']=='editor'){ ?>selected<?php }?>>编辑器</option>
						<option value="upload" <?php if($field['formtype']=='upload'){ ?>selected<?php }?>>文件上传</option>
						<option value="datetime" <?php if($field['formtype']=='datetime'){ ?>selected<?php }?>>日期和时间</option>
						<option value="linkage" <?php if($field['formtype']=='linkage'){ ?>selected<?php }?>>联动菜单</option>
						<option value="currency" <?php if($field['formtype']=='currency'){ ?>selected<?php }?>>货币</option>
				</select>
			</td>
		  </tr>
			<?php if($formtype==1){ ?><input type="hidden" name="formtype"  value="<?php echo $field['formtype'];?>"><?php }?>
		   <tr>
			<td align="center"><b>数据库设计</b></td>
			<td colspan="2">
				<table border="0" cellspacing="0" cellpadding="0" width="100%">
					<tr>
				     <td width="100">创建数据字段：</td>
				     <td><input type="radio" <?php if($field['isdb']==1 || empty($field['isdb'])){ ?>checked<?php }?> value="1" <?php if($field['issystem']==1){ ?>disabled<?php }?> name="isdb"> 是&nbsp;&nbsp;
						<input type="radio" <?php if($field['isdb']==2){ ?>checked<?php }?> value="2" <?php if($field['issystem']==1){ ?>disabled<?php }?> name="isdb">否</td>
				   </tr>
				   <tr>
				     <td width="100">字段名：</td>
				     <td><input  type="text" name="field" <?php if($field['issystem']==1){ ?>readonly<?php }?> value="<?php echo $field['field'];?>" class="insty" size="20"><cite>只能由英文字母、数字和下划线组成，并且仅能字母开头，不以下划线结尾</cite></td>
				   </tr>
				   <tr>
				     <td width="100">索引：</td>
				     <td>
						<input type="radio" <?php if($dbattribute['key_type']==1){ ?>checked<?php }?> value="1" name="key_type"> 主索引&nbsp;&nbsp;
						<input type="radio" <?php if($dbattribute['key_type']==2){ ?>checked<?php }?> value="2" name="key_type"> <input type="text" name="dbattribute[key_name]"   <?php if($dbattribute[key_type]==2){ ?>value="<?php echo $dbattribute[key_name];?>"<?php }?> class="insty" size="15">&nbsp;&nbsp;
						 <?php if($dbattribute['key_type']==1 || $dbattribute['key_type']==2){ ?><input type="hidden" name="readonly" value="1"> <input type="radio" value="3" name="key_type"> 删除 <?php }?> <cite> 修改索引，需删除后重建</cite>
						</td>
				   </tr>
				   </tr>
						<td style="border:none">类型：</td>
						<td style="border:none">
							<select name="dbtype" id="dbtype" class="selectbox"    style="height:28px;font-size:13px" onchange="db_setting('','','');">
								<option value="">请选择类型</option>
								<option lenght="3"    defval="" value="TINYINT"    <?php if($dbattribute['type']=='TINYINT'){ ?>selected<?php }?>>TinyInt</option>
								<option lenght="5"    defval="" value="SMALLINT"   <?php if($dbattribute['type']=='SMALLINT'){ ?>selected<?php }?>>SmallInt</option>
								<option lenght="5"    defval="" value="MEDIUMINT"  <?php if($dbattribute['type']=='MEDIUMINT'){ ?>selected<?php }?>>MediumInt</option>
								<option lenght="11"   defval="" value="INT"        <?php if($dbattribute['type']=='INT'){ ?>selected<?php }?>>Int</option>
								<option lenght="1"    defval="" value="CHAR"       <?php if($dbattribute['type']=='CHAR'){ ?>selected<?php }?>>Char</option>
								<option lenght="255"  defval="" value="VARCHAR"    <?php if($dbattribute['type']=='VARCHAR'){ ?>selected<?php }?>>VarChar</option>
								<option value="TEXT"       <?php if($dbattribute['type']=='TEXT'){ ?>selected<?php }?>>Text</option>
								<option value="MEDIUMTEXT" <?php if($dbattribute['type']=='MEDIUMTEXT'){ ?>selected<?php }?>>MediumText</option>
								<option value="LOGNGBLOB"  <?php if($dbattribute['type']=='LOGNGBLOB'){ ?>selected<?php }?>>LogngBlob</option>
								<option value="LONGTEXT"   <?php if($dbattribute['type']=='LONGTEXT'){ ?>selected<?php }?>>LongText</option>
								<option format="YYYY" defval="" value="YEAR"       <?php if($dbattribute['type']=='YEAR'){ ?>selected<?php }?>>Year</option>
								<option defval="" value="DATE"       <?php if($dbattribute['type']=='DATE'){ ?>selected<?php }?>>Date</option>
								<option format="HH:MM:SS" defval="" value="TIME"       <?php if($dbattribute['type']=='TIME'){ ?>selected<?php }?>>Time</option>
								<option value="DATETIME"   <?php if($dbattribute['type']=='DATETIME'){ ?>selected<?php }?>>DateTime</option>
							</select>
						</td>
					</tr>
				</table>
				<?php if($dbtype==1){ ?><input type="hidden" name="dbtype"  value="<?php echo $dbattribute['type'];?>"><?php }?>
				<div class="bd1" id="dbattr_lenght"></div>
				<div class="bd1" id="dbattr_format"></div>
				<div class="bd1" id="dbattr_defval"></div>
				<table border="0" class="bd1" cellspacing="0" cellpadding="0" width="100%" align="center">
				   <tr>
				     <td width="100">备注：</td>
				     <td style="border:none"><input type="text" name="dbattribute[comments]"  value="<?php echo $dbattribute['comments'];?>" class="insty" size="45"></td>
				   </tr>
				</table>				
			</td>
		   </tr>

		    <tr>
			<td align="center"><b>表单设计</b></td>
			<td colspan="2">
				<table border="0" cellspacing="0" cellpadding="0" width="100%"  class="bd2">
				   <tr>
				     <td width="100">选项卡：</td>
				     <td>
					 <select name="tabs" class="selectbox">
						<option value="-1" selected>通用信息</option>
						<?php foreach ($model[tabs] as $key=>$tabs){?>
						<option <?php if($field['tabs']==$key){ ?>selected<?php }?> value="<?php echo $key;?>"><?php echo $tabs;?></option>
						<?php }?>
					 </select>
				   </tr>
				   <tr>
				     <td width="100" >表单名：</td>
				     <td ><input  type="text" name="name"  value="<?php echo $field['name'];?>" class="insty" size="20"><cite>*例如：文章标题</cite></td>
				   </tr>
				</table>
				<div class="bd1" id="formattribute"></div>
			</td>
		   </tr>

		   <tr>
			<td align="right">提示文本：</td><td colspan="2">
				<input  type="text" name="tips" value="<?php echo $field['tips'];?>" class="insty" size="70">
			</td>
		  </tr>
			<tr>
				<td  align="right">校验未通过提示信息：</td><td colspan="2">
					<input  type="text" name="errortips" value="<?php echo $field['errortips'];?>" class="insty" size="70">
				</td>
			</tr>
			<tr>
				<td align="right">字段样式名：</td><td colspan="2"><input type="text" name="css" value="<?php echo $field['css'];?>" class="insty" size="8"><cite>*定义字段的CSS样式名</cite></td>
			</tr>
			<tr>
				<td align="right">附加属性：</td><td colspan="2">
				<textarea name="addattach" rows="5" cols="40" class="textinput"><?php echo $field['addattach'];?></textarea>
				<cite style="line-height:75px">可以通过此处加入javascript事件</cite></td>
			</tr>
			<tr>
			
			<td width="120" align="right">布局方式：</td><td colspan="2">&nbsp;<input type="radio"  name="layout" value="0" <?php if($field['layout']==0 || empty($field['layout'])){ ?>checked<?php }?>>&nbsp;竖排&nbsp;&nbsp;&nbsp;<input type="radio" name="layout" value="1" <?php if($field['layout']==1){ ?>checked<?php }?>>&nbsp;横排&nbsp;&nbsp;&nbsp;<input type="radio" name="layout" value="2" <?php if($field['layout']==2){ ?>checked<?php }?>>横排强制换行</td> 
			</tr>
		</table>
	</td></tr>
	<tr>
		<td width="100" height="80" align="right"></td><td><input type="submit" class="scbtn1" value="保存">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="重置" class="scbtn4"></td>
	</tr>
</table>
</form>
<!-- 数据库设计 -->

<table class="dbtype_lenght db1" border="0" cellspacing="0" cellpadding="0" id="type_text"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td align="left" width="100">长度：</td><td ><input type="text"   id="input_length" name="dbattribute[length]" value="<?php echo $dbattribute['length'];?>"  class="insty" size="10"><cite>只能输入数字</cite></td>
	</tr>
</table>

<table class="dbtype_format db1" border="0" cellspacing="0" cellpadding="0" id="type_text"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td align="left" width="100">格式：</td><td><input type="text" id="input_format" name="dbattribute[format]" value="<?php echo $dbattribute['format'];?>" class="insty" size="30"></td>
	</tr>
</table>

<table class="dbtype_defval db1" border="0" cellspacing="0" cellpadding="0" id="type_text"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td align="left" width="100">默认值：</td><td><input type="text" id="input_defval" name="dbattribute[value]" value="<?php echo $dbattribute['value'];?>" class="insty" size="30"></td>
	</tr>
</table>



<!-- 单行文本 -->
<table class="type_text type_password db1" border="0" cellspacing="0" cellpadding="0" id="type_text"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td align="left" width="100">长度：</td><td ><input type="text" name="attribute[size]" value="<?php echo $attribute['size'];?>"  class="insty" size="10"></td>
	</tr>
	<tr>
		<td align="left">默认值：</td><td><input type="text" name="attribute[value]" value="<?php echo $attribute['value'];?>" class="insty" size="30"></td>
	</tr>
</table>


<!-- 多行文本 -->
<table class="type_textarea db1"  border="0" cellspacing="0" cellpadding="0" id="type_textarea"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td width="100" align="left">宽度</td><td ><input type="text" name="attribute[cols]" value="<?php echo $attribute['cols'];?>"  class="insty" size="10"> </td>
	</tr>
	<tr>
		<td align="left">高度</td><td ><input type="text" name="attribute[rows]" value="<?php echo $attribute['rows'];?>"  class="insty" size="10"> </td>
	</tr>
	<tr>
		<td align="left">默认值</td><td><textarea name="attribute[value]" class="insty" style="width:260px;height:80px"><?php echo $attribute[value];?></textarea></td>
	</tr>
</table>

<!-- 列表框 -->
<table class="type_select db1"  border="0" cellspacing="0" cellpadding="0" id="type_select"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td align="left">列表选项</td><td><textarea name="attribute[option]" style="width:260px;height:80px" class="textinput" ><?php echo $attribute['option'];?></textarea></td>
	</tr>
	<tr>
		<td width="100" align="left">列表类型</td><td>
		<input type="radio" name="attribute[type]" value="1" <?php if($attribute['type']==1  || empty($attribute['type'])){ ?>checked<?php }?>>&nbsp;下拉列表框&nbsp;<input type="radio"  name="attribute[type]" value="2" <?php if($attribute['type']==2){ ?>checked<?php }?>>&nbsp;多选列表框&nbsp;<input type="radio"  name="attribute[type]" value="3" <?php if($attribute['type']==3){ ?>checked<?php }?>>&nbsp;联动菜单&nbsp;
		</td>
	</tr>
	<tr>
		<td align="left">默认值</td><td ><input type="text" name="attribute[value]" value="<?php echo $attribute['value'];?>"  class="insty" size="25"> </td>
	</tr>
	
</table>

<!-- 单选按钮 -->
<table class="type_radio db1"  border="0" cellspacing="0" cellpadding="0" id="type_radio"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td align="left">列表选项 </td><td><textarea name="attribute[option]" class="textinput" style="width:260px;height:80px"><?php echo $attribute['option'];?></textarea></td>
	</tr>
	<tr>
		<td align="left">默认值</td><td ><input type="text" name="attribute[value]" value="<?php echo $attribute['value'];?>"  class="insty" size="25"> </td>
	</tr>
	
</table>

<!-- 复选框 -->
<table class="type_checkbox db1"  border="0" cellspacing="0" cellpadding="0" id="type_checkbox"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td align="left">列表选项 </td><td><textarea name="attribute[option]" class="textinput" style="width:260px;height:80px"><?php echo $attribute['option'];?></textarea></td>
	</tr>
	<tr>
		<td align="left">默认值</td><td ><input type="text" name="attribute[value]" value="<?php echo $attribute['value'];?>"  class="insty" size="25"> </td>
	</tr>
	
</table>


<!-- 日期面板 -->
<table class="type_datetime db1"  border="0" cellspacing="0" cellpadding="0" id="type_textarea"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td width="100" align="left">是否显示小时</td><td >&nbsp;是&nbsp;<input type="radio" name="attribute[istime]" value="1" <?php if($attribute['istime']==1){ ?>checked<?php }?>>&nbsp;否&nbsp;<input type="radio"  name="attribute[istime]" value="0" <?php if($attribute['istime']==0 || empty($attribute['istime'])){ ?>checked<?php }?>></td>
	</tr>
	<tr>
		<td width="100" align="left">范围区间</td><td >&nbsp;是&nbsp;<input type="radio" name="attribute[isinte]" value="1" <?php if($attribute['isinte']==1){ ?>checked<?php }?>>&nbsp;否&nbsp;<input type="radio"  name="attribute[isinte]" value="0" <?php if($attribute['isinte']==0 || empty($attribute['isinte'])){ ?>checked<?php }?>></td>
	</tr>
	<tr>
		<td align="left">宽度</td><td><input type="text" name="attribute[size]" value="<?php echo $attribute['size'];?>"  class="insty" size="10"> </td>
	</tr>
	<tr>
		<td align="left">格式</td><td>
         <div class="selectlist">
		  <input id="selectlist" name="attribute[format]" value="<?php echo $attribute['format'];?> " class="caninsty insty">
		  <select class="noselect" onchange="document.getElementById('selectlist').value=this.options[this.selectedIndex].value">
                <option value="YYYY-MM-DD hh:mm:ss">YYYY-MM-DD hh:mm:ss</option>
				<option value="YYYY-MM-DD" >YYYY-MM-DD</option>
				<option value="YYYY-MM" >YYYY-MM</option>
				<option value="hh:mm:ss">hh:mm:ss</option>
				<option value="YYYY年MM月DD日 hh时mm分ss秒">YYYY年MM月DD日 hh时mm分ss秒</option>
				<option value="YYYY年MM月DD日">YYYY年MM月DD日</option>
				<option value="YYYY年MM月">YYYY年MM月</option>
				<option value="hh时mm分ss秒">hh时mm分ss秒</option>
            </select>
		</div>
		</td>
	</tr>
</table>

<!-- 编辑器 -->
<table class="type_editor" border="0" cellspacing="0" cellpadding="0" id="type_editor"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td width="100" align="left">编辑器类型</td><td>&nbsp;简洁型&nbsp;<input type="radio" name="attribute[type]" value="1" <?php if($attribute['type']==1){ ?>checked<?php }?>>&nbsp;标准型&nbsp;<input type="radio"  name="attribute[type]" value="0" <?php if($attribute['type']==0 || empty($attribute['type'])){ ?>checked<?php }?>></td>
	</tr>
	<tr>
		<td  align="left">编辑器宽度</td><td ><input type="text" name="attribute[cols]" value="<?php echo $attribute['cols'];?>"  class="insty" size="10"> </td>
	</tr>
	<tr>
		<td align="left">编辑器高度</td><td ><input type="text" name="attribute[rows]" value="<?php echo $attribute['rows'];?>"  class="insty" size="10"> </td>
	</tr>
	<tr>
		<td align="left">默认值</td><td><textarea name="attribute[value]" class="insty" style="width:260px;height:80px"><?php echo $attribute[value];?></textarea></td>
	</tr>
</table>

<!-- 文件上传 -->
<table class="type_upload" border="0" cellspacing="0" cellpadding="0" id="type_upload"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td width="120" align="left">上传类型</td><td>
			<input type="radio" name="attribute[type]" value="1" <?php if($attribute['type']==1 || empty($attribute['type'])){ ?>checked<?php }?>>&nbsp;图片&nbsp;
			<input type="radio" name="attribute[type]" value="2" <?php if($attribute['type']==2){ ?>checked<?php }?>>&nbsp;文件&nbsp;
			<input type="radio" name="attribute[type]" value="3" <?php if($attribute['type']==3){ ?>checked<?php }?>>&nbsp;多媒体&nbsp;
			<input type="radio" name="attribute[type]" value="4" <?php if($attribute['type']==4){ ?>checked<?php }?>>&nbsp;视频集&nbsp;
		</td>
	</tr>
	<tr>
		<td width="120" align="left">是否开启批量上传</td><td>
			<input type="radio" name="attribute[multi]" value="1" <?php if($attribute['multi']==1){ ?>checked<?php }?>>&nbsp;是&nbsp;
			<input type="radio" name="attribute[multi]" value="0" <?php if($attribute['multi']==0){ ?>checked<?php }?>>&nbsp;否&nbsp;
		</td>
	</tr>
	<tr>
		<td width="120" align="left">是否显示文件浏览器</td><td>
			<input type="radio" name="attribute[manager]" value="1" <?php if($attribute['manager']==1){ ?>checked<?php }?>>&nbsp;是&nbsp;
			<input type="radio" name="attribute[manager]" value="0" <?php if($attribute['manager']==0){ ?>checked<?php }?>>&nbsp;否&nbsp;
		</td>
	</tr>
	<tr>
		<td width="100" align="left">是否支持预览</td><td >
			<input type="radio" name="attribute[view]" value="true" <?php if($attribute['view']=='true'){ ?>checked<?php }?>>&nbsp;是&nbsp;
			<input type="radio" name="attribute[view]" value="false" <?php if($attribute['view']=='false'){ ?>checked<?php }?>>&nbsp;否&nbsp;
		</td>
	</tr>
	<tr>
		<td width="100" align="left">按钮名称</td><td ><input type="text" name="attribute[butname]" value="<?php echo $attribute['butname'];?>"  class="insty" size="25"></td>
	</tr>
	
	<tr>
		<td width="100" align="left">文本框长度</td><td ><input type="text" name="attribute[size]" value="<?php echo $attribute['size'];?>"  class="insty" size="10"></td>
	</tr>
	<tr>
		<td width="100" align="left">样式</td><td >
		<input type="radio" name="attribute[style]" value="1" <?php if($attribute['style']==1){ ?>checked<?php }?>>&nbsp;样式一&nbsp;
		</td>
	</tr>
</table>

<!-- 联动菜单 -->
<table class="type_linkage" border="0" cellspacing="0" cellpadding="0" id="type_editor"  style="border:none;display:none" width="100%" height="100%"  >
	<tr>
		<td width="100" align="left">菜单ID</td><td><input type="text" name="attribute[lid]" value="<?php echo $attribute['lid'];?>" class="insty" size="10">&nbsp;<cite>通过【扩展管理】->【联动菜单】查看ID</cite></td>
	</tr>
	<tr>
		<td  align="left">深度</td><td ><input type="text" name="attribute[depth]" value="<?php echo $attribute['depth'];?>"  class="insty" size="10"><cite>可以通过深度控制联动菜单的级数，例如后台录入的中国地市为三级，但是只需要显示两级，将深度填写为2则只显示两级</cite></td>
	</tr>
	<tr>
		<td align="left">如果留空默认选择项文本</td><td ><input type="text" name="attribute[default]" value="<?php echo $attribute['default'];?>"  class="insty" size="20"> <cite>默认提示文字为“==请选择==”</cite></td>
	</tr>
	<tr>
		<td align="left">默认值</td><td><input type="text" name="attribute[defval]" value="<?php if(empty($field['defval'])){ ?>0.0.0<?php }else{ ?><?php echo $attribute['defval'];?><?php }?>"  class="insty" size="30"><cite>默认值必须以‘.’分割开，0表示没有默认值，如果是三级联动则是0.0.0，四级联动则是0.0.0.0，依次类推</cite></td>
	</tr>
</table>

<!-- 货币 -->
<table class="type_currency db1" border="0" cellspacing="0" cellpadding="0" id="type_text"  style="border:none;display:none" width="100%" height="100%">
	<tr>
		<td align="left" width="100">长度：</td><td ><input type="text" name="attribute[size]" value="<?php echo $attribute['size'];?>"  class="insty" size="10"></td>
	</tr>
	<tr>
		<td align="left">默认值：</td><td><input type="text" name="attribute[value]" value="<?php echo $attribute['value'];?>" class="insty" size="30"></td>
	</tr>
</table>

<script type="text/javascript">
<?php if (!empty($field['fieldid'])){ ?>db_setting("<?php echo $dbattribute['length'];?>","<?php echo $dbattribute['format'];?>","<?php echo $dbattribute['value'];?>");<?php }?>

	$(document).ready(function(){
		$('#formattribute').html($('.type_<?php echo $field[formtype];?>').html());
		var style = $("#dbtype option:selected").attr('style');
		$('#dbattribute').html($('.dbtype_'+style).html());
	});
	
	function db_setting(slenght,sformat,sdefval) {
		var lenght      = $("#dbtype option:selected").attr('lenght');
		var format      = $("#dbtype option:selected").attr('format');
		var defval      = $("#dbtype option:selected").attr('defval');
		var lenghtnode  = $('.dbtype_lenght').html();
		var formatnode  = $('.dbtype_format').html();
		var defvalnode  = $('.dbtype_defval').html();
		if (lenght || slenght){
			$('#dbattr_lenght').html(lenghtnode);
			slenght ? $('#input_length').val(slenght) : $('#input_length').val(lenght);
		}else{
			$('#dbattr_lenght').html('');
		}
		if (format || sformat){
			$('#dbattr_format').html(formatnode);
			sformat ? $('#input_format').val(sformat) : $('#input_format').val(format);
		}else{
			$('#dbattr_format').html('');
		}
		if (defval!=null  || sdefval){
			$('#dbattr_defval').html(defvalnode);
			sdefval ? $('#input_defval').val(sdefval) : $('#input_defval').val(defval);
		}else{
			$('#dbattr_defval').html('');
		}
	}

	function field_setting(fieldtype) {
		var formnode = $('.type_'+fieldtype).html();
		if (formnode!==null){
			$('#formattribute').html(formnode);
		}else{
			$('#formattribute').html('');
		}
	}
</script>
</body>
</html>	