PHP7 fix
[Pman.Core] / Pman.register.js
1 /**
2  * DEPRICATED : use Roo.XComponents now..
3  * 
4  * Pman.register({
5  modKey : '00-admin-xxxx',
6  module : Pman.Tab.projectMgr, << really a components..
7  part : [ 'Admin', 'ProjectManager' ]
8  moduleOwner : 
9  region : 'center',
10  parent : Pman.layout
11  })
12  * 
13  */
14 Pman.register = function (obj)
15 {
16
17     //this.xregister(obj);
18
19
20     // old style calls go in here..
21     // we need to convert the object so that it looks a bit like an XCompoenent..
22
23     obj.render = function ()
24     {
25         if (!this.parent) {
26             Roo.log("Skip module, as parent does not exist");
27             Roo.log(this);
28             return;
29         }
30         //if (typeof(mod) == 'function') {
31         //    mod();
32
33         if (typeof (this.region) == 'undefined') {
34             Roo.log("Module does not have region defined, skipping");
35             Roo.log(this);
36             return;
37         }
38         if (this.module.disabled) {
39             Roo.log("Module disabled, should not rendering");
40             Roo.log(this);
41             return;
42         }
43
44         if (!this.parent.layout) {
45             Roo.log("Module parent does not have property layout.");
46             Roo.log(this);
47             return;
48         }
49
50         // honour DEPRICATED permname setings..
51         // new code should use PART name, and matching permissions.
52         if (this.permname && this.permname.length) {
53             if (!Pman.hasPerm(this.permname, 'S')) {
54                 return;
55             }
56
57         }
58         this.add(this.parent.layout, this.region);
59         this.el = this.layout;
60
61
62
63     };
64     // map some of the standard properties..
65     obj.order = obj.modKey;
66
67     // a bit risky...
68
69
70
71     // the other issue we have is that
72
73
74     // Roo.log("CALLING XComponent register with : " + obj.name);
75     Roo.log(obj);
76     // this will call xregister as it's the on.register handler..
77     Roo.XComponent.register(obj.isTop ? obj : Roo.apply(obj.module, obj));
78
79 }