]> git.proxmox.com Git - pmg-gui.git/blobdiff - js/Workspace.js
add simple LDAP configuration panel
[pmg-gui.git] / js / Workspace.js
index 1c35cb9dc2a4193f00f2ec70eaf1ccafd3bfe668..c57ddacb1bc81d36d49031585b737bf659001395 100644 (file)
@@ -19,11 +19,9 @@ Ext.define('PMG.Workspace', {
     updateLoginData: function(loginData) {
        var me = this;
 
-       console.dir(loginData);
-
        me.loginData = loginData;
-       PMG.CSRFPreventionToken = loginData.CSRFPreventionToken;
-       PMG.UserName = loginData.username;
+       Proxmox.CSRFPreventionToken = loginData.CSRFPreventionToken;
+       Proxmox.UserName = loginData.username;
 
        // creates a session cookie (expire = null)
        // that way the cookie gets deleted after browser window close
@@ -35,8 +33,8 @@ Ext.define('PMG.Workspace', {
     showLogin: function() {
        var me = this;
 
-       PMG.Utils.authClear();
-       PMG.UserName = null;
+       Proxmox.Utils.authClear();
+       Proxmox.UserName = null;
        me.loginData = null;
 
        if (!me.login) {
@@ -65,7 +63,7 @@ Ext.define('PMG.Workspace', {
 
        me.callParent();
 
-        if (!PMG.Utils.authOK()) {
+        if (!Proxmox.Utils.authOK()) {
            me.showLogin();
        } else {
            if (me.loginData) {
@@ -75,18 +73,21 @@ Ext.define('PMG.Workspace', {
 
        Ext.TaskManager.start({
            run: function() {
-               var ticket = PMG.Utils.authOK();
-               if (!ticket || !PMG.UserName) {
+               var ticket = Proxmox.Utils.authOK();
+               if (!ticket || !Proxmox.UserName) {
                    return;
                }
 
                Ext.Ajax.request({
                    params: {
-                       username: PMG.UserName,
+                       username: Proxmox.UserName,
                        password: ticket
                    },
                    url: '/api2/json/access/ticket',
                    method: 'POST',
+                   failure: function() {
+                       me.showLogin();
+                   },
                    success: function(response, opts) {
                        var obj = Ext.decode(response.responseText);
                        me.updateLoginData(obj.data);
@@ -109,7 +110,7 @@ Ext.define('PMG.StdWorkspace', {
        me.updateUserInfo();
 
        if (loginData) {
-           PMG.Utils.API2Request({
+           Proxmox.Utils.API2Request({
                url: '/version',
                method: 'GET',
                success: function(response) {
@@ -125,8 +126,8 @@ Ext.define('PMG.StdWorkspace', {
 
        var ui = me.query('#userinfo')[0];
 
-       if (PMG.UserName) {
-           var msg =  Ext.String.format(gettext("You are logged in as {0}"), "'" + PMG.UserName + "'");
+       if (Proxmox.UserName) {
+           var msg =  Ext.String.format(gettext("You are logged in as {0}"), "'" + Proxmox.UserName + "'");
            ui.update('<div class="x-unselectable" style="white-space:nowrap;">' + msg + '</div>');
        } else {
            ui.update('');
@@ -212,11 +213,12 @@ Ext.define('PMG.StdWorkspace', {
                    minWidth: 100,
                    minHeight: 100,
                    id: 'content',
+                   defaults: { layout: 'fit' },
                    xtype: 'pmgPanelConfig',
                    items: [
                        {
                            xtype: 'panel',
-                           title: 'Mail Filter',
+                           title: gettext('Mail Filter'),
                            itemId: 'filter',
                            expandedOnInit: true,
                            items: [{ xtype: 'pmgRuleConfiguration' }]
@@ -224,71 +226,71 @@ Ext.define('PMG.StdWorkspace', {
                        {
                            xtype: 'panel',
                            groups: ['filter'],
-                           title: 'Actions',
+                           title: PMG.Utils.oclass_text['action'],
                            itemId: 'filter-actions',
-                           html: "Actions"
+                           items: [{ xtype: 'pmgActionList' }]
                        },
                        {
                            xtype: 'panel',
                            groups: ['filter'],
-                           title: 'Who',
+                           title: PMG.Utils.oclass_text['who'],
                            itemId: 'filter-who',
-                           html: "Who"
+                           items: [{ xtype: 'pmgWhoConfiguration' }]
                        },
                        {
                            xtype: 'panel',
                            groups: ['filter'],
-                           title: 'What',
+                           title: PMG.Utils.oclass_text['what'],
                            itemId: 'filter-what',
-                           html: "What"
+                           items: [{ xtype: 'pmgWhatConfiguration' }]
+
                        },
                        {
                            xtype: 'panel',
                            groups: ['filter'],
-                           title: 'When',
+                           title: PMG.Utils.oclass_text['when'],
                            itemId: 'filter-when',
-                           html: "When"
+                           items: [{ xtype: 'pmgWhenConfiguration' }]
                        },
-
                        {
                            xtype: 'panel',
                            title: 'Configuration',
                            itemId: 'configuration',
                            expandedOnInit: true,
-                           html: "System Configuration"
+                           items: [{ xtype: 'pmgSystemConfiguration' }]
                        },
                        {
                            xtype: 'panel',
                            groups: ['configuration'],
-                           title: 'Mail Proxy',
+                           title: gettext('Mail Proxy'),
                            itemId: 'config-mail-proxy',
-                           html: "Mail Proxy"
+                           items: [{ xtype: 'pmgMailProxyConfiguration' }]
                        },
                        {
                            xtype: 'panel',
                            groups: ['configuration'],
-                           title: 'Spam Detector',
+                           title: gettext('Spam Detector'),
                            itemId: 'config-spam',
-                           html: "Spam Detector"
+                           items: [{ xtype: 'pmgSpamDetectorConfiguration' }]
                        },
                        {
                            xtype: 'panel',
                            groups: ['configuration'],
-                           title: 'Virus Detector',
+                           title: gettext('Virus Detector'),
                            itemId: 'config-virus',
-                           html: "Virus Detector"
+                           items: [{ xtype: 'pmgVirusDetectorConfiguration' }]
                        },
                        {
                            xtype: 'panel',
                            groups: ['configuration'],
-                           title: 'User Management',
+                           title: gettext('User Management'),
                            itemId: 'config-users',
-                           html: "User Management"
+                           items: [{ xtype: 'pmgUserManagement' }]
                        },
                        {
                            xtype: 'panel',
                            groups: ['configuration'],
-                           title: 'Cluster',
+                           title: gettext('Cluster'),
                            itemId: 'config-cluster',
                            html: "Cluster"
                        },
@@ -302,7 +304,7 @@ Ext.define('PMG.StdWorkspace', {
 
                        {
                            xtype: 'panel',
-                           title: 'Administration',
+                           title: gettext('Administration'),
                            itemId: 'admin',
                            expandedOnInit: true,
                            items: [{ xtype: 'pmgServerAdministration' }]
@@ -310,28 +312,28 @@ Ext.define('PMG.StdWorkspace', {
                        {
                            xtype: 'panel',
                            groups: ['admin'],
-                           title: 'Statistics',
+                           title: gettext('Statistics'),
                            itemId: 'statistics',
                            html: "Statistics"
                        },
                        {
                            xtype: 'panel',
                            groups: ['admin'],
-                           title: 'Quarantine',
+                           title: gettext('Quarantine'),
                            itemId: 'quarantine',
                            html: "Quarantine"
                        },
                        {
                            xtype: 'panel',
                            groups: ['admin'],
-                           title: 'Tracking Center',
+                           title: gettext('Tracking Center'),
                            itemId: 'tracking',
                            html: "Tracking Center"
                        },
                        {
                            xtype: 'panel',
                            groups: ['admin'],
-                           title: 'Queues',
+                           title: gettext('Queues'),
                            itemId: 'queues',
                            html: "Queues"
                        }