zOPER_EXPORT zSHORT OPERATION zwTZCMRPTD_LoadAudittrail( zVIEW vSubtask ) { zVIEW vTZCMRPTO; zVIEW vTZBRAUDO; zVIEW vKZDBHQUA; zULONG ulZKey; zCHAR szZKey[18]; zSHORT nRC; if ( GetViewByName( &vTZCMRPTO, "TZCMRPTO", vSubtask, zLEVEL_TASK ) > 0 ) { if ( CheckExistenceOfEntity( vTZCMRPTO, "Z_MetaDef" ) == 0 ) { if ( ActivateEmptyObjectInstance ( &vKZDBHQUA, "KZDBHQUA", vSubtask, zSINGLE ) >= 0 ) { SetNameForView( vKZDBHQUA, "KZDBHQUA", vSubtask, zLEVEL_TASK ); CreateEntity( vKZDBHQUA, "EntitySpec", zPOS_AFTER ); CreateEntity( vKZDBHQUA, "QualAttrib", zPOS_AFTER ); } else return( -1 ); GetIntegerFromAttribute(( zPLONG )&ulZKey, vTZCMRPTO, "Z_MetaDef", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "EntitySpec", "EntityName", "Z_MetaDef" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "EntityName", "Z_MetaDef" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "AttributeName", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Oper", "=" ); zltoa( ulZKey, szZKey ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Value", szZKey ); nRC = ActivateObjectInstance( &vTZBRAUDO, "TZBRAUDO", vSubtask, vKZDBHQUA, zSINGLE | zLEVEL_APPLICATION ); DropObjectInstance( vKZDBHQUA ); if ( CheckExistenceOfEntity( vTZBRAUDO, "AuditTrail" ) == 0 ) SetNameForView( vTZBRAUDO, "TZBRAUDO", vSubtask, zLEVEL_TASK ); else { MessageSend( vSubtask, "CM00299", "Audit Trail:", "There are no AuditTrail-Information for the component in this CPLR.", zMSGQ_OBJECT_CONSTRAINT_INFORMATION, zBEEP ); SetWindowActionBehavior( vSubtask, zWAB_StayOnWindow, 0, 0 ); return( -1 ); } } } else return( -1 ); return( 0 ); }
//: STRING ( 32 ) szEntityName static zSHORT oTZRPSRCO_XML_PageHeaderFooter( zVIEW vReportDef, zVIEW vSourceOI, zPCHAR szOutputLine, zLONG lFileHandle, zPCHAR szIndentationValue ) { zCHAR szEntityName[ 33 ] = { 0 }; //:STRING ( 50 ) szIndentationSubValue zCHAR szIndentationSubValue[ 51 ] = { 0 }; zSHORT lTempInteger_0; //:IF vReportDef.Control EXISTS lTempInteger_0 = CheckExistenceOfEntity( vReportDef, "Control" ); if ( lTempInteger_0 == 0 ) { //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szEntityName, szOutputLine, lFileHandle, szIndentationSubValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szEntityName, szOutputLine, lFileHandle, szIndentationSubValue ); } //:END return( 0 ); // END }
//: VIEW TZZOLODO REGISTERED AS TZZOLODO zOPER_EXPORT zSHORT OPERATION CopyEntityGroupMappingStart( zVIEW vSubtask ) { zVIEW TZZOLODO = 0; zSHORT RESULT; //:STRING ( 100 ) MappingName zCHAR MappingName[ 101 ] = { 0 }; zSHORT lTempInteger_0; zCHAR szTempString_0[ 33 ]; RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK ); //:// Copy the mapping name of the attribute to the clip board. //:IF TZZOLODO.LOD_Entity EXISTS lTempInteger_0 = CheckExistenceOfEntity( TZZOLODO, "LOD_Entity" ); if ( lTempInteger_0 == 0 ) { //:MappingName = "[Z:#S:" + //: TZZOLODO.LOD_Entity.Name + "]" GetVariableFromAttribute( szTempString_0, 0, 'S', 33, TZZOLODO, "LOD_Entity", "Name", "", 0 ); ZeidonStringCopy( MappingName, 1, 0, "[Z:#S:", 1, 0, 101 ); ZeidonStringConcat( MappingName, 1, 0, szTempString_0, 1, 0, 101 ); ZeidonStringConcat( MappingName, 1, 0, "]", 1, 0, 101 ); //:SetClipboardBlob( MappingName, 0, 0 ) SetClipboardBlob( MappingName, 0, 0 ); } //:END return( 0 ); // END }
//: VIEW TZZOLODO REGISTERED AS TZZOLODO zOPER_EXPORT zSHORT OPERATION CopyEntityGroupEnd( zVIEW vSubtask ) { zVIEW TZZOLODO = 0; zSHORT RESULT; //:STRING ( 100 ) MappingName zCHAR MappingName[ 101 ] = { 0 }; zSHORT lTempInteger_0; RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK ); //:// Copy the mapping name of the attribute to the clip board. //:IF TZZOLODO.LOD_Entity EXISTS lTempInteger_0 = CheckExistenceOfEntity( TZZOLODO, "LOD_Entity" ); if ( lTempInteger_0 == 0 ) { //:MappingName = "[Z:#E]" ZeidonStringCopy( MappingName, 1, 0, "[Z:#E]", 1, 0, 101 ); //:SetClipboardBlob( MappingName, 0, 0 ) SetClipboardBlob( MappingName, 0, 0 ); } //:END return( 0 ); // END }
// Get the time from the time control and map it to the data OI. zSHORT ZTime::MapToOI( zLONG lFlag ) { zVIEW vApp; #ifdef DEBUG_ALL TraceLineS( "ZTime::MapToOI: ", *m_pzsTag ); if ( m_pzsAName ) TraceLineS( "In MapToOI for ANAME ==> ", *m_pzsAName ); #endif // If the control is not Visible and Enabled, or if the view is not found, // do not do mapping. if ( m_pzsVName && (vApp = IsVisibleForMapToOI( *m_pzsVName )) != 0 ) { if ( CheckExistenceOfEntity( vApp, *m_pzsEName ) != 0 ) return( 0 ); COleDateTime time; if ( m_DateTime.GetTime( time ) ) { SetZeidonDateAttributeFromOleDateTime( time, vApp, *m_pzsEName, *m_pzsAName ); } } return( 0 ); }
zOPER_EXPORT zLONG OPERATION LoadSourceForMetaList( zVIEW vSubtask, zPVIEW pvSource, zVIEW vMetaListView, zLONG lMetaType ) { zVIEW vMeta; zVIEW vTempList; zLONG lRC; lRC = CheckExistenceOfEntity( vMetaListView, "W_MetaDef" ); if ( lRC == zCURSOR_UNCHANGED ) { return( 1 ); } // activate it from configuration management. // Use vTempList instead of vMetaListView for the Activate because ActivateMetaOI // modifies the position on the CM list for global operations. CreateViewFromViewForTask( &vTempList, vMetaListView, 0 ); lRC = ActivateMetaOI( vSubtask, &vMeta, vTempList, (zSHORT) lMetaType, zSINGLE ); DropView( vTempList ); // lRC = LoadSourceForMeta( pvSource, vMeta ); // DropMetaOI( vSubtask, vMeta ); *pvSource = vMeta; if ( lRC != 0 ) return( 1 ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // ENTRY: // // PURPOSE: Set the VKey Ctrl/Alt/Shift check boxes // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION PostBSetVKey( zVIEW vSubtask ) { zULONG ulLth = sizeof( zACCEL_DEF ); zVIEW vHotkey; zACCEL_DEF ac; GetViewByName( &vHotkey, "KZHKEYSO", vSubtask, zLEVEL_ANY ); if ( vHotkey && CheckExistenceOfEntity( vHotkey, "Hotkey" ) > zCURSOR_UNCHANGED ) { GetBlobFromAttribute( &ac, &ulLth, vHotkey, "Hotkey", "KeyCombo" ); SetCtrlState( vSubtask, "Ctrl", zCONTROL_STATUS_CHECKED, ac.fCtrl ); SetCtrlState( vSubtask, "Alt", zCONTROL_STATUS_CHECKED, ac.fAlt ); SetCtrlState( vSubtask, "Shift", zCONTROL_STATUS_CHECKED, ac.fShift ); // if ( CheckExistenceOfEntity( vHotkey, "Operation" ) > zCURSOR_UNCHANGED ) // { // zPCHAR pch; // // GetAddrForAttribute( &pch, vHotkey, "Operation", "DLL_Name" ); // SetCtrlText( vSubtask, "DLL_Name", pch ); // } } return( 0 ); }
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: 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
static zSHORT zwfnTZCMRPTD_LoadNewAudittrail( zVIEW vSubtask, zPVIEW vTZBRAU2O ) { zVIEW vTZCMCPL; zVIEW vKZDBHQUA; zULONG ulZKey; zCHAR szZKey[18]; zSHORT nRC; if ( GetViewByName( &vTZCMCPL, "TZCMCPL", vSubtask, zLEVEL_TASK ) < 0 ) return( -1 ); if ( CheckExistenceOfEntity( vTZCMCPL, "CPLR" ) == zCURSOR_SET ) { if ( ActivateEmptyObjectInstance( &vKZDBHQUA, "KZDBHQUA", vSubtask, zSINGLE ) >= 0 ) { SetNameForView( vKZDBHQUA, "KZDBHQUA", vSubtask, zLEVEL_TASK ); CreateEntity( vKZDBHQUA, "EntitySpec", zPOS_AFTER ); CreateEntity( vKZDBHQUA, "QualAttrib", zPOS_AFTER ); } else return( -1 ); GetIntegerFromAttribute( (zPLONG)&ulZKey, vTZCMCPL, "CPLR", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "EntitySpec", "EntityName", "CPLR" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "EntityName", "CPLR" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "AttributeName", "ZKey" ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Oper", "=" ); zltoa( ulZKey, szZKey ); SetAttributeFromString( vKZDBHQUA, "QualAttrib", "Value", szZKey ); nRC = ActivateObjectInstance( vTZBRAU2O, "TZBRAU2O", vSubtask, vKZDBHQUA, zSINGLE | zLEVEL_APPLICATION ); DropObjectInstance( vKZDBHQUA ); SetNameForView( *vTZBRAU2O, "TZBRAU2O", vSubtask, zLEVEL_TASK ); } else { MessageSend( vSubtask, "CM00299", "Audit Trail:", "There are no Audit Trail Information for a non-repository LPLR.", zMSGQ_OBJECT_CONSTRAINT_WARNING, zBEEP ); SetWindowActionBehavior( vSubtask, zWAB_StayOnWindow, 0, 0 ); return( -1 ); } return( 0 ); } // zwfnTZCMRPTD_LoadNewAudittrail
// Get all local Catalogs static zSHORT GetLocalCatalogs( zVIEW vSubtask, zVIEW vAktView ) { zSHORT nRet; // If the list of catalogfiles still exists, return nRet = CheckExistenceOfEntity( vAktView, "CatFiles"); if (nRet == zCURSOR_SET || nRet == zCALL_ERROR) return( nRet ); nRet = GetAnzahlCatalogFiles ( vSubtask, vAktView ); if (nRet != 0 ) return( nRet ); return( GetCatalogs (vSubtask, vAktView)); }
zOPER_EXPORT zSHORT OPERATION UpgradeDialog1( zVIEW vSubtask, zVIEW OrigW ) { #if 0 zVIEW OrigWC; zVIEW vPE; zVIEW vType; zVIEW LOD_List; zSHORT nZRetCode; zLONG lTempInteger_0; zSHORT RESULT; nZRetCode = RetrieveViewForMetaList( vSubtask, &LOD_List, 2013 ); nZRetCode = ActivateMetaOI( vSubtask, &vPE, LOD_List, 2013, zSINGLE ); nZRetCode = ActivateOI_FromFile( &vType, "TZPACTLO", vSubtask, "c:\\10c\\W\\BIN\\SYS\\TZPACTLI.POR", zSINGLE ); lTempInteger_0 = CheckExistenceOfEntity( OrigW, "SourceFile" ); if ( lTempInteger_0 < 0 ) { nZRetCode = CreateMetaEntity( vSubtask, OrigW, "SourceFile", zPOS_AFTER ); SetAttributeFromAttribute( OrigW, "SourceFile", "Name", OrigW, "Dialog", "Tag" ); } SetNameForView( vType, "vType", vSubtask, zLEVEL_TASK ); SetNameForView( vPE, "vPE", vSubtask, zLEVEL_TASK ); RESULT = SetCursorFirstEntity( OrigW, "Window", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { nZRetCode = CreateViewFromViewForTask( &OrigWC, OrigW, 0 ); nZRetCode = SetNameForView( OrigWC, "OrigWC", vSubtask, zLEVEL_TASK ); RESULT = SetCursorFirstEntity( OrigW, "Action", "" ); // while ( RESULT > zLEVEL_TASK ) while ( RESULT >= 0 ) { nZRetCode = UpgradeAction( vSubtask, OrigW ); RESULT = SetCursorNextEntity( OrigW, "Action", "" ); } RESULT = SetCursorFirstEntity( OrigWC, "Control", "" ); while ( RESULT >= 0 ) { nZRetCode = UpgradeControl( vSubtask, OrigW, OrigWC, vType, vPE ); RESULT = SetCursorNextEntity( OrigWC, "Control", "" ); } nZRetCode = DropView( OrigWC ); RESULT = SetCursorNextEntity( OrigW, "Window", "" ); } #endif return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZEREMDO_FactTypeType // // PURPOSE: Derived function to set the type of FactType entry, whether // Attribute ("ATR") or Relationship ("REL"). // // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZEREMDO_FactTypeType( zVIEW vTZEREMDO, LPVIEWENTITY lpViewEntity, LPVIEWATTRIB lpViewAttrib, zSHORT nMsg ) { if ( CheckExistenceOfEntity( vTZEREMDO, "ER_AttributeIdentifier" ) >= zCURSOR_SET ) { StoreValueInRecord( vTZEREMDO, lpViewEntity, lpViewAttrib, "ATR", 0 ); } else { StoreValueInRecord( vTZEREMDO, lpViewEntity, lpViewAttrib, "REL", 0 ); } return( 0 ); }
zOPER_EXPORT zLONG OPERATION LoadSourceForMeta( zVIEW vSubtask, zPVIEW pvSource, zVIEW vMetaView ) { zLONG lRC; lRC = CheckExistenceOfEntity( vMetaView, "SourceFile" ); if ( lRC != 0 ) { return( 1 ); } // Just create a new source view from the meta view, since the meta // now contains the source information. CreateViewFromViewForTask( pvSource, vMetaView, 0 ); return( 0 ); }
// Get the text for the entry control and map it to the data OI. zSHORT ZMLE::MapToOI( zLONG lFlag ) { zVIEW vApp; #ifdef DEBUG_ALL TraceLineS( "ZMLE::MapToOI: ", *m_pzsTag ); if ( m_pzsAName ) TraceLineS( "In MapToOI for ANAME ==> ", *m_pzsAName ); #endif // If the control is not Visible and Enabled, or if the view is not found, // do not do mapping. if ( m_pzsVName && (vApp = IsVisibleForMapToOI( *m_pzsVName )) != 0 ) { if ( CheckExistenceOfEntity( vApp, *m_pzsEName ) != 0 ) return( 0 ); #ifdef zREMOTE_SERVER zCHAR szMap[ 65534 ]; GetZCtrlText( this, szMap, sizeof( szMap ) ); #else CString szMap; // named szMap rather than csMap for SetAttribute below GetWindowText( szMap ); #endif zSHORT nRC = SetAttributeFromVariable( vApp, *m_pzsEName, *m_pzsAName, szMap, zTYPE_STRING, 0, *m_pzsContext, m_pzsContext->IsEmpty( ) ? (zSHORT) (lFlag | zUSE_DEFAULT_CONTEXT) : (zSHORT) lFlag ); return( nRC ); } return( 0 ); }
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 ); }
//: VIEW TZZOLODO REGISTERED AS TZZOLODO zOPER_EXPORT zSHORT OPERATION BeforeEntityChange( zVIEW vSubtask ) { zVIEW TZZOLODO = 0; zSHORT RESULT; zSHORT lTempInteger_0; RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK ); //:// Map the control, neccesary as be have "Bypass Input Data Mapping" //:// TZZOLODO pointing to the "old" Entity //:IF TZZOLODO.POD_Entity EXISTS lTempInteger_0 = CheckExistenceOfEntity( TZZOLODO, "POD_Entity" ); if ( lTempInteger_0 == 0 ) { //:MapCtrl( vSubtask, "JoinCheck" ) MapCtrl( vSubtask, "JoinCheck" ); } //:END return( 0 ); // END }
// Get the text for the entry control and map it to the data OI. zSHORT ZCheckBox::MapToOI( zLONG lFlag ) { // if ( zstrcmp( *m_pzsTag, "CheckAutoCreateActOnCatChg" ) == 0 ) // TraceLineS( "ZCheckBox::MapToOI ", *m_pzsTag ); zVIEW vApp; // If the control is not Visible and Enabled, or if the view is not found, // do not do mapping. if ( m_pzsVName && (vApp = IsVisibleForMapToOI( *m_pzsVName )) != 0 && CheckExistenceOfEntity( vApp, *m_pzsEName ) == 0 ) { zBOOL bCheck = (GetCheck( ) == 1); return( SetAttributeFromVariable( vApp, *m_pzsEName, *m_pzsAName, bCheck ? *m_pzsValueOn : *m_pzsValueOff, zTYPE_STRING, 0, *m_pzsContext, (zSHORT) lFlag ) ); } return( 0 ); }
//: STRING ( 32 ) szEntityName zOPER_EXPORT zSHORT OPERATION oTZRPSRCO_GenerateXML_LODRecurs( zVIEW vReportDef, zVIEW vReportDefRecurs, zVIEW vSourceOI, zPCHAR szOutputLine, zLONG lFileHandle, zPCHAR szIndentationValue ) { zCHAR szEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szDrivingViewName zCHAR szDrivingViewName[ 33 ] = { 0 }; //:STRING ( 50 ) szIndentationSubValue zCHAR szIndentationSubValue[ 51 ] = { 0 }; //:STRING ( 10 ) szCnt zCHAR szCnt[ 11 ] = { 0 }; //:SHORT nRC zSHORT nRC = 0; zSHORT RESULT; zSHORT lTempInteger_0; zSHORT lTempInteger_1; //:szDrivingViewName = vReportDef.DrivingViewObjRef.Name GetVariableFromAttribute( szDrivingViewName, 0, 'S', 33, vReportDef, "DrivingViewObjRef", "Name", "", 0 ); //:// Build one level of the PartialReportEntity subobject, matching the structure of the Driving LOD and //:// setting the ReportDisplayFlag entity for any entity with a corresponding GroupSet entity in the report, or having //:// a PartialReportEntityChild entity with a corresponding GroupSet entity. The flag is set to "D" if the entity has //:// a corresponding GroupSet entity and to a "C" if it has a child with a corresponding GroupSet entity. //:FOR EACH vReportDefRecurs.PartialReportEntity RESULT = SetCursorFirstEntity( vReportDefRecurs, "PartialReportEntity", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:szEntityName = vReportDefRecurs.PartialReportEntity.Name GetVariableFromAttribute( szEntityName, 0, 'S', 33, vReportDefRecurs, "PartialReportEntity", "Name", "", 0 ); //: //:// If ReportDisplayFlag = "D" then this is an entity that is displayed on the report (there is a GroupSet). //:// Otherwise, it's a parent entity where one of it's children is displayed on the report. //:IF vReportDefRecurs.PartialReportEntity.ReportDisplayFlag = "D" if ( CompareAttributeToString( vReportDefRecurs, "PartialReportEntity", "ReportDisplayFlag", "D" ) == 0 ) { //:SET CURSOR FIRST vReportDef.GroupSet WHERE vReportDef.GroupSet.Tag = szEntityName RESULT = SetCursorFirstEntityByString( vReportDef, "GroupSet", "Tag", szEntityName, "" ); //:IF RESULT < zCURSOR_SET if ( RESULT < zCURSOR_SET ) { } //: // There is an error because the report should have a GroupSet for this. //:END //:nRC = SetCursorFirstEntity( vSourceOI, szEntityName, "" ) nRC = SetCursorFirstEntity( vSourceOI, szEntityName, "" ); //:// Process group header //:SET CURSOR FIRST vReportDef.Group WHERE vReportDef.Group.Type = "gh" RESULT = SetCursorFirstEntityByString( vReportDef, "Group", "Type", "gh", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //:szOutputLine = szIndentationValue + " <" + szEntityName + "Header>" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " <", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "Header>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingViewName, szOutputLine, lFileHandle, szIndentationSubValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingViewName, szOutputLine, lFileHandle, szIndentationSubValue ); //:szOutputLine = szIndentationValue + " </" + szEntityName + "Header>" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " </", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "Header>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END //:// Go to generate an attribute entry for each attribute with mapping in the Detail Group of the GroupSet. //:SET CURSOR FIRST vReportDef.Group WHERE vReportDef.Group.Type = "ga" RESULT = SetCursorFirstEntityByString( vReportDef, "Group", "Type", "ga", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //: //:// Loop through vSourceOI for each entity //:LOOP WHILE nRC >= zCURSOR_SET while ( nRC >= zCURSOR_SET ) { //:szOutputLine = szIndentationValue + " <" + szEntityName + ">" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " <", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingViewName, szOutputLine, lFileHandle, szIndentationSubValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingViewName, szOutputLine, lFileHandle, szIndentationSubValue ); //:// Check to see if there are child entities. //:IF vReportDefRecurs.PartialReportEntityChild EXISTS lTempInteger_0 = CheckExistenceOfEntity( vReportDefRecurs, "PartialReportEntityChild" ); if ( lTempInteger_0 == 0 ) { //:SetViewToSubobject( vReportDefRecurs, "PartialReportEntityChild" ) SetViewToSubobject( vReportDefRecurs, "PartialReportEntityChild" ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:nRC = GenerateXML_LODRecurs( vReportDef, //: vReportDefRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationSubValue ) nRC = oTZRPSRCO_GenerateXML_LODRecurs( vReportDef, vReportDefRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationSubValue ); //:ResetViewFromSubobject( vReportDefRecurs ) ResetViewFromSubobject( vReportDefRecurs ); //:// We need to reset on the report GroupSet/Group because it has been changed when we go down levels. //:SET CURSOR FIRST vReportDef.GroupSet WHERE vReportDef.GroupSet.Tag = szEntityName RESULT = SetCursorFirstEntityByString( vReportDef, "GroupSet", "Tag", szEntityName, "" ); //:SET CURSOR FIRST vReportDef.Group WHERE vReportDef.Group.Type = "ga" RESULT = SetCursorFirstEntityByString( vReportDef, "Group", "Type", "ga", "" ); } //:END //:// End of checking for child entities... //:szOutputLine = szIndentationValue + " </" + szEntityName + ">" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " </", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:nRC = SetCursorNextEntity( vSourceOI, szEntityName, "" ) nRC = SetCursorNextEntity( vSourceOI, szEntityName, "" ); } //:END } //:END //:// Process group footer. //:SET CURSOR FIRST vReportDef.Group WHERE vReportDef.Group.Type = "gf" RESULT = SetCursorFirstEntityByString( vReportDef, "Group", "Type", "gf", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //:szOutputLine = szIndentationValue + " <" + szEntityName + "Footer>" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " <", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "Footer>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szEntityName, szOutputLine, lFileHandle, szIndentationSubValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szEntityName, szOutputLine, lFileHandle, szIndentationSubValue ); //:szOutputLine = szIndentationValue + " </" + szEntityName + "Footer>" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " </", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "Footer>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END //:ELSE } else { //:// Maybe the parent isn't being displayed but a child might be, so we need to check... //: //:// Loop through vSourceOI for each entity //:nRC = SetCursorFirstEntity( vSourceOI, szEntityName, "" ) nRC = SetCursorFirstEntity( vSourceOI, szEntityName, "" ); //:LOOP WHILE nRC >= zCURSOR_SET while ( nRC >= zCURSOR_SET ) { //:IF vReportDefRecurs.PartialReportEntityChild EXISTS lTempInteger_1 = CheckExistenceOfEntity( vReportDefRecurs, "PartialReportEntityChild" ); if ( lTempInteger_1 == 0 ) { //:SetViewToSubobject( vReportDefRecurs, "PartialReportEntityChild" ) SetViewToSubobject( vReportDefRecurs, "PartialReportEntityChild" ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:nRC = GenerateXML_LODRecurs( vReportDef, //: vReportDefRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationSubValue ) nRC = oTZRPSRCO_GenerateXML_LODRecurs( vReportDef, vReportDefRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationSubValue ); //:ResetViewFromSubobject( vReportDefRecurs ) ResetViewFromSubobject( vReportDefRecurs ); } //: //:END //:nRC = SetCursorNextEntity( vSourceOI, szEntityName, "" ) nRC = SetCursorNextEntity( vSourceOI, szEntityName, "" ); } //:END } RESULT = SetCursorNextEntity( vReportDefRecurs, "PartialReportEntity", "" ); //:END } //: //:END // FOR EACH vReportDefRecurs.PartialReportEntity 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 vMappingOI static zSHORT oTZRPSRCO_GenerateXML_CtlRecurs( zVIEW vReportDef, zVIEW vSourceOI, zPCHAR szDrivingObjectViewName, zPCHAR szOutputLine, zLONG lFileHandle, zPCHAR szIndentationValue ) { zVIEW vMappingOI = 0; //:STRING ( 32 ) szEntityName zCHAR szEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szAttributeName zCHAR szAttributeName[ 33 ] = { 0 }; //:STRING ( 32 ) szMappingName zCHAR szMappingName[ 33 ] = { 0 }; //:STRING ( 32 ) szContextName zCHAR szContextName[ 33 ] = { 0 }; //:STRING ( 5000 ) szReturnedAttributeValue zCHAR szReturnedAttributeValue[ 5001 ] = { 0 }; //:STRING ( 5000 ) szConvertedAttributeValue zCHAR szConvertedAttributeValue[ 5001 ] = { 0 }; //:STRING ( 200 ) szMsg zCHAR szMsg[ 201 ] = { 0 }; zSHORT RESULT; zSHORT lTempInteger_0; zSHORT lTempInteger_1; zSHORT lTempInteger_2; //:// Generate an attribute entry for each attribute with mapping in the GroupSet. Note that these are all at the same //:// hierarchical level since we're assuming no tables within a GroupSet. However, the controls in the GroupSet may well be //:// organized hierarchically and must thus be processed recursively. //:// Sort the Controls in position order so they will be in the same order as in the XSLT. (This probably isn't //:// necessary, but it will simply debugging.) //:OrderEntityForView( vReportDef, "Control", "PSDLG_Y A PSDLG_X A" ) OrderEntityForView( vReportDef, "Control", "PSDLG_Y A PSDLG_X A" ); //:// Process each Control. The processing rule is simple: //:// If the control has mapping, build an XML node. //:// If the control doesn't have mapping, ignore it. //:// The only issue is that we must step down a level if the Control has a subcontrol. //:FOR EACH vReportDef.Control RESULT = SetCursorFirstEntity( vReportDef, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:IF vReportDef.CtrlCtrl EXISTS lTempInteger_0 = CheckExistenceOfEntity( vReportDef, "CtrlCtrl" ); if ( lTempInteger_0 == 0 ) { //:SetViewToSubobject( vReportDef, "CtrlCtrl" ) SetViewToSubobject( vReportDef, "CtrlCtrl" ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingObjectViewName, szOutputLine, lFileHandle, szIndentationValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingObjectViewName, szOutputLine, lFileHandle, szIndentationValue ); //:ResetViewFromSubobject( vReportDef ) ResetViewFromSubobject( vReportDef ); //:ELSE } else { //:IF vReportDef.CtrlMapER_Attribute EXISTS lTempInteger_1 = CheckExistenceOfEntity( vReportDef, "CtrlMapER_Attribute" ); if ( lTempInteger_1 == 0 ) { //:// Format XML Line for Attribute. //:szReturnedAttributeValue = "" ZeidonStringCopy( szReturnedAttributeValue, 1, 0, "", 1, 0, 5001 ); //:szConvertedAttributeValue = "" ZeidonStringCopy( szConvertedAttributeValue, 1, 0, "", 1, 0, 5001 ); //:szAttributeName = vReportDef.CtrlMapER_Attribute.Name GetVariableFromAttribute( szAttributeName, 0, 'S', 33, vReportDef, "CtrlMapER_Attribute", "Name", "", 0 ); //:szEntityName = vReportDef.CtrlMapRelatedEntity.Name GetVariableFromAttribute( szEntityName, 0, 'S', 33, vReportDef, "CtrlMapRelatedEntity", "Name", "", 0 ); //:szContextName = "" ZeidonStringCopy( szContextName, 1, 0, "", 1, 0, 33 ); //:IF vReportDef.CtrlMapContext EXISTS lTempInteger_2 = CheckExistenceOfEntity( vReportDef, "CtrlMapContext" ); if ( lTempInteger_2 == 0 ) { //:szContextName = vReportDef.CtrlMapContext.Name GetVariableFromAttribute( szContextName, 0, 'S', 33, vReportDef, "CtrlMapContext", "Name", "", 0 ); } //:END //:IF vReportDef.CtrlMapView.Name = szDrivingObjectViewName // Check if mapping if from Driving Object View. if ( CompareAttributeToString( vReportDef, "CtrlMapView", "Name", szDrivingObjectViewName ) == 0 ) { //:GetStringFromAttributeByContext( szReturnedAttributeValue, vSourceOI, szEntityName, szAttributeName, szContextName, 5000 ) GetStringFromAttributeByContext( szReturnedAttributeValue, vSourceOI, szEntityName, szAttributeName, szContextName, 5000 ); //:ELSE } else { //:// Mapping is from separate view. //:szMappingName = vReportDef.CtrlMapView.Name GetVariableFromAttribute( szMappingName, 0, 'S', 33, vReportDef, "CtrlMapView", "Name", "", 0 ); //:GET VIEW vMappingOI NAMED szMappingName RESULT = GetViewByName( &vMappingOI, szMappingName, vReportDef, zLEVEL_TASK ); //:GetStringFromAttributeByContext( szReturnedAttributeValue, vMappingOI, szEntityName, szAttributeName, szContextName, 5000 ) GetStringFromAttributeByContext( szReturnedAttributeValue, vMappingOI, szEntityName, szAttributeName, szContextName, 5000 ); } //:END //:ConvertXML_SpecialCharacters( vReportDef, szConvertedAttributeValue, szReturnedAttributeValue, 5000 ) ConvertXML_SpecialCharacters( vReportDef, szConvertedAttributeValue, szReturnedAttributeValue, 5000 ); //:szOutputLine = szIndentationValue + " " + "<" + szEntityName + "." + szAttributeName + ">" + szConvertedAttributeValue ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " ", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "<", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ".", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szAttributeName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szConvertedAttributeValue, 1, 0, 5001 ); //:szOutputLine = szOutputLine + "</" + szEntityName + "." + szAttributeName + ">" ZeidonStringConcat( szOutputLine, 1, 0, "</", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ".", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szAttributeName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END } RESULT = SetCursorNextEntity( vReportDef, "Control", "" ); //:END } //:END return( 0 ); // END }
//: VIEW vReportDef BASED ON LOD TZRPSRCO zOPER_EXPORT zSHORT OPERATION oTZRPSRCO_GenerateXSLT_XML( zVIEW vSourceOI, zPCHAR szReportName, zPCHAR szXMLFileName, zPCHAR szTopEntityName ) { zVIEW vReportDef = 0; //:VIEW vReportLODRecurs BASED ON LOD TZRPSRCO zVIEW vReportLODRecurs = 0; //:VIEW vReportDefRoot BASED ON LOD TZRPSRCO zVIEW vReportDefRoot = 0; //:VIEW vSourceOIHier zVIEW vSourceOIHier = 0; //:VIEW vSourceOIDebug zVIEW vSourceOIDebug = 0; //:VIEW vLOD BASED ON LOD TZZOLODO zVIEW vLOD = 0; //:VIEW vTaskLPLR BASED ON LOD TZCMLPLO zVIEW vTaskLPLR = 0; //:STRING ( 200 ) szMsg zCHAR szMsg[ 201 ] = { 0 }; //:STRING ( 200 ) szFileName zCHAR szFileName[ 201 ] = { 0 }; //:STRING ( 32 ) szReturnedEntityName zCHAR szReturnedEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szLastReturnedEntityName zCHAR szLastReturnedEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szParentEntityName zCHAR szParentEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szDrivingViewName zCHAR szDrivingViewName[ 33 ] = { 0 }; //:STRING ( 50 ) szIndentationValue zCHAR szIndentationValue[ 51 ] = { 0 }; //:STRING ( 50 ) szIndentationSubValue zCHAR szIndentationSubValue[ 51 ] = { 0 }; //:STRING ( 1 ) szInNodeFlag zCHAR szInNodeFlag[ 2 ] = { 0 }; //:STRING ( 5000 ) szOutputLine zCHAR szOutputLine[ 5001 ] = { 0 }; //:INTEGER lFileHandle zLONG lFileHandle = 0; //:INTEGER Indentation zLONG Indentation = 0; //:SHORT ReturnedHierLevel zSHORT ReturnedHierLevel = 0; //:SHORT LastHierLevel zSHORT LastHierLevel = 0; //:SHORT nRC zSHORT nRC = 0; zSHORT lTempInteger_0; zSHORT RESULT; //:// Build an XSLT XML FO object for the passed in application object and Report Definition. //:// First we need to activate the report def... //:SysReadZeidonIni( -1, "[WorkStation]", "ResourcePath", szFileName ) SysReadZeidonIni( -1, "[WorkStation]", "ResourcePath", szFileName ); //://szFileName = "c:\lplr\zencas\bin\" //:szFileName = szFileName + szReportName + ".xrp" ZeidonStringConcat( szFileName, 1, 0, szReportName, 1, 0, 201 ); ZeidonStringConcat( szFileName, 1, 0, ".xrp", 1, 0, 201 ); //:SfActivateSysOI_FromFile( vReportDef, "TZRPSRCO", vSourceOI, szFileName, zSINGLE ) SfActivateSysOI_FromFile( &vReportDef, "TZRPSRCO", vSourceOI, szFileName, zSINGLE ); //:// Get the Name of the Driving object, as we will need that in processing mapping. //:IF vReportDef.DrivingViewObjRef EXISTS lTempInteger_0 = CheckExistenceOfEntity( vReportDef, "DrivingViewObjRef" ); if ( lTempInteger_0 == 0 ) { //:szDrivingViewName = vReportDef.DrivingViewObjRef.Name GetVariableFromAttribute( szDrivingViewName, 0, 'S', 33, vReportDef, "DrivingViewObjRef", "Name", "", 0 ); //:ELSE } else { //:szMsg = "The report must have a 'Driving View' set in the report details." ZeidonStringCopy( szMsg, 1, 0, "The report must have a 'Driving View' set in the report details.", 1, 0, 201 ); //:MessageSend( vReportDef, "", "Generate XSLT", //: szMsg, zMSGQ_OBJECT_CONSTRAINT_WARNING, 0 ) MessageSend( vReportDef, "", "Generate XSLT", szMsg, zMSGQ_OBJECT_CONSTRAINT_WARNING, 0 ); //:RETURN -1 return( -1 ); } //:END //:// Open XML output file. //:SysReadZeidonIni( -1, "[Workstation]", "XSLTDirectory", szFileName ) SysReadZeidonIni( -1, "[Workstation]", "XSLTDirectory", szFileName ); //:szFileName = szFileName + szXMLFileName + ".xml" ZeidonStringConcat( szFileName, 1, 0, szXMLFileName, 1, 0, 201 ); ZeidonStringConcat( szFileName, 1, 0, ".xml", 1, 0, 201 ); //:lFileHandle = SysOpenFile( vReportDef, szFileName, COREFILE_WRITE ) lFileHandle = SysOpenFile( vReportDef, szFileName, COREFILE_WRITE ); //:IF lFileHandle < 0 if ( lFileHandle < 0 ) { //:szMsg = "Cannot open XSLT Output File, " + szFileName ZeidonStringCopy( szMsg, 1, 0, "Cannot open XSLT Output File, ", 1, 0, 201 ); ZeidonStringConcat( szMsg, 1, 0, szFileName, 1, 0, 201 ); //:MessageSend( vReportDef, "", "Generate XSLT", //: szMsg, zMSGQ_OBJECT_CONSTRAINT_WARNING, 0 ) MessageSend( vReportDef, "", "Generate XSLT", szMsg, zMSGQ_OBJECT_CONSTRAINT_WARNING, 0 ); //:RETURN -1 return( -1 ); } //:END //:// Navigate the vSourceOI object/subobject hierarchically and create an XML node for each entity that has a corresponding //:// GroupSet entity in the Report Def. //:// Generate basic header. //:szOutputLine = "<?xml version=" + QUOTES + "1.0" + QUOTES + " encoding=" + QUOTES + "iso-8859-1" + QUOTES + "?>" ZeidonStringCopy( szOutputLine, 1, 0, "<?xml version=", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, QUOTES, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "1.0", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, QUOTES, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " encoding=", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, QUOTES, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "iso-8859-1", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, QUOTES, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "?>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:szOutputLine = "<zOI>" ZeidonStringCopy( szOutputLine, 1, 0, "<zOI>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:// Process the page header. //:SET CURSOR FIRST vReportDef.GroupSet WHERE vReportDef.GroupSet.Type = "PH" RESULT = SetCursorFirstEntityByString( vReportDef, "GroupSet", "Type", "PH", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //:szOutputLine = "<PageHeader>" ZeidonStringCopy( szOutputLine, 1, 0, "<PageHeader>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:XML_PageHeaderFooter( vReportDef, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ) oTZRPSRCO_XML_PageHeaderFooter( vReportDef, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ); //:szOutputLine = "</PageHeader>" ZeidonStringCopy( szOutputLine, 1, 0, "</PageHeader>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END //:szOutputLine = " <GR_" + szTopEntityName + ">" ZeidonStringCopy( szOutputLine, 1, 0, " <GR_", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szTopEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:// Process Top Entity Header, if it exists. //:CreateViewFromView( vReportLODRecurs, vReportDef ) CreateViewFromView( &vReportLODRecurs, vReportDef ); //:GenerateXML_LODRecurs( vReportDef, vReportLODRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ) oTZRPSRCO_GenerateXML_LODRecurs( vReportDef, vReportLODRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ); //:szOutputLine = " </GR_" + szTopEntityName + ">" ZeidonStringCopy( szOutputLine, 1, 0, " </GR_", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szTopEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:// Process the page footer. //:SET CURSOR FIRST vReportDef.GroupSet WHERE vReportDef.GroupSet.Type = "PF" RESULT = SetCursorFirstEntityByString( vReportDef, "GroupSet", "Type", "PF", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //:szOutputLine = "<PageFooter>" ZeidonStringCopy( szOutputLine, 1, 0, "<PageFooter>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:XML_PageHeaderFooter( vReportDef, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ) oTZRPSRCO_XML_PageHeaderFooter( vReportDef, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ); //:szOutputLine = "</PageFooter>" ZeidonStringCopy( szOutputLine, 1, 0, "</PageFooter>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END //:// Terminate and close the XML file. //:szOutputLine = "</zOI>" ZeidonStringCopy( szOutputLine, 1, 0, "</zOI>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:SysCloseFile( vReportDef, lFileHandle, 0 ) SysCloseFile( vReportDef, lFileHandle, 0 ); 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 }
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: oTZWDLGSO_DIL_Inherited_Ctrl // PURPOSE: This derived attribute determines the DIL message by the following // algorithm. // 1. If the control is a Radio or Push button, the Control Text // attribute is used. // 2. If there is no mapping, the Control Text attribute is used. // 3. If there is mapping, we will use the Domain's Context to // determine the DIL Text. If there is a Context specified for // the Control, that Context will be used. Otherwise the default // Context will be used. // NOTE: The operation is designed for Control only. // It will not handle CtrlCtrl, Option, or OptOpt. ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZWDLGSO_DIL_Inherited_Ctrl( zVIEW vIn, LPVIEWENTITY lpViewEntity, LPVIEWATTRIB lpViewAttrib, zSHORT nMsg ) { zPCHAR szAttr; zVIEW vDomain; zLONG lZKey; // If this is a derived retrieval call, then assign the attribute // using the derivation formula defined above if ( nMsg == zDERIVED_GET ) { GetAddrForAttribute( &szAttr, vIn, "ControlDef", "Tag" ); if ( lstrcmp( szAttr, "Radio" ) == 0 || lstrcmp( szAttr, "Push" ) == 0 ) { GetAddrForAttribute( &szAttr, vIn, "Control", "Text" ); } else { if ( CheckExistenceOfEntity( vIn, "CtrlMapER_Domain" ) < zCURSOR_SET ) { // no mapping so use text of control GetAddrForAttribute( &szAttr, vIn, "Control", "Text" ); } else { // OK, This is where we use the mapping // Context/Domain info to determine what the DIL needs to be. // First get a view to the Domain. GetIntegerFromAttribute( &lZKey, vIn, "CtrlMapER_Domain", "ZKey" ); ActivateMetaOI_ByZKey( vIn, &vDomain, 0, zREFER_DOMAIN_META, zSINGLE, lZKey, zCURRENT_OI ); if ( CheckExistenceOfEntity( vIn, "CtrlMapContext" ) >= zCURSOR_SET ) { // If there is a Context override, position on that Context. GetIntegerFromAttribute( &lZKey, vIn, "CtrlMapContext", "ZKey" ); SetCursorFirstEntityByInteger( vDomain, "Context", "ZKey", lZKey, 0 ); } else // If there is no Context override, position on the default // Context. SetCursorFirstEntityByString( vDomain, "Context", "IsDefault", "Y", 0 ); // Now retrieve the DIL Message from the Context. GetAddrForAttribute( &szAttr, vDomain, "Context", "DIL_NLS_Text" ); if ( szAttr[ 0 ] == 0 ) { GetAddrForAttribute( &szAttr, vDomain, "Context", "DIL_Inherited" ); } DropView( vDomain ); } } // Update the value of the DIL message text in the object StoreValueInRecord( vIn, lpViewEntity, lpViewAttrib, szAttr, 0 ); } return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZEREMDO_DeleteEntity // // PURPOSE: Delete Relationship from ER Model // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZEREMDO_DeleteEntity( zVIEW vTZEREMDO, zSHORT nReposition ) { zVIEW vTZEREMD1; zVIEW vTZERSASO; zVIEW vSubtask; // to refresh ER Diagram zSHORT nRC; zLONG lEntityZKey; LPLIBRARY hLibrary = 0; // used for dynamic call to ER control func's zFARPROC_RemoveFunc lpfn = 0; // Position and determine if there are any relationships involving // this Entity prior to deleting the Entity. nRC = CreateViewFromViewForTask( &vTZEREMD1, vTZEREMDO, 0 ); nRC = GetIntegerFromAttribute( &lEntityZKey, vTZEREMD1, "ER_Entity", "ZKey" ); nRC = SetCursorFirstEntityByInteger( vTZEREMD1, "ER_Entity_2", "ZKey", lEntityZKey, "EntpER_Model" ); // Delete the entity if it is involved in any relationships. if ( nRC >= zCURSOR_SET ) { // Loop and Delete all ER RelLinks for ( nRC = SetCursorFirstEntity( vTZEREMDO, "ER_RelLink", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntity( vTZEREMDO, "ER_RelLink", "" ) ) { oTZEREMDO_DeleteRelationship( vTZEREMDO, zREPOS_NONE, 1 ); } // Check to if all relationships were deleted. if ( SetCursorFirstEntityByInteger( vTZEREMD1, "ER_Entity_2", "ZKey", lEntityZKey, "EntpER_Model" ) >= zCURSOR_SET ) { DropView( vTZEREMD1 ); return( -1 ); } } // Delete ER Entity if ( GetViewByName( &vSubtask, "TZEREMDD", vTZEREMDO, zLEVEL_TASK ) > 0 ) { lpfn = (zFARPROC_RemoveFunc) GetOperationDynamicCallAddress( vSubtask, (LPLPLIBRARY) &hLibrary, "TZCTL", "RemoveEntity", "(tzlooprs)" ); if ( lpfn ) (*lpfn)( vSubtask, "ERD", 0, 0 ); } nRC = DeleteEntity( vTZEREMDO, "ER_Entity", nReposition ); // It is possible that the ER_Entity we just deleted is part of an // opened Subject Area. If so, we must be sure that Subject Area doesn't // have hanging SA_Entity entities. if ( GetViewByName( &vTZERSASO, "TZERSASO", vTZEREMDO, zLEVEL_TASK ) > 0 ) { nRC = SetCursorFirstEntity( vTZERSASO, "SA_Entity", 0 ); while ( nRC >= zCURSOR_SET ) { if ( CheckExistenceOfEntity( vTZERSASO, "ER_Entity" ) < zCURSOR_SET ) { if ( GetViewByName( &vSubtask, "SAVIEW", vTZEREMDO, zLEVEL_TASK ) > 0 ) { if ( lpfn == 0 ) // only get func addr once { lpfn = (zFARPROC_RemoveFunc) GetOperationDynamicCallAddress( vSubtask, (LPLPLIBRARY) &hLibrary, "TZCTL", "RemoveEntity", "(tzlooprs)" ); } if ( lpfn ) (*lpfn)( vSubtask, "ERD", 0, 0 ); } DeleteEntity( vTZERSASO, "SA_Entity", zREPOS_NONE ); } nRC = SetCursorNextEntity( vTZERSASO, "SA_Entity", 0 ); } } DropView( vTZEREMD1 ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZEREMDO_DeleteRelationship // // PURPOSE: Delete Relationship from ER Model // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZEREMDO_DeleteRelationship( zVIEW vTZEREMDO, zSHORT nReposition, zSHORT nQuietMode ) { zVIEW vTZERSASO; zVIEW vSubtask; zVIEW vERD; zSHORT nRC; unsigned long ulZKey; LPLIBRARY hLibrary = 0; // used for dynamic call to ER control func's zFARPROC_RemoveFunc lpfn = 0; // Positon on ER_RelType on Right Side( side representing relationships // only ) thus allowing a single Delete to cascade and Delete all // representations of the Relationship on both sides of the Object. nRC = SetCursorFirstEntityByEntityCsr( vTZEREMDO, "ER_RelType", vTZEREMDO, "ER_RelType_1", "EntpER_Model" ); if ( GetViewByName( &vSubtask, "TZEREMDD", vTZEREMDO, zLEVEL_TASK ) > 0 ) { if ( lpfn == 0 ) // only get func addr once { lpfn =(zFARPROC_RemoveFunc) GetOperationDynamicCallAddress( vSubtask,(LPLPLIBRARY) &hLibrary, "TZCTL", "RemoveRelationship", "(tzlooprs)" ); } if ( lpfn ) (*lpfn)( vSubtask, "ERD", 0, 0 ); } // if delete Relationship and this Relationship is a part of the // Identifier, then delete the Relationship from the Identifier CreateViewFromViewForTask( &vERD, vTZEREMDO, 0 ); for ( nRC = SetCursorFirstEntity( vERD, "ER_RelLink_2", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntity( vERD, "ER_RelLink_2", "" ) ) { GetIntegerFromAttribute( &ulZKey, vERD, "ER_RelLink_2", "ZKey" ); for ( nRC = SetCursorFirstEntityByInteger( vERD, "ER_RelLinkIdentifier", "ZKey", ulZKey, "EntpER_Model" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntityByInteger( vERD, "ER_RelLinkIdentifier", "ZKey", ulZKey, "EntpER_Model" )) { if ( CheckExistenceOfEntity( vERD, "ER_AttributeIdentifier" ) == zCURSOR_NULL ) { DeleteEntity( vERD, "ER_FactType", zREPOS_NONE ); } } } DropView( vERD ); nRC = DeleteEntity( vTZEREMDO, "ER_RelType", nReposition ); if ( nReposition != zREPOS_NONE ) { if ( nReposition == zREPOS_NEXT ) SetCursorNextEntity( vTZEREMDO, "ER_RelLink", "" ); else SetCursorPrevEntity( vTZEREMDO, "ER_RelLink", "" ); } // It is possible that the ER_RelType we just deleted is part of an // opened Subject Area. If so, we must be sure that Subject Area doesn't // have hanging SA_RelType entities that result from the deleted // relationships. if ( GetViewByName( &vTZERSASO, "TZERSASO", vTZEREMDO, zLEVEL_TASK ) > 0 ) { nRC = SetCursorFirstEntity( vTZERSASO, "SA_RelType", 0 ); while ( nRC >= zCURSOR_SET ) { if ( CheckExistenceOfEntity( vTZERSASO, "ER_RelType" ) < zCURSOR_SET ) { if ( GetViewByName( &vSubtask, "SAVIEW", vTZEREMDO, zLEVEL_TASK ) > 0 ) { if ( lpfn == 0 ) // only get func addr once { lpfn = (zFARPROC_RemoveFunc) GetOperationDynamicCallAddress( vSubtask, (LPLPLIBRARY) &hLibrary, "TZCTL", "RemoveRelationship", "(tzlooprs)" ); } if ( lpfn ) (*lpfn)( vSubtask, "ERD", 0, 0 ); } DeleteEntity( vTZERSASO, "SA_RelType", zREPOS_NONE ); } nRC = SetCursorNextEntity( vTZERSASO, "SA_RelType", 0 ); } } return( 0 ); }