Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XQSMD6

XQSMD6.m

Go to the documentation of this file.
  1. XQSMD6 ;SFISC/JDS - SECURE MENU DELEGATION UTILITIES ;03/02/98 10:40 [ 04/02/2003 8:29 AM ]
  1. ;;8.0;KERNEL;**1005,1007**;APR 1, 2003
  1. ;;8.0;KERNEL;**72**;NOV 13, 1997
  1. Q
  1. ;
  1. ; Entry to lookup all Keys associated with a Menu
  1. ; INPUT - MENULIST ARRAY --- (passed by reference)
  1. ; MENULIST(0) = Total number of Menus to start with
  1. ; MENULIST(1) = 1st Menu IEN
  1. ; MENULIST(2) - 2nd Menu IEN
  1. ; ...etc
  1. ; OUTPUT - ABORT = 1 if IEN doesn't exist --- (passed by reference)
  1. ; XQKEY ARRAY --- (passed by reference)
  1. ; XQKEY(0) = Total number of Keys
  1. ; XQKEY(1) = 1st Key found
  1. ; XQKEY(2) = 2nd Key found
  1. ; ...etc
  1. ;
  1. KEYS(MENULIST,XQKEY,ABORT) ;
  1. ; Order thru menu structure in search of locks
  1. S ABORT=0 D CHECK Q:ABORT
  1. ;
  1. K ^XTMP($J,"XQSMD6")
  1. M ^XTMP($J,"XQSMD6")=MENULIST
  1. F X=1:1:MENULIST(0) S ^XTMP($J,"XQSMD6","B",MENULIST(X))=""
  1. ;
  1. N XQJ,KEY,PIEN,CNT
  1. S XQJ="",XQKEY="",XQKEY(0)=0
  1. ;
  1. PROCESS ;
  1. F CNT=1:1 S PIEN=$G(^XTMP($J,"XQSMD6",CNT)) Q:PIEN="" D BUILD
  1. ;
  1. K ^XTMP($J,"XQSMD6"),XQKEY("B")
  1. Q
  1. ;
  1. BUILD ;
  1. ; 1st check to see if this option is still on the system,
  1. ; then check to see if a key is locking this option
  1. ;
  1. Q:'$D(^DIC(19,PIEN,0))
  1. I $P(^DIC(19,PIEN,0),U,6)]"" D KEYADD
  1. ;
  1. ; check to see if this option has any children
  1. S XQJ=""
  1. F S XQJ=$O(^DIC(19,PIEN,10,"B",XQJ)) Q:XQJ="" D CHILDADD
  1. Q
  1. ;
  1. CHILDADD ;
  1. ; Add a child to the list of children
  1. ; quit if child is already in the list
  1. ;
  1. Q:$D(^XTMP($J,"XQSMD6","B",XQJ))
  1. S ^XTMP($J,"XQSMD6",0)=^XTMP($J,"XQSMD6",0)+1
  1. S ^XTMP($J,"XQSMD6",^XTMP($J,"XQSMD6",0))=XQJ
  1. S ^XTMP($J,"XQSMD6","B",XQJ)=""
  1. I ^XTMP($J,"XQSMD6",0)#100=0 W "."
  1. Q
  1. KEYADD ;
  1. ; Add a key to the list of keys needed
  1. ;
  1. S KEY=$P(^DIC(19,PIEN,0),U,6)
  1. ;
  1. ; quit if key is already in the list
  1. Q:$D(XQKEY("B",KEY))
  1. S XQKEY(0)=XQKEY(0)+1
  1. S XQKEY(XQKEY(0))=KEY
  1. S XQKEY("B",KEY)=""
  1. Q
  1. CHECK ;
  1. ; ensure that IEN passed in is in option file ^DIC(19,
  1. ;
  1. I '$D(^DIC(19,MENULIST(1),0)) D
  1. . S ABORT=1
  1. . W !!,?7,"Aborting key search, Option File IEN "_IEN_" doesn't exist!",!!
  1. Q