Beispiel #1
0
//:   STRING(60)  szText
zOPER_EXPORT zSHORT OPERATION
oTZBRAU2O_DeletedText( zVIEW     ViewtoInstance,
                       LPVIEWENTITY InternalEntityStructure,
                       LPVIEWATTRIB InternalAttribStructure,
                       zSHORT    GetOrSetFlag )
{
   zCHAR     szText[ 61 ] = { 0 }; 


   //:CASE GetOrSetFlag
   switch( GetOrSetFlag )
   { 
      //:OF   zDERIVED_GET:
      case zDERIVED_GET :
         //:IF ViewtoInstance.AuditTrailMeta.bDeleted = "Y"
         if ( CompareAttributeToString( ViewtoInstance, "AuditTrailMeta", "bDeleted", "Y" ) == 0 )
         { 
            //: szText = "Deleted"
            ZeidonStringCopy( szText, 1, 0, "Deleted", 1, 0, 61 );
            //:ELSE
         } 
         else
         { 
            //: IF ViewtoInstance.AuditTrailMeta.bDeleted = "N"
            if ( CompareAttributeToString( ViewtoInstance, "AuditTrailMeta", "bDeleted", "N" ) == 0 )
            { 
               //: szText = "Updated"
               ZeidonStringCopy( szText, 1, 0, "Updated", 1, 0, 61 );
               //:ELSE
            } 
            else
            { 
               //: szText = ""
               ZeidonStringCopy( szText, 1, 0, "", 1, 0, 61 );
            } 

            //: END
         } 

         //: END
         //:StoreValueInRecord( ViewtoInstance,
         //:                   InternalEntityStructure,
         //:                   InternalAttribStructure,
         //:                    szText, 0 )
         StoreValueInRecord( ViewtoInstance, InternalEntityStructure, InternalAttribStructure, szText, 0 );
         break ;

      //:  /* end zDERIVED_GET */
      //:OF   zDERIVED_SET:
      case zDERIVED_SET :
         break ;
   } 


   //:     /* end zDERIVED_SET */
   //:END  /* case */
   return( 0 );
// END
} 
Beispiel #2
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: oTZEREMDO_FactTypeType
//
// PURPOSE:   Derived function to set the type of FactType entry, whether
//            Attribute ("ATR") or Relationship ("REL").
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZEREMDO_FactTypeType( zVIEW            vTZEREMDO,
                        LPVIEWENTITY     lpViewEntity,
                        LPVIEWATTRIB     lpViewAttrib,
                        zSHORT           nMsg )
{
   if ( CheckExistenceOfEntity( vTZEREMDO, "ER_AttributeIdentifier" ) >= zCURSOR_SET )
   {
      StoreValueInRecord( vTZEREMDO, lpViewEntity, lpViewAttrib, "ATR", 0 );
   }
   else
   {
      StoreValueInRecord( vTZEREMDO, lpViewEntity, lpViewAttrib, "REL", 0 );
   }

   return( 0 );
}
Beispiel #3
0
/////////////////////////////////////////////////////////////////////////////
// OPERATION: oTZWDLGSO_DIL_Inherited_Opt
// PURPOSE:   Temporary only.  To be deleted..
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZWDLGSO_DIL_Inherited_Opt( zVIEW        vIn,
                             LPVIEWENTITY lpViewEntity,
                             LPVIEWATTRIB lpViewAttrib,
                             zSHORT       nMsg )
{
   // This operation is temporary and should be deleted along with the derived
   // attribute when no portable files include a value for this attribute.
   if ( nMsg == zDERIVED_GET )
   {
      StoreValueInRecord( vIn, lpViewEntity, lpViewAttrib, "", 0 );
   }

   return( 0 );
}
Beispiel #4
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 );
}
Beispiel #5
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: oTZVSPOOO_C_GenOperationName
//
// PURPOSE:   For Object and Local operations, concatenate the LOD
//            name in front of the VML operation name.
//            For others, just use the regular operation name.
//            The Type for a Local Oper is L.
//            The Types for Object operations are either O, T, C, E or A.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZVSPOOO_C_GenOperationName( zVIEW  PIView,
                              LPVIEWENTITY EntityStructure,
                              LPVIEWATTRIB AttributeStructure,
                              zSHORT nGetOrSetFlag )
{
   zCHAR  szTempName1[ 64 ];
   zCHAR  szTempName2[ 32 ];
   zCHAR  szType[ 2 ];
   zLONG  lZKey;
   zVIEW  vTempView;

   // Set up a temporary view so that PIView remains unchanged
   CreateViewFromViewForTask( &vTempView, PIView, 0 );

   // Position on the corresponding OperationSource for Operation entity
   GetIntegerFromAttribute( &lZKey, vTempView, "Operation", "ZKey" );
   SetCursorFirstEntityByInteger( vTempView, "OperationSource", "ZKey",
                                  lZKey, "VML_XSource" );

   GetStringFromAttribute( szType, vTempView, "Operation", "Type" );
   if ( szType[ 0 ] == 'L' ||
        szType[ 0 ] == 'O' ||
        szType[ 0 ] == 'T' ||
        szType[ 0 ] == 'C' ||
        szType[ 0 ] == 'E' ||
        szType[ 0 ] == 'A' )
   {
      szTempName1[ 0 ] = 'o';
      GetStringFromAttribute( szTempName1 + 1, vTempView,
                              "VML_XSource", "MetaName" );
      zstrcat( szTempName1, "_" );
      GetStringFromAttribute( szTempName2, vTempView, "Operation", "Name" );
      zstrcat( szTempName1, szTempName2 );
   }
   else
      GetStringFromAttribute( szTempName1, vTempView, "Operation", "Name" );


   StoreValueInRecord( vTempView, EntityStructure, AttributeStructure,
                       szTempName1, 0 );

   // Get rid of temporary view
   DropView( vTempView );

   return( 0 );
}
Beispiel #6
0
/////////////////////////////////////////////////////////////////////////////
// OPERATION: oTZWDLGSO_DIL_TextMsg    // THIS MUST STAY AS TZWDLGSO UNTIL
//                                     // WE CAN CHANGE THE SOURCE FILE
//                                     // FOR A LOD OPERATION (I DON'T
//                                     // KNOW HOW ... DKS 9-9-1995)
// PURPOSE:   This derived attribute gets the DIL text by using the 'local'
//            persistent DIL_Text attr or the derived DIL_Inherited attr.
//            NOTE: The operation uses the name of the 'invoking' entity
//                  in order to be used by both LOD_Attribute and
//                  LOD_AttributeRec.
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZWDLGSO_DIL_TextMsg( zVIEW            vIn,
                       LPVIEWENTITY     lpViewEntity,
                       LPVIEWATTRIB     lpViewAttrib,
                       zSHORT           nMsg )
{
   zPCHAR       szAttr;
   zCHAR        szNull = 0;

   szAttr = &szNull;
   // This is currently a no-op.  The operation and derived attribute should
   // be removed when no portable files exist that contain occurrences of the
   // attribute value.
   if ( nMsg == zDERIVED_GET )
   {
      // Null attribute value.
      StoreValueInRecord( vIn, lpViewEntity, lpViewAttrib, "", 0 );
   }

   return( 0 );
}
Beispiel #7
0
/////////////////////////////////////////////////////////////////////////////
// OPERATION: oTZWDLGSO_DIL_Inherited_Ctrl
// PURPOSE:   This derived attribute determines the DIL message by the following
//            algorithm.
//            1. If the control is a Radio or Push button, the Control Text
//               attribute is used.
//            2. If there is no mapping, the Control Text attribute is used.
//            3. If there is mapping, we will use the Domain's Context to
//               determine the DIL Text.  If there is a Context specified for
//               the Control, that Context will be used.  Otherwise the default
//               Context will be used.
//            NOTE: The operation is designed for Control only.
//                  It will not handle CtrlCtrl, Option, or OptOpt.
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
oTZWDLGSO_DIL_Inherited_Ctrl( zVIEW         vIn,
                              LPVIEWENTITY  lpViewEntity,
                              LPVIEWATTRIB  lpViewAttrib,
                              zSHORT        nMsg )
{
   zPCHAR       szAttr;
   zVIEW        vDomain;
   zLONG        lZKey;

   // If this is a derived retrieval call, then assign the attribute
   // using the derivation formula defined above
   if ( nMsg == zDERIVED_GET )
   {
      GetAddrForAttribute( &szAttr, vIn, "ControlDef", "Tag" );
      if ( lstrcmp( szAttr, "Radio" ) == 0 ||
           lstrcmp( szAttr, "Push" ) == 0 )
      {
         GetAddrForAttribute( &szAttr, vIn, "Control", "Text" );
      }
      else
      {
         if ( CheckExistenceOfEntity( vIn, "CtrlMapER_Domain" )
                                                            < zCURSOR_SET )
         {
            // no mapping so use text of control
            GetAddrForAttribute( &szAttr, vIn, "Control", "Text" );
         }
         else
         {
            // OK, This is where we use the mapping
            // Context/Domain info to determine what the DIL needs to be.

            // First get a view to the Domain.
            GetIntegerFromAttribute( &lZKey, vIn, "CtrlMapER_Domain", "ZKey" );
            ActivateMetaOI_ByZKey( vIn, &vDomain, 0,
                                   zREFER_DOMAIN_META, zSINGLE,
                                   lZKey, zCURRENT_OI );
            if ( CheckExistenceOfEntity( vIn, "CtrlMapContext" )
                                                            >= zCURSOR_SET )
            {
               // If there is a Context override, position on that Context.
               GetIntegerFromAttribute( &lZKey, vIn, "CtrlMapContext", "ZKey" );
               SetCursorFirstEntityByInteger( vDomain, "Context", "ZKey", lZKey, 0 );
            }
            else
               // If there is no Context override, position on the default
               // Context.
               SetCursorFirstEntityByString( vDomain, "Context", "IsDefault", "Y", 0 );

            // Now retrieve the DIL Message from the Context.
            GetAddrForAttribute( &szAttr, vDomain, "Context", "DIL_NLS_Text" );
            if ( szAttr[ 0 ] == 0 )
            {
               GetAddrForAttribute( &szAttr, vDomain, "Context",
                                    "DIL_Inherited" );
            }

            DropView( vDomain );
         }
      }

      // Update the value of the DIL message text in the object
      StoreValueInRecord( vIn, lpViewEntity, lpViewAttrib, szAttr, 0 );
   }

   return( 0 );
}
Beispiel #8
0
/////////////////////////////////////////////////////////////////////////////
//
//  OPERATION: AlphaNumericUpperStrip
//
// Strip all non-alphanumerics and upper case all characters
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zLONG OPERATION
AlphaNumericUpperStrip( zLONG lEntryType,
            LPDOMAINDATA lpDomainData )
{
   zSHORT         nRC;
   zSHORT         nWChar;
   zCHAR          szWorkString[ 512 ];
   zPCHAR         pszStringToStore;
   zPLONG         lplInteger;
   zLONG          lWork;
   LPDOMAIN       lpDomain;
   zCHAR          szNullS[ 2 ];
   zLONG          lNullInteger = -2147483647 - 1;

   nRC = zDME_NOT_HANDLED;         // Default to not-handled.
   szNullS[ 0 ] = 0;

   lpDomain = (LPDOMAIN) SysGetPointerFromHandle( lpDomainData->lpViewAttribute->hDomain );

   switch ( lEntryType )
   {
      case zDME_VALIDATE_LPDATA:
      case zDME_SET_ATTRIBUTE:
         if ( lpDomainData->lpViewAttribute->cType == zTYPE_STRING )
         {
            szWorkString[ 0 ] = 0;

            // determine input data type
            switch ( lpDomainData->cType )
            {
               case zTYPE_STRING:
                  // string to string
                  pszStringToStore = (zPCHAR) lpDomainData->lpData;
                  if ( lpDomainData->lpData == 0 )
                     pszStringToStore = szWorkString;

                  break;

               case zTYPE_INTEGER:
                  // convert long to a string
                  lplInteger = (zPLONG) lpDomainData->lpData;
                  if ( *lplInteger != lNullInteger )
                     zltoa( *lplInteger, szWorkString );

                  pszStringToStore = szWorkString;
                  break;

               case zTYPE_DATETIME:
                  // convert DateTime to String
                  nRC = UfDateTimeToString( (LPDATETIME) lpDomainData->lpData,
                                            szWorkString, 18 );
                  if ( nRC == zCALL_ERROR )
                     return( nRC );

                  pszStringToStore = szWorkString;
                  break;

               default:
                  szWorkString[ 0 ] = lpDomainData->cType;
                  szWorkString[ 1 ] = 0;
                  strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
                  strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
                  // "TZDME001 - Invalid Input Data Type"
                  SendDomainError( lpDomainData->zView, lpDomain, 8, 1, 0,
                                   szWorkString,
                                   lpDomainData->lpViewAttribute->szName );
                  return( zCALL_ERROR );
            }

            // transfer all alphanumeric characters
            zPCHAR  psz;
            nWChar = 0;

            for ( psz = (zPCHAR) lpDomainData->lpData; *psz; psz++ )
            {
               if ( zisalnum( *psz ) )
               {
                  szWorkString[ nWChar++ ] = ztoupper( *psz );
               }
            }

            szWorkString[ nWChar ] = 0;

            // finally store it
            if ( lEntryType == zDME_SET_ATTRIBUTE )
            {
               nRC = StoreValueInRecord( lpDomainData->zView,
                                         lpDomainData->lpViewEntity,
                                         lpDomainData->lpViewAttribute,
                                         szWorkString, 0 );
            }
            else
               nRC = 0;
         }
         else
         {
            szWorkString[ 0 ] = lpDomainData->lpViewAttribute->cType;
            szWorkString[ 1 ] = 0;
            strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
            strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );

            // "TZDME003 - Attribute Type invalid for this Domain"
            SendDomainError( lpDomainData->zView, lpDomain, 8, 3, 0,
                             szWorkString,
                             lpDomainData->lpViewAttribute->szName );
            return( zCALL_ERROR );
         }

         break;

      case zDME_GET_VARIABLE:

         if ( lpDomainData->lpViewAttribute->cType == zTYPE_STRING )
         {
            zPCHAR   lpAttrAddr;
            zCHAR    cAttrType;
            zULONG   uAttrLength;

            if ( lpDomainData->cType != zTYPE_PIC )
            {
               nRC = GetValueFromRecord( lpDomainData->zView,
                                         lpDomainData->lpViewEntity,
                                         lpDomainData->lpViewAttribute,
                                         &lpAttrAddr, &cAttrType,
                                         &uAttrLength );
               if ( nRC )
                  return( zCALL_ERROR );
            }

            // determine input data type
            switch ( lpDomainData->cType )
            {
               case zTYPE_STRING:
                  if ( (zPCHAR) lpAttrAddr == 0 ) //null string
                  {
                     *((zPCHAR) lpDomainData->lpData) = 0;
                     nRC = -1;   // indicate attribute is null
                  }
                  else
                  {
                     *((zPCHAR) lpDomainData->lpData ) = 0;
                     zstrncat( (zPCHAR) lpDomainData->lpData,
                               (zPCHAR) lpAttrAddr,
                               lpDomainData->uMaxStringLength );
                     nRC = 0;
                  }

                  break;

               case zTYPE_INTEGER:
                  // convert string to long
                  if ( (zPCHAR) lpAttrAddr == 0 ) //null string
                  {
                     *((zPLONG) lpDomainData->lpData) = 0;
                     nRC = -1;   // indicate attribute is null
                  }
                  else
                  {
                     strcpy_s( szWorkString, zsizeof( szWorkString ), (zPCHAR) lpAttrAddr );
                     *((zPLONG) lpDomainData->lpData) = atol( szWorkString );
                     nRC = 0;
                  }

                  break;

               case zTYPE_PIC:
                  // return the picture string for the given context
                  {
                     zLPCONTEXT   lpContext;

                     if ( GetContext( &lpContext, lpDomain,
                                      lpDomainData->pszContextName ) )
                     {
                        zPCHAR lpEditString = (zPCHAR) SysGetPointerFromHandle( lpContext->hEditString );

                        if ( lpEditString && *lpEditString )
                           strcpy_s( (zPCHAR) lpDomainData->lpData, lpDomainData->uMaxStringLength,
                                    lpEditString );
                        else
                           *((zPCHAR) lpDomainData->lpData) = 0;

                        nRC = 0;
                     }
                     else
                     {
                        // "TZDME008 - Could not find context for Domain "
                        SendDomainError( lpDomainData->zView, lpDomain, 8, 8, 0,
                                         TrueName( lpDomainData->pszContextName, zSHOW_ZKEY ),
                                         lpDomainData->lpViewAttribute->szName );
                        nRC = zCALL_ERROR;
                     }
                  }

                  break;

               default:
                  szWorkString[ 0 ] = lpDomainData->cType;
                  szWorkString[ 1 ] = 0;
                  strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
                  strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
                  // "TZDME001 - Invalid Input Data Type"
                  SendDomainError( lpDomainData->zView, lpDomain, 8, 1,
                                   0, szWorkString, lpDomainData->lpViewAttribute->szName );
                  return( zCALL_ERROR );
            }

            nRC = 0;
         }
         else
         {
            szWorkString[ 0 ] = lpDomainData->lpViewAttribute->cType;
            szWorkString[ 1 ] = 0;
            strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
            strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
            // "TZDME003 - Attribute Type invalid for this Domain"
            SendDomainError( lpDomainData->zView, lpDomain, 8, 3, 0,
                             szWorkString, lpDomainData->lpViewAttribute->szName );
            return( zCALL_ERROR );
         }

      case zDME_COMPARE_ATTRIBUTE:
         if ( lpDomainData->lpViewAttribute->cType == zTYPE_STRING )
         {
            zPCHAR   lpAttrAddr;
            zCHAR    cAttrType;
            zULONG   uAttrLength;

            nRC = GetValueFromRecord( lpDomainData->zView, lpDomainData->lpViewEntity, lpDomainData->lpViewAttribute,
                                      &lpAttrAddr, &cAttrType, &uAttrLength );
            if ( nRC )
               return( zCALL_ERROR );

            if ( lpAttrAddr == 0 )
               lpAttrAddr = szNullS;

            // determine input data type
            switch ( lpDomainData->cType )
            {
               case zTYPE_STRING:
                  if ( lpDomainData->lpViewAttribute->bCaseSens )
                     nRC = zstrcmp( lpAttrAddr, (zPCHAR) lpDomainData->lpData );
                  else
                     nRC = zstrcmpi( lpAttrAddr, (zPCHAR) lpDomainData->lpData );

                  break;

               case zTYPE_INTEGER:
                  lWork = zatol( lpAttrAddr );
                  lWork -= *((zPLONG) lpDomainData->lpData);
                  nRC = (lWork == 0) ? 0 : (lWork < 0) ? -1 : 1;
                  break;

               default:
                  szWorkString[ 0 ] = lpDomainData->cType;
                  szWorkString[ 1 ] = 0;
                  strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
                  strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
                  // "TZDME001 - Invalid Input Data Type"
                  SendDomainError( lpDomainData->zView, lpDomain, 8, 1, 0, szWorkString,
                                   lpDomainData->lpViewAttribute->szName );
                  return( zCALL_ERROR );
            }
         }
         else
         {
            szWorkString[ 0 ] = lpDomainData->lpViewAttribute->cType;
            szWorkString[ 1 ] = 0;
            strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
            strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );
            // "TZDME003 - Attribute Type invalid for this Domain"
            SendDomainError( lpDomainData->zView, lpDomain, 8, 3, 0,
                             szWorkString, lpDomainData->lpViewAttribute->szName );
            return( zCALL_ERROR );
         }

         break;

      case zDME_GET_COMPARE_VALUE:
         switch ( lpDomainData->cType )
         {
            case zTYPE_STRING:
               nRC = 0;
               break;

            case zTYPE_INTEGER:
               zltoa( *((zPLONG) lpDomainData->lpData), szWorkString );
               strcpy_s( (zPCHAR) lpDomainData->lpData, lpDomainData->uMaxStringLength, szWorkString );
               nRC = 1; // indicate returning a string value
               break;

            default:
               szWorkString[ 0 ] = lpDomainData->cType;
               szWorkString[ 1 ] = 0;
               strcat_s( szWorkString, zsizeof( szWorkString ), ", " );
               strcat_s( szWorkString, zsizeof( szWorkString ), lpDomainData->lpViewEntity->szName );

               // "TZDME001 - Invalid Input Data Type"
               SendDomainError( lpDomainData->zView, lpDomain, 8, 1, 0,
                                szWorkString, lpDomainData->lpViewAttribute->szName );
               nRC = -2;
         }

         break;

      case zDME_ADD_TO_ATTRIBUTE:
      case zDME_GET_FIRST_TBL_ENT_FOR_ATTR:
      case zDME_GET_NEXT_TBL_ENT_FOR_ATTR:
      case zDME_SET_ATTRIBUTE_VALUE_NEXT:
      case zDME_SET_ATTRIBUTE_VALUE_PREV:
      default:
         // Entry not handled
         return( zDME_NOT_HANDLED );
   }

   return( nRC );

} // AlphaNumericUpperStrip