(FILECREATED " 2-Apr-87 14:48:30" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH235.;2 23331 changes to: (VARS RHTPATCH235COMS) (FNS NC.DeleteNoteCards NC.RunOpenEvents NC.OpenNoteFile) previous date: " 2-Apr-87 14:31:56" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH235.;1) (* Copyright (c) 1987 by Xerox Corporation. All rights reserved.) (PRETTYCOMPRINT RHTPATCH235COMS) (RPAQQ RHTPATCH235COMS ((* * Fixed bug whereby extra prompt window comes up over notefile icon. Also fixes args passed to NC.DeleteNoteCardInternal from NC.DeleteNoteCards.) (* * Changes to NCDATABASE) (FNS NC.RunOpenEvents NC.OpenNoteFile) (* * Changes to NCLISTCARD) (FNS NC.EvaluateListCardSubstance) (* * Changes to NCCARDS) (FNS NC.DeleteNoteCards))) (* * Fixed bug whereby extra prompt window comes up over notefile icon. Also fixes args passed to NC.DeleteNoteCardInternal from NC.DeleteNoteCards.) (* * Changes to NCDATABASE) (DEFINEQ (NC.RunOpenEvents (LAMBDA (FileName NoteFile When InterestedWindow) (* rht: " 2-Apr-87 14:26") (* * If When = AFTER then read and eval the OpenEvents card.) (* * rht 4/2/87: Added InterestedWindow arg.) (SELECTQ When (AFTER (OR (type? NoteFile NoteFile) (SETQ NoteFile (NC.NoteFileFromFileName FileName))) (LET ((OpenEventsCard (NCP.LookupCardByName (QUOTE OpenEventsCard) NoteFile))) (if (NCP.ValidCardP OpenEventsCard) then (if (NOT (NCP.ActiveCardP OpenEventsCard)) then (NCP.CacheCards OpenEventsCard)) (NC.EvaluateListCardSubstance OpenEventsCard "Evaluating the Open Events card" InterestedWindow)))) NIL))) (NC.OpenNoteFile (LAMBDA (NoteFileOrFileName NoteFilesHashArray Don'tCacheTypesAndTitlesFlg Don'tCreateFlg ConvertNoConfirmFlg Don'tCreateArrayFlg Can'tTruncateFlg Don'tCreateInterfaceFlg Don'tGetSpecialCardsFlg InterestedWindow PublicOrPrivate MenuPosition QuietFlg ReadOnlyFlg Don'tCheckForTruncationFlg) (* rht: " 2-Apr-87 14:27") (* * fgh 5/23/86 Renamed to NC.OpenNoteFile from NC.OpenDatabaseFile. Total revamp to implement device vector.) (* * kef 7/18/86: Inserted a call to stuff the UID into the NoteFile because BuildHashArray needed it.) (* * kef 7/21/86: Moved up the install of the NoteFile into the NoteFileHashArray to before the building of the NoteFile's hash array. The reason is that the remote multi client build hash array function needs to get a list of UIDs, and in order to do this, it needs to grab a Courier stream for the NoteFile given only the UID. It can only do this if the UID is registered in the NoteFilesHashArray.) (* * fgh 8/31/86 Updated to account for changes made to system since 5/23/86 revamp. Changes reimplemented include: (fgh 6/8/86 Added code to insure that two files with SameUIDP would never be open at once.) (fgh 6/25/86 Added contention locks -- NC.ProtectedNoteFileOperation, Don'tCheckOperationInProgressFlg etc.) (fgh 6/27/86 Added MenuPsotion arg to pass to SetUpNoteFileInterface) (kirk 15Jul86 Added call to NC.SetUpNoteFileInterface if already open)) (* * fgh 9/1/86 Reimplemented ReadOnly NoteFile open.) (* * fgh 9/4/86 Put in default for NoteFilesHashArray which is NC.NoteFilesHashArray) (* * kirk/rht 8/29/86: Now resets Name after conversion from version 2 to version3.) (* * rht 10/29/86: Changed "aborted" to "canceled" in message.) (* * rht 10/31/86: Added Don'tCheckForTruncationFlg arg.) (* * rht&pmi 11/21/86: Took away the protection from around the AFTER call to open events fns.) (* * pmi 12/12/86: Added InterestedWindow argument to NC.SetUpNoteFileInterface so that it can print a prompt to the user about placing the NoteFile menu.) (* * rg 3/4/87 Added NC.ProtectedSessionOperation wrapper, removed Don'tCheckOperationsInProgressFlg) (* * rht 3/25/87: Now calls NC.CoerceToInterestedWindow.) (* * pmi 3/31/87: Moved line of code which sets the ReadOnlyFlg to just after the test for an open notefile. Otherwise, a notefile opened read-only could be changed to one opened normally.) (* * rht 4/2/87: Now passes InterestedWindow to opennotefilefns.) (DECLARE (GLOBALVARS NC.OpenNoteFileFns NC.LastNoteFileOpened)) (* * NOTE: Session lock turns into NoteFile lock after NoteFile is created) (PROG (NoteFile FileName ReturnValue CriticalUIDs) (* * Figure out the name of the file containing the NoteFile) (if (NULL (SETQ FileName (COND ((type? NoteFile NoteFileOrFileName) (fetch (NoteFile FullFileName) of NoteFileOrFileName)) (NoteFileOrFileName) (T (NC.DatabaseFileName "Name of NoteFile to open:" " -- " T NIL NIL InterestedWindow))))) then (RETURN)) (* SETQ FileName (OR (FULLNAME FileName) FileName)) (* * Create a NoteFile object or use existing notefile object if there is one for this file name.) (SETQ NoteFile (if (type? NoteFile NoteFileOrFileName) then NoteFileOrFileName else (OR (NC.NoteFileFromFileName FileName) (create NoteFile)))) (replace (NoteFile FullFileName) of NoteFile with FileName) (* * (replace (NoteFile ReadOnlyFlg) of NoteFile with ReadOnlyFlg)) (OR (OPENWP InterestedWindow) (SETQ InterestedWindow (NC.CoerceToInterestedWindow NoteFile))) (RETURN (NC.ProtectedNoteFileOperation NoteFile "Open NoteFile" InterestedWindow (PROG NIL (* * Figure out the appropriate device vector from the file name.) (NC.InstallDeviceVectorInNoteFile NoteFile PublicOrPrivate) (* * If this is an open NoteFIle, just bring up its menu.) (if (NC.NoteFileOpenP NoteFile) then (OR Don'tCreateInterfaceFlg (NC.SetUpNoteFileInterface NoteFile MenuPosition InterestedWindow)) (* bring up or create notefile icon if needed) (RETURN NIL)) (* * Moved this replace to after test for open notefile. Otherwise, if notefile is open read-only, it well be changed to regular open.) (replace (NoteFile ReadOnlyFlg) of NoteFile with ReadOnlyFlg) (* * Notify user.) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Opening NoteFile: " FileName " ..." (CHARACTER 13))) (SETQ ReturnValue (PROG NIL (* * Run through OpenNoteFileFns with param of BEFORE. Exit if any returns DON'T) (if (for Function in NC.OpenNoteFileFns thereis (OR (EQ Function (QUOTE DON'T)) (EQ (QUOTE DON'T) (APPLY* Function FileName NoteFile (QUOTE BEFORE))))) then (if (WINDOWP InterestedWindow) then (NC.PrintMsg InterestedWindow NIL "Open canceled for NoteFile " FileName "." (CHARACTER 13)) (NC.ClearMsg InterestedWindow T)) (RETURN)) (* * Call the device specific OpenNoteFileFn, which returns a list of special UIDs) (if (NULL (ERSETQ (SETQ ReturnValue (APPLY* (fetch (NoteFile OpenNoteFileFn) of NoteFile) NoteFile InterestedWindow Don'tCheckForTruncationFlg)))) then (SETQ ReturnValue (QUOTE NoteFileOpenFailed))) (* * Process error returns from the OpenNoteFileFn) (if (NOT (LITATOM ReturnValue)) then (* * OpenNoteFileFn returned correctly) (SETQ CriticalUIDs ReturnValue) else (* * Error, process it.) (SETQ ReturnValue (OR (SELECTQ ReturnValue (NoteFileNotFound (NC.ProcessNoteFileNotFoundError NoteFile NoteFilesHashArray Don'tCacheTypesAndTitlesFlg Don'tCreateFlg ConvertNoConfirmFlg Don'tCreateArrayFlg Can'tTruncateFlg Don'tCreateInterfaceFlg Don'tGetSpecialCardsFlg InterestedWindow PublicOrPrivate MenuPosition QuietFlg ReadOnlyFlg Don'tCheckForTruncationFlg)) (NoteFileNeedsConversion ( NC.ProcessNoteFileNeedsConversionError NoteFile NoteFilesHashArray Don'tCacheTypesAndTitlesFlg Don'tCreateFlg ConvertNoConfirmFlg Don'tCreateArrayFlg Can'tTruncateFlg Don'tCreateInterfaceFlg Don'tGetSpecialCardsFlg InterestedWindow PublicOrPrivate MenuPosition QuietFlg ReadOnlyFlg Don'tCheckForTruncationFlg)) (NoteFileNeedsTruncation ( NC.ProcessNoteFileNeedsTruncationError NoteFile NoteFilesHashArray Don'tCacheTypesAndTitlesFlg Don'tCreateFlg ConvertNoConfirmFlg Don'tCreateArrayFlg Can'tTruncateFlg Don'tCreateInterfaceFlg Don'tGetSpecialCardsFlg InterestedWindow PublicOrPrivate MenuPosition QuietFlg ReadOnlyFlg Don'tCheckForTruncationFlg)) (NoteFileAlreadyOpen (ERSETQ (NC.ReportError NIL (CONCAT (fetch (NoteFile FullFileName) of NoteFile) " is already open for exclusive access. Open failed.")))) (NoteFileOpenFailed (ERSETQ (NC.ReportError NIL (CONCAT "Open of " (fetch (NoteFile FullFileName) of NoteFile) " failed for unknown reason.")) )) (NoteFileHeaderBad (ERSETQ (NC.ReportError NIL (CONCAT "Header of NoteFile " (fetch (NoteFile FullFileName) of NoteFile) " is bad. Contact a NoteCards wizard.")))) (PROGN (ERSETQ (NC.ReportError NIL (CONCAT "Unknown error code (" ReturnValue ") returned by OpenNoteFileFn for NoteFile " FileName))))) ReturnValue)) (* * notify the user. if there's been a problem) (if (AND (NOT (type? NoteFile ReturnValue)) (WINDOWP InterestedWindow)) then (NC.PrintMsg InterestedWindow NIL "Open canceled for NoteFile " FileName "." (CHARACTER 13)) (NC.ClearMsg InterestedWindow T)) (* * return whatever the error processing returned.) (RETURN ReturnValue)) (SETQ ReturnValue) (* * Make sure there is no other open NF with this UID.) (LET (NF) (if (AND (SETQ NF (GETHASH (fetch ( NoteFileCriticalUIDs NoteFile) of CriticalUIDs) NC.NoteFilesHashArray)) (NEQ (fetch (NoteFile FullFileName) of NoteFile) (fetch (NoteFile FullFileName) of NF)) (NC.NoteFileOpenP NF)) then (FLASHW PROMPTWINDOW) (NC.PrintMsg PROMPTWINDOW T "Couldn't open " FileName (CHARACTER 13) "because " (fetch (NoteFile FullFileName) of NF) " is already open " (CHARACTER 13) "and has the same UID.") (NC.CloseNoteFile NoteFile InterestedWindow T) (RETURN NIL))) (* * If needed, build a hash array by calling the device specific BuilHashArrayFn.) (replace (NoteFile UID) of NoteFile with (fetch ( NoteFileCriticalUIDs NoteFile) of CriticalUIDs)) (* * Store this NoteFile object in the appropriate NoteFile hash array) (NC.StoreNoteFileInHashArray NoteFile (OR NoteFilesHashArray NC.NoteFilesHashArray)) (if (NOT Don'tCreateArrayFlg) then (OR QuietFlg (NC.PrintMsg InterestedWindow T "Opening NoteFile: " FileName (CHARACTER 13) "Building index array ..." (CHARACTER 13))) (if (OR (NULL (ERSETQ (SETQ ReturnValue (APPLY* (fetch (NoteFile BuildHashArrayFn) of NoteFile) NoteFile QuietFlg InterestedWindow (CONCAT "Opening NoteFile " (fetch (NoteFile FullFileName) of NoteFile) (CHARACTER 13)))))) (NOT (type? NoteFile ReturnValue))) then (* * Error during building of hash array) (ERSETQ (NC.ReportError NIL (CONCAT "Build Hash Array failed for NoteFile " (fetch (NoteFile FullFileName) of NoteFile) " because " ReturnValue))) (RETURN))) (* * Set up critical UIDs in NoteFile object using the values returned from OpenNoteFileFn.) (NC.InstallCriticalUIDsInNoteFile NoteFile CriticalUIDs) (* * if needed, cache the special cards) (if (NOT Don'tGetSpecialCardsFlg) then (NC.GetSpecialCards NoteFile QuietFlg InterestedWindow (CONCAT "Opening NoteFile: " (fetch (NoteFile FullFileName) of NoteFile) (CHARACTER 13)))) (* * If needed, start the titles and types caching process) (if (NOT Don'tCacheTypesAndTitlesFlg) then (replace (NoteFile CachingProcess) of NoteFile with (ADD.PROCESS (LIST (FUNCTION NC.CacheTypesAndTitles) NoteFile)))) (* * If needed, open up a NoteFile interface.) (if (NOT Don'tCreateInterfaceFlg) then (NC.SetUpNoteFileInterface NoteFile MenuPosition InterestedWindow)) (* * Record this as the last NF opened.) (SETQ NC.LastNoteFileOpened NoteFile) (RETURN NoteFile))) (if (type? NoteFile ReturnValue) then (* * Run through OpenNoteFIleFns with param of AFTER. Stop if any returns DON'T) (for Function in NC.OpenNoteFileFns thereis (EQ (QUOTE DON'T) (APPLY* Function FileName NoteFile (QUOTE AFTER) InterestedWindow))) (* * Go home, returning NoteFile) (if (NULL QuietFlg) then (NC.PrintMsg InterestedWindow T "Opening NoteFile: " FileName (CHARACTER 13) "Done." (CHARACTER 13)) (NC.ClearMsg InterestedWindow T)) (RETURN NoteFile) else (* * Bail out if open was unsuccessful.) (RETURN NIL)))))))) ) (* * Changes to NCLISTCARD) (DEFINEQ (NC.EvaluateListCardSubstance (LAMBDA (Card Message InterestedWindow) (* rht: " 2-Apr-87 14:25") (* * Evaluate the contents of a list card.) (* * rht 4/2/87: Added InterestedWindow arg.) (OR InterestedWindow (SETQ InterestedWindow (NC.CoerceToInterestedWindow Card))) (if Message then (NC.PrintMsg InterestedWindow NIL Message)) (ERSETQ (for Item in (NCP.CardSubstance Card) do (ERRORSET Item))))) ) (* * Changes to NCCARDS) (DEFINEQ (NC.DeleteNoteCards (LAMBDA (CardIdentifiers NoIndividualConfirmFlg DontClearFlg InterestedWindow QuietFlg NoGroupConfirmFlg) (* rht: " 2-Apr-87 14:44") (* Delete note cards. If no card specified then get a list of note cards to be deleted. Then delete these cards.) (* * fgh 11/11/85: Updated to handle new Card objects. Also split off main work of deleteing a single note card into NC.DeleteNoteCard function.) (* * kirk 21Feb86 Added InterestedWindow) (* * kirk 29Apr86 Now returns CardIdentifiers) (* * fgh 6/9/86 Added checks to see if other operations are in progress) (* * rht 7/4/86: Now checks that card is not read-only.) (* * kirk 18Aug86 Added main window for windowless cards.) (* * rht 8/29/86: Reorganized and added call to NC.SeverAllLinks to make deleting more efficient. Added QuietFlg, NoGroupConfirmFlg and Don'tPutToBeDeletedCardsFlg args.) (* * rht 9/5/86: Now forces NoGroupConfirmFlg to be non-nil if NoIndividualConfirmFlg is NIL and only one card to delete.) (* * pmi 12/5/86: Modified message to NC.SelectNoteCards to mention SHIFT-selection.) (* * pmi 12/12/86: Removed obsolete ReturnLinksFlg argument in call to NC.SelectNoteCards.) (* * rht 12/16/86: Removed obsolete Don'tPutToBeDeletedCardsFlg arg.) (* * rht 3/9/87: Changed NC.DeleteSelectingMenu to NC.SelectingCardsMenu.) (* * rg 3/9/87 added NC.ProtectedSessionOperation wrapper) (* * rg 3/11/87 changed call of NC.DeleteNoteCard to NC.DeleteNoteCardInternal) (* * rg 3/18/87 changed NC.ProtectedSessionOperation to NC.CardSelectionOperation) (* * rht 3/30/87: Now calls NC.SeverExternalLinks rather than NC.SeverAllLinks.) (* * rht 4/2/87: Added proper args to call of NC.DeleteNoteCardInternal.) (DECLARE (GLOBALVARS NC.SelectingCardsMenu)) (NC.CardSelectionOperation (OR CardIdentifiers (SETQ CardIdentifiers (NC.SelectNoteCards NIL NIL NC.SelectingCardsMenu InterestedWindow "Please shift-select the Note Cards to be deleted."))) (* * Kludge in case args are nil, say, when we're called from a card's menu.) (if (AND (NULL NoIndividualConfirmFlg) (NULL NoGroupConfirmFlg) (EQ (LENGTH (MKLIST CardIdentifiers)) 1)) then (SETQ NoGroupConfirmFlg T) (SETQ QuietFlg T)) (* * First collect cards that are deletable.) (LET ((CardsToDelete (for CardIdentifier in (MKLIST CardIdentifiers) bind Card eachtime (BLOCK) when (AND (SETQ Card (NC.CoerceToCard CardIdentifier)) (if (NOT (NC.TopLevelCardP Card)) else (NC.PrintMsg (NC.FetchWindow Card) T "You cannot delete this FileBox." (CHARACTER 13)) (DISMISS 1000) (NC.ClearMsg (NC.FetchWindow Card) T) NIL) (NC.CheckForNotReadOnly Card ( NC.FetchWindow Card) "Can't delete cards from a ") (OR NoIndividualConfirmFlg (PROG1 (NC.AskYesOrNo "Are you sure you want to delete this?" " -- " "Yes" (NULL DontClearFlg) (OR (NC.FetchWindow Card) InterestedWindow) NIL NIL) (NC.ClearMsg)))) collect Card)) (NumSpecified (LENGTH (MKLIST CardIdentifiers))) NumToDelete) (SETQ NumToDelete (LENGTH CardsToDelete)) (if (AND (GREATERP NumToDelete 0) (if (EQUAL NumToDelete NumSpecified) then (OR NoGroupConfirmFlg (PROG1 (NC.AskYesOrNo (CONCAT "You've specified " NumToDelete " cards to delete." (CHARACTER 13) "Are you sure you want to delete them? ") NIL "Yes" (NULL DontClearFlg) InterestedWindow) (NC.ClearMsg))) else (PROG1 (NC.AskYesOrNo (CONCAT "Out of " NumSpecified " cards specified, " (DIFFERENCE NumSpecified NumToDelete) " are not deletable." (CHARACTER 13) "Want to delete the remaining " NumToDelete " cards? ") NIL "Yes" (NULL DontClearFlg) InterestedWindow) (NC.ClearMsg)))) then (* * Mark UIDs of cards about to be deleted.) (for Card in CardsToDelete do (NC.UIDPutProp (fetch (Card UID) of Card) (QUOTE AboutToBeDeletedFlg) T)) (* * Sever all links into and out of CardsToDelete) (NC.SeverExternalLinks CardsToDelete QuietFlg InterestedWindow) (* * Now delete the cards one at a time.) (OR QuietFlg (NC.PrintMsg InterestedWindow T "Deleting cards: 1 out of " NumToDelete " ...")) (for Card in CardsToDelete as i from 1 eachtime (BLOCK) do (OR QuietFlg (if (ZEROP (REMAINDER i 10)) then (NC.PrintMsg InterestedWindow T "Deleting cards: " i " out of " NumToDelete " ..."))) (NC.ProtectedCardOperation Card "Delete Card" InterestedWindow ( NC.DeleteNoteCardInternal Card QuietFlg InterestedWindow T))) (OR QuietFlg (NC.ClearMsg InterestedWindow T)) CardIdentifiers))))) ) (PUTPROPS RHTPATCH235 COPYRIGHT ("Xerox Corporation" 1987)) (DECLARE: DONTCOPY (FILEMAP (NIL (980 16244 (NC.RunOpenEvents 990 . 1830) (NC.OpenNoteFile 1832 . 16242)) (16279 16812 ( NC.EvaluateListCardSubstance 16289 . 16810)) (16844 23249 (NC.DeleteNoteCards 16854 . 23247))))) STOP