PHP8
[Pman.BAdmin] / Pman.js
diff --git a/Pman.js b/Pman.js
index 8a92206..25daefc 100644 (file)
--- a/Pman.js
+++ b/Pman.js
@@ -30,6 +30,7 @@ Pman = new Roo.Document(
     
     buildCompleted : false, // flag to say if we are building interface..
     events : {
+        'beforeauth' : true, // fired after page ready, before authentication check
         'beforeload' : true, // fired after page ready, before module building.
         'load' : true, // fired after module building
         'authrefreshed' : true // fire on auth updated?? - should be on Login?!?!?
@@ -37,7 +38,6 @@ Pman = new Roo.Document(
 
     onBuildComplete : function ()
     {
-        
         this.building = false;   
         //this.layout.getRegion('center').showPanel(0);
         //this.layout.endUpdate(); 
@@ -45,6 +45,20 @@ Pman = new Roo.Document(
         this.finalize();
         this.fireEvent('load',this);
         
+        if (Pman.Login.authUser) {
+            (function() {
+                if (typeof(FS) == 'undefined') {
+                    Roo.log("failed to initialize FS");
+                    return;
+                }
+
+                FS.identify(Pman.Login.authUser.id, {
+                    displayName: Pman.Login.authUser.firstname + ' ' + Pman.Login.authUser.lastname,
+                    email: Pman.Login.authUser.email
+                  });
+            }).defer(300);
+        }
+        
         
     },
     listeners : {
@@ -65,19 +79,7 @@ Pman = new Roo.Document(
             Roo.state.Manager.setProvider(new Roo.state.CookieProvider());
             Roo.bootstrap.Tooltip.init(); 
 
-             
-            // reset password!!!!
-            /*
-            if (showNewPass.length) {
-                Pman.PasswordChange.show(  { passwordReset : showNewPass },
-                    function(data) {
-                        // fail and success we do  a load...
-                        Pman.Login.onLoad();
-                    }
-                );
-                return;
-            }
-            */
+           
             Pman.Login.onLoad();
             
         },
@@ -99,13 +101,16 @@ Pman = new Roo.Document(
         
     },
     loadUserInterface : function()
-    {
-        
+    {       
         if (this.buildCompleted) { // it get's called from auth checking.. no need to build again..
             return; 
         }
         // triggers after authentication verified...
         
+        if(typeof(uiConfig.fullstory) != 'undefined'){
+            this.fullstory();
+        }
+        
         if (Roo.get('loading')) {
             Roo.get('loading').remove();
         }
@@ -123,7 +128,7 @@ Pman = new Roo.Document(
         
         Pman.building = true;
         
-        
+        Roo.XComponent.hideProgress = true;
         Roo.XComponent.on('beforebuild',  this.onBeforeBuild, this);
         
         Roo.XComponent.on('buildcomplete',  this.onBuildComplete, this);
@@ -168,7 +173,7 @@ Pman = new Roo.Document(
         
 
     }, 
-   genericDelete : function(tab,tbl) {
+    genericDelete : function(tab,tbl) {
         
         var r = [];
         
@@ -182,12 +187,13 @@ Pman = new Roo.Document(
         for(var i = 0; i < s.length; i++) {
             r.push(s[i].json.id);
         }
-    
+        
         Roo.bootstrap.MessageBox.confirm("Confirm", "Are you sure you want to delete that?",
             function(btn) {
                 if (btn != 'yes') {
                     return;
                 }
+                
                 //tab.grid.mask("Deleting");
                 new Pman.Request({
                     url: baseURL + '/Roo/'+tbl+'.php',
@@ -213,7 +219,9 @@ Pman = new Roo.Document(
                         
                     },
                     failure: function(act) {
-                        Roo.log(act);
+                        Roo.bootstrap.MessageBox.hide();
+                        
+                        //Roo.log(act);
                         var msg = '';
                         try {
                             msg = act.errorMsg;
@@ -222,6 +230,7 @@ Pman = new Roo.Document(
                         }
                         //tab.grid.unmask();
                         Roo.bootstrap.MessageBox.alert("Error",  msg);
+                        
                     }
                     
                 });
@@ -231,8 +240,8 @@ Pman = new Roo.Document(
         return '';
     },
     /* fired before building - check permissions on a component.. */
-    beforeBuild : function() {
-        
+    onBeforeBuild : function(obj) 
+    {
         if (typeof(obj.part) == 'undefined')  {
             return;
         }
@@ -243,11 +252,14 @@ Pman = new Roo.Document(
         var permname = obj.part.join('.');
             
         Roo.log("CHECKING: "+ permname);
-            
-                // we now have permission...
-                // obj.moduleOwner '.' lname
-             
-        if (Pman.Login.authUser.hasPermExists(permname) && !Pman.Login.authUser.hasPerm(permname,'S')) {
+        
+        if (typeof(appDisabled) != 'undefined' && appDisabled.indexOf(permname)> -1)  {
+            obj.disabled = true;
+        }
+        // we now have permission...
+        // obj.moduleOwner '.' lname
+     
+        if (Pman.Login.hasPermExists(permname) && !Pman.Login.hasPerm(permname,'S')) {
             // it's a turned off permission...
             Roo.log(permname + " is Disabled for this user");
             obj.disabled = true;
@@ -255,7 +267,7 @@ Pman = new Roo.Document(
         }
         
         if (obj.permname && obj.permname.length &&
-            Pman.Login.authUser.hasPermExists(obj.permname) && !Pman.Login.authUser.hasPerm(obj.permname,'S')) {
+            Pman.Login.hasPermExists(obj.permname) && !Pman.Login.hasPerm(obj.permname,'S')) {
             // it's a turned off permission...
             Roo.log(obj.permname + " is Disabled for this user");
             obj.disabled = true;
@@ -263,5 +275,28 @@ Pman = new Roo.Document(
         }
             
         
+    },
+    
+    fullstory : function()
+    {
+        if(uiConfig.fullstory.domains.indexOf(location.host) < 0){
+            return;
+        }
+
+        window['_fs_debug'] = false;
+        window['_fs_host'] = 'fullstory.com';
+        window['_fs_org'] = uiConfig.fullstory.account;
+        window['_fs_namespace'] = 'FS';
+        (function(m,n,e,t,l,o,g,y){
+            if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;}
+            g=m[e]=function(a,b){g.q?g.q.push([a,b]):g._api(a,b);};g.q=[];
+            o=n.createElement(t);o.async=1;o.src='https://'+_fs_host+'/s/fs.js';
+            y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);
+            g.identify=function(i,v){g(l,{uid:i});if(v){g(l,v)}};g.setUserVars=function(v){g(l,v)};
+            g.identifyAccount=function(i,v){o='account';v=v||{};v.acctId=i;g(o,v)};
+            g.clearUserCookie=function(c,d,i){if(!c || document.cookie.match('fs_uid=[`;`]*`[`;`]*`[`;`]*`')){
+            d=n.domain;while(1){n.cookie='fs_uid=;domain='+d+
+            ';path=/;expires='+new Date(0).toUTCString();i=d.indexOf('.');if(i<0){break;}d=d.slice(i+1)}}};
+        })(window,document,window['_fs_namespace'],'script','user');
     }
 });