{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathanswer.pls
More file actions
233 lines (214 loc) · 8.05 KB
/
Copy pathanswer.pls
File metadata and controls
233 lines (214 loc) · 8.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
*---------------------------------------------------------------
.
. Program Name: answer
. Description: Answer program for 2019 conference
.
. Revision History:
.
. 21 Jun 19 W Keech
. Original code
.
*---------------------------------------------------------------
INCLUDE plbequ.inc
INCLUDE plbmeth.inc
signonPath DIM %100
httpRootPath DIM %100 // For downloads
httpRootPath1 DIM %100 // For browser access
urlPath DIM %100
signonName DIM %40
signon PLFORM answersignon.pwf
userPath INIT "C:\sunbelt\td\"
userIsiName DIM 260
userFileName DIM 260
users IFILE
userName DIM 20
userPswd DIM 20
*................................................................
.
. Code start
.
CALL Main
STOP
*................................................................
.
. FetchJsonStringValue - Fetch string data for String 'label'
.
. Only update the result if the label is found
.
FetchJsonStringValue LFUNCTION
pXData XDATA ^
xLabel DIM 50
dReturn DIM ^
ENTRY
.
xString DIM 200
x200 DIM 200
xError DIM 100
nvar FORM 2
.
. Find the specified JSON label node
.
PACK s$cmdlin, "label='",xLabel,"'"
pXData.FindNode GIVING nvar:
USING *FILTER=S$cmdlin: //Locate specified JSON label!
*POSITION=START_DOCUMENT_NODE //Start at the beginning of the document!
IF ( nvar == 0 )
...
. Move to the child node of the 'orient' JSON label.
.
pXData.MoveToNode GIVING nvar USING *POSITION=MOVE_FIRST_CHILD
.
IF ( nvar == 0 )
...
. Fetch the data for the JSON label.
.
pXData.GetText GIVING xString
PACK s$cmdlin, xLabel,"= '",xString,"'"
ELSE
MOVE "Error Move Node:", s$cmdlin
ENDIF
ELSE
PACK s$cmdlin, "Error Find Node:",nvar
ENDIF
TYPE xString
IF NOT EOS
MOVE xString, dReturn
ENDIF
FUNCTIONEND
*................................................................
.
. Logon - Get the name and check against a file
.
Logon LFUNCTION
ENTRY
Name DIM 20
Pswd DIM 20
nvar FORM 2
rootPath DIM 100
saveToPath DIM 40
runtime RUNTIME
HctlSignon.GetAttr Giving Name Using "uname", "value"
HctlSignon.GetAttr Giving Pswd Using "psw", "value"
.
. Add code to lookup and verify
.
READ users,Name;userName,*LL, userPswd, signonName
IF Over
ALERT NOTE,"User name not found!", nvar, "PLB Answer"
RETURN
ENDIF
IF (Pswd == userPswd)
.
. All ok go to master
.
SETPROP signonForm, *Visible=0
PACK signonPath, userPath, userName
SQUEEZE signonPath,signonPath," "
runtime.GetDir Giving rootPath Using 3
runtime.GetDir Giving saveToPath Using 5
PACK httpRootPath, rootPath, "\", saveToPath, "td\", userName
SQUEEZE httpRootPath,httpRootPath," "
PACK httpRootPath1, rootPath, "\td\", userName
SQUEEZE httpRootPath1,httpRootPath1," "
PACK urlPath, "td/",userName, "/"
SQUEEZE urlPath,urlPath," "
STOP
ENDIF
ALERT NOTE,"Invalid password!", nvar, "PLB Answer"
FUNCTIONEND
*................................................................
.
. SignonEvent - Main event handler for the Signon form
.
SignonEvent LFUNCTION
ENTRY
JsonData DIM 4096
JsonEvent XDATA
BtnId DIM 20
EVENTINFO 0, Arg1=JsonData
JsonEvent.LoadJson Using JsonData
CALL FetchJsonStringValue Using JsonEvent,"id",BtnId
SWITCH BtnId
CASE "cancel"
SHUTDOWN
CASE "logon"
CALL Logon
CASE "forgot"
SHUTDOWN
ENDSWITCH
FUNCTIONEND
*................................................................
.
. Shutdown if not handle files
.
Shutdown
SHUTDOWN
*................................................................
.
. Make Isam
.
MakeIsam LFUNCTION
ENTRY
attdFile FILE
seq FORM "-1"
name DIM 2
fullName DIM 40
saveToPath DIM 100
rootPath DIM 100
httpRootPath DIM 300
newPath DIM 300
runtime RUNTIME
// Get the http root and add a td direcoty
runtime.GetDir Giving rootPath Using 3
PACK httpRootPath1, rootPath, "\td"
SQUEEZE httpRootPath1,httpRootPath1," "
PATH Create Using httpRootPath1
runtime.GetDir Giving saveToPath Using 5
PACK httpRootPath, rootPath, "\", saveToPath, "td"
SQUEEZE httpRootPath,httpRootPath," "
PATH Create Using httpRootPath
PATH Create Using userPath
TRAP Shutdown If IO
PACK userFileName With userPath, "conf2019users.txt"
OPEN attdFile, userFileName
PACK userFileName With userPath, "confusers.txt"
PREP users, userFileName, userIsiName, "20", "80"
LOOP
READ attdFile,seq;name,fullName
BREAK If OVER
MOVE name To userName
MOVE "p" To userPswd
WRITE users,userName;userName,userPswd,fullName
PACK newPath, userPath, userName, "\"
SQUEEZE newPath,newPath," "
PATH Create Using newPath
PACK newPath, httpRootPath, "\", userName, "\"
SQUEEZE newPath,newPath," "
PATH Create Using newPath
PACK newPath, httpRootPath1, "\", userName, "\"
SQUEEZE newPath,newPath," "
PATH Create Using newPath
REPEAT
FUNCTIONEND
*................................................................
.
. Main - Main entry point
.
Main LFUNCTION
ENTRY
client CLIENT
isCordova FORM 1
WINHIDE
TRAP MakeIsam If IO
PACK userIsiName With userPath, "confusers.isi"
OPEN users,userIsiName
TRAPCLR IO
FORMLOAD signon
client.GetState GIVING isCordova USING *STATEMASK=2
IF ( isCordova == 1 )
SETPROP SignonForm,Webwidth="100%"
ENDIF
LOOP
EVENTWAIT
REPEAT
FUNCTIONEND
You can’t perform that action at this time.
