<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-8-30 上午10:24:11  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:view>
        <script type="text/javascript"><![CDATA[
            function hls_doc_get_layout_code(bm_url_link, param, win_url_link, list_ds, pre_layout_code) {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                Leaf.request({
                    url: $(bm_url_link).getUrl(),
                    para: param,
                    success: function(res) {
                        Leaf.Masker.unmask(Ext.getBody());
                        if (!res.result.layout_code) {
                            Leaf.showMessage('${l:PROMPT}', '${l:HLS.LAYOUT_CODE_IS_NULL}');
                            return;
                        }
                        param['layout_code'] = res.result.layout_code;
                        param['usage_type'] = res.result.usage_type;
                        var winid = '';
                        if (pre_layout_code) {
                            winid = pre_layout_code + 'hls_doc_get_layout_code_winid';
                        } else {
                            winid = 'hls_doc_get_layout_code_winid';
                        }
                        param['winid'] = winid;
                        param['calc_type'] = res.result.cond_para1;
            
                        var win = new Leaf.Window({
                            id: winid,
                            params: param,
                            url: $(win_url_link).getUrl(),
                            title: param['url_title'] + '(' + res.result.layout_code + ')',
                            fullScreen: true,
                            draggable: true
                        });
                        win.on('close', function() {
                            if (list_ds) {
                                $(list_ds).query();
                            }
                        });
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            }
            
            //通过基表名获取ds_id
            
            function get_dsid_by_basetable(layoutDataSetList, base_table) {
                if (base_table) {
                    var base_table_temp = base_table.toLowerCase() + '_ds';
                    for (var i = 0;i < layoutDataSetList.length;i++) {
                        var dsId = layoutDataSetList[i];
                        if (dsId.substring(dsId.length - base_table_temp.length, dsId.length) == base_table_temp) {
                            return dsId;
                        }
                    }
                }
                return '';
            }
        ]]></script>
    </a:view>
</a:screen>
