'StyleSheet' href='/ndk/doc/samplecode/sampleui/ndk_sample.css'>
12 01 2001 Srivathsa First code.
01 06 2006 Ananth Added NDK guidelines.
Public 'vbKeyword'>Const SCRIPT_NAME = "fdir"
'vbKeyword'>Sub Main()
LoginForm
'vbKeyword'>End Sub
'vbKeyword'>Function URI(scriptName, api)
urlPrefix = Doc.urlPrefix
'vbKeyword'>If (COMPILE) Then
URI = urlPrefix + scriptName + ":" + api
'vbKeyword'>Else
URI = urlPrefix + scriptName + ".bas:" + api
'vbKeyword'>End If
'vbKeyword'>End Function
'vbKeyword'>Sub LoginForm()
Doc.Heading "FDIR v1.0"
Doc.Format 'vbKeyword'>False
Heading "NDS Login"
Doc.BeginForm (URI(SCRIPT_NAME, "NDSLogin"))
Doc.BeginTable 1
Doc.BeginRow
Doc.DataTable "User ID: ", "", "200", DOC_ALIGN_RIGHT, "", DOC_YELLOW
Doc.BeginData "", "800", "", "", ""
Doc.TextEntry "user", "", "", 125, 20
Doc.EndData
Doc.EndRow
Doc.BeginRow
Doc.DataTable "Password: ", "", "200", DOC_ALIGN_RIGHT, "", DOC_YELLOW
Doc.BeginData "", "800", "", "", ""
Doc.PasswordEntry "password", "", "", 50, 20
Doc.EndData
Doc.EndRow
Doc.EndTable
Doc.SubmitButton " OK "
Doc.ResetButton "Reset"
Doc.EndForm
'vbKeyword'>End Sub
'vbKeyword'>Sub NDSLogin()
'vbKeyword'>Dim user, password
user = Doc.getVar("user", "")
password = Doc.getVar("password", "")
success = Login(user, password)
'vbKeyword'>If (success) Then
FDIR
'vbKeyword'>End If
'vbKeyword'>End Sub
'vbKeyword'>Function Login(user, password)
'vbKeyword'>On Error Resume Next
'vbKeyword'>Set nwdir = CreateObject("UCX:NWDIR")
'vbKeyword'>If (nwdir.Login(user, password)) Then
Login = 'vbKeyword'>True
'vbKeyword'>Else
Doc.Print ("Login Failed: 'vbKeyword'>Error (" & Err.Number & ") " &Err.Description)
Doc.Break
Login = 'vbKeyword'>False
'vbKeyword'>End If
'vbKeyword'>End Function
'vbKeyword'>Sub FDIR()
dispMode = 2
'vbKeyword'>If dispMode = 1 Then
ShowVolume
'vbKeyword'>End If
'vbKeyword'>If dispMode = 2 Then
ShowDirectory
'vbKeyword'>End If
'vbKeyword'>End Sub
'vbKeyword'>Sub ShowVolume()
Heading ("Volume information")
'vbKeyword'>Set VolObj = CreateObject("UCX:VOLUMEMGR")
'vbKeyword'>Set Volumes = VolObj.Volumes
Doc.Break
Doc.Print "<b>'vbKeyword'>Select a volume.</b>"
Doc.Break
Volumes.Reset
'vbKeyword'>While (Volumes.hasmoreelements)
'vbKeyword'>Set volume = Volumes.Next
Doc.BeginLink (URI(SCRIPT_NAME, "FDIR?vol=" & volume.Name))
Doc.Print volume.Name
Doc.Break
Doc.EndLink
'vbKeyword'>Wend
'vbKeyword'>End Sub
'vbKeyword'>Sub ShowDirectory()
'vbKeyword'>Dim Buf
Buf = ""
Path = Doc.getVar("path", "")
Heading "Directory Information"
Doc.BeginTag ("center")
Doc.BeginForm (URI(SCRIPT_NAME, "ShowDirectory"))
Doc.TextEntry "path", "", "<b><Font Size =
Doc.SubmitButton " OK "
Doc.EndForm
Doc.EndTag "center"
'vbKeyword'>Set DirObj = CreateObject("UCX:NWFILEMGR")
'vbKeyword'>If (Path <> "") Then
'vbKeyword'>If DirObj.ChangeDir (Path) = False Then
Doc.Print ("Path 'vbKeyword'>Not Found ")
Doc.Break
'vbKeyword'>Exit Sub
'vbKeyword'>End If
'vbKeyword'>End If
'vbKeyword'>Set Entry = DirObj.CurrentDir
'vbKeyword'>Set Files = Entry.getChildren("*.*")
Doc.Break
Doc.Print
Doc.Print "<b> Directory 'vbKeyword'>for " & Entry.Name & "</b>"
Doc.Break
Doc.Break
Doc.print "<table cellpadding=
Doc.print "<tr align=
Doc.print "<th width=
Doc.print "<th width=
Doc.print "<th width=
Doc.print"</tr>"
Doc.print"<tr>"
Doc.Print "</Font>"
Files.Reset
'vbKeyword'>While (Files.hasmoreelements)
'vbKeyword'>Set file = Files.Next
'vbKeyword'>If (file.directory = False) Then
NumberOfFiles = NumberOfFiles + 1
SizeOfFiles = SizeOfFiles + file.Size
'vbKeyword'>Else
NumberOfDir = NumberOfDir + 1
'vbKeyword'>End If
Doc.print "<tr>"
Doc.print "<td width=
Doc.print " <td width=
Doc.print " <td width=
Doc.print "</tr>"
Doc.print "<tr>"
'vbKeyword'>Wend
Doc.print "</table>"
Doc.Break
Doc.Print "Total Number of Files: " & NumberOfFiles
Doc.Break
Doc.Print "Total Number of Directories: " & NumberOfDir
Doc.Break
'vbKeyword'>End Sub
'vbKeyword'>Sub Heading(Title)
'vbKeyword'>Set server = CreateObject("UCX:SERVER")
Doc.Print
Doc.Print "Directory Listing Tool v1.0"
Doc.Break
Doc.Print "Server Name: " & server.Name
Doc.Break
Doc.Print "</Font>"
Doc.Print "<HR>"
Doc.BeginTag "center"
Doc.Print
Doc.Print
Doc.Print "</Font>"
Doc.EndTag "center"
Doc.Break
'vbKeyword'>End Sub