You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by sm...@apache.org on 2007/12/18 20:35:52 UTC

svn commit: r605310 - in /portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed: common.js common.src.js

Author: smilek
Date: Tue Dec 18 11:35:51 2007
New Revision: 605310

URL: http://svn.apache.org/viewvc?rev=605310&view=rev
Log:
change ajax requests to set encoding to "utf-8" - fixes JS2-820 http://issues.apache.org/jira/browse/JS2-820

added jetspeed.widget.openDialog to common.js so that it can be used by dojo admin portlets (openDialog fixes the mozilla problem where text fields in dialog boxes would not show insertion point)

Modified:
    portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.js
    portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.src.js

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.js?rev=605310&r1=605309&r2=605310&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.js (original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.js Tue Dec 18 11:35:51 2007
@@ -12,6 +12,9 @@
 if(!jetspeed.om){
 jetspeed.om={};
 }
+if(!jetspeed.widget){
+jetspeed.widget={};
+}
 jetspeed.version={major:2,minor:1,patch:0,flag:"dev",revision:"",toString:function(){
 with(jetspeed.version){
 return major+"."+minor+"."+patch+flag+" ("+revision+")";
@@ -46,12 +49,14 @@
 _1.stopEvent=function(_6,_7){
 try{
 _6=_6||window.event;
+if(_6){
 _6.cancelBubble=true;
 _6.returnValue=false;
 }
+}
 catch(ex){
 if(!_7&&djConfig.isDebug){
-dojo.debug("stopEvent failure: "+jetspeed.formatError(ex));
+dojo.debug("stopEvent ("+(typeof _6)+") failure: "+jetspeed.formatError(ex));
 }
 }
 };
@@ -505,6 +510,9 @@
 if(!this.mimetype){
 this.mimetype="text/html";
 }
+if(!this.encoding){
+this.encoding="utf-8";
+}
 };
 dojo.lang.extend(jetspeed.url.BindArgs,{createIORequest:function(){
 var _50=new dojo.io.Request(this.url,this.mimetype);
@@ -715,5 +723,36 @@
 }
 };
 }
+jetspeed.widget.openDialog=function(_8d){
+var _8e=jetspeed.UAmoz;
+if(_8e){
+_8d.domNode.style.position="fixed";
+if(!_8d._fixedIPtBug){
+var _8f=_8d;
+_8f.placeModalDialog=function(){
+var _90=dojo.html.getScroll().offset;
+var _91=dojo.html.getViewport();
+var mb;
+if(_8f.isShowing()){
+mb=dojo.html.getMarginBox(_8f.domNode);
+}else{
+dojo.html.setVisibility(_8f.domNode,false);
+dojo.html.show(_8f.domNode);
+mb=dojo.html.getMarginBox(_8f.domNode);
+dojo.html.hide(_8f.domNode);
+dojo.html.setVisibility(_8f.domNode,true);
+}
+var x=(_91.width-mb.width)/2;
+var y=(_91.height-mb.height)/2;
+with(_8f.domNode.style){
+left=x+"px";
+top=y+"px";
+}
+};
+_8f._fixedIPtBug=true;
+}
+}
+_8d.show();
+};
 jetspeed.initcommon();
-
+

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.src.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.src.js?rev=605310&r1=605309&r2=605310&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.src.js (original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/common.src.js Tue Dec 18 11:35:51 2007
@@ -35,6 +35,8 @@
     jetspeed.url = {};
 if ( ! jetspeed.om )
     jetspeed.om = {};
+if ( ! jetspeed.widget )
+    jetspeed.widget = {};
 
 // jetspeed version
 
@@ -91,13 +93,16 @@
                 try
                 {
                     evt = evt || window.event;
-                    evt.cancelBubble = true;
-                    evt.returnValue = false;
+                    if ( evt )
+                    {
+                        evt.cancelBubble = true;
+                        evt.returnValue = false;
+                    }
                 }
                 catch(ex)
                 {
                     if ( ! suppressErrors && djConfig.isDebug )
-                        dojo.debug( "stopEvent failure: " + jetspeed.formatError( ex ) );
+                        dojo.debug( "stopEvent (" + ( typeof evt ) + ") failure: " + jetspeed.formatError( ex ) );
                 }
     	    };
     	    jsObj._stopEvent = function(/*Event*/evt)
@@ -634,6 +639,9 @@
     
         if ( ! this.mimetype )
             this.mimetype = "text/html";
+
+        if ( ! this.encoding )
+            this.encoding = "utf-8";
     };
     
     dojo.lang.extend( jetspeed.url.BindArgs,
@@ -904,5 +912,46 @@
             loading.style[ "display" ] = "none";
     };
 }
+
+jetspeed.widget.openDialog = function( dialogWidget )
+{
+    var isMoz = jetspeed.UAmoz;
+    if ( isMoz )
+    {
+        dialogWidget.domNode.style.position = "fixed";  // this fix involves setting position to fixed instead of absolute,
+        if ( ! dialogWidget._fixedIPtBug )              // and the change to var x and var y initialization in placeModalDialog
+        {
+            var _dialog = dialogWidget;
+            _dialog.placeModalDialog = function() {
+                // summary: position modal dialog in center of screen
+
+                var scroll_offset = dojo.html.getScroll().offset;
+                var viewport_size = dojo.html.getViewport();
+    
+                // find the size of the dialog (dialog needs to be showing to get the size)
+                var mb;
+                if(_dialog.isShowing()){
+                    mb = dojo.html.getMarginBox(_dialog.domNode);
+                }else{
+                    dojo.html.setVisibility(_dialog.domNode, false);
+                    dojo.html.show(_dialog.domNode);
+                    mb = dojo.html.getMarginBox(_dialog.domNode);
+                    dojo.html.hide(_dialog.domNode);
+                    dojo.html.setVisibility(_dialog.domNode, true);
+                }
+                //var x = scroll_offset.x + (viewport_size.width - mb.width)/2;
+                //var y = scroll_offset.y + (viewport_size.height - mb.height)/2;
+                var x = (viewport_size.width - mb.width)/2;
+                var y = (viewport_size.height - mb.height)/2;
+                with(_dialog.domNode.style){
+                    left = x + "px";
+                    top = y + "px";
+                }
+            };
+            _dialog._fixedIPtBug = true;
+        }
+    }
+    dialogWidget.show();
+};
 
 jetspeed.initcommon();



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org