//./ ADD NAME=oTZCMQSYO_ActivateREPO_Enqueue // Source Module=tzcmrepo.c //////////////////////////////////////////////// // // OPERATION: oTZCMQSYO_ActivateREPO_Enqueue // // PURPOSE: Checks for REPOS_Enqueue via the SystemAdmin. // // PARAMETERS: vTZCMREPO - A pointer to the return Repository Enqueue view // vSubtask - A qualifying view for the Activation // // RETURNS: >= 0 - TZCMREPO activated successfully // -1 - Error encountered during activation // //////////////////////////////////////////////// //./ END + 2 zOPER_EXPORT zSHORT OPERATION oTZCMQSYO_ActivateREPO_Enqueue( zPVIEW vTZCMQSYO, zVIEW vSubtask ) { zVIEW vKZDBHQUA; zSHORT nRC; if ( GetViewByName( &vKZDBHQUA, "KZDBHQUA", vSubtask, zLEVEL_TASK ) < 0 ) { if ( ActivateEmptyObjectInstance( &vKZDBHQUA, "KZDBHQUA", vSubtask, zSINGLE ) >= 0 ) { SetNameForView( vKZDBHQUA, "KZDBHQUA", vSubtask, zLEVEL_TASK ); CreateEntity( vKZDBHQUA, "EntitySpec", zPOS_AFTER ); CreateEntity( vKZDBHQUA, "QualAttrib", zPOS_AFTER ); } else return( -1 ); } SetAttributeFromString( vKZDBHQUA, "EntitySpec", "EntityName", "SysEnqueue" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "EntityName", "SysEnqueue" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "AttributeName", "TimeStamp" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Oper", ">" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Value", "19000101000000000" ); nRC = ActivateObjectInstance( vTZCMQSYO, "TZCMQSYO", vSubtask, vKZDBHQUA, zLEVEL_TASK | zMULTIPLE ); DropObjectInstance( vKZDBHQUA ); return( nRC ); }
// // OPERATION: InitializeInterpretor // // DESCRIPTION: InitializeInterpretor does all of the set up for the VML // interpretor. Loads the XPG File. Next be sure that we have access to // the global as well as Zeidon operation lists. Also Init two Globals. // zOPER_EXPORT zSHORT OPERATION InitInterp( zVIEW lpInterpSubtask, zVIEW lpAppSubtask, zPCHAR szSrcDLLName ) { zVIEW vStackObject; // zVIEW vViewObject; zVIEW vTZOPGRPO; zCHAR szExecDir[ zMAX_FILESPEC_LTH + 1 ]; // dir string zSHORT nRC; nRC = LoadXPG( lpInterpSubtask, lpAppSubtask, szSrcDLLName, "C" ); if ( nRC != 0 ) // failed return( -1 ); if ( GetViewByName( &vStackObject, "StackObject", lpInterpSubtask, zLEVEL_SUBTASK ) != zLEVEL_SUBTASK ) { // activate an empty stack object. ActivateEmptyObjectInstance( &vStackObject, "TZVSRTOO", lpInterpSubtask, zSINGLE ); // create the root of the stack object. CreateEntity( vStackObject, "StackObject", zPOS_AFTER ); // Name the Stack Object SetNameForView( vStackObject, "StackObject", lpInterpSubtask, zLEVEL_SUBTASK ); } #if 0 // DGC The following to OIs do not appear to be used anywhere so I'm // removing them so that we don't need an LPLR to be active. // get access to the global operation list and the Zeidon operation list nRC = RetrieveViewForMetaList( vSubtask, &lpGOListView, zREFER_GO_META ); if ( nRC < 0 ) // failed lpGOListView = 0; // get a view to the Task LPLR if ( GetViewByName( &vViewObject, "TaskLPLR", vSubtask, zLEVEL_TASK ) != zLEVEL_TASK ) return( -1 ); #endif if ( GetViewByName( &vTZOPGRPO, "TZOPSIGK.Interp", lpInterpSubtask, zLEVEL_TASK ) != zLEVEL_TASK ) { // get the exec directory zgGetZeidonToolsDir( lpAppSubtask, szExecDir, zAPPL_DIR_OBJECT ); // concat the name. and the .XGO extention strcat_s( szExecDir, zsizeof( szExecDir ), "TZOPSIGK.XGO" ); nRC = ActivateOI_FromFile( &vTZOPGRPO, "TZOPGRPO", lpInterpSubtask, szExecDir, zSINGLE ); if ( nRC < 0 ) // failed vTZOPGRPO = 0; else SetNameForView( vTZOPGRPO, "TZOPSIGK.Interp", lpInterpSubtask, zLEVEL_TASK ); } g_nStackPtr = 0; g_nCallStack[ 0 ] = 1; return( 0 ); }
zOPER_EXPORT zSHORT OPERATION zwTZCMRPTD_LoadAudittrail( zVIEW vSubtask ) { zVIEW vTZCMRPTO; zVIEW vTZBRAUDO; zVIEW vKZDBHQUA; zULONG ulZKey; zCHAR szZKey[18]; zSHORT nRC; if ( GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ) > 0 ) { if ( CheckExistenceOfEntity( vTZCMRPTO, "Z_MetaDef" ) == 0 ) { if ( ActivateEmptyObjectInstance ( &vKZDBHQUA, "KZDBHQUA", vSubtask, zSINGLE ) >= 0 ) { SetNameForView( vKZDBHQUA, "KZDBHQUA", vSubtask, zLEVEL_TASK ); CreateEntity( vKZDBHQUA, "EntitySpec", zPOS_AFTER ); CreateEntity( vKZDBHQUA, "QualAttrib", zPOS_AFTER ); } else return( -1 ); GetIntegerFromAttribute(( zPLONG )&ulZKey, vTZCMRPTO, "Z_MetaDef", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "EntitySpec", "EntityName", "Z_MetaDef" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "EntityName", "Z_MetaDef" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "AttributeName", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Oper", "=" ); zltoa( ulZKey, szZKey ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Value", szZKey ); nRC = ActivateObjectInstance( &vTZBRAUDO, "TZBRAUDO", vSubtask, vKZDBHQUA, zSINGLE | zLEVEL_APPLICATION ); DropObjectInstance( vKZDBHQUA ); if ( CheckExistenceOfEntity( vTZBRAUDO, "AuditTrail" ) == 0 ) SetNameForView( vTZBRAUDO, "TZBRAUDO", vSubtask, zLEVEL_TASK ); else { MessageSend( vSubtask, "CM00299", "Audit Trail:", "There are no AuditTrail-Information for the component in this CPLR.", zMSGQ_OBJECT_CONSTRAINT_INFORMATION, zBEEP ); SetWindowActionBehavior( vSubtask, zWAB_StayOnWindow, 0, 0 ); return( -1 ); } } } else return( -1 ); return( 0 ); }
static zSHORT zwfnTZCMRPTD_LoadNewAudittrail( zVIEW vSubtask, zPVIEW vTZBRAU2O ) { zVIEW vTZCMCPL; zVIEW vKZDBHQUA; zULONG ulZKey; zCHAR szZKey[18]; zSHORT nRC; if ( GetViewByName( &vTZCMCPL, "TZCMCPL", vSubtask, zLEVEL_TASK ) < 0 ) return( -1 ); if ( CheckExistenceOfEntity( vTZCMCPL, "CPLR" ) == zCURSOR_SET ) { if ( ActivateEmptyObjectInstance( &vKZDBHQUA, "KZDBHQUA", vSubtask, zSINGLE ) >= 0 ) { SetNameForView( vKZDBHQUA, "KZDBHQUA", vSubtask, zLEVEL_TASK ); CreateEntity( vKZDBHQUA, "EntitySpec", zPOS_AFTER ); CreateEntity( vKZDBHQUA, "QualAttrib", zPOS_AFTER ); } else return( -1 ); GetIntegerFromAttribute( (zPLONG)&ulZKey, vTZCMCPL, "CPLR", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "EntitySpec", "EntityName", "CPLR" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "EntityName", "CPLR" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "AttributeName", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Oper", "=" ); zltoa( ulZKey, szZKey ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Value", szZKey ); nRC = ActivateObjectInstance( vTZBRAU2O, "TZBRAU2O", vSubtask, vKZDBHQUA, zSINGLE | zLEVEL_APPLICATION ); DropObjectInstance( vKZDBHQUA ); SetNameForView( *vTZBRAU2O, "TZBRAU2O", vSubtask, zLEVEL_TASK ); } else { MessageSend( vSubtask, "CM00299", "Audit Trail:", "There are no Audit Trail Information for a non-repository LPLR.", zMSGQ_OBJECT_CONSTRAINT_WARNING, zBEEP ); SetWindowActionBehavior( vSubtask, zWAB_StayOnWindow, 0, 0 ); return( -1 ); } return( 0 ); } // zwfnTZCMRPTD_LoadNewAudittrail
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zwTZERRORD_CreateNewErrorRoot // // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT /*DIALOG */ OPERATION zwTZERRORD_CreateNewErrorRoot( zVIEW vSubtask ) { zVIEW vTZERROR; zCHAR szCurrentDateTime[ 20 ]; if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) < 0 ) { // Create Work LOD for Error List ActivateEmptyObjectInstance( &vTZERROR, "TZERROR", vSubtask, zMULTIPLE ); SetNameForView( vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ); } SysGetDateTime( szCurrentDateTime ); CreateEntity( vTZERROR, "ErrorList", zPOS_LAST ); SetAttributeFromString( vTZERROR, "ErrorList", "DateTime", szCurrentDateTime ); return( 0 ); } // zwTZERRORD_CreateNewErrorRoot
zSHORT /* LOCAL */ OPERATION zwTZCMRPTD_LoadDesc_AUX( zVIEW vSubtask, zLONG CPLR_ZKey, zPCHAR pszTimeStamp ) { zVIEW vTZBRAU3O; zVIEW vKZDBHQUA; zCHAR szZKey[18]; zSHORT nRC; if ( GetViewByName( &vTZBRAU3O, "TZBRAU3O", vSubtask, zLEVEL_TASK ) > 0 ) DropObjectInstance( vTZBRAU3O ); if ( ActivateEmptyObjectInstance ( &vKZDBHQUA, "KZDBHQUA", vSubtask, zSINGLE ) >= 0 ) { SetNameForView( vKZDBHQUA, "KZDBHQUA", vSubtask, zLEVEL_TASK ); CreateEntity( vKZDBHQUA, "EntitySpec", zPOS_AFTER ); CreateEntity( vKZDBHQUA, "QualAttrib", zPOS_AFTER ); } else return( -1 ); // QualAttrib for "WHERE CPLR.ZKey = CPLR_ZKey" SetAttributeFromString( vKZDBHQUA, "EntitySpec", "EntityName", "AuditTrail" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "EntityName", "CPLR" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "AttributeName", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Oper", "=" ); zltoa( CPLR_ZKey, szZKey ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Value", szZKey ); // QualAttrib for "AND" CreateEntity( vKZDBHQUA, "QualAttrib", zPOS_AFTER ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Oper", "AND" ); // QualAttrib for "WHERE AuditTrail.TimeStamp = pszTimeStamp" CreateEntity( vKZDBHQUA, "QualAttrib", zPOS_AFTER ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "EntityName", "AuditTrail" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "AttributeName", "TimeStamp" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Oper", "=" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Value", pszTimeStamp ); nRC = ActivateObjectInstance( &vTZBRAU3O, "TZBRAU3O", vSubtask, vKZDBHQUA, zSINGLE | zLEVEL_APPLICATION ); DropObjectInstance( vKZDBHQUA ); if (CheckExistenceOfEntity( vTZBRAU3O, "AuditTrail" ) == 0 ) SetNameForView( vTZBRAU3O, "TZBRAU3O", vSubtask, zLEVEL_TASK ); else { MessageSend( vSubtask, "CM00299", "Audit Trail:", "There are no AuditTrail-Information for the component.", zMSGQ_OBJECT_CONSTRAINT_INFORMATION, zBEEP ); SetWindowActionBehavior( vSubtask, zWAB_StayOnWindow, 0, 0 ); return( -1 ); } return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZDMXGPO_GetViewForXDM // // PURPOSE: Get access to XDM View. Activate if not loaded // and get at application level if loaded. // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZDMXGPO_GetViewForXDM( zVIEW vSubtask, zPVIEW pvTZDMXGPO, zSHORT nCurrentOrReload ) { zVIEW vT; zVIEW vTask; zCHAR szXDM_FileName[ zMAX_FILESPEC_LTH + 1 ]; zCHAR szAppViewName[ 66 ] = "dmDOMAINS."; zSHORT nRScope; zSHORT nRC; // Set up the XDM File Name and the View Name GetViewByName( &vTask, "TaskLPLR", vSubtask, zLEVEL_TASK ); GetStringFromAttribute( &szAppViewName[ 10 ], vTask, "LPLR", "Name" ); GetStringFromAttribute( szXDM_FileName, vTask, "LPLR", "ExecDir" ); zstrcat( szXDM_FileName, "\\zeidon.xdm" ); // See if XDM View is at the Application level nRScope = GetViewByName( &vT, szAppViewName, vTask, zLEVEL_APPLICATION ); if ( nRScope == zCALL_ERROR ) return( zCALL_ERROR ); if ( nRScope == zLEVEL_APPLICATION && nCurrentOrReload == zFORCE_RELOAD ) { nRC = DropObjectInstance( vT ); nRScope = -1; } if ( nRScope != zLEVEL_APPLICATION ) { // Load it from a file or create a new one if file is missing. if ( ActivateOI_FromFile( &vT, "TZDMXGPO", vTask, szXDM_FileName, zSINGLE | zLEVEL_APPLICATION | zNOI_OKAY ) != 0 ) { ActivateEmptyObjectInstance( &vT, "TZDMXGPO", vTask, zSINGLE | zLEVEL_APPLICATION ); CreateEntity( vT, "DomainGroup", zPOS_AFTER ); SetAttributeFromString( vT, "DomainGroup", "Name", &szAppViewName[ 10 ] ); SetNameForView( vT, szAppViewName, 0, zLEVEL_APPLICATION ); CommitOI_ToFile( vT, szXDM_FileName, zASCII ); // MessageSend( vT, "DM00201", "Domain Management", // "The Executable Domain File was not found. " // "An empty one is being created. You may want " // "to save all Domains OR re-Initialze the LPLR.", // zMSGQ_OBJECT_CONSTRAINT_WARNING, zBEEP ); nRC = 1; } else { SetNameForView( vT, szAppViewName, 0, zLEVEL_APPLICATION ); nRC = 0; } } else { nRC = 0; } CreateViewFromViewForTask( pvTZDMXGPO, vT, 0 ); return( nRC ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zoTZSIXSKO_SaveXSK // // PURPOSE: // // TRIGGLODED BY: // WINDOW: TZZOLODD // ACTION: OPTION // NAME: File_Save // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zoTZSIXSKO_SaveXSK( zVIEW vTZZOXODO, zVIEW vTZTENVRO ) { zVIEW vKZSIXSKO; zVIEW vKZSIXSKO_Root; zVIEW vTZTENVRO_REF = 0; zVIEW vTZTENVR1 = 0; zVIEW vTaskLPLR; zSHORT nRC; zCHAR szFileName[ zMAX_FILESPEC_LTH + 1 ]; zCHAR szMetaName[ 33 ]; zLONG lTE_ZKey = 0; zSHORT nAttrCount = 0; zSHORT nDS_Count = 0; /*=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=? ?? Hier muss noch der oder die Siron Kennungen abgehandelt ?? werden **=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?*/ // Check access to TE Object if ( !vTZTENVRO ) { nRC = MessagePrompt( vTZZOXODO, "XOD_02", "Internal LOD Error", "Unable to Load related TE.\n\nOpen or Create TE First.", 0, zBUTTONS_OK, 0, 0 ); vKZSIXSKO = 0; // initialize to something DKS 2000.03.09? DeleteEntity( vKZSIXSKO, "OBJECT", zREPOS_NONE ); return( 0 ); } nRC = ActivateEmptyObjectInstance( &vKZSIXSKO, "KZSIXSKO", vTZZOXODO, zMULTIPLE | zLEVEL_APPLICATION ); if ( nRC < 0 ) { nRC = MessagePrompt( vTZZOXODO, "XOD_01", "Internal LOD Error", "Unable to Activate Empty XSK.\n\nSeek help.", 0, zBUTTONS_OK, 0, 0 ); return( 0 ); } nRC = SetNameForView( vKZSIXSKO, "KZSIXSKO", vTZZOXODO, zLEVEL_TASK ); nRC = CreateEntity( vKZSIXSKO, "OBJECT", zPOS_AFTER ); nRC = SetAttributeFromAttribute( vKZSIXSKO, "OBJECT", "Name", vTZZOXODO, "OBJECT", "NAME" ); nRC = SetAttributeFromAttribute( vKZSIXSKO, "OBJECT", "ZKey", vTZZOXODO, "OBJECT", "ZKey" ); CreateViewFromViewForTask( &vKZSIXSKO_Root, vKZSIXSKO, 0 ); zofnTZSIXSKO_BldXSK( vKZSIXSKO_Root, vKZSIXSKO, vTZZOXODO, vTZTENVRO ); // Commit the XSK to a file named the same as the XOD, // except with suffix ".XSK". GetViewByName( &vTaskLPLR, "TaskLPLR", vTZZOXODO, zLEVEL_TASK ); GetStringFromAttribute( szFileName, vTaskLPLR, "LPLR", "ExecDir" ); zstrcat( szFileName, "\\" ); GetStringFromAttribute( szMetaName, vTZZOXODO, "OBJECT", "NAME" ); zstrcat( szFileName, szMetaName ); zstrcat( szFileName, ".XSK" ); CommitOI_ToFile( vKZSIXSKO, szFileName, zASCII ); DropView( vKZSIXSKO_Root ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // ENTRY: CreateListBox // // PURPOSE: This function creates a listbox with the given // specifications and then autodesigns this listbox with // the LISTATTRIB attributes for the listbox's entity. // In addition to auto designing the listbox's fields, any // actions defined for the listbox(in the style object) // get autodesigned. // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION ofnTZWDLGSO_CreateListBox( zVIEW vSubtask, zVIEW vNewDialog, zVIEW vUserSpec, zLONG lStart_X, zLONG lStart_Y, zLONG lHeight, zPCHAR szListType ) { zVIEW vCtrlDef; zVIEW vTZPNCTWO; zLONG lTotalLth; zLONG lAttribLth; zLONG lPaintLth; zLONG lCC; zLONG lCL; zSHORT RESULT; zCHAR szPaintStr[ 50 ]; zCHAR X_LOD_Attribute[ 16 ]; zCHAR X_ER_Attribute[ 15 ]; // TraceLineS("IN", "AutoPaintLstListPart W4" ); // Set up variables to either I_LOD listbox or L_LOD listbox. if ( szListType[ 0 ] == 'I' ) { strcpy_s( X_LOD_Attribute, zsizeof( X_LOD_Attribute ), "I_LOD_Attribute" ); strcpy_s( X_ER_Attribute, zsizeof( X_ER_Attribute ), "I_ER_Attribute" ); } else { strcpy_s( X_LOD_Attribute, zsizeof( X_LOD_Attribute ), "L_LOD_Attribute" ); strcpy_s( X_ER_Attribute, zsizeof( X_ER_Attribute ), "L_ER_Attribute" ); } lCC = 5; lCL = 12; GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK ); // TraceLineS("IN", "CreateListBox W3" ); /* Create the listbox. */ CreateMetaEntity( vSubtask, vNewDialog, "Control", zPOS_AFTER ); SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "ListBox", "" ); IncludeSubobjectFromSubobject( vNewDialog, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_X", lStart_X ); SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_Y", lStart_Y ); // We must set the CtrlBOI. ActivateEmptyObjectInstance( &vTZPNCTWO, "TZPNCTWO", vUserSpec, zSINGLE ); CreateEntity( vTZPNCTWO, "TZPNCTWO", zPOS_AFTER ); CreateEntity( vTZPNCTWO, "ListBox", zPOS_AFTER ); SetAttributeFromInteger( vTZPNCTWO, "ListBox", "Subtype", 8192 ); // Set Control.CtrlBOI from work entity GroupBox SetBlobFromEntityAttributes( vNewDialog, "Control", "CtrlBOI", vTZPNCTWO, "ListBox" ); DropView( vTZPNCTWO ); // Set the control subtype to 0(Single). SetAttributeFromInteger( vNewDialog, "Control", "Subtype", 8192 ); lTotalLth = 0; if ( CheckExistenceOfEntity ( vUserSpec, X_LOD_Attribute ) != 0 ) lTotalLth = 5; // Loop through the L_LOD_Attribute and find the total width needed // for this listbox. RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" ); while ( RESULT > zCURSOR_UNCHANGED ) { lAttribLth = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType ); if ( lAttribLth > 20 ) lAttribLth = 20; if ( lAttribLth < 5 ) lAttribLth = 5; GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec, X_ER_Attribute, "ListPaintLit" ); if ( szPaintStr[ 0 ] == 0 ) { GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec, X_ER_Attribute, "PromptPaintLit" ); } if ( szPaintStr[ 0 ] == 0 ) { GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec, X_ER_Attribute, "Name" ); /* Add a ':' to the end. */ strcat_s( szPaintStr, zsizeof( szPaintStr ), ":" ); /* Add spaces before any capital letters. */ AddSpacesToString( szPaintStr ); } lPaintLth = zstrlen( szPaintStr ); if ( lPaintLth > 20 ) lPaintLth = 20; if ( lPaintLth < 5 ) lPaintLth = 5; if ( lAttribLth > lPaintLth ) lTotalLth = lTotalLth + lAttribLth + 1; else lTotalLth = lTotalLth + lPaintLth + 1; RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" ); } lTotalLth ++; SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_X", lTotalLth * lCC ); SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_Y", lHeight ); // TraceLineS("END", "CreateListBox W3" ); return( 0 ); }
zOPER_EXPORT zSHORT OPERATION CreateSironWorkObjectList( zPCHAR szDirectoryPath, zVIEW vSubtask ) { zVIEW vImportList; zSHORT nRC; HWND hWndList; zSHORT i, nCount; zCHAR szMetaName[ 13 ]; HWND hWnd; HINSTANCE hInst; nRC = GetViewByName( &vImportList, "TZSIIMLO", NULL, zLEVEL_TASK ); if ( nRC < 0 ) { // Initialize empty list object. ActivateEmptyObjectInstance( &vImportList, "TZSIIMLO", vSubtask, zSINGLE ); CreateEntity( vImportList, "Root", zPOS_AFTER ); SetNameForView( vImportList, "TZSIIMLO",NULL, zLEVEL_TASK ); } // Using the Windows interface, create an invisible window which // contains the list of all files in the directory pased of type *.wsk. // The *.wsk is passed to Windows to delineate the files listed. zstrcat( szDirectoryPath, "*.WSK" ); GetWindowHandle( (zPULONG) &hWnd, 0, vSubtask, 0 ); hInst = (HINSTANCE) GetApplicationInstance( vSubtask ); hWndList = CreateWindow( "ListBox", NULL, WS_CHILD | LBS_SORT, 1, 1, 1, 1, hWnd, (HMENU) 101, (HANDLE) hInst, NULL ); SendMessage( hWndList, WM_SETREDRAW, FALSE, 0L ); SendMessage( hWndList, LB_DIR, 0x0000, (LONG)(LPSTR) szDirectoryPath ); nCount = (int) SendMessage( hWndList, LB_GETCOUNT, 0, 0L ); if ( nCount <= 0 ) { // If there doesn't exist a WSK file disable the buttons OK and Delete SetCtrlState(vSubtask, "ImportWSK", zCONTROL_STATUS_ENABLED, FALSE); SetCtrlState(vSubtask, "DeleteWSK", zCONTROL_STATUS_ENABLED, FALSE); return( 0 ); } for ( i = 0; i < nCount; i++ ) { SendMessage( hWndList, LB_GETTEXT, i, (LONG)(LPSTR) szMetaName ); TraceLineS( "//// List Meta Name: ", szMetaName ); /* * remove 4 Bytes at the end of the string (.wsk) */ *(szMetaName + zstrlen(szMetaName) -4 ) = 0; // Create the List entity CreateEntity( vImportList, "KatalogFile", zPOS_AFTER ); SetAttributeFromString( vImportList, "KatalogFile", "Name", szMetaName ); } return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: EnqueueInstance // // PARAMETERS: zVIEW vInstance - View to the instance to be enqueued // zPCHAR szEntityNames - A string containing 1 or // more entity names on which to enqueue // the instance. The first entity name // MUST BE the root of the object and // the remaining entity names MUST be // separated by the plus '+' character. // // RETURN CODES: 0 - Enqueue successful // 1 - Enqueue unsuccessful, the instance is already // Enqueued // zCALL_ERROR - Enqueue unsuccessful, error in processing // ///////////////////////////////////////////////////////////////////////////// zSHORT OPERATION EnqueueInstance( zVIEW vInstance, zPCHAR szEntityNames ) { zVIEW vEnqueue; zVIEW vEnqueueHolder; zVIEW vQual; zVIEW vWkInstance; zPCHAR szEntityNamePtr; zCHAR szCurrentEntity[ 34 ]; zCHAR szLevel[ 2 ]; zSHORT nEntity, nEnqueue, nIdx, nRC, nRetries; zLONG lER_Token; zCHAR szTimestamp[ 6 ]; zCHAR szObjectName[ 34 ]; zCHAR szUserID[ 34 ]; zCHAR szPassword[ 34 ]; zCHAR szKey[ 64 ]; zCHAR szMsg[ 256 ]; // We put the enqueue logic in a for loop so we can restart the // enqueue if the enqueue fails and we cannot find the owner of // the enqueue. nRetries = 4; if ( MiGetObjectNameForView( szObjectName, vInstance ) < 0 ) return( zCALL_ERROR ); for ( ; ; ) { // Set up work variables szEntityNamePtr = szEntityNames; _fstrcpy( szLevel, "R" ); nEntity = nEnqueue = 0; // Set up a multiple root instance for enqueueing if ( ActivateEmptyObjectInstance( &vEnqueue, szlCGENQUEU, vInstance, zMULTIPLE ) != 0 ) { return( zCALL_ERROR ); } // Create a view on the instance so we do not step on the applications // cursor positions. CreateViewFromViewForTask( &vWkInstance, vInstance, 0 ); // Get timestamp and user information for enqueue MiGetDateTimeForOI( szTimestamp, vWkInstance ); SysGetUserID( vInstance, szUserID, szPassword ); if ( szUserID[ 0 ] == 0 ) _fstrcpy( szUserID, "(null)" ); // Loop for each entity type to be enqueued while ( szEntityNamePtr[ 0 ] ) { // Gather the next entity name on which to enqueue nIdx = 0; while ( szEntityNamePtr[ 0 ] && szEntityNamePtr[ 0 ] != '+' ) { szCurrentEntity[ nIdx++ ] = szEntityNamePtr[ 0 ]; szEntityNamePtr++; } szCurrentEntity[ nIdx ] = 0; if ( szEntityNamePtr[ 0 ] == '+' ) szEntityNamePtr++; nEntity++; // Now that an entity name has been gathered, troll the instance // for every occurrence of that entity type and create an // enqueue instance for it nRC = SetCursorFirstEntity( vWkInstance, szCurrentEntity, zSCOPE_OI ); if ( nRC == zCALL_ERROR ) { DropView( vWkInstance ); DropObjectInstance( vEnqueue ); return( zCALL_ERROR ); } if ( nRC >= zCURSOR_SET ) { lER_Token = MiGetERTokenForEntity( vWkInstance, szCurrentEntity ); do { // Set up an enqueue instance, The ER_Token and the Instance // key are the unique keys to the object, a duplicate instance // on the database will result in an enqueue failure with the // instance in use. The UserID combined with the Timestamp is // the non-unique key for deletion of a logical enqueue. // The object name and level ( 'R' - root, 'C' - child ) are // informational only. CreateEntity( vEnqueue, szlEnqueue, zPOS_AFTER ); SetAttributeFromInteger( vEnqueue, szlEnqueue, szlER_Token, lER_Token ); MiGetKeyFromInstance( szKey, 61, vWkInstance, szCurrentEntity ); SetAttributeFromString( vEnqueue, szlEnqueue, szlInstanceKey, szKey ); SetAttributeFromVariable( vEnqueue, szlEnqueue, szlTimestamp, szTimestamp, zTYPE_DATETIME, 6, 0, 0 ); SetAttributeFromString( vEnqueue, szlEnqueue, szlType, "U" ); SetAttributeFromString( vEnqueue, szlEnqueue, szlUser, szUserID ); SetAttributeFromString( vEnqueue, szlEnqueue, szlObject, szObjectName ); SetAttributeFromString( vEnqueue, szlEnqueue, szlLevel, szLevel ); nEnqueue++; } while ( SetCursorNextEntity( vWkInstance, szCurrentEntity, zSCOPE_OI ) >= zCURSOR_SET ); } // After processing an entity type, all other enqueues are at the // child level szLevel[ 0 ] = 'C'; } // Now that we're done gathering the enqueue information, we can drop // the view to the instance DropView( vWkInstance ); // The enqueue instance has been built, now it is time to insert it // into the database for locking the instance. nRC = CommitObjectInstance( vEnqueue ); if ( nRC != zDUPLICATE_ROOT ) { DropObjectInstance( vEnqueue ); return( nRC ); } // The enqueue failed, now we will determine the owner of the enqueue // to see if we are conflicting with ourself or to report the owner // to the enqueue requestor SetCursorFirstEntity( vEnqueue, szlEnqueue, 0 ); do { fnBuildQualForEnqueue( vEnqueue, &vQual ); nRC = ActivateObjectInstance( &vEnqueueHolder, szlCGENQUEU, vInstance, vQual, zSINGLE ); DropObjectInstance( vQual ); if ( nRC < -1 ) return( zCALL_ERROR ); else if ( nRC >= 0 ) break; else DropObjectInstance( vEnqueueHolder ); } while ( SetCursorNextEntity( vEnqueue, szlEnqueue, 0 ) >= zCURSOR_SET ); // If the enqueue holder was not found, then the enqueue may have // disappeared while trying to find the holder, retry the enqueue // operation. nRetries--; if ( nRC == -1 ) { if ( nRetries == 0 ) return( zCALL_ERROR ); } // Report on the enqueue holder GetStringFromAttribute( szKey, vEnqueueHolder, szlEnqueue, szlUser ); GetStringFromAttribute( &szKey[ 30 ], vEnqueueHolder, szlEnqueue, szlObject ); // if the current enqueue holder is the current user for the // same object type, then offer to drop the previous enqueue and // re-establish the enqueue for the current user if ( _fstrcmp( szUserID, szKey ) == 0 && _fstrcmp( szObjectName, &szKey[ 30 ] ) == 0 && nRetries ) { // we will retry this once and once only nRetries = 1; _fstrcpy( szMsg, "The " ); _fstrcat( szMsg, szObjectName ); _fstrcat( szMsg, " is already enqueued by you in this session or" " a previous session. Would you like to release" " the previously held enqueue?" ); nRC = MessagePrompt( vInstance, "1", szlEnqueue, szMsg, 0, zBUTTONS_YESNO, zRESPONSE_YES, zICON_QUESTION ); if ( nRC == zRESPONSE_NO ) { DropObjectInstance( vEnqueue ); DropObjectInstance( vEnqueueHolder ); return( 1 ); } // The user wants to delete a previous enqueue for the same // object type, build the qualification for the delete and remove // the prior enqueue. fnBuildQualForEnqueueDelete( vEnqueueHolder, &vQual ); DropObjectInstance( vEnqueueHolder ); nRC = ActivateObjectInstance( &vEnqueueHolder, szlCGENQUEU, vInstance, vQual, zMULTIPLE ); DropObjectInstance( vQual ); if ( nRC < 0 ) return( zCALL_ERROR ); nRC = SetCursorFirstEntity( vEnqueueHolder, szlEnqueue, 0 ); while ( nRC >= zCURSOR_SET ) nRC = DeleteEntity( vEnqueueHolder, szlEnqueue, zREPOS_NEXT ); nRC = CommitObjectInstance( vEnqueueHolder ); DropObjectInstance( vEnqueueHolder ); // If the attempt to reuse the enqueue failed on a database error, // return that error. Otherwise, return zero ==> the enqueue was // reused. if ( nRC < 0 ) return( zCALL_ERROR ); else return( 0 ); } else { // Report on the owner of the enqueue _fstrcpy( szMsg, "The " ); _fstrcat( szMsg, szObjectName ); _fstrcat( szMsg, " is currently in use by " ); _fstrcat( szMsg, szKey ); if ( _fstrcmp( szObjectName, &szKey[ 30 ] ) != 0 ) { _fstrcat( szMsg, " under the object " ); _fstrcat( szMsg, &szKey[ 30 ] ); } _fstrcat( szMsg, "." ); MessagePrompt( vInstance, "1", szlEnqueue, szMsg, 0, zBUTTONS_OK, zRESPONSE_OK, 0 ); DropObjectInstance( vEnqueue ); DropObjectInstance( vEnqueueHolder ); return( 1 ); } } // End of for loop for enqueueing // If we reach here, then the enqueue was in use and failed. return( 1 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: DequeueInstance // // PARAMETERS: zVIEW vInstance - View to the instance to be dequeued // zSHORT nCheckOnly - 0 to dequeue // - non-zero to check the instance is // enqueued only. // // RETURN CODES: 0 - Dequeue successful // 1 - Enqueue not found // zCALL_ERROR - Dequeue unsuccessful, error in processing // ///////////////////////////////////////////////////////////////////////////// zSHORT OPERATION DequeueInstance( zVIEW vInstance, zSHORT nCheckOnly ) { zVIEW vEnqueue; zVIEW vQual; zLONG lActivateFlags; zCHAR szObjectName[ 34 ]; zCHAR szUserID[ 34 ]; zCHAR szPassword[ 34 ]; zCHAR szTimestamp[ 6 ]; zSHORT nRC; if ( MiGetObjectNameForView( szObjectName, vInstance ) < 0 ) return( zCALL_ERROR ); // Set up a an enqueue instance for building the qual object if ( ActivateEmptyObjectInstance( &vEnqueue, szlCGENQUEU, vInstance, zSINGLE ) != 0 ) { return( zCALL_ERROR ); } SysGetUserID( vInstance, szUserID, szPassword ); if ( szUserID[ 0 ] == 0 ) zstrcpy( szUserID, "(null)" ); MiGetDateTimeForOI( szTimestamp, vInstance ); if ( nCheckOnly ) lActivateFlags = zSINGLE; else lActivateFlags = zMULTIPLE; // Build a partial enqueue instance for passing to the qualification // build function fnBuildQualForEnqueueDelete. CreateEntity( vEnqueue, szlEnqueue, zPOS_FIRST ); SetAttributeFromVariable( vEnqueue, szlEnqueue, szlTimestamp, szTimestamp, zTYPE_DATETIME, 6, 0, 0 ); SetAttributeFromString( vEnqueue, szlEnqueue, szlUser, szUserID ); fnBuildQualForEnqueueDelete( vEnqueue, &vQual ); DropObjectInstance( vEnqueue ); nRC = ActivateObjectInstance( &vEnqueue, szlCGENQUEU, vInstance, vQual, lActivateFlags ); DropObjectInstance( vQual ); if ( nRC < -1 ) return( zCALL_ERROR ); else if ( nRC == -1 ) { DropObjectInstance( vEnqueue ); return( 1 ); } // The enqueue was found, if it is a check only, drop the instance // and return 0, otherwise, delete the enqueue. if ( nCheckOnly ) { DropObjectInstance( vEnqueue ); return( 0 ); } nRC = SetCursorFirstEntity( vEnqueue, szlEnqueue, 0 ); while ( nRC >= zCURSOR_SET ) nRC = DeleteEntity( vEnqueue, szlEnqueue, zREPOS_NEXT ); nRC = CommitObjectInstance( vEnqueue ); DropObjectInstance( vEnqueue ); if ( nRC < 0 ) return( zCALL_ERROR ); return( 0 ); }
//:VIEW OperationXOG BASED ON LOD TZZOXOGO zOPER_EXPORT zSHORT OPERATION oTZOGSRCO_GenerateXOG( zVIEW OperationGroup ) { zVIEW OperationXOG = 0; //:VIEW OperationGroupT BASED ON LOD TZOGSRCO zVIEW OperationGroupT = 0; //:VIEW CurrentLPLR BASED ON LOD TZCMLPLO zVIEW CurrentLPLR = 0; //:STRING ( 513 ) XOG_FileName zCHAR XOG_FileName[ 514 ] = { 0 }; //:STRING ( 513 ) POG_FileName zCHAR POG_FileName[ 514 ] = { 0 }; //:STRING ( 200 ) szMsg zCHAR szMsg[ 201 ] = { 0 }; //:INTEGER lFile zLONG lFile = 0; //:SHORT nRC zSHORT nRC = 0; zSHORT RESULT; zCHAR szTempString_0[ 33 ]; zCHAR szTempString_1[ 33 ]; //:// Build the executable Global Object executable for all Operations in the LPLR. //:// Activate or initialize the XOG executable object. //:GET VIEW CurrentLPLR NAMED "TaskLPLR" RESULT = GetViewByName( &CurrentLPLR, "TaskLPLR", OperationGroup, zLEVEL_TASK ); //:XOG_FileName = CurrentLPLR.LPLR.ExecDir + "\" + CurrentLPLR.LPLR.Name + ".XOG" GetStringFromAttribute( XOG_FileName, CurrentLPLR, "LPLR", "ExecDir" ); ZeidonStringConcat( XOG_FileName, 1, 0, "\\", 1, 0, 514 ); GetVariableFromAttribute( szTempString_0, 0, 'S', 33, CurrentLPLR, "LPLR", "Name", "", 0 ); ZeidonStringConcat( XOG_FileName, 1, 0, szTempString_0, 1, 0, 514 ); ZeidonStringConcat( XOG_FileName, 1, 0, ".XOG", 1, 0, 514 ); //:lFile = SysOpenFile( OperationGroup, XOG_FileName, COREFILE_READ ) lFile = SysOpenFile( OperationGroup, XOG_FileName, COREFILE_READ ); //:IF lFile < 0 if ( lFile < 0 ) { //:// Executable has not yet been generated. //:ACTIVATE OperationXOG EMPTY RESULT = ActivateEmptyObjectInstance( &OperationXOG, "TZZOXOGO", OperationGroup, zSINGLE ); //:CREATE ENTITY OperationXOG.TZZOXOGO RESULT = CreateEntity( OperationXOG, "TZZOXOGO", zPOS_AFTER ); //:OperationXOG.TZZOXOGO.NAME = CurrentLPLR.LPLR.Name SetAttributeFromAttribute( OperationXOG, "TZZOXOGO", "NAME", CurrentLPLR, "LPLR", "Name" ); //:ELSE } else { //:SysCloseFile( OperationGroup, lFile, 0 ) SysCloseFile( OperationGroup, lFile, 0 ); //:// Get current executable File. //:ActivateOI_FromFile( OperationXOG, "TZZOXOGO", OperationGroup, XOG_FileName, zSINGLE ) ActivateOI_FromFile( &OperationXOG, "TZZOXOGO", OperationGroup, XOG_FileName, zSINGLE ); //:// Delete current source file entries. //:FOR EACH OperationXOG.GLOBALOPERATIONSOURCEFILE RESULT = SetCursorFirstEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:DELETE ENTITY OperationXOG.GLOBALOPERATIONSOURCEFILE NONE RESULT = DeleteEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", zREPOS_NONE ); RESULT = SetCursorNextEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "" ); } //:END } //:END //:NAME VIEW OperationXOG "OperationXOG" SetNameForView( OperationXOG, "OperationXOG", 0, zLEVEL_TASK ); //:// Build the executable components from each POG Operation. //:SET CURSOR FIRST CurrentLPLR.W_MetaType WHERE CurrentLPLR.W_MetaType.Type = 14 // 14 is Global Operation Group RESULT = SetCursorFirstEntityByInteger( CurrentLPLR, "W_MetaType", "Type", 14, "" ); //:FOR EACH CurrentLPLR.W_MetaDef RESULT = SetCursorFirstEntity( CurrentLPLR, "W_MetaDef", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:POG_FileName = CurrentLPLR.LPLR.MetaSrcDir + "\" + CurrentLPLR.W_MetaDef.Name + ".POG" GetStringFromAttribute( POG_FileName, CurrentLPLR, "LPLR", "MetaSrcDir" ); ZeidonStringConcat( POG_FileName, 1, 0, "\\", 1, 0, 514 ); GetVariableFromAttribute( szTempString_1, 0, 'S', 33, CurrentLPLR, "W_MetaDef", "Name", "", 0 ); ZeidonStringConcat( POG_FileName, 1, 0, szTempString_1, 1, 0, 514 ); ZeidonStringConcat( POG_FileName, 1, 0, ".POG", 1, 0, 514 ); //:nRC = ActivateOI_FromFile( OperationGroupT, "TZOGSRCO", OperationGroup, POG_FileName, zSINGLE + 8192 ) nRC = ActivateOI_FromFile( &OperationGroupT, "TZOGSRCO", OperationGroup, POG_FileName, zSINGLE + 8192 ); //:IF nRC < 0 if ( nRC < 0 ) { //:szMsg = "Can't open POG file, " + POG_FileName ZeidonStringCopy( szMsg, 1, 0, "Can't open POG file, ", 1, 0, 201 ); ZeidonStringConcat( szMsg, 1, 0, POG_FileName, 1, 0, 201 ); //:IssueError( OperationGroup,0,0, szMsg ) IssueError( OperationGroup, 0, 0, szMsg ); //:RETURN -1 return( -1 ); } //:END //:// Create Source file entry. //:CREATE ENTITY OperationXOG.GLOBALOPERATIONSOURCEFILE RESULT = CreateEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", zPOS_AFTER ); //:OperationXOG.GLOBALOPERATIONSOURCEFILE.NAME = OperationGroupT.GlobalOperationGroup.Name SetAttributeFromAttribute( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "NAME", OperationGroupT, "GlobalOperationGroup", "Name" ); //:OperationXOG.GLOBALOPERATIONSOURCEFILE.LANGUAGETYPE = OperationGroupT.GlobalOperationGroup.LanguageType SetAttributeFromAttribute( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "LANGUAGETYPE", OperationGroupT, "GlobalOperationGroup", "LanguageType" ); //:// Create each Operation entry. //:FOR EACH OperationGroupT.Operation RESULT = SetCursorFirstEntity( OperationGroupT, "Operation", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:CREATE ENTITY OperationXOG.OPERATION RESULT = CreateEntity( OperationXOG, "OPERATION", zPOS_AFTER ); //:OperationXOG.OPERATION.NAME = OperationGroupT.Operation.Name SetAttributeFromAttribute( OperationXOG, "OPERATION", "NAME", OperationGroupT, "Operation", "Name" ); //:OperationXOG.OPERATION.TYPE = OperationGroupT.Operation.Type SetAttributeFromAttribute( OperationXOG, "OPERATION", "TYPE", OperationGroupT, "Operation", "Type" ); //:FOR EACH OperationGroupT.Parameter RESULT = SetCursorFirstEntity( OperationGroupT, "Parameter", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:CREATE ENTITY OperationXOG.PARAMETER RESULT = CreateEntity( OperationXOG, "PARAMETER", zPOS_AFTER ); //:OperationXOG.PARAMETER.NAME = OperationGroupT.Parameter.ShortDesc SetAttributeFromAttribute( OperationXOG, "PARAMETER", "NAME", OperationGroupT, "Parameter", "ShortDesc" ); //:OperationXOG.PARAMETER.DATATYPE = OperationGroupT.Parameter.DataType SetAttributeFromAttribute( OperationXOG, "PARAMETER", "DATATYPE", OperationGroupT, "Parameter", "DataType" ); RESULT = SetCursorNextEntity( OperationGroupT, "Parameter", "" ); } RESULT = SetCursorNextEntity( OperationGroupT, "Operation", "" ); //:END } RESULT = SetCursorNextEntity( CurrentLPLR, "W_MetaDef", "" ); //:END } //:END //:CommitOI_ToFile( OperationXOG, XOG_FileName, zASCII ) CommitOI_ToFile( OperationXOG, XOG_FileName, zASCII ); //:DropObjectInstance( OperationXOG ) DropObjectInstance( OperationXOG ); return( 0 ); // END }