//  Create Extra menus by automatically running DXL from a network folder.

/*
	Create Extra menus by automatically running DXL from a network folder.
	
	This allows menu creation DXL to be deployed and updated on a network
	drive without updating every client.
	
	Copy this file to any of the following directories on the client,
	according to where you want the extra menus to appear.
	
	Edit the directory path at the bottom to point to the location on the
	network containing the dxl files to build the extra menus.
	
		doorshome /lib/dxl/config/baseWindowMenuFiles
		doorshome /lib/dxl/config/descfiles
		doorshome /lib/dxl/config/descPopupFiles
		doorshome /lib/dxl/config/explorerListPopupFiles
		doorshome /lib/dxl/config/explorerTreePopupFiles
		doorshome /lib/dxl/config/formalFiles
		doorshome /lib/dxl/config/formalPopupFiles
		doorshome /lib/dxl/config/linkFiles
		doorshome /lib/dxl/config/linkPopupFiles
	
	Tony Goodman 1-June-2005
	
*/


//-----------------------------------------------------------------------------
//                               
//  modification of Telelogic's generateAutoRunDXLFolderString to work with
//  absolute paths.
//                               
//  Description: generates a string containing '#include's of all
//				 the files in the specified path. Path must be
//               an absolute path name.
//                                                                        
//-----------------------------------------------------------------------------
string generateAutoRunDXLNetworkFolderString(string sFilesPath)
{
	string sEvalStr = ""
	string sIncStart = "#include <" sFilesPath "/"
	string s
	string sLoc
	string sDXLCheck = null
	sLoc = sFilesPath
	
	Stat st = create(sLoc)
	if (!null st)
	{
		for s in directory sLoc do
		{
			if(s == "." || s == "..")
			{
				//do nothing
			}
			else
			{
				sDXLCheck = null
				sDXLCheck = checkDXL(sIncStart s ">")
				if(null sDXLCheck)
				{
					sEvalStr = sEvalStr sIncStart s ">\n"
				}
				else
				{
				    //didn't pasre properly, so don't include it
					print sDXLCheck "\n"
				}
			}
		}
	}
	return(sEvalStr)
}


//-----------------------------------------------------------------------------
//                               
//  modification of Telelogic's autoRunDXLFolder to work with mapped  network drives
//                               
//  Description: runs all the files in the specified directory as DXL.
//				 This is used for startup, finish, formal menu functions
//				 and project menu functions.
//  Notes:		 eval_ runs the code in a separate dxl context so any 
//				 declarations in dxl files in the specified path 
//				 will not persist.
//  Parameters: sFilesPath: path to the directory containing dxl files. This
//				path must be an absolute path name.
//-----------------------------------------------------------------------------
void autoRunDXLNetworkFolder(string sFilesPath)
{
	eval_(generateAutoRunDXLNetworkFolderString(sFilesPath))
}


/******************************************************************************
	MAIN
	
	Absolute path of the folder containing the menu creation DXL.
******************************************************************************/
autoRunDXLNetworkFolder("\\\\server\\dxl\\config\\extras")


sitemap