<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qianming  
    $Date: 2015-12-1 上午9:49:51  
    $Revision: 1.0  
    $Purpose: 文档配置-段落
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_content_text_link_id" url="${/request/@context_path}/modules/sys/SYS2000/sys_content_text.lview"/>
        <a:link id="sys_content_paragraph_content_view_link_id" url="${/request/@context_path}/modules/sys/SYS2000/sys_content_paragraph_content_view.lview"/>
        <script type="text/javascript"><![CDATA[
        	function do_paragraph_query(){
        	    $('sys_content_paragraph_result_ds').query();
        	}
        	function do_paragraph_reset(){
        	    $('sys_content_paragraph_query_ds').reset();
        	}
        	function open_paragraph_content_window(paragraph_id){
        	    Leaf.Window({
        	        url:$('sys_content_paragraph_content_view_link_id').getUrl(),
        	        params:{
        	            paragraph_id:paragraph_id,
        	            winid:'sys_content_paragraph_content_view_win_id'
        	        },
        	        title:'段落源码',
        	        id:'sys_content_paragraph_content_view_win_id',
        	        fullScreen:true      	        
        	    });
        	}
        	function open_texts_window(paragraph_id){
        	    Leaf.Window({
        	        url:$('sys_content_text_link_id').getUrl(),
        	        params:{
        	            paragraph_id:paragraph_id,
        	            winid:'sys_content_text_win_id'
        	        },
        	        title:'文本配置',
        	        id:'sys_content_text_win_id',
        	        fullScreen:true      	        
        	    });
        	}
        	function do_paragraph_render(value,record,name){
        	    if(name === 'content_xml'){
        	        return record.get('generate_flag')=== 'Y'?'<a href="javascript:open_paragraph_content_window('+record.get('paragraph_id')+')">查看</a>':'';
        	    }else if(name === 'texts'){
        	        return !record.isNew?'<a href="javascript:open_texts_window('+record.get('paragraph_id')+')">编辑</a>':'';
        	    }
        	}
        	function do_paragraph_edit(record,name){
        	    if(name === 'paragraph_code'){
        	        return record.isNew?'sys_content_paragraph_grid_edit_tf':'';
        	    }
        	}
		]]></script>
        <a:dataSets>
            <a:dataSet id="orientation_ds">
                <a:datas>
                    <a:record code_value="portrait" code_value_name="纵向"/>
                    <a:record code_value="landscape" code_value_name="横向"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="align_ds">
                <a:datas>
                    <a:record code_value="left" code_value_name="居左"/>
                    <a:record code_value="center" code_value_name="居中"/>
                    <a:record code_value="right" code_value_name="居右"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="sys_content_paragraph_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="document_id" defaultValue="${/parameter/@document_id}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="sys_content_paragraph_result_ds" autoQuery="true" fetchAll="true" model="sys.SYS2000.sys_content_paragraph" queryDataSet="sys_content_paragraph_query_ds" selectable="true">
                <a:fields>
                    <a:field name="paragraph_id"/>
                    <a:field name="paragraph_code" required="true"/>
                    <a:field name="description" required="true"/>
                    <a:field name="order_seq" required="true"/>
                    <a:field name="document_id" defaultValue="${/parameter/@document_id}"/>
                    <a:field name="parent_paragraph_id"/>
                    <a:field name="indleft"/>
                    <a:field name="indfirstline"/>
                    <a:field name="numid"/>
                    <a:field name="ilvl"/>
                    <a:field name="line" defaultValue="400"/>
                    <a:field name="orientation_n" displayField="code_value_name" options="orientation_ds" returnField="orientation" valueField="code_value"/>
                    <a:field name="align_n" displayField="code_value_name" options="align_ds" returnField="align" valueField="code_value"/>
                    <a:field name="toc_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="generate_flag" checkedValue="Y" uncheckedValue="N"/>
                    <a:field name="content_xml"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form column="4" labelWidth="110" marginWidth="35" title="HLS.QUERY_TITLE">
                <a:textField name="paragraph_code" bindTarget="sys_content_paragraph_query_ds" prompt="段落编码">
                    <a:events>
                        <a:event name="enterdown" handler="do_paragraph_query"/>
                    </a:events>
                </a:textField>
                <a:textField name="description" bindTarget="sys_content_paragraph_query_ds" prompt="段落描述">
                    <a:events>
                        <a:event name="enterdown" handler="do_paragraph_query"/>
                    </a:events>
                </a:textField>
                <a:numberField name="order_seq_from" bindTarget="sys_content_paragraph_query_ds" prompt="排序从">
                    <a:events>
                        <a:event name="enterdown" handler="do_paragraph_query"/>
                    </a:events>
                </a:numberField>
                <a:numberField name="order_seq_to" bindTarget="sys_content_paragraph_query_ds" prompt="排序至">
                    <a:events>
                        <a:event name="enterdown" handler="do_paragraph_query"/>
                    </a:events>
                </a:numberField>
                <a:textArea name="contents" bindTarget="sys_content_paragraph_query_ds" colspan="4" marginWidth="225" prompt="内容">
                    <a:events>
                        <a:event name="enterdown" handler="do_paragraph_query"/>
                    </a:events>
                </a:textArea>
            </a:form>
            <a:grid id="sys_content_paragraph_grid_id" bindTarget="sys_content_paragraph_result_ds" marginHeight="200" marginWidth="35" navBar="true">
                <a:toolBar>
                    <a:button click="do_paragraph_query" icon="${/request/@context_path}/images/search.png" text="HLS.QUERY"/>
                    <!-- <a:button click="do_paragraph_reset" icon="${/request/@context_path}/images/undo.png" text="HLS.RESET"/> -->
                    <a:button type="add"/>
                    <a:button type="delete"/>
                    <a:button type="save"/>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="paragraph_code" editorFunction="do_paragraph_edit" lock="true" prompt="段落编码" width="120"/>
                    <a:column name="description" editor="sys_content_paragraph_grid_edit_tf" lock="true" prompt="段落描述" width="140"/>
                    <a:column name="order_seq" align="center" editor="sys_content_paragraph_grid_edit_nf1" prompt="排序" width="60"/>
                    <a:column name="indleft" editor="sys_content_paragraph_grid_edit_nf" prompt="左缩进" width="60"/>
                    <a:column name="indfirstline" editor="sys_content_paragraph_grid_edit_nf" prompt="首行缩进" width="60"/>
                    <a:column name="numid" editor="sys_content_paragraph_grid_edit_nf1" prompt="层级ID" width="60"/>
                    <a:column name="ilvl" editor="sys_content_paragraph_grid_edit_nf1" prompt="层次级别" width="60"/>
                    <a:column name="line" editor="sys_content_paragraph_grid_edit_nf" prompt="行高" width="60"/>
                    <a:column name="orientation_n" align="center" editor="sys_content_paragraph_grid_edit_cbb" prompt="纸张方向" width="80"/>
                    <a:column name="align_n" align="center" editor="sys_content_paragraph_grid_edit_cbb" prompt="布局方式" width="80"/>
                    <a:column name="toc_flag" align="center" editor="sys_content_paragraph_grid_edit_cb" prompt="是否生成目录" width="80"/>
                    <a:column name="texts" align="center" prompt="文本" renderer="do_paragraph_render" width="60"/>
                    <a:column name="generate_flag" align="center" prompt="是否生成" width="60"/>
                    <a:column name="content_xml" align="center" prompt="段落源码" renderer="do_paragraph_render" width="60"/>
                    <a:column name="enabled_flag" align="center" editor="sys_content_paragraph_grid_edit_cb" prompt="是否启用" width="60"/>
                </a:columns>
                <a:editors>
                    <a:textField id="sys_content_paragraph_grid_edit_tf"/>
                    <a:checkBox id="sys_content_paragraph_grid_edit_cb"/>
                    <a:comboBox id="sys_content_paragraph_grid_edit_cbb"/>
                    <a:numberField id="sys_content_paragraph_grid_edit_nf" allowDecimals="true" allowNegative="false" decimalPrecision="2"/>
                    <a:numberField id="sys_content_paragraph_grid_edit_nf1" allowDecimals="false" allowNegative="false"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>