4 * This is the main Pman class [for bootstrap]
6 * In theory it's lighter than the original, as no BC concerns..
16 Pman = new Roo.Document(
19 // Tab not needed, as that's now our top level UI element..
23 rightNames: { }, /// register right names here - so they can be translated and rendered.
25 * @property {Roo.menu.Menu} pulldownMenu - the 'add menu pulldown, you can use it to add items..
31 buildCompleted : false, // flag to say if we are building interface..
33 'beforeload' : true, // fired after page ready, before module building.
34 'load' : true, // fired after module building
35 'authrefreshed' : true // fire on auth updated?? - should be on Login?!?!?
38 onBuildComplete : function ()
41 this.building = false;
42 //this.layout.getRegion('center').showPanel(0);
43 //this.layout.endUpdate();
44 //this.addTopToolbar();
46 this.fireEvent('load',this);
55 // kludge to fix firebug debugger
56 if (typeof(console) == 'undefined') {
57 console = { log : function() { } };
61 if (Roo.get('loading')) {
62 Roo.get('loading').remove();
65 Roo.state.Manager.setProvider(new Roo.state.CookieProvider());
71 if (showNewPass.length) {
72 Pman.PasswordChange.show( { passwordReset : showNewPass },
74 // fail and success we do a load...
86 if (Roo.get('loading-logo-tile')) {
87 Roo.get('loading-logo-tile').remove();
89 if (Roo.get('loading-logo-tile-top')) {
90 Roo.get('loading-logo-tile-top').remove();
92 if (Roo.get('loading-logo-bottom')) {
93 Roo.get('loading-logo-bottom').remove();
95 if (Roo.get('loading-logo-center')) {
96 Roo.get('loading-logo-center').remove();
101 loadUserInterface : function()
103 // triggers after authentication verified...
105 if (Roo.get('loading')) {
106 Roo.get('loading').remove();
108 if (Roo.get('loading-mask')) {
109 Roo.get('loading-mask').show();
112 document.title = appName + ' v' + AppVersion + ' - ' + au.company_id_name;
120 Pman.building = true;
122 Roo.XComponent.on('buildcomplete', this.onBuildComplete, this);
123 Roo.XComponent.build();
128 finalize : function() {
132 window.onbeforeunload = function(e) {
133 e = e || window.event;
134 var r = "Closing this window will loose changes, are you sure you want to do that?";
136 // For IE and Firefox
146 Roo.bootstrap.MessageBox.hide();
148 if (Roo.get('loading-mask')) {
149 Roo.get('loading-mask').remove();
153 this.buildCompleted = true; // now we can force refreshes on everything..
156 // does the URL indicate we want to see a system..
160 var forceAdmin = function(data)
162 if (!data || !data.id) {
163 //Roo.log("Force Admin");
164 Pman.Dialog.PersonStaff.show(
167 company_id : Pman.Login.authUser.company_id_id * 1,
168 company_id_name : Pman.Login.authUser.company_id_name
175 Roo.state.Manager.set('Pman.Login.username', data.email),
176 window.onbeforeunload = false;
177 document.location = baseURL + '?ts=' + Math.random();
180 var forceCompany = function(data) {
181 if (Pman.Login.authUser.company_id * 1 > 0) {
185 if (!data || !data.id) {
186 Pman.Dialog.CoreCompanies.show( { id : 0, comptype: 'OWNER' }, function(data) {
187 Roo.log("company dialog returned");
193 Pman.Login.authUser.company_id_id = data.id;
194 Pman.Login.authUser.company_id = data.id;
195 Pman.Login.authUser.company_id_name = data.name;
196 Roo.log("forcing admin");
200 if (Pman.Login.authUser.id < 0) {
201 // admin company has been created - create the user..
202 if (Pman.Login.authUser.company_id_id* 1 > 0) {