예제 #1
0
파일: tzpnupgd.c 프로젝트: arksoftgit/10c
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 );
}
예제 #2
0
파일: kzxmlpgo.c 프로젝트: arksoftgit/10c
//:TRANSFORMATION OPERATION
zOPER_EXPORT zSHORT OPERATION
oKZXMLPGO_InitWebPage( zVIEW     vKZXMLPGO,
                       zPCHAR    DialogName,
                       zPCHAR    WindowName )
{
   zSHORT    RESULT; 

   //:InitWebPage( VIEW vKZXMLPGO BASED ON LOD KZXMLPGO,
   //:          STRING ( 32 ) DialogName,
   //:          STRING ( 32 ) WindowName )

   //:// Delete any existing Page entry and initialize a new one.
   //:SET CURSOR FIRST vKZXMLPGO.Page
   RESULT = SetCursorFirstEntity( vKZXMLPGO, "Page", "" );
   //:IF RESULT >= zCURSOR_SET
   if ( RESULT >= zCURSOR_SET )
   { 
      //:DELETE ENTITY vKZXMLPGO.Page NONE
      RESULT = DeleteEntity( vKZXMLPGO, "Page", zREPOS_NONE );
   } 

   //:END
   //:CREATE ENTITY vKZXMLPGO.Page
   RESULT = CreateEntity( vKZXMLPGO, "Page", zPOS_AFTER );
   //:vKZXMLPGO.Page.DialogName = DialogName
   SetAttributeFromString( vKZXMLPGO, "Page", "DialogName", DialogName );
   //:vKZXMLPGO.Page.WindowName = WindowName
   SetAttributeFromString( vKZXMLPGO, "Page", "WindowName", WindowName );
   return( 0 );
// END
} 
예제 #3
0
/*

   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
예제 #4
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: oTZEREMDO_GetRefViewForER
//
// PURPOSE:   Get access to ER View for Reference.  Activate if not loaded
//            and get at application level if loaded.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZEREMDO_GetRefViewForER( zVIEW  vSubtask,
                           zPVIEW pvTZEREMDO,
                           zSHORT nCurrentOrReload )
{
   zVIEW  vTZERMFLO;
   zSHORT nRC;

// Get Access to ERD File List Object
   nRC = RetrieveViewForMetaList( vSubtask, &vTZERMFLO, zREFER_ERD_META );
   if ( nRC < 0 )
   {
      *pvTZEREMDO = 0;
      return( -2 );
   }

   if ( SetCursorFirstEntity( vTZERMFLO, "W_MetaDef", "" ) < zCURSOR_SET )
   {
      return( -2 );
   }

   nRC = ActivateMetaOI( vSubtask, pvTZEREMDO, vTZERMFLO,
                         zREFER_ERD_META,
                         zSINGLE | zLEVEL_APPLICATION );
   return( nRC );
}
예제 #5
0
파일: tzerrord.c 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
//    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
예제 #6
0
파일: tzerrord.c 프로젝트: arksoftgit/10c
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" );
}
예제 #7
0
파일: tzpnupgd.c 프로젝트: arksoftgit/10c
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 );
}
예제 #8
0
파일: tzersast.c 프로젝트: arksoftgit/10c
zOPER_EXPORT zSHORT OPERATION
oTZERSASO_RefreshSA_FromEMD( zVIEW  vSubjectArea,
                             zVIEW  vEntpModel )
{
   zSHORT nRC;

   nRC = SetCursorFirstEntity( vSubjectArea, "SA_Entity", "" );
   while ( nRC > zCURSOR_UNCHANGED )
   {
      oTZERSASO_RefreshOneSA_Entity( vSubjectArea, vEntpModel );
      nRC = SetCursorNextEntity( vSubjectArea, "SA_Entity", "" );
   }
}
예제 #9
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 );
}
예제 #10
0
zOPER_EXPORT zSHORT OPERATION
zwTZHKEYAD_IncludeOperation( zVIEW vSubtask )
{
   zVIEW vHotKeys;
   zVIEW vOperationList;
   zVIEW vOperation;

   GetViewByName( &vHotKeys, "KZHKEYSO", vSubtask, zLEVEL_TASK );
   GetViewByName( &vOperationList, "CM_List", vSubtask, zLEVEL_TASK );
   if ( ActivateMetaOI( vSubtask, &vOperation, vOperationList, zREFER_GO_META, 0 ) >= 0 )
   {
      if ( SetCursorFirstEntity( vHotKeys, "Operation", 0 ) >= zCURSOR_SET )
         ExcludeEntity( vHotKeys, "Operation", zREPOS_NONE );

      IncludeSubobjectFromSubobject( vHotKeys, "Operation",
                                     vOperation, "Operation", zPOS_FIRST );
      DropView( vOperation );
   }

   return( 0 );
}
예제 #11
0
파일: tzadw3aw.c 프로젝트: DeegC/10d
/////////////////////////////////////////////////////////////////////////////
//
// ENTRY: CalculateWindowSize
//
// PURPOSE: This function finds the coordinates of field or group
//          that is farthest down on the current window and the
//          field or group that is farthest to the right of the current
//          window.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_CalculateWindowSize( zVIEW vNewDialog,
   zPLONG    nLine,
   zPLONG    nMaxLength )
{
   zLONG    lFieldEnd;
   zLONG    i;
   zLONG    j;
   zSHORT   RESULT;

// TraceLineS("IN", "CalculateWindowSize W3" );
   /* Now go through the painted window and calculate the minimum
      size of the window in lines and columns. */
   *nLine = 0;
   *nMaxLength = 0;
   lFieldEnd = 0;
   RESULT = SetCursorFirstEntity( vNewDialog, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      GetIntegerFromAttribute( &i, vNewDialog, "Control", "PSDLG_X" );
      GetIntegerFromAttribute( &j, vNewDialog, "Control", "SZDLG_X" );
      i = i + j;
      if ( i > *nMaxLength )
      {
         *nMaxLength = i;
      }
      GetIntegerFromAttribute( &i, vNewDialog, "Control", "PSDLG_Y" );
      GetIntegerFromAttribute( &j, vNewDialog, "Control", "SZDLG_Y" );
      lFieldEnd = i + j;
      if ( lFieldEnd > *nLine )
      {
         *nLine = lFieldEnd;
      }
      RESULT = SetCursorNextEntity( vNewDialog, "Control", "" );
   }
// TraceLineS("END", "CalculateWindowSize W3" );
   return( 0 );
}
예제 #12
0
zOPER_EXPORT zSHORT OPERATION
VML_CreateText_DeleteAll( zVIEW vSubtask )
{
   zVIEW  vProfileXFER;
   zSHORT nRC;

   if ( MessagePrompt( vSubtask, "ED0101", "Zeidon Editor",
                       "Delete All VML Keywords?", 0, zBUTTONS_YESNO,
                       zRESPONSE_NO, zICON_QUESTION ) == zRESPONSE_NO )
   {
      return( 0 );
   }

   GetProfileView( &vProfileXFER );
   for ( nRC = SetCursorFirstEntity( vProfileXFER, "VML_Text", 0 );
         nRC == zCURSOR_SET;
         nRC = SetCursorNextEntity( vProfileXFER, "VML_Text", 0 ) )
   {
      DeleteEntity( vProfileXFER, "VML_Text", zREPOS_NONE );
   }

   return( 0 );
} // VML_CreateText_DeleteAll
예제 #13
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: oTZEREMDO_DeriveKey
//
// PURPOSE:   Derived function to set ParticipatesInKey for ER_Attribute
//            Entity in TZEREMDO
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZEREMDO_DeriveKey( zVIEW            vTZEREMDO,
                     LPVIEWENTITY     lpViewEntity,
                     LPVIEWATTRIB     lpViewAttrib,
                     zSHORT           nMsg )
{
   zSHORT nRC;

   // Derive Participates in Key
   nRC = SetCursorFirstEntity( vTZEREMDO, "ER_EntIdentifier", "" );
   nRC = SetCursorFirstEntityByEntityCsr( vTZEREMDO, "ER_AttributeIdentifier",
                                          vTZEREMDO, lpViewEntity->szName,
                                          "ER_EntIdentifier" );
   if ( nRC >= zCURSOR_SET )
   {
      StoreValueInRecord( vTZEREMDO, lpViewEntity, lpViewAttrib, "Y", 0 );
   }
   else
   {
      StoreValueInRecord( vTZEREMDO, lpViewEntity, lpViewAttrib, "N", 0 );
   }

   return( 0 );
}
예제 #14
0
zOPER_EXPORT zSHORT OPERATION
AEQ_ClearViews( zVIEW vSubtask )
{
   zVIEW  vEdWrk;
   zSHORT nRC;

   GetWorkView( &vEdWrk );
   if ( vEdWrk == 0 )
   {
      zCHAR sz[ 200 ];

      zstrcpy( sz, "TZEDWRKO not Available at AEQ_ClearViews." );
      OperatorPrompt( 0, "ED - Error", sz, 0, zBUTTONS_OK, 0, zICON_STOP );
      return( zCALL_ERROR );
   }

   nRC = SetCursorFirstEntity( vEdWrk, "View", "" );
   while ( nRC == zCURSOR_SET )
      nRC = DeleteEntity( vEdWrk, "View", zREPOS_NEXT );

   AEQ_RefreshAEQ( vSubtask );

   return( 0 );
}
예제 #15
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 );
}
예제 #16
0
파일: tzadw4aw.c 프로젝트: arksoftgit/10c
///////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This function paints the list attributes from the user spec
//           into the existing partition.
//
////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zLONG OPERATION
ofnTZWDLGSO_AutoPntFldPartWLits( zVIEW  vSubtask,
                                 zVIEW  vUserSpec,
                                 zVIEW  vNewDialog,
                                 zPCHAR szListType )
{
   zVIEW  vAutoDesWk;
   zVIEW  vSubobject;
   zVIEW  vTempStyle;
   zVIEW  vCtrlDef;
   zLONG  k, j;
   zLONG  lCC, lCL;
   zLONG  lMaxLines;
   zLONG  lLine, lFirstPaintLine, lFieldsPainted, lColumn;
   zLONG  lMaxFieldDLG_X, lMaxText, lPush;
   zLONG  lGroupDLG_X, lGroupDLG_Y;
   zSHORT RESULT;
   zLONG  lLastPaintLine, lLastWindowLine, lMaxLength;
// zCHAR  cUsage[ 1 ];
   zCHAR  szMapEntity[ 33 ];
   zCHAR  szMapAttribute[ 33 ];
   zCHAR  szType[ 33 ];
   zCHAR  szWorkString[ 256 ];
   zCHAR  X_LOD_Attribute[ 16 ];
   zCHAR  X_ER_Attribute[ 15 ];

// TraceLineS( "IN", " AutoPaintPartitionWithFields" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "I_ER_Attribute" );
   }
   else
   {
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );
      zstrcpy( X_ER_Attribute, "L_ER_Attribute" );
   }

// TraceLineS( "IN", " AutoPaintPartitionWithFields" );

   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );
   GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK );
   CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 );

   lCL = 12;
   lCC = 5;

   /* Create a new view that will point to the UIS_ViewObjRef entity
      in the user spec object.  Sometimes vUserSpec is pointing to a
      recursive subobject and UI_ViewObjRef cannot be accessed. */
   CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 );
   ResetView( vTempStyle );

   SetViewToSubobject( vSubobject, "CtrlCtrl" );
   /* Delete any existing fields in the listbox */
   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
   }

   GetIntegerFromAttribute( &lMaxLines, vNewDialog, "Control", "SZDLG_Y" );
   szMapEntity[ 0 ] = 0;

   lFirstPaintLine = 0;
   lLastPaintLine = 1;
   lLine          = 1;
   lMaxFieldDLG_X = 0;
   lMaxLength     = 0;
   lMaxText       = 0;
   lPush          = 0;
   lFieldsPainted = 0;

// cUsage[ 0 ] = 'U';

   /* If there is a paint object, loop through its attributes */
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      /* The last line painted was at this posititon */
      lLastPaintLine = lLine;
      lColumn = 1;

      /* Create the Text Field for the Attribute */
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );
      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_Y", lLine );
      if ( lFirstPaintLine == 0 )
         lFirstPaintLine = lLine;

      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_X", lColumn );
      /* Creating text field. */
      SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                    "Tag", "Text", "" );
      IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                     vCtrlDef, "ControlDef", zPOS_AFTER );
      // Remove the text border.
      SetAttributeFromInteger( vSubobject, "Control", "Subtype",
                               zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP );
      GetStringFromAttribute( szWorkString, vUserSpec,
                              X_ER_Attribute, "ListPaintLit" );
      GetStringFromAttribute( szMapAttribute, vUserSpec,
                              X_ER_Attribute, "Name" );

      // If there is no paint literal for this attribute then
      // use the attribute name as the paint literal.
      if ( szWorkString[ 0 ] == 0 )
         zstrcpy( szWorkString, szMapAttribute );

      SetAttributeFromString( vSubobject, "Control", "Text", szWorkString );

      j = zstrlen( szWorkString );
      j = j * lCC;

      // Determine the size of the longest paint literal.
      if ( j > lMaxText )
         lMaxText = j;

      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", j );
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL );

      /* Add the length of the longest paint literal
         to the column so the attribute field will be
         painted there */
      lColumn += j;
      lColumn = lColumn + lCC;

      // If there is no paint length for the field, then
      // use the field's length.
      j = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType );

      j = j * lCC;

      // If there is no paint length for the field, then
      // use the field's length.
      if ( j > 100 )
         j = 100;
      else
      if ( j < 25 )
         j = 25;

      // Create the appropriate Data Field for the Attribute.
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );

      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_Y",  lLine );
      SetAttributeFromInteger( vSubobject, "Control",
                               "PSDLG_X", lColumn );
      SetAttributeFromInteger( vSubobject, "Control",
                               "SZDLG_X", j );
      SetAttributeFromInteger( vSubobject, "Control",
                               "SZDLG_Y", lCL );
      // Determine the maximum column length.
      if ( lMaxFieldDLG_X < lColumn )
         lMaxFieldDLG_X = lColumn;

      lColumn += j;
      lColumn = lColumn - 1 * lCC;

      // Determine the maximum length of colum and literal.
      if ( lMaxLength < lColumn )
         lMaxLength = lColumn;

      SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                    "Tag", "EditBox", "" );
      IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                     vCtrlDef, "ControlDef", zPOS_AFTER );
   // SetAttributeFromInteger( vSubobject, "Control", "Type", 1010 );
      /*
      if ( cUsage[ 0 ] == 'U' )
      {
         GetStringFromAttribute( cWork, vUserSpec,
                                 X_LOD_Attribute, "DERIVEDF" );
         if ( cWork[ 0 ] != 0 )
            SetAttributeFromCharacter( vSubobject,
                                        "Control", "Type", 1000 );
      }
      */
      /* setting the group and field's ENAME and ANAME */
      CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER );

      /* set the partitions OI name */
      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                     vTempStyle, "UIS_ViewObjRef", zPOS_AFTER );
      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute",
                                     vUserSpec, X_LOD_Attribute, zPOS_AFTER );
      lFieldsPainted++;
      lLine = lLine + lCL;

      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }

   lLastPaintLine = lLine;

   /* Get the dimensions of the partition. */
   GetIntegerFromAttribute( &lGroupDLG_X, vNewDialog, "Control", "SZDLG_X" );

   GetIntegerFromAttribute( &lGroupDLG_Y, vNewDialog, "Control", "SZDLG_Y" );

   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      GetIntegerFromAttribute( &lLine, vSubobject, "Control", "PSDLG_Y" );
      if ( lLine >= lFirstPaintLine && lLine <= lLastPaintLine )
      {
         GetStringFromAttribute( szType, vSubobject, "ControlDef", "Tag" );
         /* If the control is not a text control. */
         if ( zstrcmp( szType, "Text" ) != 0 )
         {
            GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" );
            GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" );

            if ( j < lMaxFieldDLG_X )
            {
               j = lMaxFieldDLG_X - j;
               if ( ( lMaxFieldDLG_X + k ) >
                    ( lMaxLength + lCC ) )
               {
                  if ( ( lMaxFieldDLG_X + k ) <= lGroupDLG_X )
                  {
                     lMaxLength = lMaxFieldDLG_X +( k - lCC );
                  }
                  else
                  {
                     j -=( ( lMaxFieldDLG_X + k ) -
                                          lGroupDLG_X );
                     if ( j > 0 )
                     {
                        AddToAttributeFromInteger( vSubobject, "Control",
                                                   "PSDLG_X", j );
                        lMaxLength = lGroupDLG_X - lCC;
                        j = -1;
                     }
                  }
               }

               if ( j > 0 )
               {
                  SetAttributeFromInteger( vSubobject, "Control",
                                           "PSDLG_X", lMaxFieldDLG_X );
               }
            }
         }

         GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" );
         GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" );
         if ( ( j + k ) >= lGroupDLG_X )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
            }

            MessageSend( vNewDialog, "AD10304", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );

            /* the partition is not wide enough */
            return( -1 );
         }

         ///////////////////////////////////////////////////////////
         // Code to truncate fields which extend over the partition to
         // the right COMMENTED out. This is a 'too small' error as
         // noted above.
         // else
         // if ( (j + k) >= lGroupDLG_X )
         // {
         //    k =( lGroupDLG_X - 1 ) - j;
         //    SetAttributeFromInteger( vSubobject, "Control",
         //                             "SZDLG_X", k );
         // }
         ////////////////////////////////////////////////////////////
      }

      RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
   }

   lLastWindowLine = lLine;

   /* If the window painted has too many lines for the
      terminal being used for painting. Attempt to
      compress the window into a more manageable size by combining
      painted fields which are located on separate lines            */

   /*
   for ( i = 1; i < 8; i++ )
   {
      if ( lLastWindowLine + 12 <= lMaxLines )
      {
         break;
      }
      fnCompressPartition( vNewDialog, i, lFirstPaintLine, lMaxText,
                           lMaxLines,
                           &lLastPaintLine, &lLastWindowLine,
                           &lMaxLength );
   }
   */

   if ( ( lLastWindowLine + lCL ) > lMaxLines )
   {
      RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      {
         RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
      }

      MessageSend( vNewDialog, "AD10305", "Autodesigner",
                   "Partition too small( height )",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      return( -1 );
   }

// TraceLineS( "END", " AutoPaintPartitionWithFields" );

   /* Return the last paint line for AutoDesign */
   return( lLastPaintLine );
}
예제 #17
0
파일: tzadw4aw.c 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////
//
// PURPOSE:  This routine paints selected fields in a list box
// or partition (all the fields are on one line) and paints the
// field literals above the listbox or partition.
//
/////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintListBox( zVIEW  vSubtask,
                              zVIEW  vUserSpec,
                              zVIEW  vNewDialog,
                              zPCHAR szListType )
{
   zLONG    lCC;
   zLONG    lCL;
   zSHORT   nRC;
   zLONG    lFieldRow;
   zLONG    lFieldCol;
   zLONG    lPartitionStartDLG_Y;
   zLONG    lPartitionStartDLG_X;
   zLONG    lPartitionSizeDLG_X;
   zLONG    lSubtype;
   zCHAR    szParentName[ 33 ];
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
//BL   zLONG    lTempInteger_1;
   zCHAR    X_LOD_Attribute[ 16 ];

// TraceLineS("IN", "AutoPaintListBox W4" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
      zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" );
   else
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );

   lCL = 12;
   lCC = 5;
   zstrcpy( szParentName, "Window" );
   lTempInteger_0  = zstrcmp( szParentName, "SECTION" );
   /* If we are Autodesigning a ROD, set the lCL to 8 so line skips do
      not tak place. */
   if ( lTempInteger_0 == 0 )
   {
      lCL = 8;
   }
   else
   {
      lCL = 12;
   }

   // Set the Tag
   ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vNewDialog, "ListBox" );
// SetAttributeFromAttribute( vNewDialog, "Control", "Tag",
//                            vUserSpec, "LOD_Entity", "Name" );

   /* Get the group's dimensions. */
   GetIntegerFromAttribute( &lPartitionStartDLG_Y, vNewDialog,
                            "Control", "PSDLG_Y" );
   GetIntegerFromAttribute( &lPartitionStartDLG_X, vNewDialog,
                            "Control", "PSDLG_X" );
   GetIntegerFromAttribute( &lPartitionSizeDLG_X, vNewDialog,
                            "Control", "SZDLG_X" );

   /* If the control is a group box not a listbox, then the output
      fields should be placed lower down then the listbox's output fields. */
   if ( CompareAttributeToString( vNewDialog, "ControlDef", "Tag",
                                  "ListBox" ) == 0 )
      lFieldRow = 2;
   else
      lFieldRow = 5;
   lFieldCol = 1;

   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );

   /* Paint the output fields into the listbox or partition. */
   nRC = ofnTZWDLGSO_AutoPaintListPart( vSubtask, vUserSpec, vNewDialog,
                                        lFieldRow, lFieldCol,
                                        lPartitionSizeDLG_X, szListType );

#if 0
   //* Eliminated 1999/04/23 for support of new listbox style.
   /* If the fields fit and there was no other problem, paint the lits. */
   if ( nRC > -1 )
   {
      /* The literals are going to be placed above the listbox
         or partition. */
      lFieldRow = lPartitionStartDLG_Y - nCL;
      lFieldCol = lPartitionStartDLG_X + nCC;

      RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );

      /* Paint the literals above the listbox or partition. */
      lTempInteger_1 = zstrcmp( szParentName, "Window" );
      if ( lTempInteger_1 == 0 )
      {
         nRC = ofnTZWDLGSO_AutoPaintLstLitPart( vUserSpec, vNewDialog,
                                                lFieldRow, lFieldCol,
                                                lPartitionSizeDLG_X,
                                                szListType );
         if ( nRC == -1 )
            return( -1 );
      }
   }
   else
   {
      return( -1 );
   }
#endif

   // Set listbox to sort and disable first subcontrol.
   GetIntegerFromAttribute( &lSubtype, vNewDialog, "Control", "Subtype" );
   lSubtype |= zLISTBOX_SORTEDHEADERS;
   SetAttributeFromInteger( vNewDialog, "Control", "Subtype", lSubtype );
   SetCursorFirstEntity( vNewDialog, "CtrlCtrl", 0 );
   GetIntegerFromAttribute( &lSubtype, vNewDialog, "CtrlCtrl", "Subtype" );
   lSubtype |= zCONTROL_DISABLED;
   SetAttributeFromInteger( vNewDialog, "CtrlCtrl", "Subtype", lSubtype );

// TraceLineS("END", "AutoPaintListBox W4" );
   return( nRC );
}
예제 #18
0
파일: tzadw4aw.c 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// PURPOSE: This function places selected attributes in an already
// existing partition without the attributes text literals.
//
// vNewDialog - handle to the partition
// lFieldRow - offset row in the group
// lFieldCol - offset column in the group
// PartitionSize - length size for the group
//
// Return Codes:
//     0 - Everything is O.K. and the fields were placed into the
//         partition
//    -1 - The field widths exceeded the partitions width
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_AutoPaintListPart( zVIEW    vSubtask,
                               zVIEW    vUserSpec,
                               zVIEW    vNewDialog,
                               zLONG    lFieldRow,
                               zLONG    lFieldCol,
                               zLONG    PartitionSize,
                               zPCHAR   szListType )
{
   zVIEW    vAutoDesWk;
   zVIEW    vTempStyle;
   zVIEW    vSubobject;
   zVIEW    vCtrlDef;
   zLONG    lListAttributeLength;
   zLONG    lPaintLiteralLength;
   zLONG    lCC;
   zLONG    lCL;
   zCHAR    szControlType[ 33 ];
   zCHAR    szMapEntity[ 33 ];
   zCHAR    szParentName[ 33 ];
   zCHAR    szWorkString[ 65 ];
   zCHAR    szLiteralString[ 65 ];
   zLONG    lTempInteger_0;
   zSHORT   RESULT;
   zSHORT   lFieldsPainted;
   zLONG    lRC;
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_LOD_Entity[ 13 ];
   zCHAR    X_ER_Attribute[ 15 ];

// TraceLineS( "IN", "AutoPaintListPart W4" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" );
      zstrcpy( X_LOD_Entity, "I_LOD_Entity" );
      zstrcpy( X_ER_Attribute, "I_ER_Attribute" );
   }
   else
   {
      zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" );
      zstrcpy( X_LOD_Entity, "L_LOD_Entity" );
      zstrcpy( X_ER_Attribute, "L_ER_Attribute" );
   }

   lCL = 12;
   lCC = 5;

   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );
   GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK );
   GetStringFromAttribute( szControlType, vNewDialog, "ControlDef", "Tag" );

   /* It is important to know whether the parent is a WINDOW(WDODs)
      or a SECTION(RODs). */
   zstrcpy( szParentName, "Window" );

   /* IF we are Autodesigning a ROD, set lCL to 8 so line
      skips do not take place */
   lTempInteger_0  = zstrcmp( szParentName, "SECTION" );
   if ( lTempInteger_0 == 0 )
   {
      lCL = 8;
   }

   /* Create a view that will point to the controls under the listbox. */
   CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 );

   /* Set handle to the fields under the group */
   SetViewToSubobject( vSubobject, "CtrlCtrl" );

   /* Delete any existing fields in the listbox */
   RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
   }

   /* Create a new view that will point to the UIS_ViewObjRef entity
      in the user spec object.  Sometimes vUserSpec is pointing to a
      recursive subobject and UI_ViewObjRef cannot be accessed. */
   CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 );
   ResetView( vTempStyle );

   lFieldsPainted = 0;

   //// Paint the fields in the Partition //////////
   /* IF Attributes have been found to paint, paint them */
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      // This gets the length of the field to be painted.
      lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask,
                                                             vUserSpec,
                                                             szListType );

      if ( lListAttributeLength == 0 )
         lListAttributeLength = 4;
      lListAttributeLength = lListAttributeLength * lCC;
      if ( lListAttributeLength > 100 )
         lListAttributeLength = 100;
      if ( lListAttributeLength < 25 )
         lListAttributeLength = 25;

      /* If there isn't a paint literal then use the entity name
         as the paint literal */
      GetStringFromAttribute( szLiteralString, vUserSpec,
                               X_ER_Attribute, "ListPaintLit" );
      if ( szLiteralString[ 0 ] == 0 )
         GetStringFromAttribute( szLiteralString, vUserSpec,
                                 X_ER_Attribute, "PromptPaintLit" );
      lPaintLiteralLength = zstrlen( szLiteralString );
      if ( szLiteralString[ 0 ] == 0 )
      {
         GetStringFromAttribute( szLiteralString, vUserSpec,
                                 X_ER_Attribute, "Name" );
         AddSpacesToString( szLiteralString );
         lPaintLiteralLength = zstrlen( szLiteralString ) + 1;
      }

      lPaintLiteralLength = lPaintLiteralLength * lCC;
      if ( lPaintLiteralLength > 100 )
         lPaintLiteralLength = 100;
      if ( lPaintLiteralLength < 25 )
         lPaintLiteralLength = 25;

      /* Do not continue to add fields into the partition if
         the field sizes exceed the size of the partition */
      /* If the field attribute length is greater than the text
         literal length, then add the field attribute length
         to lFieldCol. */
      if ( lPaintLiteralLength < lListAttributeLength )
      {
         /* If the length of lFieldCol is greater than the
            partition size, then delete all the fields that have
            been added and give a message to the user. */
         if ( lFieldCol + lListAttributeLength > PartitionSize )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
               RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
            }
            DropView( vSubobject );
            MessageSend( vUserSpec, "AD10302", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
            return( -1 );
         }
      }
      else
      {
      /* If the text literal length is greater than the field
         attribute length, then add the text literal length
         to lFieldCol. */

         /* If the length of lFieldCol is greater than the
            partition size, then delete all the fields that have
            been added and give a message to the user. */
         if ( lFieldCol + lPaintLiteralLength > PartitionSize )
         {
            RESULT = SetCursorFirstEntity( vSubobject, "Control", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            {
               DeleteEntity( vSubobject, "Control", zREPOS_NEXT );
               RESULT = SetCursorNextEntity( vSubobject, "Control", "" );
            }
            DropView( vSubobject );
            MessageSend( vUserSpec, "AD10303", "Autodesigner",
                         "Partition too small( width )",
                         zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
            return( -1 );
         }
      }

      /* Create the partition's fields */
      CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER );
      SetAttributeFromString( vSubobject, "Control", "Text", szLiteralString );
      if ( zstrcmp( szControlType, "ListBox" ) == 0 )
      {
         SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                       "Tag", "ListBoxCtl", "" );
         IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                        vCtrlDef, "ControlDef", zPOS_AFTER );
      }
      else
      {
         SetCursorFirstEntityByString( vCtrlDef, "ControlDef",
                                       "Tag", "Text", "" );
         IncludeSubobjectFromSubobject( vSubobject, "ControlDef",
                                        vCtrlDef, "ControlDef", zPOS_AFTER );
      }
      // Set the tag
      ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vSubobject, "ListCtrl" );
/*    GetStringFromAttribute( szTag, vUserSpec, X_ER_Attribute, "Name" );
      szTag[ 30 ] = 0;

      lFieldsPainted = lFieldsPainted + 1;
      zltoa( lFieldsPainted, szWork );
      zstrcat( szTag, szWork );
      SetAttributeFromString( vSubobject, "Control", "Tag", szTag );
*/
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X",
                               lListAttributeLength );
      SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y",  lCL );

      /* If the domain is an integer or a long, then right justify. */
      /*
      IF vUserSpec.L_Domain.DerivedDataType = 'I' OR
         vUserSpec.L_Domain.DerivedDataType = 'L' OR
         vUserSpec.L_Domain.DerivedDataType = 'M'
         vNewDialog.FLAGFLD.RJUST = 'Y'
      END
      */

      GetStringFromAttribute( szMapEntity, vUserSpec, "LOD_Entity", "Name" );
      GetStringFromAttribute( szWorkString, vUserSpec, X_LOD_Entity, "Name" );
      /* If this LISTATTRIB is from a different ENTITY than the
         current ENTITY, then make sure the value gets mapped. */
      lRC = zstrcmp( szWorkString, "" );
      if ( lRC != 0 )
      {
         lRC = zstrcmp( szWorkString, szMapEntity );
         if ( lRC == 0 )
         {
            zstrcpy( szMapEntity, szWorkString );
         }
      }

      /* setting the group and field's ENAME and ANAME */
      CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER );

      /* set the partitions OI name */
      if ( szListType[ 0 ] == 'I' )
         IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                        vUserSpec, "ListViewObjRef", zPOS_AFTER );
      else
         IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView",
                                        vTempStyle, "UIS_ViewObjRef", zPOS_AFTER );

      IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute",
                                     vUserSpec, X_LOD_Attribute, zPOS_AFTER );

      /* lFieldRow should always stay the same */
      SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lFieldCol );
      SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lFieldRow );

      /* If the field length is longer than the paint literal,
         then position the next field by using the field length,
         otherwise position the next field by using the paint
         literal length */
      if ( lPaintLiteralLength < lListAttributeLength )
      {
         lFieldCol = lFieldCol + lListAttributeLength + lCC;
      }
      else
      {
         lFieldCol = lFieldCol + lPaintLiteralLength + lCC;
      }
      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }

   DropView( vSubobject );
   DropView( vTempStyle );
// TraceLineS("END", "AutoPaintListPart W4" );
   return( 0 );
}
예제 #19
0
파일: tzadw4aw.c 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// 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 );
}
예제 #20
0
파일: tzsixsko.c 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// 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 );
}
예제 #21
0
파일: tzsixsko.c 프로젝트: arksoftgit/10c
/////////////////////////////////////////////////////////////////////////////
//
// 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 );
}
예제 #22
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
} 
예제 #23
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 );
}
예제 #24
0
//:   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
} 
예제 #25
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 );
}
예제 #26
0
파일: kzxmlpgo.c 프로젝트: arksoftgit/10c
//:   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
} 
예제 #27
0
//:DIALOG OPERATION
//:RemoveAll ( VIEW vSubtask )
//:   VIEW TZTENVRO      REGISTERED AS TZTENVRO
zOPER_EXPORT zSHORT OPERATION
RemoveAll( zVIEW     vSubtask )
{
   zVIEW     TZTENVRO = 0; 
   zSHORT    RESULT; 
   //:VIEW TZZOLODO      REGISTERED AS TZZOLODO
   zVIEW     TZZOLODO = 0; 
   //:VIEW TZZOLODO_Hier BASED ON LOD  TZZOLODO
   zVIEW     TZZOLODO_Hier = 0; 
   //:STRING ( 100 ) szEntityName
   zCHAR     szEntityName[ 101 ] = { 0 }; 
   //:SHORT          sReturnLevel
   zSHORT    sReturnLevel = 0; 
   //:SHORT          nRC
   zSHORT    nRC = 0; 
   //:INTEGER        lAbsPos
   zLONG     lAbsPos = 0; 
   //:INTEGER        lDataSourceZKey
   zLONG     lDataSourceZKey = 0; 

   RESULT = GetViewByName( &TZTENVRO, "TZTENVRO", vSubtask, zLEVEL_TASK );
   RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK );

   //:CreateViewFromViewForTask( TZZOLODO, TZZOLODO, vSubtask )
   CreateViewFromViewForTask( &TZZOLODO, TZZOLODO, vSubtask );
   //:ResetView( TZZOLODO )
   ResetView( TZZOLODO );

   //:CreateViewFromViewForTask( TZZOLODO_Hier, TZZOLODO, vSubtask )
   CreateViewFromViewForTask( &TZZOLODO_Hier, TZZOLODO, vSubtask );

   //:szEntityName    = "LOD_EntityParent"
   ZeidonStringCopy( szEntityName, 1, 0, "LOD_EntityParent", 1, 0, 101 );
   //:lDataSourceZKey = TZTENVRO.TE_DBMS_Source.ZKey
   GetIntegerFromAttribute( &lDataSourceZKey, TZTENVRO, "TE_DBMS_Source", "ZKey" );

   //:nRC = DefineHierarchicalCursor( TZZOLODO_Hier, "LOD_EntityParent" )
   nRC = DefineHierarchicalCursor( TZZOLODO_Hier, "LOD_EntityParent" );
   //:LOOP WHILE nRC >= zCURSOR_SET
   while ( nRC >= zCURSOR_SET )
   { 

      //: IF nRC = zCURSOR_SET_RECURSIVECHILD
      if ( nRC == zCURSOR_SET_RECURSIVECHILD )
      { 
         //: SetViewToSubobject( TZZOLODO_Hier, "LOD_EntityChild" )
         SetViewToSubobject( TZZOLODO_Hier, "LOD_EntityChild" );
      } 

      //: END

      //: // Set up our temp view from the hier view.
      //: GetAbsolutePositionForEntity( lAbsPos, TZZOLODO_Hier, "LOD_EntityParent" )
      GetAbsolutePositionForEntity( &lAbsPos, TZZOLODO_Hier, "LOD_EntityParent" );
      //: SetCursorAbsolutePosition( szEntityName, TZZOLODO, lAbsPos )
      SetCursorAbsolutePosition( szEntityName, TZZOLODO, lAbsPos );

      //: IF szEntityName = "LOD_EntityParent"
      if ( ZeidonStringCompare( szEntityName, 1, 0, "LOD_EntityParent", 1, 0, 101 ) == 0 )
      { 

         //:  SET CURSOR FIRST TZZOLODO.POD_Entity
         //:             WHERE TZZOLODO.TE_DBMS_SourceForEntity.ZKey = lDataSourceZKey
         RESULT = SetCursorFirstEntity( TZZOLODO, "POD_Entity", "" );
         if ( RESULT > zCURSOR_UNCHANGED )
         { 
            while ( RESULT > zCURSOR_UNCHANGED && ( CompareAttributeToInteger( TZZOLODO, "TE_DBMS_SourceForEntity", "ZKey", lDataSourceZKey ) != 0 ) )
            { 
               RESULT = SetCursorNextEntity( TZZOLODO, "POD_Entity", "" );
            } 

         } 


         //:  IF RESULT >= zCURSOR_SET
         if ( RESULT >= zCURSOR_SET )
         { 
            //:  TZZOLODO.POD_Entity.SQL_JoinWithParent = "N"
            SetAttributeFromString( TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "N" );
         } 

         //:  END
      } 

      //: END

      //: nRC = SetCursorNextEntityHierarchical( sReturnLevel, szEntityName, TZZOLODO_Hier )
      nRC = SetCursorNextEntityHierarchical( (zPUSHORT) &sReturnLevel, szEntityName, TZZOLODO_Hier );
   } 

   //:END

   //:DropView( TZZOLODO_Hier )
   DropView( TZZOLODO_Hier );
   //:DropView( TZZOLODO )
   DropView( TZZOLODO );

   //:RefreshCtrl( vSubtask, "JoinCheck" )
   RefreshCtrl( vSubtask, "JoinCheck" );
   return( 0 );
// END
} 
예제 #28
0
//:   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
} 
예제 #29
0
파일: xwdgen.c 프로젝트: arksoftgit/10c
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;

}
예제 #30
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 );
}