DataObjects/Core_locking.php
[Pman.Core] / Pman.js
diff --git a/Pman.js b/Pman.js
index 283ffc3..8cea223 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(
@@ -564,7 +570,7 @@ Pman = new Roo.Document(
      */
     request : function(c) {
         var r= new Roo.data.Connection({
-            timeout : typeof(c.timeout) == 'undefined' ?  30000 c.timeout
+            timeout : typeof(c.timeout) == 'undefined' ?  30000 c.timeout
         });
         r.request({
             url: c.url,
@@ -606,74 +612,16 @@ Pman = new Roo.Document(
             
         });
     },
-    csvFrame : false,
     
-    createCsvFrame: function()
-    {
-        
-        if (this.csvFrame) {
-            document.body.removeChild(this.csvFrame);
-        }
-            
-        var id = Roo.id();
-        this.csvFrame = document.createElement('iframe');
-        this.csvFrame.id = id;
-        this.csvFrame.name = id;
-        this.csvFrame.className = 'x-hidden';
-        if(Roo.isIE){
-            this.csvFrame.src = Roo.SSL_SECURE_URL;
-        }
-        document.body.appendChild(this.csvFrame);
-
-        if(Roo.isIE){
-            document.frames[id].name = id;
-        }
-        
-    },
-    /**
-     * download({
-          url: 
-         })
-     * 
-     * 
-     */
     
+    // depreciated - use Pman.Download()
     
     download : function(c) {
         
-        if (c.newWindow) {
-            // as ie seems buggy...
-            window.open( c.url + '?' + Roo.urlEncode(c.params || {}), '_blank');
-            return;
-            
-        }
-        
-        this.createCsvFrame();
-        function cb(){
-            var r = { responseText : "", responseXML : null };
-
-            var frame = this.csvFrame;
-
-            try { 
-                var doc = Roo.isIE ? 
-                    frame.contentWindow.document : 
-                    (frame.contentDocument || window.frames[this.csvFrame.id].document);
-                
-                if(doc && doc.body && doc.body.innerHTML.length){
-                  //  alert(doc.body.innerHTML);
-                    Roo.MessageBox.alert("Error download",doc.body.innerHTML);
-                }
-                 
-            }
-            catch(e) {
-            }
-
-            Roo.EventManager.removeListener(frame, 'load', cb, this);
-        }
-        Roo.EventManager.on( this.csvFrame, 'load', cb, this);
-        this.csvFrame.src = c.url;
+        return new Pman.Download(c);
     },
+    
+    // fixme - move to document manager...
     downloadRevision : function(doc, rev)
     {
         this.download({
@@ -682,18 +630,20 @@ Pman = new Roo.Document(
         }); 
                     
     },
+    
+    
     exportCSV : function(c) {
-        //this.createCsvFrame(); 
+        
         for(var i=0;i < c.csvFormat.length;i++) {
             c.params['csvCols['+i+']'] = c.csvFormat[i][0];
             c.params['csvTitles['+i+']'] = c.csvFormat[i][1];
         }
-        
-        
         c.url +=  '?' + Roo.urlEncode(c.params);
         this.download(c);
 
     },
+    
+    
     prettyDate : function (value) 
     {
         if (typeof(value) == 'string') {
@@ -877,11 +827,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);    
                 }
-                
+                    
+                 
             }
             
             
@@ -900,38 +856,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..