source: WorldVistAEHR/trunk/r/MAILMAN-XM/XMXLIST.m@ 1578

Last change on this file since 1578 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 8.5 KB
RevLine 
[613]1XMXLIST ;ISC-SF/GMB-List message: multiple conditions ;03/01/2001 09:40
2 ;;8.0;MailMan;;Jun 28, 2002
3LISTMSGS(XMDUZ,XMK,XMFLDS,XMFLAGS,XMAMT,XMSTART,XMF,XMTROOT) ;
4 ; XMDUZ is the user doing the search
5 ; XMK is the place to look
6 ; =number - Look in this basket of the mailbox of XMDUZ
7 ; =* - Look in all baskets of the mailbox of XMDUZ
8 ; =! - Look in the MESSAGE file for all messages
9 ; that XMDUZ sent or received. If XMFLAGS["U"
10 ; and the user (DUZ) holds the XM SUPER SEARCH
11 ; key, ALL messages are examined,
12 ; regardless of ownership.
13 ; XMFLDS is a list, separated by ';', of fields to retrieve.
14 ; e.g. XMFLDS="SUBJ;DATE" means retrieve subject and date.
15 ; "BSKT" = basket (default: <basket ien>^<basket name>)
16 ; optionally followed by ":" and
17 ; "I" for basket IEN only (no 2nd piece)
18 ; "X" adds basket name xref
19 ; (If XMK="!", and msg is not in user's mailbox, will be:
20 ; "0^* N/A *")
21 ; "DATE" = date sent (default: <internal date>^<dd mmm yy hh:mm>)
22 ; optionally followed by ":" and
23 ; "I" for internal date only (no 2nd piece)
24 ; "F" for FileMan date as the 2nd piece
25 ; "X" adds FileMan date xref
26 ; "FROM" = message from (default: <internal from>^<external from>)
27 ; optionally followed by ":" and
28 ; "I" for internal from only (no 2nd piece)
29 ; "X" adds external from xref
30 ; "LINE" = number of lines in the message
31 ; "NEW" = is the msg new? (0=no; 1=yes; 2=yes, and priority, too)
32 ; "PRI" = is the message priority? (0=no; 1=yes)
33 ; "READ" = how much of the message has the user read?
34 ; null = has not read the message at all
35 ; 0 = has read the message, but no responses
36 ; number = has read through this response
37 ; "RESP" = how many responses does the message have?
38 ; 0 = none
39 ; number = this many
40 ; "SEQN" = sequence number in basket (If XMK="!", and msg is not
41 ; in user's mailbox, will not be returned at all.)
42 ; "SUBJ" = message subject (always external)
43 ; optionally followed by ":" and
44 ; "X" adds subject xref
45 ; XMFLAGS are used to control processing
46 ; =B Backwards order (Default is traverse forward)
47 ; =U Ignore the file screen on file 3.9 so that all
48 ; messages can be examined. (valid only if user holds
49 ; XM SUPER SEARCH key and XMK="!")
50 ; If XMK="!", the following flags are ignored:
51 ; =C Use basket C-xref (Default is message IEN)
52 ; =N New messages only (C flag ignored)
53 ; =P New Priority messages only (C, N flags ignored)
54 ; XMAMT How many?
55 ; =number - Get this many
56 ; =* - Get all (default)
57 ; XMSTART is used to start the lister going. The lister will keep it
58 ; updated from call to call. (If XMK="!", FileMan handles XMSTART,
59 ; and you should look at FM documentation for an explanation.)
60 ; XMSTART("XMK") Start with this basket IEN (valid only if XMK="*")
61 ; Continues from there, with each successive call,
62 ; to the end.
63 ; (Default is to start with basket .5, the WASTE basket)
64 ; XMSTART("XMZ") Start AFTER this message IEN (valid only if no C flag)
65 ; Continues from there, with each successive call,
66 ; to the end.
67 ; (Default is to start at the beginning (or end) of the
68 ; basket)
69 ; XMSTART("XMKZ") Start AFTER this message C-xref (valid only if C flag)
70 ; Continues from there, with each successive call,
71 ; to the end.
72 ; (Default is to start at the beginning (or end) of the
73 ; basket)
74 ; XMF contains conditions which are 'and'ed together to select only
75 ; those messages which meet the conditions.
76 ; XMF("FROM") Message is from this person
77 ; XMF("FDATE") Message was sent on or after this date
78 ; (If XMK="!", make sure this doesn't conflict w/XMF("PD"))
79 ; XMF("FLINE") Message has this many or more lines
80 ; XMF("PD") Message was sent in this period (FM equiv. of yyy/yyymm)
81 ; (default is current month) (valid only if XMK="!")
82 ; XMF("RFROM") Message has a response from this person
83 ; XMF("SUBJ") Subject contains this string
84 ; XMF("SUBJ","C") =0 - Search is not case-sensitive (default)
85 ; =1 - Search is case-sensitive
86 ; XMF("TDATE") Message was sent on or before this date
87 ; (If XMK="!", make sure this doesn't conflict w/XMF("PD"))
88 ; XMF("TEXT") Message contains this string
89 ; XMF("TEXT","L") =1 - Look in message only (default)
90 ; =2 - Look in both message and responses
91 ; =3 - Look in responses only
92 ; XMF("TEXT","C") =0 - Search is not case-sensitive (default)
93 ; =1 - Search is case-sensitive
94 ; XMF("TLINE") Message has this many or fewer lines
95 ; XMF("TO") Message is to this person
96 ; XMTROOT is the target root to receive the message list.
97 ; (default is ^TMP("XMLIST",$J))
98 ;
99 ; Variables set and used by the routine:
100 ; XMF("SUBJ","S") Look for this string in the subject
101 ; XMF("TEXT","S") Look for this string in the message
102 ; XMF("PD","S") Look for messages created during this period
103 N XMORDER
104 I XMDUZ'=DUZ,'$$RPRIV^XMXSEC Q
105 D INIT(.XMFLDS,.XMFLAGS,.XMAMT,.XMORDER,.XMF,.XMTROOT)
106 I XMK="!" D ALLMSGS(XMDUZ,$G(XMFLAGS),XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
107 I XMK="*" D Q
108 . I XMFLAGS["P" D NEWA^XMXLIST1(XMDUZ,"N",XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
109 . I XMFLAGS["N" D NEWA^XMXLIST1(XMDUZ,"N0",XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
110 . I XMFLAGS["C" D REGAC^XMXLIST1(XMDUZ,XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
111 . D REGAZ^XMXLIST1(XMDUZ,XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT)
112 N XMKN
113 S XMKN=$P(^XMB(3.7,XMDUZ,2,XMK,0),U,1)
114 I XMFLAGS["P" D NEW1^XMXLIST2(XMDUZ,XMK,XMKN,"N",XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
115 I XMFLAGS["N" D NEW1^XMXLIST2(XMDUZ,XMK,XMKN,"N0",XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
116 I XMFLAGS["C" D REG1C^XMXLIST2(XMDUZ,XMK,XMKN,XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT) Q
117 D REG1Z^XMXLIST2(XMDUZ,XMK,XMKN,XMORDER,.XMFLDS,XMAMT,.XMSTART,.XMF,XMTROOT)
118 Q
119INIT(XMFLDS,XMFLAGS,XMAMT,XMORDER,XMF,XMTROOT) ;
120 I $D(XMFLDS),XMFLDS="" K XMFLDS
121 I $D(XMTROOT),XMTROOT'="" D
122 . K @$$CREF^DILF(XMTROOT)
123 . S XMTROOT=$$OREF^DILF(XMTROOT)_"""XMLIST"","
124 E D
125 . K ^TMP("XMLIST",$J)
126 . S XMTROOT="^TMP(""XMLIST"",$J,"
127 I $D(XMF) D
128 . I $D(XMF)'>9 K XMF Q
129 . S:$D(XMF("SUBJ")) XMF("SUBJ","S")=$S('$G(XMF("SUBJ","C")):$$UP^XLFSTR(XMF("SUBJ")),1:XMF("SUBJ"))
130 . I $D(XMF("TEXT")) D
131 . . S XMF("TEXT","S")=$S('$G(XMF("TEXT","C")):$$UP^XLFSTR(XMF("TEXT")),1:XMF("TEXT"))
132 . . I '$D(XMF("TEXT","L")) S XMF("TEXT","L")=1
133 . I $D(XMF("PD")) S XMF("PD","S")=$S($E(XMF("PD"),4,5)="00":$E(XMF("PD"),1,3),1:$E(XMF("PD"),1,5))
134 . I $D(XMF("FROM")) S XMF("FROM")=$$UP^XLFSTR(XMF("FROM"))
135 . I $D(XMF("RFROM")) S XMF("RFROM")=$$UP^XLFSTR(XMF("RFROM"))
136 . I $D(XMF("TO")),XMF("TO")["@" S XMF("TO")=$$UP^XLFSTR(XMF("TO"))
137 S XMFLAGS=$G(XMFLAGS)
138 S XMORDER=$S(XMFLAGS["B":-1,1:1)
139 I $G(XMAMT)="" S XMAMT="*"
140 Q
141ALLMSGS(XMDUZ,XMFLAGS,XMORDER,XMFLDS,XMAMT,XMSTART,XMF,XMTROOT) ; Look in the entire MESSAGE file.
142 N XMSCREEN,XMK,XMKN,XMZ,I,XMNA,XMCNT
143 I XMFLAGS["U",'$$SSPRIV^XMXSEC1 Q
144 S XMFLAGS=$TR(XMFLAGS,"CNP")
145 I XMFLAGS["U" D AUDIT^XMJMFC(.XMF) Q:$D(XMERR)
146 S XMSCREEN=$$SCREEN^XMJMFC(XMDUZ)
147 ; File screen ^DD(3.9,0,"SCR") insists that user be author or recipient.
148 ; If FLAGS["U", then file screen is ignored.
149 D LIST^DIC(3.9,"","@",XMFLAGS,XMAMT,.XMSTART,$G(XMF("PD","S"),$E(DT,1,5)),"C",XMSCREEN)
150 S I="",XMCNT=0,XMNA=$$EZBLD^DIALOG(34014) ; * N/A *
151 F S I=$O(^TMP("DILIST",$J,2,I),XMORDER) Q:I'>0 D
152 . S XMZ=^TMP("DILIST",$J,2,I)
153 . S XMCNT=XMCNT+1
154 . S @(XMTROOT_XMCNT_")")=XMZ
155 . Q:'$D(XMFLDS)
156 . I $S(XMFLDS["BSKT":1,XMFLDS["NEW":1,XMFLDS["SEQN":1,1:0) D
157 . . S XMK=+$O(^XMB(3.7,"M",XMZ,XMDUZ,0))
158 . . S XMKN=$S(XMK:$P(^XMB(3.7,XMDUZ,2,XMK,0),U),1:XMNA)
159 . . Q:'XMK
160 . . I '$D(^XMB(3.7,XMDUZ,2,XMK,1,XMZ,0)) D ADDITM^XMUT4A(XMDUZ,XMK,XMZ)
161 . . I XMFLDS["SEQN" D KSEQN^XMXLIST1(XMDUZ,XMK,XMZ,.XMFLDS,XMTROOT,XMCNT)
162 . D FIELDS^XMXLIST1(XMDUZ,.XMK,.XMKN,XMZ,.XMFLDS,XMTROOT,XMCNT)
163 S @(XMTROOT_"0)")=$G(^TMP("DILIST",$J,0)) ; # found^# requested^more?
164 K ^TMP("DILIST",$J)
165 Q
Note: See TracBrowser for help on using the repository browser.