(FILECREATED "25-Mar-87 17:12:51" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH224.;2 3625   

      changes to:  (VARS RHTPATCH224COMS)
		   (FNS NC.MakeSearchCard NC.TitleSearch)

      previous date: "25-Mar-87 15:21:33" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH224.;1)


(* Copyright (c) 1987 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT RHTPATCH224COMS)

(RPAQQ RHTPATCH224COMS ((* * Fix to bug #483: Search cards break on search for "NIL")
			  (DECLARE: COPY FIRST (P (LOAD? (NC.FindFile (QUOTE NCSEARCHCARD)))))
			  (* * Change to NCSEARCHCARD)
			  (FNS NC.TitleSearch NC.MakeSearchCard)))
(* * Fix to bug #483: Search cards break on search for "NIL")

(DECLARE: COPY FIRST 
(LOAD? (NC.FindFile (QUOTE NCSEARCHCARD)))
)
(* * Change to NCSEARCHCARD)

(DEFINEQ

(NC.TitleSearch
  (LAMBDA (NoteFile SearchString)                            (* rht: "25-Mar-87 15:17")

          (* * Searchs all cards on NoteFile for ones with SearchString in their title.)



          (* * rht 3/25/87: Now only looks at non-deleted cards.)


    (NC.MapCards NoteFile (FUNCTION (LAMBDA (Card)
		     Card))
		 (FUNCTION (LAMBDA (Card)
		     (AND (NC.ValidCardP Card)
			    (STRPOS SearchString (NC.RetrieveTitle Card))))))))

(NC.MakeSearchCard
  (LAMBDA (Card Title NoDisplayFlg)                          (* rht: "25-Mar-87 17:11")

          (* Search for cards with specified characteristics and create a list card containing pointers to these cards.
	  For now search is limited to cards whose title contains a specified string.)



          (* * rht 11/8/84: Fixed some confusion between ListCardID and ID variables.)



          (* * fgh 11/17/85 Updated to handle multiple notefiles and crad objects.)



          (* * rht 4/11/86: changed to call NC.ApplySuper.)



          (* * rht 10/21/86: Now deletes card if no search string specified.)



          (* * rg 3/16/87 NC.DeleteNoteCards -> NC.DeleteNoteCard)


    (LET ((NoteFile (fetch (Card NoteFile) of Card))
	  SearchString HitCards WindowOrCard Window)
         (SPAWN.MOUSE)
         (SETQ WindowOrCard (NC.ApplySupersFn MakeFn Card (OR Title "SearchCard")
						NoDisplayFlg))
         (NC.ActivateCard Card)
         (SETQ Window (AND (WINDOWP WindowOrCard)
			       WindowOrCard))
         (SETQ SearchString (NC.AskUser "Please enter the search string: " NIL NIL T Window))
         (if (OR (EQUAL SearchString "")
		     (NOT SearchString))
	     then (NC.DeleteNoteCard Card NIL T)
		    NIL
	   else (NC.SetTitle Card (SETQ Title (OR Title (CONCAT "Cards with %"" 
									  SearchString "%" in title"))
				   ))
		  (AND Window (WINDOWPROP Window (QUOTE TITLE)
					      Title))
		  (RESETLST (RESETSAVE (CURSOR WAITINGCURSOR))
			      (NC.PrintMsg Window T "Searching for cards ...")
			      (SETQ HitCards (NC.TitleSearch NoteFile SearchString))
			      (TEDIT.INSERT (NC.FetchSubstance Card)
					      (CONCAT " List compiled on: " (DATE)
							(CHARACTER 13)
							(CHARACTER 13))
					      1)
			      (for HitCard in HitCards unless (EQ HitCard Card)
				 do (NC.InsertLinkBeforeMarker Card HitCard 
								   NC.ListContentsLinkLabel NIL NIL))
			      (NC.PrintMsg Window NIL "Done!" (CHARACTER 13)))
		  (BLOCK 250)
		  (NC.ClearMsg Window T)
		  WindowOrCard))))
)
(PUTPROPS RHTPATCH224 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (776 3543 (NC.TitleSearch 786 . 1275) (NC.MakeSearchCard 1277 . 3541)))))
STOP