Friday, June 18, 2010

CheckValidServerURLPath

//***************************************************************************
//FUNCTION NAME : CheckValidServerURLPath
//Purpose : Check the syntax of Transcend server url.
//***************************************************************************
function BOOL CheckValidServerURLPath(serverPath)
NUMBER nLength,nResult,nLocation;
STRING svString,szFindMe,szMsg;
BOOL bValid;
begin
nLength = StrLength (serverPath);
if (nLength = 0) then
MessageBoxEx("Please enter Transcend Server URL.","",INFORMATION);
return FALSE;
else
nLength=256;
bValid=FALSE;
// Check for presence of http://, https://, file:// in the URL
//********************START***************************
nResult = Is (VALID_PATH, serverPath);
if (nResult = TRUE) then
bValid=TRUE;
else
szMsg="The server URL you entered is invalid. Please try again";
MessageBoxEx(szMsg,"",WARNING);
return FALSE;
endif;
//********************END***************************

// Search for "/" at the end of the server URL and removing it, if exist.
//********************START***************************
if(StrRemoveLastSlash (serverPath) =0) then // removing trailing "\" at end
// Ckeck for trailing "/" at end
// START
nResult=StrFindEx ( serverPath, "/", nLength-1);
if(nResult>=0) then
StrSub(serverPath,serverPath,0,nLength-1);

if(MsiSetProperty(ISMSI_HANDLE,"CUSTOMURL",serverPath)==ERROR_SUCCESS) then
endif;
endif;
// END
endif;
//********************END***************************
return TRUE;
endif;
end;

No comments:

Post a Comment