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 ------------------------------------------------------------------------*/
21 /* This .W file was created with the Progress UIB.
*/
22 /*----------------------------------------------------------------------*/
24 /* Create an unnamed pool to store all the widgets created
25 by this procedure. This is a good default which assures
26 that this procedure's triggers and internal procedures
27 will execute in this procedure's storage
, and that proper
28 cleanup will occur on deletion of the procedure.
*/
32 /* *************************** Definitions
************************** */
34 /* Parameters Definitions
--- */
36 /* Local Variable Definitions
--- */
38 DEF VAR this-office
LIKE Office.Officecode
NO-UNDO.
39 DEF VAR repl-date
AS CHAR FORMAT "X(12)" LABEL "Date" NO-UNDO.
40 DEF VAR repl-time
AS CHAR FORMAT "X(12)" LABEL "Time" NO-UNDO.
41 DEF VAR all-trans
AS LOGI
NO-UNDO.
43 /* _UIB-CODE-BLOCK-END
*/
47 &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK
49 /* ******************** Preprocessor Definitions
******************** */
51 &Scoped-define PROCEDURE-TYPE SmartBrowser
53 &Scoped-define ADM-SUPPORTED-LINKS Record-Source,Record-Target,TableIO-Target
55 /* Name of first Frame and
/or Browse and
/or first Query
*/
56 &Scoped-define FRAME-NAME F-Main
57 &Scoped-define BROWSE-NAME br_table
59 /* Internal Tables
(found by Frame
, Query
& Browse Queries) */
60 &Scoped-define INTERNAL-TABLES ReplLog
62 /* Define KEY-PHRASE in case it is used by any query.
*/
63 &Scoped-define KEY-PHRASE TRUE
65 /* Definitions for
BROWSE br_table
*/
66 &Scoped-define FIELDS-IN-QUERY-br_table ~
67 STRING( ReplLog.ReplDate
, '
99/99/9999'
) @ repl-date ReplLog.TableToRepl ~
68 STRING( ReplLog.ReplTime
, 'HH
:MM
:SS'
) @ repl-time ReplLog.DumpFile ~
69 ReplLog.ReplEvent ReplLog.TransActID ReplLog.ReplId
70 &Scoped-define ENABLED-FIELDS-IN-QUERY-br_table
71 &Scoped-define FIELD-PAIRS-IN-QUERY-br_table
72 &Scoped-define OPEN-QUERY-br_table OPEN QUERY br_table FOR EACH ReplLog WHERE ~{&KEY-PHRASE} ~
73 AND ReplLog.OfficeCode
= this-office
AND ~
74 ( all-trans
OR ReplLog.ReplDate
= TODAY ) NO-LOCK ~
76 &Scoped-define TABLES-IN-QUERY-br_table ReplLog
77 &Scoped-define FIRST-TABLE-IN-QUERY-br_table ReplLog
80 /* Definitions for
FRAME F-Main
*/
82 /* Standard List Definitions
*/
83 &Scoped-Define ENABLED-OBJECTS br_table
85 /* Custom List Definitions
*/
86 /* List-1
,List-2
,List-3
,List-4
,List-5
,List-6
*/
88 /* _UIB-PREPROCESSOR-BLOCK-END
*/
92 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Foreign Keys" B-table-Win _INLINE
93 /* Actions
: ? adm
/support
/keyedit.w ? ? ?
*/
99 OfficeCode|y|y|ttpl.ReplLog.OfficeCode
100 TableToRepl||y|ttpl.ReplLog.TableToRepl
103 **************************
104 * Set attributes related to FOREIGN
KEYS
106 RUN set-attribute-list
(
107 'Keys-Accepted
= "OfficeCode",
108 Keys-Supplied
= "OfficeCode,TableToRepl"'
:U
).
110 /* Tell the ADM to use the OPEN-QUERY-CASES.
*/
111 &Scoped-define OPEN-QUERY-CASES RUN dispatch ('open-query-cases':U).
112 /**************************
114 /* _UIB-CODE-BLOCK-END
*/
117 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Advanced Query Options" B-table-Win _INLINE
118 /* Actions
: ? adm
/support
/advqedit.w ? ? ?
*/
126 ************************
127 * Set attributes related to SORTBY-OPTIONS
*/
128 RUN set-attribute-list
(
129 'SortBy-Options
= ""'
:U
).
130 /************************
133 </FILTER-ATTRIBUTES
> */
135 /* _UIB-CODE-BLOCK-END
*/
139 /* *********************** Control Definitions
********************** */
142 /* Definitions of the field level widgets
*/
143 /* Query definitions
*/
145 DEFINE QUERY br_table
FOR
149 /* Browse definitions
*/
150 DEFINE BROWSE br_table
151 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _DISPLAY-FIELDS br_table B-table-Win _STRUCTURED
152 QUERY br_table
NO-LOCK DISPLAY
153 STRING( ReplLog.ReplDate
, '
99/99/9999'
) @ repl-date
154 ReplLog.TableToRepl
FORMAT "X(15)"
155 STRING( ReplLog.ReplTime
, 'HH
:MM
:SS'
) @ repl-time
156 ReplLog.DumpFile
COLUMN-LABEL "File" FORMAT "X(50)"
160 /* _UIB-CODE-BLOCK-END
*/
162 WITH NO-ASSIGN SEPARATORS SIZE 77.72 BY 14
166 /* ************************ Frame Definitions
*********************** */
169 br_table
AT ROW 1 COL 1
170 WITH 1 DOWN NO-BOX KEEP-TAB-ORDER OVERLAY
171 SIDE-LABELS NO-UNDERLINE THREE-D
172 AT COL 1 ROW 1 SCROLLABLE
176 /* *********************** Procedure Settings
************************ */
178 &ANALYZE-SUSPEND _PROCEDURE-SETTINGS
179 /* Settings for
THIS-PROCEDURE
183 Add Fields to
: EXTERNAL-TABLES
184 Other Settings
: PERSISTENT-ONLY
COMPILE
187 /* This procedure should always be
RUN PERSISTENT. Report the error
, */
188 /* then cleanup and return.
*/
189 IF NOT THIS-PROCEDURE:PERSISTENT THEN DO:
190 MESSAGE "{&FILE-NAME} should only be RUN PERSISTENT."
191 VIEW-AS ALERT-BOX ERROR BUTTONS OK.
195 &ANALYZE-RESUME _END-PROCEDURE-SETTINGS
197 /* ************************* Create Window
************************** */
199 &ANALYZE-SUSPEND _CREATE-WINDOW
200 /* DESIGN Window definition
(used by the UIB
)
201 CREATE WINDOW B-table-Win
ASSIGN
204 /* END WINDOW DEFINITION
*/
209 /* *************** Runtime Attributes and UIB Settings
************** */
211 &ANALYZE-SUSPEND _RUN-TIME-ATTRIBUTES
212 /* SETTINGS
FOR WINDOW B-table-Win
213 NOT-VISIBLE
,,RUN-PERSISTENT
*/
214 /* SETTINGS
FOR FRAME F-Main
215 NOT-VISIBLE Size-to-Fit
*/
216 /* BROWSE-TAB br_table
1 F-Main
*/
218 FRAME F-Main
:SCROLLABLE = FALSE
219 FRAME F-Main
:HIDDEN = TRUE.
221 /* _RUN-TIME-ATTRIBUTES-END
*/
225 /* Setting information for Queries and Browse Widgets fields
*/
227 &ANALYZE-SUSPEND _QUERY-BLOCK BROWSE br_table
228 /* Query rebuild information for
BROWSE br_table
229 _TblList
= "ttpl.ReplLog"
230 _Options
= "NO-LOCK KEY-PHRASE SORTBY-PHRASE"
231 _Where
[1] = "ReplLog.OfficeCode = this-office AND
232 ( all-trans OR ReplLog.ReplDate = TODAY )"
233 _FldNameList
[1] > "_<CALC>"
234 "STRING( ReplLog.ReplDate, '99/99/9999' ) @ repl-date" ? ? ? ? ? ? ? ? ? no ?
235 _FldNameList
[2] > ttpl.ReplLog.TableToRepl
236 "ReplLog.TableToRepl" ?
"X(15)" "character" ? ? ? ? ? ? no ?
237 _FldNameList
[3] > "_<CALC>"
238 "STRING( ReplLog.ReplTime, 'HH:MM:SS' ) @ repl-time" ? ? ? ? ? ? ? ? ? no ?
239 _FldNameList
[4] > ttpl.ReplLog.DumpFile
240 "ReplLog.DumpFile" "File" "X(50)" "character" ? ? ? ? ? ? no ?
241 _FldNameList
[5] = ttpl.ReplLog.ReplEvent
242 _FldNameList
[6] = ttpl.ReplLog.TransActID
243 _FldNameList
[7] = ttpl.ReplLog.ReplId
245 */ /* BROWSE br_table
*/
248 &ANALYZE-SUSPEND _QUERY-BLOCK FRAME F-Main
249 /* Query rebuild information for
FRAME F-Main
252 */ /* FRAME F-Main
*/
258 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB B-table-Win
259 /* ************************* Included-Libraries
*********************** */
261 {src
/adm
/method
/browser.i
}
262 {inc
/method
/m-drlvwr.i
}
264 /* _UIB-CODE-BLOCK-END
*/
270 /* ************************ Control Triggers
************************ */
272 &Scoped-define BROWSE-NAME br_table
273 &Scoped-define SELF-NAME br_table
274 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
275 ON ROW-DISPLAY
OF br_table
IN FRAME F-Main
277 DEF VAR fgcolor
AS INT NO-UNDO.
279 IF NOT AVAILABLE ReplLog
THEN RETURN.
280 CASE ReplLog.ReplEvent
:
281 WHEN "C" THEN fgcolor
= 2.
282 WHEN "M" THEN fgcolor
= 1.
283 WHEN "D" THEN fgcolor
= 12.
284 OTHERWISE fgcolor
= ?.
287 ASSIGN repl-date
:FGCOLOR IN BROWSE {&BROWSE-NAME} = fgcolor
288 repl-time
:FGCOLOR = fgcolor
289 ReplLog.TableToRepl
:FGCOLOR = fgcolor
290 ReplLog.DumpFile
:FGCOLOR = fgcolor
291 ReplLog.ReplEvent
:FGCOLOR = fgcolor.
295 /* _UIB-CODE-BLOCK-END
*/
299 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
300 ON ROW-ENTRY
OF br_table
IN FRAME F-Main
302 /* This code displays initial values for newly added or copied rows.
*/
303 {src
/adm
/template
/brsentry.i
}
306 /* _UIB-CODE-BLOCK-END
*/
310 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
311 ON ROW-LEAVE
OF br_table
IN FRAME F-Main
313 /* Do not disable this code or no updates will take place except
314 by pressing the Save button on an Update SmartPanel.
*/
315 {src
/adm
/template
/brsleave.i
}
318 /* _UIB-CODE-BLOCK-END
*/
322 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CONTROL br_table B-table-Win
323 ON VALUE-CHANGED
OF br_table
IN FRAME F-Main
325 /* This ADM trigger code must be preserved in order to notify other
326 objects when the browser's current row changes.
*/
327 {src
/adm
/template
/brschnge.i
}
331 /* _UIB-CODE-BLOCK-END
*/
337 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK B-table-Win
340 /* *************************** Main Block
*************************** */
342 &IF DEFINED(UIB_IS_RUNNING) <> 0 &THEN
343 RUN dispatch
IN THIS-PROCEDURE ('initialize'
:U
).
347 this-office
= Office.OfficeCode.
349 /* Set up the filter attributes
*/
351 RUN set-attribute-list
( 'FilterBy-Options
= Today|All
, FilterBy-Case
= All'
).
353 /* _UIB-CODE-BLOCK-END
*/
357 /* ********************** Internal Procedures
*********************** */
359 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-open-query-cases B-table-Win adm/support/_adm-opn.p
360 PROCEDURE adm-open-query-cases
:
361 /*------------------------------------------------------------------------------
362 Purpose
: Opens different cases of the query based on attributes
363 such as the 'Key-Name'
, or 'SortBy-Case'
365 ------------------------------------------------------------------------------*/
366 DEF VAR key-value
AS CHAR NO-UNDO.
368 /* Look up the current key-value.
*/
369 RUN get-attribute
('Key-Value'
:U
).
370 key-value
= RETURN-VALUE.
372 /* Find the current record using the current Key-Name.
*/
373 RUN get-attribute
('Key-Name'
:U
).
375 WHEN 'OfficeCode'
:U
THEN DO:
376 &Scope KEY-PHRASE ReplLog.OfficeCode eq key-value
377 {&OPEN-QUERY-{&BROWSE-NAME}}
378 END.
/* OfficeCode
*/
380 &Scope KEY-PHRASE TRUE
381 {&OPEN-QUERY-{&BROWSE-NAME}}
382 END.
/* OTHERWISE...
*/
387 /* _UIB-CODE-BLOCK-END
*/
391 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE adm-row-available B-table-Win _ADM-ROW-AVAILABLE
392 PROCEDURE adm-row-available
:
393 /*------------------------------------------------------------------------------
394 Purpose
: Dispatched to this procedure when the Record-
395 Source has a new row available. This procedure
396 tries to get the new row
(or foriegn keys
) from
397 the Record-Source and process it.
399 ------------------------------------------------------------------------------*/
401 /* Define variables needed by this internal procedure.
*/
402 {src
/adm
/template
/row-head.i
}
404 /* Process the newly available records
(i.e. display fields
,
405 open queries
, and
/or pass records on to any RECORD-TARGETS
).
*/
406 {src
/adm
/template
/row-end.i
}
410 /* _UIB-CODE-BLOCK-END
*/
414 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE can-dump-changes B-table-Win
415 PROCEDURE can-dump-changes
:
416 /*------------------------------------------------------------------------------
420 ------------------------------------------------------------------------------*/
422 RUN set-link-attributes
IN sys-mgr
( THIS-PROCEDURE, "dump-changes",
423 "SENSITIVE = " + IF CAN-FIND( FIRST ReplLog
WHERE ReplLog.OfficeCode
= this-office
424 AND ReplLog.Dumpfile
= "" ) THEN "Yes" ELSE "No" ).
428 /* _UIB-CODE-BLOCK-END
*/
432 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE disable_UI B-table-Win _DEFAULT-DISABLE
433 PROCEDURE disable_UI
:
434 /*------------------------------------------------------------------------------
435 Purpose
: DISABLE the User Interface
437 Notes
: Here we clean-up the user-interface by deleting
438 dynamic widgets we have created and
/or hide
439 frames. This procedure is usually called when
440 we are ready to
"clean-up" after running.
441 ------------------------------------------------------------------------------*/
442 /* Hide all frames.
*/
444 IF THIS-PROCEDURE:PERSISTENT THEN DELETE PROCEDURE THIS-PROCEDURE.
447 /* _UIB-CODE-BLOCK-END
*/
451 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE dump-changes B-table-Win
452 PROCEDURE dump-changes
:
453 /*------------------------------------------------------------------------------
457 ------------------------------------------------------------------------------*/
459 DEF VAR dumped-to
AS CHAR NO-UNDO.
461 RUN rplctn\repldump.p.
462 dumped-to
= RETURN-VALUE.
463 RUN dispatch
( 'open-query'
:U
).
466 "The current outstanding replication" SKIP
467 "changes have been dumped successfully" SKIP
469 VIEW-AS ALERT-BOX INFORMATION TITLE "Done !".
471 RUN can-dump-changes.
475 /* _UIB-CODE-BLOCK-END
*/
479 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE inst-value-changed B-table-Win
480 PROCEDURE inst-value-changed
:
481 /*------------------------------------------------------------------------------
485 ------------------------------------------------------------------------------*/
487 RUN can-dump-changes.
491 /* _UIB-CODE-BLOCK-END
*/
495 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE purge-log B-table-Win
496 PROCEDURE purge-log
:
497 /*------------------------------------------------------------------------------
499 ------------------------------------------------------------------------------*/
500 DEF VAR do-it
AS LOGICAL NO-UNDO INITIAL No.
502 MESSAGE "This will delete all changes which have been logged" SKIP
503 "for replication to other sites." SKIP(1)
504 "Are you sure you want to do this?"
505 VIEW-AS ALERT-BOX WARNING BUTTONS OK-CANCEL
506 TITLE "Are you sure?"
510 FOR EACH ReplLog
EXCLUSIVE-LOCK: DELETE ReplLog.
END.
511 RUN dispatch
( 'open-query'
:U
).
516 /* _UIB-CODE-BLOCK-END
*/
520 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE replicate-out B-table-Win
521 PROCEDURE replicate-out
:
522 /*------------------------------------------------------------------------------
524 ------------------------------------------------------------------------------*/
525 RUN notify
( 'set-busy
,container-source'
:U
).
526 RUN rplctn
/repldump.p .
527 RUN notify
( 'set-idle
,container-source'
:U
).
528 MESSAGE "Data for outward replication dumped to file".
531 /* _UIB-CODE-BLOCK-END
*/
535 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-key B-table-Win adm/support/_key-snd.p
537 /*------------------------------------------------------------------------------
538 Purpose
: Sends a requested
KEY value back to the calling
540 Parameters
: <see adm
/template
/sndkytop.i
>
541 ------------------------------------------------------------------------------*/
543 /* Define variables needed by this internal procedure.
*/
544 {src
/adm
/template
/sndkytop.i
}
546 /* Return the key value associated with each key case.
*/
547 {src
/adm
/template
/sndkycas.i
"OfficeCode" "ReplLog" "OfficeCode"}
548 {src
/adm
/template
/sndkycas.i
"TableToRepl" "ReplLog" "TableToRepl"}
550 /* Close the
CASE statement and end the procedure.
*/
551 {src
/adm
/template
/sndkyend.i
}
555 /* _UIB-CODE-BLOCK-END
*/
559 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE send-records B-table-Win _ADM-SEND-RECORDS
560 PROCEDURE send-records
:
561 /*------------------------------------------------------------------------------
562 Purpose
: Send record
ROWID's for all tables used by
564 Parameters
: see template
/snd-head.i
565 ------------------------------------------------------------------------------*/
567 /* Define variables needed by this internal procedure.
*/
568 {src
/adm
/template
/snd-head.i
}
570 /* For each requested table
, put it's
ROWID in the output list.
*/
571 {src
/adm
/template
/snd-list.i
"ReplLog"}
573 /* Deal with any unexpected table requests before closing.
*/
574 {src
/adm
/template
/snd-end.i
}
578 /* _UIB-CODE-BLOCK-END
*/
582 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE state-changed B-table-Win
583 PROCEDURE state-changed
:
584 /* -----------------------------------------------------------
588 -------------------------------------------------------------*/
589 DEFINE INPUT PARAMETER p-issuer-hdl
AS HANDLE NO-UNDO.
590 DEFINE INPUT PARAMETER p-state
AS CHARACTER NO-UNDO.
593 /* Object instance CASEs can go here to replace standard behavior
595 {src
/adm
/template
/bstates.i
}
599 /* _UIB-CODE-BLOCK-END
*/
603 &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE use-FilterBy-Case B-table-Win
604 PROCEDURE use-FilterBy-Case
:
605 /*------------------------------------------------------------------------------
609 ------------------------------------------------------------------------------*/
611 DEF INPUT PARAMETER new-case
AS CHAR NO-UNDO.
612 all-trans
= new-case
= "All".
616 /* _UIB-CODE-BLOCK-END
*/