************************************************************************
*FUNCTION wconnect
******************
***    Author: Rick Strahl
***            (c) West Wind Technologies, 1995-2009
***   		  www.west-wind.com
***  Modified: 09/14/2009
***  Function: Main Program that loads all the Web Connect
***            classes into memory. This program is not required
***            for the registered version - simply use
***            SET PROCEDURE commands in your main program file.
************************************************************************
LPARAMETER lcUnload

lcUnload=IIF(VARTYPE(lcUnload)="C",UPPER(lcUnload),"LOAD")

#INCLUDE WCONNECT.H

*** Web Connection classes and PRGs are expected in a
*** CLASSES subdirectory or else in the current dir. Either
*** way they need to be accessible via the VFP PATH
DO PATH WITH WWC_FRAMEWORK_PATH + "classes\"
DO PATH WITH WWC_FRAMEWORK_PATH + "tools\"

#IF !SHAREWARE
   SET CLASSLIB TO wcVisual ADDITIVE
#ELSE
   SET CLASSLIB TO wcVisual IN WCONNECT.APP ADDITIVE
#ENDIF

SET PROCEDURE TO wwServer ADDITIVE
SET PROCEDURE TO wwProcess ADDITIVE
SET PROCEDURE TO wwRequest ADDITIVE


SET PROCEDURE TO wwResponse ADDITIVE
SET PROCEDURE TO wwResponseFile ADDITIVE
SET PROCEDURE TO wwResponseString ADDITIVE
SET PROCEDURE TO wwPageResponse ADDITIVE
#IF WWC_LOAD_WWJSONSERIALIZER 
	DO wwJsonSerializer
#ENDIF
#IF WWC_LOAD_WWJSONSERVICE
	DO wwJsonService
#ENDIF

SET PROCEDURE TO wwHttpHeader additive

SET PROCEDURE TO wwHtmlHelpers ADDITIVE

SET PROCEDURE TO wwConfig ADDITIVE
SET PROCEDURE TO wwCache additive

IF SHAREWARE
  SET CLASSLIB TO wwXML IN WCONNECT.APP ADDITIVE
ELSE
  SET CLASSLIB TO wwXML ADDITIVE
ENDIF

#IF WWC_LOAD_WEBCONTROLS
   SET PROCEDURE TO WebControl Additive
   SET PROCEDURE TO WebControls Additive
   SET PROCEDURE TO WebControlsExtended ADDITIVE
   SET PROCEDURE TO WebPageParser Additive
   #IF WWC_LOAD_WEBCONTROLSAJAX
      *SET PROCEDURE TO WebControlsAjax ADDITIVE
      SET PROCEDURE TO WebControlsjQuery ADDITIVE
   #ENDIF
#ENDIF

#IF WWC_LOAD_WWSHOWCURSOR
   SET PROCEDURE TO wwShowCursor ADDITIVE
#ENDIF
#IF WWC_LOAD_WWDBFPOPUP
   SET PROCEDURE TO wwDBFPopup ADDITIVE
#ENDIF

*** Base Support/Utility classes
SET PROCEDURE TO wwUtils ADDITIVE
SET PROCEDURE TO wwCollections ADDITIVE
SET PROCEDURE TO wwEval ADDITIVE
SET PROCEDURE TO wwAPI ADDITIVE

#IF WWC_LOAD_WWSCRIPTING
  SET PROCEDURE TO wwScripting ADDITIVE
#ENDIF  
#IF WWC_LOAD_WWSESSION
   SET PROCEDURE TO wwSession ADDITIVE
#ENDIF
#IF WWC_LOAD_WWUSERSECURITY
   SET PROCEDURE TO wwUserSecurity ADDITIVE
#ENDIF

#IF WWC_LOAD_WWHTTP
    SET PROCEDURE TO wwHTTP ADDITIVE
#ENDIF      
#IF WWC_LOAD_WWSMTP
	SET PROCEDURE TO wwSmtp ADDITIVE
#ENDIF

#IF WWC_LOAD_WWSOAP
   SET PROCEDURE TO wwSOAP ADDITIVE
#ENDIF

#IF WWC_LOAD_WWPDF
   SET PROCEDURE TO wwPdf Additive
#ENDIF   

#IF WWC_LOAD_WWSHOWCURSOR 
   SET PROCEDURE TO wwShowCursor ADDITIVE
#ENDIF
   
#IF WWC_LOAD_WWDBFPOPUP
   SET PROCEDURE TO wwDbfPopup ADDITIVE
#ENDIF   

#IF WWC_LOAD_WWBUSINESS
   #IF SHAREWARE
       SET CLASSLIB TO wwBusiness ADDITIVE 
       * IN WCONNECT.APP ADDITIVE
   #ELSE
       SET CLASSLIB TO wwBusiness ADDITIVE
   #ENDIF
#ENDIF


#IF WWC_LOAD_WWSQL
   #IF SHAREWARE
      SET CLASSLIB TO wwSQL IN WCONNECT.APP ADDITIVE
   #ELSE
      SET CLASSLIB TO wwSQL ADDITIVE
   #ENDIF
#ENDIF

*** Shareware warning screen
#IF SHAREWARE
   DO FORM Sharewar
#ENDIF

RETURN
*EOP wConnect


************************************************************************
FUNCTION Path
******************
***  Function: Adds or deletes items from the path string
***      Pass: pcPathName   -   Filename
***            pcMethod     -   *"ADD","DELETE"
***
***    Return: New Path or ""
************************************************************************
PARAMETERS pcPath,pcMethod
PRIVATE aPath,lcOldPath
pcMethod=IIF(type("pcMethod")="C",upper(pcMethod),"ADD")

IF parameters()<1 
   RETURN
ENDIF
   
pcPath=ADDBS(LOWER(TRIM(pcPath)))
lcOldPath=LOWER(SET("PATH"))

IF pcMethod="ADD"
    IF EMPTY(pcPath) .OR. ;
       !Directory(pcPath,1)
      RETURN ""
   ENDIF
   IF AT(";" + pcPath,";" + lcOldPath)>0
      RETURN ""
   ENDIF
   lcOldPath=lcOldPath+";"+pcPath
ELSE
   IF AT(";" + pcPath,";" + lcOldPath)<1
      RETURN ""
   ENDIF
   lcOldPath=STRTRAN(lcOldPath,";"+pcPath)
   lcOldPath=STRTRAN(lcOldPath,pcPath)
ENDIF   

SET PATH TO &lcOldPath

RETURN lcOldPath
*EOP PATH
