(FILECREATED "30-Mar-87 23:11:57" {QV}<NOTECARDS>1.3K>NEXT>RHTPATCH233.;1 6945   

      changes to:  (VARS RHTPATCH233COMS)
		   (FNS NC.DeleteNoteCards))


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

(PRETTYCOMPRINT RHTPATCH233COMS)

(RPAQQ RHTPATCH233COMS ((* * Change to NC.DeleteNoteCards to call NC.SeverExternalLinks rather than 
			     NC.SeverAllLinks.)
			  (* * Change to NCCARDS)
			  (FNS NC.DeleteNoteCards)))
(* * Change to NC.DeleteNoteCards to call NC.SeverExternalLinks rather than NC.SeverAllLinks.)

(* * Change to NCCARDS)

(DEFINEQ

(NC.DeleteNoteCards
  (LAMBDA (CardIdentifiers NoIndividualConfirmFlg DontClearFlg InterestedWindow QuietFlg 
			   NoGroupConfirmFlg)                (* rht: "30-Mar-87 23:10")
                                                             (* 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.)


    (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)))
					       (OR QuietFlg (NC.ClearMsg InterestedWindow T))
					       CardIdentifiers)))))
)
(PUTPROPS RHTPATCH233 COPYRIGHT ("Xerox Corporation" 1987))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (589 6863 (NC.DeleteNoteCards 599 . 6861)))))
STOP