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/XUS1B.m@ 1608

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

initial load of WorldVistAEHR

File size: 2.0 KB
Line 
1XUS1B ;ISCSF/RWF - Auto sign-on ;07/19/2005 15:25
2 ;;8.0;;**59,337,395**;Feb 14, 1997;Build 4
3 Q
4 ;
5AUTOXUS() ;Do the check for XUS and Auto Sign-on
6 N %,Y
7 I $G(XQXFLG("ASO")) Q 0 ;Already tried once.
8 G AUTO
9 ;
10AUTOXWB() ;Do the check for XWB and Auto Sign-on
11 N %,Y
12 I $G(XQXFLG("ASO")) Q 0 ;Already tried so skip.
13AUTO ;Common code
14 I ($T(^XWBCAGNT)="")!($P(XOPT,U,18)="d") S XQXFLG("ZEBRA")=-1 Q 0 ;Disabled
15 S Y=$$CHKVIP^XUS1B(),%=0 I Y>0 S XQXFLG("ASO")=1,%=$$PREF($P(XOPT,U,18),$P($G(^VA(200,Y,200)),U,18))
16 I Y>0,'% S Y=0 ;No Auto signon
17 Q Y
18 ;
19CHKVIP() ;Check for a Valid current IP
20 N REF,XREF,IEN,R0,ENV,JOB,HNDL
21 S IEN=0,ENV=$$ENV,REF=$G(IO("IP")) I $L(REF) D GETHNDL(.HNDL)
22 I $L(REF) D LKUP("AS1",$P(REF,":")) Q:IEN>0 IEN
23 ;Only use IP address for lookup
24 ;S REF=$G(IO("CLNM")) Q:REF["@" 0
25 ;S REF=$P(REF,":") I REF]"" D LKUP2 Q:IEN IEN I REF["." D LKUP("AS2",$P(REF,".")) Q:IEN IEN
26 ;S REF=$$LOW^XLFSTR(REF) I REF]"" D LKUP2 Q:IEN IEN I REF["." D LKUP("AS2",$P(REF,".")) Q:IEN IEN
27 Q 0
28 ;
29LKUP2 ;See if we can find a workstation name
30 I $D(^XUSEC(0,"AS2",REF))>0 D LKUP("AS2",REF) Q:IEN
31 S XREF=$O(^XUSEC(0,"AS2",REF)) I XREF]"",$E(XREF,1,$L(REF))=REF D LKUP("AS2",XREF) Q:IEN
32 Q
33LKUP(XREF,LK) ;Check one X-ref
34 S IX=0
35 F S IX=$O(^XUSEC(0,XREF,LK,IX)) Q:'$L(IX) D CHK Q:IEN>0
36 Q
37CHK ;Could this be a good one.
38 N R0,R1,JOB
39 S R0=$G(^XUSEC(0,IX,0))
40 ;Check handle.
41 S R1=$P(R0,U,13) I R1]"",$D(HNDL(R1)) D Q:IEN>0
42 . L +^XWB("SESSION",IX_"~"_R1):0 I $T L -^XWB("SESSION",IX_"~"_R1) Q
43 . S IEN=+R0 Q ;Found a match
44 ;I $P(R0,U,5)'=$P(ENV,U,2) Q ;Make sure on the same VOL.
45 ;I $P(R0,U,10)'=$P(ENV,U,3) Q ;Check that on same NODE.
46 ;S JOB=$P(R0,U,3) I $D(^$JOB(JOB)),IX=+$G(^XUTL("XQ",JOB,0)) S IEN=+R0 Q ;Found a match
47 Q
48 ;
49ENV() N Y D GETENV^%ZOSV Q Y
50PREF(%1,%2) ;
51 Q $S(%2]"":%2,1:%1)
52GETHNDL(RET) ;Get the Handles from the Client
53 N %,%1,X,XXX
54 ;I '$D(XWBUSRNM) Q ;JLI
55 S %=$$CMD^XWBCAGNT(.XXX,"XWB GET HANDLES") Q:'%
56 Q:'$O(XXX(0))
57 ;build array
58 S RET=0,%1=1 F %=1:1:$L(XXX(%1),"^") S X=$P(XXX(%1),"^",%) S:X]"" RET(X)="",RET=RET+1
59 Q
Note: See TracBrowser for help on using the repository browser.