-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patho4glws.w
1392 lines (1120 loc) · 43.6 KB
/
o4glws.w
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
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
&ANALYZE-SUSPEND _VERSION-NUMBER UIB_v9r12 GUI
&ANALYZE-RESUME
&Scoped-define WINDOW-NAME winWizard
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS winWizard
/*------------------------------------------------------------------------
File: o4glws.w
Description: Wizard to generate WSDL files, webservice adapters
and project files.
Author: Lic. Edgar Medrano Pérez
edgarmedrano@gmail.com
Created: 2005.06.14
Company: Open 4GL webservices project
http://o4glws.sourceforge.net
Notes:
------------------------------------------------------------------------*/
/* This .W file was created with the Progress AppBuilder. */
/*----------------------------------------------------------------------*/
/* Create an unnamed pool to store all the widgets created
by this procedure. This is a good default which assures
that this procedure's triggers and internal procedures
will execute in this procedure's storage, and that proper
cleanup will occur on deletion of the procedure. */
CREATE WIDGET-POOL.
/* *************************** Definitions ************************** */
{o4glws/o4glws.i}
{o4glws/procInfo.i}
DEFINE STREAM strDir.
PROCEDURE SHBrowseForFolder EXTERNAL "shell32":
DEFINE INPUT PARAMETER lpbi AS LONG.
DEFINE RETURN PARAMETER lpItemIDList AS LONG.
END PROCEDURE.
PROCEDURE SHGetPathFromIDList EXTERNAL "shell32":
DEFINE INPUT PARAMETER lpItemIDList AS LONG.
DEFINE OUTPUT PARAMETER pszPath AS CHAR.
DEFINE RETURN PARAMETER ReturnValue AS LONG.
END PROCEDURE.
PROCEDURE CoTaskMemFree EXTERNAL "ole32.dll" :
DEFINE INPUT PARAMETER lpVoid AS LONG.
END PROCEDURE.
/* Parameters Definitions --- */
/* Local Variable Definitions --- */
DEFINE VARIABLE vintCurrentSlide AS INTEGER NO-UNDO.
DEFINE VARIABLE vhndSlide AS HANDLE NO-UNDO EXTENT 7.
DEFINE VARIABLE vchrTitle AS CHARACTER NO-UNDO INITIAL "WS Wizard".
DEFINE VARIABLE vlogContinue AS LOGICAL NO-UNDO.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
/* ******************** Preprocessor Definitions ******************** */
&Scoped-define PROCEDURE-TYPE Window
&Scoped-define DB-AWARE no
/* Name of first Frame and/or Browse and/or first Query */
&Scoped-define FRAME-NAME DEFAULT-FRAME
&Scoped-define BROWSE-NAME broProcedures
/* Internal Tables (found by Frame, Query & Browse Queries) */
&Scoped-define INTERNAL-TABLES ttProcedure
/* Definitions for BROWSE broProcedures */
&Scoped-define FIELDS-IN-QUERY-broProcedures ttProcedure.cPath
&Scoped-define ENABLED-FIELDS-IN-QUERY-broProcedures
&Scoped-define SELF-NAME broProcedures
&Scoped-define OPEN-QUERY-broProcedures OPEN QUERY {&SELF-NAME} FOR EACH ttProcedure.
&Scoped-define TABLES-IN-QUERY-broProcedures ttProcedure
&Scoped-define FIRST-TABLE-IN-QUERY-broProcedures ttProcedure
/* Definitions for FRAME fraProcedures */
&Scoped-define OPEN-BROWSERS-IN-QUERY-fraProcedures ~
~{&OPEN-QUERY-broProcedures}
/* Standard List Definitions */
&Scoped-Define ENABLED-OBJECTS btnCancel btnBack btnNext btnFinish
/* Custom List Definitions */
/* List-1,List-2,List-3,List-4,List-5,List-6 */
/* _UIB-PREPROCESSOR-BLOCK-END */
&ANALYZE-RESUME
/* ************************ Function Prototypes ********************** */
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD ToPropath winWizard
FUNCTION ToPropath RETURNS CHARACTER
(INPUT ipchrAbsolutePath AS CHARACTER) FORWARD.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
/* *********************** Control Definitions ********************** */
/* Define the widget handle for the window */
DEFINE VAR winWizard AS WIDGET-HANDLE NO-UNDO.
/* Definitions of the field level widgets */
DEFINE BUTTON btnBack
LABEL "< Back"
SIZE 12 BY .95.
DEFINE BUTTON btnCancel
LABEL "Cancel"
SIZE 12 BY .95.
DEFINE BUTTON btnFinish
LABEL "Finish"
SIZE 12 BY .95.
DEFINE BUTTON btnNext
LABEL "Next >"
SIZE 12 BY .95.
DEFINE VARIABLE edtBegin AS CHARACTER INITIAL "Welcome to the WebService Generator Wizard! During the next few steps, the wizard will lead you through creating a WebService. You will define what procedures (and internal procedures) will be published in the webservice."
VIEW-AS EDITOR
SIZE 32 BY 8.1 NO-UNDO.
DEFINE IMAGE imgBegin
FILENAME "o4glws/wizard3.gif":U
STRETCH-TO-FIT RETAIN-SHAPE TRANSPARENT
SIZE 42 BY 7.14.
DEFINE IMAGE imgError
FILENAME "o4glws/error.gif":U
STRETCH-TO-FIT TRANSPARENT
SIZE 39 BY 7.14.
DEFINE RECTANGLE RECT-4
EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
SIZE 40 BY 7.14.
DEFINE VARIABLE edtEndSuccess AS CHARACTER INITIAL "Now you can use the generated WSDL file and program."
VIEW-AS EDITOR NO-BOX
SIZE 36 BY 2.38 NO-UNDO.
DEFINE IMAGE imgSucces
FILENAME "o4glws/success.gif":U
STRETCH-TO-FIT RETAIN-SHAPE TRANSPARENT
SIZE 41 BY 7.14.
DEFINE RECTANGLE RECT-3
EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
SIZE 40 BY 7.14.
DEFINE BUTTON btnSave
LABEL "..."
SIZE 4 BY .95.
DEFINE VARIABLE cboTemplate AS CHARACTER FORMAT "X(256)":U
LABEL "Template"
VIEW-AS COMBO-BOX INNER-LINES 5
DROP-DOWN-LIST
SIZE 24 BY 1 NO-UNDO.
DEFINE VARIABLE filSave AS CHARACTER FORMAT "X(256)":U
VIEW-AS FILL-IN
SIZE 32 BY .95 NO-UNDO.
DEFINE VARIABLE tglProgram AS LOGICAL INITIAL no
LABEL "WS Program using"
VIEW-AS TOGGLE-BOX
SIZE 24 BY .95 NO-UNDO.
DEFINE VARIABLE tglSave AS LOGICAL INITIAL no
LABEL "Save WS project in file"
VIEW-AS TOGGLE-BOX
SIZE 28 BY .81 NO-UNDO.
DEFINE VARIABLE tglWSDL AS LOGICAL INITIAL no
LABEL "WSDL File"
VIEW-AS TOGGLE-BOX
SIZE 24 BY .95 NO-UNDO.
DEFINE BUTTON btnLoadFile
LABEL "..."
SIZE 4 BY .95.
DEFINE VARIABLE filLoadFile AS CHARACTER FORMAT "X(256)":U
VIEW-AS FILL-IN
SIZE 30 BY .95 NO-UNDO.
DEFINE VARIABLE radLoad AS LOGICAL INITIAL yes
VIEW-AS RADIO-SET VERTICAL
RADIO-BUTTONS
"Create a new project", yes,
"Load an existing project", no
SIZE 30 BY 2.38 NO-UNDO.
DEFINE BUTTON btnDefProcedures
LABEL "Define Procedures"
SIZE 26 BY 1.19.
DEFINE VARIABLE edtProcedures AS CHARACTER INITIAL "You need to define the procedure files that will be published in the webservice."
VIEW-AS EDITOR
SIZE 26 BY 4.76 NO-UNDO.
DEFINE RECTANGLE RECT-1
EDGE-PIXELS 2 GRAPHIC-EDGE NO-FILL
SIZE 52 BY 9.05.
DEFINE BUTTON btnDestination
LABEL "..."
SIZE 5 BY .95.
DEFINE BUTTON btnSecurity
LABEL "..."
SIZE 5 BY .95.
DEFINE VARIABLE filAddress AS CHARACTER FORMAT "X(256)":U
VIEW-AS FILL-IN
SIZE 41 BY .95 NO-UNDO.
DEFINE VARIABLE filDestination AS CHARACTER FORMAT "X(256)":U
VIEW-AS FILL-IN
SIZE 36 BY .95 NO-UNDO.
DEFINE VARIABLE filName AS CHARACTER FORMAT "X(256)":U
VIEW-AS FILL-IN
SIZE 41 BY .95 NO-UNDO.
DEFINE VARIABLE filSecurity AS CHARACTER FORMAT "X(256)":U
VIEW-AS FILL-IN
SIZE 36 BY .95 NO-UNDO.
/* Query definitions */
&ANALYZE-SUSPEND
DEFINE QUERY broProcedures FOR
ttProcedure SCROLLING.
&ANALYZE-RESUME
/* Browse definitions */
DEFINE BROWSE broProcedures
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS broProcedures winWizard _FREEFORM
QUERY broProcedures DISPLAY
ttProcedure.cPath
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
WITH NO-ROW-MARKERS SEPARATORS MULTIPLE SIZE 48 BY 7.38 EXPANDABLE.
/* ************************ Frame Definitions *********************** */
DEFINE FRAME fraProcedures
edtProcedures AT ROW 1.48 COL 58 NO-LABEL NO-TAB-STOP
broProcedures AT ROW 2.67 COL 6
btnDefProcedures AT ROW 6.48 COL 58
RECT-1 AT ROW 1.48 COL 4
"Procedures:" VIEW-AS TEXT
SIZE 21 BY .71 AT ROW 1.71 COL 6
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 84.6 BY 10.14.
DEFINE FRAME DEFAULT-FRAME
btnCancel AT ROW 12.43 COL 32
btnBack AT ROW 12.43 COL 45
btnNext AT ROW 12.43 COL 58
btnFinish AT ROW 12.43 COL 71
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 84.8 BY 12.91
DEFAULT-BUTTON btnCancel.
DEFINE FRAME fraEndSuccess
edtEndSuccess AT ROW 5.52 COL 44 NO-LABEL NO-TAB-STOP
imgSucces AT ROW 1.95 COL 2
RECT-3 AT ROW 1.95 COL 43
"You completed the webservice!" VIEW-AS TEXT
SIZE 38 BY .95 AT ROW 3.86 COL 44
"Congratulations!" VIEW-AS TEXT
SIZE 38 BY .95 AT ROW 2.67 COL 44
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 84 BY 10.14.
DEFINE FRAME fraLoad
radLoad AT ROW 1.95 COL 3 NO-LABEL
filLoadFile AT ROW 4.57 COL 4 COLON-ALIGNED NO-LABEL
btnLoadFile AT ROW 4.57 COL 36
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 84.6 BY 10.14.
DEFINE FRAME fraGenerate
tglWSDL AT ROW 1.48 COL 4
tglProgram AT ROW 2.67 COL 4
cboTemplate AT ROW 3.86 COL 16 COLON-ALIGNED
tglSave AT ROW 5.29 COL 4
filSave AT ROW 6.24 COL 6 COLON-ALIGNED NO-LABEL
btnSave AT ROW 6.24 COL 40
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 84 BY 10.14.
DEFINE FRAME fraSettings
filName AT ROW 2.19 COL 3 COLON-ALIGNED NO-LABEL
filDestination AT ROW 4.1 COL 3 COLON-ALIGNED NO-LABEL
btnDestination AT ROW 4.1 COL 41
filAddress AT ROW 6 COL 3 COLON-ALIGNED NO-LABEL
filSecurity AT ROW 8.14 COL 3 COLON-ALIGNED NO-LABEL
btnSecurity AT ROW 8.14 COL 41
"Code destination:" VIEW-AS TEXT
SIZE 22 BY .71 AT ROW 3.38 COL 5
"Server address:" VIEW-AS TEXT
SIZE 16 BY .71 AT ROW 5.29 COL 5
"Security procedure:" VIEW-AS TEXT
SIZE 20 BY .95 AT ROW 7.19 COL 5
"Webservice name:" VIEW-AS TEXT
SIZE 22 BY .71 AT ROW 1.48 COL 5
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 84 BY 10.14.
DEFINE FRAME fraEndError
imgError AT ROW 1.95 COL 2
RECT-4 AT ROW 1.95 COL 43
"Go Back or press Cancel." VIEW-AS TEXT
SIZE 30 BY 1.19 AT ROW 5.05 COL 44
"You have not completed the" VIEW-AS TEXT
SIZE 38 BY .95 AT ROW 2.43 COL 44
"webservice!" VIEW-AS TEXT
SIZE 38 BY .95 AT ROW 3.86 COL 44
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 84 BY 10.14.
DEFINE FRAME fraBegin
edtBegin AT ROW 1.95 COL 50 NO-LABEL NO-TAB-STOP
imgBegin AT ROW 2.43 COL 5
WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
SIDE-LABELS NO-UNDERLINE THREE-D
AT COL 1 ROW 1
SIZE 84.6 BY 10.14.
/* *********************** Procedure Settings ************************ */
&ANALYZE-SUSPEND _PROCEDURE-SETTINGS
/* Settings for THIS-PROCEDURE
Type: Window
Allow: Basic,Browse,DB-Fields,Window,Query
Other Settings: COMPILE
*/
&ANALYZE-RESUME _END-PROCEDURE-SETTINGS
/* ************************* Create Window ************************** */
&ANALYZE-SUSPEND _CREATE-WINDOW
IF SESSION:DISPLAY-TYPE = "GUI":U THEN
CREATE WINDOW winWizard ASSIGN
HIDDEN = YES
TITLE = "WSGen wizard"
HEIGHT = 12.91
WIDTH = 84.8
MAX-HEIGHT = 35.67
MAX-WIDTH = 204.8
VIRTUAL-HEIGHT = 35.67
VIRTUAL-WIDTH = 204.8
MAX-BUTTON = no
RESIZE = yes
SCROLL-BARS = no
STATUS-AREA = no
BGCOLOR = ?
FGCOLOR = ?
KEEP-FRAME-Z-ORDER = yes
THREE-D = yes
MESSAGE-AREA = no
SENSITIVE = yes.
ELSE {&WINDOW-NAME} = CURRENT-WINDOW.
&IF '{&WINDOW-SYSTEM}' NE 'TTY' &THEN
IF NOT winWizard:LOAD-ICON("o4glws/transparent.ico":U) THEN
MESSAGE "Unable to load icon: o4glws/transparent.ico"
VIEW-AS ALERT-BOX WARNING BUTTONS OK.
&ENDIF
/* END WINDOW DEFINITION */
&ANALYZE-RESUME
/* *********** Runtime Attributes and AppBuilder Settings *********** */
&ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
/* SETTINGS FOR WINDOW winWizard
VISIBLE,,RUN-PERSISTENT */
/* REPARENT FRAME */
ASSIGN FRAME fraBegin:FRAME = FRAME DEFAULT-FRAME:HANDLE
FRAME fraEndError:FRAME = FRAME DEFAULT-FRAME:HANDLE
FRAME fraEndSuccess:FRAME = FRAME DEFAULT-FRAME:HANDLE
FRAME fraGenerate:FRAME = FRAME DEFAULT-FRAME:HANDLE
FRAME fraLoad:FRAME = FRAME DEFAULT-FRAME:HANDLE
FRAME fraSettings:FRAME = FRAME DEFAULT-FRAME:HANDLE.
/* SETTINGS FOR FRAME DEFAULT-FRAME
*/
DEFINE VARIABLE XXTABVALXX AS LOGICAL NO-UNDO.
ASSIGN XXTABVALXX = FRAME fraEndSuccess:MOVE-BEFORE-TAB-ITEM (btnCancel:HANDLE IN FRAME DEFAULT-FRAME)
XXTABVALXX = FRAME fraLoad:MOVE-BEFORE-TAB-ITEM (FRAME fraEndSuccess:HANDLE)
XXTABVALXX = FRAME fraGenerate:MOVE-BEFORE-TAB-ITEM (FRAME fraLoad:HANDLE)
XXTABVALXX = FRAME fraSettings:MOVE-BEFORE-TAB-ITEM (FRAME fraGenerate:HANDLE)
XXTABVALXX = FRAME fraEndError:MOVE-BEFORE-TAB-ITEM (FRAME fraSettings:HANDLE)
XXTABVALXX = FRAME fraBegin:MOVE-BEFORE-TAB-ITEM (FRAME fraEndError:HANDLE)
/* END-ASSIGN-TABS */.
/* SETTINGS FOR FRAME fraBegin
*/
ASSIGN
edtBegin:READ-ONLY IN FRAME fraBegin = TRUE.
/* SETTINGS FOR FRAME fraEndError
*/
/* SETTINGS FOR FRAME fraEndSuccess
*/
ASSIGN
edtEndSuccess:READ-ONLY IN FRAME fraEndSuccess = TRUE.
/* SETTINGS FOR FRAME fraGenerate
*/
/* SETTINGS FOR FRAME fraLoad
*/
/* SETTINGS FOR BUTTON btnLoadFile IN FRAME fraLoad
NO-ENABLE */
ASSIGN
btnLoadFile:HIDDEN IN FRAME fraLoad = TRUE.
/* SETTINGS FOR FILL-IN filLoadFile IN FRAME fraLoad
NO-ENABLE */
/* SETTINGS FOR FRAME fraProcedures
*/
/* BROWSE-TAB broProcedures edtProcedures fraProcedures */
ASSIGN
edtProcedures:READ-ONLY IN FRAME fraProcedures = TRUE.
/* SETTINGS FOR FRAME fraSettings
*/
IF SESSION:DISPLAY-TYPE = "GUI":U AND VALID-HANDLE(winWizard)
THEN winWizard:HIDDEN = no.
/* _RUN-TIME-ATTRIBUTES-END */
&ANALYZE-RESUME
/* Setting information for Queries and Browse Widgets fields */
&ANALYZE-SUSPEND _QUERY-BLOCK BROWSE broProcedures
/* Query rebuild information for BROWSE broProcedures
_START_FREEFORM
OPEN QUERY {&SELF-NAME} FOR EACH ttProcedure.
_END_FREEFORM
_Query is OPENED
*/ /* BROWSE broProcedures */
&ANALYZE-RESUME
/* ************************ Control Triggers ************************ */
&Scoped-define SELF-NAME winWizard
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL winWizard winWizard
ON END-ERROR OF winWizard /* WSGen wizard */
OR ENDKEY OF {&WINDOW-NAME} ANYWHERE DO:
/* This case occurs when the user presses the "Esc" key.
In a persistently run window, just ignore this. If we did not, the
application would exit. */
IF THIS-PROCEDURE:PERSISTENT THEN RETURN NO-APPLY.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL winWizard winWizard
ON WINDOW-CLOSE OF winWizard /* WSGen wizard */
DO:
DEFINE VARIABLE vlogChoice AS LOGICAL NO-UNDO.
IF vintCurrentSlide < EXTENT(vhndSlide) - 2 THEN
DO:
MESSAGE "Are you sure that you want to cancel?" VIEW-AS ALERT-BOX BUTTONS YES-NO UPDATE vlogChoice.
/* This event will close the window and terminate the procedure. */
IF vlogChoice THEN
DO:
APPLY "CLOSE":U TO THIS-PROCEDURE.
END.
END.
RETURN NO-APPLY.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME fraGenerate
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fraGenerate winWizard
ON GO OF FRAME fraGenerate
DO:
DEFINE VARIABLE vhndProjectDoc AS HANDLE NO-UNDO.
DEFINE VARIABLE vhndProjectChild AS HANDLE NO-UNDO.
DEFINE VARIABLE vchrName AS CHARACTER NO-UNDO.
DEFINE VARIABLE vchrFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE vchrAddress AS CHARACTER NO-UNDO.
DEFINE VARIABLE vchrSecurity AS CHARACTER NO-UNDO.
DEFINE VARIABLE vchrResult AS CHARACTER NO-UNDO.
DEFINE VARIABLE vchrPath AS CHARACTER NO-UNDO.
DEFINE VARIABLE vintI AS INTEGER NO-UNDO.
ASSIGN vlogContinue = FALSE.
IF tglWSDL:CHECKED THEN
DO WITH FRAME fraSettings:
ASSIGN
filName
cboTemplate
filDestination
filAddress
vchrName = filName
vchrFile = filDestination + "~\" + vchrName + ".wsdl"
vchrAddress = filAddress + "/" + vchrName + "_" + cboTemplate.
RUN o4glws/WSDL.p (
INPUT TABLE ttProcedure,
INPUT TABLE ttMethod,
INPUT TABLE ttParam,
INPUT TABLE ttTable,
INPUT TABLE ttField,
INPUT vchrFile,
INPUT vchrName,
INPUT vchrAddress,
OUTPUT vchrResult
).
IF vchrResult <> "" THEN
DO:
MESSAGE vchrResult VIEW-AS ALERT-BOX.
RETURN.
END.
END.
IF tglProgram:CHECKED THEN
DO WITH FRAME fraSettings:
ASSIGN
filName
cboTemplate
filDestination
filSecurity
vchrName = filName
vchrFile = filDestination + "/" + filName + "_" + cboTemplate
vchrSecurity = filSecurity
vchrPath = SEARCH("o4glws~\templates~\" + cboTemplate).
RUN o4glws/Adapter.p(
INPUT TABLE ttProcedure,
INPUT TABLE ttMethod,
INPUT TABLE ttParam,
INPUT TABLE ttTable,
INPUT TABLE ttField,
INPUT vchrFile,
INPUT vchrPath,
INPUT vchrName,
INPUT vchrSecurity,
OUTPUT vchrResult
).
IF vchrResult <> "" THEN
DO:
MESSAGE vchrResult VIEW-AS ALERT-BOX.
RETURN.
END.
END.
IF tglSave:CHECKED THEN
DO:
ASSIGN
filSave
ERROR-STATUS:ERROR = FALSE.
CREATE X-DOCUMENT vhndProjectDoc.
ASSIGN vhndProjectChild = createChild(vhndProjectDoc,"project","").
RUN SAVE-STATE(vhndProjectChild,OUTPUT vlogContinue).
vhndProjectDoc:SAVE("FILE",filSave).
DELETE OBJECT vhndProjectDoc.
IF ERROR-STATUS:ERROR THEN
DO:
DO vintI = 0 TO ERROR-STATUS:NUM-MESSAGES:
vchrResult = vchrResult
+ (IF vchrResult <> "" THEN ", " ELSE "")
+ ERROR-STATUS:GET-MESSAGE(vintI).
END.
MESSAGE "Project file is not valid!: " vchrResult VIEW-AS ALERT-BOX.
RETURN.
END.
END.
IF NOT (tglWSDL:CHECKED OR tglProgram:CHECKED OR tglSave:CHECKED) THEN
DO:
MESSAGE "You did not select anything!".
RETURN.
END.
ASSIGN vlogContinue = TRUE.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME fraLoad
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fraLoad winWizard
ON GO OF FRAME fraLoad
DO:
DEFINE VARIABLE vlogChoice AS LOGICAL NO-UNDO.
DEFINE VARIABLE vhndProjectDoc AS HANDLE NO-UNDO.
DEFINE VARIABLE vhndProjectChild AS HANDLE NO-UNDO.
ASSIGN vlogContinue = FALSE.
IF VALID-HANDLE(vhndProjectDoc) THEN
DO:
MESSAGE "Do you want to startover?" VIEW-AS ALERT-BOX BUTTONS YES-NO UPDATE vlogChoice.
IF NOT vlogChoice THEN
DO:
RETURN.
END.
DELETE OBJECT vhndProjectDoc NO-ERROR.
END.
CREATE X-DOCUMENT vhndProjectDoc.
/*Crear el documento o cargarlo desde el archivo*/
IF radLoad THEN
DO:
ASSIGN vhndProjectChild = createChild(vhndProjectDoc,"Project","").
END.
ELSE
DO:
IF SEARCH(filLoadFile:SCREEN-VALUE) <> ? THEN
DO:
vhndProjectDoc:LOAD("FILE",filLoadFile:SCREEN-VALUE,FALSE).
IF ERROR-STATUS:ERROR THEN
DO:
MESSAGE "Project file is not valid!" VIEW-AS ALERT-BOX.
RETURN.
END.
ASSIGN vhndProjectChild = findChild(vhndProjectDoc,"Project").
IF NOT VALID-HANDLE(vhndProjectChild) THEN
DO:
MESSAGE "Project file is not valid!" VIEW-AS ALERT-BOX.
RETURN.
END.
END.
ELSE
DO:
MESSAGE "File not found!" VIEW-AS ALERT-BOX.
RETURN.
END.
END.
RUN LOAD-STATE(vhndProjectChild,OUTPUT vlogContinue).
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME fraProcedures
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fraProcedures winWizard
ON GO OF FRAME fraProcedures
DO:
ASSIGN vlogContinue = FALSE.
IF NOT CAN-FIND(FIRST ttProcedure) THEN
DO:
MESSAGE "You have to define the procedures that will be published" VIEW-AS ALERT-BOX.
RETURN.
END.
ASSIGN vlogContinue = TRUE.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME fraSettings
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL fraSettings winWizard
ON GO OF FRAME fraSettings
DO:
ASSIGN vlogContinue = FALSE.
IF TRIM(filName:SCREEN-VALUE) = "" THEN
DO:
MESSAGE "You must supply a name" VIEW-AS ALERT-BOX.
RETURN.
END.
IF TRIM(filDestination:SCREEN-VALUE) = "" THEN
DO:
MESSAGE "You must supply a directory" VIEW-AS ALERT-BOX.
RETURN.
END.
IF TRIM(filAddress:SCREEN-VALUE) = "" THEN
DO:
MESSAGE "You must supply a server address" VIEW-AS ALERT-BOX.
RETURN.
END.
ASSIGN vlogContinue = TRUE.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btnBack
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnBack winWizard
ON CHOOSE OF btnBack IN FRAME DEFAULT-FRAME /* < Back */
DO:
IF vintCurrentSlide < EXTENT(vhndSlide) THEN
DO:
RUN SHOW-SLIDE(vintCurrentSlide - 1).
END.
ELSE
DO:
RUN SHOW-SLIDE(EXTENT(vhndSlide) - 2).
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define SELF-NAME btnCancel
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnCancel winWizard
ON CHOOSE OF btnCancel IN FRAME DEFAULT-FRAME /* Cancel */
DO:
APPLY "CLOSE":U TO THIS-PROCEDURE.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME fraProcedures
&Scoped-define SELF-NAME btnDefProcedures
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnDefProcedures winWizard
ON CHOOSE OF btnDefProcedures IN FRAME fraProcedures /* Define Procedures */
DO:
RUN o4glws/procDlg.w (
INPUT-OUTPUT TABLE ttProcedure,
INPUT-OUTPUT TABLE ttMethod,
INPUT-OUTPUT TABLE ttParam,
INPUT-OUTPUT TABLE ttTable,
INPUT-OUTPUT TABLE ttField
).
/*ENABLE broProcedures WITH FRAME fraProcedures. */
OPEN QUERY broProcedures FOR EACH ttProcedure NO-LOCK.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME fraSettings
&Scoped-define SELF-NAME btnDestination
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnDestination winWizard
ON CHOOSE OF btnDestination IN FRAME fraSettings /* ... */
DO:
DEFINE VARIABLE vchrFolder AS CHARACTER NO-UNDO.
DEFINE VARIABLE vlogCancel AS LOGICAL NO-UNDO.
RUN BrowseForFolder ("Code destination",
OUTPUT vchrFolder,
OUTPUT vlogCancel).
IF NOT vlogCancel THEN
DO WITH FRAME fraSettings:
ASSIGN filDestination = vchrFolder.
DISPLAY filDestination.
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME DEFAULT-FRAME
&Scoped-define SELF-NAME btnFinish
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnFinish winWizard
ON CHOOSE OF btnFinish IN FRAME DEFAULT-FRAME /* Finish */
DO:
RUN SHOW-SLIDE(EXTENT(vhndSlide) - (IF vlogContinue THEN 1 ELSE 0)).
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME fraLoad
&Scoped-define SELF-NAME btnLoadFile
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnLoadFile winWizard
ON CHOOSE OF btnLoadFile IN FRAME fraLoad /* ... */
DO:
DEFINE VAR l_ok AS LOGICAL NO-UNDO.
DEFINE VAR filename AS CHARACTER NO-UNDO.
DEFINE VAR Filter_NameString AS CHARACTER NO-UNDO.
DEFINE VAR Filter_FileSpec LIKE Filter_NameString NO-UNDO.
/* Initialize the file filters */
ASSIGN Filter_NameString = "Project files (*.xml)"
Filter_FileSpec = "*.xml".
/* Ask for a file name. NOTE: File-names to run must exist */
filename = filLoadFile:SCREEN-VALUE.
SYSTEM-DIALOG GET-FILE filename
TITLE "Open project"
FILTERS Filter_NameString Filter_FileSpec
MUST-EXIST
UPDATE l_ok IN WINDOW {&WINDOW-NAME}.
IF l_ok THEN DO:
filLoadFile:SCREEN-VALUE = filename.
APPLY "RETURN":U TO filLoadFile.
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME DEFAULT-FRAME
&Scoped-define SELF-NAME btnNext
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnNext winWizard
ON CHOOSE OF btnNext IN FRAME DEFAULT-FRAME /* Next > */
DO:
ASSIGN vlogContinue = TRUE.
APPLY "GO" TO vhndSlide[vintCurrentSlide].
IF vintCurrentSlide < EXTENT(vhndSlide) - 2 THEN
DO:
IF vlogContinue THEN
DO:
RUN SHOW-SLIDE(vintCurrentSlide + 1).
END.
END.
ELSE
DO:
APPLY "CHOOSE" TO btnFinish.
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME fraGenerate
&Scoped-define SELF-NAME btnSave
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnSave winWizard
ON CHOOSE OF btnSave IN FRAME fraGenerate /* ... */
DO:
DEFINE VAR l_ok AS LOGICAL NO-UNDO.
DEFINE VAR filename AS CHARACTER NO-UNDO.
DEFINE VAR Filter_NameString AS CHARACTER NO-UNDO.
DEFINE VAR Filter_FileSpec LIKE Filter_NameString NO-UNDO.
/* Initialize the file filters */
ASSIGN Filter_NameString = "Project files (*.xml)"
Filter_FileSpec = "*.xml".
/* Ask for a file name. NOTE: File-names to run must exist */
filename = filSave:SCREEN-VALUE.
SYSTEM-DIALOG GET-FILE filename
TITLE "Save project"
FILTERS Filter_NameString Filter_FileSpec
SAVE-AS
UPDATE l_ok IN WINDOW {&WINDOW-NAME}.
IF l_ok THEN DO:
filSave:SCREEN-VALUE = filename.
APPLY "RETURN":U TO filSave.
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME fraSettings
&Scoped-define SELF-NAME btnSecurity
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL btnSecurity winWizard
ON CHOOSE OF btnSecurity IN FRAME fraSettings /* ... */
DO:
DEFINE VAR l_ok AS LOGICAL NO-UNDO.
DEFINE VAR filename AS CHARACTER NO-UNDO.
/* Ask for a file name. NOTE: File-names to run must exist */
filename = filSecurity:SCREEN-VALUE.
SYSTEM-DIALOG GET-FILE filename
TITLE "Security procedure"
FILTERS "Source files (*.p)" "*.p",
"R-code files (*.r)" "*.r"
MUST-EXIST
UPDATE l_ok IN WINDOW {&WINDOW-NAME}.
IF l_ok THEN DO:
filSecurity:SCREEN-VALUE = ToPropath(filename).
APPLY "RETURN":U TO filSecurity.
END.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME fraLoad
&Scoped-define SELF-NAME radLoad
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL radLoad winWizard
ON VALUE-CHANGED OF radLoad IN FRAME fraLoad
DO:
DISPLAY radLoad:SCREEN-VALUE.
ASSIGN
radLoad
filLoadFile:SENSITIVE = NOT radLoad
btnLoadFile:SENSITIVE = NOT radLoad
btnLoadFile:VISIBLE = NOT radLoad.
END.
/* _UIB-CODE-BLOCK-END */
&ANALYZE-RESUME
&Scoped-define FRAME-NAME DEFAULT-FRAME
&Scoped-define BROWSE-NAME broProcedures
&UNDEFINE SELF-NAME
&ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK winWizard
/* *************************** Main Block *************************** */
ASSIGN
vhndSlide[1] = FRAME fraBegin:HANDLE
vhndSlide[2] = FRAME fraLoad:HANDLE
vhndSlide[3] = FRAME fraProcedures:HANDLE
vhndSlide[4] = FRAME fraSettings:HANDLE
vhndSlide[5] = FRAME fraGenerate:HANDLE
vhndSlide[6] = FRAME fraEndSuccess:HANDLE
vhndSlide[7] = FRAME fraEndError:HANDLE.
RUN LOAD-TEMPLATES.
/* Set CURRENT-WINDOW: this will parent dialog-boxes and frames. */
ASSIGN CURRENT-WINDOW = {&WINDOW-NAME}
THIS-PROCEDURE:CURRENT-WINDOW = {&WINDOW-NAME}.
/* The CLOSE event can be used from inside or outside the procedure to */
/* terminate it. */
ON CLOSE OF THIS-PROCEDURE
RUN disable_UI.
/* Best default for GUI applications is... */
PAUSE 0 BEFORE-HIDE.
/* Now enable the interface and wait for the exit condition. */
/* (NOTE: handle ERROR and END-KEY so cleanup code will always fire. */