portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smi...@apache.org
Subject svn commit: r553988 [3/3] - in /portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop: core.js core.src.js
Date Fri, 06 Jul 2007 18:39:45 GMT
Modified: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.src.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.src.js?view=diff&rev=553988&r1=553987&r2=553988
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.src.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.src.js Fri Jul  6
11:39:44 2007
@@ -270,7 +270,7 @@
         jetspeed.prefs.windowActionNoImage = noImageMap;
     }
 
-    var docUrlObj = jetspeed.url.parse( document.location.href );
+    var docUrlObj = jetspeed.url.parse( window.location.href );
     var printModeOnly = jetspeed.url.getQueryParameter( docUrlObj, "jsprintmode" ) == "true";
     if ( printModeOnly )
     {
@@ -315,18 +315,20 @@
 };
 jetspeed.updatePage = function( navToPageUrl, backOrForwardPressed )
 {
-    var previousPage = jetspeed.page;
-    if ( ! navToPageUrl || jetspeed.pageNavigateSuppress ) return;
-    if ( previousPage && previousPage.equalsPageUrl( navToPageUrl ) )
+    var currentPage = jetspeed.page;
+    if ( ! navToPageUrl || ! currentPage || jetspeed.pageNavigateSuppress ) return;
+    if ( currentPage.equalsPageUrl( navToPageUrl ) )
         return ;
-    navToPageUrl = jetspeed.page.makePageUrl( navToPageUrl );
-    if ( previousPage != null && navToPageUrl != null )
+    navToPageUrl = currentPage.makePageUrl( navToPageUrl );
+    if ( navToPageUrl != null )
     {
-        var previousPageUrl = previousPage.getPageUrl();
-        previousPage.destroy();
-        var newJSPage = new jetspeed.om.Page( jetspeed.page.layoutDecorator, navToPageUrl,
(! djConfig.preventBackButtonFix && ! backOrForwardPressed) );
+        var currentLayoutDecorator = currentPage.layoutDecorator;
+        var currentEditMode = currentPage.editMode;
+        currentPage.destroy();
+        var newJSPage = new jetspeed.om.Page( currentLayoutDecorator, navToPageUrl, (! djConfig.preventBackButtonFix
&& ! backOrForwardPressed), currentEditMode );
         jetspeed.page = newJSPage;
         newJSPage.retrievePsml();
+        window.focus();   // to prevent IE from sending alt-arrow to tab container
     }
 };
 
@@ -828,7 +830,7 @@
     if ( ! jetspeed.page.editMode )
     {
         var fromDesktop = true;
-        var fromPortal = jetspeed.url.getQueryParameter( document.location.href, jetspeed.id.PORTAL_ORIGINATE_PARAMETER
);
+        var fromPortal = jetspeed.url.getQueryParameter( window.location.href, jetspeed.id.PORTAL_ORIGINATE_PARAMETER
);
         if ( fromPortal != null && fromPortal == "true" )
             fromDesktop = false;
         jetspeed.page.editMode = true;
@@ -1004,7 +1006,7 @@
 });
 
 // ... jetspeed.om.Page
-jetspeed.om.Page = function( requiredLayoutDecorator, navToPageUrl, addToHistory )
+jetspeed.om.Page = function( requiredLayoutDecorator, navToPageUrl, addToHistory, editMode
)
 {
     if ( requiredLayoutDecorator != null && navToPageUrl != null )
     {
@@ -1016,7 +1018,10 @@
     {
         this.setPsmlPathFromDocumentUrl();
     }
-    this.addToHistory = addToHistory;
+    if ( typeof addToHistory != "undefined" )
+        this.addToHistory = addToHistory;
+    if ( typeof editMode != "undefined" )
+        this.editMode = editMode;
     this.layouts = {};
     this.columns = [];
     this.portlets = [];
@@ -1037,6 +1042,7 @@
 
     requiredLayoutDecorator: null,
     pageUrlFallback: null,
+    addToHistory: false,
 
     layouts: null,
     columns: null,
@@ -1063,12 +1069,31 @@
         var psmlPath = jetspeed.url.path.AJAX_API;
         var docPath = null;
         if ( navToPageUrl == null )
-            docPath = document.location.pathname;
+        {
+            docPath = window.location.pathname;
+            if ( ! djConfig.preventBackButtonFix && jetspeed.prefs.ajaxPageNavigation
)
+            {
+                var hash = window.location.hash;
+                if ( hash != null && hash.length > 0 )
+                {
+                    if ( hash.indexOf( "#" ) == 0 )
+                    {
+                        hash = ( hash.length > 1 ? hash.substring(1) : "" );
+                    }
+                    if ( hash != null && hash.length > 1 && hash.indexOf(
"/" ) == 0 )
+                    {
+                        this.psmlPath = jetspeed.url.path.AJAX_API + hash;
+                        return;
+                    }
+                }
+            }
+        }
         else
         {
             var uObj = jetspeed.url.parse( navToPageUrl );
             docPath = uObj.path;
         }
+
         var contextAndServletPath = jetspeed.url.path.DESKTOP;
         var contextAndServletPathPos = docPath.indexOf( contextAndServletPath );
         if ( contextAndServletPathPos != -1 && docPath.length > ( contextAndServletPathPos
+ contextAndServletPath.length ) )
@@ -1118,6 +1143,14 @@
 
         this.rootFragmentId = parsedRootLayoutFragment.id ;
 
+        var initiateEditMode = false;
+        if ( this.editMode )
+        {
+            this.editMode = false;
+            if ( jetspeed.prefs.printModeOnly == null )
+                initiateEditMode = true;
+        }
+
         // create columns
         if ( jetspeed.prefs.windowTiling )
         {
@@ -1163,21 +1196,21 @@
             // initialize portlet window state
             this._portletsInitializeWindowState( portletsByPageColumn[ "z" ] );
 
-            // load menus
-            this.retrieveAllMenus();
-    
-            // render page buttons
-            this.renderPageControls();
-            this.syncPageControls();
-    
             // detect edit mode force - likely to be temporary
-            var pageEditorInititate = jetspeed.url.getQueryParameter( document.location.href,
jetspeed.id.PAGE_EDITOR_INITIATE_PARAMETER );
-            if ( ( pageEditorInititate != null && pageEditorInititate == "true" )
|| this.actions[ jetspeed.id.ACTION_NAME_VIEW ] != null )
+            var pageEditorInititate = jetspeed.url.getQueryParameter( window.location.href,
jetspeed.id.PAGE_EDITOR_INITIATE_PARAMETER );
+            if ( initiateEditMode || ( pageEditorInititate != null && pageEditorInititate
== "true" ) || this.actions[ jetspeed.id.ACTION_NAME_VIEW ] != null )
             {
+                initiateEditMode = false;
                 if ( this.actions != null && ( this.actions[ jetspeed.id.ACTION_NAME_EDIT
] != null || this.actions[ jetspeed.id.ACTION_NAME_VIEW ] != null ) )
-                    jetspeed.editPageInitiate();
+                    initiateEditMode = true;
             }
 
+            // load menus
+            this.retrieveMenuDeclarations( true, initiateEditMode );
+    
+            // render page buttons
+            this.renderPageControls();
+            this.syncPageControls();
         }
         else
         {
@@ -1251,7 +1284,7 @@
                 dojo.undo.browser.addToHistory({
 	    	        back: function() { if ( jetspeed.debug.ajaxPageNav ) dojo.debug( "back-nav-button:
" + currentPageUrl ); jetspeed.updatePage( currentPageUrl, true ); },
 		            forward: function() { if ( jetspeed.debug.ajaxPageNav ) dojo.debug( "forward-nav-button:
" + currentPageUrl ); jetspeed.updatePage( currentPageUrl, true ); },
-		            changeUrl: false
+		            changeUrl: escape( this.getPath() )
 		        });
             }
         }
@@ -1261,7 +1294,7 @@
             dojo.undo.browser.setInitialState({
                 back: function() { if ( jetspeed.debug.ajaxPageNav ) dojo.debug( "back-nav-button
initial: " + currentPageUrl ); jetspeed.updatePage( currentPageUrl, true ); },
                 forward: function() { if ( jetspeed.debug.ajaxPageNav ) dojo.debug( "forward-nav-button
initial: " + currentPageUrl ); jetspeed.updatePage( currentPageUrl, true ); },
-                changeUrl: false
+                changeUrl: escape( this.getPath() )
             });
         }
 
@@ -2160,6 +2193,7 @@
     destroy: function()
     {
         this._destroyPortlets();
+        this._destroyEditPage();
         this._removeColumns( document.getElementById( jetspeed.id.DESKTOP ) );
         this._destroyPageControls();
     },
@@ -2264,13 +2298,9 @@
         }
         return menuNamesArray;
     },
-    retrieveAllMenus: function()
+    retrieveMenuDeclarations: function( includeMenuDefs, initiateEditMode )
     {
-        this.retrieveMenuDeclarations( true );
-    },
-    retrieveMenuDeclarations: function( includeMenuDefs )
-    {
-        contentListener = new jetspeed.om.MenusAjaxApiContentListener( includeMenuDefs );
+        contentListener = new jetspeed.om.MenusAjaxApiContentListener( includeMenuDefs, initiateEditMode
);
 
         this.clearMenus();
 
@@ -2398,6 +2428,14 @@
             }
         }
     },
+    _destroyEditPage: function()
+    {
+        var pageEditorWidget = dojo.widget.byId( jetspeed.id.PAGE_EDITOR_WIDGET_ID );
+        if ( pageEditorWidget != null )
+        {
+            pageEditorWidget.editPageDestroy();
+        }
+    },
     _destroyPageControls: function()
     {
         var pageControlsContainer = dojo.byId( jetspeed.id.PAGE_CONTROLS );
@@ -2490,7 +2528,7 @@
         if ( this.pageUrlFallback != null )
             docUrlObj = jetspeed.url.parse( this.pageUrlFallback );
         else
-            docUrlObj = jetspeed.url.parse( document.location.href );
+            docUrlObj = jetspeed.url.parse( window.location.href );
         if ( pageUrlObj != null && docUrlObj != null )
         {
             var docUrlQuery = docUrlObj.query;
@@ -2521,7 +2559,7 @@
         if ( this.pageUrlFallback != null )
             docUrlObj = jetspeed.url.parse( this.pageUrlFallback );
         else
-            docUrlObj = jetspeed.url.parse( document.location.href );
+            docUrlObj = jetspeed.url.parse( window.location.href );
         if ( pagePathObj != null && docUrlObj != null )
         {
             var docUrlQuery = docUrlObj.query;
@@ -3925,9 +3963,10 @@
 });
 
 // ... jetspeed.om.MenusAjaxApiContentListener
-jetspeed.om.MenusAjaxApiContentListener = function( /* boolean */ includeMenuDefs )
+jetspeed.om.MenusAjaxApiContentListener = function( /* boolean */ includeMenuDefs, /* boolean
*/ initiateEditMode )
 {
     this.includeMenuDefs = includeMenuDefs;
+    this.initiateEditMode = initiateEditMode;
 };
 dojo.inherits( jetspeed.om.MenusAjaxApiContentListener, jetspeed.om.MenuAjaxApiContentListener);
 dojo.lang.extend( jetspeed.om.MenusAjaxApiContentListener,
@@ -3969,6 +4008,8 @@
     {
         if ( this.includeMenuDefs )
             jetspeed.notifyRetrieveAllMenusFinished();
+        if ( this.initiateEditMode )
+            jetspeed.editPageInitiate();
     }
 });
 



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


Mime
View raw message