zOPER_EXPORT zSHORT OPERATION zwTZCMRPTD_RefreshSelComponents( zVIEW vSubtask ) { zVIEW vTZCMLPLO; zVIEW vTZCMRPTO; zVIEW vCompList; zVIEW vTZCMRPTO_New; zCHAR szName[ 33 ]; zCHAR szERR_Msg[ 254 ]; SetNameForView( vSubtask,"TZCM_ChkInWindow", vSubtask, zLEVEL_TASK ); GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ); if ( SetCursorFirstSelectedEntity( vTZCMRPTO, "ReportLine", "" ) < zCURSOR_SET ) { zstrcpy( szERR_Msg, "No Component selected to Refresh." ); MessageSend( vSubtask, "CM00241", "Configuration Management", szERR_Msg, zMSGQ_OBJECT_CONSTRAINT_WARNING, zBEEP ); return( 0 ); } if ( zwTZCMLPLD_OptionRefreshFromRepo( vSubtask, &vTZCMLPLO, szName, zRefreshUserDefined ) < 0 ) { return( -1 ); } GetViewByName( &vTZCMRPTO_New, "TZCMRPTO_New", vSubtask, zLEVEL_TASK ); // if component refreshed? if ( CompareAttributeToInteger( vTZCMRPTO_New, "CPLR", "ComponentRefreshed", 1 ) == 0 ) { zstrcpy( szERR_Msg, "Project '" ); GetStringFromAttribute( &szERR_Msg[ zstrlen( szERR_Msg ) ], vTZCMLPLO, "LPLR", "Name" ); zstrcat( szERR_Msg, "' has been successfully refreshed \nfrom CPLR '" ); zstrcat( szERR_Msg, szName ); zstrcat( szERR_Msg, "'." ); MessageSend( vSubtask, "CM00279", "Configuration Management", szERR_Msg, zMSGQ_OBJECT_CONSTRAINT_INFORMATION, zBEEP ); } if ( GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ) > 0 ) DropObjectInstance( vTZCMRPTO ); // Build new Refresh List if ( zwTZCMLPLD_RefreshUserDefined( vSubtask ) < 1 ) return( -1 ); RefreshWindow( vSubtask ); if ( GetViewByName( &vCompList, "CompList", vSubtask, zLEVEL_TASK ) >= 0 ) RefreshWindow( vCompList ); return( 0 ); } // zwTZCMRPTD_RefreshSelComponents
static void zwfnTZERRORD_WriteErrorListToFile( zVIEW vTZERROR, zLONG FileHandle, zPCHAR szTool, zPCHAR szName, zLONG lLen ) { zSHORT nRC; zCHAR szMsg[500]; zCHAR szTemp[ 255 ]; zLONG i; // write Tool and DateTime zstrcpy( szMsg, "Zeidon: " ); zstrcat( szMsg, szTool ); zstrcat( szMsg, " Error List from " ); GetStringFromAttributeByContext( szTemp, vTZERROR, "ErrorList", "DateTime", "DD.MM.YYYY HH:MM:SS", 20 ); zstrcat( szMsg, szTemp ); SysWriteLine( FileHandle, szMsg ); SysWriteLine( FileHandle, "" ); // write LPLR Name GetStringFromAttribute( szTemp, vTZERROR, "ErrorList", "LPLR_Name" ); if ( szTemp[ 0 ] ) { zstrcpy( szMsg, "Project: " ); zstrcat( szMsg, szTemp ); SysWriteLine( FileHandle, szMsg ); SysWriteLine( FileHandle, "" ); } // write Error Message for ( nRC = SetCursorFirstEntity( vTZERROR, "ErrorMsg", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntity( vTZERROR, "ErrorMsg", "" ) ) { GetStringFromAttribute( szTemp, vTZERROR, "ErrorMsg", "Name" ); if ( zstrcmp( szTemp, "" ) != 0 ) { zstrcpy( szMsg, szName ); zstrcat( szMsg, ": " ); zstrcat( szMsg, szTemp ); for ( i = zstrlen( szTemp ); i < lLen; i++ ) zstrcat( szMsg, " " ); } zstrcat( szMsg, " " ); GetStringFromAttribute( szTemp, vTZERROR, "ErrorMsg", "ErrorText" ); zstrcat( szMsg, szTemp ); SysWriteLine( FileHandle, szMsg ); } SysWriteLine( FileHandle, "" ); SysWriteLine( FileHandle, "End of Error List" ); }
zOPER_EXPORT zSHORT OPERATION zwTZCMRPTD_RefreshAllComponents( zVIEW vSubtask ) { zVIEW vTZCMLPLO; zVIEW vTZCMRPTO; zVIEW vCompList; zCHAR szName[ 33 ]; zCHAR szERR_Msg[ 254 ]; if ( GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ) > 0 ) DropObjectInstance( vTZCMRPTO ); if ( zwTZCMLPLD_OptionRefreshFromRepo( vSubtask, &vTZCMLPLO, szName, zRefreshLPLR ) < 0 ) { return( -1 ); } zstrcpy( szERR_Msg, "Project '" ); GetStringFromAttribute( &szERR_Msg[ zstrlen( szERR_Msg ) ], vTZCMLPLO, "LPLR", "Name" ); zstrcat( szERR_Msg, "' has been successfully refreshed." ); MessageSend( vSubtask, "CM00279", "Configuration Management", szERR_Msg, zMSGQ_OBJECT_CONSTRAINT_INFORMATION, zBEEP ); if ( GetViewByName( &vCompList, "CompList", vSubtask, zLEVEL_TASK ) >= 0 ) RefreshWindow( vCompList ); return( 0 ); } // zwTZCMRPTD_RefreshAllComponents
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zwTZERRORD_WriteErrorMsg // // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT /*LOCAL */ OPERATION zwTZERRORD_WriteErrorMsg( zVIEW vSubtask, zVIEW vMetaView, zPCHAR szMetaEntity, zPCHAR szMetaAttribute, zPCHAR szErrorMsg, zSHORT nError ) { zVIEW vTZERROR; zCHAR szMsg[ 255 ]; if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) < 0 ) { zwTZERRORD_LoadErrorList( vSubtask ); GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ); } CreateEntity( vTZERROR, "ErrorMsg", zPOS_LAST ); SetAttributeFromAttribute( vTZERROR, "ErrorMsg", "Name", vMetaView, szMetaEntity, szMetaAttribute ); if ( nError == 1 ) zstrcpy( szMsg, "Error: " ); else if ( nError == 0 ) zstrcpy( szMsg, "Warning: " ); zstrcat( szMsg, szErrorMsg ); SetAttributeFromString( vTZERROR, "ErrorMsg", "ErrorText", szMsg ); SetAttributeFromInteger( vTZERROR, "ErrorMsg", "Error", nError ); return( 0 ); } // zwTZERRORD_WriteErrorMsg
/* 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
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZVSPOOO_C_GenOperationName // // PURPOSE: For Object and Local operations, concatenate the LOD // name in front of the VML operation name. // For others, just use the regular operation name. // The Type for a Local Oper is L. // The Types for Object operations are either O, T, C, E or A. // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZVSPOOO_C_GenOperationName( zVIEW PIView, LPVIEWENTITY EntityStructure, LPVIEWATTRIB AttributeStructure, zSHORT nGetOrSetFlag ) { zCHAR szTempName1[ 64 ]; zCHAR szTempName2[ 32 ]; zCHAR szType[ 2 ]; zLONG lZKey; zVIEW vTempView; // Set up a temporary view so that PIView remains unchanged CreateViewFromViewForTask( &vTempView, PIView, 0 ); // Position on the corresponding OperationSource for Operation entity GetIntegerFromAttribute( &lZKey, vTempView, "Operation", "ZKey" ); SetCursorFirstEntityByInteger( vTempView, "OperationSource", "ZKey", lZKey, "VML_XSource" ); GetStringFromAttribute( szType, vTempView, "Operation", "Type" ); if ( szType[ 0 ] == 'L' || szType[ 0 ] == 'O' || szType[ 0 ] == 'T' || szType[ 0 ] == 'C' || szType[ 0 ] == 'E' || szType[ 0 ] == 'A' ) { szTempName1[ 0 ] = 'o'; GetStringFromAttribute( szTempName1 + 1, vTempView, "VML_XSource", "MetaName" ); zstrcat( szTempName1, "_" ); GetStringFromAttribute( szTempName2, vTempView, "Operation", "Name" ); zstrcat( szTempName1, szTempName2 ); } else GetStringFromAttribute( szTempName1, vTempView, "Operation", "Name" ); StoreValueInRecord( vTempView, EntityStructure, AttributeStructure, szTempName1, 0 ); // Get rid of temporary view DropView( vTempView ); return( 0 ); }
zOPER_EXPORT zSHORT OPERATION zwTZZMAIND_StartEditor( zVIEW vSubtask ) { zCHAR szCommand[ 256 ]; SysGetEnvVar( szCommand, "ZEIDON", 200 ); zstrcat( szCommand, "\\CW -ZEditor" ); return( StartTask( vSubtask, szCommand, SW_SHOWNORMAL ) ); }
// Function to process the controls in order. void fnOrderedCtrls( const ZMapAct *pzma, WPARAM wParam, LPARAM lParam ) { zCHAR szBuffer[ 64 ]; zstrcpy( szBuffer, *(pzma->m_pzsTag) ); zstrcat( szBuffer, ": " ); TraceLineI( szBuffer, pzma->m_nIdNbr ); }
zSHORT fnRefreshComponentList( zVIEW vSubtask, zPCHAR szListType ) { zVIEW vListWindow; zVIEW vList; zCHAR szListView[ 10 ]; vListWindow = 0; GetViewByName( &vListWindow, "APCMLIST", vSubtask, zLEVEL_TASK ); if ( !szListType ) { if ( GetViewByName( &vList, "TZLPLRLS", vSubtask, zLEVEL_TASK ) > 0 ) DropNameForView( vList, "TZLPLRLS", vSubtask, zLEVEL_TASK ); } else if ( szListType[ 0 ] ) { zstrcpy( szListView, "TZ" ); zstrcat( szListView, szListType ); if ( vListWindow && GetCtrlState( vListWindow, "Refer", zCONTROL_STATUS_CHECKED ) > 0 ) { zstrcat( szListView, "R" ); } else zstrcat( szListView, "S" ); GetViewByName( &vList, szListView, vSubtask, zLEVEL_TASK ); SetNameForView( vList, "TZLPLRLS", vSubtask, zLEVEL_TASK ); } if ( vListWindow ) RefreshWindow( vListWindow ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zwTZERRORD_SetCountError // // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT /*DIALOG */ OPERATION zwTZERRORD_SetCountError( zVIEW vSubtask ) { zVIEW vTZERROR; zLONG lCountError; zLONG lCountWarning; zSHORT nRC; zCHAR szCount[ 10 ]; zCHAR szControlText[ 100 ]; if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) < 0 ) return( -1 ); if ( CheckExistenceOfEntity( vTZERROR, "ErrorList" ) >= zCURSOR_SET ) { // Set Count Errors to Textfield lCountError = 0; lCountWarning = 0; for ( nRC = SetCursorFirstEntity( vTZERROR, "ErrorMsg", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntity( vTZERROR, "ErrorMsg", "" ) ) { if ( CompareAttributeToInteger( vTZERROR, "ErrorMsg", "Error", 1 ) == 0 ) lCountError++; else lCountWarning++; } zltoa( lCountError, szCount ); zstrcpy( szControlText, " " ); zstrcat( szControlText, szCount ); zstrcat( szControlText, " Error(s) " ); if ( lCountWarning > 0 ) { zltoa( lCountWarning, szCount ); zstrcat( szControlText, ", " ); zstrcat( szControlText, szCount ); zstrcat( szControlText, " Warning(s) " ); } zstrcat( szControlText, "found" ); } else { zstrcpy( szControlText, " No Errors" ); } SetCtrlText( vSubtask, "txtCountError", szControlText ); return( 0 ); } // zwTZERRORD_SetCountError
zOPER_EXPORT void OPERATION MakeShortString( CDC *pDC, zPCHAR pchReturn, zLONG lMaxReturnLth, zCPCHAR cpcString, zLONG lColLth, zLONG lOffset ) { static const _TCHAR szThreeDots[ ] = _T( "..." ); if ( lMaxReturnLth == 0 ) { pchReturn[ 0 ] = 0; return; } zstrncpy( pchReturn, cpcString, lMaxReturnLth ); pchReturn[ lMaxReturnLth ] = 0; zSHORT nStringLth = zstrlen( cpcString ); CSize size; zSHORT k; zCHAR szFontFace[ 32 ]; GetTextFace( pDC->m_hDC, sizeof( szFontFace ), szFontFace ); GetTextFace( pDC->m_hAttribDC, sizeof( szFontFace ), szFontFace ); GetTextExtentPoint32( pDC->m_hDC, cpcString, nStringLth, &size ); if ( pDC->m_bPrinting ) GetTextExtentPoint32( pDC->m_hAttribDC, cpcString, nStringLth, &size ); if ( nStringLth == 0 || (size.cx + lOffset) <= lColLth ) return; GetTextExtentPoint32( pDC->m_hDC, szThreeDots, sizeof( szThreeDots ), &size ); zLONG lAddLth = size.cx; for ( k = nStringLth - 1; k > 0; k-- ) { pchReturn[ k ] = 0; GetTextExtentPoint32( pDC->m_hDC, pchReturn, k, &size ); if ( pDC->m_bPrinting ) GetTextExtentPoint32( pDC->m_hAttribDC, pchReturn, k, &size ); if ( (size.cx + lOffset + lAddLth) <= lColLth ) break; } zstrcat( pchReturn, szThreeDots ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zwTZCMRPTD_SetCPLR_Desc // // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT /*DIALOG */ OPERATION zwTZCMRPTD_SetCPLR_Desc( zVIEW vSubtask ) { zVIEW vTZCMRPTO; zCHAR szDesc[ 255 ]; zCHAR szControlText[270]; if ( GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ) < 0 ) return( -1 ); GetStringFromAttribute( szDesc, vTZCMRPTO, "CPLR", "Desc" ); zstrcpy( szControlText, " Desc: " ); zstrcat( szControlText, szDesc ); SetCtrlText( vSubtask, "txtDesc", szControlText ); return( 0 ); } // zwTZCMRPTD_SetCPLR_Desc
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZDMXGPO_CommitXDM // // PURPOSE: Commit the current XDM to the DOMAINS.XDM file. // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZDMXGPO_CommitXDM( zVIEW vSubtask, zVIEW vTZDMXGPO ) { zVIEW vT; zCHAR szXDM_FileName[ zMAX_FILESPEC_LTH + 1 ]; zCHAR szApplExecDir[ zMAX_FILESPEC_LTH + 1 ]; zSHORT nRC; // Set up the XDM File Name GetViewByName( &vT, "TaskLPLR", vSubtask, zLEVEL_TASK ); GetStringFromAttribute( szXDM_FileName, vT, "LPLR", "ExecDir" ); GetApplDirectoryFromView( szApplExecDir, vT, 2, zMAX_FILESPEC_LTH+1 ); szApplExecDir[ zstrlen( szApplExecDir ) - 1 ] = 0; zstrcat( szXDM_FileName, "\\zeidon.xdm" ); nRC = CommitOI_ToFile( vTZDMXGPO, szXDM_FileName, zASCII ); return( nRC ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zwTZCMRPTD_LoadNewAudittrail // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT /*DIALOG */ OPERATION zwTZCMRPTD_LoadNewAudittrail( zVIEW vSubtask ) { zVIEW vTZCMCPL; zVIEW vTZBRAU2O; zVIEW vParentWindow; zULONG ulZKey; zULONG ulZKeyCPLR; zCHAR szName[ 33 ]; zCHAR szControlText[40]; GetViewByName( &vTZCMCPL, "TZCMCPL", vSubtask, zLEVEL_TASK ); GetIntegerFromAttribute( (zPLONG) &ulZKey, vTZCMCPL, "CPLR", "ZKey" ); GetStringFromAttribute( szName, vTZCMCPL, "CPLR", "Name" ); if ( GetViewByName( &vTZBRAU2O, "TZBRAU2O", vSubtask, zLEVEL_TASK ) > 0 ) { GetIntegerFromAttribute( (zPLONG) &ulZKeyCPLR, vTZBRAU2O, "CPLR", "ZKey" ); if ( ulZKey == ulZKeyCPLR ) return( 0 ); else DropObjectInstance( vTZBRAU2O ); } if ( zwfnTZCMRPTD_LoadNewAudittrail( vSubtask, &vTZBRAU2O ) < 0 ) { return( -1 ); } GetStringFromAttribute( szName, vTZCMCPL, "CPL", "Name" ); zstrcpy( szControlText, " CPL: " ); zstrcat( szControlText, szName ); SetCtrlText( vSubtask, "txtCPL", szControlText ); GetParentWindow( &vParentWindow, vSubtask ); RefreshCtrl( vParentWindow, "lbCPLRList" ); return( 0 ); } // zwTZCMRPTD_LoadNewAudittrail
static int RunSystem (char *pszOrder, HWND hWnd, FILE *fLog) { int nRC; zCHAR szMsg[256]; nRC = system (pszOrder); if (nRC == -1) { switch (errno) { case E2BIG: strcpy( szMsg, "Argument list is too big!\nOrder: " ); strcat( szMsg, pszOrder); break; case ENOENT: strcpy (szMsg, "Command interpreter cannot be found !"); break; case ENOEXEC: strcpy (szMsg, "Command-interpreter file has invalid format and is not executable"); break; case ENOMEM: strcpy (szMsg, "Memory error: ENOMEM. See description of command 'system'"); break; default: strcpy (szMsg, "Unknown error while executing command 'system'"); break; } MessageBox( hWnd, szMsg, "Error Running xwdgen", MB_OK | MB_ICONSTOP | MB_APPLMODAL ); zstrcat( szMsg, "\n" ); if ( fLog ) fputs( szMsg,fLog ); } return (nRC); }
static void ProcessXwds( HWND hWnd, zVIEW vSubtask, zCHAR *cLogFile, zCHAR cRemReadOnly) { FILE *fLog=NULL; zVIEW vLPLR; zVIEW vDialog; zSHORT nRC; RECT rect; zCHAR szDialogName[32]; zCHAR szMsg[256]; zPCHAR pszPath; zCHAR szOrder[512]; zCHAR szTargetPath[128]; zCHAR szSourcePath[128]; if ( cLogFile && cLogFile[0] ) fLog = fopen( cLogFile, "w"); if (cRemReadOnly == 'Y') { /* The program was called with parameter -r to remove the ** readonly attribute for all PWD-files. First we build a ** TMP-directory to save the original files. Then we remove ** the readonly attribute. */ pszPath = getenv ("KZD"); strcpy (szTargetPath, pszPath); strcat (szTargetPath, ":\\"); pszPath = getenv ("KZV"); strcat (szTargetPath, pszPath); strcpy (szSourcePath, szTargetPath); strcat (szTargetPath, "\\savexwd"); strcat (szSourcePath, "\\a\\bin\\sys"); strcpy (szOrder, "mkdir "); strcat (szOrder, szTargetPath); if (RunSystem (szOrder, hWnd, fLog) == -1) { if (fLog) fclose (fLog); return; } strcpy (szOrder, "xcopy "); strcat (szOrder, szSourcePath); strcat (szOrder, "\\*.pwd "); strcat (szOrder, szTargetPath); strcat (szOrder, " /K /Q"); if (RunSystem (szOrder, hWnd, fLog) == -1) { if (fLog) fclose (fLog); return; } strcpy (szOrder, "attrib -r "); strcat (szOrder, szSourcePath); strcat (szOrder, "\\*.pwd"); if (RunSystem (szOrder, hWnd, fLog) == -1) { if (fLog) fclose (fLog); return; } } RetrieveViewForMetaList( vSubtask, vSubtask, &vLPLR, zSOURCE_DIALOG_META ); nRC = SetCursorFirstEntity( vLPLR, "W_MetaDef", "" ); while ( nRC >= zCURSOR_SET ) { GetStringFromAttribute( szDialogName, vLPLR, "W_MetaDef", "Name" ); nRC = ActivateMetaOI( &vDialog, vLPLR, zSOURCE_DIALOG_META, zSINGLE ); if ( nRC < 0 ) { zstrcpy( szMsg, "Could not Activate Dialog: " ); zstrcat( szMsg, szDialogName ); zstrcat( szMsg, ".\nAborting Build" ); MessageBox( hWnd, szMsg, "Error Running xwdgen", MB_OK | MB_ICONSTOP | MB_APPLMODAL ); zstrcat( szMsg, "\n" ); if ( fLog ) { fputs( szMsg,fLog ); fclose (fLog); } return ; } else { /* The dialog ACCOUNT.PWD isn't ok. Therefore we get an error message ** while saving the dialog and the releasebuilding system isn't running. ** We don't save the dialog ACCOUNT.PWD until the bug is fixed. This dialog ** is an example and not needed for a release. RG, 17.12.1999 */ if ( strncmp (szDialogName, "TZ", 2) == 0 || strncmp (szDialogName, "tz", 2) == 0 ) { // Send message that we are saving the XWD. strcpy( szMsg, "Saving Dialog: " ); strcat( szMsg, szDialogName ); strcpy( szOutLine, szMsg ); GetClientRect( hWnd, &rect ); InvalidateRect( hWnd, &rect, TRUE ); UpdateWindow( hWnd ); TraceLineS( "xwdgen: ", szMsg ); if ( fLog ) { zstrcat( szMsg, "\n" ); fputs( szMsg,fLog ); } else TraceLineS( szMsg, "" ); SetCursorFirstEntity( vDialog, "Window", "" ); CommitMetaOI( vDialog, zSOURCE_DIALOG_META ); DropView( vDialog ); } nRC = SetCursorNextEntity( vLPLR, "W_MetaDef", "" ); } } if (cRemReadOnly == 'Y') { /* After saving the PWD and XWD files we have to get ** back the original files with readonly attribute */ strcpy (szOrder, "xcopy "); strcat (szOrder, szTargetPath); strcat (szOrder, "\\*.pwd "); strcat (szOrder, szSourcePath); strcat (szOrder, " /K /Q"); if (RunSystem (szOrder, hWnd, fLog) == -1) { if (fLog) fclose (fLog); return; } strcpy (szOrder, "rmdir /S /Q "); strcat (szOrder, szTargetPath); RunSystem (szOrder, hWnd, fLog); } if (fLog) fclose (fLog); else TraceLineS( "Completed XWD build", "" ); return; }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zofnTZSIXSKO_BldXSKChildEnt // // PURPOSE: // // TRIGGLODED BY: // WINDOW: TZZOLODD // ACTION: OPTION // NAME: File_Save // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zofnTZSIXSKO_BldXSKChildEnt ( zVIEW vKZSIXSKO_Root, zVIEW vKZSIXSKO, zVIEW vTZZOXOD1, zVIEW vTZTENVRO_REF, zSHORT nEntityFlag ) { zVIEW vTZTENVRO_Parent; zSHORT nRC; zSHORT nRC2; zPCHAR szDBMS; zSHORT nEntImpls; zLONG lEntityZKey; zSHORT nEntitySet = nEntityFlag; zSHORT nSetViewToSubXsk = 0; nRC = CreateViewFromViewForTask( &vTZTENVRO_Parent, vTZTENVRO_REF, 0 ); nRC = zCURSOR_SET; while ( nRC >= zCURSOR_SET ) { nRC = SetViewToSubobject( vTZZOXOD1, "CHILDENTITY" ); /* Check physik, if no, then do not process this entity */ if ( (nRC = CheckExistenceOfEntity ( vTZZOXOD1, "DATARECORD" )) >= zCURSOR_SET ) { nRC = GetIntegerFromAttribute( &lEntityZKey, vTZZOXOD1, "ENTITY", "ERENT_TOK" ); nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DBMS_Source" ); if ( nRC < zCURSOR_SET ) { GetAddrForAttribute( &szDBMS, vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS" ); nEntImpls = 0; for ( nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { nEntImpls++; } } if ( nEntImpls == 1 ) { nRC = zCURSOR_SET; } else if ( nEntImpls > 1 ) { for ( nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { zstrcpy( szMsg, "Do you want to use Data Source '" ); GetAddrForAttribute( &szMsgName, vTZTENVRO_Parent, "TE_DBMS_Source", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "' to implement ER Entity '" ); GetAddrForAttribute( &szMsgName, vTZTENVRO_Parent, "ER_Entity", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "'?" ); nRC = MessagePrompt ( vTZTENVRO_Parent, "XOD_06", "TE Choice", szMsg, 0, zBUTTONS_YESNO, 0, 0 ); if ( nRC == zRESPONSE_YES ) break; // found Entity implemented in same DBMS } } } if ( nRC < zCURSOR_SET ) { zstrcpy( szMsg, "Unable to Find Entity in TE Data Source with same DBMS.\n\nEntity Name = " ); GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ER_EntityRec", "Name" ); zstrcat( szMsg, szMsgName ); nRC = MessagePrompt( vTZZOXOD1, "XOD_06", "Internal LOD Error", szMsg, 0, zBUTTONS_OK, 0, 0 ); nRC = DropView( vTZTENVRO_Parent ); return( 0 ); } } // new Entity found // if SironGroup exists // if SironKatalog exists // create new Katalog // create next ENTITY and ENTITYCOM entities // create dependent ATTRIB and ATTRICOM entities nRC = CheckExistenceOfEntity ( vTZTENVRO_Parent, "SironGroup" ); if ( nRC >= zCURSOR_SET ) { nRC = CheckExistenceOfEntity ( vTZTENVRO_Parent, "SironKatalog" ); if ( nRC >= zCURSOR_SET ) { // Go back to KATALOG entity if ( nEntitySet ) { while ( ResetViewFromSubobject( vKZSIXSKO_Root ) == 0 ); } // Create new KATALOG entity nRC = SetCursorLastEntity ( vKZSIXSKO_Root, "KATALOG", "" ); nRC = CreateEntity ( vKZSIXSKO_Root, "KATALOG", zPOS_AFTER ); SetMatchingAttributesByName(vKZSIXSKO_Root, "KATALOG", vTZTENVRO_Parent, "SironKatalog", zSET_ALL ); for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent, "KatalogComment", "SironKatalog"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVRO_Parent, "KatalogComment", "SironKatalog") ) { CreateEntity ( vKZSIXSKO_Root, "KATCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "KATCOM", vTZTENVRO_Parent, "KatalogComment", zSET_ALL ); } } // ViewToSubobject only, if caller created an ENTITY entity if ( nEntitySet ) { if ( CheckExistenceOfEntity( vKZSIXSKO_Root, "ENTITY" ) >= zCURSOR_SET ) { SetViewToSubobject( vKZSIXSKO_Root, "ENTITYCHILD" ); nSetViewToSubXsk = 1; } } // Create next ENTITY entity nRC = SetCursorLastEntity ( vKZSIXSKO_Root, "ENTITY", "" ); nRC = CreateEntity ( vKZSIXSKO_Root, "ENTITY", zPOS_AFTER ); nEntitySet = 1; SetMatchingAttributesByName(vKZSIXSKO_Root, "ENTITY", vTZTENVRO_Parent, "SironGroup", zSET_ALL ); SetAttributeFromInteger( vKZSIXSKO_Root, "ENTITY", "ERENT_TOK", lEntityZKey ); for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent, "GroupComment", "SironGroup"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVRO_Parent, "GroupComment", "SironGroup") ) { CreateEntity ( vKZSIXSKO_Root, "ENTITYCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ENTITYCOM", vTZTENVRO_Parent, "GroupComment", zSET_ALL ); } // Create all dependent ATTRIB entities according to XOD ATTRIB // entities for ( nRC = SetCursorFirstEntity( vTZZOXOD1, "ATTRIB", "ENTITY"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZZOXOD1, "ATTRIB", "ENTITY") ) { nRC = SetCursorFirstEntityByAttr( vTZTENVRO_Parent, "TE_FieldDataRel","Name", vTZZOXOD1, "ATTRIB", "NAME", "TE_TablRec"); nRC = CheckExistenceOfEntity( vTZTENVRO_Parent, "SironField" ); if ( nRC < zCURSOR_SET ) { zstrcpy( szMsg, "Unable to Find SironField in TE Data Source .\n\nAttribute Name = " ); GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ATTRIB", "NAME" ); zstrcat( szMsg, szMsgName ); nRC = MessagePrompt ( vTZZOXOD1, "XOD_06", "Internal XOD Error", szMsg, 0, zBUTTONS_OK, 0, 0 ); nRC = DropView( vTZTENVRO_Parent ); return( 0 ); } CreateEntity( vKZSIXSKO_Root, "ATTRIB", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIB", vTZTENVRO_Parent, "SironField", zSET_ALL ); SetAttributeFromAttribute( vKZSIXSKO_Root, "ATTRIB", "XVAATT_TOK", vTZZOXOD1, "ATTRIB", "XVAATT_TOK" ); // Create all dependent ATTRIBCOM entities for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent, "SironFieldComment","SironField"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVRO_Parent, "SironFieldComment","SironField")) { CreateEntity ( vKZSIXSKO_Root, "ATTRIBCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIBCOM", vTZTENVRO_Parent, "SironFieldComment", zSET_ALL ); } } } } // Abstieg des Pfades nRC = CheckExistenceOfEntity( vTZZOXOD1, "CHILDENTITY" ); if ( nRC >= zCURSOR_SET ) zofnTZSIXSKO_BldXSKChildEnt( vKZSIXSKO_Root, vKZSIXSKO, vTZZOXOD1, vTZTENVRO_Parent, nEntitySet ); nRC2 = ResetViewFromSubobject( vTZZOXOD1 ); if ( nSetViewToSubXsk ) { nRC2 = ResetViewFromSubobject( vKZSIXSKO_Root ); nSetViewToSubXsk = 0; } nRC = SetCursorNextEntity( vTZZOXOD1, "CHILDENTITY", "" ); } if ( vTZTENVRO_Parent ) nRC = DropView( vTZTENVRO_Parent ); return( 0 ); }
static void ProcessXods( HWND hWnd, zVIEW vSubtask, zCHAR *cTE_Name, zCHAR *cLogFile, zCHAR cNet ) { FILE *fLog=NULL; zVIEW vTaskLPLR = NULL; zCHAR szMsg[ 256 ]; zVIEW vTZTEDBLO, vDTE, vCM_List; zVIEW vLOD, vLOD_List, vXOD; zVIEW vTemp = NULL; zVIEW vT=NULL; zSHORT nRC; RECT rect; LPLIBRARY hLib = NULL; zCHAR szLODName[ 32 ]; zCHAR szFileName[ 256 ]; zCHAR szNetwork[ 256 ]; if ( cLogFile && cLogFile[0] ) fLog = fopen( cLogFile, "w"); memset (szNetwork, 0, 256); SysReadZeidonIni( -1, "[Zeidon]", "DefaultNetWork", szNetwork ); if (*szNetwork == 0) { strcpy( szMsg, "No default Network set" ); MessageBox( hWnd, szMsg, "Error Running xodgen", MB_OK | MB_ICONSTOP | MB_APPLMODAL ); zstrcat( szMsg, "\n" ); if ( fLog ) { fputs( szMsg,fLog ); fclose (fLog); } return; } ActivateOI_FromFile( &vTZTEDBLO, "tztedblo", vSubtask, "tztedblo.xdl", zMULTIPLE ); SetNameForView( vTZTEDBLO, "TZTEDBLO", 0, zLEVEL_TASK ); //oTZTENVRO_GetUpdViewForDTE_P nRC = RetrieveViewForMetaList( vSubtask, vSubtask, &vCM_List, zSOURCE_DTE_META ); nRC = ActivateMetaOI( &vDTE, vCM_List, zSOURCE_DTE_META, zSINGLE | zACTIVATE_ROOTONLY ); if ( nRC < 0 ) { strcpy( szMsg, "Internal error activating TE" ); MessageBox( hWnd, szMsg, "Error Running xodgen", MB_OK | MB_ICONSTOP | MB_APPLMODAL ); zstrcat( szMsg, "\n" ); if ( fLog ) { fputs( szMsg,fLog ); fclose (fLog); } return; } SetNameForView( vDTE, "TE_DB_Environ", vSubtask, zLEVEL_TASK ); // Position on given DBMS Source nRC = SetCursorFirstEntityByString( vDTE, "TE_DBMS_Source", "Name", cTE_Name, 0 ); if ( nRC < zCURSOR_SET ) { strcpy( szMsg, "Invalid TE Name :"); strcat( szMsg, cTE_Name ); MessageBox( hWnd, szMsg, "Error Running xodgen", MB_OK | MB_ICONSTOP | MB_APPLMODAL ); zstrcat( szMsg, "\n" ); if ( fLog ) { fputs( szMsg,fLog ); fclose (fLog); } return; } nRC = GetViewByName( &vTaskLPLR, "TaskLPLR", 0, zLEVEL_TASK ); assert(nRC >= 0 ) ; // Check for network build if ( cNet ) { // Use default network for Ton Beller (DBMS = "Network Server") SetCursorFirstEntityByString( vTZTEDBLO, "TE_DBMS_Source", "Network", szNetwork, 0 ); SetAttributeFromAttribute( vDTE, "TE_DBMS_Source", "DBMS", vTZTEDBLO, "TE_DBMS_Source", "DBMS" ); SetAttributeFromAttribute( vDTE, "TE_DBMS_Source", "Network", vTZTEDBLO, "TE_DBMS_Source", "Network" ); } else { // Position on corresponding DBMS entry in DB Handler object. SetCursorFirstEntityByAttr( vTZTEDBLO, "TE_DBMS_Source", "DBMS", vDTE, "TE_DBMS_Source", "DBMS", 0 ); } //zwTZTEUPDD_BuildXODsOnLPLR( zVIEW vSubtask ) // Create a view that lists all LODs. RetrieveViewForMetaList( vSubtask, vSubtask, &vLOD_List, zREFER_LOD_META ); OrderEntityForView( vLOD_List, "W_MetaDef", "Name A" ); SetNameForView( vLOD_List, "TZZOLFLO", vSubtask, zLEVEL_TASK ); // Loop through each of the LOD's // WMetaType.Type= zREFER_LOD_META // for ( nRC = SetCursorFirstEntity( vLOD_List, "W_MetaDef", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntity( vLOD_List, "W_MetaDef", "" ) ) { GetStringFromAttribute( szLODName, vLOD_List, "W_MetaDef", "Name" ); nRC = ActivateMetaOI( &vLOD, vLOD_List, zREFER_LOD_META, zCURRENT_OI ); if ( nRC < 0 ) { zstrcpy( szMsg, "Could not Activate LOD: " ); zstrcat( szMsg, szLODName ); zstrcat( szMsg, ".\nAborting Build" ); MessageBox( hWnd, szMsg, "Error Running xodgen", MB_OK | MB_ICONSTOP | MB_APPLMODAL ); zstrcat( szMsg, "\n" ); if ( fLog ) { fputs( szMsg,fLog ); fclose (fLog); } return ; } else { // Send message that we are building the LOD. strcpy( szMsg, "Building executable for LOD: " ); strcat( szMsg, szLODName ); strcat( szMsg, "." ); strcpy( szOutLine, szMsg ); GetClientRect( hWnd, &rect ); InvalidateRect( hWnd, &rect, TRUE ); UpdateWindow( hWnd ); if ( fLog ) { zstrcat( szMsg, "\n" ); fputs( szMsg,fLog ); } else TraceLineS( szMsg, "" ); // Make sure the TE_SourceZKey attribute is set because it determines // what DBMS_Source is used in building the XOD. if ( CheckExistenceOfEntity( vLOD, "POD" ) >= zCURSOR_SET ) SetAttributeFromAttribute ( vLOD, "POD", "TE_SourceZKey", vDTE, "TE_DBMS_Source", "ZKey" ); // Build the XOD in memory oTZZOXODO_SaveXOD( vLOD ); SetNameForView( vLOD, "TZZOLODO", 0, zLEVEL_TASK ); DropMetaOI( vSubtask, vLOD ); // Commit the XOD to LPLR file. GetViewByName( &vXOD, "TZZOXODO", 0, zLEVEL_TASK ); GetStringFromAttribute( szFileName, vTaskLPLR, "LPLR", "ExecDir" ); ofnTZCMWKSO_AppendSlash( szFileName ); zstrcat( szFileName, szLODName ); zstrcat( szFileName, ".XOD" ); CommitOI_ToFile( vXOD, szFileName, zSINGLE ); } } if (fLog) fclose (fLog); else TraceLineS( "Completed XOD build", "" ); return; }
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 ); }
zOPER_EXPORT zSHORT OPERATION BuildXODsOnLPLR( zVIEW vSubtask ) { // This routine does not actually save LODs, but only builds the XODs // on the LPLR. zVIEW vDTE; zVIEW vLPLR; zVIEW vLOD_List; zVIEW vLOD; zVIEW vXOD; zSHORT nRC; zCHAR szMsg[ zSHORT_MESSAGE_LTH + 1 ]; zCHAR szLOD_Name[ 33 ]; zCHAR szFileName[ zMAX_FILESPEC_LTH + 1 ]; GetViewByName( &vDTE, "TE_DB_Environ", vSubtask, zLEVEL_TASK ); GetViewByName( &vLOD_List, "TZZOLFLO", vSubtask, zLEVEL_TASK ); GetViewByName( &vLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK ); // Save Subtask for use by XOD build routine. SetNameForView( vSubtask, "TE_Window", vSubtask, zLEVEL_TASK ); // For each selected LOD, build the XOD using the current DBMS and // commit as file to LPLR, unless the LOD does not have a POD. // Note that we are not looking to see if the DBMS identified // in the POD.TE_SourceZKey matches the current DBMS. We will save // selected LODs with the current DBMS no matter how they were saved // last time. for ( nRC = SetCursorFirstSelectedEntity( vLOD_List, "W_MetaDef", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextSelectedEntity( vLOD_List, "W_MetaDef", "" ) ) { GetStringFromAttribute( szLOD_Name, vLOD_List, "W_MetaDef", "Name" ); nRC = ActivateMetaOI( vSubtask, &vLOD, vLOD_List, zREFER_LOD_META, zCURRENT_OI ); if ( nRC < 0 ) { zstrcpy( szMsg, "Could not Activate LOD: " ); zstrcat( szMsg, szLOD_Name ); zstrcat( szMsg, ".\nAborting Build" ); MessageSend( vSubtask, "TE00426", "Physical Data Model", szMsg, zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } else { // Send message that we are building the LOD. zstrcpy( szMsg, "Building executable for LOD: " ); zstrcat( szMsg, szLOD_Name ); zstrcat( szMsg, "." ); MB_SetMessage( vSubtask, 1, szMsg ); // Make sure the TE_SourceZKey attribute is set because it determines // what DBMS_Source is used in building the XOD. if ( CheckExistenceOfEntity( vLOD, "POD" ) >= zCURSOR_SET ) SetAttributeFromAttribute( vLOD, "POD", "TE_SourceZKey", vDTE, "TE_DBMS_Source", "ZKey" ); // Build the XOD in memory. oTZZOXODO_SaveXOD( vSubtask, vLOD ); SetNameForView( vLOD, "TZZOLODO", vSubtask, zLEVEL_TASK ); GetViewByName( &vXOD, "TZZOXODO", vSubtask, zLEVEL_TASK ); DropMetaOI( vSubtask, vLOD ); // Commit the XOD to LPLR file. GetStringFromAttribute( szFileName, vLPLR, "LPLR", "ExecDir" ); ofnTZCMWKSO_AppendSlash( szFileName ); zstrcat( szFileName, szLOD_Name ); zstrcat( szFileName, ".XOD" ); TraceLineS( "*** Committing workstation file: ", szFileName ); CommitOI_ToFile( vXOD, szFileName, zSINGLE ); } } MB_SetMessage( vSubtask, 1, "Build of XODs complete." ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zwTZERRORD_ErrorListSaveToFile // // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT /*DIALOG */ OPERATION zwTZERRORD_ErrorListSaveToFile( zVIEW vSubtask ) { zVIEW vTZERROR; zULONG ulZFlags = 0; zLONG lLth; zLONG FileHandle; zCHAR szMsg[300]; zCHAR szTool[50]; zCHAR szTitle[ 100 ]; zCHAR szName[ 33 ]; zCHAR szFileName[ zMAX_FILENAME_LTH + 1]; if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) < 0 ) return( -1 ); if ( CompareAttributeToInteger( vTZERROR, "ErrorList", "MetaType", zSOURCE_ERD_META ) == 0 ) { zstrcpy( szTool, "Data Model" ); zstrcpy( szName, "Entity" ); lLth = 32; } else if ( CompareAttributeToInteger( vTZERROR, "ErrorList", "MetaType", zSOURCE_REPLACE_BMP ) == 0 ) { zstrcpy( szTool, "Bitmap" ); zstrcpy( szName, "Dialog" ); lLth = 8; } else { zstrcpy( szTool, "" ); zstrcpy( szName, "" ); lLth = 1; } szFileName[ 0 ] = 0; ulZFlags = zOFN_OVERWRITEPROMPT | zOFN_CREATEPROMPT | zOFN_SAVEAS | zOFN_HIDEREADONLY; if ( OperatorPromptForFile( vSubtask, szFileName, sizeof( szFileName ), "Text Files (*.txt)|*.txt|", "txt", ulZFlags ) == 1 ) { FileHandle = SysOpenFile( vSubtask, szFileName, COREFILE_WRITE ); if ( FileHandle == -1 ) { zstrcpy( szMsg, "Unable to open " ); zstrcat( szMsg, szFileName ); zstrcpy( szTitle, szTool ); zstrcat( szTitle, " Maintenance" ); MessageSend( vSubtask, "FEH001", szTitle, szMsg, zMSGQ_OBJECT_CONSTRAINT_ERROR, 0 ); return( -1 ); } zwfnTZERRORD_WriteErrorListToFile( vTZERROR, FileHandle, szTool, szName, lLth ); SysCloseFile( vSubtask, FileHandle, 0 ); } return( 0 ); } // zwTZERRORD_ErrorListSaveToFile
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 ); }
///////////////////////////////////////////////////////////////////////////// // // ENTRY: // // PURPOSE: Save the HK object(both Source & Executable???) // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zwTZHKEYAD_SaveHK_ForLPLR( zVIEW vSubtask ) { zPCHAR lpGlobalHotkey; zUSHORT usGlobalHotkeyLth; LPACCEL_TABLE lpAT; LPACCEL_TABLE lpAT_Start; zCHAR szFileSpec[ zMAX_FILESPEC_LTH + 1 ]; zVIEW vKZHKEYSO; zVIEW vKZHKEYXO; zVIEW vTaskLPLR; zULONG ulMaxLth; zSHORT nRC; GetViewByName( &vKZHKEYSO, "KZHKEYSO", vSubtask, zLEVEL_ANY ); // Get the directory. GetViewByName( &vTaskLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK ); if ( vTaskLPLR == 0 ) { MessageSend( vSubtask, "HK00102", "Hot Keys", "Can't locate LPLR?", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } GetStringFromAttribute( szFileSpec, vTaskLPLR, "LPLR", "MetaSrcDir" ); zstrcat( szFileSpec, "\\ZEIDON.PHK" ); MiSetOI_ReleaseForView( vKZHKEYSO, szlReleaseCurrent ); CommitOI_ToFile( vKZHKEYSO, szFileSpec, zASCII | zENCODE_BLOBS | zNO_NULL_STRING_TERM ); SfAllocTaskMemory( vSubtask, (zCOREMEM) &lpGlobalHotkey, 65000 ); lpAT = (LPACCEL_TABLE) SfLockTaskMemory( lpGlobalHotkey ); lpAT_Start = lpAT; usGlobalHotkeyLth = 0; SfActivateSysEmptyOI( &vKZHKEYXO, "KZHKEYXO", vSubtask, zSINGLE | zLEVEL_APPLICATION ); CreateEntity( vKZHKEYXO, "App", zPOS_AFTER ); nRC = SetEntityCursor( vKZHKEYSO, "Hotkey", 0, zPOS_FIRST, 0, 0, 0, 0, 0, 0 ); while ( nRC >= 0 ) { CreateEntity( vKZHKEYXO, "Hotkey", zPOS_AFTER ); SetMatchingAttributesByName( vKZHKEYXO, "Hotkey", vKZHKEYSO, "Hotkey", zSET_ALL ); SetAttributeFromAttribute( vKZHKEYXO, "Hotkey", "COP", vKZHKEYSO, "Operation", "Name" ); SetAttributeFromAttribute( vKZHKEYXO, "Hotkey", "DLL", vKZHKEYSO, "Hotkey", "DLL_Name" ); lpAT->chType = zACCEL_HOTKEY; ulMaxLth = sizeof( zACCEL_DEF ); GetBlobFromAttribute( &(lpAT->ac), &ulMaxLth, vKZHKEYSO, "Hotkey", "KeyCombo" ); lpAT->nID = (zSHORT) GetRelativeEntityNumber( vKZHKEYSO, "Hotkey", 0, 0L ); usGlobalHotkeyLth += sizeof( zACCEL_TABLE ); lpAT++; nRC = SetCursorNextEntity( vKZHKEYSO, "Hotkey", 0 ); } zmemset( lpAT, 0xFF, sizeof( zACCEL_TABLE ) ); // terminator usGlobalHotkeyLth += sizeof( zACCEL_TABLE ); lpAT = lpAT_Start; SetAttributeFromBlob( vKZHKEYXO, "App", "Hotkey", lpAT, usGlobalHotkeyLth ); SfUnlockTaskMemory( lpAT ); SfFreeTaskMemory( lpGlobalHotkey ); GetStringFromAttribute( szFileSpec, vTaskLPLR, "LPLR", "ExecDir" ); zstrcat( szFileSpec, "\\ZEIDON.XKY" ); CommitOI_ToFile( vKZHKEYXO, szFileSpec, zASCII ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // ENTRY: // // PURPOSE: Create a HK if one doesn't exist for current LPLR. // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zwTZHKEYAD_InitHK_ForLPLR( zVIEW vSubtask ) { zVIEW vCM_List; zVIEW vKZHKEYSO; zVIEW vTaskLPLR; zCHAR szFileSpec[ zMAX_FILESPEC_LTH + 1 ]; // zSHORT nRC; RetrieveViewForMetaList( vSubtask, &vCM_List, zREFER_GO_META ); SetNameForView( vCM_List, "CM_List", vSubtask, zLEVEL_TASK ); #if 0 // Get File list of Presentation Environments (only one). nRC = RetrieveViewForMetaList( vSubtask, &vCM_List, zREFER_HKEY_META ); // Always have a Named List of PPE's (even though there can only be One)! // This is done to be consistent with other dialogs. The only time the // that the named List will not exist is during a SwithLPLR. // This fact is used a "flag" to the ReturnFromSubWnd logic. nRC = SetNameForView( vCM_List, "CM_HK_List", vSubtask, zLEVEL_TASK ); // See if one exists. nRC = SetCursorFirstEntity( vCM_List, "W_MetaDef", "" ); // If not, create one, else open it. if ( nRC == zCURSOR_NULL ) { // oTZPESRCO_GrayOptions( vSubtask ); } else { nRC = ActivateMetaOI( vSubtask, &vKZHKEYSO, vCM_List, zREFER_HKEY_META, zSINGLE ); SetNameForView( vKZHKEYSO, "TZPESRCV", vSubtask, zLEVEL_TASK ); CreateViewFromViewForTask( &vCtrlList, vKZHKEYSO, 0 ); SetNameForView( vCtrlList, "TZPECTRL", vSubtask, zLEVEL_TASK ); SetAttributeFromInteger( vKZHKEYSO, "ApplHKyDef", "CtrlFontDel", 0 ); } #endif // Get the directory. GetViewByName( &vTaskLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK ); if ( vTaskLPLR == 0 ) { MessageSend( vSubtask, "HK00101", "Hot Keys", "Can't locate LPLR?", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } GetStringFromAttribute( szFileSpec, vTaskLPLR, "LPLR", "MetaSrcDir" ); zstrcat( szFileSpec, "\\ZEIDON.PHK" ); TraceLineS( "Hotkey Dialog opening file: ", szFileSpec ); // Load the HKEY object. if ( ActivateOI_FromFile( &vKZHKEYSO, "KZHKEYSO", vSubtask, szFileSpec, zIGNORE_ERRORS | zSINGLE | zLEVEL_APPLICATION | zNOI_OKAY ) < 0 ) { CreateEntity( vKZHKEYSO, "Application", zPOS_AFTER ); CommitOI_ToFile( vKZHKEYSO, szFileSpec, zASCII ); } SetNameForView( vKZHKEYSO, "KZHKEYSO", vSubtask, zLEVEL_TASK ); 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: zofnTZSIXSKO_BldXSK // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zofnTZSIXSKO_BldXSK ( zVIEW vKZSIXSKO_Root, zVIEW vKZSIXSKO, zVIEW vTZZOXODO, zVIEW vTZTENVRO_REF ) { zVIEW vTZZOXOD1; zVIEW vTZZOXOD_TestWorkAttrib; zVIEW vTZTENVR1; zPCHAR szDBMS; zSHORT nEntImpls; zSHORT nRC; zLONG lEntityZKey; zSHORT nAttrCount = 0; zSHORT nEntitySet = 0; nRC = CreateViewFromViewForTask( &vTZTENVR1, vTZTENVRO_REF, 0 ); nRC = CreateViewFromViewForTask( &vTZZOXOD1, vTZZOXODO, 0 ); nRC = SetCursorFirstEntity( vTZZOXOD1, "ENTITY", "" ); /*=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=? ?? Was ist hier mit Work Entities ? ?? Wie koennen diese umgangen werden ?? natuerlich auch fuer Kinder beruecksichtigen **=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?*/ /* Check physik, if no, then do not process this entity */ if ( (nRC = CheckExistenceOfEntity( vTZZOXOD1, "DATARECORD" )) >= zCURSOR_SET ) { // Suche SironKatalog in TE nRC = GetIntegerFromAttribute( &lEntityZKey, vTZZOXOD1, "ENTITY", "ERENT_TOK" ); nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DBMS_Source" ); if ( nRC < zCURSOR_SET ) { GetAddrForAttribute( &szDBMS, vTZTENVR1, "TE_DBMS_Source", "DBMS" ); nEntImpls = 0; for ( nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVR1, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { nEntImpls++; } } if ( nEntImpls == 1 ) { nRC = zCURSOR_SET; } else if ( nEntImpls > 1 ) { for ( nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVR1, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { zstrcpy( szMsg, "Do you want to use Data Source '" ); GetAddrForAttribute( &szMsgName, vTZTENVR1, "TE_DBMS_Source", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "' to implement ER Entity '" ); GetAddrForAttribute( &szMsgName, vTZTENVR1, "ER_Entity", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "'?" ); nRC = MessagePrompt ( vTZTENVR1, "XOD_06", "TE Choice", szMsg, 0, zBUTTONS_YESNO, 0, 0 ); if ( nRC == zRESPONSE_YES ) break; // found Entity implemented in same DBMS } } } if ( nRC < zCURSOR_SET ) { zstrcpy( szMsg, "Unable to Find Entity in TE Data Source with same " "DBMS.\n\nEntity Name = " ); GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ENTITY", "NAME" ); zstrcat( szMsg, szMsgName ); nRC = MessagePrompt( vTZZOXOD1, "XOD_03", "Internal LOD Error", szMsg, 0, zBUTTONS_OK, 0, 0 ); return( 0 ); } } // Now: First Entity found // if SironKatalog Exits // create KATALOG and KATCOM entities // create first ENTITY and ENTITYCOM entities // create dependent ATTRIB and ATTRICOM entities nRC = CheckExistenceOfEntity ( vTZTENVR1, "SironKatalog" ); if ( nRC >= zCURSOR_SET ) { // Create KATALOG entity nRC = CreateEntity ( vKZSIXSKO_Root, "KATALOG", zPOS_AFTER ); SetMatchingAttributesByName(vKZSIXSKO_Root, "KATALOG", vTZTENVR1, "SironKatalog", zSET_ALL ); for ( nRC = SetCursorFirstEntity( vTZTENVR1, "KatalogComment", "SironKatalog"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1, "KatalogComment", "SironKatalog") ) { CreateEntity ( vKZSIXSKO_Root, "KATCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "KATCOM", vTZTENVR1, "KatalogComment", zSET_ALL ); } // Create first ENTITY entity nRC = CreateEntity ( vKZSIXSKO_Root, "ENTITY", zPOS_AFTER ); nEntitySet = 1; SetMatchingAttributesByName(vKZSIXSKO_Root, "ENTITY", vTZTENVR1, "OrigSironField", zSET_ALL ); SetAttributeFromAttribute( vKZSIXSKO_Root, "ENTITY", "ERENT_TOK", vTZZOXOD1, "ENTITY", "ERENT_TOK" ); for ( nRC = SetCursorFirstEntity( vTZTENVR1, "FieldComment", "OrigSironField"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1, "FieldComment", "OrigSironField") ) { CreateEntity ( vKZSIXSKO_Root, "ENTITYCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ENTITYCOM", vTZTENVR1, "FieldComment", zSET_ALL ); } // Create all dependent ATTRIB entities // according to XOD ATTRIB entities for ( nRC = SetCursorFirstEntity( vTZZOXOD1, "ATTRIB", "ENTITY"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZZOXOD1, "ATTRIB", "ENTITY") ) { // If the Attribute is a Workattribute there is no Datafield. // Do not save the Workattributes in the XSK-file. nRC = CreateViewFromViewForTask( &vTZZOXOD_TestWorkAttrib, vTZZOXOD1, 0 ); nRC = SetCursorFirstEntityByAttr (vTZZOXOD_TestWorkAttrib, "DATAFIELD", "FLDNAME", vTZZOXOD1, "ATTRIB", "NAME", ""); if (nRC == zCURSOR_SET) { nRC = SetCursorFirstEntityByAttr ( vTZTENVR1, "TE_FieldDataRel", "Name", vTZZOXOD1, "ATTRIB", "NAME", "TE_TablRec"); CreateEntity ( vKZSIXSKO_Root, "ATTRIB", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIB", vTZTENVR1, "SironField", zSET_ALL ); SetAttributeFromAttribute( vKZSIXSKO_Root, "ATTRIB", "XVAATT_TOK", vTZZOXOD1, "ATTRIB", "XVAATT_TOK" ); // Create all dependent ATTRIBCOM entities for ( nRC = SetCursorFirstEntity( vTZTENVR1,"SironFieldComment","SironField"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1,"SironFieldComment","SironField") ) { CreateEntity ( vKZSIXSKO_Root, "ATTRIBCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIBCOM", vTZTENVR1, "SironFieldComment", zSET_ALL ); } } DropView( vTZZOXOD_TestWorkAttrib ); } } } nRC = CheckExistenceOfEntity( vTZZOXOD1, "CHILDENTITY" ); if ( nRC >= zCURSOR_SET ) zofnTZSIXSKO_BldXSKChildEnt( vKZSIXSKO_Root, vKZSIXSKO, vTZZOXOD1, vTZTENVRO_REF, nEntitySet ); nRC = DropView( vTZZOXOD1 ); nRC = DropView( vTZTENVR1 ); 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 ); }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
zOPER_EXPORT zSHORT OPERATION VML_DisplayList( zVIEW vSubtask ) { zVIEW vProfileXFER; zCHAR szShowStr[ 10 ]; zSHORT nRC; GetProfileView( &vProfileXFER ); *szShowStr = 0; // Build a string that contains each of the VML types that the user // wants shown. if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowDeclarations", "Y" ) == 0 ) { zstrcat( szShowStr, "D" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowControlStatements", "Y" ) == 0 ) { zstrcat( szShowStr, "C" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowViewStatements", "Y" ) == 0 ) { zstrcat( szShowStr, "V" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowEntityStatements", "Y" ) == 0 ) { zstrcat( szShowStr, "E" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowOperators", "Y" ) == 0 ) { zstrcat( szShowStr, "O" ); } if ( CompareAttributeToString( vProfileXFER, "ED", "VML_ShowOther", "Y" ) == 0 ) { zstrcat( szShowStr, "?" ); } // szShowStr lists all the types that the user wants shown. eg "CV?" means // that the user wants all control, view, and 'other' vml statements // shown. for ( nRC = SetCursorFirstEntity( vProfileXFER, "VML_Text", 0 ); nRC == zCURSOR_SET; nRC = SetCursorNextEntity( vProfileXFER, "VML_Text", 0 ) ) { zCHAR szType[ 5 ]; GetStringFromAttribute( szType, vProfileXFER, "VML_Text", "Type" ); if ( zstrchr( szShowStr, *szType ) ) SetSelectStateOfEntity( vProfileXFER, "VML_Text", TRUE ); else SetSelectStateOfEntity( vProfileXFER, "VML_Text", FALSE ); } SetCursorFirstSelectedEntity( vProfileXFER, "VML_Text", 0 ); LB_SetDisplaySelectSet( vSubtask, "TextList", DISP_SELECT_SET ); LB_SetSelectSelectSet( vSubtask, "TextList", SEL_SELECT_SET ); return( 0 ); } // VML_DisplayList