1 &ANALYZE-SUSPEND _VERSION-NUMBER UIB_v8r12 GUI
6 &Scoped-define WINDOW-NAME CURRENT-WINDOW
7 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS B-table-Win
8 /*------------------------------------------------------------------------
12 Description
: from BROWSER.W
- Basic SmartBrowser Object Template
20 ------------------------------------------------------------------------*/
24 /* *************************** Definitions
************************** */
26 DEF VAR key-name
AS CHAR NO-UNDO.
27 DEF VAR key-value
AS CHAR NO-UNDO.
28 DEF VAR task-key-value
AS CHAR NO-UNDO.
30 /* _UIB-CODE-BLOCK-END
*/
34 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
36 /* ******************** Preprocessor Definitions
******************** */
38 &Scoped-define PROCEDURE-TYPE SmartBrowser
40 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
42 /* Name of first Frame and
/or Browse and
/or first Query
*/
43 &Scoped-define FRAME-NAME F-Main
44 &Scoped-define BROWSE-NAME br_table
46 /* Internal Tables
(found by Frame
, Query
& Browse Queries) */
47 &Scoped-define INTERNAL-TABLES FlowRule
49 /* Define KEY-PHRASE in case it is used by any query.
*/
50 &Scoped-define KEY-PHRASE TRUE
52 /* Definitions for
BROWSE br_table
*/
53 &Scoped-define FIELDS-IN-QUERY-br_table FlowRule.FlowTaskType ~
54 FlowRule.FlowStepType FlowRule.FlowRuleCode FlowRule.Description ~
55 FlowRule.NextTaskType FlowRule.NextStepType FlowRule.Priority ~
57 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table
58 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table
59 &Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH FlowRule WHERE ~{&KEY-PHRASE} NO-LOCK ~
61 &Scoped-define TABLES-IN-QUERY-br_table FlowRule
62 &Scoped-define FIRST-TABLE-IN-QUERY-br_table FlowRule
65 /* Definitions for
FRAME F-Main
*/
67 /* Standard List Definitions
*/
68 &Scoped-Define ENABLED-OBJECTS br_table
70 /* Custom List Definitions
*/
71 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
73 /* _UIB-PREPROCESSOR-BLOCK-END
*/
77 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
78 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
84 FlowTaskType|y|y|TTPL.FlowRule.FlowTaskType
85 NextTaskType|y|y|TTPL.FlowRule.NextTaskType
86 NextStepType|y|y|TTPL.FlowRule.NextStepType
87 FlowRuleType||y|TTPL.FlowRule.FlowRuleType
88 FlowStepType|y|y|TTPL.FlowRule.FlowStepType
91 **************************
92 * Set attributes related to FOREIGN
KEYS
94 RUN set-attribute-list
(
95 'Keys-Accepted
= "FlowTaskType,NextTaskType,NextStepType,FlowStepType",
96 Keys-Supplied
= "FlowTaskType,NextTaskType,NextStepType,FlowRuleType,FlowStepType"'
:U
).
98 /* Tell the ADM to use the OPEN-QUERY-CASES.
*/
99 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
100 /**************************
102 /* _UIB-CODE-BLOCK-END
*/
105 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
106 /* Actions
: ? adm
/support
/advqedit.w ? ? ?
*/
114 ************************
115 * Set attributes related to SORTBY-OPTIONS
*/
116 RUN set-attribute-list
(
117 'SortBy-Options
= ""'
:U
).
118 /************************
121 </FILTER-ATTRIBUTES
> */
123 /* _UIB-CODE-BLOCK-END
*/
127 /* *********************** Control Definitions
********************** */
130 /* Definitions of the field level widgets
*/
131 /* Query definitions
*/
133 DEFINE QUERY br_table
FOR
137 /* Browse definitions
*/
138 DEFINE BROWSE br_table
139 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _STRUCTURED
140 QUERY br_table
NO-LOCK DISPLAY
141 FlowRule.FlowTaskType
COLUMN-LABEL "Task Type"
142 FlowRule.FlowStepType
COLUMN-LABEL "Step Type"
143 FlowRule.FlowRuleCode
COLUMN-LABEL "Rule Code"
145 FlowRule.NextTaskType
146 FlowRule.NextStepType
148 FlowRule.FlowRuleType
COLUMN-LABEL "Rule Type"
149 /* _UIB-CODE-BLOCK-END
*/
151 WITH NO-ASSIGN SEPARATORS SIZE 76.57 BY 12.8
155 /* ************************ Frame Definitions
*********************** */
158 br_table
AT ROW 1 COL 1
159 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
160 SIDE-LABELS NO-UNDERLINE THREE-D
161 AT COL 1 ROW 1 SCROLLABLE
162 BGCOLOR 8 FGCOLOR 0 .
165 /* *********************** Procedure Settings
************************ */
167 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
168 /* Settings for
THIS-PROCEDURE
172 Add Fields to
: EXTERNAL-TABLES
173 Other Settings
: PERSISTENT-ONLY
COMPILE
176 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
177 /* then cleanup and return.
*/
178 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
179 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
180 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
184 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
186 /* ************************* Create Window
************************** */
188 &ANALYZE-SUSPEND _CREATE-WINDOW
189 /* DESIGN Window definition
(used by the UIB
)
190 CREATE WINDOW B-table-Win
ASSIGN
193 /* END WINDOW DEFINITION
*/
198 /* *************** Runtime Attributes and UIB Settings
************** */
200 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
201 /* SETTINGS
FOR WINDOW B-table-Win
202 NOT-VISIBLE
,,RUN-PERSISTENT
*/
203 /* SETTINGS
FOR FRAME F-Main
204 NOT-VISIBLE Size-to-Fit
*/
205 /* BROWSE-TAB br_table
1 F-Main
*/
207 FRAME F-Main
:SCROLLABLE = FALSE
208 FRAME F-Main
:HIDDEN = TRUE.
210 /* _RUN-TIME-ATTRIBUTES-END
*/
214 /* Setting information for Queries and Browse Widgets fields
*/
216 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
217 /* Query rebuild information for
BROWSE br_table
218 _TblList
= "TTPL.FlowRule"
219 _Options
= "NO-LOCK KEY-PHRASE SORTBY-PHRASE"
220 _FldNameList
[1] > TTPL.FlowRule.FlowTaskType
221 "FlowRule.FlowTaskType" "Task Type" ?
"character" ? ? ? ? ? ? no ?
222 _FldNameList
[2] > TTPL.FlowRule.FlowStepType
223 "FlowRule.FlowStepType" "Step Type" ?
"character" ? ? ? ? ? ? no ?
224 _FldNameList
[3] > TTPL.FlowRule.FlowRuleCode
225 "FlowRule.FlowRuleCode" "Rule Code" ?
"character" ? ? ? ? ? ? no ?
226 _FldNameList
[4] = TTPL.FlowRule.Description
227 _FldNameList
[5] = TTPL.FlowRule.NextTaskType
228 _FldNameList
[6] = TTPL.FlowRule.NextStepType
229 _FldNameList
[7] = TTPL.FlowRule.Priority
230 _FldNameList
[8] > TTPL.FlowRule.FlowRuleType
231 "FlowRule.FlowRuleType" "Rule Type" ?
"character" ? ? ? ? ? ? no ?
233 */ /* BROWSE br_table
*/
236 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
237 /* Query rebuild information for
FRAME F-Main
240 */ /* FRAME F-Main
*/
246 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
247 /* ************************* Included-Libraries
*********************** */
249 {src
/adm
/method
/browser.i
}
250 {inc
/method
/m-drlvwr.i
}
252 /* _UIB-CODE-BLOCK-END
*/
258 /* ************************ Control Triggers
************************ */
260 &Scoped-define BROWSE-NAME br_table
261 &Scoped-define SELF-NAME br_table
262 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
263 ON ROW-ENTRY
OF br_table
IN FRAME F-Main
265 /* This code displays initial values for newly added or copied rows.
*/
266 {src
/adm
/template
/brsentry.i
}
269 /* _UIB-CODE-BLOCK-END
*/
273 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
274 ON ROW-LEAVE
OF br_table
IN FRAME F-Main
276 /* Do not disable this code or no updates will take place except
277 by pressing the Save button on an Update SmartPanel.
*/
278 {src
/adm
/template
/brsleave.i
}
281 /* _UIB-CODE-BLOCK-END
*/
285 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
286 ON VALUE-CHANGED
OF br_table
IN FRAME F-Main
288 /* This ADM trigger code must be preserved in order to notify other
289 objects when the browser's current row changes.
*/
290 {src
/adm
/template
/brschnge.i
}
293 /* _UIB-CODE-BLOCK-END
*/
299 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
302 /* *************************** Main Block
*************************** */
304 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
305 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
308 /* _UIB-CODE-BLOCK-END
*/
312 /* ********************** Internal Procedures
*********************** */
314 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
315 PROCEDURE adm-open-query-cases
:
316 /*------------------------------------------------------------------------------
317 Purpose
: Opens different cases of the query based on attributes
318 such as the 'Key-Name'
, or 'SortBy-Case'
320 ------------------------------------------------------------------------------*/
321 DEF VAR key-value
AS CHAR NO-UNDO.
323 /* Look up the current key-value.
*/
324 RUN get-attribute
('Key-Value'
:U
).
325 key-value
= RETURN-VALUE.
327 /* Find the current record using the current Key-Name.
*/
328 RUN get-attribute
('Key-Name'
:U
).
330 WHEN 'FlowTaskType'
:U
THEN DO:
331 &Scope KEY-PHRASE FlowRule.FlowTaskType eq key-value
332 {&OPEN-QUERY-{&BROWSE-NAME}}
333 END.
/* FlowTaskType
*/
334 WHEN 'NextTaskType'
:U
THEN DO:
335 &Scope KEY-PHRASE FlowRule.NextTaskType eq key-value
336 {&OPEN-QUERY-{&BROWSE-NAME}}
337 END.
/* NextTaskType
*/
338 WHEN 'NextStepType'
:U
THEN DO:
339 &Scope KEY-PHRASE FlowRule.NextStepType eq key-value
340 {&OPEN-QUERY-{&BROWSE-NAME}}
341 END.
/* NextStepType
*/
342 WHEN 'FlowStepType'
:U
THEN DO:
343 &Scope KEY-PHRASE FlowRule.FlowStepType eq key-value
344 {&OPEN-QUERY-{&BROWSE-NAME}}
345 END.
/* FlowStepType
*/
347 &Scope KEY-PHRASE TRUE
348 {&OPEN-QUERY-{&BROWSE-NAME}}
349 END.
/* OTHERWISE...
*/
354 /* _UIB-CODE-BLOCK-END
*/
358 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
359 PROCEDURE adm-row-available
:
360 /*------------------------------------------------------------------------------
361 Purpose
: Dispatched to this procedure when the Record-
362 Source has a new row available. This procedure
363 tries to get the new row
(or foriegn keys
) from
364 the Record-Source and process it.
366 ------------------------------------------------------------------------------*/
368 /* Define variables needed by this internal procedure.
*/
369 {src
/adm
/template
/row-head.i
}
371 /* Process the newly available records
(i.e. display fields
,
372 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
373 {src
/adm
/template
/row-end.i
}
377 /* _UIB-CODE-BLOCK-END
*/
381 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
382 PROCEDURE disable_UI
:
383 /*------------------------------------------------------------------------------
384 Purpose
: DISABLE the User Interface
386 Notes
: Here we clean-up the user-interface by deleting
387 dynamic widgets we have created and
/or hide
388 frames. This procedure is usually called when
389 we are ready to
"clean-up" after running.
390 ------------------------------------------------------------------------------*/
391 /* Hide all frames.
*/
393 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
396 /* _UIB-CODE-BLOCK-END
*/
400 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE internal-send-key B-table-Win adm/support/_key-snd.p
401 PROCEDURE internal-send-key
:
402 /*------------------------------------------------------------------------------
403 Purpose
: Sends a requested
KEY value back to the calling
405 Parameters
: <see adm
/template
/sndkytop.i
>
406 ------------------------------------------------------------------------------*/
408 /* Define variables needed by this internal procedure.
*/
409 {src
/adm
/template
/sndkytop.i
}
411 /* Return the key value associated with each key case.
*/
412 {src
/adm
/template
/sndkycas.i
"FlowTaskType" "FlowRule" "FlowTaskType"}
413 {src
/adm
/template
/sndkycas.i
"NextTaskType" "FlowRule" "NextTaskType"}
414 {src
/adm
/template
/sndkycas.i
"NextStepType" "FlowRule" "NextStepType"}
415 {src
/adm
/template
/sndkycas.i
"FlowRuleType" "FlowRule" "FlowRuleType"}
416 {src
/adm
/template
/sndkycas.i
"FlowStepType" "FlowRule" "FlowStepType"}
418 /* Close the
CASE statement and end the procedure.
*/
419 {src
/adm
/template
/sndkyend.i
}
423 /* _UIB-CODE-BLOCK-END
*/
427 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-delete-record B-table-Win
428 PROCEDURE local-delete-record
:
429 /*------------------------------------------------------------------------------
430 Purpose
: Override standard ADM method
432 ------------------------------------------------------------------------------*/
433 DEF VAR yes-do-it
AS LOGI
NO-UNDO INITIAL Yes.
435 IF NOT AVAILABLE(FlowRule
) THEN RETURN.
437 MESSAGE "Are you sure you want to delete" SKIP
438 "the current Workflow Rule record?"
439 VIEW-AS ALERT-BOX QUESTION BUTTONS OK-CANCEL
440 TITLE "Are you sure?" UPDATE yes-do-it .
442 IF yes-do-it
THEN DO TRANSACTION:
443 FIND CURRENT FlowRule
EXCLUSIVE-LOCK.
445 RUN dispatch
( 'open-query'
:U
).
449 /* _UIB-CODE-BLOCK-END
*/
453 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-open-query-cases B-table-Win
454 PROCEDURE local-open-query-cases
:
455 /*------------------------------------------------------------------------------
456 Purpose
: Override standard ADM method
457 Notes
: We do this because we are browsing on a two-part key
,
458 the other part of which is
(if necessary
) set in the
459 use-Key-Value routine.
460 ------------------------------------------------------------------------------*/
462 /* Find the current record using the current Key-Name.
*/
464 WHEN 'FlowTaskType'
:U
THEN DO:
465 &Scope KEY-PHRASE FlowRule.FlowTaskType eq key-value
466 {&OPEN-QUERY-{&BROWSE-NAME}}
467 END.
/* FlowTaskType
*/
468 WHEN 'NextTaskType'
:U
THEN DO:
469 &Scope KEY-PHRASE FlowRule.NextTaskType eq key-value
470 {&OPEN-QUERY-{&BROWSE-NAME}}
471 END.
/* NextTaskType
*/
472 WHEN 'NextStepType'
:U
THEN DO:
473 &Scope KEY-PHRASE FlowRule.NextTaskType eq task-key-value ~
474 AND FlowRule.NextStepType eq key-value
475 {&OPEN-QUERY-{&BROWSE-NAME}}
476 END.
/* NextStepType
*/
477 WHEN 'FlowStepType'
:U
THEN DO:
478 &Scope KEY-PHRASE FlowRule.FlowTaskType eq task-key-value ~
479 AND FlowRule.FlowStepType eq key-value
480 {&OPEN-QUERY-{&BROWSE-NAME}}
481 END.
/* FlowStepType
*/
483 &Scope KEY-PHRASE TRUE
484 {&OPEN-QUERY-{&BROWSE-NAME}}
485 END.
/* OTHERWISE...
*/
490 /* _UIB-CODE-BLOCK-END
*/
494 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win
496 /*------------------------------------------------------------------------------
497 Purpose
: Override the standard send-key routine.
498 ------------------------------------------------------------------------------*/
499 /* definition from src
/adm
/template
/sndkytop.i
*/
500 DEFINE INPUT PARAMETER pc_key-name
AS CHARACTER NO-UNDO.
501 DEFINE OUTPUT PARAMETER pc_key-value
AS CHARACTER NO-UNDO INITIAL ?.
504 MESSAGE "Sending key" pc_key-name
SKIP
505 "could send" key-name
"which is" key-value
SKIP
506 "record is" (IF AVAILABLE(FlowStepType
) THEN "" ELSE "not ") + "available".
509 IF NOT AVAILABLE(FlowRule
) THEN DO:
510 IF pc_key-name
= "FlowStepType"
511 AND (key-name
= "FlowStepType" OR key-name
= "NextStepType") THEN DO:
512 pc_key-value
= key-value.
513 /* MESSAGE "Returning" pc_key-value
"for" pc_key-name.
*/
516 IF pc_key-name
= "FlowTaskType"
517 AND (key-name
= "FlowStepType" OR key-name
= "NextStepType") THEN DO:
518 IF key-name
= "FlowStepType" THEN
519 pc_key-value
= find-parent-key
( "FlowTaskType" ).
521 pc_key-value
= find-parent-key
( "NextTaskType" ).
522 /* MESSAGE "Returning" pc_key-value
"for" pc_key-name.
*/
527 RUN internal-send-key
( pc_key-name
, OUTPUT pc_key-value
).
531 /* _UIB-CODE-BLOCK-END
*/
535 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
536 PROCEDURE send-records
:
537 /*------------------------------------------------------------------------------
538 Purpose
: Send record
ROWID's for all tables used by
540 Parameters
: see template
/snd-head.i
541 ------------------------------------------------------------------------------*/
543 /* Define variables needed by this internal procedure.
*/
544 {src
/adm
/template
/snd-head.i
}
546 /* For each requested table
, put it's
ROWID in the output list.
*/
547 {src
/adm
/template
/snd-list.i
"FlowRule"}
549 /* Deal with any unexpected table requests before closing.
*/
550 {src
/adm
/template
/snd-end.i
}
554 /* _UIB-CODE-BLOCK-END
*/
558 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
559 PROCEDURE state-changed
:
560 /* -----------------------------------------------------------
564 -------------------------------------------------------------*/
565 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
566 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
569 /* Object instance CASEs can go here to replace standard behavior
571 {src
/adm
/template
/bstates.i
}
575 /* _UIB-CODE-BLOCK-END
*/
579 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Name B-table-Win
580 PROCEDURE use-Key-Name
:
581 /*------------------------------------------------------------------------------
583 ------------------------------------------------------------------------------*/
584 DEF INPUT PARAMETER new-key-name
AS CHAR NO-UNDO.
585 key-name
= new-key-name.
588 /* _UIB-CODE-BLOCK-END
*/
592 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-key-value B-table-Win
593 PROCEDURE use-key-value
:
594 /*------------------------------------------------------------------------------
596 ------------------------------------------------------------------------------*/
597 DEF INPUT PARAMETER new-key-value
AS CHAR NO-UNDO.
598 key-value
= new-key-value.
600 IF key-name
= "NextStepType" THEN
601 task-key-value
= find-parent-key
( "NextTaskType" ).
602 ELSE IF key-name
= "FlowStepType" THEN
603 task-key-value
= find-parent-key
( "FlowTaskType" ).
609 /* _UIB-CODE-BLOCK-END
*/