Author: smilek
Date: Fri Dec 1 01:54:23 2006
New Revision: 481208
URL: http://svn.apache.org/viewvc?view=rev&rev=481208
Log:
jetspeed.desktop.compatibility changed to jetspeed.common; moved jetspeed.url
functions and objects from core.js to common.js; support portlet titles and
portlet icons; added debug methods to EditorTable
Added:
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js
Removed:
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/compatibility.js
Modified:
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js
Added: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js?view=auto&rev=481208
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js (added)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js Fri Dec
1 01:54:23 2006
@@ -0,0 +1,473 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// jetspeed javascript to help support portlets in both /portal and /desktop
+
+if ( window.dojo )
+{
+ dojo.provide( "jetspeed.common" );
+ dojo.require( "dojo.io.*" );
+ dojo.require( "dojo.uri.Uri" );
+}
+
+// ... jetspeed base objects
+if ( ! window.jetspeed )
+ jetspeed = {};
+if ( ! jetspeed.url )
+ jetspeed.url = {};
+
+// ... jetspeed version
+jetspeed.version =
+{
+ major: 2, minor: 1, patch: 0, flag: "dev",
+ revision: "",
+ toString: function()
+ {
+ with (jetspeed.version)
+ {
+ return major + "." + minor + "." + patch + flag + " (" + revision
+ ")";
+ }
+ }
+};
+
+if ( ! window.dojo )
+{
+ jetspeed.no_dojo_load_notifying = false;
+ jetspeed.no_dojo_post_load = false;
+ jetspeed.pageLoadedListeners = [];
+
+ window.onload = function()
+ {
+ if ( ! window.dojo )
+ {
+ jetspeed.no_dojo_load_notifying = true;
+ jetspeed.no_dojo_post_load = true;
+ var pll = jetspeed.pageLoadedListeners;
+ for( var x=0; x < pll.length; x++ )
+ {
+ pll[x]();
+ }
+ jetspeed.pageLoadedListeners = [];
+ }
+ };
+};
+
+/*
+Call styles:
+ jetspeed.addOnLoad( functionPointer )
+ jetspeed.addOnLoad( object, "functionName" )
+*/
+jetspeed.addOnLoad = function( obj, fcnName )
+{
+ if ( window.dojo )
+ {
+ if ( arguments.length == 1 )
+ dojo.addOnLoad( obj );
+ else
+ dojo.addOnLoad( obj, fcnName );
+ }
+ else
+ {
+ if ( arguments.length == 1 )
+ {
+ jetspeed.pageLoadedListeners.push(obj);
+ }
+ else if( arguments.length > 1 )
+ {
+ jetspeed.pageLoadedListeners.push( function()
+ {
+ obj[fcnName]();
+ } );
+ }
+ if ( jetspeed.no_dojo_post_load && ! jetspeed.no_dojo_load_notifying )
+ {
+ jetspeed.callPageLoaded();
+ }
+ }
+};
+
+jetspeed.callPageLoaded = function()
+{
+ if( typeof setTimeout == "object" ) // IE
+ {
+ setTimeout( "jetspeed.pageLoaded();", 0 );
+ }
+ else
+ {
+ jetspeed.pageLoaded();
+ }
+};
+
+jetspeed.printobj = function( obj )
+{
+ var props = [];
+ for( var prop in obj )
+ {
+ try
+ {
+ props.push( prop + ': ' + obj[prop] );
+ }
+ catch(E)
+ {
+ props.push( prop + ': ERROR - ' + E.message );
+ }
+ }
+ props.sort();
+ var buff = "";
+ for( var i = 0; i < props.length; i++ )
+ {
+ if ( buff.length > 0 )
+ buff += "\r\n";
+ buff += props[i];
+ }
+ return buff;
+};
+
+jetspeed.println = function( line )
+{
+ try
+ {
+ var console = document.getElementById( "debug_container" );
+ if( !console )
+ {
+ console = document.getElementsByTagName( "body" )[0] ||
document.body;
+ }
+ var div = document.createElement( "div" );
+ div.appendChild( document.createTextNode( line ) );
+ console.appendChild( div );
+ }
+ catch (e)
+ {
+ try
+ { // safari needs the output wrapped in an element for some reason
+ document.write("<div>" + line + "</div>");
+ }
+ catch(e2)
+ {
+ window.status = line;
+ }
+ }
+};
+
+
+// ... jetspeed.url
+jetspeed.url.path =
+{
+ SERVER: null, // http://localhost:8080
+ JETSPEED: null, // /jetspeed
+ AJAX_API: null, // /jetspeed/ajaxapi
+ DESKTOP: null, // /jetspeed/desktop
+ PORTAL: null, // /jetspeed/portal
+ PORTLET: null, // /jetspeed/portlet
+ initialized: false
+};
+
+jetspeed.url.pathInitialize = function( force )
+{
+ if ( ! force && jetspeed.url.path.initialized ) return;
+ var baseTags = document.getElementsByTagName( "base" );
+
+ var baseTagHref = null;
+ if ( baseTags && baseTags.length == 1 )
+ baseTagHref = baseTags[0].href;
+ else
+ baseTagHref = window.location.href;
+
+ var baseTag = jetspeed.url.parse( baseTagHref );
+
+ var basePath = baseTag.path;
+
+ var sepPos = -1;
+ for( var startPos =1 ; sepPos <= startPos ; startPos++ )
+ {
+ sepPos = basePath.indexOf( "/", startPos );
+ if ( sepPos == -1 )
+ break;
+ }
+
+ var serverUri = "";
+ if ( baseTag.scheme != null) { serverUri += baseTag.scheme + ":"; }
+ if ( baseTag.authority != null) { serverUri += "//" + baseTag.authority; }
+
+ var jetspeedPath = null;
+ if ( sepPos == -1 )
+ jetspeedPath = basePath;
+ else
+ jetspeedPath = basePath.substring( 0, sepPos );
+
+ //dojo.debug( "pathInitialize new-JETSPEED=" + jetspeedPath + "
orig-JETSPEED=" + jetspeed.url.path.JETSPEED + " new-SERVER=" + serverUri + "
orig-SERVER=" + document.location.protocol + "//" + document.location.host );
+
+ jetspeed.url.path.JETSPEED = jetspeedPath;
+ jetspeed.url.path.SERVER = serverUri;
+ jetspeed.url.path.AJAX_API = jetspeed.url.path.JETSPEED + "/ajaxapi";
+ jetspeed.url.path.DESKTOP = jetspeed.url.path.JETSPEED + "/desktop";
+ jetspeed.url.path.PORTAL = jetspeed.url.path.JETSPEED + "/portal";
+ jetspeed.url.path.PORTLET = jetspeed.url.path.JETSPEED + "/portlet";
+
+ jetspeed.url.path.initialized = true;
+};
+jetspeed.url.parse = function( url )
+{ // taken from dojo.uri.Uri
+ if ( url == null )
+ return null;
+ if ( window.dojo && window.dojo.uri )
+ return new dojo.uri.Uri( url );
+ var regexp = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";
+ var r = url.toString().match( new RegExp( regexp ) );
+ var parsedUrl = {};
+ parsedUrl.scheme = r[2] || (r[1] ? "" : null);
+ parsedUrl.authority = r[4] || (r[3] ? "" : null);
+ parsedUrl.path = r[5]; // can never be undefined
+ parsedUrl.query = r[7] || (r[6] ? "" : null);
+ parsedUrl.fragment = r[9] || (r[8] ? "" : null);
+ return parsedUrl;
+};
+jetspeed.url.scheme =
+{ // used to make jetspeed.url.validateUrlStartsWithHttp cleaner
+ HTTP_PREFIX: "http://",
+ HTTP_PREFIX_LEN: "http://".length,
+ HTTPS_PREFIX: "https://",
+ HTTPS_PREFIX_LEN: "https://".length
+};
+jetspeed.url.isPortal = function()
+{
+ if ( window.djConfig && window.djConfig.jetspeed )
+ {
+ var servletPath = window.djConfig.jetspeed.servletPath;
+ if ( servletPath != null && servletPath.toLowerCase().indexOf(
"/desktop" ) == 0 )
+ return false;
+ }
+ return true;
+};
+jetspeed.url.isDesktop = function()
+{
+ return ! jetspeed.url.isPortal();
+};
+jetspeed.url.servletPath = function()
+{
+ if ( jetspeed.url.isPortal() )
+ return "/portal";
+ else
+ return "/desktop";
+};
+jetspeed.url.basePortalUrl = function()
+{
+ if ( ! jetspeed.url.path.initialized )
+ jetspeed.url.pathInitialize();
+ return jetspeed.url.path.SERVER; // return document.location.protocol +
"//" + document.location.host ;
+};
+jetspeed.url.basePortalDesktopUrl = function()
+{
+ if ( ! jetspeed.url.path.initialized )
+ jetspeed.url.pathInitialize();
+ return jetspeed.url.basePortalUrl() + jetspeed.url.path.JETSPEED ;
+};
+jetspeed.url.basePortalWindowThemeUrl = function( windowtheme )
+{
+ return jetspeed.url.basePortalDesktopUrl() +
"/javascript/jetspeed/windowthemes/" + windowtheme;
+};
+
+jetspeed.url.validateUrlStartsWithHttp = function( url )
+{
+ if ( url )
+ {
+ var len = url.length;
+ var hSLen = jetspeed.url.scheme.HTTPS_PREFIX_LEN;
+ if ( len > hSLen ) // has to be at least longer than as https://
+ {
+ var hLen = jetspeed.url.scheme.HTTP_PREFIX_LEN;
+ if ( url.substring( 0, hLen ) == jetspeed.url.scheme.HTTP_PREFIX )
+ return true;
+ if ( url.substring( 0, hSLen ) == jetspeed.url.scheme.HTTPS_PREFIX
)
+ return true;
+ }
+ }
+ return false;
+};
+jetspeed.url.getQueryParameter = function( urlObj, paramname )
+{
+ if ( urlObj == null )
+ return null;
+ if ( ! urlObj.authority || ! urlObj.scheme )
+ urlObj = jetspeed.url.parse( urlObj );
+ if ( urlObj == null )
+ return null;
+ if ( urlObj.jsQParamN == null && urlObj.query )
+ {
+ var vAry=new Array() ;
+ var nAry = urlObj.query.split( "&" );
+ for ( var i=0; i < nAry.length; i++ )
+ {
+ if ( nAry[i] == null )
+ nAry[i]="";
+ var sepP = nAry[i].indexOf( "=" );
+ if ( sepP > 0 && sepP < (nAry[i].length -1) )
+ {
+ vAry[i] = unescape( nAry[i].substring( sepP + 1 ) );
+ nAry[i] = unescape( nAry[i].substring( 0, sepP ) );
+ }
+ else
+ {
+ vAry[i] = "";
+ }
+ }
+ urlObj.jsQParamN = nAry;
+ urlObj.jsQParamV = vAry;
+ }
+ if ( urlObj.jsQParamN != null )
+ {
+ for ( var i=0; i < urlObj.jsQParamN.length; i++ )
+ {
+ if ( urlObj.jsQParamN[i] == paramname )
+ {
+ return urlObj.jsQParamV[i];
+ }
+ }
+ }
+ return null;
+};
+
+if ( window.dojo )
+{
+ jetspeed.url.BindArgs = function( bindArgs )
+ {
+ dojo.lang.mixin( this, bindArgs );
+
+ if ( ! this.mimetype )
+ this.mimetype = "text/html";
+ };
+
+ dojo.lang.extend( jetspeed.url.BindArgs,
+ {
+ createIORequest: function()
+ {
+ var ioReq = new dojo.io.Request( this.url, this.mimetype );
+ ioReq.fromKwArgs( this ); // doing this cause dojo.io.Request
tests arg0 for ctor == Object; we want out own obj here
+ return ioReq;
+ },
+
+ load: function( type, data, http )
+ {
+ //dojo.debug( "loaded content for url: " + this.url );
+ //dojo.debug( "r e t r i e v e C o n t e n t . l o a d" ) ;
+ //dojo.debug( " type:" );
+ //dojo.debugShallow( type ) ;
+ //dojo.debug( " http:" );
+ //dojo.debugShallow( http ) ;
+ var dmId = null;
+ if ( this.debugContentDumpIds )
+ {
+ dmId = ( ( this.domainModelObject && dojo.lang.isFunction(
this.domainModelObject.getId ) ) ? this.domainModelObject.getId() : "" );
+ for ( var debugContentIndex = 0 ; debugContentIndex <
this.debugContentDumpIds.length; debugContentIndex++ )
+ {
+ if ( dmId.match( new RegExp( this.debugContentDumpIds[
debugContentIndex ] ) ) )
+ {
+ if ( dojo.lang.isString( data ) )
+ dojo.debug( "retrieveContent [" + ( dmId ? dmId :
this.url ) + "] content: " + data );
+ else
+ {
+ var textContent = dojo.dom.innerXML( data );
+ if ( ! textContent )
+ textContent = ( data != null ? "!= null (IE no
XMLSerializer)" : "null" );
+ dojo.debug( "retrieveContent [" + ( dmId ? dmId :
this.url ) + "] xml-content: " + textContent );
+ }
+ }
+ }
+ }
+ if ( this.contentListener && dojo.lang.isFunction(
this.contentListener.notifySuccess ) )
+ {
+ this.contentListener.notifySuccess( data, this.url,
this.domainModelObject, http ) ;
+ }
+ else
+ {
+ dmId = ( ( this.domainModelObject && dojo.lang.isFunction(
this.domainModelObject.getId ) ) ? this.domainModelObject.getId() : "" );
+ dojo.debug( "retrieveContent [" + ( dmId ? dmId : this.url ) +
"] no valid contentListener" );
+ }
+ },
+
+ error: function( type, error )
+ {
+ //dojo.debug( "r e t r i e v e C o n t e n t . e r r o r" ) ;
+ //dojo.debug( " type:" );
+ //dojo.debugShallow( type ) ;
+ //dojo.debug( " error:" );
+ //dojo.debugShallow( error ) ;
+ if ( this.contentListener && dojo.lang.isFunction(
this.contentListener.notifyFailure ) )
+ {
+ this.contentListener.notifyFailure( type, error, this.url,
this.domainModelObject );
+ }
+ }
+ });
+
+ jetspeed.url.retrieveContent = function( bindArgs, contentListener,
domainModelObject, debugContentDumpIds )
+ {
+ if ( ! bindArgs ) bindArgs = {};
+ bindArgs.contentListener = contentListener ;
+ bindArgs.domainModelObject = domainModelObject ;
+ bindArgs.debugContentDumpIds = debugContentDumpIds ;
+
+ var jetspeedBindArgs = new jetspeed.url.BindArgs( bindArgs );
+
+ dojo.io.bind( jetspeedBindArgs.createIORequest() ) ;
+ };
+
+ jetspeed.url.checkAjaxApiResponse = function( requestUrl, data,
reportError, apiRequestDescription, dumpOutput )
+ {
+ var success = false;
+ var statusElmt = data.getElementsByTagName( "status" );
+ if ( statusElmt != null )
+ {
+ var successVal = statusElmt[0].firstChild.nodeValue;
+ if ( successVal == "success" )
+ {
+ success = true;
+ }
+ }
+ if ( ( ! success && reportError ) || dumpOutput )
+ {
+ var textContent = dojo.dom.innerXML( data );
+ if ( ! textContent )
+ textContent = ( data != null ? "!= null (IE no XMLSerializer)"
: "null" );
+ if ( apiRequestDescription == null )
+ apiRequestDescription = "ajax-api";
+ if ( success )
+ dojo.debug( apiRequestDescription + " success url=" +
requestUrl + " xml-content=" + textContent );
+ else
+ dojo.raise( apiRequestDescription + " failure url=" +
requestUrl + " xml-content=" + textContent );
+ }
+ return success;
+ };
+
+ jetspeed.url.formatBindError = function( /* Object */ bindError )
+ {
+ if ( bindError == null ) return "";
+ var msg = " error:";
+ if ( bindError.message != null )
+ msg += " " + bindError.message;
+ if ( bindError.number != null && bindError.number != "0" )
+ {
+ msg += " (" + bindError.number;
+ if ( bindError.type != null && bindError.type != "unknown" )
+ msg += "/" + bindError.type;
+ msg += ")";
+ }
+ else if ( bindError.type != null && bindError.type != "unknown" )
+ {
+ msg += " (" + bindError.type + ")";
+ }
+ return msg;
+ };
+}
Modified:
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js?view=diff&rev=481208&r1=481207&r2=481208
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js
(original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js Fri
Dec 1 01:54:23 2006
@@ -21,6 +21,15 @@
dojo.provide("jetspeed.desktop.core");
+dojo.require("dojo.lang.*");
+dojo.require("dojo.event.*");
+dojo.require("dojo.io.*");
+dojo.require("dojo.uri.Uri");
+dojo.require("dojo.widget.*");
+dojo.require("dojo.collections.ArrayList");
+dojo.require("dojo.collections.Set");
+dojo.require("jetspeed.common");
+
// ... testing
// ... jetspeed base objects
@@ -28,26 +37,12 @@
jetspeed = {} ;
if ( ! jetspeed.om )
jetspeed.om = {} ;
-if ( ! jetspeed.url )
- jetspeed.url = {} ;
if ( ! jetspeed.ui )
jetspeed.ui = {} ;
if ( ! jetspeed.ui.widget )
jetspeed.ui.widget = {} ;
-// ... jetspeed version
-jetspeed.version =
-{
- major: 2, minor: 1, patch: 0, flag: "dev",
- revision: "",
- toString: function()
- {
- with (jetspeed.version)
- {
- return major + "." + minor + "." + patch + flag + " (" + revision
+ ")";
- }
- }
-};
+
// ... jetspeed.id
jetspeed.id =
@@ -139,12 +134,15 @@
portletSelectorWindowIcon: "text-x-script.png",
portletSelectorBounds: { x: 20, y: 20, width: 400, height: 600 },
- windowActionButtonOrder: [ jetspeed.id.ACTION_NAME_MENU, "edit", "view",
"help", jetspeed.id.ACTION_NAME_MINIMIZE, jetspeed.id.ACTION_NAME_MAXIMIZE,
jetspeed.id.ACTION_NAME_RESTORE ],
- windowActionNotPortlet: [ jetspeed.id.ACTION_NAME_MENU,
jetspeed.id.ACTION_NAME_MINIMIZE, jetspeed.id.ACTION_NAME_MAXIMIZE,
jetspeed.id.ACTION_NAME_RESTORE ],
+ windowActionButtonOrder: [ jetspeed.id.ACTION_NAME_MENU, "edit", "view",
"help", jetspeed.id.ACTION_NAME_MINIMIZE, jetspeed.id.ACTION_NAME_RESTORE,
jetspeed.id.ACTION_NAME_MAXIMIZE ],
+ windowActionNotPortlet: [ jetspeed.id.ACTION_NAME_MENU,
jetspeed.id.ACTION_NAME_MINIMIZE, jetspeed.id.ACTION_NAME_RESTORE,
jetspeed.id.ACTION_NAME_MAXIMIZE ],
windowActionButtonMax: 5,
windowActionButtonHide: false,
windowActionButtonTooltip: true,
windowActionMenuOrder: [ jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_EXPAND,
jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_NORMAL,
jetspeed.id.ACTION_NAME_DESKTOP_TILE, jetspeed.id.ACTION_NAME_DESKTOP_UNTILE ],
+
+ windowIconEnabled: true,
+ windowIconPath: "/images/portlets/small/",
windowThemesAllowed: [ "tigris", "blueocean" ],
windowTheme: "tigris",
@@ -402,6 +400,8 @@
windowThemeConfig.windowActionButtonTooltip =
jetspeed.prefs.windowActionButtonTooltip;
windowThemeConfig.windowActionMenuOrder =
jetspeed.prefs.windowActionMenuOrder;
windowThemeConfig.windowActionNoImage = jetspeed.prefs.windowActionNoImage;
+ windowThemeConfig.windowIconEnabled = jetspeed.prefs.windowIconEnabled;
+ windowThemeConfig.windowIconPath = jetspeed.prefs.windowIconPath;
// load window theme config
var windowThemeConfigUri = jetspeed.url.basePortalWindowThemeUrl(
windowtheme ) + "/" + windowtheme + ".js";
@@ -419,6 +419,23 @@
}
windowThemeConfig.windowActionNoImage = noImageMap;
}
+ if ( windowThemeConfig.windowIconPath != null )
+ {
+ windowThemeConfig.windowIconPath = dojo.string.trim(
windowThemeConfig.windowIconPath );
+ if ( windowThemeConfig.windowIconPath == null ||
windowThemeConfig.windowIconPath.length == 0 )
+ windowThemeConfig.windowIconPath = null;
+ else
+ {
+ var winIconsPath = windowThemeConfig.windowIconPath;
+ var firstCh = winIconsPath.charAt(0);
+ if ( firstCh != "/" )
+ winIconsPath = "/" + winIconsPath;
+ var lastCh = winIconsPath.charAt( winIconsPath.length
-1 );
+ if ( lastCh != "/" )
+ winIconsPath = winIconsPath + "/";
+ windowThemeConfig.windowIconPath = winIconsPath;
+ }
+ }
});
};
@@ -667,231 +684,6 @@
return formDump;
};
-
-// ... jetspeed.url
-jetspeed.url.path =
-{
- SERVER: null, // http://localhost:8080
- JETSPEED: null, // /jetspeed
- AJAX_API: null, // /jetspeed/ajaxapi
- DESKTOP: null, // /jetspeed/desktop
- PORTAL: null, // /jetspeed/portal
- PORTLET: null, // /jetspeed/portlet
- initialized: false
-};
-
-jetspeed.url.pathInitialize = function( force )
-{
- if ( ! force && jetspeed.url.path.initialized ) return;
- var baseTag = null;
- var baseTags = document.getElementsByTagName( "base" );
- if ( baseTags && baseTags.length == 1 )
- baseTag = new dojo.uri.Uri( baseTags[0].href );
- else
- baseTag = new dojo.uri.Uri( window.location.href );
-
- var basePath = baseTag.path;
-
- var sepPos = -1;
- for( var startPos =1 ; sepPos <= startPos ; startPos++ )
- {
- sepPos = basePath.indexOf( "/", startPos );
- if ( sepPos == -1 )
- break;
- }
-
- var serverUri = "";
- if ( baseTag.scheme != null) { serverUri += baseTag.scheme + ":"; }
- if ( baseTag.authority != null) { serverUri += "//" + baseTag.authority; }
-
- var jetspeedPath = null;
- if ( sepPos == -1 )
- jetspeedPath = basePath;
- else
- jetspeedPath = basePath.substring( 0, sepPos );
-
- //dojo.debug( "pathInitialize new-JETSPEED=" + jetspeedPath + "
orig-JETSPEED=" + jetspeed.url.path.JETSPEED + " new-SERVER=" + serverUri + "
orig-SERVER=" + document.location.protocol + "//" + document.location.host );
-
- jetspeed.url.path.JETSPEED = jetspeedPath;
- jetspeed.url.path.SERVER = serverUri;
- jetspeed.url.path.AJAX_API = jetspeed.url.path.JETSPEED + "/ajaxapi";
- jetspeed.url.path.DESKTOP = jetspeed.url.path.JETSPEED + "/desktop";
- jetspeed.url.path.PORTAL = jetspeed.url.path.JETSPEED + "/portal";
- jetspeed.url.path.PORTLET = jetspeed.url.path.JETSPEED + "/portlet";
-
- jetspeed.url.path.initialized = true;
-}
-jetspeed.url.scheme =
-{ // used to make jetspeed.url.validateUrlStartsWithHttp cleaner
- HTTP_PREFIX: "http://",
- HTTP_PREFIX_LEN: "http://".length,
- HTTPS_PREFIX: "https://",
- HTTPS_PREFIX_LEN: "https://".length
-};
-jetspeed.url.basePortalUrl = function()
-{
- if ( ! jetspeed.url.path.initialized )
- jetspeed.url.pathInitialize();
- return jetspeed.url.path.SERVER; // return document.location.protocol +
"//" + document.location.host ;
-};
-jetspeed.url.basePortalDesktopUrl = function()
-{
- if ( ! jetspeed.url.path.initialized )
- jetspeed.url.pathInitialize();
- return jetspeed.url.basePortalUrl() + jetspeed.url.path.JETSPEED ;
-};
-jetspeed.url.basePortalWindowThemeUrl = function( windowtheme )
-{
- return jetspeed.url.basePortalDesktopUrl() +
"/javascript/jetspeed/windowthemes/" + windowtheme;
-};
-
-jetspeed.url.validateUrlStartsWithHttp = function( url )
-{
- if ( url )
- {
- var len = url.length;
- var hSLen = jetspeed.url.scheme.HTTPS_PREFIX_LEN;
- if ( len > hSLen ) // has to be at least longer than as https://
- {
- var hLen = jetspeed.url.scheme.HTTP_PREFIX_LEN;
- if ( url.substring( 0, hLen ) == jetspeed.url.scheme.HTTP_PREFIX )
- return true;
- if ( url.substring( 0, hSLen ) == jetspeed.url.scheme.HTTPS_PREFIX
)
- return true;
- }
- }
- return false;
-};
-
-jetspeed.url.BindArgs = function( bindArgs )
-{
- dojo.lang.mixin( this, bindArgs );
-
- if ( ! this.mimetype )
- this.mimetype = "text/html";
-};
-
-dojo.lang.extend( jetspeed.url.BindArgs,
-{
- createIORequest: function()
- {
- var ioReq = new dojo.io.Request( this.url, this.mimetype );
- ioReq.fromKwArgs( this ); // doing this cause dojo.io.Request tests
arg0 for ctor == Object; we want out own obj here
- return ioReq;
- },
-
- load: function( type, data, evt )
- {
- //dojo.debug( "loaded content for url: " + this.url );
- //dojo.debug( "r e t r i e v e C o n t e n t . l o a d" ) ;
- //dojo.debug( " type:" );
- //dojo.debugShallow( type ) ;
- //dojo.debug( " evt:" );
- //dojo.debugShallow( evt ) ;
- var dmId = null;
- if ( this.debugContentDumpIds )
- {
- dmId = ( ( this.domainModelObject && dojo.lang.isFunction(
this.domainModelObject.getId ) ) ? this.domainModelObject.getId() : "" );
- for ( var debugContentIndex = 0 ; debugContentIndex <
this.debugContentDumpIds.length; debugContentIndex++ )
- {
- if ( dmId.match( new RegExp( this.debugContentDumpIds[
debugContentIndex ] ) ) )
- {
- if ( dojo.lang.isString( data ) )
- dojo.debug( "retrieveContent [" + ( dmId ? dmId :
this.url ) + "] content: " + data );
- else
- {
- var textContent = dojo.dom.innerXML( data );
- if ( ! textContent )
- textContent = ( data != null ? "!= null (IE no
XMLSerializer)" : "null" );
- dojo.debug( "retrieveContent [" + ( dmId ? dmId :
this.url ) + "] xml-content: " + textContent );
- }
- }
- }
- }
- if ( this.contentListener && dojo.lang.isFunction(
this.contentListener.notifySuccess ) )
- {
- this.contentListener.notifySuccess( data, this.url,
this.domainModelObject ) ;
- }
- else
- {
- dmId = ( ( this.domainModelObject && dojo.lang.isFunction(
this.domainModelObject.getId ) ) ? this.domainModelObject.getId() : "" );
- dojo.debug( "retrieveContent [" + ( dmId ? dmId : this.url ) + "]
no valid contentListener" );
- }
- },
-
- error: function( type, error )
- {
- //dojo.debug( "r e t r i e v e C o n t e n t . e r r o r" ) ;
- //dojo.debug( " type:" );
- //dojo.debugShallow( type ) ;
- //dojo.debug( " error:" );
- //dojo.debugShallow( error ) ;
- if ( this.contentListener && dojo.lang.isFunction(
this.contentListener.notifyFailure ) )
- {
- this.contentListener.notifyFailure( type, error, this.url,
this.domainModelObject );
- }
- }
-});
-
-jetspeed.url.retrieveContent = function( bindArgs, contentListener,
domainModelObject, debugContentDumpIds )
-{
- if ( ! bindArgs ) bindArgs = {};
- bindArgs.contentListener = contentListener ;
- bindArgs.domainModelObject = domainModelObject ;
- bindArgs.debugContentDumpIds = debugContentDumpIds ;
-
- var jetspeedBindArgs = new jetspeed.url.BindArgs( bindArgs );
-
- dojo.io.bind( jetspeedBindArgs.createIORequest() ) ;
-};
-
-jetspeed.url.checkAjaxApiResponse = function( requestUrl, data, reportError,
apiRequestDescription, dumpOutput )
-{
- var success = false;
- var statusElmt = data.getElementsByTagName( "status" );
- if ( statusElmt != null )
- {
- var successVal = statusElmt[0].firstChild.nodeValue;
- if ( successVal == "success" )
- {
- success = true;
- }
- }
- if ( ( ! success && reportError ) || dumpOutput )
- {
- var textContent = dojo.dom.innerXML( data );
- if ( ! textContent )
- textContent = ( data != null ? "!= null (IE no XMLSerializer)" :
"null" );
- if ( apiRequestDescription == null )
- apiRequestDescription = "ajax-api";
- if ( success )
- dojo.debug( apiRequestDescription + " success url=" + requestUrl
+ " xml-content=" + textContent );
- else
- dojo.raise( apiRequestDescription + " failure url=" + requestUrl
+ " xml-content=" + textContent );
- }
- return success;
-};
-
-jetspeed.url.formatBindError = function( /* Object */ bindError )
-{
- if ( bindError == null ) return "";
- var msg = " error:";
- if ( bindError.message != null )
- msg += " " + bindError.message;
- if ( bindError.number != null && bindError.number != "0" )
- {
- msg += " (" + bindError.number;
- if ( bindError.type != null && bindError.type != "unknown" )
- msg += "/" + bindError.type;
- msg += ")";
- }
- else if ( bindError.type != null && bindError.type != "unknown" )
- {
- msg += " (" + bindError.type + ")";
- }
- return msg;
-};
-
// ... jetspeed.om.PortletContentRetriever
jetspeed.om.PortletContentRetriever = function()
{
@@ -1010,7 +802,7 @@
},
notifyFailure: function( /* String */ type, /* Object */ error, /* String
*/ requestUrl, /* Page */ page )
{
- dojo.raise( "PageContentListenerCreateWidget notifyFailure url=" +
requestUrl + " type=" + type + " error=" + error ) ;
+ dojo.raise( "PageContentListenerCreateWidget error url: " + requestUrl
+ " type: " + type + jetspeed.url.formatBindError( error ) );
}
};
@@ -1268,7 +1060,17 @@
}
else
{
- fragChildren.push( { id: child.getAttribute( "id" ), type:
fragType, name: child.getAttribute( "name" ), properties:
this._parsePSMLProperties( child, null ), actions: this._parsePSMLActions(
child, null ), currentActionState: this._parsePSMLCurrentActionState( child ),
currentActionMode: this._parsePSMLCurrentActionMode( child ), decorator:
child.getAttribute( "decorator" ), documentOrderIndex: i } );
+ var portletProps = this._parsePSMLProperties( child, null
);
+ var portletIcon = portletProps[
jetspeed.id.PORTLET_PROP_WINDOW_ICON ];
+ if ( portletIcon == null || portletIcon.length == 0 )
+ {
+ portletIcon = this._parsePSMLIcon( child );
+ if ( portletIcon != null && portletIcon.length > 0 )
+ {
+ portletProps[ jetspeed.id.PORTLET_PROP_WINDOW_ICON
] = portletIcon;
+ }
+ }
+ fragChildren.push( { id: child.getAttribute( "id" ), type:
fragType, name: child.getAttribute( "name" ), properties: portletProps,
actions: this._parsePSMLActions( child, null ), currentActionState:
this._parsePSMLCurrentActionState( child ), currentActionMode:
this._parsePSMLCurrentActionMode( child ), decorator: child.getAttribute(
"decorator" ), documentOrderIndex: i } );
}
}
else if ( childLName == "property" )
@@ -1357,6 +1159,15 @@
}
return null;
},
+ _parsePSMLIcon: function( fragmentNode )
+ {
+ var nodes = fragmentNode.getElementsByTagName( "icon" );
+ if ( nodes != null && nodes.length == 1 )
+ {
+ return nodes[0].firstChild.nodeValue;
+ }
+ return null;
+ },
_parsePSMLProperties: function( fragmentNode, propertiesMap )
{
if ( propertiesMap == null )
@@ -2821,9 +2632,14 @@
this.contentRetriever.getContent( bindArgs, contentListener, portlet,
jetspeed.debugContentDumpIds );
},
- setPortletContent: function( portletContent, renderUrl )
+ setPortletContent: function( portletContent, renderUrl, portletTitle )
{
var windowWidget = this.getPortletWindow();
+ if ( portletTitle != null )
+ {
+ this.putProperty( jetspeed.id.PORTLET_PROP_WINDOW_TITLE,
portletTitle );
+ windowWidget.setPortletTitle( portletTitle );
+ }
if ( windowWidget )
{
windowWidget.setPortletContent( portletContent, renderUrl );
@@ -3045,9 +2861,16 @@
};
jetspeed.om.PortletContentListener.prototype =
{
- notifySuccess: function( /* String */ portletContent, /* String */
requestUrl, /* Portlet */ portlet )
+ notifySuccess: function( /* String */ portletContent, /* String */
requestUrl, /* Portlet */ portlet, http )
{
- portlet.setPortletContent( portletContent, requestUrl );
+ var portletTitle = null;
+ if ( http != null )
+ {
+ portletTitle = http.getResponseHeader("JS_PORTLET_TITLE");
+ if ( portletTitle != null )
+ portletTitle = unescape( portletTitle );
+ }
+ portlet.setPortletContent( portletContent, requestUrl, portletTitle );
if ( this.suppressGetActions == null || this.suppressGetActions ==
false )
jetspeed.getActionsForPortlet( portlet.getId() );
},
Modified:
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js?view=diff&rev=481208&r1=481207&r2=481208
==============================================================================
---
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js
(original)
+++
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/EditorTable.js
Fri Dec 1 01:54:23 2006
@@ -277,5 +277,39 @@
if ( invocation != null )
invocation.proceed();
return true;
+ },
+
+ dojoDebugTableData: function()
+ {
+ dojo.debug( debugTableData() );
+ },
+ debugTableData: function()
+ {
+ var tTableWidget = this;
+ // format: js_masterdata[index][key]=value (data[index][key]
+ buff = tTableWidget.widgetId + " data:" + "\r\n";
+ for ( var masterDataIndex = 0 ; masterDataIndex <
tTableWidget.js_masterdata.length ; masterDataIndex++ )
+ {
+ buff += "[" + masterDataIndex + "]" + "\r\n";
+ var slotsUsed = new Object();
+ for ( var slotKey in tTableWidget.js_masterdata[masterDataIndex] )
+ {
+ buff += " " + slotKey + "=" +
tTableWidget.js_masterdata[masterDataIndex][ slotKey ];
+ if ( slotKey == "__isModified" || slotKey == "__isNew" )
+ buff += "\r\n";
+ else
+ {
+ var dataVal = null;
+ if ( tTableWidget.data.length <= masterDataIndex )
+ buff += " <out-of-bounds>" + "\r\n";
+ else
+ {
+ dataVal = tTableWidget.data[masterDataIndex][ slotKey ];
+ buff += " (" + ( dataVal == null ? "null" : dataVal ) +
")" + "\r\n";
+ }
+ }
+ }
+ }
+ return buff;
}
});
Modified:
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js?view=diff&rev=481208&r1=481207&r2=481208
==============================================================================
---
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js
(original)
+++
portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js
Fri Dec 1 01:54:23 2006
@@ -18,7 +18,7 @@
dojo.require("jetspeed.desktop.core");
dojo.require("dojo.widget.*");
-dojo.provide("dojo.widget.FloatingPane");
+dojo.require("dojo.widget.FloatingPane");
jetspeed.widget.PortletWindow = function()
{
@@ -164,33 +164,33 @@
initWindowTitle: function( fragment )
{
var windowtitle = this.getInitProperty(
jetspeed.id.PORTLET_PROP_WINDOW_TITLE );
- if ( windowtitle )
- this.title = windowtitle;
- else if ( this.title == null )
- this.title = "";
- if ( this.portletInitialized )
- {
- // BOZO: update title
- }
+ this.setPortletTitle( windowtitle );
},
initWindowIcon: function( fragment )
{
- var windowicon = this.getInitProperty(
jetspeed.id.PORTLET_PROP_WINDOW_ICON );
- if ( ! windowicon )
+ if ( this.windowThemeConfig != null &&
this.windowThemeConfig.windowIconEnabled &&
this.windowThemeConfig.windowIconPath != null )
{
- if ( jetspeed.debugPortletWindowIcons )
+ var windowicon = this.getInitProperty(
jetspeed.id.PORTLET_PROP_WINDOW_ICON );
+ if ( ! windowicon )
+ {
+ if ( jetspeed.debugPortletWindowIcons )
+ {
+ windowicon =
jetspeed.debugPortletWindowIcons[Math.floor(Math.random()*jetspeed.debugPortletWindowIcons.length)];
+ }
+ else
+ {
+ windowicon = "document.gif";
+ }
+ }
+ this.iconSrc = new
dojo.uri.Uri(jetspeed.url.basePortalDesktopUrl() +
this.windowThemeConfig.windowIconPath + windowicon ) ;
+ if ( this.portletInitialized && this.titleBarIcon )
{
- windowicon =
jetspeed.debugPortletWindowIcons[Math.floor(Math.random()*jetspeed.debugPortletWindowIcons.length)];
+ this.titleBarIcon.src = this.iconSrc.toString();
}
}
- if ( windowicon )
- this.iconSrc = new
dojo.uri.Uri(jetspeed.url.basePortalDesktopUrl() +
"/javascript/jetspeed/windowicons/" + windowicon ) ;
else
- this.iconSrc = new
dojo.uri.Uri(jetspeed.url.basePortalDesktopUrl() +
"/javascript/jetspeed/windowicons/document.gif" ) ;
- if ( this.portletInitialized )
{
- if ( this.titleBarIcon )
- this.titleBarIcon.src = this.iconSrc.toString();
+ this.iconSrc = null;
}
},
@@ -406,7 +406,7 @@
}
// <img src=""> can hang IE! better get rid of it
- if ( this.iconSrc=="" )
+ if ( this.iconSrc == "" )
{
dojo.dom.removeNode( this.titleBarIcon );
}
@@ -1659,6 +1659,17 @@
if ( this.portlet )
this.portlet.postParseAnnotateHtml( this.containerNode );
+ },
+ setPortletTitle: function( newPortletTitle )
+ {
+ if ( newPortletTitle )
+ this.title = newPortletTitle;
+ else
+ this.title = "";
+ if ( this.portletInitialized && this.titleBarText )
+ {
+ this.titleBarText.innerHTML = this.title;
+ }
},
_splitAndFixPaths_scriptsonly: function( /* String */ s, /* String */ url )
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]