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.
29 /* _UIB-CODE-BLOCK-END
*/
33 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
35 /* ******************** Preprocessor Definitions
******************** */
37 &Scoped-define PROCEDURE-TYPE SmartBrowser
39 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
41 /* Name of first Frame and
/or Browse and
/or first Query
*/
42 &Scoped-define FRAME-NAME F-Main
43 &Scoped-define BROWSE-NAME br_table
45 /* Internal Tables
(found by Frame
, Query
& Browse Queries) */
46 &Scoped-define INTERNAL-TABLES FlowStepType
48 /* Define KEY-PHRASE in case it is used by any query.
*/
49 &Scoped-define KEY-PHRASE TRUE
51 /* Definitions for
BROWSE br_table
*/
52 &Scoped-define FIELDS-IN-QUERY-br_table FlowStepType.FlowTaskType ~
53 FlowStepType.FlowStepType FlowStepType.Description ~
54 FlowStepType.InitialStatus FlowStepType.InitialPriority ~
55 FlowStepType.WarnPeriod FlowStepType.WarnUnits
56 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table
57 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table
58 &Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH FlowStepType WHERE ~{&KEY-PHRASE} NO-LOCK ~
60 &Scoped-define TABLES-IN-QUERY-br_table FlowStepType
61 &Scoped-define FIRST-TABLE-IN-QUERY-br_table FlowStepType
64 /* Definitions for
FRAME F-Main
*/
66 /* Standard List Definitions
*/
67 &Scoped-Define ENABLED-OBJECTS br_table
69 /* Custom List Definitions
*/
70 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
72 /* _UIB-PREPROCESSOR-BLOCK-END
*/
76 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
77 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
83 FlowTaskType|y|y|TTPL.FlowStepType.FlowTaskType
84 NextTaskType||y|TTPL.FlowStepType.FlowTaskType
85 FlowStepType||y|TTPL.FlowStepType.FlowStepType
86 NextStepType||y|TTPL.FlowStepType.FlowStepType
89 **************************
90 * Set attributes related to FOREIGN
KEYS
92 RUN set-attribute-list
(
93 'Keys-Accepted
= "FlowTaskType",
94 Keys-Supplied
= "FlowTaskType,NextTaskType,FlowStepType,NextStepType"'
:U
).
96 /* Tell the ADM to use the OPEN-QUERY-CASES.
*/
97 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
98 /**************************
100 /* _UIB-CODE-BLOCK-END
*/
103 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
104 /* Actions
: ? adm
/support
/advqedit.w ? ? ?
*/
112 ************************
113 * Set attributes related to SORTBY-OPTIONS
*/
114 RUN set-attribute-list
(
115 'SortBy-Options
= ""'
:U
).
116 /************************
119 </FILTER-ATTRIBUTES
> */
121 /* _UIB-CODE-BLOCK-END
*/
125 /* *********************** Control Definitions
********************** */
128 /* Definitions of the field level widgets
*/
129 /* Query definitions
*/
131 DEFINE QUERY br_table
FOR
132 FlowStepType
SCROLLING.
135 /* Browse definitions
*/
136 DEFINE BROWSE br_table
137 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _STRUCTURED
138 QUERY br_table
NO-LOCK DISPLAY
139 FlowStepType.FlowTaskType
COLUMN-LABEL "Task Type"
140 FlowStepType.FlowStepType
COLUMN-LABEL "Step Type Code"
141 FlowStepType.Description
142 FlowStepType.InitialStatus
COLUMN-LABEL "Init. Status"
143 FlowStepType.InitialPriority
COLUMN-LABEL "Init. Priority"
144 FlowStepType.WarnPeriod
145 FlowStepType.WarnUnits
146 /* _UIB-CODE-BLOCK-END
*/
148 WITH NO-ASSIGN SEPARATORS SIZE 84.57 BY 12.8
152 /* ************************ Frame Definitions
*********************** */
155 br_table
AT ROW 1 COL 1
156 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
157 SIDE-LABELS NO-UNDERLINE THREE-D
158 AT COL 1 ROW 1 SCROLLABLE
159 BGCOLOR 8 FGCOLOR 0 .
162 /* *********************** Procedure Settings
************************ */
164 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
165 /* Settings for
THIS-PROCEDURE
169 Add Fields to
: EXTERNAL-TABLES
170 Other Settings
: PERSISTENT-ONLY
COMPILE
173 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
174 /* then cleanup and return.
*/
175 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
176 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
177 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
181 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
183 /* ************************* Create Window
************************** */
185 &ANALYZE-SUSPEND _CREATE-WINDOW
186 /* DESIGN Window definition
(used by the UIB
)
187 CREATE WINDOW B-table-Win
ASSIGN
190 /* END WINDOW DEFINITION
*/
195 /* *************** Runtime Attributes and UIB Settings
************** */
197 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
198 /* SETTINGS
FOR WINDOW B-table-Win
199 NOT-VISIBLE
,,RUN-PERSISTENT
*/
200 /* SETTINGS
FOR FRAME F-Main
201 NOT-VISIBLE Size-to-Fit
*/
202 /* BROWSE-TAB br_table
1 F-Main
*/
204 FRAME F-Main
:SCROLLABLE = FALSE
205 FRAME F-Main
:HIDDEN = TRUE.
207 /* _RUN-TIME-ATTRIBUTES-END
*/
211 /* Setting information for Queries and Browse Widgets fields
*/
213 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
214 /* Query rebuild information for
BROWSE br_table
215 _TblList
= "TTPL.FlowStepType"
216 _Options
= "NO-LOCK KEY-PHRASE SORTBY-PHRASE"
217 _FldNameList
[1] > TTPL.FlowStepType.FlowTaskType
218 "FlowTaskType" "Task Type" ?
"character" ? ? ? ? ? ? no ?
219 _FldNameList
[2] > TTPL.FlowStepType.FlowStepType
220 "FlowStepType" "Step Type Code" ?
"character" ? ? ? ? ? ? no ?
221 _FldNameList
[3] = TTPL.FlowStepType.Description
222 _FldNameList
[4] > TTPL.FlowStepType.InitialStatus
223 "InitialStatus" "Init. Status" ?
"character" ? ? ? ? ? ? no ?
224 _FldNameList
[5] > TTPL.FlowStepType.InitialPriority
225 "InitialPriority" "Init. Priority" ?
"integer" ? ? ? ? ? ? no ?
226 _FldNameList
[6] = TTPL.FlowStepType.WarnPeriod
227 _FldNameList
[7] = TTPL.FlowStepType.WarnUnits
229 */ /* BROWSE br_table
*/
232 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
233 /* Query rebuild information for
FRAME F-Main
236 */ /* FRAME F-Main
*/
242 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
243 /* ************************* Included-Libraries
*********************** */
245 {src
/adm
/method
/browser.i
}
246 {inc
/method
/m-drlvwr.i
}
248 /* _UIB-CODE-BLOCK-END
*/
254 /* ************************ Control Triggers
************************ */
256 &Scoped-define BROWSE-NAME br_table
257 &Scoped-define SELF-NAME br_table
258 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
259 ON ROW-ENTRY
OF br_table
IN FRAME F-Main
261 /* This code displays initial values for newly added or copied rows.
*/
262 {src
/adm
/template
/brsentry.i
}
265 /* _UIB-CODE-BLOCK-END
*/
269 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
270 ON ROW-LEAVE
OF br_table
IN FRAME F-Main
272 /* Do not disable this code or no updates will take place except
273 by pressing the Save button on an Update SmartPanel.
*/
274 {src
/adm
/template
/brsleave.i
}
277 /* _UIB-CODE-BLOCK-END
*/
281 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
282 ON VALUE-CHANGED
OF br_table
IN FRAME F-Main
284 /* This ADM trigger code must be preserved in order to notify other
285 objects when the browser's current row changes.
*/
286 {src
/adm
/template
/brschnge.i
}
289 /* _UIB-CODE-BLOCK-END
*/
295 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
298 /* *************************** Main Block
*************************** */
300 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
301 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
304 /* _UIB-CODE-BLOCK-END
*/
308 /* ********************** Internal Procedures
*********************** */
310 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
311 PROCEDURE adm-open-query-cases
:
312 /*------------------------------------------------------------------------------
313 Purpose
: Opens different cases of the query based on attributes
314 such as the 'Key-Name'
, or 'SortBy-Case'
316 ------------------------------------------------------------------------------*/
317 DEF VAR key-value
AS CHAR NO-UNDO.
319 /* Look up the current key-value.
*/
320 RUN get-attribute
('Key-Value'
:U
).
321 key-value
= RETURN-VALUE.
323 /* Find the current record using the current Key-Name.
*/
324 RUN get-attribute
('Key-Name'
:U
).
326 WHEN 'FlowTaskType'
:U
THEN DO:
327 &Scope KEY-PHRASE FlowStepType.FlowTaskType eq key-value
328 {&OPEN-QUERY-{&BROWSE-NAME}}
329 END.
/* FlowTaskType
*/
331 &Scope KEY-PHRASE TRUE
332 {&OPEN-QUERY-{&BROWSE-NAME}}
333 END.
/* OTHERWISE...
*/
338 /* _UIB-CODE-BLOCK-END
*/
342 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
343 PROCEDURE adm-row-available
:
344 /*------------------------------------------------------------------------------
345 Purpose
: Dispatched to this procedure when the Record-
346 Source has a new row available. This procedure
347 tries to get the new row
(or foriegn keys
) from
348 the Record-Source and process it.
350 ------------------------------------------------------------------------------*/
352 /* Define variables needed by this internal procedure.
*/
353 {src
/adm
/template
/row-head.i
}
355 /* Process the newly available records
(i.e. display fields
,
356 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
357 {src
/adm
/template
/row-end.i
}
361 /* _UIB-CODE-BLOCK-END
*/
365 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
366 PROCEDURE disable_UI
:
367 /*------------------------------------------------------------------------------
368 Purpose
: DISABLE the User Interface
370 Notes
: Here we clean-up the user-interface by deleting
371 dynamic widgets we have created and
/or hide
372 frames. This procedure is usually called when
373 we are ready to
"clean-up" after running.
374 ------------------------------------------------------------------------------*/
375 /* Hide all frames.
*/
377 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
380 /* _UIB-CODE-BLOCK-END
*/
384 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE internal-send-key B-table-Win adm/support/_key-snd.p
385 PROCEDURE internal-send-key
:
386 /*------------------------------------------------------------------------------
387 Purpose
: Sends a requested
KEY value back to the calling
389 Parameters
: <see adm
/template
/sndkytop.i
>
390 ------------------------------------------------------------------------------*/
392 /* Define variables needed by this internal procedure.
*/
393 {src
/adm
/template
/sndkytop.i
}
395 /* Return the key value associated with each key case.
*/
396 {src
/adm
/template
/sndkycas.i
"FlowTaskType" "FlowStepType" "FlowTaskType"}
397 {src
/adm
/template
/sndkycas.i
"NextTaskType" "FlowStepType" "FlowTaskType"}
398 {src
/adm
/template
/sndkycas.i
"FlowStepType" "FlowStepType" "FlowStepType"}
399 {src
/adm
/template
/sndkycas.i
"NextStepType" "FlowStepType" "FlowStepType"}
401 /* Close the
CASE statement and end the procedure.
*/
402 {src
/adm
/template
/sndkyend.i
}
406 /* _UIB-CODE-BLOCK-END
*/
410 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE local-delete-record B-table-Win
411 PROCEDURE local-delete-record
:
412 /*------------------------------------------------------------------------------
413 Purpose
: Override standard ADM method
415 ------------------------------------------------------------------------------*/
416 DEF VAR yes-do-it
AS LOGI
NO-UNDO INITIAL Yes.
418 IF NOT AVAILABLE(FlowStepType
) THEN RETURN.
420 MESSAGE "Are you sure you want to delete" SKIP
421 "the current Workflow Step record?"
422 VIEW-AS ALERT-BOX QUESTION BUTTONS OK-CANCEL
423 TITLE "Are you sure?" UPDATE yes-do-it .
425 IF yes-do-it
THEN DO TRANSACTION:
426 FIND CURRENT FlowStepType
EXCLUSIVE-LOCK.
428 RUN dispatch
( 'open-query'
:U
).
432 /* _UIB-CODE-BLOCK-END
*/
436 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win
438 /*------------------------------------------------------------------------------
439 Purpose
: Override the standard send-key routine.
440 ------------------------------------------------------------------------------*/
441 /* definition from src
/adm
/template
/sndkytop.i
*/
442 DEFINE INPUT PARAMETER pc_key-name
AS CHARACTER NO-UNDO.
443 DEFINE OUTPUT PARAMETER pc_key-value
AS CHARACTER NO-UNDO INITIAL ?.
445 MESSAGE "Sending key" pc_key-name
SKIP
446 "could send" key-name
"which is" key-value
SKIP
447 "record is" (IF AVAILABLE(FlowStepType
) THEN "" ELSE "not ") + "available".
449 IF NOT AVAILABLE(FlowStepType
) THEN DO:
450 IF (pc_key-name
= "FlowTaskType" OR pc_key-name
= "NextTaskType")
451 AND key-name
= "FlowTaskType" THEN DO:
452 pc_key-value
= key-value.
457 RUN internal-send-key
( pc_key-name
, OUTPUT pc_key-value
).
461 /* _UIB-CODE-BLOCK-END
*/
465 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
466 PROCEDURE send-records
:
467 /*------------------------------------------------------------------------------
468 Purpose
: Send record
ROWID's for all tables used by
470 Parameters
: see template
/snd-head.i
471 ------------------------------------------------------------------------------*/
473 /* Define variables needed by this internal procedure.
*/
474 {src
/adm
/template
/snd-head.i
}
476 /* For each requested table
, put it's
ROWID in the output list.
*/
477 {src
/adm
/template
/snd-list.i
"FlowStepType"}
479 /* Deal with any unexpected table requests before closing.
*/
480 {src
/adm
/template
/snd-end.i
}
484 /* _UIB-CODE-BLOCK-END
*/
488 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
489 PROCEDURE state-changed
:
490 /* -----------------------------------------------------------
494 -------------------------------------------------------------*/
495 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
496 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
499 /* Object instance CASEs can go here to replace standard behavior
501 {src
/adm
/template
/bstates.i
}
505 /* _UIB-CODE-BLOCK-END
*/
509 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-Key-Name B-table-Win
510 PROCEDURE use-Key-Name
:
511 /*------------------------------------------------------------------------------
513 ------------------------------------------------------------------------------*/
514 DEF INPUT PARAMETER new-key-name
AS CHAR NO-UNDO.
515 key-name
= new-key-name.
518 /* _UIB-CODE-BLOCK-END
*/
522 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-key-value B-table-Win
523 PROCEDURE use-key-value
:
524 /*------------------------------------------------------------------------------
526 ------------------------------------------------------------------------------*/
527 DEF INPUT PARAMETER new-key-value
AS CHAR NO-UNDO.
528 key-value
= new-key-value.
531 /* _UIB-CODE-BLOCK-END
*/