sys_mail_server.lview 8.96 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ouyangzhaochang2663 $
    $Date: 2010/11/15 07:47:58 $
    $Revision: 1.4 $
    $Purpose: 邮件服务器设置
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function queryMailServer(){
                $('sys_mail_server_result_ds').query();
            }
            function resetMailServer(){
            	$('sys_mail_server_query_ds').reset();
            }
            function mailUsernameEdit(record, name){
                if(record.get('auth_login_flag') == 'Y'){
                    return 'mail_username_grid_tf';
                }else{
                    return '';
                }
            }
            
            function mailPasswordEdit(record, name){
                if(record.get('auth_login_flag') == 'Y'){
                    return 'password_grid_password';
                }else{
                    return '';
                }
            }
            
            function onUpdate(ds,record,name,value,oldValue){
                if(name == 'auth_login_flag'){
                    var rq = (value == 'Y');
                    record.getMeta().getField('mail_username').setRequired(rq);
                    record.getMeta().getField('mail_password').setRequired(rq);
                    if(!rq){
                        record.set('mail_username','');
                        record.set('mail_password','');
                    }
                }                      	               
            }            
            function onAdd(ds,record){
                record.getMeta().getField('mail_username').setRequired(true);
                record.getMeta().getField('mail_password').setRequired(true);
            }
            
            function setPassword(value, record, name){
                var passwd ='';
                if(typeof(record.get('mail_password')) != 'undefined' ){
                    for(var i=0; i<value.length ; i++){
                        passwd = passwd + '●';
                    }
                    return passwd;
                }
            }
            
            function emailValidator(record, name, value){  
                var reg = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;  
                if (!reg.test(value)){  
                    return '${l:THE_ADDRESS_YOU_SENT_IS_NOT_CORRECT}';  
                }
                return true;
            }
            /*默认缺省值只能为一*/
            function clickFunction(checkBox,checked){
                var records=$('sys_mail_server_result_ds').getAll();            	
            	for(var i=0;i<records.length;i++){
            		records[i].set('default_flag','N');                		
            	}            	
            	checkBox.record.set('default_flag','Y');
            }
            
                    	function sys_1030_grid_add(){
                $('sys_mail_server_grid').showEditorByRecord($('sys_mail_server_result_ds').create());
            }
            function sys_1030_grid_clear(){
                $('sys_mail_server_grid').clear();
            }
            function sys_1030_grid_remove(){
                $('sys_mail_server_grid').remove();
            }
            function sys_1030_grid_submit() {
                var result_ds = $('sys_mail_server_result_ds');
                if (result_ds.validate()) {
                    result_ds.submit();
                }
            }
            function sys_1030_next(){
                 history.go(1);
            }
            function sys_1030_back(){
                history.go(-1);
            }
            function sys_1030_quit(){
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="sys_mail_server_query_ds" autoCreate="true" model="sys.SYS1030.sys_mail_server"/>
            <a:dataSet id="sys_mail_server_result_ds" autoQuery="true" fetchAll="false" model="sys.SYS1030.sys_mail_server" queryDataSet="sys_mail_server_query_ds" selectable="true">
                <a:fields>
                    <a:field name="mail_address" required="true"/>
                    <a:field name="mail_protocol" required="true"/>
                    <a:field name="mail_smtp_host" required="true"/>
                    <a:field name="auth_login_flag" checkedValue="Y" defaultValue="Y" required="true" uncheckedValue="N"/>
                    <a:field name="mail_port_number" required="true"/>
                    <a:field name="enabled_flag" checkedValue="Y" defaultValue="Y" uncheckedValue="N"/>
                    <a:field name="default_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="mail_address" validator="emailValidator"/>
                    <a:field name="charset" defaultValue="UTF-8"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onUpdate"/>
                    <a:event name="add" handler="onAdd"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="sys_1030_back" text="HLS.BACK"/>
                <a:gridButton click="sys_1030_next" text="HLS.FORWARD"/>
                <a:gridButton click="sys_1030_quit" text="HLS.EXIT"/>
                <a:gridButton click="sys_1030_grid_add" text="HLS.NEW"/>
                <a:gridButton click="sys_1030_grid_clear" text="HLS.CLEAR"/>
                <a:gridButton click="sys_1030_grid_remove" text="HLS.REMOVE"/>
                <a:gridButton click="sys_1030_grid_submit" text="HLS.SAVE"/>
                <a:gridButton click="queryMailServer" text="HLS.QUERY"/>
            </a:screenTopToolbar>
            <a:form column="3" title="SYS_MAIL_SERVER.MAIL_SERVER_QUERY">
                <a:textField name="mail_smtp_host" bindTarget="sys_mail_server_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="queryMailServer"/>
                    </a:events>
                </a:textField>
                <a:textField name="mail_address" bindTarget="sys_mail_server_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="queryMailServer"/>
                    </a:events>
                </a:textField>
                <a:textField name="mail_username" bindTarget="sys_mail_server_query_ds">
                    <a:events>
                        <a:event name="enterdown" handler="queryMailServer"/>
                    </a:events>
                </a:textField>
            </a:form>
            <a:grid id="sys_mail_server_grid" bindTarget="sys_mail_server_result_ds" marginHeight="180" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="mail_smtp_host" editor="text_grid_tf" width="150"/>
                    <a:column name="mail_protocol" editor="text_grid_tf" width="60"/>
                    <a:column name="mail_port_number" align="right" editor="mail_port_number_grid_numberField" width="60"/>
                    <a:column name="default_flag" align="center" editor="checkbox_grid_ck" width="40"/>
                    <a:column name="enabled_flag" editor="checkbox_grid_ckb" width="40"/>
                    <a:column name="mail_address" editor="text_grid_tf" width="150"/>
                    <a:column name="auth_login_flag" editor="checkbox_grid_ckb" width="80"/>
                    <a:column name="mail_username" editorFunction="mailUsernameEdit"/>
                    <a:column name="mail_password" editorFunction="mailPasswordEdit" renderer="setPassword"/>
                    <!-- <a:column name="display_name" editor="text_grid_tf"/>
                    <a:column name="reply_to" editor="text_grid_tf" width="150"/>
                    <a:column name="mail_signature" editor="text_grid_tf"/> -->
                    <a:column name="charset" editor="text_grid_tf" prompt="字符集"/>
                    <a:column name="attch_directory" editor="text_grid_tf" prompt="附件目录" width="150"/>
                </a:columns>
                <a:editors>
                    <a:textField id="text_grid_tf"/>
                    <a:numberField id="mail_port_number_grid_numberField" allowDecimals="false" allowNegative="false"/>
                    <a:checkBox id="checkbox_grid_ckb"/>
                    <a:checkBox id="checkbox_grid_ck">
                        <a:events>
                            <a:event name="click" handler="clickFunction"/>
                        </a:events>
                    </a:checkBox>
                    <a:passWord id="password_grid_password"/>
                    <a:textField id="mail_username_grid_tf"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>