<%

' ********************************************************************
' Copyright (C) 2001 Microsoft Corporation. All rights reserved.
'
'	IMPORTANT.  Please read the legal.txt file, located in the
'	"<CMS Install Directory>\Server\httpexec\WBC\Internals"
'	directory, governing the use of this internal file."
' ********************************************************************

' ********************************************************************
' File:		/NR/System/WBC/Internals/Integration/CFeatureManager.inc
' Version: 	Microsoft Content Management Server
' Author:	Microsoft Corporation.
' Purpose:	Implements a Feature Manager that allows registering and
'			querying of features.
'
' ********************************************************************

' ---- Content Connector Feature ID's
Const IDS_FEATURE_CONNECTOR_FRAMEWORK = "ConnectorFramework"
Const IDS_FEATURE_CONNECTOR_IISAPPLICATION = "ConnectorIISApp"
Const IDS_FEATURE_CONNECTOR_PROFILEEDITOR = "ConnectorProfileEditor"

Class CFeatureManager

	Private m_dictAllFeatures

    ' ---- [Private] Standard Class_Initialize
    Private Sub Class_Initialize()
    	' -- init all member with default values

			'-- Create a dictionary for adding tab pages
	        Set m_dictAllFeatures = CreateObject("Scripting.Dictionary")

	End Sub

	Public Function FeatureIsRegistered( strFeatureName )

		FeatureIsRegistered = m_dictAllFeatures.Exists( strFeatureName )

	End Function

	Public Function RegisterFeature( strFeatureName )

		m_dictAllFeatures.Item( strFeatureName ) = True

	End Function

End Class


Dim g_pFeatureManager
Set g_pFeatureManager = Nothing

' ---- [Public] Global Class Factory function for CFeatureManager
Function GetGlobalFeatureManager()

	If g_pFeatureManager Is Nothing Then
		Set g_pFeatureManager = New CFeatureManager
	End If

	Set GetGlobalFeatureManager = g_pFeatureManager

End Function


Function NRCS_TestAndRegisterConnectorApplication()
	NRCS_TestAndRegisterConnectorApplication = False

	If Application("NRCSConnectorInstalled") = True Then
		Call GetGlobalFeatureManager.RegisterFeature( _
										IDS_FEATURE_CONNECTOR_IISAPPLICATION )
		' Return true
		NRCS_TestAndRegisterConnectorApplication = True
	End If

End Function
Call NRCS_TestAndRegisterConnectorApplication()


' ********************************************************************
' ======= Taken from ContentConnector_Include.asp
' ********************************************************************

'TODO: this Const may not belong here
Const IDS_NO_URL = "javascript:void(null)"

'TODO: use GlobalFeatureMgr
' ---- [Public] This function checks if Content Connector for Commerce Server application is running
Function CS_IsConnectorEnabled()
	If Application("NRCSConnectorInstalled") = True Then
		CS_IsConnectorEnabled = True
	Else
		CS_IsConnectorEnabled = False
	End If
End Function

'TODO: use GlobalFeatureMgr
' ---- [Public] This function checks if the site is running Content Connector for Commerce Server
Function CS_IsConnectorSite()
	CS_IsConnectorSite = CS_IsConnectorEnabled() And CS_IsConnectorIncluded()
End Function

'TODO: remove once not referenced locally (should not be used globally)
' ---- [Private] This function reads the Content Connector for Commerce Server include flag
Function CS_IsConnectorIncluded()
	CS_IsConnectorIncluded = g_bIsCSConnectorIncluded
End Function

' ---- [Private] This function sets the Content Connector for Commerce Server include flag
Sub CS_SetConnectorIncluded(bIsCSConnectorIncluded)
	g_bIsCSConnectorIncluded = bIsCSConnectorIncluded
End Sub

%>