//: SHORT nRC zOPER_EXPORT zSHORT OPERATION oKZXMLPGO_InitWebSessionObject( zPVIEW vKZXMLPGO, zVIEW AnyView, zPCHAR UserID ) { zSHORT nRC = 0; zSHORT RESULT; //:nRC = SfActivateSysEmptyOI( vKZXMLPGO, "KZXMLPGO", AnyView, zSINGLE ) nRC = SfActivateSysEmptyOI( vKZXMLPGO, "KZXMLPGO", AnyView, zSINGLE ); //:IF nRC >= 0 if ( nRC >= 0 ) { //:CREATE ENTITY vKZXMLPGO.Session RESULT = CreateEntity( *vKZXMLPGO, "Session", zPOS_AFTER ); //:vKZXMLPGO.Session.UserID = UserID SetAttributeFromString( *vKZXMLPGO, "Session", "UserID", UserID ); } //:END //:RETURN nRC return( nRC ); // END }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: SironCreateDataModel // // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT /*GLOBAL */ OPERATION SironCreateDataModel( zVIEW vSubtask, zPVIEW pvERD ) { zVIEW vERD_Window; zVIEW vTaskLPLR; GetViewByName( &vTaskLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK ); ActivateEmptyMetaOI( vSubtask, pvERD, zSOURCE_ERD_META, zSINGLE | zLEVEL_APPLICATION ); // Build Root Instance CreateMetaEntity( vSubtask, *pvERD, "EntpER_Model", zPOS_AFTER ); SetAttributeFromAttribute( *pvERD, "EntpER_Model", "Name", vTaskLPLR, "LPLR", "Name" ); SetAttributeFromString( *pvERD, "EntpER_Model", "Desc", "Siron Catalogs DataModel" ); SetNameForView( *pvERD, "TZEREMDO", vSubtask, zLEVEL_TASK ); // Data Model exists, enable ERD Control GetParentWindow( &vERD_Window, vSubtask ); SetCtrlState( vERD_Window, "ERD", zCONTROL_STATUS_ENABLED, TRUE ); // Set window Title with check out state SetTitleWithCheckOutState( vERD_Window, "Data Model", "TZEREMDO", *pvERD, "EntpER_Model", zSOURCE_ERD_META ); return( 0 ); } // SironCreateDataModel
/* The user selected a LOD in the Object list. Load the LOD meta and copy all object operations to the editor work object. */ zOPER_EXPORT zSHORT OPERATION ObjList_AddObjOpersToWorkList( zVIEW vSubtask ) { zVIEW vObjList; zVIEW vLOD; zVIEW vEdWrk; zSHORT nRC; zSHORT nLth; zCHAR szOpName[ 255 ]; GetWorkView( &vEdWrk ); GetViewByName( &vObjList, "TZEDCWZD_TZCMLPLO_List", vSubtask, zLEVEL_TASK ); ActivateMetaOI( vSubtask, &vLOD, vObjList, zREFER_LOD_META, 0 ); GetStringFromAttribute( szOpName, vObjList, "W_MetaDef", "Name" ); zstrcat( szOpName, "." ); nLth = zstrlen( szOpName ); for ( nRC = SetCursorFirstEntity( vLOD, "OperationList", 0 ); nRC == zCURSOR_SET; nRC = SetCursorNextEntity( vLOD, "OperationList", 0 ) ) { GetStringFromAttribute( &szOpName[ nLth ], vLOD, "OperationList", "Name" ); CreateEntity( vEdWrk, "Oper", zPOS_LAST ); SetAttributeFromString( vEdWrk, "Oper", "Name", szOpName ); } DropMetaOI( vSubtask, vLOD ); DropView( vObjList ); return( 0 ); } // ObjList_AddObjOpersToWorkList
zOPER_EXPORT zSHORT OPERATION OpIns_RebuildOperList( zVIEW vSubtask ) { zCHAR szCurrentType[ 5 ]; zVIEW vProfileXFER; zVIEW vEdWrk; GetWorkView( &vEdWrk ); GetProfileView( &vProfileXFER ); GetStringFromAttribute( szCurrentType, vProfileXFER, "ED", "OpIns_CurrentType" ); // Default of CurrentType is 'Z'... if ( *szCurrentType == 0 ) { zstrcpy( szCurrentType, "Z" ); SetAttributeFromString( vProfileXFER, "ED", "OpIns_CurrentType", szCurrentType ); } // Check to see if the operations for the current type are already // loaded. If they are, then delete the list. if ( SetCursorFirstEntityByString( vEdWrk, "OperListType", "Type", szCurrentType, 0 ) == zCURSOR_SET ) { DeleteEntity( vEdWrk, "OperListType", zREPOS_FIRST ); } // if ( SetCursor...)... // Now call BuildOperList to rebuild the oper list. OpIns_BuildOperList( vSubtask ); return( 0 ); } // OpIns_RebuildOperList
zOPER_EXPORT zSHORT OPERATION zwTZVSDBAD_FindStatement( zVIEW XPG2, zVIEW XPG ) { zSHORT StatementFound; zSHORT RESULT; zLONG lTempInteger_0; zSHORT nZRetCode; RESULT = SetCursorFirstEntity( XPG2, "Statement", "" ); StatementFound = 0; while ( StatementFound == 0 && RESULT == zCURSOR_SET ) { lTempInteger_0 = CheckExistenceOfEntity( XPG2, "Substatement" ); if ( lTempInteger_0 == 0 ) { nZRetCode = SetViewToSubobject( XPG2, "Substatement" ); StatementFound = zwTZVSDBAD_FindStatement( XPG2, XPG ); nZRetCode = ResetViewFromSubobject( XPG2 ); } if ( StatementFound == 0 ) { if ( CompareAttributeToAttribute( XPG2, "Statement", "RelativeLineNumber", XPG, "OperationText", "RelativeLineNumber" ) == 0 ) { StatementFound = 1; if ( CompareAttributeToString ( XPG, "OperationText", "BreakPointFlag", ">" ) == 0 ) { nZRetCode = SetAttributeFromString( XPG2, "Statement", "BreakPointFlag", "" ); nZRetCode = SetAttributeFromString( XPG, "OperationText", "BreakPointFlag", "" ); } else { nZRetCode = SetAttributeFromString( XPG2, "Statement", "BreakPointFlag", "Y" ); nZRetCode = SetAttributeFromString( XPG, "OperationText", "BreakPointFlag", ">" ); } } else { RESULT = SetCursorNextEntity( XPG2, "Statement", "" ); } } lTempInteger_0 = CheckExistenceOfEntity( XPG2, "Statement" ); } return( StatementFound ); }
zOPER_EXPORT zSHORT OPERATION UpgradeCtrlMap( zVIEW vSubtask, zVIEW OrigW, zVIEW OrigWC ) { #if 0 zLONG lTempInteger_0; zSHORT RESULT; zCHAR szTempString_0[ 33 ]; zSHORT nZRetCode; zLONG lTempInteger_1; zLONG lTempInteger_2; lTempInteger_0 = CheckExistenceOfEntity( OrigWC, "CtrlMapView" ); if ( lTempInteger_0 >= 0 ) { nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMapView", "Name" ); RESULT = SetCursorFirstEntityByString( OrigW, "ViewObjRef", "Name", szTempString_0, "" ); } else { if ( CompareAttributeToString ( OrigWC, "CtrlMap", "X_ViewName", "" ) != 0 ) { nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_ViewName" ); RESULT = SetCursorFirstEntityByString( OrigW, "ViewObjRef", "Name", szTempString_0, "" ); } } lTempInteger_1 = CheckExistenceOfEntity( OrigWC, "CtrlMapView" ); if ( lTempInteger_1 < 0 && CompareAttributeToString ( OrigWC, "CtrlMap", "X_ViewName", "" ) != 0 ) { nZRetCode = IncludeSubobjectFromSubobject( OrigWC, "CtrlMapView", OrigW, "ViewObjRef", zPOS_AFTER ); } lTempInteger_2 = CheckExistenceOfEntity( OrigWC, "CtrlMapLOD_Attribute" ); if ( lTempInteger_2 < 0 && CompareAttributeToString ( OrigWC, "CtrlMap", "X_AttributeName", "" ) != 0 ) { nZRetCode = IncludeAttributeMapping( vSubtask, OrigW, OrigWC ); } nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_ViewName", "" ); nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_EntityName", "" ); nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_AttributeName", "" ); nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_Context", "" ); #endif return( 0 ); }
///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// // // OPERATION: SetMemoryToAttribute // // Returns: 0 - Attribute successfully set // otw - Error setting attribute // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION SetMemoryToAttribute( zLONG hMemory, zVIEW vApp, zCPCHAR cpcEntityName, zCPCHAR cpcAttributeName ) { ZDrMemory *pMemory = (ZDrMemory *) hMemory; return( SetAttributeFromString( vApp, cpcEntityName, cpcAttributeName, pMemory->GetStringFromMemory( ) ) ); }
zOPER_EXPORT zSHORT OPERATION VML_Postbuild( zVIEW vSubtask ) { zVIEW vProfileXFER; // Call postbuild routine in ZEDITOR to reposition the window. fnCallEditorOperation( vSubtask, "VML_Postbuild" ); GetProfileView( &vProfileXFER ); // Set the default values of the Show... attributes. if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowDeclarations", "" ) == 0 ) { SetAttributeFromString( vProfileXFER, "ED", "VML_ShowDeclarations", "Y" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowControlStatements", "" ) == 0 ) { SetAttributeFromString( vProfileXFER, "ED", "VML_ShowControlStatements", "Y" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowViewStatements", "" ) == 0 ) { SetAttributeFromString( vProfileXFER, "ED", "VML_ShowViewStatements", "Y" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowEntityStatements", "" ) == 0 ) { SetAttributeFromString( vProfileXFER, "ED", "VML_ShowEntityStatements", "Y" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowOperators", "" ) == 0 ) { SetAttributeFromString( vProfileXFER, "ED", "VML_ShowOperators", "Y" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowOther", "" ) == 0 ) { SetAttributeFromString( vProfileXFER, "ED", "VML_ShowOther", "Y" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_InsertFull", "" ) == 0 ) { SetAttributeFromString( vProfileXFER, "ED", "VML_InsertFull", "Y" ); } VML_DisplayList( vSubtask ); return( 0 ); } // VML_BuildTextList
zOPER_EXPORT void OPERATION SetZeidonDateAttributeFromOleDateTime( COleDateTime& DateTime, zVIEW vApp, zCPCHAR cpcEntity, zCPCHAR cpcAttribute ) { zCHAR szDate[ 20 ]; SetZeidonDateFromOleDateTime( szDate, DateTime ); SetAttributeFromString( vApp, cpcEntity, cpcAttribute, szDate ); }
zOPER_EXPORT zSHORT OPERATION VML_BuildTextList( zVIEW vSubtask ) { zSHORT i; zVIEW vProfileXFER; GetProfileView( &vProfileXFER ); // Add each of the 'standard' VML statements to the text list. for ( i = 0; VML_TextStrings[ i ].pszText != 0; i++ ) { if ( SetCursorFirstEntityByString( vProfileXFER, "VML_Text", "Text", VML_TextStrings[ i ].pszText, 0 ) != zCURSOR_SET ) { // Text doesn't exist, so create it. CreateEntity( vProfileXFER, "VML_Text", zPOS_LAST ); SetAttributeFromString( vProfileXFER, "VML_Text", "Text", VML_TextStrings[ i ].pszText ); SetAttributeFromString( vProfileXFER, "VML_Text", "Type", VML_TextStrings[ i ].pszType ); SetAttributeFromString( vProfileXFER, "VML_Text", "UserDefined", "N" ); if ( VML_TextStrings[ i ].pszInsertText ) SetAttributeFromString( vProfileXFER, "VML_Text", "InsertText", VML_TextStrings[ i ].pszInsertText ); if ( VML_TextStrings[ i ].pszInsertTextFull ) SetAttributeFromString( vProfileXFER, "VML_Text", "InsertTextFull", VML_TextStrings[ i ].pszInsertTextFull ); } } OrderEntityForView( vProfileXFER, "VML_Text", "Text A" ); VML_DisplayList( vSubtask ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZWDLGSO_ConvertCtrlTextToWeb // // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT /*TRANSFORMATION */ OPERATION oTZWDLGSO_ConvertCtrlTextToWeb( zVIEW vTZWDLGSO /* BASED ON LOD TZWDLGSO */ ) { zCHAR NewText[ 255 ]; zCHAR OrigText[ 255 ]; zPCHAR pszIn; zPCHAR pszOutEnd; zPCHAR pszOut; // Convert the Control Text attribute to Web characters. // Initially, that is converting "&&" to "&". GetVariableFromAttribute( OrigText, 0, 'S', 254, vTZWDLGSO, "Control", "Text", "", 0 ); pszIn = OrigText; pszOut = NewText; pszOutEnd = pszOut + 254; while ( pszOut < pszOutEnd && *pszIn != 0 ) { if ( *pszIn == '&' ) if ( *(pszIn + 1) == '&' ) { // This is a double apersand, so convert to "&". zstrcpy( pszOut, "&" ); pszIn = pszIn + 2; pszOut = pszOut + 5; } else { // This is a single apersand, so remove it. pszIn++; } else { // This is reqular character, so copy it. *pszOut = *pszIn; pszOut++; pszIn++; } } *pszOut = 0; SetAttributeFromString( vTZWDLGSO, "Control", "Text", NewText ); return( 0 ); } // oTZWDLGSO_ConvertCtrlTextToWeb
//////////////////////////////////////////////////////////////////////////////////////////////////////// // // OPERATION: SetWSKInLod // zOPER_EXPORT zSHORT OPERATION SetWSKInLod( zVIEW vSubtask, zVIEW vAktView, zPCHAR szFilename ) { zCHAR *pszFilename; zCHAR *pszEndname; // Get the Filename to set it into the WorkLod pszFilename = zstrrchr( szFilename, '\\' ) + 1; pszEndname = zstrchr( pszFilename, '.' ); *pszEndname = 0; CreateEntity( vAktView, "KatalogFile", zPOS_FIRST ); SetAttributeFromString( vAktView, "KatalogFile", "Name", pszFilename); // To import the file we need the extension *pszEndname = '.'; return( 0 ); } // SetWSKInLod
///////////////////////////////////////////////////////////////////////////// // // 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
zOPER_EXPORT zSHORT OPERATION UpgradeControl( zVIEW vSubtask, zVIEW OrigW, zVIEW OrigWC, zVIEW vType, zVIEW vPE ) { #if 0 zLONG lType; zCHAR szTag[ 35 ]; zSHORT RESULT; zSHORT nZRetCode; RESULT = SetCursorFirstEntity( OrigWC, "CtrlCtrl", "" ); while ( RESULT >= 0 ) { nZRetCode = SetViewToSubobject( OrigWC, "CtrlCtrl" ); nZRetCode = UpgradeControl( vSubtask, OrigW, OrigWC, vType, vPE ); nZRetCode = ResetViewFromSubobject( OrigWC ); RESULT = SetCursorNextEntity( OrigWC, "CtrlCtrl", "" ); } RESULT = SetCursorFirstEntity( OrigWC, "CtrlMap", "" ); while ( RESULT >= 0 ) { nZRetCode = UpgradeCtrlMap( vSubtask, OrigW, OrigWC ); RESULT = SetCursorNextEntity( OrigWC, "CtrlMap", "" ); } // Upgrade Control to relate to ControlDef if ( CheckExistenceOfEntity ( OrigWC, "ControlDef" ) < 0 ) { GetIntegerFromAttribute( &lType, OrigWC, "Control", "Type" ); SetCursorFirstEntityByInteger( vType, "Control", "Type", lType, "" ); GetStringFromAttribute( szTag, vType, "Control", "Tag" ); SetCursorFirstEntityByString( vPE, "ControlDef", "Tag", szTag, "" ); IncludeSubobjectFromSubobject( OrigWC, "ControlDef", vPE, "ControlDef", zPOS_AFTER ); SetAttributeFromString ( OrigWC, "Control", "Type", ""); } #endif return( 0 ); }
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 ); }
/////////////////////////////////////////////////////////////////////// // // PURPOSE: This function paints the list attributes from the user spec // into the existing partition. // //////////////////////////////////////////////////////////////////////// zOPER_EXPORT zLONG OPERATION ofnTZWDLGSO_AutoPntFldPartWLits( zVIEW vSubtask, zVIEW vUserSpec, zVIEW vNewDialog, zPCHAR szListType ) { zVIEW vAutoDesWk; zVIEW vSubobject; zVIEW vTempStyle; zVIEW vCtrlDef; zLONG k, j; zLONG lCC, lCL; zLONG lMaxLines; zLONG lLine, lFirstPaintLine, lFieldsPainted, lColumn; zLONG lMaxFieldDLG_X, lMaxText, lPush; zLONG lGroupDLG_X, lGroupDLG_Y; zSHORT RESULT; zLONG lLastPaintLine, lLastWindowLine, lMaxLength; // zCHAR cUsage[ 1 ]; zCHAR szMapEntity[ 33 ]; zCHAR szMapAttribute[ 33 ]; zCHAR szType[ 33 ]; zCHAR szWorkString[ 256 ]; zCHAR X_LOD_Attribute[ 16 ]; zCHAR X_ER_Attribute[ 15 ]; // TraceLineS( "IN", " AutoPaintPartitionWithFields" ); // Set up variables to either I_LOD listbox or L_LOD listbox. if ( szListType[ 0 ] == 'I' ) { zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" ); zstrcpy( X_ER_Attribute, "I_ER_Attribute" ); } else { zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" ); zstrcpy( X_ER_Attribute, "L_ER_Attribute" ); } // TraceLineS( "IN", " AutoPaintPartitionWithFields" ); GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK ); GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK ); CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 ); lCL = 12; lCC = 5; /* Create a new view that will point to the UIS_ViewObjRef entity in the user spec object. Sometimes vUserSpec is pointing to a recursive subobject and UI_ViewObjRef cannot be accessed. */ CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 ); ResetView( vTempStyle ); SetViewToSubobject( vSubobject, "CtrlCtrl" ); /* Delete any existing fields in the listbox */ RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); } GetIntegerFromAttribute( &lMaxLines, vNewDialog, "Control", "SZDLG_Y" ); szMapEntity[ 0 ] = 0; lFirstPaintLine = 0; lLastPaintLine = 1; lLine = 1; lMaxFieldDLG_X = 0; lMaxLength = 0; lMaxText = 0; lPush = 0; lFieldsPainted = 0; // cUsage[ 0 ] = 'U'; /* If there is a paint object, loop through its attributes */ RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" ); while ( RESULT > zCURSOR_UNCHANGED ) { /* The last line painted was at this posititon */ lLastPaintLine = lLine; lColumn = 1; /* Create the Text Field for the Attribute */ CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER ); SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lLine ); if ( lFirstPaintLine == 0 ) lFirstPaintLine = lLine; SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lColumn ); /* Creating text field. */ SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "Text", "" ); IncludeSubobjectFromSubobject( vSubobject, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); // Remove the text border. SetAttributeFromInteger( vSubobject, "Control", "Subtype", zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP ); GetStringFromAttribute( szWorkString, vUserSpec, X_ER_Attribute, "ListPaintLit" ); GetStringFromAttribute( szMapAttribute, vUserSpec, X_ER_Attribute, "Name" ); // If there is no paint literal for this attribute then // use the attribute name as the paint literal. if ( szWorkString[ 0 ] == 0 ) zstrcpy( szWorkString, szMapAttribute ); SetAttributeFromString( vSubobject, "Control", "Text", szWorkString ); j = zstrlen( szWorkString ); j = j * lCC; // Determine the size of the longest paint literal. if ( j > lMaxText ) lMaxText = j; SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", j ); SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL ); /* Add the length of the longest paint literal to the column so the attribute field will be painted there */ lColumn += j; lColumn = lColumn + lCC; // If there is no paint length for the field, then // use the field's length. j = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType ); j = j * lCC; // If there is no paint length for the field, then // use the field's length. if ( j > 100 ) j = 100; else if ( j < 25 ) j = 25; // Create the appropriate Data Field for the Attribute. CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER ); SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lLine ); SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lColumn ); SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", j ); SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL ); // Determine the maximum column length. if ( lMaxFieldDLG_X < lColumn ) lMaxFieldDLG_X = lColumn; lColumn += j; lColumn = lColumn - 1 * lCC; // Determine the maximum length of colum and literal. if ( lMaxLength < lColumn ) lMaxLength = lColumn; SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "EditBox", "" ); IncludeSubobjectFromSubobject( vSubobject, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); // SetAttributeFromInteger( vSubobject, "Control", "Type", 1010 ); /* if ( cUsage[ 0 ] == 'U' ) { GetStringFromAttribute( cWork, vUserSpec, X_LOD_Attribute, "DERIVEDF" ); if ( cWork[ 0 ] != 0 ) SetAttributeFromCharacter( vSubobject, "Control", "Type", 1000 ); } */ /* setting the group and field's ENAME and ANAME */ CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER ); /* set the partitions OI name */ IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView", vTempStyle, "UIS_ViewObjRef", zPOS_AFTER ); IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute", vUserSpec, X_LOD_Attribute, zPOS_AFTER ); lFieldsPainted++; lLine = lLine + lCL; RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" ); } lLastPaintLine = lLine; /* Get the dimensions of the partition. */ GetIntegerFromAttribute( &lGroupDLG_X, vNewDialog, "Control", "SZDLG_X" ); GetIntegerFromAttribute( &lGroupDLG_Y, vNewDialog, "Control", "SZDLG_Y" ); RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { GetIntegerFromAttribute( &lLine, vSubobject, "Control", "PSDLG_Y" ); if ( lLine >= lFirstPaintLine && lLine <= lLastPaintLine ) { GetStringFromAttribute( szType, vSubobject, "ControlDef", "Tag" ); /* If the control is not a text control. */ if ( zstrcmp( szType, "Text" ) != 0 ) { GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" ); GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" ); if ( j < lMaxFieldDLG_X ) { j = lMaxFieldDLG_X - j; if ( ( lMaxFieldDLG_X + k ) > ( lMaxLength + lCC ) ) { if ( ( lMaxFieldDLG_X + k ) <= lGroupDLG_X ) { lMaxLength = lMaxFieldDLG_X +( k - lCC ); } else { j -=( ( lMaxFieldDLG_X + k ) - lGroupDLG_X ); if ( j > 0 ) { AddToAttributeFromInteger( vSubobject, "Control", "PSDLG_X", j ); lMaxLength = lGroupDLG_X - lCC; j = -1; } } } if ( j > 0 ) { SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lMaxFieldDLG_X ); } } } GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" ); GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" ); if ( ( j + k ) >= lGroupDLG_X ) { RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); } MessageSend( vNewDialog, "AD10304", "Autodesigner", "Partition too small( width )", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); /* the partition is not wide enough */ return( -1 ); } /////////////////////////////////////////////////////////// // Code to truncate fields which extend over the partition to // the right COMMENTED out. This is a 'too small' error as // noted above. // else // if ( (j + k) >= lGroupDLG_X ) // { // k =( lGroupDLG_X - 1 ) - j; // SetAttributeFromInteger( vSubobject, "Control", // "SZDLG_X", k ); // } //////////////////////////////////////////////////////////// } RESULT = SetCursorNextEntity( vSubobject, "Control", "" ); } lLastWindowLine = lLine; /* If the window painted has too many lines for the terminal being used for painting. Attempt to compress the window into a more manageable size by combining painted fields which are located on separate lines */ /* for ( i = 1; i < 8; i++ ) { if ( lLastWindowLine + 12 <= lMaxLines ) { break; } fnCompressPartition( vNewDialog, i, lFirstPaintLine, lMaxText, lMaxLines, &lLastPaintLine, &lLastWindowLine, &lMaxLength ); } */ if ( ( lLastWindowLine + lCL ) > lMaxLines ) { RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); } MessageSend( vNewDialog, "AD10305", "Autodesigner", "Partition too small( height )", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } // TraceLineS( "END", " AutoPaintPartitionWithFields" ); /* Return the last paint line for AutoDesign */ return( lLastPaintLine ); }
///////////////////////////////////////////////////////////////////////////// // // PURPOSE: This function places selected attributes in an already // existing partition without the attributes text literals. // // vNewDialog - handle to the partition // lFieldRow - offset row in the group // lFieldCol - offset column in the group // PartitionSize - length size for the group // // Return Codes: // 0 - Everything is O.K. and the fields were placed into the // partition // -1 - The field widths exceeded the partitions width // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION ofnTZWDLGSO_AutoPaintListPart( zVIEW vSubtask, zVIEW vUserSpec, zVIEW vNewDialog, zLONG lFieldRow, zLONG lFieldCol, zLONG PartitionSize, zPCHAR szListType ) { zVIEW vAutoDesWk; zVIEW vTempStyle; zVIEW vSubobject; zVIEW vCtrlDef; zLONG lListAttributeLength; zLONG lPaintLiteralLength; zLONG lCC; zLONG lCL; zCHAR szControlType[ 33 ]; zCHAR szMapEntity[ 33 ]; zCHAR szParentName[ 33 ]; zCHAR szWorkString[ 65 ]; zCHAR szLiteralString[ 65 ]; zLONG lTempInteger_0; zSHORT RESULT; zSHORT lFieldsPainted; zLONG lRC; zCHAR X_LOD_Attribute[ 16 ]; zCHAR X_LOD_Entity[ 13 ]; zCHAR X_ER_Attribute[ 15 ]; // TraceLineS( "IN", "AutoPaintListPart W4" ); // Set up variables to either I_LOD listbox or L_LOD listbox. if ( szListType[ 0 ] == 'I' ) { zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" ); zstrcpy( X_LOD_Entity, "I_LOD_Entity" ); zstrcpy( X_ER_Attribute, "I_ER_Attribute" ); } else { zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" ); zstrcpy( X_LOD_Entity, "L_LOD_Entity" ); zstrcpy( X_ER_Attribute, "L_ER_Attribute" ); } lCL = 12; lCC = 5; GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK ); GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK ); GetStringFromAttribute( szControlType, vNewDialog, "ControlDef", "Tag" ); /* It is important to know whether the parent is a WINDOW(WDODs) or a SECTION(RODs). */ zstrcpy( szParentName, "Window" ); /* IF we are Autodesigning a ROD, set lCL to 8 so line skips do not take place */ lTempInteger_0 = zstrcmp( szParentName, "SECTION" ); if ( lTempInteger_0 == 0 ) { lCL = 8; } /* Create a view that will point to the controls under the listbox. */ CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 ); /* Set handle to the fields under the group */ SetViewToSubobject( vSubobject, "CtrlCtrl" ); /* Delete any existing fields in the listbox */ RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); } /* Create a new view that will point to the UIS_ViewObjRef entity in the user spec object. Sometimes vUserSpec is pointing to a recursive subobject and UI_ViewObjRef cannot be accessed. */ CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 ); ResetView( vTempStyle ); lFieldsPainted = 0; //// Paint the fields in the Partition ////////// /* IF Attributes have been found to paint, paint them */ RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" ); while ( RESULT > zCURSOR_UNCHANGED ) { // This gets the length of the field to be painted. lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType ); if ( lListAttributeLength == 0 ) lListAttributeLength = 4; lListAttributeLength = lListAttributeLength * lCC; if ( lListAttributeLength > 100 ) lListAttributeLength = 100; if ( lListAttributeLength < 25 ) lListAttributeLength = 25; /* If there isn't a paint literal then use the entity name as the paint literal */ GetStringFromAttribute( szLiteralString, vUserSpec, X_ER_Attribute, "ListPaintLit" ); if ( szLiteralString[ 0 ] == 0 ) GetStringFromAttribute( szLiteralString, vUserSpec, X_ER_Attribute, "PromptPaintLit" ); lPaintLiteralLength = zstrlen( szLiteralString ); if ( szLiteralString[ 0 ] == 0 ) { GetStringFromAttribute( szLiteralString, vUserSpec, X_ER_Attribute, "Name" ); AddSpacesToString( szLiteralString ); lPaintLiteralLength = zstrlen( szLiteralString ) + 1; } lPaintLiteralLength = lPaintLiteralLength * lCC; if ( lPaintLiteralLength > 100 ) lPaintLiteralLength = 100; if ( lPaintLiteralLength < 25 ) lPaintLiteralLength = 25; /* Do not continue to add fields into the partition if the field sizes exceed the size of the partition */ /* If the field attribute length is greater than the text literal length, then add the field attribute length to lFieldCol. */ if ( lPaintLiteralLength < lListAttributeLength ) { /* If the length of lFieldCol is greater than the partition size, then delete all the fields that have been added and give a message to the user. */ if ( lFieldCol + lListAttributeLength > PartitionSize ) { RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); RESULT = SetCursorNextEntity( vSubobject, "Control", "" ); } DropView( vSubobject ); MessageSend( vUserSpec, "AD10302", "Autodesigner", "Partition too small( width )", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } } else { /* If the text literal length is greater than the field attribute length, then add the text literal length to lFieldCol. */ /* If the length of lFieldCol is greater than the partition size, then delete all the fields that have been added and give a message to the user. */ if ( lFieldCol + lPaintLiteralLength > PartitionSize ) { RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); RESULT = SetCursorNextEntity( vSubobject, "Control", "" ); } DropView( vSubobject ); MessageSend( vUserSpec, "AD10303", "Autodesigner", "Partition too small( width )", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } } /* Create the partition's fields */ CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER ); SetAttributeFromString( vSubobject, "Control", "Text", szLiteralString ); if ( zstrcmp( szControlType, "ListBox" ) == 0 ) { SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "ListBoxCtl", "" ); IncludeSubobjectFromSubobject( vSubobject, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); } else { SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "Text", "" ); IncludeSubobjectFromSubobject( vSubobject, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); } // Set the tag ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vSubobject, "ListCtrl" ); /* GetStringFromAttribute( szTag, vUserSpec, X_ER_Attribute, "Name" ); szTag[ 30 ] = 0; lFieldsPainted = lFieldsPainted + 1; zltoa( lFieldsPainted, szWork ); zstrcat( szTag, szWork ); SetAttributeFromString( vSubobject, "Control", "Tag", szTag ); */ SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", lListAttributeLength ); SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL ); /* If the domain is an integer or a long, then right justify. */ /* IF vUserSpec.L_Domain.DerivedDataType = 'I' OR vUserSpec.L_Domain.DerivedDataType = 'L' OR vUserSpec.L_Domain.DerivedDataType = 'M' vNewDialog.FLAGFLD.RJUST = 'Y' END */ GetStringFromAttribute( szMapEntity, vUserSpec, "LOD_Entity", "Name" ); GetStringFromAttribute( szWorkString, vUserSpec, X_LOD_Entity, "Name" ); /* If this LISTATTRIB is from a different ENTITY than the current ENTITY, then make sure the value gets mapped. */ lRC = zstrcmp( szWorkString, "" ); if ( lRC != 0 ) { lRC = zstrcmp( szWorkString, szMapEntity ); if ( lRC == 0 ) { zstrcpy( szMapEntity, szWorkString ); } } /* setting the group and field's ENAME and ANAME */ CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER ); /* set the partitions OI name */ if ( szListType[ 0 ] == 'I' ) IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView", vUserSpec, "ListViewObjRef", zPOS_AFTER ); else IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView", vTempStyle, "UIS_ViewObjRef", zPOS_AFTER ); IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute", vUserSpec, X_LOD_Attribute, zPOS_AFTER ); /* lFieldRow should always stay the same */ SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lFieldCol ); SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lFieldRow ); /* If the field length is longer than the paint literal, then position the next field by using the field length, otherwise position the next field by using the paint literal length */ if ( lPaintLiteralLength < lListAttributeLength ) { lFieldCol = lFieldCol + lListAttributeLength + lCC; } else { lFieldCol = lFieldCol + lPaintLiteralLength + lCC; } RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" ); } DropView( vSubobject ); DropView( vTempStyle ); // TraceLineS("END", "AutoPaintListPart W4" ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // PURPOSE: This function places the paint literals of selected // attributes above the fields in a partition or list box. // // vNewDialog - handle to the group // OffsetDLG_Y - offset row to the group // OffsetDLG_X - offset column to the group // PartitionSize - length size of the group // // Return Codes: // 0 - Everything is O.K. and the literals were placed into the // partition // -1 - The literal widths exceeded the partitions width // //////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION ofnTZWDLGSO_AutoPaintLstLitPart( zVIEW vSubtask, zVIEW vUserSpec, zVIEW vNewDialog, zLONG OffsetDLG_Y, zLONG OffsetDLG_X, zLONG PartitionSize, zPCHAR szListType ) { zVIEW vCtrlDef; zLONG lCC; zLONG lCL; zLONG lFieldCol; zLONG lListAttributeLength; zLONG lPaintLiteralLength; zCHAR sPaintLiteral[ 65 ]; zSHORT RESULT; zLONG lTempInteger_1; zLONG lTempInteger_2; 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' ) { zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" ); zstrcpy( X_ER_Attribute, "I_ER_Attribute" ); } else { zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" ); zstrcpy( X_ER_Attribute, "L_ER_Attribute" ); } lCC = 5; lCL = 12; GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK ); lFieldCol = 1; RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" ); while ( RESULT > zCURSOR_UNCHANGED ) { /* This gets the length of the field to be painted */ lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType ); lListAttributeLength = lListAttributeLength * lCC; /* Limit the size of the attribute length. */ if ( lListAttributeLength > 100 ) lListAttributeLength = 100; if ( lListAttributeLength < 25 ) lListAttributeLength = 25; /* Get the paint literal */ GetStringFromAttribute( sPaintLiteral, vUserSpec, X_ER_Attribute, "ListPaintLit" ); if ( sPaintLiteral[ 0 ] == 0 ) GetStringFromAttribute( sPaintLiteral, vUserSpec, X_ER_Attribute, "PromptPaintLit" ); if ( sPaintLiteral[ 0 ] == 0 ) { GetStringFromAttribute( sPaintLiteral, vUserSpec, X_ER_Attribute, "Name" ); /* Add a ':' to the end. */ zstrcat( sPaintLiteral, ":" ); /* Add spaces before any capital letters. */ AddSpacesToString( sPaintLiteral ); } lPaintLiteralLength = zstrlen( sPaintLiteral ); lPaintLiteralLength = lPaintLiteralLength * lCC; /* Limit the size of the literal length. */ if ( lPaintLiteralLength > 100 ) lPaintLiteralLength = 100; if ( lPaintLiteralLength < 25 ) lPaintLiteralLength = 25; /* lTempInteger_1 = CheckForOverlappingFields( vNewDialog, OffsetDLG_Y, OffsetDLG_Y + nCL, lFieldCol + OffsetDLG_X - lCC, lFieldCol + OffsetDLG_X + lPaintLiteralLength - lCC ); */ lTempInteger_1 = 0; /* Check to see IF there is a field or group located above the listbox that would be in the way of painting the literals */ if ( lTempInteger_1 == -1 ) { /* Cannot place text fields above the listbox because of either a field or a group */ /* InformationMessage( "Field literals can't fit because of FIELD or GROUP" ); */ MessageSend( vUserSpec, "AD10301", "Autodesigner", "Field literals can't fit because of FIELD or GROUP", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } /* Add the listbox literals at the end of the client fields. This makes a difference in fnCompressWindow in autodesigning.*/ SetCursorLastEntity( vNewDialog, "Control", "" ); /* Do not continue to add fields into the list box if the field sizes exceed the size of the list box */ /* If the field attribute length is greater than the text literal length, then add the field attribute length to lFieldCol. */ if ( lPaintLiteralLength < lListAttributeLength ) { /* If the length of lFieldCol is greater than the partition size, then RETURN */ if ( lFieldCol + lListAttributeLength > PartitionSize ) { return( 1 ); } } else { /* If the length of lFieldCol is greater than the partition size, then RETURN */ if ( lFieldCol + lPaintLiteralLength > PartitionSize ) { return( 1 ); } } /* Create literals for the list box */ CreateMetaEntity( vSubtask, vNewDialog, "Control", zPOS_AFTER ); SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "Text", "" ); IncludeSubobjectFromSubobject( vNewDialog, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); /* Remove the text border. */ SetAttributeFromInteger( vNewDialog, "Control", "Subtype", zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP ); SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_Y", OffsetDLG_Y ); lTempInteger_2 = OffsetDLG_X + lFieldCol - lCC; SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_X", lTempInteger_2 ); SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_X", lPaintLiteralLength ); SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_Y", 10 ); ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vNewDialog, "ListText" ); SetAttributeFromString( vNewDialog, "Control", "Text", sPaintLiteral ); /* If the field length is longer than the paint literal, then position the next field by using the field length, otherwise position the next field by using the paint literal length */ if ( lPaintLiteralLength < lListAttributeLength ) { lFieldCol = lFieldCol + lListAttributeLength + lCC; } else { lFieldCol = lFieldCol + lPaintLiteralLength + lCC; } RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" ); } // TraceLineS("END", "AutoPaintLstListPart W4" ); return( 0 ); }
static zSHORT GetAnzahlCatalogFiles( zVIEW vSubtask, zVIEW vAktView) { zSHORT nRet; zLONG lHMem; zLONG lAnzCatalogFiles; zLONG lLv; zCHAR *pszCatalogFileList = NULL; void *pEnv = NULL; // First we have to get the number of catalogfiles from the environment file // SIRENV if (g_hLib == NULL) { nRet = fnLoadHzvaffz (vSubtask); if ( nRet != 0 ) return( nRet ); } // Open the environment nRet = pfnOpenEnv (&pEnv); if ( nRet != 0 ) return( nRet ); nRet = pfnGetAnzahlCatalogFiles (pEnv, &lAnzCatalogFiles); if ( nRet != 0 ) { pfnFreeEnv( pEnv ); return( nRet ); } // Get Memory for the whole cataloglist // max. length of a catalogname shoud be 9 characters lHMem = SysAllocMemory( &pszCatalogFileList, lAnzCatalogFiles * 9, 0, zCOREMEM_ALLOC, 0 ); if ( lHMem == 0 ) { pfnFreeEnv( pEnv ); return( 552); } memset(pszCatalogFileList, 0, lAnzCatalogFiles * 9); // Get all Catalogfilenames from the Environmentfile nRet = pfnGetAllCatalogFiles (pEnv, pszCatalogFileList, lAnzCatalogFiles); pfnFreeEnv( pEnv ); if ( nRet != 0 ) { SysFreeMemory (lHMem); return( nRet ); } // Set all Catalogfilenames into the WorkLOD for ( lLv = 0; lLv < lAnzCatalogFiles; lLv++ ) { CreateEntity( vAktView, "CatFiles", zPOS_AFTER ); SetAttributeFromString(vAktView, "CatFiles", "wkCatFiles", pszCatalogFileList); SetAttributeFromString( vAktView, "CatFiles", "wkEinschraenkung", ""); pszCatalogFileList += 9; } // Free all Memory SysFreeMemory( lHMem ); return( 0 ); }
/************************************************************************************************* ** ** OPERATION: SetRptShapeFromBlob ** *************************************************************************************************/ zOPER_EXPORT zLONG /*GLOBAL */ OPERATION SetRptShapeFromBlob( zVIEW vReportDef ) { zCHAR szBlob[ 8 + (6 * sizeof( zLONG )) ]; // zVIEW vReport; // zLONG lSubtype; zULONG ulPenColor = 0xFF000000; zULONG ulShapeColor = 0xFF000000; zULONG ulLth = sizeof( szBlob ); zmemset( szBlob, 0, ulLth ); GetBlobFromAttribute( szBlob, &ulLth, vReportDef, "Control", "CtrlBOI" ); // TraceLineI( "Shape control blob lth = ", ulLth ); if ( ulLth == sizeof( szBlob ) || ulLth == sizeof( szBlob ) - (1 * sizeof( zLONG )) || // remove this soon ulLth == sizeof( szBlob ) - (2 * sizeof( zLONG )) ) { zLONG lPenWidth; zLONG lPenType; zLONG lRoundValue; zLONG lFlags = 0; if ( szBlob[ 4 ] == TRUE ) { TraceLineI( "**** Horizontal Line **** ", szBlob[ 4 ] ); SetAttributeFromInteger( vReportDef, "Control", "BorderBottom", szBlob[ 4 ] ); } /* SetCtrlState( vSubtask, "Rectangle", zCONTROL_STATUS_CHECKED, szBlob[ 0 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "RoundRect", zCONTROL_STATUS_CHECKED, szBlob[ 1 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "Ellipse", zCONTROL_STATUS_CHECKED, szBlob[ 2 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "Diamond", zCONTROL_STATUS_CHECKED, szBlob[ 3 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "HorizontalLine", zCONTROL_STATUS_CHECKED, szBlob[ 4 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "VerticalLine", zCONTROL_STATUS_CHECKED, szBlob[ 5 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "DiagonalDescend", zCONTROL_STATUS_CHECKED, szBlob[ 6 ] ? TRUE : FALSE ); SetCtrlState( vSubtask, "DiagonalAscend", zCONTROL_STATUS_CHECKED, szBlob[ 7 ] ? TRUE : FALSE ); */ lPenWidth = *((zPLONG) (szBlob + 8)); lPenType = *((zPLONG) (szBlob + 8 + sizeof( zLONG ))); ulPenColor = *((zPLONG) (szBlob + 8 + (2 * sizeof( zLONG )))); lRoundValue = *((zPLONG) (szBlob + 8 + (3 * sizeof( zLONG )))); if ( ulLth == sizeof( szBlob ) ) { ulShapeColor = *((zPULONG) (szBlob + 8 + (4 * sizeof( zLONG )))); lFlags = *((zPLONG) (szBlob + 8 + (5 * sizeof( zLONG )))); } zltoa( ulPenColor, szBlob ); SetAttributeFromString( vReportDef, "Control", "wLineColorText", szBlob ); SetAttributeFromInteger( vReportDef, "Control", "wLineColorInt", ulPenColor ); SetAttributeFromInteger( vReportDef, "Control", "BorderWidth", lPenWidth ); switch ( lPenType ) { case 1: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 1 ); break; case 2: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 2 ); break; case 3: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 3 ); break; case 4: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 4 ); break; default: SetAttributeFromInteger( vReportDef, "Control", "BorderStyle", 0 ); break; } zltoa( lRoundValue, szBlob ); //SetCtrlText( vSubtask, "RoundValue", szBlob ); } else { //SetCtrlState( vSubtask, "Rectangle", zCONTROL_STATUS_CHECKED, TRUE ); //SetCtrlText( vSubtask, "PenWidth", "1" ); } /* SetCtrlProperty( vSubtask, "__ColorLine", zCONTROL_PROPERTY_INTEGER_DATA, ulPenColor, 0 ); SetCtrlProperty( vSubtask, "__ColorShape", zCONTROL_PROPERTY_INTEGER_DATA, ulShapeColor, 0 ); */ return( 0 ); } // SetRptShapeFromBlob
static zSHORT GetCatalogs( zVIEW vSubtask, zVIEW vAktView ) { zSHORT nRet; zCHAR szServerName[9]; zCHAR szCatalogFileName[9]; zCHAR szEinschraenkung[9]; zCHAR szCatalogName[9]; zCHAR *pszCatalogList = NULL; long lAnzahlCatalogs; long lLv; zCHAR szLocalServer[MAX_COMPUTERNAME_LENGTH + 1]; zLONG lLocalLength; // First we have to see, if the catalogs should be loaded locally or from // the server lLocalLength = MAX_COMPUTERNAME_LENGTH + 1; memset(szLocalServer, 0, MAX_COMPUTERNAME_LENGTH + 1); if (GetComputerName( szLocalServer, &lLocalLength ) == 0 ) return( -3); // Get the actual Servername and CatalogFileName memset(szServerName, 0, 9); GetStringFromAttribute(szServerName, vAktView, "TZSIIMWK", "wkServerName"); if ( zstrcmp( szServerName, szLocalServer ) != 0 ) { // For servers we have to see if the list of catalogs is // already loaded. If not we have to Create an entity for // the catalogfile ADRTAFEL // If the list of catalogfiles still exists, return nRet = CheckExistenceOfEntity( vAktView, "CatFiles" ); if ( nRet == zCURSOR_SET || nRet == zCALL_ERROR ) return( nRet ); // First we have to Create the Catalogfilename in the WorkLOD CreateEntity(vAktView, "CatFiles", zPOS_AFTER); SetAttributeFromString( vAktView, "CatFiles", "wkCatFiles", "ADRTAFEL"); SetAttributeFromString( vAktView, "CatFiles", "wkEinschraenkung", ""); } // If the siron modules are not loaded, load them now if ( g_hLib == NULL ) { nRet = fnLoadHzvaffz( vSubtask ); if ( nRet != 0 ) return( nRet ); } // Position onto the first catalogfile nRet = SetCursorFirstEntity(vAktView, "CatFiles", ""); while ( nRet == zCURSOR_SET ) { // Set Catalogfilename in structure for getting the cataloglist memset(szCatalogFileName, 0, 9); GetStringFromAttribute( szCatalogFileName, vAktView, "CatFiles", "wkCatFiles"); GetStringFromAttribute( szEinschraenkung, vAktView, "CatFiles", "wkCatFiles"); lAnzahlCatalogs = 0; if ( zstrcmp( szServerName, szLocalServer ) == 0 ) { // Read all Catalogs from local PC nRet = pfnGetLocalCatalogs( szCatalogFileName, szEinschraenkung, &lAnzahlCatalogs, &pszCatalogList, "", "" ); } else { // Read all Catalogs from the selected server nRet = pfnGetServerCatalogs( szServerName, szCatalogFileName, szEinschraenkung, &lAnzahlCatalogs, &pszCatalogList, "", "" ); } if ( nRet != 0 ) { pfnFreeListMemory( &pszCatalogList ); return( nRet ); // Umsetzen auf 590 } for (lLv = 0; lLv < lAnzahlCatalogs; lLv++) { memset( szCatalogName, 0, 9 ); memcpy( szCatalogName, pszCatalogList+(lLv*9), 8); CreateEntity (vAktView, "Catalogs", zPOS_AFTER); SetAttributeFromString (vAktView, "Catalogs", "wkCatalogName", szCatalogName); } // Free Memory pfnFreeListMemory( &pszCatalogList ); nRet = SetCursorNextEntity( vAktView, "CatFiles", "" ); } return( 0 ); }
//:DIALOG OPERATION //:RemoveAll ( VIEW vSubtask ) //: VIEW TZTENVRO REGISTERED AS TZTENVRO zOPER_EXPORT zSHORT OPERATION RemoveAll( zVIEW vSubtask ) { zVIEW TZTENVRO = 0; zSHORT RESULT; //:VIEW TZZOLODO REGISTERED AS TZZOLODO zVIEW TZZOLODO = 0; //:VIEW TZZOLODO_Hier BASED ON LOD TZZOLODO zVIEW TZZOLODO_Hier = 0; //:STRING ( 100 ) szEntityName zCHAR szEntityName[ 101 ] = { 0 }; //:SHORT sReturnLevel zSHORT sReturnLevel = 0; //:SHORT nRC zSHORT nRC = 0; //:INTEGER lAbsPos zLONG lAbsPos = 0; //:INTEGER lDataSourceZKey zLONG lDataSourceZKey = 0; RESULT = GetViewByName( &TZTENVRO, "TZTENVRO", vSubtask, zLEVEL_TASK ); RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK ); //:CreateViewFromViewForTask( TZZOLODO, TZZOLODO, vSubtask ) CreateViewFromViewForTask( &TZZOLODO, TZZOLODO, vSubtask ); //:ResetView( TZZOLODO ) ResetView( TZZOLODO ); //:CreateViewFromViewForTask( TZZOLODO_Hier, TZZOLODO, vSubtask ) CreateViewFromViewForTask( &TZZOLODO_Hier, TZZOLODO, vSubtask ); //:szEntityName = "LOD_EntityParent" ZeidonStringCopy( szEntityName, 1, 0, "LOD_EntityParent", 1, 0, 101 ); //:lDataSourceZKey = TZTENVRO.TE_DBMS_Source.ZKey GetIntegerFromAttribute( &lDataSourceZKey, TZTENVRO, "TE_DBMS_Source", "ZKey" ); //:nRC = DefineHierarchicalCursor( TZZOLODO_Hier, "LOD_EntityParent" ) nRC = DefineHierarchicalCursor( TZZOLODO_Hier, "LOD_EntityParent" ); //:LOOP WHILE nRC >= zCURSOR_SET while ( nRC >= zCURSOR_SET ) { //: IF nRC = zCURSOR_SET_RECURSIVECHILD if ( nRC == zCURSOR_SET_RECURSIVECHILD ) { //: SetViewToSubobject( TZZOLODO_Hier, "LOD_EntityChild" ) SetViewToSubobject( TZZOLODO_Hier, "LOD_EntityChild" ); } //: END //: // Set up our temp view from the hier view. //: GetAbsolutePositionForEntity( lAbsPos, TZZOLODO_Hier, "LOD_EntityParent" ) GetAbsolutePositionForEntity( &lAbsPos, TZZOLODO_Hier, "LOD_EntityParent" ); //: SetCursorAbsolutePosition( szEntityName, TZZOLODO, lAbsPos ) SetCursorAbsolutePosition( szEntityName, TZZOLODO, lAbsPos ); //: IF szEntityName = "LOD_EntityParent" if ( ZeidonStringCompare( szEntityName, 1, 0, "LOD_EntityParent", 1, 0, 101 ) == 0 ) { //: SET CURSOR FIRST TZZOLODO.POD_Entity //: WHERE TZZOLODO.TE_DBMS_SourceForEntity.ZKey = lDataSourceZKey RESULT = SetCursorFirstEntity( TZZOLODO, "POD_Entity", "" ); if ( RESULT > zCURSOR_UNCHANGED ) { while ( RESULT > zCURSOR_UNCHANGED && ( CompareAttributeToInteger( TZZOLODO, "TE_DBMS_SourceForEntity", "ZKey", lDataSourceZKey ) != 0 ) ) { RESULT = SetCursorNextEntity( TZZOLODO, "POD_Entity", "" ); } } //: IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //: TZZOLODO.POD_Entity.SQL_JoinWithParent = "N" SetAttributeFromString( TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "N" ); } //: END } //: END //: nRC = SetCursorNextEntityHierarchical( sReturnLevel, szEntityName, TZZOLODO_Hier ) nRC = SetCursorNextEntityHierarchical( (zPUSHORT) &sReturnLevel, szEntityName, TZZOLODO_Hier ); } //:END //:DropView( TZZOLODO_Hier ) DropView( TZZOLODO_Hier ); //:DropView( TZZOLODO ) DropView( TZZOLODO ); //:RefreshCtrl( vSubtask, "JoinCheck" ) RefreshCtrl( vSubtask, "JoinCheck" ); return( 0 ); // END }
//: VIEW TZZOLODO REGISTERED AS TZZOLODO zOPER_EXPORT zSHORT OPERATION EntityChanged( zVIEW vSubtask ) { zVIEW TZZOLODO = 0; zSHORT RESULT; //:VIEW TZTENVRO REGISTERED AS TZTENVRO zVIEW TZTENVRO = 0; //:SHORT nIsCheckedOut zSHORT nIsCheckedOut = 0; zSHORT lTempInteger_0; zSHORT lTempInteger_1; zCHAR szTempString_0[ 201 ]; zCHAR szTempString_1[ 2 ]; zCHAR szTempString_2[ 201 ]; RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK ); RESULT = GetViewByName( &TZTENVRO, "TZTENVRO", vSubtask, zLEVEL_TASK ); //:nIsCheckedOut = ComponentIsCheckedOut( vSubtask, TZZOLODO, zSOURCE_LOD_META ) nIsCheckedOut = ComponentIsCheckedOut( vSubtask, TZZOLODO, zSOURCE_LOD_META ); //:IF nIsCheckedOut = 1 if ( nIsCheckedOut == 1 ) { //:// do not allow any input to the Join checkbox, if we are on the root //:// or if the currrent LOD entity is work or if the currrent LOD entity is derived //:IF TZZOLODO.ER_RelLinkRec EXISTS AND TZZOLODO.LOD_EntityParent.Work != "Y" lTempInteger_0 = CheckExistenceOfEntity( TZZOLODO, "ER_RelLinkRec" ); //: AND TZZOLODO.LOD_EntityParent.Derived != "Y" if ( lTempInteger_0 == 0 && CompareAttributeToString( TZZOLODO, "LOD_EntityParent", "Work", "Y" ) != 0 && CompareAttributeToString( TZZOLODO, "LOD_EntityParent", "Derived", "Y" ) != 0 ) { //:// Set the cursor to the POD_Entity for the current TE Source. //:SET CURSOR FIRST TZZOLODO.POD_Entity //: WHERE TZZOLODO.TE_DBMS_SourceForEntity.ZKey = TZTENVRO.TE_DBMS_Source.ZKey RESULT = SetCursorFirstEntity( TZZOLODO, "POD_Entity", "" ); if ( RESULT > zCURSOR_UNCHANGED ) { while ( RESULT > zCURSOR_UNCHANGED && ( CompareAttributeToAttribute( TZZOLODO, "TE_DBMS_SourceForEntity", "ZKey", TZTENVRO, "TE_DBMS_Source", "ZKey" ) != 0 ) ) { RESULT = SetCursorNextEntity( TZZOLODO, "POD_Entity", "" ); } } //:IF RESULT < zCURSOR_SET if ( RESULT < zCURSOR_SET ) { //:// POD_Entity doesn't exist so create one. //:CREATE ENTITY TZZOLODO.POD_Entity RESULT = CreateEntity( TZZOLODO, "POD_Entity", zPOS_AFTER ); //:TZZOLODO.POD_Entity.SQL_JoinWithParent = "N" SetAttributeFromString( TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "N" ); //:INCLUDE TZZOLODO.TE_DBMS_SourceForEntity FROM TZTENVRO.TE_DBMS_Source RESULT = IncludeSubobjectFromSubobject( TZZOLODO, "TE_DBMS_SourceForEntity", TZTENVRO, "TE_DBMS_Source", zPOS_AFTER ); } //:END //:// not the root and not work and not derived //:SetCtrlState( vSubtask, "JoinCheck", zCONTROL_STATUS_ENABLED, TRUE ) SetCtrlState( vSubtask, "JoinCheck", zCONTROL_STATUS_ENABLED, TRUE ); //:ELSE } else { //:SetCtrlState( vSubtask, "JoinCheck", zCONTROL_STATUS_ENABLED, FALSE ) SetCtrlState( vSubtask, "JoinCheck", zCONTROL_STATUS_ENABLED, FALSE ); } //:END //:// Refresh checkbox and set the string being displayed. //:IF TZZOLODO.POD_Entity EXISTS lTempInteger_1 = CheckExistenceOfEntity( TZZOLODO, "POD_Entity" ); if ( lTempInteger_1 == 0 ) { //: TZZOLODO.LOD_EntityParent.WorkString = TZZOLODO.LOD_EntityParent.Name + //: " JOIN = " + TZZOLODO.POD_Entity.SQL_JoinWithParent GetStringFromAttribute( szTempString_0, TZZOLODO, "LOD_EntityParent", "Name" ); ZeidonStringConcat( szTempString_0, 1, 0, " JOIN = ", 1, 0, 201 ); GetVariableFromAttribute( szTempString_1, 0, 'S', 2, TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "", 0 ); ZeidonStringConcat( szTempString_0, 1, 0, szTempString_1, 1, 0, 201 ); SetAttributeFromString( TZZOLODO, "LOD_EntityParent", "WorkString", szTempString_0 ); //:ELSE } else { //: TZZOLODO.LOD_EntityParent.WorkString = TZZOLODO.LOD_EntityParent.Name + " JOIN = N" GetStringFromAttribute( szTempString_2, TZZOLODO, "LOD_EntityParent", "Name" ); ZeidonStringConcat( szTempString_2, 1, 0, " JOIN = N", 1, 0, 201 ); SetAttributeFromString( TZZOLODO, "LOD_EntityParent", "WorkString", szTempString_2 ); } //:END } //:END //:RefreshCtrl( vSubtask, "JoinCheck" ) RefreshCtrl( vSubtask, "JoinCheck" ); //:RefreshCtrl( vSubtask, "edDescription" ) RefreshCtrl( vSubtask, "edDescription" ); //:RefreshCtrl( vSubtask, "cbDerived" ) RefreshCtrl( vSubtask, "cbDerived" ); //:RefreshCtrl( vSubtask, "cbWork" ) RefreshCtrl( vSubtask, "cbWork" ); return( 0 ); // END }
//: VIEW SourceView zOPER_EXPORT zSHORT OPERATION oKZXMLPGO_AddWebControlSubobject( zVIEW vKZXMLPGO, zPCHAR ControlName, zPCHAR ControlType, zPCHAR ControlContext, zPCHAR SourceViewName, zPCHAR SourceEntity, zPCHAR SourceAttribute, zPCHAR AutoComboBoxExternalValue ) { zVIEW SourceView = 0; //:VIEW SourceView2 zVIEW SourceView2 = 0; //:SHORT nRC zSHORT nRC = 0; //:INTEGER CursorPos zLONG CursorPos = 0; //:STRING ( 2000 ) ExternalValue zCHAR ExternalValue[ 2001 ] = { 0 }; //:STRING ( 200 ) CurrentValue zCHAR CurrentValue[ 201 ] = { 0 }; zSHORT RESULT; zCHAR szTempString_0[ 255 ]; zCHAR szTempString_1[ 32001 ]; //:// Create a Control entity for the data passed. //:// If the Control is a ListBox or ComboBox, also create the SubControl entries for each list value. //:CREATE ENTITY vKZXMLPGO.Control RESULT = CreateEntity( vKZXMLPGO, "Control", zPOS_AFTER ); //:vKZXMLPGO.Control.Name = ControlName SetAttributeFromString( vKZXMLPGO, "Control", "Name", ControlName ); //:vKZXMLPGO.Control.Type = ControlType SetAttributeFromString( vKZXMLPGO, "Control", "Type", ControlType ); //:// If the Named View does not exist or the EntityName doesn't exist, simply return. //:GET VIEW SourceView NAMED SourceViewName RESULT = GetViewByName( &SourceView, SourceViewName, vKZXMLPGO, zLEVEL_TASK ); //:IF RESULT < 0 if ( RESULT < 0 ) { //:// There is no mapping, so return having just created the entity, with Name and Type, //:// unless the Control is Text, in which case we'll add the Text value, which is passed as //:// AutoComboBoxExternalValue. //:IF vKZXMLPGO.Control.Type = "Text" OR //: vKZXMLPGO.Control.Type = "PushBtn" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "Text" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "PushBtn" ) == 0 ) { //:vKZXMLPGO.Control.CurrentValue = AutoComboBoxExternalValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", AutoComboBoxExternalValue ); } //:END //:RETURN return( 0 ); } //:END //:IF SourceEntity != "" if ( ZeidonStringCompare( SourceEntity, 1, 0, "", 1, 0, 33 ) != 0 ) { //:nRC = CheckExistenceOfEntity( SourceView, SourceEntity ) nRC = CheckExistenceOfEntity( SourceView, SourceEntity ); //:IF nRC < 0 if ( nRC < 0 ) { //:RETURN return( 0 ); } //:END } //:END //:// If there is mapping, process according to Control Type //:IF vKZXMLPGO.Control.Type = "EditBox" OR //: vKZXMLPGO.Control.Type = "Text" OR //: vKZXMLPGO.Control.Type = "CheckBox" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "EditBox" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "Text" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "CheckBox" ) == 0 ) { //:GetStringFromAttributeByContext( ExternalValue, //: SourceView, SourceEntity, SourceAttribute, ControlContext, 2000 ) GetStringFromAttributeByContext( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, 2000 ); //:vKZXMLPGO.Control.CurrentValue = ExternalValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", ExternalValue ); //:ELSE } else { //:IF vKZXMLPGO.Control.Type = "MLEdit" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "MLEdit" ) == 0 ) { //:SetAttributeFromAttribute( vKZXMLPGO, "Control", "CurrentValue", //: SourceView, SourceEntity, SourceAttribute ) SetAttributeFromAttribute( vKZXMLPGO, "Control", "CurrentValue", SourceView, SourceEntity, SourceAttribute ); //:ELSE } else { //:IF vKZXMLPGO.Control.Type = "ComboBox" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBox" ) == 0 ) { //:// Build the list of selection values from the Domain table entries. //:GetStringFromAttributeByContext( CurrentValue, //: SourceView, SourceEntity, SourceAttribute, ControlContext, 200 ) GetStringFromAttributeByContext( CurrentValue, SourceView, SourceEntity, SourceAttribute, ControlContext, 200 ); //:vKZXMLPGO.Control.CurrentValue = CurrentValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", CurrentValue ); //:nRC = GetFirstTableEntryForAttribute( ExternalValue, //: SourceView, SourceEntity, SourceAttribute, //: ControlContext, CursorPos ) nRC = GetFirstTableEntryForAttribute( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, &CursorPos ); //:LOOP WHILE nRC >= 0 while ( nRC >= 0 ) { //:CREATE ENTITY vKZXMLPGO.ComboValue RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER ); //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue ); //:IF ExternalValue = CurrentValue if ( ZeidonStringCompare( ExternalValue, 1, 0, CurrentValue, 1, 0, 2001 ) == 0 ) { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ); //:ELSE } else { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ); } //:END //:nRC = GetNextTableEntryForAttribute( ExternalValue, //: SourceView, SourceEntity, SourceAttribute, //: ControlContext, CursorPos ) nRC = GetNextTableEntryForAttribute( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, &CursorPos ); } //:END //:ELSE } else { //:IF vKZXMLPGO.Control.Type = "ComboBoxAuto" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBoxAuto" ) == 0 ) { //:// Build the list of selection values from the list of entities. //:// Note that the entry selected is defined by the AutoComboBoxExternalValue passed, which //:// was set from the value of the Edit Mapping. //:vKZXMLPGO.Control.CurrentValue = AutoComboBoxExternalValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", AutoComboBoxExternalValue ); //:nRC = SetCursorFirstEntity( SourceView, SourceEntity, "" ) nRC = SetCursorFirstEntity( SourceView, SourceEntity, "" ); //:LOOP WHILE nRC >= 0 while ( nRC >= 0 ) { //:CREATE ENTITY vKZXMLPGO.ComboValue RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER ); //:GetStringFromAttributeByContext( ExternalValue, //: SourceView, SourceEntity, SourceAttribute, "", 2000 ) GetStringFromAttributeByContext( ExternalValue, SourceView, SourceEntity, SourceAttribute, "", 2000 ); //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue ); //:IF ExternalValue = AutoComboBoxExternalValue if ( ZeidonStringCompare( ExternalValue, 1, 0, AutoComboBoxExternalValue, 1, 0, 2001 ) == 0 ) { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ); //:ELSE } else { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ); } //:END //:nRC = SetCursorNextEntity( SourceView, SourceEntity, "" ) nRC = SetCursorNextEntity( SourceView, SourceEntity, "" ); } //:END //:ELSE } else { //:IF vKZXMLPGO.Control.Type = "ComboBoxList" if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBoxList" ) == 0 ) { //:// Build the list of selection values from the list of entities. //:// Note that the entry selected is defined by the cursor position. //:CreateViewFromViewForTask( SourceView2, SourceView, vKZXMLPGO ) CreateViewFromViewForTask( &SourceView2, SourceView, vKZXMLPGO ); //:GetStringFromAttributeByContext( CurrentValue, //: SourceView, SourceEntity, SourceAttribute, "", 2000 ) GetStringFromAttributeByContext( CurrentValue, SourceView, SourceEntity, SourceAttribute, "", 2000 ); //:vKZXMLPGO.Control.CurrentValue = CurrentValue SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", CurrentValue ); //:nRC = SetCursorFirstEntity( SourceView2, SourceEntity, "" ) nRC = SetCursorFirstEntity( SourceView2, SourceEntity, "" ); //:LOOP WHILE nRC >= 0 while ( nRC >= 0 ) { //:CREATE ENTITY vKZXMLPGO.ComboValue RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER ); //:GetStringFromAttributeByContext( ExternalValue, //: SourceView2, SourceEntity, SourceAttribute, "", 2000 ) GetStringFromAttributeByContext( ExternalValue, SourceView2, SourceEntity, SourceAttribute, "", 2000 ); //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue ); //:IF ExternalValue = CurrentValue if ( ZeidonStringCompare( ExternalValue, 1, 0, CurrentValue, 1, 0, 2001 ) == 0 ) { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 ); //:ELSE } else { //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ) SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 ); } //:END //:nRC = SetCursorNextEntity( SourceView2, SourceEntity, "" ) nRC = SetCursorNextEntity( SourceView2, SourceEntity, "" ); } //:END //:DropView( SourceView2 ) DropView( SourceView2 ); } //:END } //:END } //:END } //:END } //:END //:TraceLineS( "AddWebControlSubobject Type: ", vKZXMLPGO.Control.Type ) GetStringFromAttribute( szTempString_0, vKZXMLPGO, "Control", "Type" ); TraceLineS( "AddWebControlSubobject Type: ", szTempString_0 ); //:TraceLineS( " =============== Value: ", vKZXMLPGO.Control.CurrentValue ) GetStringFromAttribute( szTempString_1, vKZXMLPGO, "Control", "CurrentValue" ); TraceLineS( " =============== Value: ", szTempString_1 ); return( 0 ); // /* vKZXMLPGO.Control.Type = "EditBox" OR // vKZXMLPGO.Control.Type = "ListBox" OR // vKZXMLPGO.Control.Type = "Text" OR // vKZXMLPGO.Control.Type = "CheckBox" OR // vKZXMLPGO.Control.Type = "ListBox" OR // vKZXMLPGO.Control.Type = "MLE" OR // vKZXMLPGO.Control.Type = "Outliner" OR // vKZXMLPGO.Control.Type = "RadioBtnGroup" */ // END }
zOPER_EXPORT zLONG OPERATION Exec_StepOnce( zVIEW vSubtask ) { zVIEW vZ_View; zVIEW vS_View; zLONG lStepRC; zLONG lRC; zCHAR szDebugFlag[ 2 ]; // Single step actually loops unless one of these conditions occur. // 1. The next statement to execute is within an operation currently in debug mode. // 2. The return code from the last statement executed indicates debugging is to start for that operation. // 3. Execution is terminating. // // The loop is very close to that in the Go function. // szDebugFlag[ 0 ] = 'N'; lStepRC = zXC_STEP_EXECUTED; zPVOID hWRKS; // initialize work storage manager if ( WRKS_Init( &hWRKS ) < 0 ) { // Error in WRKS system MessageSend( vSubtask, "VM03002", "VML Interpretor", "Error Initializing Work Storage", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); TraceLineS( "VML Interpreter Error ","Initializing Work Storage" ); return( lStepRC ); } if ( setjmp( g_jbWRKS ) != 0 ) { // Error return from longjmp WRKS_Close( &hWRKS ); return( zXC_STEP_EXECUTED ); } while ( (lStepRC == zXC_STEP_EXECUTED || lStepRC == zXC_OPERATION_STAGED) && szDebugFlag[ 0 ] != 'Y' ) { lStepRC = StepOnce( vSubtask, hWRKS, &lRC ); // Don't execute the following if the operation is terminating. if ( lStepRC ) { GetViewByName( &vZ_View, "ZeidonVML", vSubtask, zLEVEL_TASK ); GetViewByName( &vS_View, "XPG", vZ_View, zLEVEL_SUBTASK ); GetStringFromAttribute( szDebugFlag, zsizeof( szDebugFlag ), vS_View, "Operation", "CurrentDebugFlag" ); } } if ( lStepRC == zXC_SETUP_DEBUGGER ) { SetAttributeFromString( vS_View, "Operation", "CurrentDebugFlag", "Y" ); } // close work storage manager WRKS_Close( &hWRKS ); return( lStepRC ); }
//////////////////////////////////////////////////////////////////////////////////////////////////////// // // OPERATION: GetAllServerNames // zOPER_EXPORT zSHORT OPERATION GetAllServerNames( zVIEW vSubtask, zVIEW vAktView ) { zSHORT nRet; void *pEnv = NULL; zCHAR *pszServerList = NULL; long lAnzServer; long lHMem; long lLv; unsigned long lLocalLength; zCHAR szLocalServer[MAX_COMPUTERNAME_LENGTH+1]; // If the serverlist still exists, return nRet = CheckExistenceOfEntity( vAktView, "TZSIIMWK"); if ( nRet == zCURSOR_SET || nRet == zCALL_ERROR ) return( nRet ); // Load hzvaffz.dll and get the function pointers if ( g_hLib != NULL ) { nRet = fnLoadHzvaffz (vSubtask); if (nRet != 0 ) return( nRet ); } nRet = pfnOpenEnv( &pEnv ); if ( nRet != 0 ) return( nRet ); nRet = pfnGetAnzahlServerNames (pEnv, &lAnzServer); if ( nRet != 0 ) { pfnFreeEnv (pEnv); return( nRet ); } lAnzServer += 1; // The local servername is not in the list // Get Memory for the whole serverlist // max. length of a servername shoud be 9 characters lHMem = SysAllocMemory( &pszServerList, lAnzServer * 9, 0, zCOREMEM_ALLOC, 0 ); if ( lHMem == 0 ) { pfnFreeEnv( pEnv ); return( 551 ); } // Now get the Local Server Name lLocalLength = MAX_COMPUTERNAME_LENGTH + 1; memset(szLocalServer, 0, MAX_COMPUTERNAME_LENGTH + 1); if (GetComputerName( szLocalServer, &lLocalLength ) == 0 ) { pfnFreeEnv( pEnv ); return( -3 ); } // Put the local Server name into the list memset( pszServerList, 0, lAnzServer * 9 ); memcpy( pszServerList, szLocalServer, 9 ); // Get all Servernames nRet = pfnGetAllServerNames( pEnv, pszServerList+9, lAnzServer - 1 ); pfnFreeEnv( pEnv ); if ( nRet != 0 ) { SysFreeMemory( lHMem ); return( nRet ); } // Set all Servernames into the WorkLOD for ( lLv = 0; lLv < lAnzServer; lLv++ ) { CreateEntity( vAktView, "TZSIIMWK", zPOS_AFTER ); SetAttributeFromString( vAktView, "TZSIIMWK", "wkServerName", pszServerList ); pszServerList += 9; } SysFreeMemory( lHMem ); return( 0 ); }
zOPER_EXPORT zLONG OPERATION SyntaxError( zVIEW vSubtask, zLONG lErrorNumber, zPCHAR szErrorString ) { zVIEW vError; zVIEW vSearchError; zBOOL bFound; zBOOL bDone; zCHAR szMessage[ 256 ]; zCHAR szNum[ 10 ]; zLONG lRC; if ( GetViewByName( &vError, "TZVMEROO", vSubtask, zLEVEL_TASK ) > 0 ) { // IssueError( vError, 0, 0, "Syntax Error" ); // build msc type error message GetStringFromAttribute( szMessage, vError, "Root", "SourceFileName" ); zstrcat( szMessage, "(" ); zltoa( qqlineno, szNum ); zstrcat( szMessage, szNum ); zstrcat( szMessage, ") : error " ); zltoa( lErrorNumber, szNum ); zstrcat( szMessage, szNum ); zstrcat( szMessage, ": " ); zstrcat( szMessage, g_szMessages[ lErrorNumber - 501 ] ); switch ( lErrorNumber ) { case eQINVALIDFUNCTIONPARAM /*553*/: case eQINVALIDFUNCTIONDEF /*554*/ : case 556: break; default: zstrcat( szMessage, " Last Token " ); if ( !szErrorString || !szErrorString[ 0 ] ) zstrcat( szMessage, sQToken.szToken ); } zstrcat( szMessage, szErrorString ); // look to see if a similar error message has been posted // we need to match both nErrorNumber and szErrorString CreateViewFromViewForTask( &vSearchError, vError, 0 ); bFound = FALSE; bDone = FALSE; // Try to find 1st occurrence of current Last Token lRC = SetCursorFirstEntityByString( vSearchError, "Error", "LastToken", szErrorString, "" ); // if none was found, skip the following loop if ( lRC < zCURSOR_SET ) bDone = TRUE; while ( !bDone ) { // If we have found an occurrence of current Last Token if ( lRC >= zCURSOR_SET ) { // check error number lRC = CompareAttributeToInteger( vSearchError, "Error", "ErrorNumber", lErrorNumber ); // if a match if ( lRC == 0 ) { bDone = TRUE; bFound = TRUE; } // otherwise, look again else { lRC = SetCursorNextEntityByString( vSearchError, "Error", "LastToken", szErrorString, "" ); } } // otherwise, no more occurrences of szErrorString found else { // so we quit looking bDone = TRUE; } } // if a simlar error was NOT previously issued if ( bFound == FALSE ) { // put the error in error LOD CreateEntity( vError, "Error", zPOS_AFTER ); SetAttributeFromString ( vError, "Error", "String", szMessage ); SetAttributeFromString ( vError, "Error", "LastToken", szErrorString ); SetAttributeFromInteger( vError, "Error", "ErrorNumber", lErrorNumber ); // SysWriteLine( g_lfErrorHandle, "------" ); // SysWriteLine( g_lfErrorHandle, "------" ); SysWriteLine( vError, g_lfErrorHandle, szMessage ); } // drop the search view DropView( vSearchError ); } // some errors require the parsing process to be stopped, // because Object Engine errors would come up. switch ( lErrorNumber ) { case eQNOOPERATIONNAMEGIVEN: SkipRemainingFile( ); TraceLineS( "VML Parsing STOPPED on ERROR --", szMessage ); break; default: TraceLineS( "VML Parsing ERROR --", szMessage ); break; } return( 0 ); }
/////////////////////////////////////////////////////////////////////////////// // // OPERATION: TZZAPPSD_SendServerExecs // // PURPOSE: This Entry takes the zeidon.xdm and all xod object instances // and sends them to the Server for running the application on // the server. // //////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION TZZAPP2D_SendServerExecs( zVIEW vSubtask ) { zVIEW vZApp; zVIEW vLPLR; zVIEW vMeta; zSHORT nRC; zCHAR szFileName[ zMAX_FILESPEC_LTH + 1 ]; zCHAR szMetaName[ 13 ]; zCHAR szAppName[ 32 ]; zCHAR szServerSubDir[ 33 ]; zCHAR szLPLR_Path[ zMAX_FILESPEC_LTH + 1 ]; zCHAR szMsg[ zSHORT_MESSAGE_LTH + 1 ]; zVIEW vApplSubtask; zCHAR szServer[ 33 ]; // get XLP for selceted application GetViewByName( &vZApp, "KZAPPLOO", vSubtask, zLEVEL_TASK ); GetStringFromAttribute( szAppName, vZApp, "APPLICATION", "APP_NAME" ); GetStringFromAttribute( szLPLR_Path, vZApp, "APPLICATION", "APP_ADOBIN" ); SysAppendcDirSep( szLPLR_Path ); zstrcpy( szFileName, szLPLR_Path ); zstrcat( szFileName, szAppName ); zstrcat( szFileName, ".XLP" ); // open Task LPLR nRC = ActivateOI_FromFile( &vLPLR, "TZCMLPLO", vSubtask, szFileName, zMULTIPLE ); if ( nRC ) { MessageSend( vSubtask, "CM00285", "Configuration Management", "Can't activate XLP for task.", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } SetNameForView( vLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK); zmemset (szServer,0,sizeof(szServer)); // GetViewByName( &vLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK ); // Start the network if necessary. Use zeidon and hzkzoe as constants for now. nRC = NetStatus( "zeidon" ); if ( nRC == 0 ) { nRC = NetStartup( "zeidon", "hzkzoe" ); if ( nRC ) { MessageSend( vSubtask, "CM00285", "Configuration Management", "Network cannot be started.", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } } // First get the application name and make sure it exists in the // zeidon.app object on the server. If it isn't there, add it. GetStringFromAttribute( szAppName, vLPLR, "LPLR", "Name" ); zstrcpy( szFileName, "zeidon.app" ); SfCreateSubtask( &vApplSubtask, vSubtask, "Zeidon System" ); nRC = NetActivateOI_FromFile( 0, szServer, &vMeta, "KZAPPLOO", vApplSubtask, szFileName, zSINGLE ); if ( nRC >= 0 ) { nRC = SetCursorFirstEntityByString( vMeta, "APPLICATION", "APP_NAME", szAppName, 0 ); if ( nRC >= zCURSOR_SET ) DropObjectInstance( vMeta ); else { CreateEntity( vMeta, "APPLICATION", zPOS_LAST ); SetAttributeFromString( vMeta, "APPLICATION", "APP_NAME", szAppName ); zstrcpy( szServerSubDir, szAppName ); zstrcat( szServerSubDir, "/" ); SetAttributeFromString( vMeta, "APPLICATION", "APP_DLL", szServerSubDir ); SetAttributeFromString( vMeta, "APPLICATION", "APP_ADOBIN", szServerSubDir ); SetAttributeFromString( vMeta, "APPLICATION", "APP_LOCAL", szServerSubDir ); TraceLineS( "*** Committing server file: ", szFileName ); zstrcpy( szMsg, "Sending ZEIDON.APP: " ); MB_SetMessage( vSubtask, 1, szMsg ); // Send OI to server. NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII ); DropObjectInstance( vMeta ); } } else { SfDropSubtask( vApplSubtask, 0 ); MessageSend( vSubtask, "CM00286", "Configuration Management", "ZEIDON.APP cannot be activated.", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } SfDropSubtask( vApplSubtask, 0 ); // Send the XDM before all the xods. // First format the file name for activation on the client and then // format it for commit on the server. // GetStringFromAttribute( szFileName, vLPLR, "LPLR", "ExecDir" ); zstrcpy( szFileName, szLPLR_Path ); zstrcpy( szMetaName, "ZEIDON.XDM" ); zstrcat( szFileName, szMetaName ); TraceLineS( "*** Activating client file: ", szFileName ); nRC = ActivateOI_FromFile( &vMeta, "TZDMXGPO", vSubtask, szFileName, zSINGLE ); if ( nRC >= 0 ) { // Filename includes Directory-prefix **HH** GetStringFromAttribute( szFileName, vLPLR, "LPLR", "Name" ); zstrcat( szFileName, "/" ); zstrcat( szFileName, szMetaName ); TraceLineS( "*** Committing server file: ", szFileName ); MB_SetMessage( vSubtask, 1, "Sending XDM" ); // Send OI to server. NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII ); } // Next loop through all the LODs, activating each XOD and sending // it to the server. SetCursorFirstEntityByInteger( vLPLR, "W_MetaType", "Type", zREFER_LOD_META, 0 ); nRC = SetCursorFirstEntity( vLPLR, "W_MetaDef", 0 ); while ( nRC >= zCURSOR_SET ) { zstrcpy( szFileName, szLPLR_Path ); GetStringFromAttribute( szMetaName, vLPLR, "W_MetaDef", "Name" ); zstrcat( szFileName, szMetaName ); zstrcat( szFileName, ".XOD" ); TraceLineS( "*** Activating client file: ", szFileName ); nRC = ActivateOI_FromFile( &vMeta, "TZZOXODO", vSubtask, szFileName, zSINGLE ); if ( nRC >= 0 ) { // Filename includes Directory-prefix **HH** GetStringFromAttribute( szFileName, vLPLR, "LPLR", "Name" ); zstrcat( szFileName, "/" ); zstrcat( szFileName, szMetaName ); zstrcat( szFileName, ".XOD" ); TraceLineS( "*** Committing server file: ", szFileName ); zstrcpy( szMsg, "Sending XOD: " ); zstrcat( szMsg, szMetaName ); MB_SetMessage( vSubtask, 1, szMsg ); // Send OI to server. NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII ); } nRC = SetCursorNextEntity( vLPLR, "W_MetaDef", 0 ); } MB_SetMessage( vSubtask, 1, "Transmission Complete" ); return( 0 ); }
zOPER_EXPORT zLONG OPERATION InvokeInterp( zVIEW lpInterpSubtask, // Interpretor's subtask zVIEW lpAppSubtask, // application's subtask zPCHAR szSrcDLLName, // name of the dialog zPCHAR szOperationName, // operation to interp zPLONG plRC ) { zVIEW vXChecker; zSHORT nRC; zLONG lStepRC; zVIEW vStackObject; // view to the stack object zVIEW vS_View; zVIEW vZ_View; zVIEW vSO; zVIEW vSubtask = 0; zVIEW vTaskLPLR; zPVOID hWRKS = NULL; // Check to make sure the LPLR is active. GetViewByName( &vTaskLPLR, "TaskLPLR", lpAppSubtask, zLEVEL_TASK ); if ( vTaskLPLR == 0 ) InitializeLPLR( lpInterpSubtask, "" ); aInterpreterSave[ lMultiple ].vSubtask = lpInterpSubtask; if ( lMultiple > 0 ) { if ( lMultiple >= MAX_INTEPRETER_ENTRY ) { // Error, because number of recursive entries // is greater than MAX_INTEPRETER_ENTRY return( -99 ); } vSubtask = aInterpreterSave[ lMultiple -1 ].vSubtask; // save the global variables aInterpreterSave[ lMultiple -1 ].nStackPtr = g_nStackPtr; g_nStackPtr = 0; memcpy( aInterpreterSave[ lMultiple -1 ].nCallStack, g_nCallStack, zsizeof( g_nCallStack ) ); memset( g_nCallStack, 0, zsizeof( g_nCallStack ) ); aInterpreterSave[ lMultiple -1 ].vXPGView = g_vXPGView; g_vXPGView = 0; GetViewByName( &g_vStatementView, "StatementView", vSubtask, zLEVEL_SUBTASK ); aInterpreterSave[ lMultiple -1 ].vStatementView = g_vStatementView; g_vStatementView = 0; GetViewByName( &vSO, "StackObject", vSubtask, zLEVEL_SUBTASK ); aInterpreterSave[ lMultiple -1 ].vStackObject = vSO; memcpy( aInterpreterSave[ lMultiple -1 ].sValueStack, sValueStack, zsizeof( sValueStack ) ); memset( sValueStack, 0, zsizeof( sValueStack ) ); } lMultiple++; // see if we can load the XPG. if not, don't parse for now, exit out nRC = InitInterp( lpInterpSubtask, lpAppSubtask, szSrcDLLName ); if ( nRC < 0 ) { lStepRC = 1; // if the init failed return. goto EndOfInvokeInterp; } // Initialize the Working Storage Manager if ( WRKS_Init( &hWRKS ) < 0 ) { // Error in WRKS system MessageSend( vSubtask, "VM03002", "VML Interpretor", "Error Initializing Work Storage", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); TraceLineS( "VML Interpreter Error ","Initializing Work Storage" ); lStepRC = 1; // if the init failed return. goto EndOfInvokeInterp; } if ( setjmp( g_jbWRKS ) != 0 ) { // Error return from longjmp WRKS_Close( &hWRKS ); lStepRC = 1; goto EndOfInvokeInterp; } // get the program object as it was loaded by the init function. GetViewByName( &g_vXPGView, "XPG", lpInterpSubtask, zLEVEL_SUBTASK ); // try to position at the correct operation in the Subtask nRC = SetCursorFirstEntityByString( g_vXPGView, "Operation", "Name", szOperationName, "" ); if ( nRC != zCURSOR_SET ) { // no error message here, as we assume that the operation // to be called is a C operation. // Returning -1, the driver will try to load it from the DLL lStepRC = -1; goto EndOfInvokeInterp; } SetCursorFirstEntityByEntityCsr( g_vXPGView, "SourceFile", g_vXPGView, "SourceFileOfOperation", "" ); SetCursorFirstEntityByEntityCsr( g_vXPGView, "OperationSource", g_vXPGView, "Operation", "" ); SetCursorFirstEntity( g_vXPGView, "OperationText", "" ); SetCursorFirstEntity( g_vXPGView, "Statement", "" ); CreateViewFromViewForTask( &g_vStatementView, g_vXPGView, 0 ); // Create all of the entities needed in the stack object SetStackObjectFromViews( lpInterpSubtask, g_vXPGView, // View to the XPG g_vStatementView, // View to the statement 0 ); // index into the expression // Get the stack object as it was loaded with the XPG GetViewByName( &vStackObject, "StackObject", lpInterpSubtask, zLEVEL_SUBTASK ); // ###blob SetAttributeFromInteger( vStackObject, // "Variable", "Value", (zLONG)lpAppSubtask ); SetAttributeFromBlob( vStackObject, "Variable", "Value", &lpAppSubtask, sizeof( void * ) ); SetNameForView( g_vStatementView, "StatementView", lpInterpSubtask, zLEVEL_SUBTASK ); SetNameForView( lpAppSubtask, "ApplicationView", lpInterpSubtask, zLEVEL_SUBTASK ); GetViewByName( &vXChecker, "TZVSXCOO", lpInterpSubtask, zLEVEL_APPLICATION ); if ( vXChecker != 0 ) { nRC = SetCursorFirstEntityByString( vXChecker, "DialogOperation", "Name", szOperationName, "" ); if ( nRC == zCURSOR_SET ) { GetViewByName( &vZ_View, "ZeidonVML", vSubtask, zLEVEL_TASK ); GetViewByName( &vS_View, "XPG", vZ_View, zLEVEL_SUBTASK ); SetAttributeFromString( vS_View, "Operation", "CurrentDebugFlag", "Y" ); lStepRC = zXC_SETUP_DEBUGGER; goto EndOfInvokeInterp; } } // lStepRC = zXC_STEP_EXECUTED; #if 0 OperationCount( 3 ); OperationCount( 1 ); #endif // Loop through each statement using the Go function. lStepRC = Go( lpAppSubtask, hWRKS, plRC ); EndOfInvokeInterp: // close work storage manager if ( hWRKS ) WRKS_Close( &hWRKS ); lMultiple--; if ( lMultiple > 0 ) { vSubtask = aInterpreterSave[ lMultiple - 1 ].vSubtask; // restore the global variables g_nStackPtr = aInterpreterSave[ lMultiple - 1 ].nStackPtr; memcpy( g_nCallStack, aInterpreterSave[ lMultiple -1 ].nCallStack, zsizeof( g_nCallStack ) ); g_vXPGView = aInterpreterSave[ lMultiple - 1 ].vXPGView; SetNameForView( g_vXPGView, "XPG", vSubtask, zLEVEL_SUBTASK ); g_vStatementView = aInterpreterSave[ lMultiple - 1 ].vStatementView; SetNameForView( g_vStatementView, "StatementView", vSubtask, zLEVEL_SUBTASK ); vSO = aInterpreterSave[ lMultiple - 1 ].vStackObject; SetNameForView( vSO, "StackObject", vSubtask, zLEVEL_SUBTASK ); memcpy( sValueStack, aInterpreterSave[ lMultiple - 1 ].sValueStack, zsizeof( sValueStack ) ); } return( lStepRC ); }