<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-8-21 上午10:45:24  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="hls220_prj_cdd_item_templet_link" url="${/request/@context_path}/modules/hls/HLS220/prj_cdd_item_templet.lview"/>
        <a:link id="hls220_prj_cdd_item_templet_hd_copy_link" url="${/request/@context_path}/modules/hls/HLS220/prj_cdd_item_templet_hd_copy.lview"/>
        <script type="text/javascript"><![CDATA[
            function hls220_templet_query() {
                $('hls220_templet_result_ds').query();
            }
            
            function hls220_templet_copy() {
                var records = $('hls220_templet_result_ds').getSelected();
                if (records.length != 1) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '${l:HLS.SELECT_RECORD}');
                } else {
                    new Leaf.Window({
                        id: 'hls220_prj_cdd_item_templet_hd_copy_window',
                        url: $('hls220_prj_cdd_item_templet_hd_copy_link').getUrl(),
                        title: '${l:HLS220.TEMPLET_COPY}',
                        width: 500,
                        height: 200
                    });
                }
            }
            
            function windowopen_templet_line(id) {
                var record = $('hls220_templet_result_ds').findById(id);
                var templet_head_id = record.get('templet_head_id');
                new Leaf.Window({
                    id: 'hls220_prj_cdd_item_templet_window',
                    url: $('hls220_prj_cdd_item_templet_link').getUrl() + '?templet_head_id=' + templet_head_id + '&record_id=' + id,
                    params: null,
                    title: '${l:HLS220.TEMPLET_DETAIL}',
                    fullScreen: true
                });
            }
            
            function hls220_templet_grid_render(value, record, name) {
                if (name == 'hls220_edit') {
                    if (!record.isNew) {
                        return '<a href="javascript:windowopen_templet_line(\'' + record.id + '\');">${l:HLS.EDIT}</a>';
                    }
                }
                return '';
            
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls220_templet_enabled_status_ds" lookupCode="ENABLED_STATUS"/>
            <a:dataSet id="hls220_templet_query_ds">
                <a:fields>
                    <a:field name="templet_code"/>
                    <a:field name="templet_name"/>
                    <a:field name="enabled_flag_des" displayField="code_value_name" options="hls220_templet_enabled_status_ds" returnField="enabled_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls220_templet_result_ds" autoPageSize="true" autoQuery="true" model="hls.HLS220.prj_cdd_item_templet_hd" queryDataSet="hls220_templet_query_ds" selectable="true">
                <a:fields>
                    <a:field name="templet_code" required="true"/>
                    <a:field name="templet_name" required="true"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="hls220_templet_query" text="HLS.QUERY"/>
                <a:gridButton bind="hls220_templet_grid" type="add"/>
                <a:gridButton bind="hls220_templet_grid" type="clear"/>
                <a:gridButton click="hls220_templet_copy" text="HLS.COPY" width="80"/>
                <a:gridButton bind="hls220_templet_grid" type="save"/>
            </a:screenTopToolbar>
            <a:form labelSeparator=" " row="1">
                <a:textField name="templet_code" bindTarget="hls220_templet_query_ds" prompt="HLS.TEMPLET_CODE"/>
                <a:textField name="templet_name" bindTarget="hls220_templet_query_ds" prompt="HLS.TEMPLET_NAME"/>
                <a:comboBox name="enabled_flag_des" bindTarget="hls220_templet_query_ds" prompt="HLS.ENABLED_FLAG"/>
            </a:form>
            <a:grid id="hls220_templet_grid" bindTarget="hls220_templet_result_ds" marginHeight="130" marginWidth="50" navBar="true" width="800">
                <a:columns>
                    <a:column name="templet_code" editor="hls220_templet_grid_code_tf" prompt="HLS.TEMPLET_CODE" width="150"/>
                    <a:column name="templet_name" editor="hls220_templet_grid_tf" prompt="HLS.TEMPLET_NAME" width="250"/>
                    <a:column name="enabled_flag" editor="hls220_templet_grid_ck" prompt="HLS.ENABLED_FLAG" width="80"/>
                    <a:column name="hls220_edit" align="center" prompt="HLS.EDIT" renderer="hls220_templet_grid_render" width="70"/>
                    <a:column name="note" editor="hls220_templet_grid_tf" prompt="HLS.COMMENT" width="250"/>
                </a:columns>
                <a:editors>
                    <a:textField id="hls220_templet_grid_code_tf" typeCase="upper"/>
                    <a:textField id="hls220_templet_grid_tf"/>
                    <a:checkBox id="hls220_templet_grid_ck"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
