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

PXRMEXIX.m

Go to the documentation of this file.
  1. PXRMEXIX ;SLC/PJH - Reminder Dialog Exchange checks. ;10/10/2007
  1. ;;2.0;CLINICAL REMINDERS;**6**;Feb 04, 2005;Build 123
  1. ;
  1. ;=====================================================================
  1. ;
  1. ;Yes/No Prompts
  1. ;--------------
  1. ASK(YESNO,TEXT,HELP) ;
  1. W !
  1. N DIR,X,Y
  1. K DIROUT,DIRUT,DTOUT,DUOUT
  1. S DIR(0)="YA0"
  1. M DIR("A")=TEXT
  1. S DIR("B")="Y"
  1. S DIR("?")="Enter Y or N. For detailed help type ??"
  1. S DIR("??")=U_"D HLP^PXRMEXIX(HELP)"
  1. D ^DIR K DIR
  1. I $D(DIROUT) S DTOUT=1
  1. I $D(DTOUT)!($D(DUOUT)) S PXRMDONE=1 Q
  1. S YESNO=$E(Y(0))
  1. Q
  1. ;
  1. ;Dialog check - all exist, none exist or some exist
  1. ;--------------------------------------------------
  1. EXIST(ALL,DNAME,DTYP,INAME) ;
  1. ;0 - None exist
  1. ;1 - All exist
  1. ;2 - Some exist
  1. ;
  1. ;Look for component dialogs in DMAP node from PXRMEXIC
  1. N DONE,DOTHER,EXISTS,FILE,MODE
  1. S ALL="",DONE=0,MODE="",NAME=""
  1. ;
  1. I DTYP="reminder dialog" D
  1. .F S NAME=$O(^TMP("PXRMEXTMP",$J,"DMAP",NAME)) Q:NAME="" D Q:DONE
  1. ..;Check if dialog exists
  1. ..S EXISTS=$$EXISTS^PXRMEXIU(801.41,NAME)
  1. ..;If exists accumulate list of ancestors
  1. ..I EXISTS D OTHER(NAME,.DOTHER)
  1. ..;Quit if some exist and some don't
  1. ..I MODE=1,'EXISTS S MODE=2,DONE=1 Q
  1. ..I MODE=0,EXISTS S MODE=2,DONE=1 Q
  1. ..;Set all exists flag if dialog found
  1. ..I MODE="",EXISTS S MODE=1
  1. ..;Set none exists flag if dialog not found
  1. ..I MODE="",'EXISTS S MODE=0
  1. ;
  1. I DTYP'="reminder dialog" D
  1. .F S NAME=$O(INAME(NAME)) Q:NAME="" D Q:DONE
  1. ..;Treat namechanges as 'done'
  1. ..I $D(PXRMNMCH(801.41,NAME)) Q
  1. ..;Check if dialog exists
  1. ..S EXISTS=$$EXISTS^PXRMEXIU(801.41,NAME)
  1. ..;If exists accumulate list of ancestors
  1. ..I EXISTS D OTHER(NAME,.DOTHER)
  1. ..;Quit if some exist and some don't
  1. ..I MODE=1,'EXISTS S MODE=2,DONE=1 Q
  1. ..I MODE=0,EXISTS S MODE=2,DONE=1 Q
  1. ..;Set all exists flag if dialog found
  1. ..I MODE="",EXISTS S MODE=1
  1. ..;Set none exists flag if dialog not found
  1. ..I MODE="",'EXISTS S MODE=0
  1. ;
  1. ;If all or none exist give option to install all without prompting
  1. N ANS,TEXT
  1. I MODE=0 D
  1. .S TEXT(1)="All dialog components for "_DNAME_" are new."
  1. I MODE=1 D
  1. .S TEXT(1)="All dialog components for "_DNAME_" already exist."
  1. .S TEXT(2)="",TEXT(4)=""
  1. .S TEXT(3)="Components not used by any other dialogs."
  1. .;Warn if used by other dialogs
  1. .I $D(DOTHER) D
  1. ..S TEXT(3)="WARNING - some components already used by:"
  1. ..N CNT,DLIT,DNAME,DTYP,FIRST,NAME
  1. ..S CNT=4,DNAME="",TEXT(CNT)=""
  1. ..F S DNAME=$O(DOTHER(DNAME)) Q:DNAME="" D
  1. ...S NAME="",FIRST=1,CNT=CNT+1
  1. ...S DTYP=DOTHER(DNAME)
  1. ...I DTYP="R" S DTYP="Reminder Dialog"
  1. ...I DTYP="G" S DTYP="Dialog Group"
  1. ...I DTYP="E" S DTYP="Dialog Element"
  1. ...;S CNT=CNT+1,FIRST=0,TEXT(CNT)=DLIT_NAME_" ("_DTYP_")"
  1. ...S CNT=CNT+1,FIRST=0,TEXT(CNT)=DNAME_" ("_DTYP_")"
  1. ..S CNT=CNT+1,TEXT(CNT)=""
  1. S TEXT="Install "_DTYP_" and all components with no further changes: "
  1. ;Give option to install all descendents
  1. D ASK(.ANS,.TEXT,2) I $G(ANS)="Y" S ALL=1
  1. I $G(ANS)="N" S ALL=0
  1. Q
  1. ;
  1. ;Check if used by other dialogs
  1. ;------------------------------
  1. OTHER(NAME,LIST) ;
  1. N DDATA,DIEN,DNAME,DTYP,IEN
  1. S IEN=$O(^PXRMD(801.41,"B",NAME,0)) Q:'IEN
  1. ;Check if used by other dialogs
  1. I '$D(^PXRMD(801.41,"AD",IEN)) Q
  1. ;Build list of dialogs using this component
  1. S DIEN=0
  1. F S DIEN=$O(^PXRMD(801.41,"AD",IEN,DIEN)) Q:'DIEN D
  1. .S DDATA=$G(^PXRMD(801.41,DIEN,0)) Q:DDATA=""
  1. .S DNAME=$P(DDATA,U),DTYP=$P(DDATA,U,4) Q:DNAME=""
  1. .;Include only dialogs that are not part of this reminder dialog
  1. .I $D(^TMP("PXRMEXTMP",$J,"DMAP",DNAME)) Q
  1. .S LIST(DNAME)=DTYP
  1. Q
  1. ;
  1. ;General help text routine.
  1. ;--------------------------
  1. HLP(CALL) ;
  1. N HTEXT
  1. N DIWF,DIWL,DIWR,IC
  1. S DIWF="C75",DIWL=0,DIWR=75
  1. ;
  1. I CALL=1 D
  1. .S HTEXT(1)="Enter 'Yes' to install all sub-components or"
  1. .S HTEXT(2)="enter 'No' to install only the selected dialog."
  1. I CALL=2 D
  1. .S HTEXT(1)="Enter 'Yes' to install without changes."
  1. .S HTEXT(2)="Enter 'No' to install with changes."
  1. I CALL=3 D
  1. .S HTEXT(1)="Select IFE to INSTALL reminder or dialog from this exchange"
  1. .S HTEXT(2)="entry. Select DFE to DELETE this entry from the exchange file. "
  1. .S HTEXT(3)="Select IH to view the installation HISTORY for this entry."
  1. K ^UTILITY($J,"W")
  1. S IC=""
  1. F S IC=$O(HTEXT(IC)) Q:IC="" D
  1. . S X=HTEXT(IC)
  1. . D ^DIWP
  1. W !
  1. S IC=0
  1. F S IC=$O(^UTILITY($J,"W",0,IC)) Q:IC="" D
  1. . W !,^UTILITY($J,"W",0,IC,0)
  1. K ^UTILITY($J,"W")
  1. W !
  1. Q