<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ericyin  
    $Date: 2012-12-12 下午2:04:41  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function hls_104_queryDivision() {
                $('hls104_areas_result_ds').query();
            }
            
            function hls_104_resetDivision() {
                $('hls104_areas_query_ds').reset();
            }
            
            function hls_104_grid_submit() {
                var result_ds = $('hls104_areas_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            
            function hls_104_grid_add() {
                $('hls_area_grid').showEditorByRecord($('hls104_areas_result_ds').create());
            }
            
            function hls_104_next() {
                history.go(1);
            }
            
            function hls_104_back() {
                history.go(-1);
            }
            
            function hls_104_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            
            function hls_104_grid_clear() {
                $('hls_area_grid').clear();
            }
            
            function hls104ListFunction(record, name) {
                if (record.isNew) {
                    return 'hls104_hls_area_grid_comboBox';
                } else {
                    return '';
                }
            }
            
            function hls104_onUpdate(ds, record, name, value) {
                if (name == 'lease_organizations_display') {
	                record.set('org_description', '');
	                record.set('channel_description', '');
	                record.set('division_description', '');
	                record.set('lease_channel_display', '');
	                record.set('division_display', '');
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls_lease_organizations_ds" loadData="true" model="hls.HLS104.hls_lease_organizations_vl"/>
            <a:dataSet id="hls_lease_channels_ds" loadData="true" model="hls.HLS104.hls_lease_channels_vl"/>
            <a:dataSet id="hls_divisions_ds" loadData="true" model="hls.HLS104.hls_divisions_vl"/>
            <a:dataSet id="hls104_areas_query_ds" model="hls.HLS104.hls_lease_areas"/>
            <a:dataSet id="hls104_areas_result_ds" autoCount="true" autoQuery="true" fetchAll="false" model="hls.HLS104.hls_lease_areas" pageSize="15" queryDataSet="hls104_areas_query_ds" selectable="true">
                <a:fields>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="org_description"/>
                    <a:field name="channel_description"/>
                    <a:field name="division_description"/>
                    <a:field name="lease_organizations_display" displayField="lease_organizations_code" options="hls_lease_organizations_ds" required="true" returnField="lease_organizations_id" valueField="lease_organizations_id">
                        <a:mapping>
                            <a:map from="description" to="org_description"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="lease_channel_display" displayField="lease_channel_code" options="hls_lease_channels_ds" required="true" returnField="lease_channel_id" valueField="lease_channel_id">
                        <a:mapping>
                            <a:map from="description" to="channel_description"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="division_display" displayField="division_code" options="hls_divisions_ds" required="true" returnField="division_id" valueField="division_id">
                        <a:mapping>
                            <a:map from="description" to="division_description"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="hls104_onUpdate"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenTopToolbar height="29">
            <a:button click="hls_104_back" height="20" icon="${/request/@context_path}/images/back.png" iconAlign="left" text="后退" width="50"/>
            <a:separator style="margin-left:3px;"/>
            <a:button click="hls_104_next" height="20" icon="${/request/@context_path}/images/forward.png" iconAlign="left" text="前进" width="50"/>
            <a:separator style="margin-left:3px;"/>
            <a:button click="hls_104_quit" height="20" icon="${/request/@context_path}/images/quit.png" iconAlign="left" text="退出" width="50"/>
            <a:separator style="margin-left:3px;"/>
            <a:button click="hls_104_grid_add" height="20" icon="${/request/@context_path}/images/add.png" iconAlign="left" text="HLS.NEW" width="50"/>
            <a:separator style="margin-left:3px;"/>
            <a:button click="hls_104_grid_clear" height="20" icon="${/request/@context_path}/images/clear.png" iconAlign="left" text="HLS.CLEAR" width="50"/>
            <a:separator style="margin-left:3px;"/>
            <a:button click="hls_104_grid_submit" height="20" icon="${/request/@context_path}/images/save.png" iconAlign="left" text="保存" width="50"/>
            <a:separator style="margin-left:3px;"/>
            <a:button click="hls_104_queryDivision" height="20" icon="${/request/@context_path}/images/search.png" iconAlign="left" text="HAP_QUERY" width="50"/>
            <a:separator style="margin-left:3px;"/>
        </a:screenTopToolbar>
        <a:screenBody>
            <a:grid id="hls_area_grid" bindTarget="hls104_areas_result_ds" height="490" marginWidth="20" navBar="true" width="1000">
                <a:columns>
                    <a:column name="lease_organizations_display" align="left" editorFunction="hls104ListFunction" prompt="HLS_LEASE_AREAS.ORG_DISPLAY" sortable="true" width="100"/>
                    <a:column name="org_description" align="left" prompt="HLS_LEASE_AREAS.ORG_DESCRIPTION" width="200"/>
                    <a:column name="lease_channel_display" align="left" editorFunction="hls104ListFunction" prompt="HLS_LEASE_AREAS.CHANNEL_DISPLAY" width="100"/>
                    <a:column name="channel_description" align="left" prompt="HLS_LEASE_AREAS.CHANNEL_DESCRIPTION" width="200"/>
                    <a:column name="division_display" align="left" editorFunction="hls104ListFunction" prompt="HLS_LEASE_AREAS.DIVISION_DISPLAY" width="100"/>
                    <a:column name="division_description" align="left" prompt="HLS_LEASE_AREAS.DIVISION_DESCRIPTION" width="200"/>
                    <a:column name="enabled_flag" align="center" editor="hls104_hls_area_grid_cb" width="50"/>
                </a:columns>
                <a:editors>
                    <a:comboBox id="hls104_hls_area_grid_comboBox"/>
                    <a:checkBox id="hls104_hls_area_grid_cb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>
