<extend name="Public/base" />

<block name="body">
    
    
    <div class="cf main-place top_nav_list navtab_list">
        <ul class="tabnav1711 fr jstabnav">
          <li data-tab="tab1" class="current"><a href="javascript:void(0);">基 础</a></li>
          <li data-tab="tab2"><a href="javascript:void(0);">设 计</a></li>
          <li data-tab="tab3"><a href="javascript:void(0);">高 级</a></li>
        </ul>
        <h3 class="page_title">{$meta_title}</h3>
        <p class="description_text"></p>
    </div>

	<!-- 标签页导航 -->
	<div class="tab-wrap">
		
		<div class="tab-content tabcon1711 tabcon17112 tabcon17113">
			<!-- 表单 -->
			<form id="form" action="{:U('update')}" method="post" class="form-horizontal form_info_ml doc-modal-form">
				<!-- 基础 -->
				<div id="tab1" class="tab-pane in tab1">
          <table border="0" cellspacing="0" cellpadding="0" style="width:100%">
            <tbody>
              <tr>
                  <td class="l noticeinfo">模型标识</td>
                  <td class="r table_radio">
                      <input name="name" type="text" class="" value="{$info.name}" placeholder="请输入文档模型标识">
                      <span class="notice-text">请输入文档模型标识</span>
                  </td>
              </tr>
              <tr>
                  <td class="l noticeinfo">模型名称</td>
                  <td class="r table_radio">
                      <input name="title" type="text" class="" value="{$info.title}" placeholder="请输入模型的名称">
                      <span class="notice-text">请输入模型的名称</span>
                  </td>
              </tr>
              <tr>
                  <td class="l noticeinfo">模型类型</td>
                  <td class="r table_radio">
                      <span class="form_select"><select name="extend">
                  <option value="0">独立模型</option>
                  <option value="1">文档模型</option>
                </select></span>
                      <span class="notice-text">目前只支持独立模型和文档模型</span>
                  </td>
              </tr>
            </tbody>
          </table>
				</div>

				<div id="tab2" class="tab-pane tab2">
          <table border="0" cellspacing="0" cellpadding="0" style="width:100%">
            <tbody>
              <tr class="marktop">
                <td class="l noticeinfo">字段管理</td>
                <td class="r table_radio">
                    <div class="form-item cf edit_sort edit_sort_l form_field_sort">
							<span>字段列表 		[ <a href="{:U('Attribute/add?model_id='.$info['id'])}" target="_balnk">新增</a>
							<a href="{:U('Attribute/index?model_id='.$info['id'])}" target="_balnk">管理</a> ] </span>
							<ul class="dragsort">
								<foreach name="fields" item="field" key="k">
										<li >
											<em ><input class="ids" type="checkbox" name="attribute_list[]" value="{$field['id']}" <if condition="in_array($field['id'],$info['attribute_list'])">checked="checked"</if> /> {$field['title']} [{$field['name']}]</em>
										</li>
								</foreach>
							</ul>
						</div>
                    <span class="notice-text">只有新增了字段,该表才会真正建立</span>
                </td>
              </tr>
              <tr class="marktop">
                <td class="l noticeinfo">字段别名定义</td>
                <td class="r table_radio">
                    <textarea name="attribute_alias">{$info.attribute_alias}</textarea>
                    <span class="notice-text">用于表单显示的名称</span>
                </td>
              </tr>
              <tr>
                <td class="l noticeinfo">表单显示分组</td>
                <td class="r table_radio">
                    <input type="text" class="" name="field_group" value="{$info.field_group}">
                    <span class="notice-text">用于表单显示的分组,以及设置该模型表单排序的显示</span>
                </td>
              </tr>
              <tr>
                <td class="l noticeinfo">表单显示排序</td>
                <td class="r table_radio">
                    <div class="form_main">
                      <volist name=":parse_field_attr($info['field_group'])" id="vo">
						            <div class="form-item cf edit_sort edit_sort_l form_field_sort">
                            <span>{$vo}</span>
                            <ul class="dragsort needdragsort" data-group="{$key}">
                                <foreach name="fields" item="field" key="k">
                                    <if condition="(($field['group'] eq $key) or($i eq 1 and !isset($field['group']))) and ($field['is_show'] eq 1)">
                                        <li class="getSort">
                                            <em data="{$field['id']}">{$field['title']} [{$field['name']}]</em>
                                            <input type="hidden" name="field_sort[{$key}][]" value="{$field['id']}"/>
                                        </li>
                                    </if>
                                </foreach>
                            </ul>
                        </div>
                      </volist>
                    </div>
                    <span class="notice-text">直接拖动进行排序</span>
                </td>
              </tr>
              <tr>
                <td class="l noticeinfo">列表定义</td>
                <td class="r table_radio">
                    <textarea name="list_grid">{$info.list_grid}</textarea>
                    <span class="notice-text">默认列表模板的展示规则</span>
                </td>
              </tr>
              <tr>
                <td class="l noticeinfo">默认搜索字段</td>
                <td class="r table_radio">
                    <input type="text" class="" name="search_key" value="{$info.search_key}">
                    <span class="notice-text">默认列表模板的默认搜索项</span>
                </td>
              </tr>
              <tr>
                <td class="l noticeinfo">高级搜索字段</td>
                <td class="r table_radio">
                    <input type="text" class="" name="search_list" value="{$info.search_list}">
                    <span class="notice-text">默认列表模板的高级搜索项</span>
                </td>
              </tr>
            </tbody>
          </table>
        
        
        
        
                    
				</div>

				<!-- 高级 -->
				<div id="tab3" class="tab-pane tab3">
          <table border="0" cellspacing="0" cellpadding="0" style="width:100%">
            <tbody>
              <tr>
                <td class="l noticeinfo">列表模板</td>
                <td class="r table_radio">
                    <input type="text" class="" name="template_list" value="{$info.template_list}" placeholder="">
                    <span class="notice-text">自定义的列表模板,放在Application\Admin\View\Think下,不写则使用默认模板</span>
                </td>
              </tr>
              <tr>
                <td class="l noticeinfo">新增模板</td>
                <td class="r table_radio">
                    <input type="text" class="" name="template_add" value="{$info.template_add}" placeholder="">
                    <span class="notice-text">自定义的新增模板,放在Application\Admin\View\Think下,不写则使用默认模板</span>
                </td>
              </tr>
              <tr>
                <td class="l noticeinfo">编辑模板</td>
                <td class="r table_radio">
                    <input type="text" class="" name="template_edit" value="{$info.template_edit}" placeholder="">
                    <span class="notice-text">自定义的编辑模板,放在Application\Admin\View\Think下,不写则使用默认模板</span>
                </td>
              </tr>
              <tr>
                <td class="l noticeinfo">列表数据大小</td>
                <td class="r table_radio">
                    <input type="text" class="" name="list_row" value="{$info.list_row}" placeholder="">
                    <span class="notice-text">默认列表模板的分页属性</span>
                </td>
              </tr>
            </tbody>
          </table>
				</div>

				<!-- 按钮 -->
				<div class="form-item cf">
					<label class="item-label"></label>
					<div class="controls edit_sort_btn">
						<input type="hidden" name="id" value="{$info['id']}"/>
						<button class=" submit_btn ajax-post no-refresh mlspacing mt0" type="submit" target-form="form-horizontal">确 定</button>
						<button class=" submit_btn mt0" onclick="javascript:history.back(-1);return false;">返 回</button> 
					</div>
				</div>
			</form>
		</div>
	</div>
	
	<div class="common_settings">
			<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
			<form class="addShortcutIcon">
				<input type="hidden" name="title" value="{$m_title}">
				<input type="hidden" name="url" value="{$m_url}">
			</form>
			<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
		</div>
	
</block>
<block name="script">
<script type="text/javascript" src="__STATIC__/jquery.dragsort-0.5.1.min.js"></script>
<script type="text/javascript" charset="utf-8">
Think.setValue("extend", {$info.extend|default=0});

//导航高亮
highlight_subnav('{:U('Model/index')}');

$(function(){
	showTab();
})
//拖曳插件初始化
$(function(){
	$(".needdragsort").dragsort({
	     dragSelector:'li',
	     placeHolderTemplate: '<li class="draging-place">&nbsp;</li>',
	     dragBetween:true,	//允许拖动到任意地方
	     dragEnd:function(){
	    	 var self = $(this);
	    	 self.find('input').attr('name', 'field_sort[' + self.closest('ul').data('group') + '][]');
	     }
	 });
})
</script>
</block>