<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-6-24 下午03:23:39  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:c="leaf.application.action" xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" cacheEnabled="true" cacheKey="${/parameter/@layout_code}_screen" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <!-- <s:server-script import="aut_authority_validate.js"/> -->
        <a:model-query fetchAll="true" model="hls.HLS030.hls_doc_layout_main" rootPath="layout_main_path"/>
        <a:model-query fetchAll="true" model="cont.CON500.hls_doc_layout_button" rootPath="layout_main_button_path"/>
        <a:model-query defaultWhereClause="t1.parent_table is null and t1.tab_type!=&apos;TAB&apos; and t1.enabled_flag=&apos;Y&apos; and rownum=1" fetchAll="true" model="cont.CON500.con_hls_doc_layout_tab_query" rootPath="base_table_path"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
            if ('$c{/parameter/@master_id}') {
                var detail_mask;
                if ('${/parameter/@winid}') {
                    if (parent.$L.CmpManager.get('${/parameter/@winid}')) {
                        detail_mask = parent.$('${/parameter/@winid}').wrap;
                        parent.Leaf.Masker.mask(detail_mask, '${l:HLS.LOADING}');
                    } else {
                        detail_mask = $('${/parameter/@winid}').wrap;
                        Leaf.Masker.mask(detail_mask, '${l:HLS.LOADING}');
                    }
                } else {
                    detail_mask = Ext.getBody();
                    Leaf.Masker.mask(detail_mask, '${l:HLS.LOADING}');
                }
            }
            
            function hls213_bp_master_save(nextStep) {
                var root_ds = $('${/model/base_table_path/record/@tab_code}_${/model/base_table_path/record/@base_table}_ds');
                if (root_ds.validate()) {
                    var winid = '${/parameter/@winid}';
                    Leaf.Masker.mask($(winid).wrap, '${l:HLS.EXECUTING}');
                    var root_record = root_ds.getAt(0);
                    root_ds.setSubmitParameter('layout_code', '${/parameter/@layout_code}');
                    on_hls_save_dynamic(root_ds, root_record, nextStep, winid);
                }
            }
            
            function hls213_bp_master_exit() {
                $('${/parameter/@winid}').close();
            }
            
            function hls213_bp_master_save_exit() {
                hls213_bp_master_save(hls213_bp_master_exit);
            }
        ]]></script>
        <a:freeMarker><![CDATA[
	        	<#if model.getObject("/model/layout_main_button_path").getChilds()??>
	        		<#if model.getObject("/parameter/@tab_tab_code")??>
		        	<#else>
		        		<a:screenTopToolbar>
			        		<#list model.getObject('/model/layout_main_button_path').getChilds() as item>
				        			<#if item.getString('button_code') =='SAVE'>
				        				<a:gridButton click="hls213_bp_master_save" text="${item.getString('prompt')!""}"/>
				        			<#elseif item.getString('button_code') =='EXIT'>
				        				<a:gridButton click="hls213_bp_master_exit" text="${item.getString('prompt')!""}"/>
				        			<#elseif item.getString('button_code') =='SAVE_EXIT'>
				        				<a:gridButton click="hls213_bp_master_save_exit" text="${item.getString('prompt')!""}"/>
				        			<#elseif item.getString('button_code') =='USER_BUTTON1'&&item.getString('function_code')=='${model.getObject("/parameter/@function_code")!""}'>
				        				<a:gridButton click="function(){hls213_bp_master_prj_import&amp;&amp;hls213_bp_master_prj_import($('${model.getObject("/model/base_table_path/record/@tab_code")!""}_${model.getObject("/model/base_table_path/record/@base_table")}_ds'))}" text="${item.getString('prompt')!""}"/>
				        			<#elseif item.getString('button_code') =='USER_BUTTON2'&&item.getString('function_code')=='${model.getObject("/parameter/@function_code")!""}'>
				        				<a:gridButton click="function(){hls213_bp_master_prj_query&amp;&amp;hls213_bp_master_prj_query($('${model.getObject("/model/base_table_path/record/@tab_code")!""}_${model.getObject("/model/base_table_path/record/@base_table")}_ds'))}" text="${item.getString('prompt')!""}"/>
				        			<#else>
				        				<a:gridButton id="${item.getString('button_code')!""}" click="function(btn){hls213_define_button&amp;&amp;hls213_define_button(btn,$('${model.getObject("/model/base_table_path/record/@tab_code")!""}_${model.getObject("/model/base_table_path/record/@base_table")}_ds'))}" text="${item.getString('prompt')!""}"/>
				        			</#if>
			        		</#list>
		        		</a:screenTopToolbar>
		        	</#if>
	        	</#if>
	        ]]></a:freeMarker>
        <a:screenBody padding="5" style="width:98%">
            <a:placeHolder id="dynamicMain_id"/>
        </a:screenBody>
    </a:view>
    <a:view-config>
        <c:create-config targetId="dynamicMain_id">
            <p:loop source="/model/layout_main_path">
                <p:switch test="@tab_type">
                    <p:case value="FORM">
                        <c:process-config>
                            <a:screen-include screen="modules/hls/HLS213/hls_bp_master_dynamic_create_form.lview?form_tab_code=${@tab_code}&amp;layout_code=${/parameter/@layout_code}&amp;document_id=$c{/parameter/@document_id}&amp;document_category=$c{/parameter/@document_category}&amp;winid=${/parameter/@winid}&amp;function_code=${/parameter/@function_code}&amp;function_usage=$c{/parameter/@function_usage}&amp;maintain_type=${/parameter/@maintain_type}&amp;master_id=$c{/parameter/@master_id}&amp;master_type=$c{/parameter/@master_type}&amp;default_value_dsid=$c{/parameter/@default_value_dsid}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="GRID">
                        <c:process-config>
                            <a:screen-include screen="modules/hls/HLS213/hls_bp_master_dynamic_create_grid.lview?grid_tab_code=${@tab_code}&amp;layout_code=${/parameter/@layout_code}&amp;document_id=$c{/parameter/@document_id}&amp;document_category=$c{/parameter/@document_category}&amp;winid=${/parameter/@winid}&amp;function_code=${/parameter/@function_code}&amp;function_usage=$c{/parameter/@function_usage}&amp;maintain_type=${/parameter/@maintain_type}&amp;master_id=$c{/parameter/@master_id}&amp;master_type=$c{/parameter/@master_type}&amp;default_value_dsid=$c{/parameter/@default_value_dsid}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="TEXTAREA">
                        <c:process-config>
                            <a:screen-include screen="modules/hls/HLS213/hls_bp_master_dynamic_create_textarea.lview?textarea_tab_code=${@tab_code}&amp;layout_code=${/parameter/@layout_code}&amp;document_id=$c{/parameter/@document_id}&amp;document_category=${/parameter/@document_category&amp;winid=${/parameter/@winid}&amp;function_code=${/parameter/@function_code}&amp;function_usage=$c{/parameter/@function_usage}&amp;maintain_type=${/parameter/@maintain_type}&amp;master_id=$c{/parameter/@master_id}&amp;master_type=$c{/parameter/@master_type}&amp;default_value_dsid=$c{/parameter/@default_value_dsid}"/>
                        </c:process-config>
                    </p:case>
                    <p:case value="TAB">
                        <c:process-config>
                            <a:screen-include screen="modules/hls/HLS213/hls_bp_master_dynamic_create_tabpanel.lview?tab_group=${@tab_group}&amp;parent_tab_code=${/parameter/@tab_tab_code}&amp;layout_code=${/parameter/@layout_code}&amp;document_id=$c{/parameter/@document_id}&amp;document_category=$c{/parameter/@document_category}&amp;winid=${/parameter/@winid}&amp;function_code=${/parameter/@function_code}&amp;function_usage=$c{/parameter/@function_usage}&amp;maintain_type=${/parameter/@maintain_type}&amp;master_id=$c{/parameter/@master_id}&amp;master_type=$c{/parameter/@master_type}&amp;default_value_dsid=$c{/parameter/@default_value_dsid}"/>
                        </c:process-config>
                    </p:case>
                </p:switch>
            </p:loop>
        </c:create-config>
    </a:view-config>
</a:screen>
