<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-2-26 下午2:37:49  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure><![CDATA[
    ]]></a:init-procedure>
    <a:view>
        <a:link id="pageLink_column_position" url="${/request/@context_path}/modules/hls/HLS030/hls_doc_layout_column_position.lview"/>
        <a:link id="pageLink_tab_column" url="${/request/@context_path}/modules/hls/HLS030/hls_doc_layout_tab_column.lview"/>
        <script type="text/javascript"><![CDATA[
        	var tab_gird_index=0;
        	function tabScreen_close() {
	            $('hls_doc_layout_tab').close();
	        }
	        
	        function tabDs_grid_query() {
	            $('tabDs').query();
	        }
	        
	        function tabDs_grid_save() {
	            var ds = $('tabDs');
	            ds.setSubmitParameter('layout_code','${/parameter/@layout_code}');
	            if (ds.validate()) {
	                ds.submit();
	            }
	        }
	        
	        function winOpen_column_position(layout_code,tab_code)
	        {
	            new Leaf.Window({
	                id: 'hls_doc_layout_column_position',
	                url: $('pageLink_column_position').getUrl(),
	                params:{
	                	layout_code:layout_code,
	                	tab_code:tab_code
	                },
	                title: '${l:HLS030.WIN_TITLE.COLUMN_POSITION}' + '('+layout_code+'.'+tab_code+')',
	               	fullScreen : true,
	               	draggable : true
	            });
	        }
	        
	        function winOpen_tab_column(layout_code,tab_code)
	        {
	            new Leaf.Window({
	                id: 'hls_doc_layout_tab_column',
	                url: $('pageLink_tab_column').getUrl(),
	                params:{
	                	layout_code:layout_code,
	                	tab_code:tab_code
	                },
	                title: '${l:HLS030.WIN_TITLE.TAB_COLUMN}' + '('+layout_code+'.'+tab_code+')',
	               	fullScreen : true,
	               	draggable : true
	            });
	        }
	        
	        function render_tabDs_grid(value, record, name)
	        {
	            if(!record.isNew){
		            if(name=='column_position')
		            {
		                if(record.get('configurable')=='Y'&&record.get('tab_type')=='FORM')
		                {
		                    return '<a href="javascript:winOpen_column_position(\'' + record.get('layout_code') + '\',\'' + record.get('tab_code') + '\');">' + '${l:HLS030.LINK.COLUMN_POSITION}' + '</a>';
		                }
		            }
		            if(name=='tab_column')
		            {
		                if(record.get('tab_type')!='TAB')
		                {
		                    return '<a href="javascript:winOpen_tab_column(\'' + record.get('layout_code') + '\',\'' + record.get('tab_code') + '\');">' + '${l:HLS030.LINK.TAB_COLUMN}' + '</a>';
		                }
		            }
		            return '';
	            }
	            return '';
	        }
	        
	        function tabDs_grid_add() {
	            var record = $('tabDs').create();
	            if(tab_gird_index==0){
	            	$('tabDs_grid').showEditorByRecord(record);
	            }else{
	            	$('tabDs_grid2').showEditorByRecord(record);
	            }
	        }
	        
	        function hls_doc_layout_tab_select(tab,index){
	            tab_gird_index=index;
	        }
	        
	        function tabDs_grid_clear(){
	            $('tabDs_grid').clear();
	            $('tabDs_grid2').clear();
	        }
	        function editorFunction_tabDs_grid(record,name)
	        {
	            if(record.isNew)
	            {
	                if(name=='tab_code')
		            {
		                return 'tabDs_grid_tf_upper';
		            }
		            return '';
	            }
	            return '';
	            
	        }
	        function editorFunction_tabDs_grid2(record,name)
	        {
	            if(record.isNew)
	            {
	                if(name=='tab_code')
		            {
		                return 'tabDs_grid_tf_upper2';
		            }
		            return '';
	            }
	            return '';
	            
	        }
	        
	        function onSubmitSuccess_tabDs(ds)
	        {
	            ds.query();
	        }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="tabTabDs" lookupCode="HLS030_TAB_TYPE"/>
            <a:dataSet id="hls030_setup_height_ds" lookupCode="HLS_SETUP_HEIGHT"/>
            <a:dataSet id="hls030_setup_width_ds" lookupCode="HLS_SETUP_WIDTH"/>
            <a:dataSet id="para_tabDs" autoCreate="true" model="hls.HLS030.hls_doc_layout_tab">
                <a:fields>
                    <a:field name="query_tab_code"/>
                    <a:field name="tab_desc"/>
                    <a:field name="tab_type_desc" displayField="code_value_name" options="tabTabDs" returnField="tab_type" valueField="code_value"/>
                    <a:field name="parent_tab_desc" lovGridHeight="300" lovHeight="450" lovService="hls.HLS030.hls_doc_layout_tab_lov?layout_code=${/parameter/@layout_code}&amp;tab_type=TAB" lovWidth="500">
                        <a:mapping>
                            <a:map from="tab_desc" to="parent_tab_desc"/>
                            <a:map from="tab_code" to="parent_tab_code"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="tabDs" autoQuery="true" model="hls.HLS030.hls_doc_layout_tab" pageSize="50" queryDataSet="para_tabDs" queryUrl="${/request/@context_path}/autocrud/hls.HLS030.hls_doc_layout_tab/query?layout_code=${/parameter/@layout_code}" selectable="true" submitUrl="${/request/@context_path}/modules/hls/HLS030/hls_doc_layout_tab_save.lsc">
                <a:fields>
                    <a:field name="attachment_tab_group_code" lovGridHeight="350" lovHeight="500" lovService="hls.HLS220.prj_cdd_item_tab_group?enabled_flag=Y" lovWidth="500" prompt="HLS030.HLS_DOC_LAYOUT_TAB.ATTACHMENT_TAB_GROUP">
                        <a:mapping>
                            <a:map from="tab_group" to="attachment_tab_group_code"/>
                            <a:map from="tab_group_id" to="attachment_tab_group"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="attachment_tab_group"/>
                    <a:field name="layout_code" defaultValue="${/parameter/@layout_code}"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="configurable" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="show_box" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="repeat_bindertarget_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="tab_desc"/>
                    <a:field name="tab_seq" required="true"/>
                    <a:field name="row_count" defaultValue="0"/>
                    <a:field name="column_count" defaultValue="4"/>
                    <a:field name="box_width" defaultValue="1112"/>
                    <a:field name="field_width" defaultValue="150"/>
                    <a:field name="label_width" defaultValue="120"/>
                    <a:field name="margin_top" defaultValue="3"/>
                    <a:field name="setup_height" defaultValue="MARGIN_HEIGHT"/>
                    <a:field name="setup_width" defaultValue="MARGIN_WIDTH"/>
                    <a:field name="setup_height_desc" displayField="code_value_name" options="hls030_setup_height_ds" returnField="setup_height" valueField="code_value"/>
                    <a:field name="setup_width_desc" displayField="code_value_name" options="hls030_setup_width_ds" returnField="setup_width" valueField="code_value"/>
                    <a:field name="width"/>
                    <a:field name="height"/>
                    <a:field name="margin_height" defaultValue="100"/>
                    <a:field name="margin_width" defaultValue="50"/>
                    <a:field name="base_table" lovGridHeight="300" lovHeight="450" lovService="hls.HLS030.hls_doc_category_db_object_lov?document_category=${/parameter/@document_category}&amp;object_type=TABLE" lovWidth="500" title="HLS030.HLS_DOC_LAYOUT_TAB.BASE_TABLE">
                        <a:mapping>
                            <a:map from="object_name" to="base_table"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="query_source" lovGridHeight="300" lovHeight="450" lovService="hls.HLS030.hls_doc_category_db_object_lov?document_category=${/parameter/@document_category}" lovWidth="500" title="HLS030.HLS_DOC_LAYOUT_TAB.QUERY_SOURCE">
                        <a:mapping>
                            <a:map from="object_name" to="query_source"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="parent_table" lovGridHeight="300" lovHeight="450" lovService="hls.HLS030.hls_doc_category_db_object_lov?document_category=${/parameter/@document_category}&amp;object_type=TABLE" lovWidth="500" title="HLS030.HLS_DOC_LAYOUT_TAB.PARENT_TABLE">
                        <a:mapping>
                            <a:map from="object_name" to="parent_table"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="tab_type_desc" displayField="code_value_name" options="tabTabDs" required="true" returnField="tab_type" valueField="code_value"/>
                    <a:field name="parent_tab_desc" lovGridHeight="300" lovHeight="450" lovService="hls.HLS030.hls_doc_layout_tab_lov?layout_code=${/parameter/@layout_code}" lovWidth="500">
                        <a:mapping>
                            <a:map from="tab_desc" to="parent_tab_desc"/>
                            <a:map from="tab_code" to="parent_tab_code"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="root_tree_code" lovGridHeight="300" lovHeight="450" lovService="hls.HLS030.hls_doc_layout_tree?layout_code=${/parameter/@layout_code}&amp;root_code_flag=Y" lovWidth="500">
                        <a:mapping>
                            <a:map from="tree_code" to="root_tree_code"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="tree_code" lovGridHeight="300" lovHeight="450" lovService="hls.HLS030.hls_doc_layout_tree?layout_code=${/parameter/@layout_code}" lovWidth="500">
                        <a:mapping>
                            <a:map from="tree_code" to="tree_code"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="query_only" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="onSubmitSuccess_tabDs"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="tabScreen_close" text="HLS.CLOSE"/>
                <a:gridButton click="tabDs_grid_add" text="HLS.NEW"/>
                <a:gridButton click="tabDs_grid_save" text="HLS.SAVE"/>
                <a:gridButton click="tabDs_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="tabDs_grid_query" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:hBox labelSeparator=" ">
                <a:textField name="tab_code" bindTarget="para_tabDs"/>
                <a:textField name="tab_desc" bindTarget="para_tabDs"/>
                <a:comboBox name="tab_type_desc" bindTarget="para_tabDs"/>
                <a:lov name="parent_tab_desc" bindTarget="para_tabDs"/>
            </a:hBox>
            <a:tabPanel marginHeight="150" marginWidth="20">
                <a:tabs>
                    <a:tab id="hls030_tab1_id" prompt="HLS030.HLS_DOC_LAYOUT_TAB.BASIC_INFORMATION" width="100">
                        <!-- <a:grid id="tabDs_grid" bindTarget="tabDs" height="425" navBar="true" width="1230"> -->
                        <a:grid id="tabDs_grid" bindTarget="tabDs" marginHeight="180" marginWidth="40" navBar="true">
                            <a:columns>
                                <a:column name="tab_code" editorFunction="editorFunction_tabDs_grid" lock="true" width="100"/>
                                <a:column name="tab_desc" editor="tabDs_grid_tf" width="80"/>
                                <a:column name="tab_type_desc" editor="tabDs_grid_comb" width="80"/>
                                <a:column name="parent_tab_desc" editor="tabDs_grid_lov" width="80"/>
                                <a:column name="tab_seq" align="right" editor="tabDs_grid_nf_integer" width="40"/>
                                <a:column name="tab_group" align="right" editor="tabDs_grid_nf_integer" width="40"/>
                                <a:column name="base_table" editor="tabDs_grid_lov" width="150"/>
                                <a:column name="parent_table" editor="tabDs_grid_lov" width="150"/>
                                <a:column name="query_source" editor="tabDs_grid_lov" width="100"/>
                                <!-- <a:column name="tree_code" editor="tabDs_grid_tf_upper"/>
                    <a:column name="ref_tab_code" editor="tabDs_grid_tf_upper"/>
                    <a:column name="tab_ref_screen" editor="tabDs_grid_tf"/> -->
                                <a:column name="tab_column" align="center" prompt="HLS030.WIN_TITLE.TAB_COLUMN" renderer="render_tabDs_grid" width="60"/>
                                <a:column name="column_position" align="center" prompt="HLS030.WIN_TITLE.COLUMN_POSITION" renderer="render_tabDs_grid" width="60"/>
                                <a:column name="configurable" align="center" editor="tabDs_grid_check" width="40"/>
                                <a:column name="query_only" align="center" editor="tabDs_grid_check" prompt="仅查询" width="40"/>
                                <a:column name="row_count" align="right" editor="tabDs_grid_nf_integer" width="35"/>
                                <a:column name="column_count" align="right" editor="tabDs_grid_nf_integer" width="35"/>
                                <a:column name="label_width" align="right" editor="tabDs_grid_nf_integer" width="40"/>
                                <a:column name="field_width" align="right" editor="tabDs_grid_nf_integer" width="40"/>
                                <a:column name="margin_top" align="right" editor="tabDs_grid_nf_integer" width="40"/>
                                <a:column name="enabled_flag" align="center" editor="tabDs_grid_check" width="35"/>
                                <!-- <a:column name="show_box" align="center" editor="tabDs_grid_check" width="35"/>
                    <a:column name="box_width" align="right" editor="tabDs_grid_nf_integer" width="55"/> -->
                            </a:columns>
                            <a:editors>
                                <a:textField id="tabDs_grid_tf"/>
                                <a:textField id="tabDs_grid_tf_upper" maxLength="30" typeCase="upper"/>
                                <a:numberField id="tabDs_grid_nf_integer" allowDecimals="false" allowNegative="false"/>
                                <a:lov id="tabDs_grid_lov"/>
                                <a:checkBox id="tabDs_grid_check"/>
                                <a:comboBox id="tabDs_grid_comb"/>
                            </a:editors>
                        </a:grid>
                    </a:tab>
                    <a:tab id="hls030_tab2_id" prompt="HLS030.HLS_DOC_LAYOUT_TAB.ADDITIONAL_INFORMATION" width="100">
                        <!-- <a:grid id="tabDs_grid2" bindTarget="tabDs" height="425" navBar="true" width="1230"> -->
                        <a:grid id="tabDs_grid2" bindTarget="tabDs" marginHeight="180" marginWidth="40" navBar="true">
                            <a:columns>
                                <a:column name="tab_code" editorFunction="editorFunction_tabDs_grid2" lock="true" width="100"/>
                                <a:column name="tab_desc" editor="tabDs_grid_tf2" width="80"/>
                                <a:column name="show_box" align="center" editor="tabDs_grid_check2" width="70"/>
                                <a:column name="box_width" align="right" editor="tabDs_grid_nf_integer2" width="70"/>
                                <a:column name="setup_height_desc" editor="hls030_tabDs_grid_cmb" width="80"/>
                                <a:column name="margin_height" align="right" editor="tabDs_grid_nf_integer2" width="70"/>
                                <a:column name="height" align="right" editor="tabDs_grid_nf_integer2" width="60"/>
                                <a:column name="setup_width_desc" editor="hls030_tabDs_grid_cmb" width="80"/>
                                <a:column name="margin_width" align="right" editor="tabDs_grid_nf_integer2" width="70"/>
                                <a:column name="width" align="right" editor="tabDs_grid_nf_integer2" width="60"/>
                                <a:column name="tree_code" editor="hls030_tabDs_grid_lov" width="70"/>
                                <a:column name="tree_level" align="right" width="60"/>
                                <a:column name="root_tree_code" align="right" editor="hls030_tabDs_grid_lov" width="70"/>
                                <a:column name="ref_tab_code" editor="tabDs_grid_tf_upper2" width="70"/>
                                <a:column name="tab_ref_screen" editor="tabDs_grid_tf2" width="70"/>
                                <a:column name="repeat_object" editor="tabDs_grid_tf2" width="70"/>
                                <a:column name="repeat_bindertarget_flag" editor="tabDs_grid_check2" width="60"/>
                                <a:column name="parent_loaded_object" editor="tabDs_grid_tf_upper2"/>
                                <a:column name="attachment_tab_group_code" editor="hls030_tabDs_grid_lov"/>
                                <a:column name="repeat_bindname_object" editor="tabDs_grid_tf_upper2"/>
                            </a:columns>
                            <a:editors>
                                <a:comboBox id="hls030_tabDs_grid_cmb"/>
                                <a:textField id="tabDs_grid_tf2"/>
                                <a:textField id="tabDs_grid_tf_upper2" maxLength="30" typeCase="upper"/>
                                <a:numberField id="tabDs_grid_nf_integer2" allowDecimals="false" allowNegative="false"/>
                                <a:checkBox id="tabDs_grid_check2"/>
                                <a:lov id="hls030_tabDs_grid_lov"/>
                            </a:editors>
                        </a:grid>
                    </a:tab>
                </a:tabs>
                <a:events>
                    <a:event name="select" handler="hls_doc_layout_tab_select"/>
                </a:events>
            </a:tabPanel>
        </a:screenBody>
    </a:view>
</a:screen>
