source: WorldVistAEHR/trunk/r/MAILMAN-XM/XMGAPI0.m@ 949

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

initial load of WorldVistAEHR

File size: 1.4 KB
Line 
1XMGAPI0 ;(WASH ISC)/CAP-Validate/Get Subject APIs ;04/17/2002 08:56
2 ;;8.0;MailMan;;Jun 28, 2002
3 ; Entry points (DBIA 1142):
4 ; $$SUBCHK - Validate a proposed message subject
5 ; $$SUBGET - Retrieve the subject of a message
6ENT(Y,Z) ;Check Input Subject
7 ;Param1=String
8 ;Param2=Silent Flag
9 N A S A=""
10 I $L(Y)>65 S A=1,%="Entered SUBJECT too long, "_$L($E(Y,66,999))_" characters longer than 65." S Y=$E(Y,1,250) G S:Z Q "3-"_%_U_$E(Y,1,65)
11 ;
12 I Y[U S Y=$$ENCODEUP^XMCU1(Y)
13 ;
14 ;REMOVE LEADING BLANKS
15B I Y?1" ".E S Y=$E(Y,2,99) G B
16 ;
17 ;REMOVE TRAILING BLANKS
18E I $E(Y,$L(Y))=" " S Y=$E(Y,1,$L(Y)-1) G E
19 ;
20 G U:Y'?.E1C.E I 'Z Q "5-Subject cannot contain control characters.^"_Y
21 F X=1:1 I $E(Y,X)?1C S Y=$E(Y,1,X-1)_$E(Y,X+1,99) Q:Y'?.E1C.E S X=X-1
22 W $C(7),!,"Control characters removed ("""_Y_""" is Subject accepted).",!
23 ;
24U I Y="" Q ""
25 I Y="?" S A=1,%="Enter a Message Subject, between 3 & 65 characters long or '^' to exit." G S:Z Q "4-"_%_U_Y
26 I $L(Y)<3 S A=1,%="SUBJECT must be at least 3 characters long." G S:Z Q "1-"_%_U_Y
27 I Y?1"R"2N.N S A=1,%="Subject names of this format (1""R""1.N) are RESERVED" G S:Z Q "2-"_%_U_Y
28Q Q A_U_Y
29S W !,$C(7),%,!
30 G Q
31SUBGET(X) ;Return Subject of a Message (""=Error, Else returns Subject)
32 S X=$P($G(^XMB(3.9,X,0)),U) I X="" Q ""
33 Q $$DECODEUP^XMCU1(X)
34SUBCHK(X,Z) ;Check Subject (""=Error, Else returns Subject)
35 ;Param1=String
36 ;Param2=Silent Flag (0=Silent, 1=Verbose)
37 N Y S Y=X
38 Q $$ENT(X,Z)
Note: See TracBrowser for help on using the repository browser.