You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/08/11 19:32:25 UTC

svn commit: r430871 - /incubator/xap/trunk/src/xap/Xap.js

Author: mturyn
Date: Fri Aug 11 12:32:24 2006
New Revision: 430871

URL: http://svn.apache.org/viewvc?rev=430871&view=rev
Log:
Improved code for scanPage(), added window.sessionNames to help keep track of all the embedded xaplets for the page.

Modified:
    incubator/xap/trunk/src/xap/Xap.js

Modified: incubator/xap/trunk/src/xap/Xap.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/Xap.js?rev=430871&r1=430870&r2=430871&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/Xap.js (original)
+++ incubator/xap/trunk/src/xap/Xap.js Fri Aug 11 12:32:24 2006
@@ -136,32 +136,50 @@
 
 }
 
+Xap.APPLICATION_CONTEXT_ATTRIBUTE__NAME="xapContext" ;
+Xap.APPLICATION_ID_ATTRIBUTE__NAME = "xapId" ;
+Xap.APPLICATION_SOURCE_ATTRIBUTE__NAME = "xapSrc" ;
+Xap.APPLICATION_TOOLKIT_ATTRIBUTE__NAME = "xapToolkit" ;
 
 Xap.scanPage = function(){
 	var allPossibleContainerNodes = Xap._findAppElements() ;
+	if( !window.xapSessionIds){
+		window.xapSessionIds = new Array( 0 ) ;
+	}
 	for (var i =0; i<allPossibleContainerNodes.length; i++){
 		var element = allPossibleContainerNodes[i] ; 	
 		if( !element.getAttribute ){
 			continue;
 		}
 		var thisElementsAppName = null ;		
-		thisElementsAppName = element.getAttribute("appName");
+		thisElementsAppName = element.getAttribute(Xap.APPLICATION_ID_ATTRIBUTE__NAME);
 		if(!thisElementsAppName){
 			continue;
 		}
-		var src = element.getAttribute("src");	
-//		alert("Found xap tag with \n        appName:" + thisElementsAppName + ", \n        and source " + src+ "\n        under element of type: "+element.nodeName);
-		var context = element.getAttribute("context");
-		var toolkit = element.getAttribute("toolkit");
+		// What's the XAL file?---required
+		var src = element.getAttribute(Xap.APPLICATION_SOURCE_ATTRIBUTE__NAME);	
+		// What's the toolkit?---dojo?---defaults to zimbra if null
+		var toolkit = element.getAttribute(Xap.APPLICATION_TOOLKIT_ATTRIBUTE__NAME);
+		// what's the load context for plugin.xml or its equivalent?---default to boot context:
+		var context = Xap._sourceRootDir ;
+		if( element.getAttribute(Xap.APPLICATION_CONTEXT_ATTRIBUTE__NAME)){
+			context = element.getAttribute(Xap.APPLICATION_CONTEXT_ATTRIBUTE__NAME) ;
+		};
 		
 		var session = Xap.createSession(context, src, toolkit , element);
 		// these might be handy to keep around:
-		session.appName = thisElementsAppName ;
-		session.src = src ;
+		session[Xap.APPLICATION_ID_ATTRIBUTE__NAME] = thisElementsAppName ;
+		session[Xap.APPLICATION_SOURCE_ATTRIBUTE__NAME ] = src ;
+		session[Xap.APPLICATION_TOOLKIT_ATTRIBUTE__NAME ] = toolkit ;	
+		session[Xap.APPLICATION_CONTEXT_ATTRIBUTE__NAME] = context ;	
+
 		session.domContainer = element ;
 		if (window[thisElementsAppName]==null){
 			window[thisElementsAppName]= session;
+			window.xapSessionIds.push( thisElementsAppName ) ;
 		}
+		
+		
 		else{
 			//TODO throw some error?
 		}