rem: var fIndex = parseInt( dataObj.data);  dump( "Source row: " + fIndex + "\n"); 
add: for ( var i = 0; i < dragSession.numDropItems; ++i ) { dragSession.getData ( trans, i ); var dataObj = new Object(); var bestFlavor = new Object(); var len = new Object(); try { trans.getAnyTransferData( bestFlavor, dataObj, len); if ( dataObj )  { dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsWString); } if ( !dataObj ) { continue; } 
context: function DropOnTree( event){	var treeRoot = document.getElementById("fieldList");	if (!treeRoot)	return(false);	// target is the <treecell>, and the <treeitem> is two levels above	var treeItem = event.target.parentNode.parentNode;	if (!treeItem)	return(false);	// get drop hint attributes	var dropBefore = treeItem.getAttribute("dd-droplocation");	var dropOn = treeItem.getAttribute("dd-dropon");	// calculate drop action	var dropAction;	if (dropBefore == "true")	dropAction = "before";	else if (dropOn == "true")	dropAction = "on";	else				dropAction = "after";	dump( "DropAction: " + dropAction + "\n");	// calculate parent container node	/* bookmarks.js uses this, not sure what it's for???	var containerItem = treeItem;	if (dropAction != "on")		containerItem = treeItem.parentNode.parentNode;	*/	var dragService = Components.classes["@mozilla.org/widget/dragservice;1"].getService();	if ( dragService ) dragService = dragService.QueryInterface(Components.interfaces.nsIDragService);	if ( !dragService )	return(false);		var dragSession = dragService.getCurrentSession();	if ( !dragSession )	return(false);	var trans = Components.classes["@mozilla.org/widget/transferable;1"].createInstance();	if ( trans ) trans = trans.QueryInterface(Components.interfaces.nsITransferable);	if ( !trans )		return(false);	trans.addDataFlavor( top.transferType);	// trans.addDataFlavor( "text/unicode");	var body = document.getElementById( "fieldBody");	if (!body)		return( false);	for ( var i = 0; i < dragSession.numDropItems; ++i )	{		dragSession.getData ( trans, i );		var dataObj = new Object();		var bestFlavor = new Object();		var len = new Object();		try {			trans.getAnyTransferData( bestFlavor, dataObj, len);			if ( dataObj )	{				dataObj = dataObj.value.QueryInterface(Components.interfaces.nsISupportsWString);			}			if ( !dataObj )	{				continue;			}			var fIndex = parseInt( dataObj.data);						dump( "Source row: " + fIndex + "\n");			// so now what, move the given row to the new position!			// find the source row index			var srcRow = FindRowFromIndex( body, fIndex);			if (srcRow < 0) {				dump( "*** Error finding source row\n");				continue;			}			var dstRow = FindRowFromItem( body, treeItem);			if (dstRow < 0) {				dump( "*** Error finding destination row\n");				continue;			}			// always do before unless we can't			if (dropAction == "on" || dropAction == "after") {				dstRow++;				if (dstRow >= body.childNodes.length) {					if (srcRow == (body.childNodes.length - 1))						continue;					dstRow = -1;				}			}						var maxIndex = body.childNodes.length - 1;			var dstBox = body.childNodes[srcRow].firstChild.firstChild.firstChild.checked;			var dstField = body.childNodes[srcRow].firstChild.firstChild.firstChild.getAttribute( 'value');			var dstIndex = body.childNodes[srcRow].getAttribute( 'field-index');						dump( "FieldDrag from " + srcRow + " to " + dstRow + "\n");			if (dstRow < 0) {				// remove the row and append it to the end!				// Move srcRow to the end!								while (srcRow < maxIndex) {					AssignRow( body.childNodes[srcRow], body.childNodes[srcRow + 1]);					srcRow++;				}								SetRow( body.childNodes[maxIndex], dstIndex, dstBox, dstField);			}			else {				if (dstRow == srcRow)					continue;				if (srcRow < dstRow)					dstRow--;				if (dstRow == srcRow)					continue;				if (dstRow < srcRow) {					// move dstRow down to srcRow					while (dstRow < srcRow) {						AssignRow( body.childNodes[srcRow], body.childNodes[srcRow - 1]);						srcRow--;					}				}				else {					// move dstRow up to srcRow					while (srcRow < dstRow) {						AssignRow( body.childNodes[srcRow], body.childNodes[srcRow + 1]);						srcRow++;					}				}				SetRow( body.childNodes[dstRow], dstIndex, dstBox, dstField);			}		}		catch( ex) {			dump( "Caught drag exception in DropOnTree\n");			dump( ex);			dump( "\n");		}	}	return(false);}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/eaa6754a0a946375badf1165b3e4af3999e4b03c/fieldMapImport.js/clean/mailnews/import/resources/content/fieldMapImport.js