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

XMVGRP.m

Go to the documentation of this file.
  1. XMVGRP ;ISC-SF/GMB-Group creation/enrollment ;03/07/2002 07:01
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; Entry points used by MailMan options (not covered by DBIA):
  1. ; ENLOCAL XMxxxxx - Add local users to mail groups
  1. ENLOCAL1(XMXQUSER) ; Add local user(s) to group(s) - called from Kernel
  1. ; XMXQUSER - first user being added (duz or name)
  1. I '$D(XMV) N XMV,XMDISPI,XMDUN,XMNOSEND,XMPRIV
  1. D INITAPI^XMVVITAE
  1. ENLOCAL ; Add local user(s) to mail group(s).
  1. N XMGRP,XMMBR,XMINSTR,XMTSK,XMTO,XMABORT
  1. S XMABORT=0
  1. D ENGRP(.XMGRP,.XMABORT) Q:XMABORT!'$D(XMGRP) ; select groups
  1. D ENUSER(.XMMBR,.XMABORT,.XMXQUSER) Q:XMABORT ; select users
  1. D ENCONF(.XMGRP,.XMMBR,.XMABORT) Q:XMABORT ; confirm it
  1. D ADD2GRPZ^XMXGRP(.XMGRP,.XMMBR,.XMTO) ; add users to groups
  1. W !!,$$EZBLD^DIALOG(38233) ; Users have been added to the mail groups
  1. D ENFWD(XMDUZ,.XMINSTR,.XMABORT) Q:XMABORT ; forward msgs?
  1. D FAFMSGS^XMXGRP1(XMDUZ,.XMGRP,.XMTO,.XMINSTR,.XMTSK) ; yup.
  1. D FWDTSK^XMVGROUP(XMTSK) ; tell the user the task number.
  1. Q
  1. ENGRP(XMGRP,XMABORT) ;
  1. N Y
  1. F D Q:Y=-1!XMABORT
  1. . N DIC,DIR,X,XMDEL
  1. . S DIR("A")=$$EZBLD^DIALOG($S($D(XMGRP):38211,1:38210)) ; Another mail group / Allocate mail group
  1. . S DIR("PRE")="I $E(X)=""-"" S XMDEL=1,X=$E(X,2,99)"
  1. . D BLD^DIALOG(38213,"","","DIR(""?"")")
  1. . ;Enter the name of the mail group you wish to allocate.
  1. . ;Precede any mail group name with '-' to remove it.
  1. . ;You'll only be able to select mail groups you're authorized to edit.
  1. . ;Enter ?? for a list of mail groups you've already selected,
  1. . ;and for mail group help.
  1. . S DIR("??")="^D HELPGRP^XMVGRP"
  1. . S DIR(0)="PO^3.8:FEMQ"
  1. . S DIC("S")=$$GRPSCR^XMVGROUP(1)
  1. . D ^DIR I $D(DTOUT)!$D(DUOUT) S XMABORT=1 Q
  1. . Q:Y=-1
  1. . I '$G(XMDEL) S XMGRP($P(Y,U,2))=+Y Q
  1. . I '$D(XMGRP($P(Y,U,2))) W $C(7),$$EZBLD^DIALOG(38214) Q ; ?? Not on current list.
  1. . K XMGRP($P(Y,U,2))
  1. . W $$EZBLD^DIALOG(38215) ; Deleted from current list.
  1. Q
  1. HELPGRP ;
  1. I '$D(XMGRP) W !,$$EZBLD^DIALOG(38216) ; You haven't selected any mail groups yet.
  1. E D SHOWGRP
  1. N DIR,X,Y,DIRUT,DTOUT,DIRUT
  1. S DIR("A")=$$EZBLD^DIALOG(38217) ; Want mail group help
  1. S DIR(0)="Y"
  1. S DIR("B")=$$EZBLD^DIALOG(39053) ; NO
  1. D ^DIR Q:'Y
  1. ;D HELP^XMHIG
  1. N DIC,X,Y,DLAYGO
  1. S DIC(0)="AEQM",DIC="^XMB(3.8,"
  1. S DIC("S")=$$GRPSCR^XMVGROUP(1)
  1. F W ! D ^DIC Q:Y<0 D
  1. . D DISPLAY^XMHIG(+Y)
  1. Q
  1. SHOWGRP ;
  1. N XMI,XMJ,XML,XMLN
  1. W !!,$$EZBLD^DIALOG(38218) ; You've selected the following mail groups:
  1. S XML=0,XMI="" F S XMI=$O(XMGRP(XMI)) Q:XMI="" I $L(XMI)>XML S XML=$L(XMI)
  1. S XML=XML+3,XMLN=80\XML
  1. S XMI=""
  1. F XMJ=0:1 S XMI=$O(XMGRP(XMI)) Q:XMI="" D
  1. . W:'(XMJ#XMLN) ! W ?(XMJ#XMLN*XML),XMI
  1. Q
  1. ENUSER(XMMBR,XMABORT,XMUSER) ;
  1. N XMX,XMDONE
  1. W !
  1. S XMDONE=0
  1. F D Q:XMDONE!XMABORT
  1. . N XMDEL
  1. . W !,$$EZBLD^DIALOG($S($D(XMMBR):38221,1:38220)) ; Another user: / Add user:
  1. . I $G(XMUSER)'="" D
  1. . . S XMX=XMUSER
  1. . . K XMUSER
  1. . . W XMX
  1. . E D Q:XMX=""
  1. . . R XMX:DTIME S:'$T XMX=U I XMX[U S XMABORT=1 Q
  1. . . I XMX="" D Q
  1. . . . I $D(XMMBR) S XMDONE=1 Q
  1. . . . W $C(7)," ??",!,$$EZBLD^DIALOG(38222) ; You must select a user, or enter ^ to exit.
  1. . . I XMX?1."?" D HELPUSR(XMX) S:XMX'="?" XMX="" Q
  1. . . I $E(XMX)="-" S XMDEL=1,XMX=$E(XMX,2,99) W:XMX="" " ??",$C(7)
  1. . N DIC,D,X,Y,DLAYGO,XMNAME
  1. . S X=$$UP^XLFSTR(XMX)
  1. . S DIC("S")="I $L($P(^(0),U,3)),$D(^XMB(3.7,+Y,2))" ; User must have an access code & mailbox
  1. . S DIC("W")="I Y'=DUZ D USERINFO^XMXADDR1(Y)"
  1. . S DIC="^VA(200,"
  1. . S DIC(0)="FEMN" ; 'N' means if user enters a DUZ, ask "OK?"
  1. . S D="B^BB^C^D" ; name^alias^initial^nickname
  1. . D MIX^DIC1 I $D(DTOUT)!$D(DUOUT) S XMABORT=1 Q
  1. . I Y<0 W " ??",$C(7) Q
  1. . S XMNAME=$$NAME^XMXUTIL(+Y) ; $P(Y,U,2)
  1. . I '$G(XMDEL) S XMMBR(XMNAME)=+Y Q
  1. . I '$D(XMMBR(XMNAME)) W !,$C(7),$$EZBLD^DIALOG(38214) Q ; ?? Not on current list.
  1. . K XMMBR(XMNAME)
  1. . W !,$$EZBLD^DIALOG(38215) ; Deleted from current list.
  1. Q
  1. HELPUSR(XMX) ;
  1. I XMX="?" D Q
  1. . N XMTEXT
  1. . D BLD^DIALOG(38223,"","","XMTEXT","F")
  1. . D MSG^DIALOG("WH","","","","XMTEXT")
  1. . ;Enter the name of the user you wish to add to the group(s).
  1. . ;Precede any user name with '-' to remove it.
  1. . ;You'll only be able to select users with mailboxes and access codes.
  1. . ;Enter ?? for a list of users you've already selected,
  1. . ;and for user help.
  1. I '$D(XMMBR) W !,$$EZBLD^DIALOG(38226) ;You haven't selected any users yet.
  1. E D SHOWUSR
  1. N DIR,X,Y,DIRUT,DTOUT,DIRUT
  1. S DIR("A")=$$EZBLD^DIALOG(38224) ; Want user help
  1. S DIR(0)="Y"
  1. S DIR("B")=$$EZBLD^DIALOG(39053) ; NO
  1. D ^DIR Q:'Y
  1. D HELP^XMHIU
  1. Q
  1. SHOWUSR ;
  1. N XMI,XMJ,XML,XMLN
  1. W !!,$$EZBLD^DIALOG(38225) ; You've selected the following users:
  1. S XML=0,XMI="" F S XMI=$O(XMMBR(XMI)) Q:XMI="" I $L(XMI)>XML S XML=$L(XMI)
  1. S XML=XML+3,XMLN=80\XML
  1. S XMI=""
  1. F XMJ=0:1 S XMI=$O(XMMBR(XMI)) Q:XMI="" D
  1. . W:'(XMJ#XMLN) ! W ?(XMJ#XMLN*XML),XMI
  1. Q
  1. ENCONF(XMGRP,XMMBR,XMABORT) ;
  1. D SHOWGRP
  1. D SHOWUSR
  1. W !
  1. N DIR,X,Y
  1. D BLD^DIALOG(38230,"","","DIR(""A"")") ; You are adding users to mail groups. Do you wish to proceed
  1. S DIR(0)="Y"
  1. S DIR("B")=$$EZBLD^DIALOG(39054) ; yes
  1. D ^DIR I 'Y S XMABORT=1
  1. Q
  1. ENFWD(XMDUZ,XMINSTR,XMABORT) ;
  1. W !
  1. N DIR,X,Y
  1. D BLD^DIALOG(38231,"","","DIR(""A"")")
  1. ;Do you wish to forward past mail group messages
  1. ;to the user(s) you just added to the mail group(s)
  1. D BLD^DIALOG(38232,"","","DIR(""?"")")
  1. ;Answer YES to forward past mail group messages.
  1. ;You will be asked for a time frame to search,
  1. ;and then MailMan will create a task to find and forward
  1. ;existing mail group messages.
  1. S DIR(0)="Y"
  1. S DIR("B")=$$EZBLD^DIALOG(39053) ; no
  1. D ^DIR I $D(DIRUT)!'Y S XMABORT=1 Q
  1. D FWDDATES(XMDUZ,.XMINSTR,.XMABORT) Q:XMABORT
  1. S XMINSTR("FLAGS")="F"
  1. Q
  1. FWDDATES(XMDUZ,XMINSTR,XMABORT) ;
  1. ; Message sent on or before date
  1. N DIR,Y,X,XMOLDEST,XMTEXT
  1. ;S XMOLDEST=$O(^XMB(3.9,"C",""))
  1. F S XMOLDEST=$O(^XMB(3.9,"C","")) Q:XMOLDEST?1N.N K ^XMB(3.9,"C",XMOLDEST) ; kill bogus nodes
  1. ; You will now choose a date range for the messages to be searched
  1. ; and forwarded. The oldest message is from XMOLDEST.
  1. W !
  1. D BLD^DIALOG(38023.5,$$FMTE^XLFDT(XMOLDEST,5),"","XMTEXT","F")
  1. D MSG^DIALOG("WM","",IOM,"","XMTEXT")
  1. I $P(^XMB(3.7,XMDUZ,0),U,7) D
  1. . N XMCUT
  1. . S XMCUT=$P(^XMB(3.7,XMDUZ,0),U,7)
  1. . Q:XMCUT<XMOLDEST
  1. . ; You may not access any message prior to |1| unless someone
  1. . ; forwards it to you.
  1. . D BLD^DIALOG(37100,$$FMTE^XLFDT(XMCUT,5),"","XMTEXT","F")
  1. . D MSG^DIALOG("WE","",IOM,"","XMTEXT")
  1. . S XMOLDEST=XMCUT
  1. W !
  1. S DIR(0)="DO^"_XMOLDEST_":DT:EX"
  1. S DIR("A")=$$EZBLD^DIALOG(34444) ; Message sent on or after
  1. D BLD^DIALOG(34444.1,"","","DIR(""?"")")
  1. ; Enter a date. It must include day, month, and year.
  1. S DIR("B")=$$FMTE^XLFDT($$MAX^XLFMTH(XMOLDEST,$$FMADD^XLFDT(DT,-365)),5)
  1. D ^DIR I $D(DIRUT) S XMABORT=1 Q
  1. S XMINSTR("FDATE")=Y
  1. ; Message sent on or before date
  1. I XMINSTR("FDATE")=DT S XMINSTR("TDATE")=DT Q
  1. K DIR,Y,X
  1. S DIR(0)="DO^"_XMINSTR("FDATE")_":DT:EX"
  1. S DIR("A")=$$EZBLD^DIALOG(34445) ; Message sent on or before
  1. D BLD^DIALOG(34444.1,"","","DIR(""?"")")
  1. ; Enter a date. It must include day, month, and year.
  1. S DIR("B")=$$FMTE^XLFDT(DT,5)
  1. D ^DIR I $D(DIRUT) S XMABORT=1 Q
  1. S XMINSTR("TDATE")=Y
  1. Q