subroutine kb_entry_sub(parm) /************************ PURPOSE : Provides processing support for the knowledgeBase entry window - KB_ENTRY CREATED : 01-10-98 PROCEDURES : Callable from the KB_ENTRY window. Single parameter required indicating processing action to take. WARNINGS : Requires the existence of the following tables and indexes: Tables.: KNOWLEDGE !KNOWLEDGE Indexes: SEARCH_XREF in the KNOWLEDGE table REVISION HISTORY (Most CURRENT first) : DATE IMPLEMENTOR FUNCTION -------- ----------- --------------------------------------------------- 01-22-93 kb Wrote intial code 05-13-93 tmc Added this header. Cleaned up code to conform to standards. Removed hardcoded names to equates at top of routine. Made version 3.x specific. 2/28/98 ibm Modified code for OpenInsight *************************/ * COMMON Variables (Terminate with '%') : * $insert sysinclude, window_common% * EQUATE Variables (Terminate with '$') : equ progName$ to 'KB_ENTRY_SUB' equ transferTable$ to 'KNOWLEDGE_TRANSFER' equ true$ to 1 equ false$ to 0 equ yes$ to 1 equ no$ to 0 equ otherwise$ to 1 equ null$ to '' equ keyList$ to 1 ; * key_opt option return values/actions equ allDocs$ to 2 equ search$ to 3 equ all$ to 1 ; * upload/download options return values/actions equ some$ to 2 equ subList$ to 'KEY_OPT,PRINT,UPLOAD,DOWNLOAD' equ delim$ to \2C\ ; * comma $insert Popup_Equates * VARIABLES pos = 0 ; * generic list/array index counter col = 100 ; * default screen coordinates (pixels) row = 100 pop = "" ; * Initialize popup variable pop = col pop = row pop = "1" retval = null$ ixSearchStr = "DOC_ID":@VM:"TITLE" temp = null$ volume = null$ options = null$ table = null$ * MESSAGES Called (Terminate with '$') : equ createTableFail$ to '146' equ insertDisk$ to 'I100' equ invalBranch$ to "|Invalid branch ('%1%') passed to %2%!|Process canceled.|" equ noDocs$ to "|There are no documents selected.|Process canceled.|" equ docsSelected$ to "|There are %1% documents selected for printing.|Would you like to continue?|" equ tableExists$ to "|%1% already exists.|Do you want to download into %1%?|" equ drvNotReady$ to "|Insert disk in drive %1%|and close the drive door.|" equ createTable$ to '|Creating "%1%" on "%2%".|Please wait.|' * DECLARED FUNCTIONS Called declare function popup, get_property, indexlookup, utility, msg * DECLARED SUBROUTINES Called declare subroutine attach_table, repository, copy_row, msg, create_table, detach_table, clear_table declare subroutine set_property * * * * * * * * * * * * * * * * * * * * * * * * * PROGRAM TOP locate parm in subList$ using delim$ setting pos then on pos gosub key_opt, print, upload, download end else msg(@window, invalBranch$, null$, null$, parm:@fm:progname$) end return * * * * * * * * * * * * * * * * * * * * * * * * * INTERNAL SUBROUTINES key_opt: activeWindow = get_property("WORKSHOP_MAIN","MDIACTIVE" , "TEXT") if activeWindow <> "KB_ENTRY" then return display = Get_Property("KB_ENTRY" , "QBFLIST") pop = 'Current List':@VM:'All Documents':@VM:'Keyword Search' pop = '1':@SVM:'25':@SVM:'L':@SVM:@SVM pop = 'Document Options' pop = 'P' retVal = popup(@WINDOW , pop) begin case case retval = keyList$ * gives a popup of current browse list or all row in table retVal = null$ pop = "KNOWLEDGE" convert @FM to @VM in display pop= display pop = '0':@SVM:'5':@SVM:'L':@SVM:@SVM:@SVM:'Key':@VM:'1':@SVM:'70':@SVM:'L':@SVM:@SVM:@SVM:'Title' pop = "K" pop = "2" pop = "Documents" pop = "K" retval = popup(@WINDOW , pop) if retVal then if display ne retVal then gosub setBrowseList end end case retval = allDocs$ * gives a popup of all rows in the table retval = null$ pop = "KNOWLEDGE" pop = 0':@SVM:'5':@SVM:'L':@SVM:@SVM:@SVM:'Key':@VM:'1':@SVM:'70':@SVM:'L':@SVM:@SVM:@SVM:'Title' pop = "T" pop = "2" pop = "Documents" pop = "K" retVal = popup(@WINDOW , pop) if retval then if display NE retVal then gosub setBrowseList end end case retVal = search$ retval = IndexLookup(@WINDOW , "KNOWLEDGE", "KEYWORDS",ixSearchStr,"MULTI","") if retval then gosub setBrowseList end end case return * * * * * * * * * * * * * * * * * * * * * * * * print: * * Print the current keylist * browse_list = Get_Property("KB_ENTRY" , "QBFLIST") if browse_list then retVal = yes$ open 'SYSLISTS' to hSYSLISTS then write browse_list to hSYSLISTS, "KBASE_":@STATION then message = docsSelected$:@FM:"BNY":@FM:@FM:"!" message<12> = "Knowledge Base" xCnt = Count(browse_list,@FM) + (browse_list NE '') retVal = msg(@WINDOW , message, '', '', xCnt) if retVal then Repository("EXECUTE" , "WORKSHOP*OIREPORT*RDLAYOUT*KBASE.RPT") end end end end else message = noDocs$:@FM:@FM:@FM:'H' message<12> = "Knowledge Base" msg(@WINDOW , message) end return * * * * * * * * * * * * * * * * * * * * * * * * upload: * * Upload new data to the knowledgebase. * gosub getVolume if attachFlag then attach_table (volume, table, '', options ) if @file.error< 1 > = 400 then @file.error = null$ if @file.error then msg(@window,"Error Code: ":@file.error<1>:" Failed to attach volume ":volume) * two exit pts...bad but fast return end else volume = null$ end end pop = 'All Documents':@VM:'Selected Documents' pop = '1':@SVM:'25':@SVM:'L':@SVM:@SVM pop = 'Upload options' pop = 'P' pop = 1 retVal = popup(@WINDOW , pop) table = transferTable$ if retVal then begin case case retVal = all$ retVal = '*' case retVal = some$ pop = table pop = ':@SVM:'5':@SVM:'L':@SVM:@SVM:@SVM:'Key':@VM:'1':@SVM:'70':@SVM:'L':@SVM:@SVM:@SVM:'Title' pop = "T" pop = "2" pop = "Select items to Update KnowledgeBase" pop = "K" retVal = popup(@WINDOW , popRec) end case if retVal then copy_row( transfertable$, retVal, "KNOWLEDGE", retVal, 2, 0 ) convert @fm to @vm in retVal if retVal = '*' else gosub setBrowseList end end end return * * * * * * * * * * * * * * * * * * * * * * * * download: * * Download the knowledgebase or a subset of it to a new file. This is used * for the submission process for new entries into the knowledgebase. * browse_list = Get_Property("KB_ENTRY" , "QBFLIST") if browse_list then gosub getVolume if attachflag then message = createTable$:@fm:'U' message<12> = 'Knowledge Base' createTable = Msg( @window ,message, null$, null$, transfertable$:@fm:volume) create_table(volume, transfertable$, false$, "GLOBAL", null$, FALSE$) msg( @WINDOW, createTable ) if @file.error then if @file.error< 1 > = createTableFail$ then retVal = yes$ retVal=msg( @window, tableExists$:@fm:'BNY':@fm:@fm:'?', null$, null$, transfertable$ ) end else msg(@window,@file.error<1>:' Error creating table',null$,null$,null$) end return end end if browse_list then srcIds = browse_list convert @vm to @fm in srcIds end else srcIds = get_property(@window:".DOC_ID",'TEXT') end if volume then clear_table(transfertable$) copy_row("KNOWLEDGE", srcIds, transfertable$, srcIds, 2, 0 ) detach_table(transfertable$) end end else msg( @window , noDocs$ ) end return * * * * * * * * * * * * * * * * * * * * * * * * setBrowseList: * * Build a browse list * Set_Property("KB_ENTRY" , "QBFLIST" , retval) return * * * * * * * * * * * * * * * * * * * * * * * * getVolume: * * Get volume of table to download/upload to/from * attachFlag = false$ volume = Utility( "CHOOSEDIR" , @WINDOW ) if volume then attachFlag = TRUE$ end return