コード例 #1
0
static BOOL FillStructureFromControls (HWND hwnd)
{
   HWND hwndObjectType = GetDlgItem (hwnd, IDC_LOCATE_OBJECTTYPE);
   HWND hwndDatabase   = GetDlgItem (hwnd, IDC_LOCATE_DATABASE);
   HWND hwndFind       = GetDlgItem (hwnd, IDC_LOCATE_FIND);
   LPLOCATEPARAMS lplocate   = GetDlgProp (hwnd);

   int  nSel;
   char szObjectType [MAXOBJECTNAME];
   char szDatabase   [MAXOBJECTNAME];
   char szFind       [MAXOBJECTNAME];

   ZEROINIT (szObjectType);
   ZEROINIT (szDatabase  );
   ZEROINIT (szFind      );

   ComboBox_GetText (hwndObjectType, szObjectType, sizeof (szObjectType));
   if (IsWindowEnabled (hwndDatabase))
       ComboBox_GetText (hwndDatabase  , szDatabase  , sizeof (szDatabase  ));
   Edit_GetText (hwndFind, szFind, sizeof (szFind));
   if ((nSel = ComboBox_GetCurSel (hwndObjectType)) != CB_ERR)
       lplocate->ObjectType = Obj4locate() [nSel];
   else
       lplocate->ObjectType = -1;

   x_strcpy (lplocate->DBName,     szDatabase);
   x_strcpy (lplocate->FindString, szFind);
   if (!ProhibitString_all2 (hwnd))
       return FALSE;

   return TRUE;
}
コード例 #2
0
BOOL IsLocalNodeName(LPCTSTR nodeName, BOOL bCanContainServerClass)
{
  CString csLocal;
  csLocal.LoadString(IDS_I_LOCALNODE);
  ASSERT (!csLocal.IsEmpty());
  if (csLocal.IsEmpty())
    csLocal = "(local)";

  // Remove server class if specified
  CString csNodeName = nodeName;
  if (bCanContainServerClass) {

    // First, remove user name from source node name.
    UCHAR nodeNameNoUser[MAXOBJECTNAME];
    x_strcpy((char*)nodeNameNoUser, (LPCTSTR)csNodeName);
    RemoveConnectUserFromString(nodeNameNoUser);
    csNodeName = nodeNameNoUser;

    UCHAR gwClassName[MAXOBJECTNAME];
    BOOL bHasGW = GetGWClassNameFromString((LPUCHAR)nodeName, gwClassName);
    UCHAR nodeNameNoGW[MAXOBJECTNAME];
    x_strcpy ((char*)nodeNameNoGW, (LPCTSTR)nodeName);
    if (bHasGW) {
      RemoveGWNameFromString(nodeNameNoGW);
      csNodeName = nodeNameNoGW;
    }
  }

  // Test
  if (csLocal.CompareNoCase(csNodeName) == 0)
    return TRUE;
  else
    return FALSE;
}
コード例 #3
0
static void FillAllComboCells(HWND hwnd, int maxLine)
{
   HWND hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER);
   LPSTORAGEPARAMS  lpstorage = GetDlgProp (hwnd);
   LPCHECKEDOBJECTS ls, lploc = GetLocations ();
   int     i, maxlen = 0;
   char*   item;
   char*   buffer;
   char*   first;

   ls = lploc;
   while (ls)
   {
       item   = (char*) ls->dbname;
       maxlen = maxlen + x_strlen (item) +1;

       ls = ls->pnext;
   }
   if (maxlen > 0)
   {
       buffer = ESL_AllocMem (maxlen +2);
       first  = buffer;

       ls = lploc;
       x_strcpy (buffer, (char*) ls->dbname);
       ls = ls->pnext;

       while (ls)
       {
           item   = (char*)  ls->dbname;
           buffer = buffer + x_strlen (buffer) +1;
           x_strcpy (buffer, item);

           ls = ls->pnext;
       }
       buffer = buffer + x_strlen (buffer) +1;
       x_strcpy (buffer, "");

       //
       // Fill all combos
       //

       for (i=1; i<maxLine; i++)
       {
           ContainerFillComboCell(
               hwndContainer,
               i,
               1,
               0,
               CONT_ALIGN_LEFT,
               first);
       }
       ESL_FreeMem (first);
       first = NULL;
   }
   lploc = FreeCheckedObjects (lploc);
}
コード例 #4
0
void ErrorMessage (UINT message_id, int reason)
{
   char MessageString [200];
   char Reason [80];
   char Message[200];
   HWND CurrentFocus;

   switch (reason)
   {
       case RES_ERR:
           x_strcpy (Reason, "");

           // Trial EMB
           #ifdef DISPLAY_SQLERR_MSG
           // Note : under debugger, we see that sqlcode has been reset
           // in the ReleaseSession/Rollback call
           // Also, the error text can be truncated - need full length
           if (sqlca.sqlcode < 0)
           wsprintf ( Reason, "error %ld : %s",
                      sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
           #endif
           break;
       case RES_TIMEOUT:
           LoadString (hResource, (UINT)IDS_I_TIMEOUT, (LPSTR)Reason, sizeof (Reason));
           break;
       case RES_NOGRANT:
           LoadString (hResource, (UINT)IDS_I_NOGRANT, (LPSTR)Reason, sizeof (Reason));
           break;
       case RES_ALREADYEXIST:
           LoadString (hResource, (UINT)IDS_I_OBJECT_ALREADY_EXIST, (LPSTR)Reason, sizeof (Reason));
           break;
       default:
           x_strcpy (Reason, "");
           break;
   }

   ZEROINIT (MessageString);
   if (message_id == (UINT)IDS_E_CANNOT_ALLOCATE_MEMORY)
       x_strcpy (MessageString, "Cannot allocate memory.");
   else
       LoadString (hResource, (UINT)message_id, MessageString, sizeof (MessageString));

   if (x_strlen (Reason) > 0)
       wsprintf (Message, "%s\n%s", Reason, MessageString);
   else
       wsprintf (Message, "%s", MessageString);

   CurrentFocus = GetFocus ();
   if (message_id == (UINT)IDS_E_CANNOT_ALLOCATE_MEMORY)
       MessageBox (NULL, Message, NULL, MB_ICONHAND|MB_SYSTEMMODAL|MB_OK);
   else {
       // MessageBox (NULL, Message, NULL, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL);
       MessageWithHistoryButton(CurrentFocus, Message);
   }
   SetFocus   (CurrentFocus);
}
コード例 #5
0
LONG CuDlgDomPropLocationSpace::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
  // cast received parameters
  int nNodeHandle = (int)wParam;
  LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
  ASSERT (nNodeHandle != -1);
  ASSERT (pUps);

  // ignore selected actions on filters
  switch (pUps->nIpmHint)
  {
    case 0:
    //case FILTER_DOM_SYSTEMOBJECTS:
    //case FILTER_DOM_BASEOWNER:
    //case FILTER_DOM_OTHEROWNER:
    //case FILTER_DOM_BKREFRESH:          // Special item - no refresh code
    //case FILTER_DOM_BKREFRESH_DETAIL:   // Special item - no refresh code
      break;

    default:
      return 0L;    // nothing to change on the display
  }

  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);

  LOCATIONDATAMIN locData;
  x_strcpy ((char *)locData.LocationName, (const char *)lpRecord->objName);
  x_strcpy ((char *)locData.LocationArea, (const char *)lpRecord->szComplim);
  // Just in case - Normally not used by Create method with 2 parameters
  locData.LocationUsages[0] = ATTACHED_NO;   // DATA_PATH
  locData.LocationUsages[1] = ATTACHED_NO;   // WORK_PATH
  locData.LocationUsages[2] = ATTACHED_NO;   // JNL_PATH
  locData.LocationUsages[3] = ATTACHED_NO;   // CHK_PATH
  locData.LocationUsages[4] = ATTACHED_NO;   // DMP_PATH

  try
  {
    ResetDisplay();
    CaPieInfoData* pPieInfo = m_pDlgFrame->GetPieInformation();
    pPieInfo->Cleanup();
    if (!Pie_Create(pPieInfo, nNodeHandle, &locData))
    {
        AfxMessageBox (IDS_E_LOCATION_SPACE, MB_ICONEXCLAMATION|MB_OK);
        pPieInfo->Cleanup();
    }
    m_pDlgFrame->UpdatePieChart();
    m_pDlgFrame->UpdateLegend();
  }
  catch (CMemoryException* e)
  {
      VDBA_OutOfMemoryMessage();
      e->Delete();
  }
  return 0L;
}
コード例 #6
0
// Query the current selection in a combobox type cell
// the received buffer must be of size MAXOBJECTNAME+1
BOOL ContainerGetComboCellSelection(HWND hwndCnt, int linenum, int colnum, char *buf)
{
  LPFIELDINFO     lpFld;
  GENCNTR_COLUMN  column;
  int             cpt;
  char           *pItem;
  LPRECORDCORE    hLine;

  hLine = MakeHLineFromLineNum(hwndCnt, linenum);

  // query lpFld from hline and colnum
  lpFld = QueryLpFld(hwndCnt, hLine, colnum);
  if (!lpFld)
    return FALSE;

  // extract data from cell
  if (!CntFldDataGet(hLine, lpFld, 0, (LPVOID)&column))
    return FALSE;

  // check the cell is a combo
  if (column.type != CONT_COLTYPE_COMBO)
    return FALSE;

  // return the nth string
  pItem = column.ucol.sCombo.pItems;  // first item
  for (cpt=0; cpt<column.ucol.sCombo.selection; cpt++)
    pItem += x_strlen(pItem) + 1;
  x_strcpy(buf, pItem);
  return TRUE;
}
コード例 #7
0
static LPCHECKEDOBJECTS GetLocations ()
{
   int  hdl, ires;
   BOOL bwsystem;
   char buf [MAXOBJECTNAME];
   char buffilter [MAXOBJECTNAME];
   LPCHECKEDOBJECTS obj, list = NULL;  
   ZEROINIT (buf);
   ZEROINIT (buffilter);

   hdl      = GetCurMdiNodeHandle ();
   // Force to TRUE so as II_DATABASE is picked up.
   bwsystem = TRUE;
       
   ires     = DOMGetFirstObject (hdl, OT_LOCATION, 0, NULL, bwsystem, NULL, buf, NULL, NULL);
   while (ires == RES_SUCCESS)
   {
      BOOL bOK;
      if (DOMLocationUsageAccepted(hdl,buf,LOCATIONDATABASE,&bOK)==
          RES_SUCCESS && bOK) {
          obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
          if (obj)
          {
             x_strcpy (obj->dbname, buf);
             obj->pnext = NULL;
             list = AddCheckedObject (list, obj);
          }
      }
      ires  = DOMGetNextObject (buf, buffilter, NULL);
   }
   return list;
}
コード例 #8
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   char    szFormat [100];
   char    szTitle  [MAX_TITLEBAR_LEN];

   LPLOCATEPARAMS lplocate = (LPLOCATEPARAMS)lParam;

   if (!AllocDlgProp (hwnd, lplocate))
       return FALSE;

   LoadString (hResource, (UINT)IDS_T_LOCATE, szFormat, sizeof (szFormat));
   wsprintf (szTitle, szFormat,  GetVirtNodeName (GetCurMdiNodeHandle ()));
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_LOCATE));

   //
   // Load the string "(all)"
   //
   if (LoadString (hResource, (UINT)IDS_I_LOCATE_ALL, String_all, sizeof (String_all)) == 0)
       x_strcpy (String_all, "(all)");

   FillObjectTypes (hwnd);
   ComboBoxFillDatabases (GetDlgItem (hwnd, IDC_LOCATE_DATABASE));

   if (ComboBox_GetCount (GetDlgItem (hwnd, IDC_LOCATE_OBJECTTYPE)) > 0)
       ComboBox_SetCurSel(GetDlgItem (hwnd, IDC_LOCATE_OBJECTTYPE), 0);

   Edit_LimitText (GetDlgItem (hwnd, IDC_LOCATE_FIND), MAXOBJECTNAME -1);
   Edit_SetText   (GetDlgItem (hwnd, IDC_LOCATE_FIND), String_all);
   EnableDisableOKButton (hwnd);

   richCenterDialog(hwnd);
   return TRUE;
}
コード例 #9
0
static LPTABLExFILE AddElement (LPTABLExFILE lpFile, char* aTable)
{
   LPTABLExFILE obj = (LPTABLExFILE) ESL_AllocMem (sizeof (TABLExFILE));
   if (!obj)
   {
       lpFile = FreeTableAndFile (lpFile);
       ErrorMessage ((UINT) IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
       return (lpFile);
   }
   else
   {
       LPTABLExFILE plistbegin = lpFile;
       x_strcpy (obj->TableName, aTable);  // Prefixed by owner
       obj->next = NULL;

       // find the last object in the list
       while (lpFile)
       {
           if (!lpFile->next)
               break;
           lpFile=lpFile->next;
       }

       if (lpFile)
           lpFile->next = obj;
       else
       {
           lpFile = obj; // At the present time no element in the list.
           plistbegin = lpFile;
       }

       return (plistbegin);
   }
}
コード例 #10
0
BOOL CxDlgObjectComment::FillListColumnWithComment( void )
{
	//
	// Get Session
	int hdl, nRes = RES_ERR ;
	TCHAR tcDBName      [MAXOBJECTNAME];
	TCHAR tcObjectName  [MAXOBJECTNAME];
	TCHAR tcObjectOwner [MAXOBJECTNAME];
	CString strSess;
	m_tcObjComment = NULL;
	CString strVNodeName = (LPTSTR)GetVirtNodeName(m_nNodeHandle);

	x_strcpy(tcDBName,m_csDBName);
	x_strcpy(tcObjectName, m_csObjectName );
	x_strcpy(tcObjectOwner,m_csObjectOwner);

	strSess.Format (_T("%s::%s"), 
	(LPTSTR)(LPCTSTR)strVNodeName, 
	(LPTSTR)(LPCTSTR)m_csDBName);
	nRes = Getsession ((LPUCHAR)(LPCTSTR)strSess, SESSION_TYPE_CACHEREADLOCK, &hdl);
	if (nRes != RES_SUCCESS)
	{
		TRACE0 (_T("CxDlgObjectComment::FillListColumnWithComment(): Fail to Get the session\n"));
		return FALSE;
	}

	nRes = SQLGetComment( (LPTSTR)(LPCTSTR)strVNodeName, tcDBName, tcObjectName, tcObjectOwner,
	                      &m_tcObjComment, m_ListColumn);

	ReleaseSession (hdl, RELEASE_COMMIT);

	if (nRes != RES_SUCCESS)
	{
		CString csMsg;
		csMsg.LoadString(IDS_E_COMMENTS_FAILED);
		MessageWithHistoryButton(m_hWnd,csMsg);
		return FALSE;
	}

	if (m_tcObjComment)
		SetCommentObject(m_tcObjComment);

	return TRUE;
}
コード例 #11
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPSECURITYALARMPARAMS lpsecurity   = (LPSECURITYALARMPARAMS)lParam;
   HWND    hwndUsers    = GetDlgItem (hwnd, IDC_REFALARM_BYUSER  );
   HWND    hwndDatabase = GetDlgItem (hwnd, IDC_REFALARM_DATABASE);
   HWND    hwndTables   = GetDlgItem (hwnd, IDC_REFALARM_ONTABLE );
   char    szTitle  [MAX_TITLEBAR_LEN];
   char    szFormat [100];
   char    szDatabaseName [MAXOBJECTNAME];

   if (!AllocDlgProp (hwnd, lpsecurity))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();

   LoadString (hResource, (UINT)IDS_T_CREATE_SECURITY, szFormat, sizeof (szFormat));

   wsprintf (szTitle, szFormat,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lpsecurity->DBName);
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REFALARM));

   //
   // Get the available database names and insert them into the combo box
   //
   ComboBoxFillDatabases (hwndDatabase);
   ComboBoxSelectFirstStr(hwndDatabase);
   ComboBox_GetText (hwndDatabase, szDatabaseName, sizeof (szDatabaseName));
   if (x_strlen (szDatabaseName) > 0)
       x_strcpy (lpsecurity->DBName, szDatabaseName);

   //
   // Get the available table names and insert them into the table list 
   //
   if (x_strlen (lpsecurity->DBName) > 0)
   {
       if (!CAListBoxFillTables (hwndTables, lpsecurity->DBName, FALSE))
       {
           CAListBoxDestroyItemData (hwndTables);
           return FALSE;
       }
   }
   //
   // Get the available users names and insert them into the CA list box 
   // 

   CAListBoxFillUsersP (hwndUsers);
   PreCheckItem (hwnd);
   EnableDisableOKButton (hwnd);

   richCenterDialog (hwnd);
   return TRUE;
}
コード例 #12
0
static void FillObjectTypes (HWND hwnd)
{
   int  i;
   char item [MAXOBJECTNAME];
   HWND hwndObjectType = GetDlgItem (hwnd, IDC_LOCATE_OBJECTTYPE);

   for (i = 0; i < nbObj4locate(); i++)
   {
       x_strcpy (item, (char*) ObjectTypeString (Obj4locate()[i], FALSE));
       ComboBox_AddString (hwndObjectType, item);
   }
}
コード例 #13
0
static void AddFile (HWND hwnd, LPTABLExFILE lpFile)
{
   int     hdl, ires;
   BOOL    bwsystem;
   char    buf       [MAXOBJECTNAME];
   char    buf2      [MAXOBJECTNAME];
   char    szOwner   [MAXOBJECTNAME];
   LPUCHAR parentstrings [MAXPLEVEL];
   LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd);
   HWND hwndTables  = GetDlgItem (hwnd, IDC_AUDITDBF_TABLE);
   LPTABLExFILE
       ls  = lpFile,
       obj;
   char    szFileName[MAXOBJECTNAME];

   ZEROINIT (buf);
   parentstrings [0] = lpauditdb->DBName;
   parentstrings [1] = NULL;

   hdl      = GetCurMdiNodeHandle ();
   bwsystem = GetSystemFlag ();

   ires = DOMGetFirstObject (
       hdl,
       OT_TABLE,
       1,
       parentstrings,
       bwsystem,
       NULL,
       buf,
       szOwner,
       NULL);
   while (ires == RES_SUCCESS)
   {
       StringWithOwner (buf, szOwner, buf2);
       obj = FindStringInListTableAndFile (ls, buf2);
       if (obj)
       {
           wsprintf (szFileName,   "%s.trl", RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(buf)));
           x_strcpy (obj->FileName,  szFileName);
       }

       ires    = DOMGetNextObject (buf, szOwner, NULL);
   }
}
コード例 #14
0
static LPOBJECTLIST InsertTableName (LPUCHAR tableName)
{
   LPOBJECTLIST list = NULL;
   LPOBJECTLIST obj;

   obj = AddListObject (list, x_strlen (tableName) +1);
   if (obj)
   {
       x_strcpy ((UCHAR *)obj->lpObject, tableName);
       list = obj;
   }
   else
   {
       //
       // Cannot allocate memory
       //
       list = NULL;
   }
   return (list);
}
コード例 #15
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPREPLMAILPARAMS lpmail  = GetDlgProp (hwnd);
   HWND    hwndMailText = GetDlgItem (hwnd, IDC_MAIL_TEXT);
   char    szText  [MAX_MAIL_TEXTLEN];

   switch (id)
   {
       case IDOK:
       {
           int ires;

           Edit_GetText (hwndMailText, szText, sizeof (szText));
           x_strcpy (lpmail->szMailText, szText);
           ires = DBAAddObject
               ( GetVirtNodeName ( GetCurMdiNodeHandle ()),
                 OT_REPLIC_MAILUSER,
                 (void *) lpmail);

           if (ires != RES_SUCCESS)
           {
               ErrorMessage ((UINT) IDS_E_REPLMAIL_FAILED, ires);
               break;
           }
           else
           {
               EndDialog (hwnd, TRUE);
           }
       }
       break;

       case IDCANCEL:
           EndDialog (hwnd, FALSE);
           break;

       case IDC_MAIL_TEXT:
           EnableDisableOKButton (hwnd);
           break;
   }
}
コード例 #16
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
    LPGROUPUSERPARAMS lpusr2grp = GetDlgProp (hwnd);

    switch (id)
    {
    case IDOK:
    {
        BOOL Success;
        HWND hwndUser = GetDlgItem (hwnd, IDC_USR2GRP_USERBOX);
        char szUser [MAXOBJECTNAME];

        ComboBox_GetText (hwndUser, szUser, sizeof (szUser));
        x_strcpy (lpusr2grp->ObjectName, szUser);

        Success = CreateObject (hwnd, lpusr2grp);

        if (!Success)
            break;
        else
            EndDialog (hwnd, TRUE);
    }
    break;


    case IDCANCEL:
        EndDialog (hwnd, FALSE);
        break;

    case IDC_USR2GRP_USERBOX:
    {
        switch (codeNotify)
        {
        case CBN_SELCHANGE:
            EnableDisableOKButton (hwnd);
        }
        break;
    }
    }
}
コード例 #17
0
static BOOL FillStructureFromControls (HWND hwnd)
{
   int  i;
   char buffer [MAXOBJECTNAME];
   LPOBJECTLIST
       list = NULL,
       obj;
   LPSTORAGEPARAMS  lpstorage = GetDlgProp (hwnd);
   HWND hwndContainer         = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER);


   // Mandatory in case current cell is a combo
   ContainerNewSel(hwndContainer);

   for (i=1; i<= nLine; i++)
   {
       ZEROINIT (buffer);
       ContainerGetComboCellSelection (hwndContainer, i, 1, buffer);
     
       obj = AddListObjectTail (&list, x_strlen (buffer) +1);
       if (obj)
       {
           x_strcpy ((UCHAR *)obj->lpObject, buffer);
           //list = obj;
       }
       else
       {
           FreeObjectList (list);
           list = NULL;
           return FALSE;
       }
   }
   FreeObjectList (lpstorage->lpNewLocations);
   lpstorage->lpNewLocations = NULL;
   lpstorage->lpNewLocations = list;

   return TRUE;
}
コード例 #18
0
LONG CuDlgDomPropTableColumns::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
  // cast received parameters
  int nNodeHandle = (int)wParam;
  LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
  ASSERT (nNodeHandle != -1);
  ASSERT (pUps);

  // ignore selected actions on filters
  switch (pUps->nIpmHint)
  {
    case 0:
    //case FILTER_DOM_SYSTEMOBJECTS:
    //case FILTER_DOM_BASEOWNER:
    //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH_DETAIL:
      if (m_Data.m_refreshParams.MustRefresh(pUps->pSFilter->bOnLoad, pUps->pSFilter->refreshtime))
        break;    // need to update
      else
        return 0; // no need to update
      break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListColumns);
        return 0L;
    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the object
  TABLEPARAMS tableparams;
  memset (&tableparams, 0, sizeof (tableparams));

  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();
  x_strcpy ((char *)tableparams.DBName,     (const char *)lpRecord->extra);
  x_strcpy ((char *)tableparams.objectname, RemoveDisplayQuotesIfAny((LPCTSTR)StringWithoutOwner(lpRecord->objName)));
  x_strcpy ((char *)tableparams.szSchema,   (const char *)lpRecord->ownerName);
  tableparams.detailSubset = TABLE_SUBSET_COLUMNSONLY;  // minimize query duration

  int dummySesHndl;
  int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle),
                               OT_TABLE,
                               &tableparams,
                               FALSE,
                               &dummySesHndl);
  if (iResult != RES_SUCCESS) {
    // Table may not exist if propagate too fast
    if (iResult != RES_ENDOFDATA)
      ASSERT (FALSE);

    // Reset m_Data
    CuDomPropDataTableColumns tempData;
    tempData.m_refreshParams = m_Data.m_refreshParams;
    m_Data = tempData;

    // Create error item and that's it!
    /* "<Data Unavailable>" */
    CuTblColumn tblColumn1(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE));
    m_Data.m_uaColumns.Add(tblColumn1);

    // Refresh display
    RefreshDisplay();

    return 0L;
  }

  // Update refresh info
  m_Data.m_refreshParams.UpdateRefreshParams();
  TCHAR *lpObjComment = NULL;
  int iret = RES_SUCCESS;
  LPOBJECTLIST ls ,lpColTemp,lpObjCol = NULL;
  LPCOMMENTCOLUMN lpCommentCol;
  ls = tableparams.lpColumns;
  while (ls)
  {
    lpColTemp = AddListObjectTail(&lpObjCol, sizeof(COMMENTCOLUMN));
    if (!lpColTemp)
    {
      // Need to free previously allocated objects.
      FreeObjectList(lpObjCol);
      lpObjCol = NULL;
      break;
    }
    LPCOLUMNPARAMS lstbl=(LPCOLUMNPARAMS)ls->lpObject;
    lpCommentCol = (LPCOMMENTCOLUMN)lpColTemp->lpObject;
    lstrcpy((LPTSTR)lpCommentCol->szColumnName,(LPCTSTR)(LPUCHAR)lstbl->szColumn);
    lpCommentCol->lpszComment = NULL;
    ls=(LPOBJECTLIST)ls->lpNext;
  }

  if (lpObjCol)
    iret = VDBAGetCommentInfo ( (LPTSTR)(LPUCHAR)GetVirtNodeName(nNodeHandle),
                                (LPTSTR)tableparams.DBName, (LPTSTR)tableparams.objectname,
                                (LPTSTR)tableparams.szSchema, &lpObjComment, lpObjCol);
  else
    ASSERT (FALSE);

  // update member variables, for display/load/save purpose

  // list of columns
  m_Data.m_uaColumns.RemoveAll();
  ls = tableparams.lpColumns;
  ASSERT (ls);    // No columns is unacceptable
  while (ls) {
    LPCOLUMNPARAMS lpCol = (LPCOLUMNPARAMS)ls->lpObject;
    ASSERT (lpCol);

    // Column name
    CString csName = lpCol->szColumn;

    // Format "column type"
    CString csType = "";
    if (lstrcmpi(lpCol->tchszInternalDataType, lpCol->tchszDataType) != 0)  {
      ASSERT (lpCol->tchszInternalDataType[0]);
      csType = lpCol->tchszInternalDataType;  // UDTs
      if (lstrcmpi(lpCol->tchszInternalDataType,VDBA_MfcResourceString(IDS_OBJECT_KEY)) == 0 ||
          lstrcmpi(lpCol->tchszInternalDataType,VDBA_MfcResourceString(IDS_TABLE_KEY) ) == 0) {
          if (lpCol->bSystemMaintained)
              csType += VDBA_MfcResourceString(IDS_SYSTEM_MAINTAINED);
          else
              csType += VDBA_MfcResourceString(IDS_NO_SYSTEM_MAINTAINED);
      }
    }
    else {
      LPUCHAR lpType;
      lpType = GetColTypeStr(lpCol);
      if (lpType) {
        csType = lpType;
        ESL_FreeMem(lpType);
      }
      else {
        // Unknown type: put type name "as is" - length will not be displayed
        csType = lpCol->tchszDataType;
	  }
    }

    // Format "default specification"
    CString csDefSpec = "";
    if (lpCol->lpszDefSpec)
      csDefSpec = lpCol->lpszDefSpec;

    // Format "Comment"
    CString csTblComment = "";
    LPOBJECTLIST LsObj = lpObjCol;
    LPCOMMENTCOLUMN lpCommentCol;

    while (LsObj)
    {
      lpCommentCol = (LPCOMMENTCOLUMN)LsObj->lpObject;
      if (strcmp((LPTSTR)lpCommentCol->szColumnName,(LPTSTR)lpCol->szColumn) == 0)
      {
        if (iret!=RES_SUCCESS && !lpCommentCol->lpszComment)
          csTblComment.LoadString(IDS_NOT_AVAILABLE);
        else
        {
            if (lpCommentCol->lpszComment)
              csTblComment = lpCommentCol->lpszComment;
        }
      }
      LsObj = (LPOBJECTLIST)LsObj->lpNext;
    }

    // item on the stack
    CuTblColumn tblColumn(csName,             // LPCTSTR name,
                          csType,             // LPCTSTR type, ??? Code complexe
                          lpCol->nKeySequence,// int primKeyRank,
                          lpCol->bNullable,   // BOOL bNullable,
                          lpCol->bDefault,    // BOOL bWithDefault,
                          csDefSpec,          // LPCTSTR defSpec
                          csTblComment );     // LPCTSTR comment on column
    CuMultFlag *pRefCol = m_Data.m_uaColumns.Find(&tblColumn);
    ASSERT (!pRefCol);
    m_Data.m_uaColumns.Add(tblColumn);

    // Loop on next column
    ls = (LPOBJECTLIST)ls->lpNext;
  }

  // liberate detail structure
  FreeAttachedPointers (&tableparams,  OT_TABLE);
  // liberate column comment
  ls = lpObjCol;
  while (ls)
  {
    lpCommentCol = (LPCOMMENTCOLUMN)ls->lpObject;
    if (lpCommentCol->lpszComment)
      ESL_FreeMem (lpCommentCol->lpszComment);
    ls = (LPOBJECTLIST)ls->lpNext;
  }
  FreeObjectList(lpObjCol);
  if (lpObjComment)
    ESL_FreeMem (lpObjComment);
  // Refresh display
  RefreshDisplay();

  return 0L;
}
コード例 #19
0
static BOOL FillStructureFromControls (HWND hwnd, LPSECURITYALARMPARAMS lpsecurity)
{
   char buf        [MAXOBJECTNAME];
//   char buffowner  [MAXOBJECTNAME];
//   char bufftable  [MAXOBJECTNAME];
   char szDBE      [MAXOBJECTNAME];
   char szName     [MAXOBJECTNAME];

   LPCHECKEDOBJECTS  obj;
   LPCHECKEDOBJECTS  list = NULL;
   int i, max_database_number, checked;

   HWND hwndDB         = GetDlgItem (hwnd, IDC_SALARM_ONTABLE);
   HWND hwndUsers      = GetDlgItem (hwnd, IDC_SALARM_BYUSER );
   HWND hwndSuccess    = GetDlgItem (hwnd, IDC_SALARM_SUCCESS);
   HWND hwndFailure    = GetDlgItem (hwnd, IDC_SALARM_FAILURE);
   HWND hwndSelect     = GetDlgItem (hwnd, IDC_SALARM_SELECT);
   HWND hwndDelete     = GetDlgItem (hwnd, IDC_SALARM_DELETE);
   HWND hwndInsert     = GetDlgItem (hwnd, IDC_SALARM_INSERT);
   HWND hwndUpdate     = GetDlgItem (hwnd, IDC_SALARM_UPDATE);
   HWND hwndConnect    = GetDlgItem (hwnd, IDC_SALARM_CONNECT);
   HWND hwndDisconnect = GetDlgItem (hwnd, IDC_SALARM_DISCONNECT);
   HWND hwndDBE        = GetDlgItem (hwnd, IDC_SALARM_DBEVENT);
   HWND hwndDBEText    = GetDlgItem (hwnd, IDC_SALARM_DBEVENT_TEXT);
   HWND hwndName       = GetDlgItem (hwnd, IDC_SALARM_NAME);

   x_strcpy (lpsecurity->DBName, "iidbdb");
   ZEROINIT (szName);
   Edit_GetText (hwndName, szName, sizeof (szName));
   x_strcpy (lpsecurity->ObjectName, szName);

   lpsecurity->bsuccfail [SECALARMSUCCESS] = Button_GetCheck (hwndSuccess);
   lpsecurity->bsuccfail [SECALARMFAILURE] = Button_GetCheck (hwndFailure);
   //
   // Get selection from
   // toggle buttons (Select, Delete, Insert, Update)
   //
   lpsecurity->baccesstype [SECALARMSEL]       = Button_GetCheck (hwndSelect);
   lpsecurity->baccesstype [SECALARMDEL]       = Button_GetCheck (hwndDelete);
   lpsecurity->baccesstype [SECALARMINS]       = Button_GetCheck (hwndInsert);
   lpsecurity->baccesstype [SECALARMUPD]       = Button_GetCheck (hwndUpdate);
   lpsecurity->baccesstype [SECALARMCONNECT]   = Button_GetCheck (hwndConnect   );
   lpsecurity->baccesstype [SECALARMDISCONN]   = Button_GetCheck (hwndDisconnect);
   
   //
   // Get the names of users that have been checked and
   // insert into the list
   //
  
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_USER)))
       lpsecurity->iAuthIdType = OT_USER;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_GROUP)))
       lpsecurity->iAuthIdType = OT_GROUP;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_ROLE)))
       lpsecurity->iAuthIdType = OT_ROLE;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_PUBLIC)))
       lpsecurity->iAuthIdType = OT_PUBLIC;
   else
       lpsecurity->iAuthIdType = OT_USER;

   max_database_number = CAListBox_GetCount (hwndUsers);
   
   
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_PUBLIC)))
   {
       obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
       if (!obj)
       {
           FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
           ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
           return FALSE;
       }
       else
       {
           x_strcpy (obj->dbname, lppublicsysstring());
           obj->bchecked = TRUE;
           list = AddCheckedObject (list, obj);
       }
   }

   for (i = 0; i < max_database_number; i++)
   {
       checked = CAListBox_GetSel (hwndUsers, i);
       if (checked == 1)
       {
           CAListBox_GetText (hwndUsers, i, buf);
           obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
           if (!obj)
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
           else
           {
               if (x_strcmp (buf, lppublicdispstring()) == 0)
                   x_strcpy (obj->dbname, lppublicsysstring());
               else
                   x_strcpy (obj->dbname, QuoteIfNeeded(buf));
               obj->bchecked = TRUE;
               list = AddCheckedObject (list, obj);
           }
       }
   }
   lpsecurity->lpfirstUser = list;

   //
   // Get the names of Database that have been checked and
   // insert into the list
   //
   
   max_database_number = CAListBox_GetCount (hwndDB);
   list = NULL;
   
   for (i=0; i<max_database_number; i++)
   {
       checked = CAListBox_GetSel (hwndDB, i);
       if (checked)
       {
           CAListBox_GetText (hwndDB, i, buf);

           obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
           if (!obj)
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
           else
           {
               x_strcpy (obj->dbname, buf);
               obj->bchecked = TRUE;
               list = AddCheckedObject (list, obj);
           }
       }
   }
   lpsecurity->lpfirstTable = list;

   ComboBox_GetText (hwndDBE, szDBE, sizeof (szDBE));
   if ((x_strlen (szDBE) > 0 ) && (x_strcmp (szDBE, szSecurityDBEvent) != 0))
   {
       char szOwner [MAXOBJECTNAME];
       char szAll   [MAXOBJECTNAME];
       int  len, nSel;

       nSel = ComboBox_GetCurSel (hwndDBE);
       x_strcpy (szOwner, (char *) ComboBox_GetItemData (hwndDBE, nSel));
       StringWithOwner  (szDBE, szOwner, szAll);
       x_strcpy (lpsecurity->DBEvent, szAll);
       len = Edit_GetTextLength (hwndDBEText);
       if (len > 0)
       {
           lpsecurity->lpDBEventText = ESL_AllocMem ((len*sizeof(TCHAR)) + sizeof(TCHAR));
           if (lpsecurity->lpDBEventText)
           {
             Edit_GetText (hwndDBEText, lpsecurity->lpDBEventText, len+1); // Emb 26/06/97: +1 was missing --> lost character
             if (EscapedSimpleQuote(&lpsecurity->lpDBEventText) == RES_ERR) {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
             }
           }
           else
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
       }
       lpsecurity->bDBEvent = TRUE;
   }
   else if (lpsecurity->lpDBEventText)
   {
       ESL_FreeMem (lpsecurity->lpDBEventText);
       lpsecurity->lpDBEventText = NULL;
   }

   return TRUE;
}
コード例 #20
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{

   LPSECURITYALARMPARAMS lpsecurity   = (LPSECURITYALARMPARAMS)lParam;
   HWND hwndUsers    = GetDlgItem (hwnd, IDC_SALARM_BYUSER );
   HWND hwndDB       = GetDlgItem (hwnd, IDC_SALARM_ONTABLE);
   HWND hwndDBE      = GetDlgItem (hwnd, IDC_SALARM_DBEVENT);
   HWND hwndCaptionDB= GetDlgItem (hwnd, IDC_SALARM_STATIC_DB);

   char szFormat [100];
   char szTitle  [180];

   if (!AllocDlgProp (hwnd, lpsecurity))
       return FALSE;

   bNoDisplayMessageDB = FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();

   if (lpsecurity->bInstallLevel) {
      SetWindowText (hwndCaptionDB, "On:");
      //"Create Security Alarm on Current Installation on %s"
      wsprintf (szTitle, ResourceString(IDS_F_CREATE_SECURITY),
                GetVirtNodeName ( GetCurMdiNodeHandle ()));
   }
   else {
      LoadString (hResource, (UINT)IDS_T_CREATE_SECURITY, szFormat, sizeof (szFormat));
      wsprintf (szTitle, szFormat,
                GetVirtNodeName ( GetCurMdiNodeHandle ()),
                lpsecurity->DBName);

   }


   
   SetWindowText (hwnd, szTitle);

   Edit_LimitText (GetDlgItem (hwnd, IDC_SALARM_DBEVENT_TEXT), MAXOBJECTNAME-1);
   ZEROINIT (szSecurityDBEvent);
   LoadString (hResource, (UINT)IDS_I_NODBEVENT, szSecurityDBEvent, sizeof (szSecurityDBEvent));

   //
   // Set the default to user
   //
   Button_SetCheck (GetDlgItem (hwnd, IDC_SALARM_USER), TRUE);

   //
   // Get the available users names and insert them into the CA list box 
   // 

   CAListBoxFillUsers (hwndUsers);

   //
   // Get the available DB names and insert them into the table list 
   // 
   if (lpsecurity->bInstallLevel) {
       char * pcurinst = ResourceString(IDS_CURRENT_INSTALLATION);
       CAListBox_AddString   (hwndDB,pcurinst);
       CAListBox_SelectString(hwndDB,-1,pcurinst);
       lpsecurity->iObjectType = OT_VIRTNODE;
       EnableWindow(hwndDB,FALSE);
       EnableWindow(hwndDBE,FALSE);
   }
   else  {
       CAListBoxFillDatabases (hwndDB);
       lpsecurity->iObjectType = OT_DATABASE;
   }

   if (!lpsecurity->bInstallLevel &&
       !ComboBoxFillDBevents (hwndDBE, "iidbdb"))
   {
       ComboBoxDestroyItemData (hwndDBE);
       return FALSE;
   }

   {
       int   k;
       char* buffowner;

       k = ComboBox_AddString (hwndDBE, szSecurityDBEvent);
       buffowner = ESL_AllocMem (x_strlen (szSecurityDBEvent) +1);
       x_strcpy (buffowner, szSecurityDBEvent);
       ComboBox_SetItemData (hwndDBE, k, buffowner);
       ComboBox_SelectString(hwndDBE, -1, szSecurityDBEvent);
       EnableControl (hwnd, FALSE);
   }

   PreCheckItem (hwnd);
   EnableDisableOKButton (hwnd);
   //
   // The value 9039 is defined in MAINMFC.H but is not accessible from this file:
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT (lpsecurity->bInstallLevel? 9039: (UINT)IDD_SECURITY_ALARM2));

   richCenterDialog (hwnd);
   return TRUE;
}
コード例 #21
0
LONG CuDlgDomPropTblInteg::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
  // cast received parameters
  int nNodeHandle = (int)wParam;
  LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
  ASSERT (nNodeHandle != -1);
  ASSERT (pUps);

  // ignore selected actions on filters
  switch (pUps->nIpmHint)
  {
    case 0:
      case FILTER_DOM_SYSTEMOBJECTS:    // eligible
      //case FILTER_DOM_BASEOWNER:
      //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH:
      // eligible if UpdateType is compatible with DomGetFirst/Next object type,
      // or is ot_virtnode, which means refresh for all whatever the type is
      if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
          pUps->pSFilter->UpdateType != OT_INTEGRITY)
        return 0L;
      break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the current item
  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();
  //
  // Get list of Tbl for the replication
  //
  m_Data.m_uaTblInteg.RemoveAll();

  int     iret;
  UCHAR   buf[MAXOBJECTNAME];
  UCHAR   bufOwner[MAXOBJECTNAME];
  UCHAR   bufComplim[MAXOBJECTNAME];

  //
  // CHECK EXISTENCE SINCE REGISTERED TABLE MIGHT NOT REALLY EXIST YET
  //
  int   resultType;
  UCHAR resultObjectName[MAXOBJECTNAME];
  UCHAR resultOwnerName[MAXOBJECTNAME];
  UCHAR resultExtraData[MAXOBJECTNAME];
  char* parentStrings[3];
  parentStrings[0] = (char*)lpRecord->extra;  // DBName
  parentStrings[1] = parentStrings[2] = NULL;

  // preparation for get limited info - added static type - added all related granted types
  LPUCHAR lpName = NULL;
  LPUCHAR lpOwner = NULL;
  int basicType = GetBasicType(lpRecord->recType);
  m_Data.m_objType = basicType;
  switch (basicType) {
    case OT_TABLE:
    case OT_SCHEMAUSER_TABLE:
      lpName = (LPUCHAR)lpRecord->objName;
      lpOwner = (LPUCHAR)lpRecord->ownerName;
      break;
    case OT_STATIC_INTEGRITY:
      lpName = (LPUCHAR)lpRecord->extra2;
      lpOwner = (LPUCHAR)lpRecord->tableOwner;
      break;
    default:
      ASSERT(FALSE);
      return 0L;
  }

  iret = DOMGetObjectLimitedInfo(nNodeHandle,
                                 lpName,                           // object name,
                                 lpOwner,                          // object owner
                                 OT_TABLE,                         // iobjecttype
                                 1,                                // level
                                 (unsigned char **)parentStrings,  // parenthood
                                 TRUE,                             // bwithsystem
                                 &resultType,
                                 resultObjectName,
                                 resultOwnerName,
                                 resultExtraData
                                 );
  if (iret == RES_ENDOFDATA)
    iret = RES_ERR;           // Non-existent: ERROR !!!
  if (iret == RES_SUCCESS) {
    LPUCHAR aparentsTemp[MAXPLEVEL];

    // prepare parenthood with schema where relevant
    aparentsTemp[0] = lpRecord->extra;  // DBName

    UCHAR bufParent1[MAXOBJECTNAME];
    aparentsTemp[1] = bufParent1;
    x_strcpy((char *)buf, (const char *)resultObjectName);
    StringWithOwner(buf, resultOwnerName, aparentsTemp[1]); // schema.name

    aparentsTemp[2] = NULL;

    memset (&bufComplim, '\0', sizeof(bufComplim));
    memset (&bufOwner, '\0', sizeof(bufOwner));
    iret =  DOMGetFirstObject(nNodeHandle,
                              OT_INTEGRITY,
                              2,                            // level,
                              aparentsTemp,                 // Temp mandatory!
                              pUps->pSFilter->bWithSystem,  // bwithsystem
                              NULL,                         // lpowner
                              buf,
                              bufOwner,
                              bufComplim);
  }
  if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
    // Erroneous case!
    CuNameWithOwner errItem(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE));//"<Data Unavailable>"
    m_Data.m_uaTblInteg.Add(errItem);
  }
  else {
    while (iret == RES_SUCCESS) {
      CuNameWithOwner item((const char*)buf, _T(""));   // no owner
      m_Data.m_uaTblInteg.Add(item);

      iret = DOMGetNextObject(buf, bufOwner, bufComplim);
    }
  }
  if (m_Data.m_uaTblInteg.GetCount() == 0) {
    CuNameWithOwner noItem(VDBA_MfcResourceString (IDS_E_NO_INTEGRITY));//"<No Integrity>"
    m_Data.m_uaTblInteg.Add(noItem);
  }

  // Refresh display
  RefreshDisplay();

  return 0L;
}
コード例 #22
0
LONG CuDlgDomPropView::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
  // cast received parameters
  int nNodeHandle = (int)wParam;
  LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
  ASSERT (nNodeHandle != -1);
  ASSERT (pUps);

  // ignore selected actions on filters
  switch (pUps->nIpmHint)
  {
    case 0:
      //case FILTER_DOM_SYSTEMOBJECTS:
      //case FILTER_DOM_BASEOWNER:
      //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH_DETAIL:
      if (m_Data.m_refreshParams.MustRefresh(pUps->pSFilter->bOnLoad, pUps->pSFilter->refreshtime))
        break;    // need to update
      else
        return 0; // no need to update
      break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_clistCtrl);
        return 0L;
    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the object
  VIEWPARAMS ViewParams;
  memset (&ViewParams, 0, sizeof (ViewParams));

  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();
  //
  // Get Detail Info
  //
  x_strcpy ((char *)ViewParams.objectname, RemoveDisplayQuotesIfAny((LPCTSTR)StringWithoutOwner(lpRecord->objName)));
  x_strcpy ((char *)ViewParams.szSchema, (const char *)lpRecord->ownerName);
  x_strcpy ((char *)ViewParams.DBName, (const char *)lpRecord->extra);
  int dummySesHndl;
  int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle),
                               OT_VIEW,
                               &ViewParams,
                               FALSE,
                               &dummySesHndl);
  if (iResult != RES_SUCCESS) {
    ASSERT (FALSE);

    // Reset m_Data
    CuDomPropDataView tempData;
    tempData.m_refreshParams = m_Data.m_refreshParams;
    m_Data = tempData;

    // Refresh display
    RefreshDisplay();

    return 0L;
  }

  // Update refresh info
  m_Data.m_refreshParams.UpdateRefreshParams();

  // update member variables, for display/load/save purpose
  m_Data.m_csText = ViewParams.lpViewText;

  // liberate detail structure
  FreeAttachedPointers (&ViewParams, OT_VIEW);

  //
  // Get list of view components
  //
  m_Data.m_acsViewComponents.RemoveAll();
  m_Data.m_acsSchema.RemoveAll();
  m_Data.m_awCompType.RemoveAll();

  int     iret;
  LPUCHAR aparentsTemp[MAXPLEVEL];

  UCHAR   buf[MAXOBJECTNAME];
  UCHAR   bufOwner[MAXOBJECTNAME];
  UCHAR   bufComplim[MAXOBJECTNAME];

  memset (&bufComplim, '\0', sizeof(bufComplim));
  memset (&bufOwner, '\0', sizeof(bufOwner));

  // prepare parenthood with schema where relevant
  aparentsTemp[0] = lpRecord->extra;  // DBName

  UCHAR bufParent1[MAXOBJECTNAME];
  aparentsTemp[1] = bufParent1;
  x_strcpy((char *)buf, (const char *)lpRecord->objName);
  StringWithOwner(buf, lpRecord->ownerName, aparentsTemp[1]); // schema.name

  aparentsTemp[2] = NULL;

  iret =  DOMGetFirstObject(nNodeHandle,
                            OT_VIEWTABLE,
                            2,                           // level,
                            aparentsTemp,                // Temp mandatory!
                            pUps->pSFilter->bWithSystem, // bwithsystem
                            NULL,                        // owner
                            buf,
                            bufOwner,
                            bufComplim);
  if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
    // Erroneous case!
    CString csUnavail;
    csUnavail.LoadString(IDS_TM_ERR_ERR);// = "< Data Unavailable >";
    m_Data.m_acsViewComponents.Add(csUnavail);
    m_Data.m_acsSchema.Add(_T(""));
    m_Data.m_awCompType.Add(OT_VIEWTABLE);    // unresolved view component
  }
  else {
    while (iret == RES_SUCCESS) {
      m_Data.m_acsViewComponents.Add((LPCTSTR)buf);
      m_Data.m_acsSchema.Add((LPCTSTR)bufOwner);

      // Solve type on the fly
      int viewCompType;
      UCHAR resBuf[MAXOBJECTNAME];
      UCHAR resBuf2[MAXOBJECTNAME];
      UCHAR resBuf3[MAXOBJECTNAME];
      LPUCHAR aparentsSolve[MAXPLEVEL];
      aparentsSolve[0] = lpRecord->extra;  // DBName
      aparentsSolve[1] = aparentsSolve[2] = NULL;
      int res = DOMGetObjectLimitedInfo(nNodeHandle,
                                        buf,
                                        bufOwner,
                                        OT_VIEWTABLE,
                                        1,     // level
                                        aparentsSolve,  // parentstrings,
                                        TRUE,
                                        &viewCompType,
                                        resBuf,
                                        resBuf2,
                                        resBuf3);
      if (res != RES_SUCCESS)
        viewCompType = OT_VIEWTABLE;

      m_Data.m_awCompType.Add(viewCompType);    // OT_TABLE or OT_VIEW, or OT_VIEWTABLE if error

      iret = DOMGetNextObject(buf, bufOwner, bufComplim);
    }
  }
  if (m_Data.m_acsViewComponents.GetUpperBound() == -1) {
    CString csNoViewComp;
	csNoViewComp.LoadString(IDS_VIEW_COMPONENTS);// = "< No View Components>";
    m_Data.m_acsViewComponents.Add(csNoViewComp);
    m_Data.m_acsSchema.Add(_T(""));
    m_Data.m_awCompType.Add(OT_VIEWTABLE);    // unresolved view component
  }

  // Get comment
  TCHAR *lpObjComment = NULL;
  LPOBJECTLIST lpObjCol = NULL;

  iret = VDBAGetCommentInfo ( (LPTSTR)(LPUCHAR)GetVirtNodeName(nNodeHandle),
                       (LPTSTR)ViewParams.DBName, (LPTSTR)ViewParams.objectname,
                       (LPTSTR)ViewParams.szSchema, &lpObjComment, lpObjCol);

  if (iret!=RES_SUCCESS)
  {
    CString csMsg;
    csMsg.LoadString(IDS_NOT_AVAILABLE);
    m_ctrlEditComment.SetWindowText(csMsg);
    m_Data.m_csComment = csMsg;
  }
  else if (lpObjComment)
  {
      m_ctrlEditComment.SetWindowText(lpObjComment);
      m_Data.m_csComment = lpObjComment;
      ESL_FreeMem(lpObjComment);
  }
  else
  {
    m_ctrlEditComment.SetWindowText(_T(""));
    m_Data.m_csComment.Empty();
  }

  //
  // Refresh display
  //
  RefreshDisplay();

  return 0L;
}
コード例 #23
0
LONG CuDlgDomPropTableGrantees::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
    // cast received parameters
    int nNodeHandle = (int)wParam;
    LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
    ASSERT (nNodeHandle != -1);
    ASSERT (pUps);

    // ignore selected actions on filters
    switch (pUps->nIpmHint)
    {
    case 0:
    case FILTER_DOM_SYSTEMOBJECTS:  // can be $ingres
        //case FILTER_DOM_BASEOWNER:
        //case FILTER_DOM_OTHEROWNER:
        break;

    case FILTER_DOM_BKREFRESH:
        // eligible if UpdateType is compatible with DomGetFirst/Next object type,
        // or is ot_virtnode, which means refresh for all whatever the type is
        if (pUps->pSFilter->UpdateType != OT_VIRTNODE &&
                pUps->pSFilter->UpdateType != OTLL_GRANTEE)
            return 0L;
        break;
    case FILTER_SETTING_CHANGE:
        VDBA_OnGeneralSettingChange(&m_cListCtrl);
        return 0L;
    default:
        return 0L;    // nothing to change on the display
    }

    // Get info on the current item
    LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
    ASSERT (lpRecord);
    ResetDisplay();
    //
    // Get list of Grantees
    //
    m_Data.m_uaTableGrantees.RemoveAll();

    int     iret;
    LPUCHAR aparentsTemp[MAXPLEVEL];

    UCHAR   buf[MAXOBJECTNAME];
    UCHAR   bufOwner[MAXOBJECTNAME];
    UCHAR   bufComplim[MAXOBJECTNAME];

    memset (&bufComplim, '\0', sizeof(bufComplim));
    memset (&bufOwner, '\0', sizeof(bufOwner));

    // prepare parenthood with schema where relevant
    aparentsTemp[0] = lpRecord->extra;  // parent DB Name

    UCHAR bufParent1[MAXOBJECTNAME];
    aparentsTemp[1] = bufParent1;
    switch (lpRecord->recType) {
    case OT_TABLE:
    case OTR_GRANTEE_SEL_TABLE:
    case OTR_GRANTEE_INS_TABLE:
    case OTR_GRANTEE_UPD_TABLE:
    case OTR_GRANTEE_DEL_TABLE:
    case OTR_GRANTEE_REF_TABLE:
    case OTR_GRANTEE_CPI_TABLE:
    case OTR_GRANTEE_CPF_TABLE:
    case OTR_GRANTEE_ALL_TABLE:
    case OTR_LOCATIONTABLE:
    case OT_REPLIC_REGTABLE:
    case OT_SCHEMAUSER_TABLE:
    case OTR_REPLIC_CDDS_TABLE:
        x_strcpy((char *)buf, (const char *)lpRecord->objName);
        break;
    case OT_STATIC_TABLEGRANTEES:
        x_strcpy((char *)buf, (const char *)lpRecord->extra2);
        break;
    default:
        ASSERT (FALSE);
        buf[0] = '\0';
    }
    ASSERT (lpRecord->ownerName);
    StringWithOwner(buf, lpRecord->ownerName, aparentsTemp[1]); // schema.name

    aparentsTemp[2] = NULL;

    // loop on grants
    BOOL bError = FALSE;
    for (int index = 0; index < NBTBLGRANTEES; index++) {
        iret =  DOMGetFirstObject(nNodeHandle,
                                  aGrantType[index],
                                  2,                            // level,
                                  aparentsTemp,                 // Temp mandatory!
                                  pUps->pSFilter->bWithSystem,  // bwithsystem
                                  NULL,                         // lpowner
                                  buf,
                                  bufOwner,
                                  bufComplim);
        if (iret != RES_SUCCESS && iret != RES_ENDOFDATA) {
            bError = TRUE;
            continue;
        }
        else {
            while (iret == RES_SUCCESS) {
                // received data:
                // - Grantee name in buf
                CuTableGrantee grantee((const char *)buf,     // Grantee name (user/group/role)
                                       FALSE,                 // not special item
                                       aGrantType[index]    // grant type
                                      );

                // Solve type on the fly and SetGranteeType
                int granteeType;
                UCHAR resBuf[MAXOBJECTNAME];
                UCHAR resBuf2[MAXOBJECTNAME];
                UCHAR resBuf3[MAXOBJECTNAME];
                int res = DOMGetObjectLimitedInfo(nNodeHandle,
                                                  buf,
                                                  bufOwner,
                                                  OT_GRANTEE,
                                                  0,     // level
                                                  NULL,  // parentstrings,
                                                  TRUE,
                                                  &granteeType,
                                                  resBuf,
                                                  resBuf2,
                                                  resBuf3);
                if (res != RES_SUCCESS)
                    grantee.SetGranteeType(OT_ERROR);
                else
                    grantee.SetGranteeType(granteeType);

                CuMultFlag *pRefGrantee = m_Data.m_uaTableGrantees.Find(&grantee);
                if (pRefGrantee)
                    m_Data.m_uaTableGrantees.Merge(pRefGrantee, &grantee);
                else
                    m_Data.m_uaTableGrantees.Add(grantee);

                iret = DOMGetNextObject(buf, bufOwner, bufComplim);
            }
        }
    }

    // Manage error case
    if (bError)
    {
        /* "<Data Unavailable>" */
        CuTableGrantee grantee1(VDBA_MfcResourceString (IDS_DATA_UNAVAILABLE),
                                TRUE);
        m_Data.m_uaTableGrantees.Add(grantee1);
    }

    // Manage no grantee
    if (m_Data.m_uaTableGrantees.GetCount() == 0)
    {
        /* "<No Grantee>" */
        CuTableGrantee grantee2(VDBA_MfcResourceString (IDS_E_NO_GRANTEE), TRUE);
        m_Data.m_uaTableGrantees.Add(grantee2);
    }

    ASSERT (m_Data.m_uaTableGrantees.GetCount() > 0 );

    // Refresh display
    RefreshDisplay();

    return 0L;
}
コード例 #24
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPGRANTPARAMS lpgrant   = GetDlgProp (hwnd);
   HWND hwndDatabases      = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES);
   HWND hwndGrantees       = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES);
   HWND hwndProcedures     = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES);
   int  ires;

   switch (id)
   {
       case IDOK:
           if (!FillStructureFromControls (hwnd, lpgrant))
               break;
           
           ires = DBAAddObject
               (GetVirtNodeName ( GetCurMdiNodeHandle ()),
               OTLL_GRANT,
               (void *) lpgrant);

           if (ires != RES_SUCCESS)
           {
               FreeAttachedPointers (lpgrant, OTLL_GRANT);
               ErrorMessage ((UINT)IDS_E_GRANT_PROCEDURE_FAILED, ires);
               break;
           }
           else 
               EndDialog (hwnd, TRUE);
           FreeAttachedPointers (lpgrant, OTLL_GRANT);
           break;

       case IDCANCEL:
           FreeAttachedPointers (lpgrant, OTLL_GRANT);
           EndDialog (hwnd, FALSE);
           break;

       case IDC_GNREF_PROCEDURE_PROCEDURES:
       case IDC_GNREF_PROCEDURE_GRANTEES:
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_USER:
           CAListBox_ResetContent (hwndGrantees);
           FillGrantees (hwndGrantees, OT_USER);
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_GROUP:
           CAListBox_ResetContent (hwndGrantees);
           FillGrantees (hwndGrantees, OT_GROUP);
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_ROLE:
           CAListBox_ResetContent (hwndGrantees);
           FillGrantees (hwndGrantees, OT_ROLE);
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_PUBLIC:
           CAListBox_ResetContent (hwndGrantees);
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_DATABASES:
       {
           char selString [MAXOBJECTNAME+1];
           if (codeNotify == CBN_SELCHANGE)
           {
               CAListBoxDestroyItemData (hwndProcedures);
               CAListBox_ResetContent   (hwndProcedures);
               ComboBox_GetText (hwndDatabases, selString, sizeof (selString));
               x_strcpy (lpgrant->DBName, selString);
               if (lpgrant->ObjectType == OT_PROCEDURE) {
                  if (!CAListBoxFillProcedures (hwndProcedures, selString))
                      CAListBoxDestroyItemData (hwndProcedures);
               }
               else {
                  if (!CAListBoxFillSequences (hwndProcedures, lpgrant->DBName))
                      CAListBoxDestroyItemData (hwndProcedures);
               }
           }
           EnableDisableOKButton (hwnd);
       }
       break;

   }
}
コード例 #25
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPAUDITDBPARAMS lpauditdb = GetDlgProp (hwnd);
   BOOL Success;

   switch (id)
   {
       case IDOK:
           if (lpauditdb->bStartSinceTable)
           {
             char szTblOwner[MAXOBJECTNAME];
             OwnerFromString(table.lpTable->lpObject, szTblOwner);
             if ( IsTheSameOwner(GetCurMdiNodeHandle(),szTblOwner) == FALSE )
               break;
             if ( table.bRefuseTblWithDupName && IsTableNameUnique(GetCurMdiNodeHandle(),lpauditdb->DBName,table.lpTable->lpObject) == FALSE)
               break;
           }
           Success = FillStructureFromControls (hwnd);

           if (!Success)
               break;
           else
           {
               FreeObjectList (table.lpTable);
               table.lpTable = NULL;
               lpfile = FreeTableAndFile (lpfile);
               EndDialog (hwnd, TRUE);
           }
           break;

       case IDCANCEL:
           FreeObjectList (table.lpTable);
           table.lpTable = NULL;
           lpfile = FreeTableAndFile (lpfile);

           EndDialog (hwnd, FALSE);
           break;

       case IDC_AUDITDB_CKP:
           EnableDisableControls (hwnd);
           break;

       case IDC_AUDITDB_CKP_BUTTON:
           {
               char szCurChkPtNum[MAXOBJECTNAME];
               char szUserName    [MAXOBJECTNAME];
               int ires;
               LPUCHAR vnodeName = GetVirtNodeName (GetCurMdiNodeHandle ());

               DBAGetUserName (GetVirtNodeName ( GetCurMdiNodeHandle ()), szUserName);
               ires = MfcDlgCheckPointLst(lpauditdb->DBName ,szUserName, vnodeName, szCurChkPtNum);
               if (ires != IDCANCEL)
                   Edit_SetText   (GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER), szCurChkPtNum);
               break;
           }
       case IDC_AUDITDB_IDTABLE:
           {
               int   iret;
               char* aString;
               char  szTable [MAXOBJECTNAME];
               LPOBJECTLIST ls;
               LPTABLExFILE lf;

               x_strcpy (table.DBName,  lpauditdb->DBName);
               table.bRefuseTblWithDupName = TRUE;
               iret = DlgAuditDBTable (hwnd, &table);

               ls = table.lpTable;
               EnableDisableControls (hwnd);

               while (ls)
               {
                   aString = (char *)ls->lpObject;
                   if (!FindStringInListTableAndFile (lpfile, aString))
                   {
                       //
                       // Add table  into TABLExFILE
                       //
                       lpfile = AddElement (lpfile, aString);
                   }
                   ls = ls->lpNext;
               }
               AddFile (hwnd, lpfile);

               lf = lpfile;
               while (lf)
               {
                   if (!FindStringInListObject (table.lpTable, lf->TableName))
                   {
                       //
                       // Delete table from TABLExFILE
                       //
                       x_strcpy (szTable, lf->TableName);
                       lf = lf->next;
                       lpfile = RemoveElement (lpfile, szTable);
                   }
                   else lf = lf->next;
               }
           }
           break;

       case IDC_AUDITDB_IDFILE:
           {
               int iret;
               AUDITDBFPARAMS file;
               ZEROINIT (file);

               x_strcpy (file.DBName,  lpauditdb->DBName);
               file.lpTableAndFile = lpfile;
               iret   = DlgAuditDBFile (hwnd, &file);
               if (iret)
                   lpfile = file.lpTableAndFile;
           }
           break;

       case IDC_AUDITDB_TABLES:
           EnableDisableControls (hwnd);
           break;
       case IDC_AUDITDB_FILES:
           EnableDisableControls (hwnd);
           break;
   }
}
コード例 #26
0
static BOOL FillStructureFromControls (HWND hwnd)
{
   char szGreatBuffer [MAX_RMCMD_BUFSIZE];
   char szBufferT     [MAX_RMCMD_BUFSIZE];
   char szBufferF     [MAX_RMCMD_BUFSIZE];
   char szSyscat      [22];
   char szBefore      [22];
   char szAfter       [22];
   char szCn          [10];
   char szActUser     [MAXOBJECTNAME];
   char szUserName    [MAXOBJECTNAME];
   char buftemp[200];

   HWND hwndSyscat         = GetDlgItem (hwnd, IDC_AUDITDB_SYSCAT);
   HWND hwndBefore         = GetDlgItem (hwnd, IDC_AUDITDB_BEFORE);
   HWND hwndAfter          = GetDlgItem (hwnd, IDC_AUDITDB_AFTER);
   HWND hwndCn             = GetDlgItem (hwnd, IDC_AUDITDB_CKP_NUMBER);
   HWND hwndActUser        = GetDlgItem (hwnd, IDC_AUDITDB_ACTION_USER);
   HWND hwndWait           = GetDlgItem (hwnd, IDC_AUDITDB_WAIT);
   HWND hwndInconsistent   = GetDlgItem (hwnd, IDC_AUDITDB_INCONSISTENT);
   HWND hwndTable          = GetDlgItem (hwnd, IDC_AUDITDB_TABLES);
   HWND hwndFile           = GetDlgItem (hwnd, IDC_AUDITDB_FILES);

   LPUCHAR vnodeName = GetVirtNodeName (GetCurMdiNodeHandle ());
   LPAUDITDBPARAMS     lpauditdb  = GetDlgProp (hwnd);
   LPTABLExFILE ls   = lpfile;

   ZEROINIT (szGreatBuffer);
   ZEROINIT (szBufferT);
   ZEROINIT (szBufferF);
   ZEROINIT (szSyscat);
   ZEROINIT (szBefore);
   ZEROINIT (szAfter);
   ZEROINIT (szCn);
   ZEROINIT (szActUser);

   // Verify if the length of the remote command do not exceed MAX_LINE_COMMAND.
   if (!VerifyBufferLen(hwnd))
   {
       ErrorMessage ((UINT) IDS_E_TOO_MANY_TABLES_SELECTED, RES_ERR);
       return FALSE;
   }

   if (Button_GetCheck (hwndFile))
       x_strcpy (szBufferF, " -file");

   if (Button_GetCheck (hwndTable))
   {
       char*  aTable;
       LPOBJECTLIST list = table.lpTable;

       if (list)
       {
           aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject));
           x_strcpy (szBufferT, " -table=");
           x_strcat (szBufferT, aTable);
           list = list->lpNext;
       }
       while (list)
       {
           x_strcat (szBufferT, ",");
           aTable = (LPTSTR)RemoveDisplayQuotesIfAny((LPTSTR)StringWithoutOwner(list->lpObject));
           x_strcat (szBufferT, aTable);
           list = list->lpNext;
       }
   }

   if (Button_GetCheck (hwndFile) && ls && Modify (ls))
   {
       x_strcpy (szBufferF, " -file=");
       x_strcat (szBufferF, ls->FileName);
       ls = ls->next;

       while (ls)
       {
           x_strcat (szBufferF, ",");
           x_strcat (szBufferF, ls->FileName);
           ls = ls->next;
       }
   }

   if (Button_GetCheck (hwndSyscat))
       x_strcpy (szSyscat, "-a");
   else
       x_strcpy (szSyscat, "");

   wsprintf (szGreatBuffer,
       "auditdb %s %s %s %s",
       szSyscat,
       lpauditdb->DBName,
       szBufferT,
       szBufferF);
 
   Edit_GetText (hwndAfter,  szAfter,  sizeof (szAfter ));
   Edit_GetText (hwndBefore, szBefore, sizeof (szBefore));
   Edit_GetText (hwndCn,     szCn,     sizeof (szCn));

   ComboBox_GetText (hwndActUser, szActUser, sizeof (szActUser));

   if (x_strlen (szAfter) > 0)
   {
       x_strcat (szGreatBuffer, " -b");
       x_strcat (szGreatBuffer, szAfter);
   }

   if (x_strlen (szBefore) > 0)
   {
       x_strcat (szGreatBuffer, " -e");
       x_strcat (szGreatBuffer, szBefore);
   }

   if (Button_GetCheck (GetDlgItem (hwnd, IDC_AUDITDB_CKP)))
   {
       x_strcat (szGreatBuffer, " #c");
       if (x_strlen (szCn) > 0)
           x_strcat (szGreatBuffer, szCn);
   }

   if (x_strlen (szActUser) > 0)
   {
       x_strcat (szGreatBuffer, " -i");
       x_strcat (szGreatBuffer, szActUser);
   }

   if (Button_GetCheck (hwndWait))
       x_strcat (szGreatBuffer, " -wait");

   if (Button_GetCheck (hwndInconsistent))
       x_strcat (szGreatBuffer, " -inconsistent");
  
   ZEROINIT (szUserName);
   DBAGetUserName (vnodeName, szUserName);
   x_strcat (szGreatBuffer, " -u");
   x_strcat (szGreatBuffer, szUserName);


   wsprintf(buftemp,
       ResourceString ((UINT)IDS_T_RMCMD_AUDITDB), //"auditing database %s::%s",
       vnodeName,
       lpauditdb->DBName);
   execrmcmd(vnodeName,szGreatBuffer,buftemp);
   return TRUE;
}
コード例 #27
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPGRANTPARAMS lpgrant = (LPGRANTPARAMS)lParam;
   HWND    hwndDatabases = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES);
   HWND    hwndGrantees  = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES);
   HWND    hwndProcedures= GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES);
   UCHAR   szDatabaseName[MAXOBJECTNAME];
   char    szTitle [MAX_TITLEBAR_LEN];
   char    szFormat[100];

   if (!AllocDlgProp (hwnd, lpgrant))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();
   if (lpgrant->ObjectType == OT_PROCEDURE)
      LoadString (hResource, (UINT)IDS_T_GNREF_PROCEDURE, szFormat, sizeof (szFormat));
   else
      LoadString (hResource, (UINT)IDS_T_GNREF_SEQUENCE, szFormat, sizeof (szFormat));

   wsprintf (
       szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()));

   SetWindowText (hwnd, szTitle);
   if (lpgrant->ObjectType == OT_PROCEDURE)
      lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_GNREF_PROCEDURE));
   else
      lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)ID_HELPID_GNREF_SEQUENCE));


   if (lpgrant->GranteeType == OT_GROUP)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GROUP), TRUE);
       FillGrantees (hwndGrantees, lpgrant->GranteeType);
   }
   else
   if (lpgrant->GranteeType == OT_ROLE)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_ROLE),  TRUE);
       FillGrantees (hwndGrantees, lpgrant->GranteeType);
   }
   else
   {
       if  (x_strcmp (lpgrant->PreselectGrantee, lppublicdispstring()) == 0)
           Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PUBLIC), TRUE);
       else
       {
           Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_USER),   TRUE);
           lpgrant->GranteeType = OT_USER;
           FillGrantees (hwndGrantees, lpgrant->GranteeType);
       }
   }

   ComboBoxFillDatabases  (hwndDatabases);
   ComboBoxSelectFirstStr (hwndDatabases);
   ComboBox_GetText (hwndDatabases, szDatabaseName, sizeof (szDatabaseName));
   x_strcpy (lpgrant->DBName, szDatabaseName);
   
   if (lpgrant->ObjectType == OT_PROCEDURE) {
      if (!CAListBoxFillProcedures (hwndProcedures, szDatabaseName))
         CAListBoxDestroyItemData (hwndProcedures);
   }
   else {
       ShowWindow( GetDlgItem (hwnd,IDC_GNREF_PROCEDURE_OPTION) ,SW_HIDE);// Hided "With grant Option" control
       LoadString (hResource, (UINT)IDS_STATIC_SEQUENCE, szFormat, sizeof (szFormat));
       SetDlgItemText(  hwnd, IDC_STATIC_GNREF_PROCEDURE, szFormat ); 

       if (!CAListBoxFillSequences (hwndProcedures, lpgrant->DBName))
           CAListBoxDestroyItemData (hwndProcedures);
   }

   if (x_strlen (lpgrant->PreselectGrantee) > 1)
      PreselectGrantee (hwndGrantees, lpgrant->PreselectGrantee);
   if (x_strlen (lpgrant->PreselectObject) > 1)
      CAListBoxSelectStringWithOwner (hwndProcedures, lpgrant->PreselectObject, lpgrant->PreselectObjectOwner);
   EnableDisableOKButton (hwnd);

   richCenterDialog(hwnd);
   return TRUE;
}
コード例 #28
0
LONG CuDlgDomPropProcLink::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
  // cast received parameters
  int nNodeHandle = (int)wParam;
  LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
  ASSERT (nNodeHandle != -1);
  ASSERT (pUps);

  // ignore selected actions on filters
  switch (pUps->nIpmHint)
  {
    case 0:
      //case FILTER_DOM_SYSTEMOBJECTS:
      //case FILTER_DOM_BASEOWNER:
      //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH_DETAIL:
      if (m_Data.m_refreshParams.MustRefresh(pUps->pSFilter->bOnLoad, pUps->pSFilter->refreshtime))
        break;    // need to update
      else
        return 0; // no need to update
      break;

    default:
      return 0L;    // nothing to change on the display
  }

  // Get info on the object
  PROCEDUREPARAMS ProcedureParams;
  memset (&ProcedureParams, 0, sizeof (ProcedureParams));

  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();

  //
  // Get Detail Info
  //
  x_strcpy ((char *)ProcedureParams.objectname, (const char *)lpRecord->objName);
  x_strcpy ((char *)ProcedureParams.objectowner, (const char *)lpRecord->ownerName);
  x_strcpy ((char *)ProcedureParams.DBName, (const char *)lpRecord->extra);
  int dummySesHndl;
  int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle),
                               OT_PROCEDURE,
                               &ProcedureParams,
                               FALSE,
                               &dummySesHndl);
  if (iResult != RES_SUCCESS) {
    ASSERT (FALSE);

    // Reset m_Data
    CuDomPropDataProcedure tempData;
    tempData.m_refreshParams = m_Data.m_refreshParams;
    m_Data = tempData;

    // Refresh display
    RefreshDisplay();

    return 0L;
  }

  // Update refresh info
  m_Data.m_refreshParams.UpdateRefreshParams();

  // update member variables, for display/load/save purpose
  m_Data.m_csText = ProcedureParams.lpProcedureText;


  // liberate detail structure
  FreeAttachedPointers (&ProcedureParams, OT_PROCEDURE);

  //
  // No list of Rules executing procedure
  //
  m_Data.m_acsRulesExecutingProcedure.RemoveAll();    // For serialization only

  //
  // Refresh display
  //
  RefreshDisplay();

  return 0L;
}
コード例 #29
0
int CALLBACK GenericContainerCellDraw( HWND hCntWnd, LPFIELDINFO lpFld, LPRECORDCORE lpRec, LPVOID lpData, HDC hDC, int nXstart, int nYstart, UINT fuOptions, LPRECT lpRect, LPSTR lpszOut, UINT uLenOut)
{
  COLORREF  crOldText = 0;
  COLORREF  crOldBk   = 0;
  BOOL      bChgedTxtColor = FALSE;
  BOOL      bChgedBkColor  = FALSE;

  // Custom management
  GENCNTR_COLUMN  cont_col;
  char            buf[BUFSIZE];

  // combo downarrow bitmap paint
  HDC     hMemDC;
  HBITMAP hBitmap, hOldBitmap;
  RECT    rcClient;
  int     x, y;
  HBRUSH  hBrush;

  // text alignment
  SIZE  size;
  int   remainder;
  int   availwidth;
  int   margin;

  // Decorations for title type cell
  HPEN  hOldPen, hWhitePen, hDkGrayPen;

  // Combo selection paint
  int   cpt;
  char *pItem;

  CntFldDataGet(lpRec, lpFld, 0, &cont_col);

  // Clear whole rectangle (old decorations cleanup) for combo type cell
  if (cont_col.type == CONT_COLTYPE_COMBO) {
    rcClient.left   = lpRect->left;
    rcClient.top    = lpRect->top;
    rcClient.right  = lpRect->right;
    rcClient.bottom = lpRect->bottom;
    hBrush = GetStockObject(WHITE_BRUSH);
    FillRect(hDC, &rcClient, hBrush);
  }

  switch (cont_col.type) {
    case CONT_COLTYPE_TITLE:
      fuOptions |= ETO_OPAQUE;
      crOldBk = SetBkColor(hDC, RGB(192,192,192));  // Light gray background
      bChgedBkColor = TRUE;
      crOldText = SetTextColor(hDC, RGB(255, 0, 0) ); // Red text
      bChgedTxtColor = TRUE;
      x_strcpy(buf, cont_col.ucol.s);
      //wsprintf(buf, "Title : %s", cont_col.ucol.s);
      break;
    case CONT_COLTYPE_TEXT:
      x_strcpy(buf, cont_col.ucol.s);
      //wsprintf(buf, "Text : %s", cont_col.ucol.s);
      break;
    case CONT_COLTYPE_COMBO:
      pItem = cont_col.ucol.sCombo.pItems;  // first item
      for (cpt=0; cpt<cont_col.ucol.sCombo.selection; cpt++)
        pItem += x_strlen(pItem) + 1;
      x_strcpy(buf, pItem);           // Show the 'nth' item
      //wsprintf(buf, "Combo : %s", cont_col.ucol.s);
      break;
    case CONT_COLTYPE_INT:
      wsprintf(buf, "%ld", cont_col.ucol.i);
      //wsprintf(buf, "Int : %ld", cont_col.ucol.i);
      break;
    case CONT_COLTYPE_FLOAT:
      // NOTE : wsprintf is not aware of the floating format...
      sprintf(buf, "%.*f", cont_col.precision, cont_col.ucol.f);
      //sprintf(buf, "Float : %.2f", cont_col.ucol.f);
      break;
    case CONT_COLTYPE_EMPTY:
      buf[0] = '\0';    // empty cell
      break;
    default:
      x_strcpy(buf, "Unknown type!");
      break;
  }

  // manage the horizontal positioning of the text
  if (cont_col.align != CONT_ALIGN_LEFT) {
    availwidth = lpRect->right - lpRect->left;
    margin = nXstart - lpRect->left;
#ifdef WIN32
    GetTextExtentPoint32(hDC, buf, x_strlen(buf), &size);
#else
    GetTextExtentPoint(hDC, buf, x_strlen(buf), &size);
#endif

    remainder = availwidth - 2*margin - size.cx;

    if (remainder > 0)
      switch (cont_col.align) {
        case CONT_ALIGN_CENTER:
          nXstart += remainder/2;
          break;
        case CONT_ALIGN_RIGHT:
          nXstart += remainder;
          break;
      }
  }

  // Draw the field data.
  ExtTextOut( hDC, nXstart, nYstart, fuOptions, lpRect,
              buf, x_strlen(buf), (LPINT)NULL);

  // Restore colors
  if (bChgedTxtColor)
    SetTextColor(hDC, crOldText);
  if (bChgedBkColor)
    SetBkColor(hDC, crOldBk);

  // Draw decorations for title type cell
  if (cont_col.type == CONT_COLTYPE_TITLE) {
    hWhitePen  = GetStockObject(WHITE_PEN);
    hDkGrayPen = CreatePen(PS_SOLID, 2, RGB(128, 128, 128));  // Dark gray

    hOldPen = SelectObject(hDC, hWhitePen);
    MoveToEx(hDC, lpRect->left,     lpRect->bottom, NULL);
    LineTo(hDC, lpRect->left,     lpRect->top);
    LineTo(hDC, lpRect->right-1,  lpRect->top);

    SelectObject(hDC, hDkGrayPen);
    MoveToEx(hDC, lpRect->left+2,  lpRect->bottom-2, NULL);
    LineTo(hDC, lpRect->right-2, lpRect->bottom-2);
    LineTo(hDC, lpRect->right-2, lpRect->top+1);

    SelectObject(hDC, hOldPen);
    DeleteObject(hDkGrayPen);
  }

  // Draw decorations for combo type cell
  if (cont_col.type == CONT_COLTYPE_COMBO) {
    hMemDC = CreateCompatibleDC(hDC);
    if (hMemDC) {
      hBitmap = LoadBitmap(0, (LPCSTR)OBM_DNARROW);
      if (hBitmap) {
        hOldBitmap = (HBITMAP)SelectObject(hMemDC,hBitmap);

        y = lpRect->top + 1;
        // 1 parent needed when in the CellDraw function!
        if (IsLastColumn(GetParent(hCntWnd), cont_col.colnum)) {
          GetClientRect(hCntWnd, &rcClient);
          x = rcClient.right;
          //x -= GetSystemMetrics(SM_CXVSCROLL);
          x -= 1;
        }
        else
          x = lpRect->right - 1;
        x -= GetSystemMetrics(SM_CXVSCROLL);
        BitBlt(hDC, x, y, BITMAPS_WIDTH, BITMAPS_HEIGHT,
               hMemDC, 0, 0, SRCCOPY);
        SelectObject(hMemDC,hOldBitmap);
        DeleteObject(hBitmap);
      }
      DeleteDC(hMemDC);
    }
  }

  // Finished
  return 0;

}
コード例 #30
0
LONG CuDlgDomPropIceSecRole::OnUpdateData (WPARAM wParam, LPARAM lParam)
{
  // cast received parameters
  int nNodeHandle = (int)wParam;
  LPIPMUPDATEPARAMS pUps = (LPIPMUPDATEPARAMS)lParam;
  ASSERT (nNodeHandle != -1);
  ASSERT (pUps);

  // ignore selected actions on filters
  switch (pUps->nIpmHint)
  {
    case 0:
      //case FILTER_DOM_SYSTEMOBJECTS:
      //case FILTER_DOM_BASEOWNER:
      //case FILTER_DOM_OTHEROWNER:
      break;

    case FILTER_DOM_BKREFRESH_DETAIL:
      if (m_Data.m_refreshParams.MustRefresh(pUps->pSFilter->bOnLoad, pUps->pSFilter->refreshtime))
        break;    // need to update
      else
        return 0; // no need to update
      break;

    default:
      return 0L;    // nothing to change on the display
  }


  LPTREERECORD  lpRecord = (LPTREERECORD)pUps->pStruct;
  ASSERT (lpRecord);
  ResetDisplay();
  // double check type
  int objType = lpRecord->recType;
  ASSERT (objType == OT_ICE_BUNIT_SEC_ROLE);

  // Get Info
  ICEBUSUNITROLEDATA  iceStruct;
  memset (&iceStruct, 0, sizeof(iceStruct));
  x_strcpy((LPSTR)iceStruct.icerole.RoleName, (LPCSTR)lpRecord->objName);
  x_strcpy((LPSTR)iceStruct.icebusunit.Name, (LPCSTR)lpRecord->extra);
  int iResult = GetICEInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle),
                            objType,
                            &iceStruct);
  if (iResult != RES_SUCCESS) {
    ASSERT (FALSE);

    // Reset m_Data
    CuDomPropDataIceSecRole tempData;
    tempData.m_refreshParams = m_Data.m_refreshParams;
    m_Data = tempData;

    // Refresh display
    RefreshDisplay();

    return 0L;
  }

  // Update refresh info
  m_Data.m_refreshParams.UpdateRefreshParams();

  //
  // update member variables, for display/load/save purpose
  //
  m_Data.m_bExecDoc   = iceStruct.bExecDoc;
  m_Data.m_bCreateDoc = iceStruct.bCreateDoc;
  m_Data.m_bReadDoc   = iceStruct.bReadDoc;

  // Refresh display
  RefreshDisplay();

  return 0L;
}