source: EWD/ewdapps/tutorial/r/KBANDemo.m@ 1320

Last change on this file since 1320 was 1284, checked in by Sam Habiel, 13 years ago

Added Sign-On Project, Bed Board, Tutorial, and Roll-and-Scroll emulator

File size: 1.9 KB
Line 
1KBANDemo ; Test to demo EWD
2 ;;
3login(sessid)
4 n error s error=""
5 n un,pw
6 s un=$$getTextValue^%zewdAPI("username",sessid)
7 s pw=$$getPasswordValue^%zewdAPI("password",sessid)
8 s %ZIS="0H",IOP="NULL"
9 d ^%ZIS
10 i POP s error="Programming error" d ^%ZTER g EXIT
11 d SETUP^XUSRB() ; Set-up for GUI signon
12 n RETURN
13 D VALIDAV^XUSRB(.RETURN,$$ENCRYP^XUSRB1(un_";"_pw))
14 n DUZ s DUZ=RETURN(0)
15 i DUZ'>0 s error="No a valid login"
16 i error="" d ; everything is okay; save symtab crap
17 . d mergeArrayToSession^%zewdAPI(.DUZ,"DUZ",sessid)
18 . d mergeArrayToSession^%zewdAPI(.IO,"IO",sessid)
19 . d setSessionValue^%zewdAPI("U","^",sessid)
20 q error
21EXIT D:$G(DUZ) LOGOUT^XUSRB
22 Q error
23getUsernames(sessid)
24 d clearList^%zewdAPI("user",sessid)
25 n sam
26 d LIST^DIC(200,"","@;.01","PKU","*","","","","","","sam")
27 n i s i=0
28 f s i=$o(sam("DILIST",i)) q:i="" d
29 . n entry s entry=sam("DILIST",i,0)
30 . d appendToList^%zewdAPI("user",$p(entry,U,2),$p(entry,U),sessid)
31 quit ""
32getInfo(sessid)
33 n DUZ s DUZ=$$getSessionValue^%zewdAPI("user",sessid)
34 n Name s Name=$$GET1^DIQ(200,DUZ,.01)
35 n officePhone s officePhone=$$GET1^DIQ(200,DUZ,"OFFICE PHONE")
36 d setSessionValue^%zewdAPI("Name",Name,sessid)
37 d setSessionValue^%zewdAPI("officePhone",officePhone,sessid)
38 quit ""
39savePhones(sessid)
40 quit ""
41CVC(sessid)
42 ; get stored session values for DUZ, IO, and U
43 d FillSymTab(sessid)
44 n VC1,VC2,VC3
45 s VC1=$$getPasswordValue^%zewdAPI("vc1",sessid)
46 s VC2=$$getPasswordValue^%zewdAPI("vc2",sessid)
47 s VC3=$$getPasswordValue^%zewdAPI("vc3",sessid)
48 n eVC1,eVC2,eVC3
49 s eVC1=$$ENCRYP^XUSRB1(VC1)
50 s eVC2=$$ENCRYP^XUSRB1(VC2)
51 s eVC3=$$ENCRYP^XUSRB1(VC3)
52 n vcString s vcString=eVC1_U_eVC2_U_eVC3
53 n ret
54 d CVC^XUSRB(.ret,vcString)
55 i ret(0)=0 q ""
56 i ret(0)>0 q ret(1)
57FillSymTab(id) ; Fill symbol table
58 d mergeArrayFromSession^%zewdAPI(.DUZ,"DUZ",id)
59 d mergeArrayFromSession^%zewdAPI(.IO,"IO",id)
60 s U=$$getSessionValue^%zewdAPI("U",id)
61 quit
Note: See TracBrowser for help on using the repository browser.