]> git.proxmox.com Git - pmg-gui.git/commitdiff
cleanup, add MailProxyPorts
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 24 Feb 2017 10:00:42 +0000 (11:00 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 24 Feb 2017 10:00:42 +0000 (11:00 +0100)
js/MailProxyConfiguration.js
js/MailProxyPorts.js [new file with mode: 0644]
js/MailProxyRelaying.js
js/Makefile

index 259bef2284a4378af593ac8d92fc34f8e39a7dab..a5ce8bc38fb256c49012af5eef80d318fdd35679 100644 (file)
@@ -11,7 +11,7 @@ Ext.define('PMG.MailProxyConfiguration', {
        },
        {
            title: gettext('Ports'),
-           html: "Ports",
+           xtype: 'pmgMailProxyPorts'
        },
        {
             title: gettext('Options'),
diff --git a/js/MailProxyPorts.js b/js/MailProxyPorts.js
new file mode 100644 (file)
index 0000000..a5b7da0
--- /dev/null
@@ -0,0 +1,69 @@
+Ext.define('PMG.MailProxyPorts', {
+    extend: 'Proxmox.grid.ObjectGrid',
+    alias: ['widget.pmgMailProxyPorts'],
+
+    initComponent : function() {
+       var me = this;
+
+       var rows = {
+           ext_port: {
+               required: true,
+               defaultValue: 26,
+               header: gettext('External SMTP Port'),
+               editor: {
+                   xtype: 'proxmoxWindowEdit',
+                   subject: gettext('External SMTP Port'),
+                   items: {
+                       xtype: 'proxmoxintegerfield',
+                       name: 'ext_port',
+                       minValue: 1,
+                       maxValue: 65535,
+                       deleteEmpty: true,
+                       value: 26,
+                       labelWidth: 150,
+                       fieldLabel: gettext('External SMTP Port')
+                   }
+               }
+           },
+           int_port: {
+               required: true,
+               defaultValue: 25,
+               header: gettext('Internal SMTP Port'),
+               editor: {
+                   xtype: 'proxmoxWindowEdit',
+                   subject: gettext('Internal SMTP Port'),
+                   items: {
+                       xtype: 'proxmoxintegerfield',
+                       name: 'int_port',
+                       minValue: 1,
+                       maxValue: 65535,
+                       deleteEmpty: true,
+                       value: 25,
+                       labelWidth: 150,
+                       fieldLabel: gettext('Internal SMTP Port')
+                   }
+               }
+           }
+       };
+
+       var baseurl = '/config/mail';
+
+       Ext.apply(me, {
+           url: '/api2/json' + baseurl,
+           editorConfig: {
+               url: '/api2/extjs' + baseurl,
+           },
+           interval: 5000,
+           cwidth1: 200,
+           rows: rows,
+           listeners: {
+               itemdblclick: me.run_editor
+           }
+       });
+
+       me.callParent();
+
+       me.on('activate', me.rstore.startUpdate);
+       me.on('destroy', me.rstore.stopUpdate);
+    }
+});
index 1fe986dfe631a3240fd2159d55fe67c1065771df..da8757751d55def64e3cffcd49dac59d9f36d190 100644 (file)
@@ -27,7 +27,7 @@ Ext.define('PMG.MailProxyRelaying', {
                header: gettext('SMTP port'),
                editor: {
                    xtype: 'proxmoxWindowEdit',
-                   subject: gettext('SMTP port'),
+                   subject: gettext('SMTP Port'),
                    items: {
                        xtype: 'proxmoxintegerfield',
                        name: 'relayport',
@@ -77,48 +77,16 @@ Ext.define('PMG.MailProxyRelaying', {
 
        var baseurl = '/config/mail';
 
-       var reload = function() {
-           me.rstore.load();
-       };
-
-       var run_editor = function() {
-           var sm = me.getSelectionModel();
-           var rec = sm.getSelection()[0];
-           if (!rec) {
-               return;
-           }
-
-           var rowdef = rows[rec.data.key];
-           if (!rowdef.editor) {
-               return;
-           }
-
-           var win;
-           if (Ext.isString(rowdef.editor)) {
-               win = Ext.create(rowdef.editor, {
-                   confid: rec.data.key,
-                   url: '/api2/extjs/' + baseurl
-               });
-           } else {
-               var config = Ext.apply({
-                   confid: rec.data.key,
-                   url: '/api2/extjs/' + baseurl
-               }, rowdef.editor);
-               win = Ext.createWidget(rowdef.editor.xtype, config);
-               win.load();
-           }
-
-           win.show();
-           win.on('destroy', reload);
-       };
-
        Ext.apply(me, {
-           url: '/api2/json/' + baseurl,
+           url: '/api2/json' + baseurl,
+           editorConfig: {
+               url: '/api2/extjs' + baseurl,
+           },
            interval: 5000,
            cwidth1: 200,
            rows: rows,
            listeners: {
-               itemdblclick: run_editor
+               itemdblclick: me.run_editor
            }
        });
 
index 2042168d7b6022dd55af9c7ab492f9d763364fe2..4b10023f96fa8008daea7761a3f30d4ce3161301 100644 (file)
@@ -5,6 +5,7 @@ JSSRC=                                                  \
        RuleConfiguration.js                            \
        SystemConfiguration.js                          \
        MailProxyRelaying.js                            \
+       MailProxyPorts.js                               \
        MailProxyConfiguration.js                       \
        ConfigPanel.js                                  \
        Workspace.js