<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/11/15 07:46:39 $
    $Revision: 1.3 $
 -->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view package="leaf.ui.std" template="default">
        <a:link id="exp_position_group_relations_link" url="${/request/@context_path}/modules/exp/EXP1100/exp_position_group_relations.lview"/>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <div/>
        <script type="text/javascript"><![CDATA[
        
            function queryPositionGroups(){
                $('exp_position_groups_result_ds').query()
            }
            function positionGroupCodeEdit(record,name){
                if(record.isNew){
                    return 'position_group_code_grid_tf';
                }
                return '';
            }
            
            function setPositionGroupRelations(value, record, name){
                var positionGroupId = record.get('position_group_id');
                if(positionGroupId){
                    return '<a href="javascript:setPositionGroupRelationsInfo('+positionGroupId+')">${l:EXP_POSITION_GROUPS.POSITION_GROUP_RELATIONS}</a>';
                }
            }
            
            function setPositionGroupRelationsInfo(positionGroupId){
                new Leaf.Window({id:'exp_position_group_relations_window', url:/*exp_position_group_relations.screen*/$('exp_position_group_relations_link').getUrl()+'?position_group_id='+positionGroupId, title:'${l:EXP_POSITION_GROUPS.POSITION_GROUP_RELATIONS}', height:600,width:750});
            }
        	
        	function reset(){
        		$('exp_position_groups_query_ds').reset();
        	}
        	        	function exp_1100_grid_add(){
                $('exp_1100_grid').showEditorByRecord($('exp_position_groups_result_ds').create());
            }
            function exp_1100_grid_clear(){
                $('exp_1100_grid').clear();
            }
            function exp_1100_grid_submit() {
                var result_ds = $('exp_position_groups_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            function exp_1100_next(){
                 history.go(1);
            }
            function exp_1100_back(){
                history.go(-1);
            }
            function exp_1100_quit(){
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="exp_position_groups_query_ds" model="exp.EXP1100.exp_position_groups"/>
            <a:dataSet id="exp_position_groups_result_ds" autoQuery="true" fetchAll="false" model="exp.EXP1100.exp_position_groups" notification="有数据没有保存" pageSize="15" queryDataSet="exp_position_groups_query_ds" selectable="true">
                <a:fields>
                    <a:field name="company_id" defaultValue="${/session/@company_id}"/>
                    <a:field name="position_group_code" required="true"/>
                    <a:field name="position_group_description" required="true"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" unCheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="exp_1100_back" text="HLS.BACK"/>
                <a:gridButton click="exp_1100_next" text="HLS.FORWARD"/>
                <a:gridButton click="exp_1100_quit" text="HLS.EXIT"/>
                <a:gridButton click="exp_1100_grid_add" text="HLS.NEW"/>
                <a:gridButton click="exp_1100_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="exp_1100_grid_submit" text="HLS.SAVE"/>
                <a:gridButton click="queryPositionGroups" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:form column="2" title="HAP_QUERY_TITLE">
                <a:textField name="position_group_code" bindTarget="exp_position_groups_query_ds" typeCase="upper" width="150">
                    <a:events>
                        <a:event name="enterdown" handler="queryPositionGroups"/>
                    </a:events>
                </a:textField>
                <a:textField name="position_group_description" bindTarget="exp_position_groups_query_ds" width="150">
                    <a:events>
                        <a:event name="enterdown" handler="queryPositionGroups"/>
                    </a:events>
                </a:textField>
            </a:form>
            <a:grid id="exp_1100_grid" bindTarget="exp_position_groups_result_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="position_group_code" align="left" editorFunction="positionGroupCodeEdit" sortable="true" width="170"/>
                    <a:column name="position_group_description" align="left" editor="position_group_description_grid_tf" width="320"/>
                    <a:column name="enabled_flag" align="center" editor="enabled_flag_ckb" sortable="true" width="80"/>
                    <a:column name="position_group_id" align="center" prompt="EXP_POSITION_GROUPS.POSITION_GROUP_RELATIONS" renderer="setPositionGroupRelations"/>
                </a:columns>
                <a:editors>
                    <a:textField id="position_group_code_grid_tf" typeCase="upper"/>
                    <a:textField id="position_group_description_grid_tf"/>
                    <a:checkBox id="enabled_flag_ckb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>