Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmaster.pls
More file actions
297 lines (266 loc) · 11.2 KB
/
master.pls
File metadata and controls
297 lines (266 loc) · 11.2 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
*---------------------------------------------------------------
.
. Program Name: master
. Description: Master program for 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
masterStarted DIM %1
mainWin MAINWINDOW
result FORM 5
mainForm PLFORM main.pwf
*................................................................
.
. 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
.===============================================================================
CopyFile LFUNCTION
inFile DIM ^
outFile DIM ^
ENTRY
infoLine DIM 100
EXCEPTSET CopyFileError IF IO
COPYFILE inFile, outFile
PACK infoLine Using "Copied ", inFile, " to ", outFile
ActionList.InsertString Using infoLine, 0
RETURN
.
CopyFileError
PACK infoLine Using "Copy Error on ", inFile
ActionList.InsertString Using infoLine, 0
FUNCTIONEND
*................................................................
.
. Download - Handles Download button
.
Download LFUNCTION
ENTRY
outFile DIM 300 //Output - User DIM to receive selected file!
scan DIM 200 //Input - Path on PWS server where input selection files are located.
prefix DIM 50 //Input - Prefix (example: prt_) or NULL
searchName DIM 50 //Input - Search named (example: '*.*', '*.pdf', ...etc
infoLine DIM 80
oname DIM 200
iname DIM 200
client CLIENT
MOVE "*.*", SearchName
MOVE signonPath To Scan
CALLS "webfileselect;StartProg" USING outFile: //Output - User DIM to receive selected file!
scan: //Input - Path where input selection files located.
prefix: //Input - Prefix (example: prt_) or NULL
searchName //Input - Search named (example: '*.*', '*.pdf', ...etc
TYPE OutFile
IF NOT EOS
PACK iname Using signonPath, "\", outFile
PACK oname Using httpRootPath, "\", outFile
PACK infoLine Using "Download ", oname
ActionList.InsertString Using infoLine, 0
CALL CopyFile Using iname, oname
PACK oname Using urlPath, outFile
PACK infoLine Using "Download ", oname
ActionList.InsertString Using infoLine, 0
client.Open USING *URL=oname, *OPTIONS=1
ENDIF
FUNCTIONEND
*................................................................
.
. Chain - Handles Chain button
.
Chain LFUNCTION
ENTRY
programName DIM 40
infoLine DIM 80
nvar FORM 2
EXCEPTSET ChainIssue NORESET IF CFAIL
GETPROP EditText1, TEXT=programName
CHOP programName
TYPE programName
IF EOS
ALERT NOTE,"Program Selection Not Specified!", nvar, "PLB Master"
RETURN
ENDIF
CHAIN programName
RETURN
ChainIssue PACK infoLine, "'", programName, "' not found!"
ALERT NOTE,infoLine, nvar, "PLB Master Chain Error"
UNPACK "", S$ERROR$
CHAIN "master"
FUNCTIONEND
*................................................................
.
. Compile - Handles Compile button
.
Compile LFUNCTION
ENTRY
CmplerCmd DIM 400
outFile DIM 300 //Output - User DIM to receive selected file!
scan DIM 200 //Input - Path on PWS server where input selection files are located.
prefix DIM 50 //Input - Prefix (example: prt_) or NULL
searchName DIM 50 //Input - Search named (example: '*.*', '*.pdf', ...etc
infoLine DIM 80
srcName DIM 200
plcName DIM 200
lstName DIM 200
lstName1 DIM 200
urlName DIM 200
client CLIENT
MOVE "*.pls", SearchName
MOVE signonPath To Scan
CALLS "webfileselect;StartProg" USING outFile: //Output - User DIM to receive selected file!
scan: //Input - Path where input selection files located.
prefix: //Input - Prefix (example: prt_) or NULL
searchName //Input - Search named (example: '*.*', '*.pdf', ...etc
TYPE OutFile
IF NOT EOS
PACK srcName Using signonPath, "\", outFile
SCAN "." In outFile
LENSET outFile
RESET outFile
PACK plcName Using signonPath, "\", outFile, "plc"
PACK lstName Using signonPath, "\", outFile, "lst"
PACK lstName1 Using httpRootPath1, "\", outFile, "lst"
PACK urlName Using urlPath, outFile, "lst"
PACK CmplerCmd Using "C:\SUNBELT\PLBWIN.101B\CODE\PLBWIN.EXE -I C:\SUNBELT\PLBWIN.101B\CODE\PLBWIN.INI PLBCMP #"":
srcName,"#",#"", plcName:
"#",#"",lstName,"#" -ZG,ZT,S,ZH,E,X,P #"TD#""
ActionList.InsertString Using CmplerCmd, 0
EXECUTE CmplerCmd
CALL CopyFile Using lstName, lstName1
client.Open USING *URL=urlName
ENDIF
. FindFile
.
FUNCTIONEND
*................................................................
.
. Upload - Handles Upload button
.
Upload LFUNCTION
ENTRY
fileCount FORM 5
pos FORM 5
fname DIM 200
oname DIM 200
iname DIM 200
infoLine DIM 100
time DIM 12
CLOCK TIME to time
PACK infoLine,"Upload started.... ",time
ActionList.InsertString Using infoLine, 0
Upload.GetFileCount Giving fileCount
SUB "1" From fileCount
FOR pos From "0" TO fileCount
Upload.GetFileItem Giving fname Using pos, 1
PACK iname Using "!", fname
PACK oname Using signonPath, "\", fname
CALL CopyFile Using iname, oname
REPEAT
CLOCK TIME to time
PACK infoLine,"Upload complete.... ",time
ActionList.InsertString Using infoLine, 0
FUNCTIONEND
*................................................................
.
. Main - Main entry point
.
Main LFUNCTION
ENTRY
nvar FORM 2
infoLine DIM 40
client CLIENT
isCordova FORM 1
// Make sure we have a valid path
TYPE signonPath
IF EOS
SHUTDOWN
ENDIF
GETPROP mainWin, Visible=Result
IF ( Result != 0 )
WINHIDE
ENDIF
TYPE masterStarted
IF EOS
UNPACK "", S$ERROR$
MOVE "1", masterStarted
SEARCHPATH ADD, signonPath
ENDIF
CHOP S$ERROR$
TYPE S$ERROR$
IF NOT EOS
ALERT NOTE,S$ERROR$,NVAR,"PLB Master error recovery"
UNPACK "", S$ERROR$
ENDIF
SETMODE *PercentConvert=1
FORMLOAD mainForm
SETMODE *PercentConvert=0
client.GetState GIVING isCordova USING *STATEMASK=2
IF ( isCordova == 1 )
SETPROP WebForm1,Webwidth="100%"
ENDIF
// Allow multiple files to be uploaded at one time
Upload.SetFileOptions Using *Flags=1
PACK infoLine, "Hello ", signonName
ActionList.InsertString Using infoLine, 0
LOOP
EVENTWAIT
REPEAT
FUNCTIONEND
You can’t perform that action at this time.
