DataObjects/pman.links.ini
[Pman.Core] / Pman.js
diff --git a/Pman.js b/Pman.js
index e7d16f9..6210427 100644 (file)
--- a/Pman.js
+++ b/Pman.js
@@ -8,11 +8,17 @@
  * 
  * {tag: 'div', style: 'display:block;position:absolute;top:2;left:300;width:100%;height:25px'});
  * 
+ * 
+ *  CHANGES
+ *  - gtranslate moved to Pman.GoogleTranslate
+ * 
+ * 
  */
  
 if (typeof(_T) == 'undefined') { _T={};}
  
 
+
   
 
 Pman = new Roo.Document(
@@ -143,13 +149,15 @@ Pman = new Roo.Document(
                 //resizeTabs: true,
                 alwaysShowTabs: true,
                 minTabWidth: 140
-            } /*,
+            } ,
             south: {
+                collapsible : true,
+                collapsed : true,
                 split:false,
-                initialSize: 25,
+                height: 120,
                 titlebar: false
             }
-            */
+            
         });
         
         this.fireEvent('beforeload',this);
@@ -159,7 +167,7 @@ Pman = new Roo.Document(
         this.layout.beginUpdate();
         this.layout.add('north', new Roo.ContentPanel('title', 'North'));
         var au = Pman.Login.authUser;
-        if (au.id > 0 && au.company_id_background_color.length) {
+        if (au.id > 0 && au.company_id_background_color && au.company_id_background_color.length) {
             Roo.get('title').dom.style.backgroundColor = '#' + au.company_id_background_color;
             Roo.get('headerInformation').dom.style.color = this.invertColor('#' + au.company_id_background_color);
         }
@@ -321,10 +329,11 @@ Pman = new Roo.Document(
         var forceAdmin = function(data)
         {
             if (!data || !data.id) {
+                //Roo.log("Force Admin");
                 Pman.Dialog.PersonStaff.show( 
                     { 
                         id : 0, 
-                        company_id : Pman.Login.authUser.company_id * 1, 
+                        company_id : Pman.Login.authUser.company_id_id * 1, 
                         company_id_name : Pman.Login.authUser.company_id_name
                     }, function(data) {
                         forceAdmin(data);
@@ -348,12 +357,19 @@ Pman = new Roo.Document(
                 });
                 return;
             }
+            Pman.Login.authUser.company_id_id  = data.id;
             Pman.Login.authUser.company_id  = data.id;
             Pman.Login.authUser.company_id_name  = data.name;
             forceAdmin();
         }
         
         if (Pman.Login.authUser.id < 0) {
+            // admin company has been created - create the user..
+            if (Pman.Login.authUser.company_id_id* 1 > 0) {
+                forceAdmin();
+                return;
+            }
+            
             forceCompany();
             /// create account..
             
@@ -636,6 +652,8 @@ Pman = new Roo.Document(
         this.download(c);
 
     },
+    
+    
     prettyDate : function (value) 
     {
         if (typeof(value) == 'string') {
@@ -819,11 +837,17 @@ Pman = new Roo.Document(
             if (typeof(mod) == 'function') {
                 mod();
                 
-            } else {
-                if (mod.parent.layout && !mod.module.disabled) {
+            } else  if (mod.parent.layout && !mod.module.disabled) {
+                // honour permname setings..
+                if (mod.permname && mod.permname.length) {
+                    if (Pman.hasPerm(mod.permname, 'S')) {
+                        mod.module.add(mod.parent.layout, mod.region);    
+                    }
+                } else {
                     mod.module.add(mod.parent.layout, mod.region);    
                 }
-                
+                    
+                 
             }
             
             
@@ -842,38 +866,6 @@ Pman = new Roo.Document(
         
     },
     
-    gtranslate : function(str, src, dest, cb) {
-        // load script: 
-        
-        
-        var x = new Roo.data.ScriptTagProxy({ 
-            url:  'http://ajax.googleapis.com/ajax/services/language/translate', 
-            callbackParam : 'callback' 
-        });
-        x.load(
-            {
-                v: '1.0',
-                q : str,
-                langpair : src + '|' +dest
-            }, // end params.
-            { // reader
-                readRecords : function (o) {
-                    if (!o.responseData) {
-                        return o;
-                    }
-                    return o.responseData.translatedText;
-                }
-            }, 
-            function (result) {
-                cb(result);
-            },
-            this,
-            []
-        );
-        
-            
-        
-    } ,
     invertColor : function(c)
     {
         // read..