con_contract_update_textarea.lview 14.4 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-6-24 下午07:14:16  
    $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" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <!-- <s:server-script><![CDATA[
            var n = $ctx.model.getChild('textarea_layout_config_path');
            if (n) $ctx.model.removeChild(n);
            n = $ctx.model.getChild('textarea_tab_layout_detail_path');
            if (n) $ctx.model.removeChild(n);
        ]]></s:server-script> -->
        <a:model-query defaultWhereClause="t1.enabled_flag=&apos;Y&apos;" fetchAll="true" model="hls.HLS030.hls_doc_layout_config_grid_field" rootPath="textarea_layout_config_nodisplay_path"/>
        <a:model-query defaultWhereClause="t1.enabled_flag=&apos;Y&apos; and t1.display_flag=&apos;Y&apos;" fetchAll="true" model="hls.HLS030.hls_doc_layout_config_grid_field" rootPath="textarea_layout_config_path"/>
        <a:model-query defaultWhereClause="t1.tab_code=${/parameter/@textarea_tab_code} and t1.enabled_flag=&apos;Y&apos;" fetchAll="true" model="cont.CON500.con_hls_doc_layout_tab_query" rootPath="textarea_tab_layout_detail_path"/>
    </a:init-procedure>
    <a:view>
        <script type="text/javascript"><![CDATA[
            window['${/parameter/@textarea_tab_code}_on_con_header_textarea_init'] = function(ds) {
                var head_record = ds.getCurrentRecord() || ds.create();
                if (!'${/parameter/@document_id}' && '${/parameter/@default_value_dsid}') {
                    var default_value_ds = $('${/parameter/@default_value_dsid}'),
                        default_record = default_value_ds.getCurrentRecord();
                    for (var name in head_record.data) {
                        if (!Ext.isEmpty(default_record.get(name)) && name.indexOf('price_list') == '-1') {
                            head_record.set(name, default_record.get(name));
                        }
                    }
                }
                unlock_current_window();
            };
            
            window['${/parameter/@textarea_tab_code}_temp_processfunction'] = function(datas) {
                var ds = $('${/model/textarea_tab_layout_detail_path/record/@parent_table_tab_code}_${/model/textarea_tab_layout_detail_path/record/@base_table}_ds'),
                    f = $('temp_ds').fields;
                for (var name in f) {
                    ds.addField(f[name].pro);
                    var record = ds.getCurrentRecord(),
                        df = f[name].pro['defaultvalue'];
                    if (record && record.isNew && !Ext.isEmpty(df)) {
                        record.set(name, df, true);
                    }
                }
            
                return datas;
            };
            
            function temp_Load() {
                $('temp_ds').destroy();
            }
        ]]></script>
        <a:dataSets>
            <a:freeMarker><![CDATA[
            	<#if model.getObject("/model/textarea_tab_layout_detail_path").getChilds()??>
            		<#if model.getObject("/model/textarea_tab_layout_detail_path/record/@parent_tab_code_flag")=='N'>
	            		<a:dataSet id="temp_ds" processFunction="${model.getObject('/parameter/@textarea_tab_code')}_temp_processfunction" >
	                		<a:fields>
		                		<#if model.getObject("/model/textarea_layout_config_nodisplay_path").getChilds()??>
		                			<#list model.getObject('/model/textarea_layout_config_nodisplay_path').getChilds() as item>
	        							<#if item.getString('validation_type') =='TEXTAREA'>
	        							    <a:field name="${item.getString('column_name')}" requiredMessage="${model.getObject("/model/textarea_tab_layout_detail_path/record/@tab_desc")!""}${item.getString('prompt')!''}${buildSession.getLocalizedPrompt('HLS.NOT_NULL')}" defaultValue="${item.getString('default_value')!""}" readOnly="${item.getString('readonly_input_mode')}" required="${item.getString('required_input_mode')}"/>
	        							</#if>
	                                </#list>
	                            </#if>
	                		</a:fields>
	                		<a:datas>
	                			<a:record name="temp"/>
	                		</a:datas>
	                		<a:events>
	                			<a:event name="load" handler="temp_Load" />
	                		</a:events>
	                	</a:dataSet>
            		<#else>
	            			<#if model.getObject("/model/textarea_tab_layout_detail_path/record/@parent_table_flag")=='N'>
	            				<a:dataSet id="${model.getObject('/parameter/@textarea_tab_code')}_${model.getObject('/model/textarea_tab_layout_detail_path/record/@base_table')}_ds" fetchAll="true" queryUrl='${r"${/request/@context_path}"}/modules/cont/CON500/con_contract_base_query.lsc?document_id=${model.getObject("/parameter/@document_id")!""}&amp;document_category=${model.getObject("/parameter/@document_category")!""}&amp;document_type=${model.getObject("/parameter/@document_type")!""}&amp;tab_code=${model.getObject("/parameter/@textarea_tab_code")!""}&amp;layout_code=${model.getObject("/parameter/@layout_code")!""}' submitUrl='${r"${/request/@context_path}"}/modules/cont/CON500/con_contract_save.lsc?base_table=${model.getObject("/model/textarea_tab_layout_detail_path/record").getString("base_table")}&amp;query_only=${model.getObject("/model/textarea_tab_layout_detail_path/record/@query_only")!""}&amp;tab_code=${model.getObject("/parameter").getString("textarea_tab_code")}&amp;function_code=${model.getObject("/parameter").getString("function_code")}&amp;function_usage=${model.getObject("/parameter").getString("function_usage")}&amp;document_id=${model.getObject("/parameter/@document_id")!""}&amp;document_category=${model.getObject("/parameter/@document_category")!""}&amp;document_type=${model.getObject("/parameter/@document_type")!""}&amp;parent_table=${model.getObject("/model/textarea_tab_layout_detail_path/record").getString("parent_table")!""}&amp;parent_base_table_pk=${model.getObject("/model/textarea_tab_layout_detail_path/record").getString("parent_base_table_pk")!""}'>
	            					<a:fields>
		            					<#if model.getObject("/model/textarea_layout_config_nodisplay_path").getChilds()??>
		            						<#list model.getObject('/model/textarea_layout_config_nodisplay_path').getChilds() as item>
		            							<#if item.getString('validation_type') =='TEXTAREA'>
		            							    <a:field name="${item.getString('column_name')}" requiredMessage="${model.getObject("/model/textarea_tab_layout_detail_path/record/@tab_desc")!""}${item.getString('prompt')!''}${buildSession.getLocalizedPrompt('HLS.NOT_NULL')}" defaultValue="${item.getString('default_value')!""}" readOnly="${item.getString('readonly_input_mode')}" required="${item.getString('required_input_mode')}"/>
		            							</#if>
		                                    </#list>
		                                </#if>
	                                </a:fields>
	                                <a:events>
	                					<a:event name="load" handler="${model.getObject('/parameter/@textarea_tab_code')}_on_con_header_textarea_init"/>
	                					<a:event name="add" handler="${model.getObject('/parameter/@textarea_tab_code')}_on_con_header_textarea_init"/>
	                				</a:events>
                            	</a:dataSet>
                            	<script type="text/javascript">
                            	(function(){
                            	    var base_ds=$('${model.getObject('/parameter/@textarea_tab_code')}_${model.getObject('/model/textarea_tab_layout_detail_path/record/@base_table')}_ds');
                            		if(!'${model.getObject("/parameter/@document_id")!""}'){
                            			base_ds.create();
                            		}else{
                            		    base_ds.setQueryParameter('${model.getObject('/model/textarea_tab_layout_detail_path/record/@parent_base_table_pk')!""}','${model.getObject("/parameter/@document_id")!""}');
                            		    base_ds.query();
                            		    base_ds.on('load',function(){
                            		       if(!base_ds.getAll().length){
                            		      	 base_ds.create(); 
                            		       }
                            		    });
                            		}
                            	})();
                            	</script>
                            <#else>
                                 <a:dataSet id="${model.getObject('/parameter/@textarea_tab_code')}_${model.getObject('/model/textarea_tab_layout_detail_path/record/@base_table')}_ds" fetchAll="true" bindName="${model.getObject('/parameter/@textarea_tab_code')}_${model.getObject('/model/textarea_tab_layout_detail_path/record/@base_table')}" queryUrl='${r"${/request/@context_path}"}/modules/cont/CON500/con_contract_base_query.lsc?document_id=${model.getObject("/parameter/@document_id")!""}&amp;document_category=${model.getObject("/parameter/@document_category")!""}&amp;document_type=${model.getObject("/parameter/@document_type")!""}&amp;tab_code=${model.getObject("/parameter/@textarea_tab_code")!""}&amp;layout_code=${model.getObject("/parameter/@layout_code")!""}'  bindTarget="${model.getObject('/model/textarea_tab_layout_detail_path/record/@parent_table_tab_code')}_${model.getObject('/model/textarea_tab_layout_detail_path/record/@parent_table')}_ds" submitUrl='${r"${/request/@context_path}"}/modules/cont/CON500/con_contract_save.lsc?base_table=${model.getObject("/model/textarea_tab_layout_detail_path/record").getString("base_table")}&amp;query_only=${model.getObject("/model/textarea_tab_layout_detail_path/record/@query_only")!""}&amp;tab_code=${model.getObject("/parameter").getString("textarea_tab_code")}&amp;function_code=${model.getObject("/parameter").getString("function_code")}&amp;function_usage=${model.getObject("/parameter").getString("function_usage")}&amp;document_id=${model.getObject("/parameter/@document_id")!""}&amp;document_category=${model.getObject("/parameter/@document_category")!""}&amp;document_type=${model.getObject("/parameter/@document_type")!""}&amp;parent_table=${model.getObject("/model/textarea_tab_layout_detail_path/record").getString("parent_table")!""}&amp;parent_base_table_pk=${model.getObject("/model/textarea_tab_layout_detail_path/record").getString("parent_base_table_pk")!""}'>
	            					<a:fields>
		            					<#if model.getObject("/model/textarea_layout_config_nodisplay_path").getChilds()??>
		            						<#list model.getObject('/model/textarea_layout_config_nodisplay_path').getChilds() as item>
		            							<#if item.getString('validation_type') =='TEXTAREA'>
		            							    <a:field name="${item.getString('column_name')}" requiredMessage="${model.getObject("/model/textarea_tab_layout_detail_path/record/@tab_desc")!""}${item.getString('prompt')!''}${buildSession.getLocalizedPrompt('HLS.NOT_NULL')}" defaultValue="${item.getString('default_value')!""}" readOnly="${item.getString('readonly_input_mode')}" required="${item.getString('required_input_mode')}"/>
		            							</#if>
		                                    </#list>
		                                </#if>
	                                </a:fields>
	                                <a:events>
	                					<a:event name="load" handler="${model.getObject('/parameter/@textarea_tab_code')}_on_con_header_textarea_init"/>
	                					<a:event name="add" handler="${model.getObject('/parameter/@textarea_tab_code')}_on_con_header_textarea_init"/>
	                				</a:events>
                            	</a:dataSet>
                            	<script type="text/javascript">
                            		(function(){
                            		    var base_ds=$('${model.getObject('/parameter/@textarea_tab_code')}_${model.getObject('/model/textarea_tab_layout_detail_path/record/@base_table')}_ds');
	                            		var parent_ds=$('${model.getObject('/model/textarea_tab_layout_detail_path/record/@parent_table_tab_code')}_${model.getObject('/model/textarea_tab_layout_detail_path/record/@parent_table')}_ds');
	                            		if(!'${model.getObject("/parameter/@document_id")!""}'){
	                            			base_ds.create();
	                            		}else{
	                            		     parent_ds.on('indexchange',function(ds){
	                            		     	base_ds.setQueryParameter('${model.getObject('/model/textarea_tab_layout_detail_path/record/@parent_base_table_pk')!""}',parent_ds.getCurrentRecord().get('${model.getObject('/model/textarea_tab_layout_detail_path/record/@parent_base_table_pk')!""}'));
		                            		    base_ds.query();
		                            		    base_ds.on('load',function(){
		                            		       if(!base_ds.getAll().length){
		                            		      	 base_ds.create(); 
		                            		       }
		                            		    });
	                            		    });
	                            		}
                            		})();
                            	</script>
	            			</#if>
            		</#if>
            	</#if>
            ]]></a:freeMarker>
        </a:dataSets>
        <a:hBox>
            <a:placeHolder id="dynamicHeadTextArea_id"/>
        </a:hBox>
    </a:view>
    <a:view-config>
        <c:create-config targetId="dynamicHeadTextArea_id">
            <p:loop source="/model/textarea_layout_config_path">
                <p:switch test="@validation_type">
                    <p:case value="TEXTAREA">
                        <c:process-config>
                            <a:textArea name="${@column_name}" bindTarget="${/model/textarea_tab_layout_detail_path/record/@form_binder_tab_code}_${/model/textarea_tab_layout_detail_path/record/@base_table}_ds" height="${/model/textarea_tab_layout_detail_path/record/@height}" marginHeight="${/model/textarea_tab_layout_detail_path/record/@margin_height}" marginWidth="${/model/textarea_tab_layout_detail_path/record/@margin_width}" prompt="${@prompt}" style="margin-top:${@margin_top}px;margin-bottom:${@margin_top}px" width="${/model/textarea_tab_layout_detail_path/record/@width}"/>
                        </c:process-config>
                    </p:case>
                </p:switch>
            </p:loop>
        </c:create-config>
    </a:view-config>
</a:screen>