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/XUS.m@ 1009

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

revised back to 6/30/08 version

File size: 6.4 KB
Line 
1XUS ;SFISC/STAFF - SIGNON ;3/19/07 09:15
2 ;;8.0;KERNEL;**16,26,49,59,149,180,265,337,419,437**;Jul 10, 1995;Build 22
3 ; Modified from FOIA VISTA,
4 ; Copyright (C) 2007 WorldVistA
5 ;
6 ; This program is free software; you can redistribute it and/or modify
7 ; it under the terms of the GNU General Public License as published by
8 ; the Free Software Foundation; either version 2 of the License, or
9 ; (at your option) any later version.
10 ;
11 ; This program is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
15 ;
16 ; You should have received a copy of the GNU General Public License
17 ; along with this program; if not, write to the Free Software
18 ; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 ;Sign-on message numbers are 30810.51 to 30810.99
20 S U="^" D INTRO^XUS1A()
21 K K ^XUTL("ZISPARAM",$I)
22 S U="^",XQXFLG("GUI")="^"
23 W ! S $Y=0 D SET1(1) I POP S XUM=3 G NO ;Sets DUZ("LANG")
24 S XUSTMP(51)=$$EZBLD^DIALOG(30810.51),XUSTMP(52)=$$EZBLD^DIALOG(30810.52)
25 W !!,"Volume set: ",$P(XUENV,U,4)," UCI: ",XUCI," Device: ",$I W:$S('$D(IO("ZIO")):0,1:$I'=IO("ZIO")) " (",IO("ZIO"),")" W !
26RESTART ;
27 S XUM=$$SET2 G:XUM NO
28 I $P(XU1,U,2)]"" S XUM=$$DEVPAS() I XUM G H:XUM<0,NO
29 ;S PGM=$P(XOPT,U,8),XUA=$P(PGM,"[",1) I XUA]"" X XUEON G NEXT^XUS1
30A S (XUSER(0),XUSER(1),XQUR)=""
31 ;Check for locked IP/device.
32 I $$LKCHECK^XUSTZIP() S XUM=7,XUFAC=$P(XOPT,U,2),XUHALT=1 G NO
33 ;Auto Sign-on check
34 S X=$$AUTOXUS^XUS1B() I X>0 S DUZ=X D USER(DUZ) W !!,">> Auto Sign-on: ",$P(XUSER(0),U)," <<<",! G B
35 X XUEOFF S AV=$$ASKAV() X XUEON I AV="^;^" G H ;Get out
36 I AV["MAIL-BOX",AV[";XMR" S (XUA,PGM)="XMR",XMCHAN=$P($P(AV,";")," ",2),DUZ=.5 G XMR^XUSCLEAN
37 S XQUR=$P(AV,";",3)
38 S DUZ=$$CHECKAV(AV) K AV
39 S XUM=$$UVALID() G:XUM NO
40B K XUF,%1 S XUF=0 X XUEON
41 I DUZ D USER^XUS1 G:XUM NO
42 I DUZ D SEC^XUS3:($D(^%ZIS(1,XUDEV,"TIME"))!$D(^(95))) G:XUM NO
43 G NO:'DUZ
44 S DTIME=$P(XOPT,U,10),X=$S(DUZ("BUF"):"",1:"NO-")_"TYPE-AHEAD" X:$D(^%ZOSF(X)) ^(X)
45 D TT^XUS3:$G(XUTT)
46 D CLRFAC^XUS3($G(IO("IP")))
47PGM ;
48 S Y=+$G(^%ZIS(1,XUDEV,201)) I Y>0,$$CHK S XQY=Y G OK
49 S Y=+$G(^VA(200,DUZ,201)) I Y>0,$$CHK S XQY=Y G OK
50 I $D(DUZ("ASH")) S Y=$O(^DIC(19,"B","XU NOP MENU",0)) I Y>0 S XQY=Y G OK ;rwf 403
51 S XUM=16
52 G NO
53 ;
54OK D CHEK^XQ83
55 S (XUA,PGM)="XQ"
56 G NEXT^XUS1
57 ;
58CHK() ;Check that option exeist and LOCK
59 I $D(^DIC(19,Y,0)),$S($P(^(0),U,6)="":1,1:$D(^XUSEC($P(^(0),U,6),DUZ))) Q 1
60 Q 0
61 ;
62LC S X=$$UP(X)
63 Q
64UP(%) Q $TR(%,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
65 ;
66FAC ;Failed access
67 S:'DUZ XUF(.1)=$E(%1)
68 S:XUF=2 XUF(.2)=XUF(.2)+1,XUF(XUF(.2))=%1 S %1="" Q
69 Q
70NO ;Tell why didn't get on
71 S X=$$NO^XUS3() G RESTART:'X ;fall into exit
72H ;Exit point for all applications
73C ;CLOSE
74 G ^XUSCLEAN
75 ;
76ON X ^%ZOSF("EON") Q
77 ;
78ASKAV(PRE) ;Ask and return Access;Verify code, Turn off echo before calling
79 N X,Y S PRE=$G(PRE)
80 F W !,PRE,XUSTMP(51) S X=$$ACCEPT S:X="^" X="^;^" Q:$L(X)
81 S X=$TR(X,$C(9),";") ;Convert TAB to ; to match GUI.
82 I $P(X," ")="MAIL-BOX" S X=X_";XMR"
83 I $E(X,1,7)="~~TOK~~" Q X ;Use CCOW token
84 I '$L($P(X,";",2)) W !,PRE,XUSTMP(52) S Y=$$ACCEPT S:Y="^" X="^;" S $P(X,";",2)=Y
85 Q X
86 ;
87 ;Timeout used by XUSTZ call.
88ACCEPT(TO) ;Read A/V and echo '*' char.
89 ;Have the Read write to flush the buffer on some systems
90 N C,A,E K DUOUT S A="",TO=$G(TO,60),E=0
91 F D Q:E
92 . R "",*C:TO S:('$T) DUOUT=1 S:('$T)!(C=94) A="^"
93 . I (A="^")!(C=13)!($L(A)>60) S E=1 Q
94 . I C=127 Q:'$L(A) S A=$E(A,1,$L(A)-1) W $C(8,32,8) Q
95 . S A=A_$C(C) W *42
96 . Q
97 Q A
98 ;
99CHECKAV(X1) ;Check A/V code return DUZ or Zero. (Called from XUSRB)
100 N %,%1,X,Y,IEN,DA,DIK
101 S IEN=0
102 ;Start CCOW
103 I $E(X1,1,7)="~~TOK~~" D Q:IEN>0 IEN
104 . I $E(X1,8,9)="~1" S IEN=$$CHKASH^XUSRB4($E(X1,8,255))
105 . I $E(X1,8,9)="~2" S IEN=$$CHKCCOW^XUSRB4($E(X1,8,255))
106 . Q
107 ;End CCOW
108 S X1=$S($$GET^XPAR("SYS","XU VC CASE SENSITIVE"):$$UP($P(X1,";",1))_";"_$P(X1,";",2),1:$$UP(X1)) S:X1[":" XUTT=1,X1=$TR(X1,":") ; Allow case sensitive for VOE
109 S X=$P(X1,";") Q:X="^" -1 S:XUF %1="Access: "_X
110 Q:X'?1.20ANP 0
111 S X=$$EN^XUSHSH(X) I '$D(^VA(200,"A",X)) D LBAV Q 0 ; Case insensitive for Access Code for VOE
112 S %1="",IEN=$O(^VA(200,"A",X,0)),XUF(.3)=IEN D USER(IEN)
113 S X=$P(X1,";",2) S:XUF %1="Verify: "_X S X=$$EN^XUSHSH(X)
114 I $P(XUSER(1),"^",2)'=X D LBAV Q 0
115 I $G(XUFAC(1)) S DIK="^XUSEC(4,",DA=XUFAC(1) D ^DIK
116 Q IEN
117LBAV ;Log Bad AV
118 D:XUF FAC
119 I IEN S X=$P($G(^VA(200,IEN,1.1)),U,2)+1,$P(^(1.1),"^",2)=X
120 Q
121 ;
122USER(IX) ;Build XUSER
123 S XUSER(0)=$G(^VA(200,+IX,0)),XUSER(1)=$G(^(.1)),XUSER(1.1)=$G(^(1.1))
124 Q
125 ;
126XUVOL ;Setup XUENV, XUCI,XQVOL,XUVOL
127 S U="^" D GETENV^%ZOSV S XUENV=Y,XUCI=$P(Y,U,1),XQVOL=$P(Y,U,2)
128 S X=$O(^XTV(8989.3,1,4,"B",XQVOL,0)),XUVOL=$S(X>0:^XTV(8989.3,1,4,X,0),1:XQVOL_"^y^1")
129 Q
130 ;
131XOPT ;Setup initial XOPT
132 S XOPT=$S($D(^XTV(8989.3,1,"XUS")):^("XUS"),1:"")
133 F I=2:1:15 I $P(XOPT,U,I)="" S $P(XOPT,U,I)=$P("^5^900^1^1^^^^1^300^^^^N^90",U,I)
134 Q
135 ;
136SET1(FLAG) ;Setup parameters (also called from XUSRB)
137 N %
138 S U="^",XUEON=^%ZOSF("EON"),XUEOFF=^("EOFF")
139 D XUVOL,XOPT S DUZ("LANG")=$P(XOPT,U,7) S:$P(XUVOL,U,6)="y" XRTL=XUCI_","_XQVOL
140 K ^XUTL("XQ",$J) S XUF=0,XUDEV=0,DUZ=0,DUZ(0)="@",IOS=0,ION=""
141 I FLAG S %ZIS="L",IOP="HOME" D ^%ZIS Q:POP
142 S XUDEV=IOS,XUIOP=ION D:$D(XRTL) T0^%ZOSV
143 D GETFAC^XUS3($G(IO("IP")))
144 S %=$P(XOPT,U,14)
145 I "N"'[% D
146 . S XUF=(%["R")+1,XUF(.1)="",XUF(.2)=0,XUF(.3)=0
147 . I %["D" S:$D(^XTV(8989.3,1,4.33,"B",XUDEV))[0 XUF=0
148 Q
149SET2() ;EF. Return error code (also called from XUSRB)
150 N %,X
151 S XUNOW=$$HTFM^XLFDT($H),DT=$P(XUNOW,".")
152 K DUZ,XUSER
153 S (DUZ,DUZ(2))=0,(DUZ(0),DUZ("AG"),XUSER(0),XUSER(1),XUTT,%UCI)=""
154 S %=$$INHIBIT^XUSRB() I %>0 Q %
155 S X=$G(^%ZIS(1,XUDEV,"XUS")),XU1=$G(^(1))
156 I $L(X) F I=1:1:15 I $L($P(X,U,I)) S $P(XOPT,U,I)=$P(X,U,I)
157 S DTIME=600
158 I '$P(XOPT,U,11),$D(^%ZIS(1,XUDEV,90)),^(90)>2800000,^(90)'>DT Q 8
159 I $D(XRT0) S XRTN="XUS" D T1^%ZOSV
160 Q 0
161 ;
162UVALID() ;EF. Is it valid for this user to sign on?
163 I DUZ'>0 Q 4
164 I $P(XUSER(1.1),U,5),$P(XUSER(1.1),U,5)>XUNOW S XUM(0)=$$FMTE^XLFDT($P(XUSER(1.1),U,5),"2PM") Q 18 ;User locked until
165 I $P(XUSER(0),U,11),$P(XUSER(0),U,11)'>DT Q 11 ;Access Terminated
166 I $P(XUSER(0),U,7) Q 5 ;Disuser flag set
167 I '$L($P(XUSER(1),U,2)) Q 21 ;419
168 Q 0
169 ;
170DEVPAS() ;EF. Ask device password
171 X XUEOFF W !,"DEVICE PASSWORD: " R X:60 X XUEON
172 S X=$E(X,1,30) S:'$T X="^" D LC Q:X["^" -1 I $P(XU1,U,2)'=X S:XUF %1="Device: "_X D:XUF FAC Q 6
173 Q 0
174 ;
Note: See TracBrowser for help on using the repository browser.