<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangxing5129  
    $Date: 2013-11-14 下午08:08:53  
    $Revision: 1.0  
    $Purpose: 公司章程
-->
<a:screen xmlns:c="leaf.application.action" xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" xmlns:p="uncertain.proc" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="fnd.FND501.fnd_regulatory_framework" rootPath="regulatory_detail_rp"/>
    </a:init-procedure>
    <a:view>
        <script charset="utf-8" src="${/request/@context_path}/kindeditor/kindeditor-min.js" type="text/javascript"/>
        <script charset="utf-8" src="${/request/@context_path}/kindeditor/lang/zh_CN.js" type="text/javascript"/>
        <a:link id="fnd501_attach_upload_link" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="fnd_regulatory_choose_pic_code_link" url="${/request/@context_path}/modules/fnd/FND501/fnd_regulatory_choose_pic_code.lview"/>
        <script type="text/javascript"><![CDATA[
            var contentEditor;
            
            Leaf.onReady(function() {
                var K = KindEditor;
                contentEditor = K.create('textarea[id="regulatory_framework_ta"]', {
                    allowFileManager: false,
                    uploadJson: '${/request/@context_path}/kindeditor/jsp/upload_json.jsp',
                    items: ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', 'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'map', 'code', 'pagebreak', 'anchor', 'link', 'unlink', '|', 'about']
                });
                var fm_code='${/parameter/@regulatory_framework_code}';
                defaultLink='fnd_regulatory_fm_picture_query.lview?fm_code='+fm_code+'&pic_code=';
                //防止偶尔出现编辑框不能编辑的问题。
                $('description_tf').focus();
            });
            
            function regulatory_detail_save() {
                var ds = $('fnd_regulatory_detail_result_ds');
                var record = ds.getCurrentRecord();
                record.set('regulatory_framework', contentEditor.html());
                ds.submit();
            }
            
            function regulatory_detail_close() {
                $('fnd_regulatory_detail_win').close();
            }
            
            function regulatory_detail_ds_submit(ds) {
                Leaf.showInfoMessage('${l:PROMPT}', '${l:FND501.SAVE_SUCCESS}');
            }
            
            
            
            //上传附件
            
            function regulatory_detail_attach_upload() {
                var url = $('fnd501_attach_upload_link').getUrl() + '?table_name=FND_REGULATORY_FRAMEWORK&header_id=${/parameter/@regulatory_framework_id}';
                new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'regulatory_uploadfile_win',
                    width: 850,
                    height: 400
                });
            }
            
            //
            
            function regulatory_add_picture() {
                var url = $('fnd_regulatory_choose_pic_code_link').getUrl() + '?regulatory_framework_id=${/parameter/@regulatory_framework_id}';
                new Leaf.Window({
                    url: url,
                    title: '编辑图片超链接',
                    id: 'fnd_regulatory_choose_pic_code_win',
                    width: 400,
                    height: 250
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="fnd_regulatory_detail_result_ds" autoCreate="true" autoQuery="true" model="fnd.FND501.fnd_regulatory_framework" queryUrl="${/request/@context_path}/autocrud/fnd.FND501.fnd_regulatory_framework/query?regulatory_framework_id=${/parameter/@regulatory_framework_id}">
                <a:fields>
                    <a:field name="description" readOnly="true"/>
                    <a:field name="link_code" readOnly="true"/>
                </a:fields>
                <a:datas dataSource="/model/regulatory_detail_rp"/>
                <a:events>
                    <a:event name="submitsuccess" handler="regulatory_detail_ds_submit"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="regulatory_detail_close" text="HLS.CLOSE"/>
                <a:gridButton click="regulatory_detail_save" text="HLS.SAVE"/>
                <a:gridButton click="regulatory_detail_attach_upload" text="FND501.SEARCH_ATTACHMENT"/>
                <a:gridButton click="regulatory_add_picture" text="附件链接"/>
            </a:screenTopToolbar>
            <a:hBox labelWidth="120">
                <a:textField name="description" id="description_tf" bindTarget="fnd_regulatory_detail_result_ds" prompt="制度名称" width="200"/>
            </a:hBox>
            <a:textArea name="regulatory_framework" id="regulatory_framework_ta" bindTarget="fnd_regulatory_detail_result_ds" marginHeight="170" marginWidth="50" prompt=""/>
        </a:screenBody>
    </a:view>
</a:screen>