Fix #6913 - add more documentation to code
[roojs1] / Roo / bootstrap / MessageBox.js
index b4386d4..80a1ffd 100644 (file)
@@ -28,7 +28,7 @@ Roo.Msg.show({
    animEl: 'elId'
 });
 </code></pre>
- * @singleton
+ * @static
  */
 Roo.bootstrap.MessageBox = function(){
     var dlg, opt, mask, waitTimer;
@@ -61,10 +61,11 @@ Roo.bootstrap.MessageBox = function(){
             buttons["cancel"].hide();
             buttons["yes"].hide();
             buttons["no"].hide();
-            //dlg.footer.dom.style.display = 'none';
+            dlg.footerEl.hide();
+            
             return width;
         }
-        dlg.footerEl.dom.style.display = '';
+        dlg.footerEl.show();
         for(var k in buttons){
             if(typeof buttons[k] != "function"){
                 if(b[k]){
@@ -104,7 +105,7 @@ Roo.bootstrap.MessageBox = function(){
                     //collapsible : false,
                     //shim:true,
                     //modal: true,
-                  //  width:400,
+                //    width: 'auto',
                   //  height:100,
                     //buttonAlign:"center",
                     closeClick : function(){
@@ -151,11 +152,11 @@ Roo.bootstrap.MessageBox = function(){
                 progressEl.enableDisplayMode();
                 
                 // This is supposed to be the progessElement.. but I think it's controlling the height of everything..
-                //var pf = progressEl.dom.firstChild;
-                //if (pf) {
-                    //pp = Roo.get(pf.firstChild);
-                    //pp.setHeight(pf.offsetHeight);
-                //}
+                var pf = progressEl.dom.firstChild;
+                if (pf) {
+                    pp = Roo.get(pf.firstChild);
+                    pp.setHeight(pf.offsetHeight);
+                }
                 
             }
             return dlg;
@@ -170,7 +171,8 @@ Roo.bootstrap.MessageBox = function(){
         updateText : function(text)
         {
             if(!dlg.isVisible() && !opt.width){
-                dlg.setWidth(this.maxWidth);
+                dlg.dialogEl.setStyle({ 'max-width' : this.maxWidth});
+                // dlg.resizeTo(this.maxWidth, 100); // forcing the height breaks long alerts()
             }
             msgEl.innerHTML = text || '&#160;';
       
@@ -220,8 +222,10 @@ Roo.bootstrap.MessageBox = function(){
             if(text){
                 this.updateText(text);
             }
+            
             if (pp) { // weird bug on my firefox - for some reason this is not defined
                 pp.setWidth(Math.floor(value*progressEl.dom.firstChild.offsetWidth));
+                pp.setHeight(Math.floor(progressEl.dom.firstChild.offsetHeight));
             }
             return this;
         },        
@@ -338,6 +342,9 @@ Roo.Msg.show({
                 textareaEl.hide();
             }
             progressEl.setDisplayed(opt.progress === true);
+            if (opt.progress) {
+                d.animate = false; // do not animate progress, as it may not have finished animating before we close it..
+            }
             this.updateProgress(0);
             activeTextEl.dom.value = opt.value || "";
             if(opt.prompt){
@@ -401,12 +408,14 @@ Roo.Msg.show({
          * @param {Object} scope (optional) The scope of the callback function
          * @return {Roo.MessageBox} This message box
          */
-        alert : function(title, msg, fn, scope){
+        alert : function(title, msg, fn, scope)
+        {
             this.show({
                 title : title,
                 msg : msg,
                 buttons: this.OK,
                 fn: fn,
+                closable : false,
                 scope : scope,
                 modal : true
             });