How can I add a panel to the User Panel/Form?

21 views
Skip to first unread message

Valerie Wagner

unread,
Mar 26, 2014, 2:50:37 PM3/26/14
to scmma...@googlegroups.com
Hi,

We need to add additional info panels to the "User Form" panel.  When you click on "Users" and then select a user, you currently get two tabs: "User Form" and "Permissions". We need to track additional information about our users, and need to add a  couple more panels.

With repositories, we can easily add panels because of the Sonia.repository.openListeners.push() function. I can find no similar operation for users.

One method I've investigated is listening for the "login" event, then registering a tab change listener:


main
.getMainTabPanel().on('tabchange', tabChangeListener);


In the tabChangeListener() function, I can check if the tab's xtype is "UserPanel". However, when a user is selected, the panels that are displayed are created through this function:


Sonia.user.setEditPanel = function(panels){
 
var editPanel = Ext.getCmp('userEditPanel');
  editPanel
.removeAll();
 
Ext.each(panels, function(panel){
    editPanel
.add(panel);
 
});
  editPanel
.setActiveTab(0);
  editPanel
.doLayout();
};



I've tried getting the editPanel myself and adding a new panel, but the Ext JS documentation says something about this method not working for a particular layout, which I believe SCMM is using.

Any advice would be appreciated!

thanks,
Valerie

Sebastian Sdorra

unread,
Mar 27, 2014, 3:36:54 AM3/27/14
to scmma...@googlegroups.com
Hi,
You are right there is no "nice" method for adding panels to the user overview. But there is a way to do this. You have to override the selectItem method of the Sonia.user.Grid:

// store original method
Sonia.user.Grid.prototype.selectItemYourPluginId = Sonia.user.Grid.prototype.selectItem;

// override the user grid
Ext.override(Sonia.user.Grid, {

  // override the original method
  selectItem: function(user){
    // call the original method
    this.selectItemYourPluginId(user);
    // get a reference of the edit panel
    var editPanel = Ext.getCmp('userEditPanel');
    // add your own panel
    editPanel.add({
      xtype: 'panel',
      title: 'Hello User',
      html: '<h1>Hello User ' + user.name + '</h1>'
    });
    // insome cases you have to call doLayout
    // editPanel.doLayout();
  }

});

I hope this helps.

Sebastian



--
You received this message because you are subscribed to the Google Groups "scmmanager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scmmanager+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages