;==File=================================================================; ; SM2100.DBL ;=======================================================================; ; Copyright 1999 by TAH Software Systems (TAH), Oklahoma City, Oklahoma ; ; ; ; TAH provides this software under a license and may only be ; ; used in accordance with the terms and conditions of such ; ; license and with the inclusion of the above Copyright notice. ; ;==Function=============================================================; ; sm2100 System manager security maintenance. ; sm2100tb System manager security toolbar routine. ;==Changes==============================================================; ; 04/23/2009 wsc - add wrk_opt to fix del of app rec, not del master too. ; 10/13/2000 tah - Converted to toolbar and stay in add mode. ;==Changes==============================================================; ;=======================================================================; .subroutine sm2100 .start nopage,nolist .include "WND:toolbar.def" .include "WND:tools.def" .include "WND:fldinf.def" .include "UTS:dtb.gbl" .include "UTS:dteut.def" .include "UTS:utcomm.gbl" .include "SMS:dtesm.def" .include "SMS:smcomm.gbl" external function inp_done ,^val global data section sm2100, INIT record field_info inp_wind_no ,i4 ; Input window number field_enabled ,d1 ; Enabled or disabled fields .include "SMS:smscur.rec" record ,X dtb_table ,a%size(smscur) dtb_key ,a%size(smsc_key) @dtb_table endglobal record abort ,d1 ; Abort flag before_password ,a8 ; Password before change field_error ,d1 force_next ,d1 ; force an i_next after m_signal hold_setname ,a20 ; Saved input set name prior_comp ,a2 ; Prior company in add mode prior_oper ,a12 ; Prior operator in add mode wind_name ,a*, 'sm2100' wrk_comp ,a2 ; compare for delete wrk_menu ,a2 ; compare for delete wrk_oper ,a12 ; compare for delete wrk_password ,a8 ; for encoding password wrk_option ,a6 ; compare for delete .start nopage,list .proc call do_setup ; Set up environment and security call open_files ; Open needed data file tables call init_windows ; Init windows routines call init_data_toolbar ; Init the data toolbar repeat ; Loop to process the input window begin call process_input if (g_entnam.eq.'END') exitloop end call close_files ; Close all data files call do_shutdown ; Clean up xreturn ; Return to calling program ; Open the needed data files open_files, xcall open (smscur_chan,'U:I',smscur_name) return ; Close the data files close_files, return do_setup, xcall e_enter ; Enter a new environment xcall lodcol ('RL') ; remove local columns ut_calprg = 'SM2100' clear hold_setname,prior_comp,prior_oper return do_shutdown, clear g_entnam xcall dtb_close ; Close data toolbar xcall e_exit ; Exit the current environment return ; Initialize the window information init_windows, clear field_info xcall lodwin ('LPL',wind_name,inp_wind_no) field_enabled = TRUE xcall lodinp ('PD') ; Place and disable input column return ; Initialize the data toolbar functions init_data_toolbar, dtb_add = sec_opta ; Add per security dtb_chg = sec_optc ; Change per security dtb_del = sec_optd ; Delete per security dtb_mov = 'Y' ; Allow movement xcall dtb_init (smscur_chan,inp_wind_no,,,'sm2100tb',,smscur_chan) xcall sm2100tb ('FRST') call display_linked_fields ; record on file return ; Do input for the window process_input, repeat begin force_next = FALSE dtb_abort = FALSE dtb_setname = 'set_chg' if (hold_setname) dtb_setname = hold_setname if (dtb_setname.eq.'set_add') then xcall i_next (inp_wind_no,dtb_setname,"*FRST*") else xcall i_next (inp_wind_no,dtb_setname,"*NONE*") do begin if (force_next.eq.TRUE) begin xcall i_next (inp_wind_no,dtb_setname,'*NEXT*') force_next = FALSE end xcall i_input (inp_wind_no,dtb_setname,smscur,,ut_col_sel,,ut_windows) if g_select ; menu option key chosen begin if (g_entnam(1:1).ne.'^') xcall sm2100tb (g_entnam) case g_entnam of begincase 'END': if (dtb_function.ne.'A') then return else begin xcall sm2100tb ('CANC') call display_linked_fields xcall lodinp ('D') clear hold_setname end '^ADD': call set_up_for_add '^CANC': begin call display_linked_fields xcall lodinp ('D') clear hold_setname return end '^DEL': begin wrk_comp = smsc_comp wrk_menu = smsc_menu wrk_oper = smsc_oper wrk_option = smsc_option xcall dtb_delete (dtb_key,dtb_table,opcde) if (.not.opcde) begin if (wrk_menu.eq.'**') then call delete_oper else if (wrk_option.eq.ut_blanks) call delete_menu xcall lodinp ('D') xcall sm2100tb ('^DISABLE') end call display_linked_fields end '^DISP': call display_linked_fields '^EDIT': begin if (smsc_menu.eq.'**') then xcall i_disable (D_SET,inp_wind_no,'set_showm') else xcall i_disable (D_SET,inp_wind_no,'set_showu') xcall i_next (inp_wind_no,dtb_setname,'*FRST*') xcall lodinp ('E') if (smsc_menu.eq.'**') then before_password = smsc_paswd else before_password = smsc_pass end '^FIND': call find_record '^UPDT': begin call update_button if (.not.field_error) .and. (.not.opcde) return end '@': call process_signal endcase end end until (.not.g_setsts) .and. (.not.g_select) if (.not.ut_windows) .and. & (dtb_function.eq.'A' .or. dtb_function.eq.'E') begin call update_button if (field_error) .or. (opcde) xcall sm2100tb ('CANC') end end ; Process any break signals process_signal, force_next = (.not.ut_windows) case g_entnam of begincase '@SCMENU': if (smsc_menu.eq.'**') then xcall i_disable (D_SET,inp_wind_no,'set_showm') else xcall i_disable (D_SET,inp_wind_no,'set_showu') endcase return ; Set up window for adding records set_up_for_add, xcall i_next (inp_wind_no,dtb_setname,'*FRST*') xcall lodinp ('E') hold_setname = 'set_add' if (prior_oper) begin xcall i_putfld (inp_wind_no,dtb_setname,smscur,'SCCOMP',prior_comp) xcall i_putfld (inp_wind_no,dtb_setname,smscur,'SCOPER',prior_oper) end clear before_password return update_button, hold_setname = dtb_setname call update_record if (dtb_function.eq.'A') begin prior_comp = smsc_comp prior_oper = smsc_oper xcall sm2100tb ('ADD') call set_up_for_add end return delete_oper, repeat begin xcall db_next (smscur_chan,smscur,'F','M',,,opcde) if (opcde) .or. & (smsc_oper.ne.wrk_oper) .or. & (smsc_comp.ne.wrk_comp) exitloop xcall db_delete (smscur_chan,smscur,smsc_key,,opcde) end return delete_menu, repeat begin xcall db_next (smscur_chan,smscur,'F','M',,,opcde) if (opcde) .or. & (smsc_oper.ne.wrk_oper) .or. & (smsc_comp.ne.wrk_comp) .or. & (smsc_menu.ne.wrk_menu) exitloop xcall db_delete (smscur_chan,smscur,smsc_key,0,opcde) end return ; Find a record by key or as a lookup list window ; (this is coded however needed) find_record, xcall smscur_lookup (dtb_inwindno,dtb_chan,dtb_table,dtb_key) g_select = TRUE return ; Write the record to the file update_record, call verify_record if (.not.field_error) begin if (smsc_menu.eq.'**') then begin if (smsc_paswd.eq.'NONE') then clear smsc_paswd else if (smsc_paswd.ne.UT_BLANKS) .and. & (smsc_paswd.ne.before_password) begin xcall encode (smsc_paswd,wrk_password) smsc_paswd = wrk_password end end else begin if (smsc_pass.eq.'NONE') then clear smsc_pass else if (smsc_pass.ne.UT_BLANKS) .and. & (smsc_pass.ne.before_password) begin xcall encode (smsc_pass,wrk_password) smsc_pass = wrk_password end end xcall dtb_update (dtb_key,dtb_table,opcde) if (.not.opcde) begin xcall i_disable (D_ALL,inp_wind_no) field_enabled = FALSE xcall lodinp ('D') clear hold_setname end end return ; Display all linked fields display_linked_fields, if (smsc_menu.eq.'**') then begin xcall i_init (inp_wind_no,'set_showm') xcall i_display (inp_wind_no,'set_showu',smscur) ;; if (smsc_paswd.eq.UT_BLANKS) .or. ;; & (smsc_paswd.eq.'NONE') ;; xcall i_dspfld (inp_wind_no,'SCPASS','NONE') end else begin xcall i_init (inp_wind_no,'set_showu') xcall i_display (inp_wind_no,'set_showm',smscur) ;; if (smsc_pass.eq.UT_BLANKS) .or. ;; & (smsc_pass.eq.'NONE') ;; xcall i_dspfld (inp_wind_no,'SCCPAS','NONE') end return ; Check the record for valid information verify_record, clear field_error if (%inp_done(inp_wind_no,dtb_setname).eq.FALSE) begin ; Not all fields have been entered field_error = -1 return end return .end ;=======================================================================; .subroutine sm2100tb a_param ,a .start nopage,nolist .include "UTL:tools.def" .include "UTS:dtb.gbl" .include "UTS:utcomm.gbl" global data section sm2100 record field_info inp_wind_no ,i4 ; Input window number field_enabled ,d1 ; Enabled or disabled fields .include "SMS:smscur.rec" record ,X dtb_table ,a%size(smscur) dtb_key ,a%size(smsc_key) @dtb_table endglobal .start nopage,list .proc .include "UTS:dtbfunct.inc" .end ;=======================================================================;