<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/11/15 07:47:58 $
    $Revision: 1.3 $
    $Purpose: 参数定义
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_parameter_define_link" url="${/request/@context_path}/modules/sys/SYS1110/sys_parameter_define.lview"/>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function queryParameter() {
                $('sys_parameter_result_ds').query();
            }
            
            function resetParameter() {
                $('sys_parameter_query_ds').reset();
            }
            
            function actionRenderer(value, record, name) {
                var param_id = record.get('parameter_id');
                if (param_id) {
                    return '<a href="javascript:editParamInfo(' + param_id + ')">${l:PROMPT.EDIT}</a>';
                } else {
                    return '';
                }
            }
            
            function editParamInfo(id) {
                new Leaf.Window({
                    id: 'sys_parameter_new',
                    url: $('sys_parameter_define_link').getUrl() + '?parameter_id=' + id + '&opt=update',
                    title: '${l:PROMOT.EDIT_PARAMETER}',
                    height: 500,
                    width: 550
                });
            }
            
            function newParamInfo() {
                new Leaf.Window({
                    id: 'sys_parameter_new',
                    url: $('sys_parameter_define_link').getUrl(),
                    title: '${l:PROMOT.EDIT_PARAMETER}',
                    height: 500,
                    width: 550
                });
            }
            
            function modelRenderer(combobox, record) {
                return record.get('module_code') + '-' + record.get('module_name');
            }
            
            function sys_1110_next() {
                history.go(1);
            }
            
            function sys_1110_back() {
                history.go(-1);
            }
            
            function sys_1110_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            
            function sys_1110_grid_submit() {
                var result_ds = $('sys_parameter_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="sys_module_ds" loadData="true" model="sys.sys_module_select"/>
            <a:dataSet id="sys_parameter_query_ds" model="sys.sys_parameters">
                <a:fields>
                    <a:field name="module_name_display" displayField="module_name_display" options="sys_module_ds" returnField="module_id" valueField="module_id"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sys_parameter_result_ds" autoCount="true" autoQuery="true" fetchAll="false" model="sys.sys_parameters" notification="有数据没有保存" pageSize="15" queryDataSet="sys_parameter_query_ds"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="sys_1110_back" text="HLS.BACK"/>
                <a:gridButton click="sys_1110_next" text="HLS.FORWARD"/>
                <a:gridButton click="sys_1110_quit" text="HLS.EXIT"/>
                <a:gridButton click="newParamInfo" text="HLS.NEW"/>
                <a:gridButton click="sys_1110_grid_submit" text="HLS.SAVE"/>
                <a:gridButton click="queryParameter" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:form column="3" title="HAP_QUERY_TITLE">
                <a:textField name="parameter_code" bindTarget="sys_parameter_query_ds" typeCase="upper">
                    <a:events>
                        <a:event name="enterdown" handler="queryParameter"/>
                    </a:events>
                </a:textField>
                <a:textField name="parameter_name" bindTarget="sys_parameter_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="queryParameter"/>
                    </a:events>
                </a:textField>
                <a:comboBox name="module_name_display" bindTarget="sys_parameter_query_ds" prompt="SYS_MODULE.MODULE_NAME">
                    <a:events>
                        <a:event name="enterdown" handler="queryParameter"/>
                    </a:events>
                </a:comboBox>
            </a:form>
            <a:grid id="grid" bindTarget="sys_parameter_result_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="parameter_code" sortable="true" width="250"/>
                    <a:column name="parameter_name" width="200"/>
                    <a:column name="description" sortable="true" width="250"/>
                    <a:column name="module_name" prompt="SYS_MODULE.MODULE_NAME" width="70"/>
                    <a:column name="validation_type" sortable="true" width="90"/>
                    <a:column name="start_date_active" align="center" renderer="Leaf.formatDate" sortable="true" width="90"/>
                    <a:column name="end_date_active" align="center" renderer="Leaf.formatDate" sortable="true" width="90"/>
                    <a:column name="parameter_id" align="center" prompt="HAP_OPERATION" renderer="actionRenderer" width="50"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>