(FILECREATED "27-Mar-87 17:46:17" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH230.;1 6241   

      changes to:  (VARS RHTPATCH230COMS)
		   (FNS NC.OpenCrossFileLinkDestNoteFile NC.GetCrossFileLinkDestCard))


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

(PRETTYCOMPRINT RHTPATCH230COMS)

(RPAQQ RHTPATCH230COMS ((* * Fixes bug #488 (item 5)
			     : need way of opening remote notefile read-only.)
			  (* * New function for NCCROSSFILELINKS)
			  (FNS NC.OpenCrossFileLinkDestNoteFile)
			  (* * Change for NCCROSSFILELINKS)
			  (FNS NC.GetCrossFileLinkDestCard)))
(* * Fixes bug #488 (item 5) : need way of opening remote notefile read-only.)

(* * New function for NCCROSSFILELINKS)

(DEFINEQ

(NC.OpenCrossFileLinkDestNoteFile
  (LAMBDA (DestNoteFile DestFileName InterestedWindow)       (* rht: "27-Mar-87 17:39")

          (* * If DestNoteFile is an open notefile, then fine. Otherwise get file names from user and keep trying to open 
	  until she gives up.)


    (LET ((Menu (create MENU
			  ITEMS ←(QUOTE (Open% Read/Write Open% Read-Only Cancel))
			  MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
						  12
						  (QUOTE BOLD))
			  MENUROWS ← 1
			  MENUBORDERSIZE ← 1
			  ITEMHEIGHT ← 20
			  MENUTITLEFONT ←(FONTCREATE (QUOTE HELVETICA)
						       12
						       (QUOTE BOLD))))
	  ReadOnlyOpenFlg)
         (if (NCP.OpenNoteFileP DestNoteFile)
	     then DestNoteFile
	   else (for while (OR DestFileName (SETQ DestFileName
					 (NC.AskUser "File name to try opening: " NIL NIL T 
						       InterestedWindow)))
		     do (replace (MENU TITLE) of Menu with (CONCAT "OPEN " DestFileName 
									       "?"))
			  (if (AND (SELECTQ (MENU Menu)
						  (Open% Read/Write (SETQ ReadOnlyOpenFlg NIL)
								    T)
						  (Open% Read-Only (SETQ ReadOnlyOpenFlg T))
						  (Cancel (RETURN NIL))
						  (RETURN NIL))
				       (NCP.OpenNoteFileP (SETQ DestNoteFile
							      (NC.OpenNoteFile (OR DestNoteFile 
										     DestFileName)
										 NIL NIL NIL NIL NIL 
										 NIL NIL NIL 
										 InterestedWindow NIL 
										 NIL NIL 
										 ReadOnlyOpenFlg))))
			      then (RETURN DestNoteFile)
			    else (NC.PrintMsg InterestedWindow T "Couldn't open " DestFileName 
						  "."
						  (CHARACTER 13))
				   (SETQ DestFileName (SETQ DestNoteFile NIL))
				   (if (NOT (NC.AskYesOrNo 
						     "Want to try opening a different notefile? "
								 NIL "Yes" NIL InterestedWindow))
				       then (RETURN NIL))))))))
)
(* * Change for NCCROSSFILELINKS)

(DEFINEQ

(NC.GetCrossFileLinkDestCard
  (LAMBDA (CrossFileLinkCard InterestedWindow)               (* rht: "27-Mar-87 17:40")

          (* * Find the notefile corresponding to this crossfilelink and try to open it if not already open.
	  Then look for the card in there having the given UID. Return NIL if failed for any reason.)



          (* * rht 11/10/86: Make sure CrossFileLinkCard is cached before fetching substance.)



          (* * rht 11/19/86: Now rips off version number from destination notefile hint.)



          (* * rht 12/11/86: Now checks that destination card is not deleted.)



          (* * rht 12/16/86: Now takes InterestedWindow argument.)



          (* * rht 3/25/87: Now calls NC.CoerceToInterestedWindow.)



          (* * rht 3/27/87: Now calls NC.OpenCrossFileLinkDestNoteFile.)


    (LET ((Title (NC.FetchTitle CrossFileLinkCard))
	  (SourceNoteFile (fetch (Card NoteFile) of CrossFileLinkCard))
	  Substance DestNoteFileUID DestFileHint DestCardUID DestNoteFile DestFileName)
         (OR (OPENWP InterestedWindow)
	       (SETQ InterestedWindow (NC.CoerceToInterestedWindow SourceNoteFile)))
         (if (NOT (NC.ActiveCardP CrossFileLinkCard))
	     then (NC.GetNoteCard CrossFileLinkCard))
         (SETQ Substance (NC.FetchSubstance CrossFileLinkCard))
         (SETQ DestCardUID (fetch (CrossFileLinkSubstance CrossFileLinkDestCardUID) of 
											Substance))
         (SETQ DestNoteFileUID (fetch (CrossFileLinkSubstance CrossFileLinkDestNoteFileUID)
				    of Substance))
         (SETQ DestFileHint (fetch (CrossFileLinkSubstance CrossFileLinkDestFileHint)
				 of Substance))
         (SETQ DestNoteFile (NC.NoteFileFromNoteFileUID DestNoteFileUID))
         (SETQ DestFileName (OR (AND (type? NoteFile DestNoteFile)
					   (fetch (NoteFile FullFileName) of DestNoteFile))
				    DestFileHint))
         (for while (SETQ DestNoteFile (NC.OpenCrossFileLinkDestNoteFile DestNoteFile 
										 DestFileName 
										 InterestedWindow))
	    bind Card NewFileName do (if (NC.ValidCardP (SETQ Card (NC.CardFromUID 
										      DestCardUID 
										     DestNoteFile)))
					     then (if (NOT (EQUAL (SETQ NewFileName
									    (fetch (NoteFile 
										     FullFileName)
									       of DestNoteFile))
									  (FULLNAME
									    (fetch (
CrossFileLinkSubstance CrossFileLinkDestFileHint) of Substance))))
							then (replace (CrossFileLinkSubstance
									    CrossFileLinkDestFileHint)
								  of Substance
								  with (PACKFILENAME
									   (QUOTE VERSION)
									   NIL
									   (QUOTE BODY)
									   NewFileName))
							       (NC.MarkCardDirty CrossFileLinkCard))
						    (RETURN Card)
					   else (NC.PrintMsg InterestedWindow T 
							     "Couldn't find destination card in "
								 DestFileName "." (CHARACTER 13))
						  (if (NOT (NC.AskYesOrNo 
						     "Want to try opening a different notefile? "
										NIL "Yes" NIL 
										InterestedWindow))
						      then (RETURN NIL)
						    else (SETQ DestNoteFile (SETQ DestFileName 
							       NIL))))))))
)
(PUTPROPS RHTPATCH230 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (722 2706 (NC.OpenCrossFileLinkDestNoteFile 732 . 2704)) (2747 6159 (
NC.GetCrossFileLinkDestCard 2757 . 6157)))))
STOP