]> git.proxmox.com Git - pmg-gui.git/commitdiff
MailProxyRelaying: configure relay setting
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 24 Feb 2017 08:51:09 +0000 (09:51 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 24 Feb 2017 08:52:51 +0000 (09:52 +0100)
js/MailProxyConfiguration.js [new file with mode: 0644]
js/MailProxyRelaying.js [new file with mode: 0644]
js/Makefile
js/Workspace.js

diff --git a/js/MailProxyConfiguration.js b/js/MailProxyConfiguration.js
new file mode 100644 (file)
index 0000000..259bef2
--- /dev/null
@@ -0,0 +1,39 @@
+Ext.define('PMG.MailProxyConfiguration', {
+    extend: 'Ext.tab.Panel',
+    alias: 'widget.pmgMailProxyConfiguration',
+
+    title: gettext('Mail Proxy Configuration'),
+
+    items: [
+       {
+           title: gettext('Relaying'),
+           xtype: 'pmgMailProxyRelaying'
+       },
+       {
+           title: gettext('Ports'),
+           html: "Ports",
+       },
+       {
+            title: gettext('Options'),
+           html: "Options"
+       },
+       {
+            title: gettext('Transports'),
+           html: "Transports"
+       },
+       {
+            title: gettext('Networks'),
+           html: "Networks"
+       },
+       {
+            title: gettext('TLS'),
+           html: "TLS"
+       },
+       {
+            title: gettext('Whitelist'),
+           html: "whitelist"
+       }
+    ]
+});
+
+
diff --git a/js/MailProxyRelaying.js b/js/MailProxyRelaying.js
new file mode 100644 (file)
index 0000000..f2ec834
--- /dev/null
@@ -0,0 +1,138 @@
+Ext.define('PMG.MailProxyRelaying', {
+    extend: 'Proxmox.grid.ObjectGrid',
+    alias: ['widget.pmgMailProxyRelaying'],
+
+    initComponent : function() {
+       var me = this;
+
+       var rows = {
+           relay: {
+               required: true,
+               defaultValue: Proxmox.Utils.noneText,
+               header: gettext('Default Relay'),
+               editor: {
+                   xtype: 'proxmoxWindowEdit',
+                   subject: gettext('Default Relay'),
+                   items: {
+                       xtype: 'proxmoxtextfield',
+                       name: 'relay',
+                       deleteEmpty: true,
+                       fieldLabel: gettext('Default Relay')
+                   }
+               }
+           },
+           relayport: {
+               required: true,
+               defaultValue: 25,
+               header: gettext('SMTP port'),
+               editor: {
+                   xtype: 'proxmoxWindowEdit',
+                   subject: gettext('SMTP port'),
+                   items: {
+                       xtype: 'proxmoxintegerfield',
+                       name: 'relayport',
+                       minValue: 1,
+                       maxValue: 65535,
+                       deleteEmpty: true,
+                       value: 25,
+                       fieldLabel: gettext('SMTP port')
+                   }
+               }
+           },
+           relaynomx: {
+               required: true,
+               defaultValue: 0,
+               header: gettext('Disable MX lookup'),
+               renderer: Proxmox.Utils.format_boolean,
+               editor: {
+                   xtype: 'proxmoxWindowEdit',
+                   subject: gettext('Disable MX lookup'),
+                   items: {
+                       xtype: 'proxmoxcheckbox',
+                       name: 'relaynomx',
+                       uncheckedValue: 0,
+                       defaultValue: 0,
+                       deleteDefaultValue: true,
+                       fieldLabel: gettext('Disable MX lookup')
+                   }
+               }
+           },
+           smarthost: {
+               required: true,
+               defaultValue: Proxmox.Utils.noneText,
+               header: gettext('Smarthost'),
+               editor: {
+                   xtype: 'proxmoxWindowEdit',
+                   subject: gettext('Smarthost'),
+                   items: {
+                       xtype: 'proxmoxtextfield',
+                       name: 'smarthost',
+                       deleteEmpty: true,
+                       fieldLabel: gettext('Smarthost')
+                   }
+               }
+           },
+
+       };
+
+       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, {
+                   pveSelNode: me.pveSelNode,
+                   confid: rec.data.key,
+                   url: '/api2/extjs/' + baseurl
+               });
+           } else {
+               var config = Ext.apply({
+                   pveSelNode: me.pveSelNode,
+                   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,
+           interval: 5000,
+           cwidth1: 250,
+           //tbar: [ edit_btn, revert_btn ],
+           rows: rows,
+           listeners: {
+               itemdblclick: run_editor
+               //selectionchange: set_button_status
+           }
+       });
+
+       me.callParent();
+
+       me.on('activate', me.rstore.startUpdate);
+       me.on('destroy', me.rstore.stopUpdate);
+
+       //me.rstore.on('datachanged', function() {
+       //set_button_status();
+       //});
+    }
+});
index 6055052230f662b549763ef1323280458a163755..2042168d7b6022dd55af9c7ab492f9d763364fe2 100644 (file)
@@ -4,6 +4,8 @@ JSSRC=                                                  \
        ServerAdministration.js                         \
        RuleConfiguration.js                            \
        SystemConfiguration.js                          \
+       MailProxyRelaying.js                            \
+       MailProxyConfiguration.js                       \
        ConfigPanel.js                                  \
        Workspace.js
 
index 7d0c5c8ed2e62b7d1c5017b5665483be1a509277..c78171a01031a3af786386312b3de77b475b71b5 100644 (file)
@@ -264,7 +264,7 @@ Ext.define('PMG.StdWorkspace', {
                            groups: ['configuration'],
                            title: 'Mail Proxy',
                            itemId: 'config-mail-proxy',
-                           html: "Mail Proxy"
+                           items: [{ xtype: 'pmgMailProxyConfiguration' }]
                        },
                        {
                            xtype: 'panel',