' GLOBAL CONFIGURATION DICTIONARY
Dim globalConfig : Set globalConfig = CreateObject("Scripting.Dictionary")

loadGlobalConfiguration()
loadGlobalVars()

'**********************************************************
' loadGlobalConfiguration		(added by CC-000138)
' @description: loads the configuration parameters from the file configuration_global in the dictionary globalConfig
' @param: none
' @return: nothing
'**********************************************************
function loadGlobalConfiguration
	if IsObject(recCommon) Then
		sConfigPath = recCommon.sScriptPath.Value 
	else 
		Set fso = CreateObject("Scripting.FileSystemObject")
		sConfigPath =  fso.GetParentFolderName(WScript.ScriptFullName) & "\"
	End if 

	Set xmlDoc = CreateObject("MSXML2.DOMDocument")

	xmlDoc.async = False
	xmlPath = sConfigPath & "configs\configuration_global.xml"
	debug2File xmlPath
	' Lade die XML-Daten
	xmlDoc.load(xmlPath)

	If xmlDoc.parseError.errorCode <> 0 Then
		debug2File "Fehler beim Laden des XML: " & xmlPath & " " & xmlDoc.parseError.reason
	Else
		' Erstelle ein Dictionary
		Set dict = CreateObject("Scripting.Dictionary")
		
		' Durchlaufe die Parameter und füge sie dem Dictionary hinzu
		Set parameterNodes = xmlDoc.selectNodes("//parameter")
		For Each parameterNode In parameterNodes
			paramName = parameterNode.getAttribute("internal")
			paramValue = parameterNode.text
			globalConfig(paramName) = paramValue
		Next
		
		' Gib die Inhalte des Dictionaries aus
		For Each key In dict.Keys
			debug2File key & ": " & globalConfig(key)
		Next
	End If
end function 

'**********************************************************
' loadGlobalVars		(added by CC-000138)
' @description: fills variables with data from the global configuration file
' @param: none
' @return: nothing
'**********************************************************
function loadGlobalVars() 
	debug2File "start load globalVars"
	'wfvariables.sRoleBlacklist.value = globalConfig("RoleBlacklist")
	debug2File "end load globalVars"
end function 