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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
    <script language=javascript>
        Ext.onReady(function () {
            Ext.create('Ext.container.Viewport', {
                
                layout: 'fit',
                items:[
                    {
                        xtype: 'panel',
                        layout: 'anchor',
                        autoScroll: true,
                        items: [
    Ext.create('Ext.form.Panel', {
        title: '檔案傳送',
        width: 400,
        bodyPadding: 10,
        frame: true,
        anchor: '100%',
        items: [
            {
                xtype: 'filefield',
                name: 'photo',
                fieldLabel: '檔案',
                labelWidth: 50,
                msgTarget: 'side',
                allowBlank: false,
                anchor: '100%',
                buttonText: '選擇檔案...'
            }, {
                xtype: 'checkbox',
                name:'missing',
                boxLabel:'啟用漏封包測試模式(偶數封包)'
            }
        ],

        buttons: [{
            text: '開始傳送(廣播模式)',
            formBind: true,
            handler: function () {
                var form = this.up('form').getForm();
                if (form.isValid()) {
                    form.submit({
                        url: 'Handler.ashx?action=FileUpload',
                        waitMsg: '檔案上傳中...',
                        success: function (fp, o) {
                            Ext.Msg.alert('成功', '檔案上傳成功！');
                        }
                    });
                }
            }
        }]
    }),                                                                Ext.create('Ext.form.Panel', {
        title: '檔案接收',
        width: 400,
        bodyPadding: 10,
        frame: true,
        anchor: '100%',
        items: [
            Ext.create('Ext.form.ComboBox', {
                fieldLabel: '目標設備',
                name: 'full_model',
                store: Ext.create('Ext.data.Store', {
                    fields: ['abbr', 'name'],
                    data: [
                                                                  { "abbr": "110@1", "name": "N2" },
                                            { "abbr": "101@1", "name": "N7" },
                                            { "abbr": "101@11", "name": "N10" }
                    ]
                }),
                queryMode: 'local',
                displayField: 'name',
                valueField: 'abbr',
                editable: false,
                value: '101@1'
            }),
            {
                xtype: 'textfield',
                name: 'device_id',
                fieldLabel: '目標設備ID',
                emptyText: '00000001',
                allowBlank: false
            },
            {
                xtype: 'textfield',
                name: 'device_subid',
                fieldLabel: '目標設備SubID',
                emptyText: '1',
                allowBlank: false
            },
            {
                xtype: 'textfield',
                name: 'file_name',
                fieldLabel: '檔名',
                allowBlank: false
            }, {
                xtype: 'label',
                text: '路徑：\\\\192.168.0.247\\share\\casper\\FileDownload'
            }],

        buttons: [{
            text: '開始接收',
            formBind: true,
            handler: function () {
                var form = this.up('form').getForm();
                if (form.isValid()) {
                    form.submit({
                        url: 'Handler.ashx?action=FileDownload',
                        waitMsg: '檔案接收中...',
                        success: function (fp, o) {
                            Ext.Msg.alert('成功', '檔案接收命令發出！');
                        }
                    });
                }
            }
        }]
    }),
                        Ext.create('Ext.form.Panel', {
                            title: '訊息發佈',
                            width: 400,
                            bodyPadding: 10,
                            frame: true,
                            anchor: '100%',
                            items: [
                                Ext.create('Ext.form.ComboBox', {
                                    fieldLabel: '目標設備',
                                    name: 'full_model',
                                    store: Ext.create('Ext.data.Store', {
                                        fields: ['abbr', 'name'],
                                        data: [
                                            { "abbr": "110@1", "name": "N2" },
                                            { "abbr": "101@1", "name": "N7" },
                                            { "abbr": "101@11", "name": "N10" }
                                        ]
                                    }),
                                    queryMode: 'local',
                                    displayField: 'name',
                                    valueField: 'abbr',
                                    editable: false,
                                    value: '110@1'
                                }),
                                {
                                    xtype: 'textfield',
                                    name: 'device_id',
                                    fieldLabel: '目標設備ID',
                                    emptyText: '00000001',
                                    allowBlank: false
                                },
                                {
                                    xtype: 'textfield',
                                    name: 'device_subid',
                                    fieldLabel: '目標設備SubID',
                                    emptyText: '1',
                                    allowBlank: false
                                },
                                {
                                    xtype: 'textfield',
                                    name: 'title',
                                    fieldLabel: '標題',
                                    allowBlank: false,
                                    anchor: '100%'
                                },
                                {
                                    xtype: 'textareafield',
                                    rows: 10,
                                    name: 'message',
                                    fieldLabel: '訊息',
                                    anchor: '100%'
                                }],

                            buttons: [{
                                text: '發佈',
                                formBind: true,
                                handler: function () {
                                    var form = this.up('form').getForm();
                                    if (form.isValid()) {
                                        form.submit({
                                            url: 'Handler.ashx?action=MSG',
                                            waitMsg: '訊息發佈中...',
                                            success: function (fp, o) {
                                                Ext.Msg.alert('成功', '訊息已經發佈！');
                                            }
                                        });
                                    }
                                }
                            }]
                        }),
                                                                Ext.create('Ext.form.Panel', {
                                                                    title: '信件通知',
                                                                    width: 400,
                                                                    bodyPadding: 10,
                                                                    frame: true,
                                                                    anchor: '100%',
                                                                    items: [
                                                                        Ext.create('Ext.form.ComboBox', {
                                                                            fieldLabel: '目標設備',
                                                                            name: 'full_model',
                                                                            store: Ext.create('Ext.data.Store', {
                                                                                fields: ['abbr', 'name'],
                                                                                data: [
                                                                                    { "abbr": "101@1", "name": "N7" },
                                                                                    { "abbr": "101@11", "name": "N10" }
                                                                                ]
                                                                            }),
                                                                            queryMode: 'local',
                                                                            displayField: 'name',
                                                                            valueField: 'abbr',
                                                                            editable: false,
                                                                            value: '101@1'
                                                                        }),
                                                                        {
                                                                            xtype: 'textfield',
                                                                            name: 'device_id',
                                                                            fieldLabel: '目標設備ID',
                                                                            emptyText: '00000001',
                                                                            allowBlank: false
                                                                        },
                                                                        {
                                                                            xtype: 'textfield',
                                                                            name: 'device_subid',
                                                                            fieldLabel: '目標設備SubID',
                                                                            emptyText: '1',
                                                                            allowBlank: false
                                                                        },
                                                                        {
                                                                            xtype: 'textfield',
                                                                            name: 'OL',
                                                                            fieldLabel: '平信數量',
                                                                            value: '1',
                                                                            allowBlank: false
                                                                        }, {
                                                                            xtype: 'textfield',
                                                                            name: 'RL',
                                                                            fieldLabel: '掛號信數量',
                                                                            value: '2',
                                                                            allowBlank: false
                                                                        }, {
                                                                            xtype: 'textfield',
                                                                            name: 'PK',
                                                                            fieldLabel: '包裹數量',
                                                                            value: '3',
                                                                            allowBlank: false
                                                                        }],

                                                                    buttons: [{
                                                                        text: '通知',
                                                                        formBind: true,
                                                                        handler: function () {
                                                                            var form = this.up('form').getForm();
                                                                            if (form.isValid()) {
                                                                                form.submit({
                                                                                    url: 'Handler.ashx?action=MAIL',
                                                                                    waitMsg: '信件通知中...',
                                                                                    success: function (fp, o) {
                                                                                        Ext.Msg.alert('成功', '信件已經通知！');
                                                                                    }
                                                                                });
                                                                            }
                                                                        }
                                                                    }]
                                                                })
                        ]
                    }
                ]

            });

        });
        </script>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>
