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

XQSMD5.m

Go to the documentation of this file.
  1. XQSMD5 ;SEA/JLI,MJM - SECURE MENU DELEGATE EDIT USER OPTIONS ;10/15/98 12:22 [ 04/02/2003 8:29 AM ]
  1. ;;8.0;KERNEL;**1002,1003,1004,1005,1007**;APR 1, 2003
  1. ;;8.0;KERNEL;**72,99**;Jul 10, 1995
  1. Q
  1. ;
  1. ENTRY ; Main Entry point to edit primary (if applicable) and secondary options
  1. ;
  1. ; check to see if you have options to delegate
  1. I $O(^VA(200,DUZ,19.5,0))'>0 W !,$C(7),"No Delegated Options Available to Give Out",! Q
  1. ;
  1. ; get user to delegate options to
  1. S Y=$$LOOKUP^XUSER("QA") G:Y'>0 EXIT S (XQDA,DA)=+Y
  1. ;
  1. ; check user's primary menu, if user has primary and it's not one
  1. ; of the ones that you can delegate, goto secondary options,
  1. ; otherwise fall through and edit primary options
  1. S XQPRI=$S($D(^VA(200,DA,201)):+^(201),1:0) I XQPRI,'$D(^VA(200,DUZ,19.5,XQPRI,0)) G SEC
  1. ;
  1. ; either change primary option or leave as is and go to secondary
  1. K DIC
  1. S XQOLD=XQPRI,DIC="^VA(200,"_DUZ_",19.5,",DIC(0)="QMAE",DA(1)=DUZ,DIC("A")=" PRIMARY MENU OPTION: " S:XQPRI>0 DIC("B")=$P(^DIC(19,XQPRI,0),U,1) D ^DIC I +Y=XQOLD!(+Y'>0) G SEC
  1. ;
  1. ; changing primary option
  1. S (X,XQPRI)=+Y,X=$P(^DIC(19,X,0),U,1),DIE="^VA(200,",DA=XQDA,DR="201///"_X_";" D ^DIE
  1. ;
  1. ; delete old keys associated with old primary menu
  1. I XQOLD D
  1. .S MENUOLD(0)=1,MENUOLD(1)=XQOLD,XQANS=""
  1. .D KEYS^XQSMD6(.MENUOLD,.XQKEY,.ABORT) K MENUOLD
  1. .I XQKEY(0) D
  1. ..D ADJUST
  1. ..Q:'ONEGOOD
  1. ..M XQ2=XQKEY
  1. ..W !,"...Removing KEYS associated with previous PRIMARY menu"
  1. ..D KEYDEL
  1. ..Q
  1. K XQ2,XQKEY
  1. ;
  1. ; add new keys associated with new primary menu if you have
  1. ; been delegated those keys
  1. G:'$D(^VA(200,DUZ,52)) SEC
  1. S MENUPRI(0)=1,MENUPRI(1)=XQPRI
  1. D KEYS^XQSMD6(.MENUPRI,.XQKEY,.ABORT) K MENUPRI
  1. D:XQKEY(0) KEYADD
  1. K XQKEY
  1. ;
  1. ; fall through to secondary options
  1. ;
  1. SEC ; Enter Secondary Menu Options from delegated options
  1. K DIC
  1. W ! S DIC="^VA(200,"_DUZ_",19.5,",DIC(0)="QMAE",DA(1)=DUZ,DIC("A")=" SECONDARY MENU OPTION: " D ^DIC G:Y'>0 ENTRY
  1. S XQX=$P(Y,U,2)
  1. S:'$D(^VA(200,XQDA,203,0)) ^(0)="^200.03P" S (XQXNAME,X)=$P(^DIC(19,+Y,0),U,1),DIC="^VA(200,"_XQDA_",203,",DIC(0)="ML",DLAYGO=200,DA(1)=XQDA D ^DIC
  1. ;
  1. S XQADD=+$P(Y,U,3),XQSEC=+Y D KEY:XQADD,DEL:'XQADD K ^DIC(200,XQDA,203.1)
  1. G SEC
  1. ;
  1. EXIT ;
  1. K D0,DA,DI,DIC,DIE,DR,DQ,I,J,ONEGOOD,P,X,XQ1,XQ2,XQ3,XQADD,XQANS,XQCOMMON,XQDA,XQJ,XQKEY,XQKEYIEN,XQOLD,XQPRI,XQSEC,XQX,XQXNAME,Y,Z
  1. Q
  1. ;
  1. DEL ; delete delegated menu
  1. W !,$C(7),"Want to Delete ",XQXNAME," as a Secondary Option? Y// "
  1. R Z:DTIME Q:'$T!(Z[U) S:Z="" Z="Y" Q:"Yy"'[$E(Z)
  1. ;
  1. ; check to see if users has any keys delegated
  1. G:'$D(^VA(200,DUZ,52,0)) MENUDEL
  1. ;
  1. ; build list of users primary ans secondary menus
  1. S MENU1(0)=1,MENU1(1)=XQPRI,XQJ=""
  1. F S XQJ=$O(^VA(200,XQDA,203,"B",XQJ)) Q:XQJ="" D
  1. . Q:XQJ=XQX
  1. . S MENU1(0)=MENU1(0)+1,MENU1(MENU1(0))=XQJ
  1. . Q
  1. ;
  1. ; get list of keys for primary and all secondary menus in XQ1
  1. D KEYS^XQSMD6(.MENU1,.XQ1,.ABORT) K MENU1
  1. ;
  1. ; get list of keys for delegated menu in XQ2
  1. S MENU2(0)=1,MENU2(1)=XQX
  1. D KEYS^XQSMD6(.MENU2,.XQ2,.ABORT) K MENU2
  1. ;
  1. ; compare the two list and inform the user if delegated menu
  1. ; has keys unique to the delegated menu, store in XQ3
  1. S XQANS="N",ONEGOOD=0
  1. D:XQ2(0)>0 COMPARE
  1. D:ONEGOOD INFORM
  1. ;
  1. ; user timeout or "^" aborted
  1. I $G(DTOUT)!($G(DUOUT)) W !!,$C(7),"No action taken, menu delegation still active!" Q
  1. ;
  1. ; delete keys if user respond with 'Unique' or 'All'
  1. I XQANS="U"!(XQANS="A") D KEYDEL
  1. ;
  1. ; delete menu from user's secondary menu's multiple
  1. S DIE="^VA(200,"_XQDA_",203,",DR=".01///@",DA=XQSEC,DA(1)=XQDA D ^DIE
  1. ;
  1. W !!,$C(7),"Delegated Menu: "_XQXNAME_" has been removed!"
  1. Q
  1. ;
  1. KEY ; get list of keys
  1. N MENULIST,XQKEY,ABORT
  1. S MENULIST(0)=1,MENULIST(1)=XQX
  1. D KEYS^XQSMD6(.MENULIST,.XQKEY,.ABORT)
  1. Q:ABORT
  1. D:XQKEY(0) KEYADD
  1. W !!,$C(7),"Delegated Menu: "_XQXNAME_" has been added!"
  1. Q
  1. ;
  1. KEYDEL ; delete keys
  1. F I=1:1:XQ2(0) D
  1. .Q:XQ2(I)=""
  1. .S XQCOMMON=0,XQKEYIEN=""
  1. .I XQANS="U" F J=1:1:XQ3(0) S:XQ2(1)=XQ3(J) XQCOMMON=1
  1. .Q:XQCOMMON
  1. .S XQKEYIEN=$O(^DIC(19.1,"B",XQ2(I),0))
  1. .S DIE="^VA(200,"_XQDA_",51,",DR=".01///@",DA=XQKEYIEN,DA(1)=XQDA D ^DIE
  1. .W !,$C(7),"Key: "_XQ2(I)_" has been removed!"
  1. .Q
  1. Q
  1. ;
  1. KEYADD ; add keys
  1. ; adjust list to ones that have been delegated to you
  1. D ADJUST Q:'ONEGOOD
  1. W !!,$C(7),"The following Keys LOCK options within this menu structure",!
  1. F I=1:1:XQKEY(0) W:XQKEY(I)'="" !,?5,XQKEY(I)
  1. W !!,$C(7),"Do you want to ALLOCATE these Keys to this User? N// "
  1. R Z:DTIME Q:'$T!(Z[U) S:Z="" Z="N" Q:"Nn"[$E(Z)
  1. ;
  1. K DIC
  1. S DIC="^VA(200,"_XQDA_",51,",DIC(0)="NMQ",DIC("P")="200.051PA",DA(1)=XQDA
  1. F I=1:1:XQKEY(0) D
  1. .Q:XQKEY(I)=""
  1. .S X=$O(^DIC(19.1,"B",XQKEY(I),0)),DINUM=X
  1. .I '$D(^VA(200,XQDA,51,"B",X,X)) D FILE^DICN W !,$C(7),"Key: "_XQKEY(I)_" has been added!"
  1. .Q
  1. Q
  1. ;
  1. COMPARE ; compare keys used in the delegated menu against keys the user
  1. ; will need based on their primary and secondary menus
  1. N KEYIEN
  1. S XQ3="",XQ3(0)=0
  1. F I=1:1:XQ2(0) D
  1. .S KEYIEN=$O(^DIC(19.1,"B",XQ2(I),0))
  1. .I '$G(^VA(200,DUZ,52,KEYIEN,0)) S XQ2(I)="" Q
  1. .S ONEGOOD=1
  1. .F J=1:1:XQ1(0) D
  1. ..Q:XQ2(I)'=XQ1(J)
  1. ..S XQ3(0)=XQ3(0)+1,XQ3(XQ3(0))=XQ2(I)
  1. ..Q
  1. Q
  1. ;
  1. INFORM ; inform the user of the keys situation
  1. W !!,$C(7),"The following Keys LOCK options within this menu structure.",!
  1. F I=1:1:XQ2(0) W:XQ2(I)'="" !,?5,XQ2(I)
  1. W:XQ3(0) !!,$C(7),"The following are Keys from the list above that this User has potential needs",!,"for within their current assigned Menu's (Primary and all Secondaries)."
  1. W:XQ3(0) !,"Selecting 'U' will remove all keys EXCEPT those noted below.",! F I=1:1:XQ3(0) W !,?5,XQ3(I)
  1. S DIR(0)="S^A:ALL Remove all Keys associated with this Menu;N:NONE Do not remove any Keys associated with this Menu"_$S(XQ3(0):";U:UNIQUE Only remove Keys unique to this Menu",1:"")
  1. D ^DIR S XQANS=Y
  1. Q
  1. ;
  1. ADJUST ; adjust the list of keys to ones that the user (DUZ) has
  1. ; been delegated [node ^VA(200,DUZ,52,]
  1. N I,KEYIEN
  1. S ONEGOOD=0
  1. F I=1:1:XQKEY(0) D
  1. . S KEYIEN=$O(^DIC(19.1,"B",XQKEY(I),0))
  1. . I $G(^VA(200,DUZ,52,KEYIEN,0)) S ONEGOOD=1 Q
  1. . S XQKEY(I)=""
  1. . Q
  1. Q