<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Main.aspx.cs" Inherits="GigaTech.CMS.Web.Common.SystemAdmin.Setting.Main" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>

    <script language=javascript>
        Ext.apply(Ext.form.field.VTypes, {
            IPAddress: function (v) {
                return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v);
            },
            IPAddressText: 'Must be a numeric IP address',
            IPAddressMask: /[\d\.]/i
        });

        Ext.onReady(function () {
            Ext.create('Ext.window.Window', {
                title: '<%=GetGlobalResourceObject("CMSResource", "SystemSetting")%>',
                closable: false,
                maximized: true,
                constrain: true,
                shadow: true,
                shadowOffset: 50,
                layout: 'fit',
                //bodyPadding: '5 0 0 0',
                buttons: [
                    {
                        text: '<%=GetGlobalResourceObject("CMSResource", "Save")%>',
                        handler: function () {
                            var form = Ext.getCmp("SettingForm").getForm();
                            if (form.isValid()) {
                                form.submit({
                                    success: function (f, action) {
                                        alert("<%=GetGlobalResourceObject("CMSResource", "SaveSuccess")%>");
                                    },
                                    failure: function (f, action) {
                                        alert("<%=GetGlobalResourceObject("CMSResource", "SaveFail")%>");
                                    }
                                });
                            }
                        }
                    }
                ],
                items: [
                    {
                        xtype: 'form',
                        id: 'SettingForm',
                        border: false,
                        bodyPadding: 5,
                        layout: 'anchor',
                        url: 'Handler.ashx?action=SetData',
                        defaults: {
                            anchor: '100%',
                            labelWidth: 50
                        },
                        defaultType: 'textfield',
                        items: [
<%--                            {
                                xtype: 'fieldset',
                                title: 'Network',
                                defaultType: 'textfield',
                                layout: 'anchor',
                                items: [
                                    {
                                        xtype: 'combo',
                                        width:400,
                                        fieldLabel: 'CMS IP Address',
                                        store: Ext.create('Ext.data.Store', {
                                            fields: ['abbr', 'name'],
                                            data: [
                                                <%=IPItems%>
                                            ]
                                        }),
                                        queryMode: 'local',
                                        displayField: 'name',
                                        valueField: 'abbr',
                                        value: '<%=IPValue%>',
                                        name:'system_ip',
                                        editable:false
                                    }
                                ]
                            },--%>
                            {
                                xtype: 'fieldset',
                                title: '<%=GetGlobalResourceObject("CMSResource", "AreaSetting")%>',
                                defaultType: 'textfield',
                                layout: 'anchor',
                                items: [
                                    {
                                        xtype:'combo',
                                        fieldLabel: '<%=GetGlobalResourceObject("CMSResource", "City")%>',
                                        store: Ext.create('Ext.data.Store', {
                                            fields: ['abbr', 'name'],
                                            data: [
                                                <%=areaItems%>
                                            ]
                                        }),
                                        queryMode: 'local',
                                        displayField: 'name',
                                        valueField: 'abbr',
                                        value: '<%=areaValue%>',
                                        name:'system_area',
                                        editable:false
                                    }
                                ]
                            },
                            {
                                xtype: 'fieldset',
                                title: '<%=GetGlobalResourceObject("CMSResource", "SecuritySetting")%>',
                                defaultType: 'textfield',
                                layout: 'anchor',
                                items: [
                                    {
                                        xtype: 'checkbox',
                                        boxLabel: '<%=GetGlobalResourceObject("CMSResource", "EnableCaptcha")%>',
                                        name: 'enable_captch'
                                    },
                                    {
                                        xtype: 'fieldset',
                                        checkboxToggle: true,
                                        title: '<%=GetGlobalResourceObject("CMSResource", "EnablePWDCheck")%>',
                                        defaultType: 'textfield',
                                        collapsed: true,
                                        layout: 'anchor',
                                        id: 'check_pwd',
                                        items: [
                                            {
                                                xtype: 'numberfield',
                                                fieldLabel: '<%=GetGlobalResourceObject("CMSResource", "MinimumPWD")%>',
                                                name: 'pwd_length',
                                                value: 5,
                                                minValue: 5,
                                                maxValue: 10
                                            },
                                            {
                                                xtype: 'checkbox',
                                                boxLabel: '<%=GetGlobalResourceObject("CMSResource", "PWDAlphanumeric")%>',
                                                name: 'pwd_mix'
                                            }
                                        ]
                                    }]
                            },
                            {
                                xtype: 'fieldset',
                                title: '<%=GetGlobalResourceObject("CMSResource", "SMTPSetting")%>',
                                defaultType: 'textfield',
                                layout: 'anchor',
                                hidden:true,
                                items: [
                                    {
                                        fieldLabel: 'IP Address',
                                        name: 'smtp_ip',
                                        vtype: 'IPAddress'
                                    },
                                    {
                                        xtype: 'numberfield',
                                        fieldLabel: 'Port',
                                        hideTrigger: true,
                                        name: 'smtp_port'
                                    },
                                    {
                                        xtype: 'fieldset',
                                        checkboxToggle: true,
                                        title: '<%=GetGlobalResourceObject("CMSResource", "SMTPAuthReq")%>',
                                        defaultType: 'textfield',
                                        collapsed: true,
                                        layout: 'anchor',
                                        id: 'smtp_auth',
                                        listeners: {
                                            'expand': function () {
                                                Ext.getCmp("smtp_id").allowBlank = false;
                                                Ext.getCmp("smtp_pwd").allowBlank = false;
                                            },
                                            'collapse': function () {
                                                Ext.getCmp("smtp_id").allowBlank = true;
                                                Ext.getCmp("smtp_pwd").allowBlank = true;
                                            }
                                        },
                                        items: [
                                            {
                                                fieldLabel: '<%=GetGlobalResourceObject("CMSResource", "ID")%>',
                                                id: 'smtp_id',
                                                name: 'smtp_id',
                                                vtype: 'alphanum'
                                            },
                                            {
                                                fieldLabel: '<%=GetGlobalResourceObject("CMSResource", "PWD")%>',
                                                id: 'smtp_pwd',
                                                name: 'smtp_pwd',
                                                vtype: 'alphanum'
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ],
                listeners: {
                    'show': function () {
                        Ext.getCmp("SettingForm").getForm().load({
                            url: 'Handler.ashx?action=GetData'
                        }
                        );

                    }
                }
            }).show();
        });
    </script>

<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>
