Sebastian Sdorra avatar Sebastian Sdorra committed a8d4e52

start implementation of ui for global user permissions

Comments (0)

Files changed (10)

scm-webapp/src/main/webapp/resources/js/group/sonia.group.formpanel.js

 
   initComponent: function(){
     this.addEvents('preCreate', 'created', 'preUpdate', 'updated', 'updateFailed', 'creationFailed');
-    Sonia.repository.FormPanel.superclass.initComponent.apply(this, arguments);
+    Sonia.group.FormPanel.superclass.initComponent.apply(this, arguments);
   },
 
   update: function(group){

scm-webapp/src/main/webapp/resources/js/group/sonia.group.grid.js

 
   renderMembers: function(members){
     var out = '';
-    if ( members != null ){
+    if ( members !== null ){
       var s = members.length;
       for ( var i=0; i<s; i++ ){
         out += members[i];
         }
       }
     },{
-      item: group,
       xtype: 'permissionsPanel',
       baseUrl: 'security/permission/group/' + group.name
     }]);

scm-webapp/src/main/webapp/resources/js/group/sonia.group.js

   });
   editPanel.setActiveTab(0);
   editPanel.doLayout();
-}
+};
 
 /**
  * panels
   bodyCssClass: 'x-panel-mc',
   padding: 5,
   html: 'Add or select a Group'
-}
+};

scm-webapp/src/main/webapp/resources/js/group/sonia.group.memberformpanel.js

       singleSelect: true
     });
 
-    if ( this.item != null ){
+    if ( this.item !== null ){
       var data = [];
-      if ( this.item.members != null ){
+      if ( this.item.members !== null ){
         for ( var i=0; i<this.item.members.length; i++ ){
           var a = [];
           a.push( this.item.members[i] );

scm-webapp/src/main/webapp/resources/js/group/sonia.group.panel.js

           }]
         }
       ]
-    }
+    };
 
     Ext.apply(this, Ext.apply(this.initialConfig, config));
     Sonia.group.Panel.superclass.initComponent.apply(this, arguments);
         buttons: Ext.MessageBox.OKCANCEL,
         icon: Ext.MessageBox.QUESTION,
         fn: function(result){
-          if ( result == 'ok' ){
+          if ( result === 'ok' ){
 
             if ( debug ){
               console.debug( 'remove group ' + item.name );

scm-webapp/src/main/webapp/resources/js/group/sonia.group.propertiesformpanel.js

         fieldLabel: this.nameText,
         name: 'name',
         allowBlank: false,
-        readOnly: this.item != null,
+        readOnly: this.item !== null,
         helpText: this.nameHelpText,
         vtype: 'name'
       },{
         xtype: 'textarea',
         helpText: this.descriptionHelpText
       }]
-    }
+    };
     
     Ext.apply(this, Ext.apply(this.initialConfig, config));
     Sonia.group.PropertiesFormPanel.superclass.initComponent.apply(this, arguments);

scm-webapp/src/main/webapp/resources/js/user/sonia.user.formpanel.js

       fieldLabel: this.nameText,
       name: 'name',
       allowBlank: false,
-      readOnly: this.item != null,
+      readOnly: this.item !== null,
       helpText: this.usernameHelpText,
       vtype: 'username'
     },{
       helpText: this.mailHelpText
     }];
 
-    if ( this.item == null || this.item.type == state.defaultUserType ){
+    if ( this.item === null || this.item.type === state.defaultUserType ){
       items.push({
         fieldLabel: this.passwordText,
         id: 'pwd',
   },
   
   isReadOnly: function(){
-    return this.item != null && this.item.type != state.defaultUserType;
+    return this.item !== null && this.item.type !== state.defaultUserType;
   },
 
   fixRequest: function(user){

scm-webapp/src/main/webapp/resources/js/user/sonia.user.grid.js

         scope: this
       }
     });
-    if ( item.type == state.defaultUserType ){
+    if ( item.type === state.defaultUserType ){
       panel.getForm().setValues([
         {id: 'password', value: dummyPassword},
         {id: 'password-confirm', value: dummyPassword}
       ]);
     }
-    Sonia.user.setEditPanel(panel);
+    Sonia.user.setEditPanel([panel,{
+      xtype: 'permissionsPanel',
+      baseUrl: 'security/permission/user/' + item.name
+    }]);
   }
 
 });

scm-webapp/src/main/webapp/resources/js/user/sonia.user.js

 
 // functions
 
-Sonia.user.setEditPanel = function(panel){
+Sonia.user.setEditPanel = function(panels){
   var editPanel = Ext.getCmp('userEditPanel');
   editPanel.removeAll();
-  editPanel.add(panel);
+  Ext.each(panels, function(panel){
+    editPanel.add(panel);
+  });
+  editPanel.setActiveTab(0);
   editPanel.doLayout();
-}
+};
 
 /**
  * Panels
   title: 'User Form',
   padding: 5,
   xtype: 'panel',
+  bodyCssClass: 'x-panel-mc',
   html: 'Add or select an User'
 };
 

scm-webapp/src/main/webapp/resources/js/user/sonia.user.panel.js

         xtype: 'userGrid',
         region: 'center',
         parentPanel: this
-      },{
+      }, {
         id: 'userEditPanel',
-        layout: 'fit',
+        xtype: 'tabpanel',
+        activeTab: 0,
+        height: 250,
+        split: true,
+        border: true,
+        region: 'south',
         items: [{
-          region: 'south',
+          bodyCssClass: 'x-panel-mc',
           title: 'User Form',
-          xtype: 'panel',
           padding: 5,
           html: this.emptyText
-        }],
-        height: 250,
-        split: true,
-        border: false,
-        region: 'south'
+        }]
       }]
     };
 
   },
 
   showAddPanel: function(){
-    var editPanel = Ext.getCmp('userEditPanel');
-    editPanel.removeAll();
-    var panel = new Sonia.user.FormPanel({
-      region: 'south',
+    Sonia.user.setEditPanel({
+      xtype: 'userEditPanel',
       title: this.titleText,
       padding: 5,
       onUpdate: {
         scope: this
       }
     });
-    editPanel.add(panel);
-    editPanel.doLayout();
   },
   
   resetPanel: function(){
         buttons: Ext.MessageBox.OKCANCEL,
         icon: Ext.MessageBox.QUESTION,
         fn: function(result){
-          if ( result == 'ok' ){
+          if ( result === 'ok' ){
 
             if ( debug ){
               console.debug( 'remove user ' + item.name );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.