source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUS1A.m@ 1211

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1XUS1A ;SF-ISC/STAFF - SIGNON overflow from XUS1 ;01/28/2004 08:09
2 ;;8.0;KERNEL;**153,149,183,258,265**;Jul 10, 1995
3 Q
4USER() ;
5 N %B,%E,%T,I1,X1,X2
6 S XUTEXT=0,DUZ(2)=$G(DUZ(2),0)
7 F I=0:0 S I=$O(^XTV(8989.3,1,"POST",I)) Q:I'>0 D SET("!"_$G(^(I,0)))
8 D SET("!"),XOPT
9 S %H=$P($H,",",2)
10 D SET("!Good "_$S(%H<43200:"morning ",%H<61200:"afternoon ",1:"evening ")_$S($P(XUSER(1),U,4)]"":$P(XUSER(1),U,4),1:$P(XUSER(0),U,1)))
11 S I1=$G(^VA(200,DUZ,1.1)),X=(+I1_"0000")
12 I X D SET("! You last signed on "_$S(X\1=DT:"today",X\1+1=DT:"yesterday",1:$$FMTE^XLFDT(X,"1D"))_" at "_$E(X,9,10)_":"_$E(X,11,12))
13 I $P(I1,"^",2) S I=$P(I1,"^",2) D SET("!There "_$S(I>1:"were ",1:"was ")_I_" unsuccessful attempt"_$S(I>1:"s",1:"")_" since you last signed on.")
14 I $P(XUSER(0),U,12),$$PH(%H,$P(XUSER(0),U,12)) Q 17 ;Time frame
15 I +$P(XOPT,U,15) S %=$P(XOPT,U,15)-($H-XUSER(1)) I %<6,%>0 D SET("! Your Verify code will expire in "_%_" days")
16 ;Report new Mail
17 N XUXM S %=$$NU^XMGAPI4(1,1,"XUXM") I $G(XUXM) F %=0:0 S %=$O(XUXM(%)) Q:%'>0 D SET("!"_XUXM(%))
18 S:$P(XOPT,"^",5) XUTT=1 S DTIME=$P(XOPT,U,10)
19 ;Check Multiple Sign-on allowed, X1 signed on flag, X2 0=No,1=Yes,2=1IP
20 S X1=$P($G(^VA(200,DUZ,1.1)),U,3),X2=$P(XOPT,U,4)
21 I 'X2,X1 Q 9 ;Multi Sign-on not allowed
22 I X2=2 D Q:%B>0 %B ;Only from one IP
23 . S %B=0 I '$D(IO("IP")) S:X1 %B=9 Q ;Can't tell IP,
24 . S X1=$$COUNT(DUZ,IO("IP")),%B=$S(X1<0:9,(X1+1)>$P(XOPT,U,19):9,1:0)
25USX S $P(^VA(200,DUZ,1.1),U,3)=1
26 ;Call XQOR to handle SIGN-ON protocall.
27 N XUSER,XUSQUIT ;Protect ourself.
28 S DIC="^DIC(19,",X="XU USER SIGN-ON",XUSQUIT=0
29 D EN^XQOR
30 K X,DIC
31 Q XUSQUIT ;If protocol set XUSQUIT will stop sign-on.
32 ;
33SET(V) ;Set into XUTEXT(XUTEXT), Called from XU USER SIGN-ON protocol.
34 S XUTEXT=$G(XUTEXT)+1,XUTEXT(XUTEXT)=V
35 Q
36 ;
37DUZ ;setup duz, also see XUS5
38 ;Called from XUSRB, XUESSO1
39 S:'$D(XUSER(0)) XUSER(0)=^VA(200,DUZ,0) D:$D(XOPT)[0 XOPT
40 S DUZ(0)=$P(XUSER(0),U,4),DUZ(1)="",DUZ("AUTO")=$P(XOPT,"^",6)
41 S DUZ(2)=$S($G(DUZ(2))>0:DUZ(2),1:+$P(XOPT,U,17))
42 S X=$P($G(^DIC(4,DUZ(2),99)),U,5),DUZ("AG")=$S(X]"":X,1:$P(^XTV(8989.3,1,0),U,8))
43 S DUZ("BUF")=($P(XOPT,U,9)="Y"),DUZ("LANG")=$P(XOPT,U,7)
44 Q
45XOPT ;Build the XOPT string
46 N X,I
47 S:'$D(XOPT) XOPT=$G(^XTV(8989.3,1,"XUS"))
48 S X=$G(^VA(200,DUZ,200))
49 F I=4:1:7,9,10,19 I $P(X,U,I)]"" S $P(XOPT,"^",I)=$P(X,U,I)
50 Q
51 ;
52COUNT(IEN,IP) ;Count sign-on log active connect from this IP
53 N CNT,IX
54 S CNT="",IX=0
55 I '$D(^XUSEC(0,"AS3",IEN)) Q 0 ;First sign-on
56 I $O(^XUSEC(0,"AS3",IEN,""))'=IP Q -1 ;Diff IP
57 I $O(^XUSEC(0,"AS3",IEN,""),-1)'=IP Q -1 ;Diff IP
58 F S IX=$O(^XUSEC(0,"AS3",IEN,IP,IX)) Q:'IX S CNT=CNT+1
59 Q CNT ;Return Count
60 ;
61INTRO(WNM) ;
62 Q:'$D(^XTV(8989.3,1,"INTRO",0))
63 F I=0:0 S I=$O(^XTV(8989.3,1,"INTRO",I)) Q:I'>0 S X=^(I,0) D
64 . I $D(WNM) S @WNM@(I)=X
65 . I '$D(WNM) W X,!
66 . Q
67 Q
68 ;
69DD(Y) Q $$FMTE^XLFDT(X,"1D")
70 ;
71PH(%T,%R) ;Check Prohibited time for R/S
72 N MSG S MSG=$$PROHIBIT(%T,%R)
73 I MSG S XUM(0)=$P(MSG,U,2) Q 1
74 D SET("!"),SET("! "_$$EZBLD^DIALOG(30810.62)_" "_$P(MSG,U,2))
75 Q 0
76 ;
77PROHIBIT(%T,%R) ;See if a prohibited time, (Time from $H, restrict range)
78 N XMSG,%B,%E
79 S %T=%T\60#60+(%T\3600*100),%B=$P(%R,"-",1),%E=$P(%R,"-",2)
80 S XMSG=$P($$FMTE^XLFDT(DT_"."_%B,"2P")," ",2,3)_" "_$$EZBLD^DIALOG(30810.61)_" "_$P($$FMTE^XLFDT(DT_"."_%E,"2P")," ",2,3)
81 I $S(%E'<%B:%T'>%E&(%T'<%B),1:%T>%B!(%T<%E)) Q "1^"_XMSG ;No
82 Q "0^"_XMSG
Note: See TracBrowser for help on using the repository browser.