//*********************************************************************** // (c) Copyright 1998-2007 Santronics Software, Inc. All Rights Reserved. //*********************************************************************** // // File Name : html-suggest-test.wcc // Subsystem : Wildcat! RPC Ajax // Date : 11/22/07 // Version : 452.4a // Author : HLS/SSI // // Revision History: // Build Date Author Comments // ----- -------- ------ ------------------------------------------- // 452.4a 11/22/07 HLS - Created for Auto-Suggest plugin test // Simple sorted text file search //*********************************************************************** const crlf = chr(13)+chr(10) function NoItems Print "no items" HttpSetResponseHeader("","404 No Items Found") end function //---------------------------------------------------- // MAIN //---------------------------------------------------- dim srch as string = httpunescape(paramstr(1)) if srch = "" then NoItems() end end if dim UseOptions as boolean = TRUE if lcase(left(srch,2)) = "q=" then srch = mid(srch,3) UseOptions = FALSE end if dim total as integer = 0 dim lines as string = GetText("wc:\http\public\test\baddomain.txt") dim i as integer = instr(lines,crlf) do while (i > 0) dim w as string = left(lines,i-1) lines = mid(lines,i+2) if lcase(left(w,len(srch))) > lcase(srch) then exit do end if if lcase(left(w,len(srch))) = lcase(srch) then inc(total) dim uname as string = w if UseOptions then print ""; else print uname end if end if i = instr(lines,crlf) loop if total = 0 then NoItems() end end if