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(
21 rightNames: { }, /// register right names here - so they can be translated and rendered.
23 * @property {Roo.menu.Menu} pulldownMenu - the 'add menu pulldown, you can use it to add items..
29 buildCompleted : false, // flag to say if we are building interface..
31 'beforeload' : true, // fired after page ready, before module building.
32 'load' : true, // fired after module building
33 'authrefreshed' : true // fire on auth updated?? - should be on Login?!?!?
36 onBuildComplete : function ()
39 this.building = false;
40 //this.layout.getRegion('center').showPanel(0);
41 //this.layout.endUpdate();
42 //this.addTopToolbar();
44 this.fireEvent('load',this);
53 // kludge to fix firebug debugger
54 if (typeof(console) == 'undefined') {
55 console = { log : function() { } };
59 if (Roo.get('loading')) {
60 Roo.get('loading').remove();
63 Roo.state.Manager.setProvider(new Roo.state.CookieProvider());
69 if (showNewPass.length) {
70 Pman.PasswordChange.show( { passwordReset : showNewPass },
72 // fail and success we do a load...
84 if (Roo.get('loading-logo-tile')) {
85 Roo.get('loading-logo-tile').remove();
87 if (Roo.get('loading-logo-tile-top')) {
88 Roo.get('loading-logo-tile-top').remove();
90 if (Roo.get('loading-logo-bottom')) {
91 Roo.get('loading-logo-bottom').remove();
93 if (Roo.get('loading-logo-center')) {
94 Roo.get('loading-logo-center').remove();
99 loadUserInterface : function()
101 // triggers after authentication verified...
103 if (Roo.get('loading')) {
104 Roo.get('loading').remove();
106 if (Roo.get('loading-mask')) {
107 Roo.get('loading-mask').show();
110 document.title = appName + ' v' + AppVersion + ' - ' + au.company_id_name;
118 Pman.building = true;
120 Roo.XComponent.on('buildcomplete', this.onBuildComplete, this);
121 Roo.XComponent.build();
126 finalize : function() {
130 window.onbeforeunload = function(e) {
131 e = e || window.event;
132 var r = "Closing this window will loose changes, are you sure you want to do that?";
134 // For IE and Firefox
144 Roo.bootstrap.MessageBox.hide();
146 if (Roo.get('loading-mask')) {
147 Roo.get('loading-mask').remove();
151 this.buildCompleted = true; // now we can force refreshes on everything..
154 // does the URL indicate we want to see a system..
155 if (AppTrackOnLoad * 1 > 0) {
156 this.onLoadTrack(AppTrackOnLoad,false);
161 var forceAdmin = function(data)
163 if (!data || !data.id) {
164 //Roo.log("Force Admin");
165 Pman.Dialog.PersonStaff.show(
168 company_id : Pman.Login.authUser.company_id_id * 1,
169 company_id_name : Pman.Login.authUser.company_id_name
176 Roo.state.Manager.set('Pman.Login.username', data.email),
177 window.onbeforeunload = false;
178 document.location = baseURL + '?ts=' + Math.random();
181 var forceCompany = function(data) {
182 if (Pman.Login.authUser.company_id * 1 > 0) {
186 if (!data || !data.id) {
187 Pman.Dialog.CoreCompanies.show( { id : 0, comptype: 'OWNER' }, function(data) {
188 Roo.log("company dialog returned");
194 Pman.Login.authUser.company_id_id = data.id;
195 Pman.Login.authUser.company_id = data.id;
196 Pman.Login.authUser.company_id_name = data.name;
197 Roo.log("forcing admin");
201 if (Pman.Login.authUser.id < 0) {
202 // admin company has been created - create the user..
203 if (Pman.Login.authUser.company_id_id* 1 > 0) {