TMGXINST ;TMG/kst/XML Configuration Scripting System ;03/25/06 ;;1.0;TMG-LIB;**1**;07/12/04 ;" XML Configuration Scripting System ;" ;" K. Toppenberg, MD ;" 7-12-04 ;" ;"Purpose: Intrepret a specially-prepaired XML file, designed ;" for configuring VistA ;"Dependancy: Requires TMGXDLG.m, TMGSTUTL.m, TMGDEBUG.m ;"------------------------------------------------------------- ;"CHANGE LOG ;"10-17-04: Got WP fields to upload properly. Created FormatArray function. ;"10-15-04: Forgot to log several days. Created . Ensured data substitution ;" more widely implemented. Worked more on script. Tracked down modal dialog ;" box bug (conflicting globals in two different modules). ;"10-5-04: Learned that WP fields must be treated differently, so worked on support. ;" Had trouble with a locked record after a crash. Learn about GTM lke utility. ;"10-4-04: Tracked down apparent bug in FILE^DIE that doesn't allow upload to a word ;" processor field. Also allowed redirection of debug output to a file or to ;" an X graphic tail box. ;"10-2-05: Changed record node divider character from "/" to "|" because I could not ;" ever remember to protect the / as // and I'm sure others wouldn't remember ;" either. Fixed bug that caused crash when showing error box before XML ;" parse was complete, and datanode contained valid data. Changed UploadFile ;" to UploadRecord with syntax ;"10-1-04: Fixed bug with line wrapping disordering in dialog boxes. Fixed bug ;" preventing non-modal dialog boxes ("&"-->" &") NOTE: ??working? ;"9-30-04: Allowed data substitution {{...}} to be used in Show and message boxes. ;" Fixed bug to allow multiple data substitutions on one line. ;"9-27-04: ;" Ran a test menu upload and got Adam and TMG Text menu to upload ;" Cleaned up error reporting. Discovered that including the ` character ;" in upload data causes an error... haven't tracked down reason yet. ;"9-26-04: ;" Started this change log ;" Change parameter system so that unlimited number of params allowed ;" Cleaned up command execution and passing of parameters ;" Got X graphic dialogs working -- can call from XML script. ;" Added options for a variety of user interfaces: GUI,CHUI,Roll ;" Changed log in process so that user #1 is used (MGR,IRM on my system) ;"2/9/2008: Moved some functions out into TMGXMLT for reuse by other code. ;"------------------------------------------------------------- ;"Public Functions ;"Run(DispMode,DebugMode,UserPath,UserFName) ;"------------------------------------------------------------- ;"Private Functions ;" ;"ShowWelcome() ;"GetFName(Path,Filename) ;"LoadFile(Path,Filename) ;"ShutDown ;"InitVars() ;"CMDProcess(Command,Params) ;"DoComment(Params) ;"DoShow(Params) ;"DoM(Params) ;"DoMenu(Params) ;"DoLookup(Params) -- take data from XML file, and look up if it is already in database ;"DoValueLookup(Params) -- look for a value of a given value in a given record in given file. ;"DoFileUtility(Params) ;"DoSearchRec(Params) ;"DoUpload(Params) ;"GetRInfo(ID,Data) -- get record info from the section and store it in the Data variable. ;"ProcessRNode(DataP,Field,Text,EntryNumber,FileNumber,DoingSubNodes,Flags) -- Allow for recursive calling when doing GetRInfo ;"WPHandle(DataP,EntryNumber,FieldNumber,Text) -- process word-processing fields for ProcessRNode() ;"CheckArraySubst(TextArray) ;"ParamSubstitute(Params) ;"CheckSubstituteData(Text) ;"DoJump(Params) ;"GetLabelNode(Label) ;"GetData(Ref) ;"ParseSeg(Ref,ID) ;"GetDescIDNode(ParentNode,Name,ID) ;"GetCMDLine(ExecNode,Command,Params) ;"GetNextCMD(ExecNode) ;"RunScript(ExecNode) ;"GetDispMode() ;"DoMsgBox(Params) ;"================================================================= ;"================================================================= Run(DispMode,DebugMode,UserPath,UserFName) ;"Purpose: To use given XML filename to process ;"Input: ;" DispMode: OPTIONAL -- If not given, will ask user. Should be ;" 1 for GUI ;" 2 for CHUI ;" 3 for Roll-n-Scroll ;" DebugMode: OPTIONAL -- If not given, will ask user. Should be: ;" 0 for none, ;" 1 for To Screen ;" 2 for To File ;" 3 for To Tail (only valid if DispMode="GUI") ;" UserPath: OPTIONAL --Directory to load from ;" UserFName: OPTIONAL --the full filename. If not given, will ask user ;"Set up some global variables. new TMGDEBUG set TMGDEBUG=0 ;"Note: user could change this at runtime... new DBIndent set DBIndent=0 new PriorErrorFound set PriorErrorFound=0 ;"new DispMode new cGUI set cGUI="GUI" new cCHUI set cCHUI="CHUI" new cRoll set cRoll="Roll-n-Scroll" new DModes new cDialog set cDialog="UseDialog" set DModes(0)="x" set DModes(1)=cGUI set DModes(2)=cCHUI set DModes(3)=cRoll set DModes(4)="x" new ExecNode ;"This is the execution point new DataNode ;"A handle to node new ScriptNode ;"A handle to