| 1 | XMJMF2 ;ISC-SF/GMB-XMJMF (cont.) ;07/12/2002  10:11 | 
|---|
| 2 | ;;8.0;MailMan;;Jun 28, 2002 | 
|---|
| 3 | B ; Search one basket | 
|---|
| 4 | N XMDIC,XMFBSKT | 
|---|
| 5 | S XMDIC("B")=$G(XMFBSKTN,$$EZBLD^DIALOG(37005)) ; IN | 
|---|
| 6 | D SELBSKT^XMJBU(XMDUZ,34439,"",.XMDIC,.XMFBSKT,.XMFBSKTN) I XMFBSKT=U S XMABORT=1 Q  ; Select basket to search: | 
|---|
| 7 | S XMF("BSKT")=XMFBSKT | 
|---|
| 8 | Q | 
|---|
| 9 | BA ; Search all baskets | 
|---|
| 10 | S XMF("BSKT")="*" | 
|---|
| 11 | Q | 
|---|
| 12 | DA ; Message sent on or after date | 
|---|
| 13 | N DIR,Y,X | 
|---|
| 14 | S DIR(0)="DO^:"_$G(XMF("TDATE"),DT)_":EX" | 
|---|
| 15 | S DIR("A")=$$EZBLD^DIALOG(34444) ; Message sent on or after | 
|---|
| 16 | D BLD^DIALOG(34444.1,"","","DIR(""?"")") | 
|---|
| 17 | ; Enter a date.  It must include day, month, and year. | 
|---|
| 18 | S:$D(XMF("FDATE")) DIR("B")=XMFFDTX | 
|---|
| 19 | D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 20 | I X="@" D  Q | 
|---|
| 21 | . I XMK="!" D NODELETE Q | 
|---|
| 22 | . K XMF("FDATE") | 
|---|
| 23 | Q:Y="" | 
|---|
| 24 | S XMF("FDATE")=Y | 
|---|
| 25 | S XMFFDTX=$$MMDT^XMXUTIL1(XMF("FDATE")) | 
|---|
| 26 | Q | 
|---|
| 27 | NODELETE ;This search requires a date range. | 
|---|
| 28 | ;You may change the dates, but you may not delete them. | 
|---|
| 29 | N XMTEXT | 
|---|
| 30 | D BLD^DIALOG(34444.5,"","","XMTEXT","F") | 
|---|
| 31 | D MSG^DIALOG("WE","","","","XMTEXT") | 
|---|
| 32 | D WAIT^XMXUTIL | 
|---|
| 33 | Q | 
|---|
| 34 | DB ; Message sent on or before date | 
|---|
| 35 | N DIR,Y,X | 
|---|
| 36 | S DIR(0)="DO^"_$G(XMF("FDATE"))_":DT:EX" | 
|---|
| 37 | S DIR("A")=$$EZBLD^DIALOG(34445) ; Message sent on or before | 
|---|
| 38 | D BLD^DIALOG(34444.1,"","","DIR(""?"")") | 
|---|
| 39 | ; Enter a date.  It must include day, month, and year. | 
|---|
| 40 | S:$D(XMF("TDATE")) DIR("B")=XMFTDTX | 
|---|
| 41 | D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 42 | I X="@" D  Q | 
|---|
| 43 | . I XMK="!" D NODELETE Q | 
|---|
| 44 | . K XMF("TDATE") | 
|---|
| 45 | Q:Y="" | 
|---|
| 46 | S XMF("TDATE")=Y | 
|---|
| 47 | S XMFTDTX=$$MMDT^XMXUTIL1(XMF("TDATE")) | 
|---|
| 48 | Q | 
|---|
| 49 | F ; Message from | 
|---|
| 50 | D GETPERS(XMDUZ,.XMF,"FROM",.XMFFRN,34440,34441,.XMABORT) | 
|---|
| 51 | Q | 
|---|
| 52 | G ; Go search | 
|---|
| 53 | W !,$$EZBLD^DIALOG(34417) ; Searching... | 
|---|
| 54 | I XMK="!" D FIND^XMJMFC(XMDUZ,.XMF,1) Q | 
|---|
| 55 | I $G(XMF("BSKT"))="*" D FINDALL^XMJMFB(XMDUZ,.XMF) Q | 
|---|
| 56 | D FIND1^XMJMFB(XMDUZ,.XMF,1) | 
|---|
| 57 | Q | 
|---|
| 58 | LM ; Message has this many lines or more | 
|---|
| 59 | N DIR,Y,X | 
|---|
| 60 | S DIR(0)="FO^1:12^K:'$$LMOK^XMJMF2(X) X" | 
|---|
| 61 | S DIR("A")=$$EZBLD^DIALOG(34449) ; Lines of text, minimum | 
|---|
| 62 | D BLD^DIALOG(34449.1,"","","DIR(""?"")") | 
|---|
| 63 | ; Enter a number from 100 to 100,000. | 
|---|
| 64 | ; We will find all messages with that many lines of text or more. | 
|---|
| 65 | S:$D(XMF("FLINE")) DIR("B")=XMF("FLINE") | 
|---|
| 66 | D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 67 | I X="@" K XMF("FLINE") Q | 
|---|
| 68 | I Y S XMF("FLINE")=Y | 
|---|
| 69 | Q | 
|---|
| 70 | LMOK(X) ; | 
|---|
| 71 | I X="@" Q 1 | 
|---|
| 72 | I X'?1N.N Q 0 | 
|---|
| 73 | I $G(XMF("TLINE")),X>XMF("TLINE") Q 0 | 
|---|
| 74 | I X<100 Q 0 | 
|---|
| 75 | I X>100000 Q 0 | 
|---|
| 76 | Q 1 | 
|---|
| 77 | LX ; Message has this many lines or less | 
|---|
| 78 | N DIR,Y,X | 
|---|
| 79 | S DIR(0)="FO^1:12^K:'$$LXOK^XMJMF2(X) X" | 
|---|
| 80 | S DIR("A")=$$EZBLD^DIALOG(34450) ; Lines of text, maximum | 
|---|
| 81 | D BLD^DIALOG(34450.1,"","","DIR(""?"")") | 
|---|
| 82 | ; Enter a number from 100 to 100,000. | 
|---|
| 83 | ; We will find all messages with that many lines of text or less. | 
|---|
| 84 | S:$D(XMF("TLINE")) DIR("B")=XMF("TLINE") | 
|---|
| 85 | D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 86 | I X="@" K XMF("TLINE") Q | 
|---|
| 87 | I Y S XMF("TLINE")=Y | 
|---|
| 88 | Q | 
|---|
| 89 | LXOK(X) ; | 
|---|
| 90 | I X="@" Q 1 | 
|---|
| 91 | I X'?1N.N Q 0 | 
|---|
| 92 | I $G(XMF("FLINE")),X<XMF("FLINE") Q 0 | 
|---|
| 93 | I X<100 Q 0 | 
|---|
| 94 | I X>100000 Q 0 | 
|---|
| 95 | Q 1 | 
|---|
| 96 | Q ; Quit | 
|---|
| 97 | S XMABORT=1 | 
|---|
| 98 | Q | 
|---|
| 99 | R ; Response from | 
|---|
| 100 | D GETPERS(XMDUZ,.XMF,"RFROM",.XMFRFRN,34440.1,34441.1,.XMABORT) | 
|---|
| 101 | Q | 
|---|
| 102 | S ; Subject contains | 
|---|
| 103 | N DIR,Y,X | 
|---|
| 104 | S DIR(0)="FO^3:30" | 
|---|
| 105 | S DIR("A")=$$EZBLD^DIALOG(34438) ; Subject contains | 
|---|
| 106 | S:$D(XMF("SUBJ")) DIR("B")=XMF("SUBJ") | 
|---|
| 107 | D BLD^DIALOG(34438.1,"","","DIR(""?"")") | 
|---|
| 108 | ;Enter the string that the subject contains. | 
|---|
| 109 | ;It may be from 3 to 30 characters. | 
|---|
| 110 | ;The search is NOT case-sensitive. | 
|---|
| 111 | D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 112 | I X="@" K XMF("SUBJ") Q | 
|---|
| 113 | Q:Y="" | 
|---|
| 114 | S XMF("SUBJ")=Y | 
|---|
| 115 | Q | 
|---|
| 116 | T ; Message to | 
|---|
| 117 | D GETPERS(XMDUZ,.XMF,"TO",$G(XMF("TO")),34440.2,34441.2,.XMABORT) | 
|---|
| 118 | Q | 
|---|
| 119 | X ; Message contains | 
|---|
| 120 | N DIR,Y,X | 
|---|
| 121 | S DIR(0)="FO^3:30" | 
|---|
| 122 | S DIR("A")=$$EZBLD^DIALOG(34446.1) ; Message contains | 
|---|
| 123 | S:$D(XMF("TEXT")) DIR("B")=XMF("TEXT") | 
|---|
| 124 | D BLD^DIALOG(34446.4,"","","DIR(""?"")") | 
|---|
| 125 | ;Enter the string to search for.  It may be from 3 to 30 characters. | 
|---|
| 126 | ;Note that if the string you are searching for is not all on one line | 
|---|
| 127 | ;in the message, the search will not be able to find it. | 
|---|
| 128 | D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 129 | I X="@" K XMF("TEXT") Q | 
|---|
| 130 | Q:Y="" | 
|---|
| 131 | S XMF("TEXT")=Y | 
|---|
| 132 | K DIR,X,Y | 
|---|
| 133 | S DIR(0)="Y" | 
|---|
| 134 | S DIR("A")=$$EZBLD^DIALOG(34447) ; Should the search be case-sensitive | 
|---|
| 135 | S DIR("B")=$$EZBLD^DIALOG($S($G(XMF("TEXT","C"),1):39054,1:39053)) ; Yes/No | 
|---|
| 136 | D BLD^DIALOG(34447.1,"","","DIR(""?"")") | 
|---|
| 137 | ;Your answer determines whether case (upper/lower) matters in the search. | 
|---|
| 138 | ;It also affects the speed of the search. | 
|---|
| 139 | ;A case-sensitive search (one in which case matters) is faster. | 
|---|
| 140 | ;A case-insensitive search (one in which case does not matter) may find | 
|---|
| 141 | ;more matches, but will be slower. | 
|---|
| 142 | ;Answer YES for a faster search, when case matters. | 
|---|
| 143 | ;Answer NO for a slower search, when case does not matter. | 
|---|
| 144 | D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 145 | S XMF("TEXT","C")=Y | 
|---|
| 146 | K DIR,X,Y N I | 
|---|
| 147 | S DIR("A")=$$EZBLD^DIALOG(34448) ; Where should we search | 
|---|
| 148 | ; x.1:Message only / x.2:Message and Responses / x.3:Responses only | 
|---|
| 149 | S DIR(0)="" | 
|---|
| 150 | F I=1,2,3 S DIR(0)=DIR(0)_";"_I_":"_$$EZBLD^DIALOG(34448+(I/10)) | 
|---|
| 151 | S DIR(0)="S^"_$E(DIR(0),2,999) | 
|---|
| 152 | ; x.1:Message only / x.2:Message and Responses / x.3:Responses only | 
|---|
| 153 | S DIR("B")=$$EZBLD^DIALOG(34448+($G(XMF("TEXT","L"),1)/10)) | 
|---|
| 154 | D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 155 | S XMF("TEXT","L")=Y | 
|---|
| 156 | Q | 
|---|
| 157 | GETPERS(XMDUZ,XMF,XMWHICH,XMNAME,XMPROMPT,XMHELP,XMABORT) ; | 
|---|
| 158 | N DIR,Y,X,XMOK | 
|---|
| 159 | S DIR(0)="FO^1:30" | 
|---|
| 160 | S DIR("A")=$$EZBLD^DIALOG(XMPROMPT) ; Message from / Message to / Response from | 
|---|
| 161 | S DIR("?")="^D HGETPERS^XMJMF2" | 
|---|
| 162 | I $D(XMF(XMWHICH)) D | 
|---|
| 163 | . S DIR("B")=XMNAME | 
|---|
| 164 | . I XMNAME'["@" S DIR(0)="FrO^1:30" ; ('r' means no 'replace...with...' prompt) | 
|---|
| 165 | . Q:XMWHICH'="TO" | 
|---|
| 166 | . Q:"^G.^g.^"'[(U_$E(XMNAME,1,2)_U) | 
|---|
| 167 | . N XMPRIVAT | 
|---|
| 168 | . S XMPRIVAT=$$EZBLD^DIALOG(39135) ; " [Private Mail Group]" | 
|---|
| 169 | . I XMNAME[XMPRIVAT S DIR("B")=$P(XMNAME,XMPRIVAT) | 
|---|
| 170 | F  D  Q:XMABORT!XMOK | 
|---|
| 171 | . S XMOK=1 | 
|---|
| 172 | . D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 173 | . I X="@" K XMF(XMWHICH),XMNAME Q | 
|---|
| 174 | . I Y="" Q | 
|---|
| 175 | . I X["@" S (XMNAME,XMF(XMWHICH))=$$UP^XLFSTR(Y) Q | 
|---|
| 176 | . I XMWHICH="TO" D  Q | 
|---|
| 177 | . . N XMINSTR | 
|---|
| 178 | . . K XMNAME | 
|---|
| 179 | . . S XMINSTR("ADDR FLAGS")="X"  ; don't create ^TMP("XMY" globals | 
|---|
| 180 | . . D ADDR^XMXADDR(XMDUZ,X,.XMINSTR,"",.XMNAME) | 
|---|
| 181 | . . I '$D(XMNAME) S XMOK=0 Q | 
|---|
| 182 | . . S XMF(XMWHICH)=XMNAME | 
|---|
| 183 | . N DIC,X | 
|---|
| 184 | . S X=Y | 
|---|
| 185 | . S DIC="^VA(200,",DIC(0)="MNEQ" | 
|---|
| 186 | . D ^DIC I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q | 
|---|
| 187 | . I Y=-1 S XMOK=0 Q | 
|---|
| 188 | . S XMF(XMWHICH)=+Y | 
|---|
| 189 | . S XMNAME=$$NAME^XMXUTIL(+Y) | 
|---|
| 190 | Q | 
|---|
| 191 | HGETPERS ; | 
|---|
| 192 | N XMTEXT | 
|---|
| 193 | D BLD^DIALOG(XMHELP,"","","XMTEXT","F") | 
|---|
| 194 | ;Enter the name of the person who sent the message/response. | 
|---|
| 195 | ; - or - | 
|---|
| 196 | ;Enter the message addressee.  It may be a person, group, device, or server. | 
|---|
| 197 | I XMWHICH'="TO" D BLD^DIALOG(34441.3,"","","XMTEXT","F") | 
|---|
| 198 | ;If it's from a local VistA package/fake sender, just put '@' after | 
|---|
| 199 | ;the sender, like ACCOUNTS RECEIVABLE@ | 
|---|
| 200 | D BLD^DIALOG(34442,"","","XMTEXT","F") | 
|---|
| 201 | ;For remote users, enter name@, name@domain, or @domain. | 
|---|
| 202 | ;'Name' must be found somewhere in the user's name. | 
|---|
| 203 | ;'Domain' must be found somewhere in the user's domain. | 
|---|
| 204 | ;The more characters you provide, the narrower the search will be. | 
|---|
| 205 | ;MailMan may capitalize some names to facilitate filtering. | 
|---|
| 206 | D MSG^DIALOG("WH","",IOM,"","XMTEXT") | 
|---|
| 207 | Q | 
|---|