Exemple #1
0
void CxDlgUserMod::ExecuteRemoteCommand(LPCTSTR csCommandLine)
{
	int hnode;
	CString csTempo,csNodeName,csTitle;

	LPUCHAR vnodeName = (LPUCHAR)GetVirtNodeName ( m_nNodeHandle);
	csNodeName = vnodeName;
	hnode = OpenNodeStruct  ((LPUCHAR)(LPCTSTR)csNodeName);
	if (hnode<0)
	{
		CString strMsg = VDBA_MfcResourceString (IDS_MAX_NB_CONNECT);//_T("Maximum number of connections has been reached"
		strMsg += CString(VDBA_MfcResourceString (IDS_E_USERMOD));            // " - Cannot launch 'usermod' command.");
		AfxMessageBox (strMsg);
		return;
	}
	// Temporary for activate a session
	UCHAR buf[MAXOBJECTNAME];
	DOMGetFirstObject (hnode, OT_DATABASE, 0, NULL, FALSE, NULL, buf, NULL, NULL);
	csTitle.Format(IDS_T_USERMOD, (LPCTSTR)csNodeName, (LPCTSTR)m_csDBName);
	execrmcmd1( (char *)(LPCTSTR)csNodeName,
	            (char *)(LPCTSTR)csCommandLine,
	            (char *)(LPCTSTR)csTitle,
	            TRUE);

	CloseNodeStruct(hnode,FALSE);
}
Exemple #2
0
static int RetrieveTupLen4PageSize( void )
{
	int iret, SessType, ilocsession,dwRange;
	char connectname[MAXOBJECTNAME];
	char szValue[40];
	char szConst[MAX_ENUMTUPLEN][14] = {"tup_len_2k", "tup_len_4k",
	                                    "tup_len_8k", "tup_len_16k",
	                                    "tup_len_32k", "tup_len_64k" };

	if (GetOIVers() >= OIVERS_30)
	{
		SessType=SESSION_TYPE_CACHENOREADLOCK;

		wsprintf(connectname,"%s::iidbdb",GetVirtNodeName(GetCurMdiNodeHandle ()));
		iret = Getsession(connectname, SessType, &ilocsession);
		if (iret !=RES_SUCCESS)
			return RES_ERR;

		for (dwRange=0;dwRange<MAX_ENUMTUPLEN;dwRange++)  {
			INGRESII_llDBMSInfo(szConst[dwRange],szValue);
			if (szValue[0] != '0')
				iTabRowsSpanPages[dwRange] = my_atoi(szValue);
		}

		if (iret==RES_SUCCESS)
			iret=ReleaseSession(ilocsession, RELEASE_COMMIT);
		else
			ReleaseSession(ilocsession, RELEASE_ROLLBACK);
	}
	return RES_SUCCESS;
}
Exemple #3
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;
}
Exemple #4
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
    HWND hwndUser = GetDlgItem (hwnd, IDC_USR2GRP_USERBOX);
    LPGROUPUSERPARAMS lpusr2grp   = (LPGROUPUSERPARAMS)lParam;
    char szTitle  [MAX_TITLEBAR_LEN];
    char szFormat [150];

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

    LoadString (hResource, (UINT)IDS_T_USR2GRP, szFormat, sizeof (szFormat));
    wsprintf   (
        szTitle,
        szFormat,
        lpusr2grp->GroupName,
        GetVirtNodeName ( GetCurMdiNodeHandle ()));

    SetWindowText (hwnd, szTitle);
    ComboBoxFillUsers (hwndUser);
    EnableDisableOKButton (hwnd);
    lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_USR2GRP));

    richCenterDialog (hwnd);
    return TRUE;
}
Exemple #5
0
void CxDlgIceCommonCombo::OnOK() 
{
	ICEBUSUNITLOCATIONDATA Il;
	ICEPROFILEROLEDATA Ip;
	ICEPROFILECONNECTIONDATA Ic;
	ICEWEBUSERROLEDATA Ir;
	ICEWEBUSERCONNECTIONDATA Iw;
	LPVOID pStruct = NULL;
	LPUCHAR vnodeName = (LPUCHAR)GetVirtNodeName (m_nHnodeHandle);
	UpdateData(TRUE);

	switch (m_nCurrentObject)
	{
	case OT_ICE_WEBUSER_CONNECTION:
		memset(&Iw,0,sizeof(ICEWEBUSERCONNECTIONDATA));
		lstrcpy((LPSTR)Iw.icedbconnection.ConnectionName,m_csCommon);
		lstrcpy((LPSTR)Iw.icewebuser.UserName,(LPSTR)(LPCTSTR)m_csParentName);
		pStruct = &Iw;
		break;
	case OT_ICE_WEBUSER_ROLE:
		memset(&Ir,0,sizeof(ICEWEBUSERROLEDATA));
		lstrcpy((LPSTR)Ir.icerole.RoleName,m_csCommon);
		lstrcpy((LPSTR)Ir.icewebuser.UserName,(LPSTR)(LPCTSTR)m_csParentName);
		pStruct = &Ir;
		break;
	case OT_ICE_PROFILE_CONNECTION:
		memset(&Ic,0,sizeof(ICEPROFILECONNECTIONDATA));
		lstrcpy((LPSTR)Ic.icedbconnection.ConnectionName,m_csCommon);
		lstrcpy((LPSTR)Ic.iceprofile.ProfileName,(LPSTR)(LPCTSTR)m_csParentName);
		pStruct = &Ic;
		break;
	case OT_ICE_PROFILE_ROLE:
		memset(&Ip,0,sizeof(ICEPROFILEROLEDATA));
		lstrcpy((LPSTR)Ip.icerole.RoleName,m_csCommon);
		lstrcpy((LPSTR)Ip.iceprofile.ProfileName,(LPSTR)(LPCTSTR)m_csParentName);
		pStruct = &Ip;
		break;
	case OT_ICE_BUNIT_LOCATION:
		memset(&Il,0,sizeof(ICEBUSUNITLOCATIONDATA));
		lstrcpy((LPSTR)Il.icelocation.LocationName,m_csCommon);
		lstrcpy((LPSTR)Il.icebusunit.Name,(LPSTR)(LPCTSTR)m_csParentName);
		pStruct = &Il;
		break;
	default:
		ASSERT(FALSE);
		return;
	}

	if ( ICEAddobject(vnodeName ,m_nCurrentObject,pStruct ) == RES_ERR )
	{
		CString csMsg;
		csMsg.LoadString(m_nMessageID);
		MessageWithHistoryButton(m_hWnd,csMsg);
		return;
	}

	CDialog::OnOK();
}
Exemple #6
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;
}
Exemple #7
0
/////////////////////////////////////////////////////////////////////////////
// interface to dom.c
extern "C" BOOL MfcDlgCreateIceDbUser( LPICEDBUSERDATA lpCreateDbUser ,int nHnode)
{
	CxDlgIceDbUser dlg;
	dlg.m_pStructDbUser = lpCreateDbUser;
	dlg.m_csVirtNodeName = GetVirtNodeName (nHnode);
	int iret = dlg.DoModal();
	if (iret == IDOK)
		return TRUE;
	else
		return FALSE;
}
Exemple #8
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPSTORAGEPARAMS lpstructure = (LPSTORAGEPARAMS)lParam;
   char szFormat [100];
   char szTitle  [MAX_TITLEBAR_LEN];
   char buffer   [MAXOBJECTNAME];
   LPUCHAR parentstrings [MAXPLEVEL];

   HWND hwndContainer = GetDlgItem (hwnd, IDC_RELOCATE_CONTAINER);

   if (!AllocDlgProp (hwnd, lpstructure))
       return FALSE;
   parentstrings [0] = lpstructure->DBName;
   if (lpstructure->nObjectType == OT_TABLE)
   {
       LoadString (hResource, (UINT)IDS_T_RELOCATE_TABLE, szFormat, sizeof (szFormat));
       GetExactDisplayString (
           lpstructure->objectname,
           lpstructure->objectowner,
           OT_TABLE,
           parentstrings,
           buffer);
       lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RELOCATE));
   }
   else
   {
       LoadString (hResource, (UINT)IDS_T_RELOCATE_INDEX, szFormat, sizeof (szFormat));
       GetExactDisplayString (
           lpstructure->objectname,
           lpstructure->objectowner,
           OT_INDEX,
           parentstrings,
           buffer);
       lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RELOC_IDX));
   }

   wsprintf (
       szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()),
       lpstructure->DBName,
       buffer);
   SetWindowText (hwnd, szTitle);
   
   //DuplicateLocationList   (hwnd);
   InitContainer           (hwndContainer, hwnd, 2);
   ContainerDisableDisplay (hwndContainer);
   FillAllData             (hwnd);
   ContainerEnableDisplay  (hwndContainer, TRUE);
   richCenterDialog        (hwnd);

   return TRUE;
}
Exemple #9
0
/////////////////////////////////////////////////////////////////////////////
// interface to dom.c
extern "C" BOOL MfcDlgCreateIceProfile( LPICEPROFILEDATA lpcreateIceProf, int nHnode )
{
	CxDlgIceProfile dlg;
	dlg.m_pStructProfileInfo = lpcreateIceProf;
	dlg.m_csVnodeName = GetVirtNodeName (nHnode);
	dlg.m_nHnodeHandle = nHnode;
	int iret = dlg.DoModal();
	if (iret == IDOK)
		return TRUE;
	else
		return FALSE;
}
Exemple #10
0
/////////////////////////////////////////////////////////////////////////////
// interface to dom.c
extern "C" BOOL MfcDlgCreateIceRole ( LPICEROLEDATA lpcreateIRole , int nHnode)
{
	CxDlgIceRole dlg;
	ASSERT (lpcreateIRole);
	if (!lpcreateIRole)
		return FALSE;
	dlg.m_pStructRoleInfo = lpcreateIRole;
	dlg.m_csVirtNodeName = GetVirtNodeName (nHnode);
	int iret = dlg.DoModal();
	if (iret == IDOK)
		return TRUE;
	else
		return FALSE;
}
Exemple #11
0
LONG CuDlgDBEventPane02::OnDbeventTraceIncoming (WPARAM wParam, LPARAM lParam)
{
    LPRAISEDDBE lpStruct = (LPRAISEDDBE)lParam;
    CView*  pView = (CView*)GetParent();
    ASSERT  (pView);
    CDbeventDoc* pDoc = (CDbeventDoc*)pView->GetDocument();
    ASSERT  (pDoc);
    CSplitterWnd* pSplitter = (CSplitterWnd*)pView->GetParent();
    ASSERT (pSplitter);
    CDbeventFrame*  pFrame = (CDbeventFrame*)pSplitter->GetParent();
    ASSERT  (pFrame);
    if (!pFrame->GetPaneRegisteredDBEvent()->Find ((LPCTSTR)lpStruct->DBEventName, (LPCTSTR)lpStruct->DBEventOwner))
    {
        IncomingDBEvent (
            pDoc, 
            "r",
            (LPCTSTR)lpStruct->StrTimeStamp, 
            (LPCTSTR)lpStruct->DBEventName, 
            (LPCTSTR)lpStruct->DBEventOwner, 
            (LPCTSTR)lpStruct->DBEventText,
            "*");
    }
    else
    {
        IncomingDBEvent (
            pDoc, 
            "r",
            (LPCTSTR)lpStruct->StrTimeStamp, 
            (LPCTSTR)lpStruct->DBEventName, 
            (LPCTSTR)lpStruct->DBEventOwner, 
            (LPCTSTR)lpStruct->DBEventText);
    }
    if (pDoc->m_bPopupOnRaise)
    {
        CString strMsg;
        strMsg.GetBuffer (520);
        TCHAR tchszAll [80];

        StringWithOwner ((LPUCHAR)lpStruct->DBEventName, (LPUCHAR)lpStruct->DBEventOwner, (LPUCHAR)tchszAll);
        //"%s: Database Event %s '%s' was raised on node %s."
            strMsg.Format (IDS_I_DB_EVENT_RAISED,
            (LPCTSTR)lpStruct->StrTimeStamp,
            (LPCTSTR)tchszAll,
            (LPCTSTR)lpStruct->DBEventText,
            (LPCTSTR)GetVirtNodeName (pDoc->m_hNode));
        BfxMessageBox (strMsg);
    }
    return RES_SUCCESS;
}
Exemple #12
0
static BOOL CreateObject (HWND hwnd, LPGROUPUSERPARAMS   lpusr2grp)
{
    int     ires;
    LPUCHAR vnodeName = GetVirtNodeName (GetCurMdiNodeHandle ());

    ires = DBAAddObject (vnodeName, OT_GROUPUSER, (void *) lpusr2grp );

    if (ires != RES_SUCCESS)
    {
        ErrorMessage ((UINT) IDS_E_ADD_USR2GRP_FAILED, ires);
        return FALSE;
    }

    return TRUE;
}
Exemple #13
0
BOOL CxDlgUserMod::OnInitDialog()
{
	CDialog::OnInitDialog();
	LPUCHAR parent [MAXPLEVEL];
	TCHAR   buffer [MAXOBJECTNAME];
	CString csFormatTitle,csCaption;

	//
	// Make up title:
	GetWindowText(csFormatTitle);
	parent [0] = (LPUCHAR)(LPTSTR)(LPCTSTR)m_csDBName;
	parent [1] = NULL;
	csCaption.Format(csFormatTitle, (LPTSTR)GetVirtNodeName(m_nNodeHandle), (LPCTSTR)m_csDBName);

	if (!m_csTableName.IsEmpty() && !m_csTableOwner.IsEmpty())
	{
		GetExactDisplayString (m_csTableName, m_csTableOwner, OT_TABLE, parent, buffer);
		csCaption += buffer;
		bChooseTableEnable = FALSE;
	}
	else
		bChooseTableEnable = TRUE;
	SetWindowText(csCaption);

	if ( bChooseTableEnable )
		m_ctrlButtonTables.EnableWindow(FALSE); // Grayed "Tables" button
	else
	{
		m_ctrlButtonTables.ShowWindow(SW_HIDE); // hide button "tables"
		m_CheckSpecifTbl.ShowWindow(SW_HIDE);   // hide checkBox "specify tables"

		m_ctrlStaticTblName.ShowWindow(SW_SHOW); //Show static "table"
		m_ctrlStaticTblName.EnableWindow(TRUE) ; //Ungrayed static "table"
		m_ctrlTblName.ShowWindow(SW_SHOW);       //Show edit controle with the table name.
		m_ctrlTblName.EnableWindow(FALSE);       //Grayed edit controle with the table name.
		m_ctrlTblName.SetWindowText(m_csTableName);
	}

	m_lpTblParam.lpTable = NULL;

	PushHelpId(IDD_USERMOD);

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemple #14
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;
}
Exemple #15
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPGRANTPARAMS lpgrant = (LPGRANTPARAMS)lParam;
   HWND hwndGrantees  = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GRANTEES);
   HWND hwndDBevents  = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT);
   char szTitle [MAX_TITLEBAR_LEN];
   char szFormat[100];
   //
   // force catolist.dll to load
   //
   CATOListDummy();

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

   LoadString (hResource, (UINT)IDS_T_GRANT_DBEVENT, szFormat, sizeof (szFormat));
   wsprintf (szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()),
       lpgrant->DBName);
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_GRANT_DBEVENT));

   Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_USER), TRUE);
   FillGrantees (hwndGrantees, OT_USER);

   if (!CAListBoxFillDBevents (hwndDBevents, lpgrant->DBName))
       CAListBoxDestroyItemData (hwndDBevents);

   if (lpgrant->PreselectPrivileges [GRANT_RAISE])
       Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_RAISE),    TRUE);
   if (lpgrant->PreselectPrivileges [GRANT_REGISTER])
       Button_SetCheck (GetDlgItem (hwnd, IDC_GRANT_DBEVENT_REGISTER), TRUE);

   if (x_strlen (lpgrant->PreselectGrantee) > 0)
       CAListBox_SelectString (hwndGrantees, -1, lpgrant->PreselectGrantee);
   if (x_strlen (lpgrant->PreselectObject) > 0)
       CAListBoxSelectStringWithOwner (hwndDBevents, lpgrant->PreselectObject, lpgrant->PreselectObjectOwner);
   EnableDisableOKButton  (hwnd);
   
   richCenterDialog(hwnd);
   return TRUE;
}
Exemple #16
0
BOOL CxDlgUserMod::GenerateUsermodSyntax(CString& csCommandSyntax)
{
	TCHAR szusernamebuf[MAXOBJECTNAME];
	LPOBJECTLIST lpObjList = m_lpTblParam.lpTable;

	csCommandSyntax = _T("usermod ");
	csCommandSyntax += m_csDBName;
	if ( IsStarDatabase(m_nNodeHandle, (LPUCHAR)(LPCTSTR)m_csDBName) )
	{
		csCommandSyntax += _T("/star");
	}


	// -u flag
	DBAGetUserName ((LPUCHAR)(LPCTSTR)GetVirtNodeName(m_nNodeHandle),(LPUCHAR) szusernamebuf);
	csCommandSyntax += _T(" -u");
	csCommandSyntax += szusernamebuf;

	// tables list or current selected table
	if (bChooseTableEnable)
	{
		if (IsDlgButtonChecked(IDC_CHECK_SPECIF_TABLES) == BST_CHECKED)
		{
			while (lpObjList)
			{
				csCommandSyntax += _T(" ");
				csCommandSyntax += CString(StringWithoutOwner((LPUCHAR)lpObjList->lpObject));
				lpObjList = (LPOBJECTLIST)lpObjList->lpNext;
			}
		}
	}
	else
	{
		csCommandSyntax += _T(" ");
		csCommandSyntax += m_csTableName;
	}

	// -noint flag
	if (IsDlgButtonChecked(IDC_CHECK_NOINTERRUPT) == BST_CHECKED)
		csCommandSyntax += _T(" -noint");

	return TRUE;
}
Exemple #17
0
// create command line and execute remote command
static BOOL SendCommand(HWND hwnd)
{
   //create the command for remote 
   UCHAR buf2[MAXOBJECTNAME*3];
   UCHAR buf[MAX_RMCMD_BUFSIZE];
 
   int iReplicVersion;
   LPRECONCILER  lpreconciler  = GetDlgProp(hwnd);
   LPUCHAR vnodeName = GetVirtNodeName(GetCurMdiNodeHandle ());

   // Get everything from dd_connections 
   iReplicVersion=GetReplicInstallStatus(GetCurMdiNodeHandle (),lpreconciler->DBName,
                                                                lpreconciler->DbaName);
   // Get additionnal information on current CDDS: name,error ,collision
   if (iReplicVersion == REPLIC_V11)  {
	   UCHAR tmpusername[MAXOBJECTNAME];
	   DBAGetUserName(vnodeName,tmpusername);
 
       wsprintf(buf,"reconcil %s %s %s -u%s %s",lpreconciler->DBName,
                                           lpreconciler->TarGetDbNumber,
                                           lpreconciler->CddsNo,
                                           tmpusername,
										   lpreconciler->StarTime);
       wsprintf(buf2,ResourceString(IDS_REPLIC_REC_1PARM_TITLE), lpreconciler->DBName);
   }
   else {
       wsprintf(buf,"reconcil %s::%s %s %s %s %s", vnodeName,
                                                   lpreconciler->DBName,
                                                   lpreconciler->DbaName,
                                                   lpreconciler->TarGetDbNumber,
                                                   lpreconciler->CddsNo,
                                                   lpreconciler->StarTime);
       wsprintf(buf2,ResourceString(IDS_REPLIC_REC_2PARMS_TITLE),
                  vnodeName,
                  lpreconciler->DBName);
   }

   execrmcmd(vnodeName,buf,buf2);

   return(TRUE);
}
Exemple #18
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;
   }
}
Exemple #19
0
static BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   int  nProd = 0;
   char Title[200];
   HWND hwndProducts   = GetDlgItem(hwnd, IDC_PRODUCTS);
   HWND hwndTables     = GetDlgItem(hwnd, IDC_TABLES);
   HWND hwndtableall   = GetDlgItem(hwnd, IDC_TABLE_ALL);
   HWND hwndproductall = GetDlgItem(hwnd, IDC_PRODUCT_ALL);
   
   LPRECONCILER lpmod = (LPRECONCILER)lParam;
   
   ZEROINIT (Title);

   if (!AllocDlgProp(hwnd, lpmod))
      return FALSE;
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RECONCILER));
   
   //Fill the windows title bar
   GetWindowText(hwnd,Title,GetWindowTextLength(hwnd)+1);
   x_strcat(Title, " ");
   x_strcat(Title, GetVirtNodeName ( GetCurMdiNodeHandle ()));
   x_strcat(Title, "::");
   x_strcat(Title,lpmod->DBName);

   SetWindowText(hwnd,Title);

   if (!OccupyDbnumberControl(hwnd)
    || !OccupyCddsControl(hwnd))
   {
     ASSERT(NULL);
     EndDialog(hwnd, FALSE);
     return TRUE;
   }
	
   InitialiseEditControls(hwnd);
   EnableDisableOKButton (hwnd);
   richCenterDialog(hwnd);
   return TRUE;
}
Exemple #20
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPREPLMAILPARAMS lpmail = (LPREPLMAILPARAMS)lParam;
   HWND hwndMailText   = GetDlgItem (hwnd, IDC_MAIL_TEXT);
   char szFormat[100];
   char szTitle [MAX_TITLEBAR_LEN];

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

   LoadString (hResource, (UINT)IDS_T_MAIL, szFormat, sizeof (szFormat));
   wsprintf (szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()),
       lpmail->DBName);
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_MAIL));

   Edit_LimitText (hwndMailText, MAX_MAIL_TEXTLEN-1);
   EnableDisableOKButton (hwnd);
       
   richCenterDialog(hwnd);
   return TRUE;
}
Exemple #21
0
int StartReplicServer (int hdl,  LPREPLICSERVERDATAMIN lpReplicServerDta )
{
	const LPCTSTR lpszIngresServiceName = _T("Ingres_Database_%s");
	const LPCTSTR lpszReplicServiceTempl = _T("Ingres_Replicator_%s_%d");
	int ires = RES_SUCCESS;
	TCHAR  tchszCommandLine[200];
	TCHAR* tchszCurLine;
	CString strVName = lpReplicServerDta->RunNode;
	CString msg;

#if !defined (MAINWIN)
	CString strLoc = LIBMON_getLocalHostName();
	if ( strVName.CompareNoCase(strLoc) == 0)
	{
		CString strReplicServiceName;
		CString strIngresServiceName;
		CString strII = INGRESII_QueryInstallationID(FALSE);

		if( strII.IsEmpty() )
		{
			AfxMessageBox (IDS_E_INSTALLATION_NOT_FOUND);
			return RES_ERR;
		}
		strReplicServiceName.Format(lpszReplicServiceTempl, (LPCTSTR)strII, lpReplicServerDta->serverno);
		strIngresServiceName.Format(lpszIngresServiceName,  (LPCTSTR)strII);

		if (!IsServiceInstalled ((LPCTSTR)strReplicServiceName)) 
		{
			// search max server no on local (run) node
			RESOURCEDATAMIN  ResDtaMin;
			REPLICSERVERDATAMIN ReplicSvrDta;
			int i,iservermax=0;
			LPUCHAR vnodeName = (LPUCHAR)GetVirtNodeName ( hdl );
			FillResStructFromDB(&ResDtaMin, lpReplicServerDta->ParentDataBaseName);

			/* 23-Dec-98 :  fixed "error system 3" when exiting the product, in the case       */
			/* VDBA detected that the replicator services were not installed, and proposed     */
			/* to install them automatically.                                                  */
			/* implementation: Replaced GetFirstMonInfo-GetNextMonInfo loop                    */
			/* with DBAGetFirstObject-DBAGetNextObject loop.                                   */
			/* this avoids using the cache for getting the list of servers                     */
			/* (for calculating the argument to be passed to "repinst"), because of a          */
			/* restriction of the cache for repl.servers: cache entries are attached to a node,*/
			/* but for repl.servers, the given entry needs to be connected to other nodes.     */
			/* A special management is implemented for "Monitor windows" attached cache        */
			/* entries, but in the current case, there isn't a monitor window open on the      */
			/* used node (which can be different from the open Monitor Window from which       */
			/* this stuff has been called.                                                     */

			int ires =DBAGetFirstObject (
				(LPUCHAR)vnodeName,
				OT_MON_REPLIC_SERVER,
				1,
				(LPUCHAR *)&ResDtaMin,
				TRUE,
				(LPUCHAR)&ReplicSvrDta,
				NULL,NULL);
			while (ires==RES_SUCCESS) 
			{
				if (! lstrcmpi((LPCTSTR)lpReplicServerDta->RunNode, (LPCTSTR)ReplicSvrDta.RunNode)) {
					if (ReplicSvrDta.serverno>iservermax)
						iservermax=ReplicSvrDta.serverno;
				}
				ires=DBAGetNextObject((LPUCHAR)&ReplicSvrDta,NULL,NULL);
			}
			if ( iservermax == 0 ) {
				//_T("Cannot retrieve number of server(s) - Install services Aborted."
				AfxMessageBox(IDS_E_NB_SERVERS);
				return RES_ERR;
			}
			//"The Ingres Replicator %d service is not installed.\n"
			//"Do you want to invoke 'repinst %d' in the background, "
			//"in order to install all Replicator services required by your replication scheme?"
			msg.Format(IDS_F_SERVICE_NOT_INSTALL,lpReplicServerDta->serverno,iservermax);
			int iansw;
			if (GVvista())
			{
				CMessageBox imb(NULL, msg);
				iansw=imb.DoModal();
			}
			else
				iansw = AfxMessageBox (msg, MB_YESNO|MB_ICONQUESTION);
			if (iansw == IDNO)
				return RES_ERR;
			CString Cmd;
			Cmd.Format(_T("repinst %d"),iservermax);
			if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0) {
				AfxMessageBox (IDS_E_REPINST_UTIL);//"Failure in invoking the repinst utility"
				return RES_ERR;
			}
			if (!IsServiceInstalled ((LPCTSTR)strReplicServiceName)) {
				AfxMessageBox (IDS_E_REPINST_INSTALL);//"The service has not been installed properly by the repinst utility"
				return RES_ERR;
			}
			//"DBA passwords are required for all services that have been created\n"
			//"Do you want to enter them now?\n"
			//"(If not, you will need to use the Control Panel Services option.)\n"
			//"(Some other settings for these services can only be changed through the control panel.)
			if (GVvista())
			{
				CString str;
				str.Format(IDS_I_PASSWORD_REQUIRED);
				CMessageBox imb(NULL, str);
				iansw = imb.DoModal();	
			}
			else
				iansw = AfxMessageBox (IDS_I_PASSWORD_REQUIRED, MB_YESNO|MB_ICONQUESTION);
			if (iansw == IDNO)
				return RES_ERR;
			// ask for user/password
			CaServiceConfig ServiceParms;
			if (!FillServiceConfig  (ServiceParms))
				return RES_ERR;
			BOOL bOK=TRUE;
			for (i=1;i<=iservermax;i++) {
				strReplicServiceName.Format(lpszReplicServiceTempl, (LPCTSTR)strII, i);
				if (GVvista())
				{
				     CString Cmd;
				     Cmd.Format(_T("repinst config %d -username:%s -password:%s"), iservermax, 
						ServiceParms.m_strAccount, ServiceParms.m_strPassword);
				     if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0)
				     {
				     	//"Failure in user/password setup for the 'Ingres Replicator %d' service"
					msg.Format(IDS_E_USER_PASSWORD_NB,i);
					AfxMessageBox (msg);
					bOK=FALSE;
				     }
				}
				else
				if (!SetServicePassword ((LPCTSTR) strReplicServiceName, ServiceParms)) {
					//"Failure in user/password setup for the 'Ingres Replicator %d' service"
					msg.Format(IDS_E_USER_PASSWORD_NB,i);
					AfxMessageBox (msg);
					bOK=FALSE;
				}
			}
			if (!bOK)
				return RES_ERR;
			if (!IsServiceRunning(strIngresServiceName)) {
				//"Ingres is currently not started as a service.\n"
				//"You must close all connections in VDBA (or Exit VDBA), "
				//"then stop Ingres, and restart it as a Service if you want "
				//"to start a replicator server on the local installation.\n"
				//"You must also make sure that the user/password for the Ingres service is correct.\n"
				//"Do you want to apply the user/password that you just entered for the replicator services?"
				iansw = AfxMessageBox (IDS_I_INGRES_NOT_STARTED, MB_YESNO|MB_ICONQUESTION);
				if (iansw == IDYES) {
					if (GVvista())
					{
					     CString Cmd;
					     Cmd.Format(_T("repinst config %d -username:%s -password:%s"), iservermax, 
							ServiceParms.m_strAccount, ServiceParms.m_strPassword);
					     if (LIBMON_Mysystem((LPTSTR)(LPCTSTR)Cmd)<0)
					     {
						//"Failure in user/password setup for the 'Ingres Replicator %d' service"
						msg.Format(IDS_E_USER_PASSWORD_NB,i);
						AfxMessageBox (msg);
						bOK=FALSE;
					     }
					}
					else
					if (!SetServicePassword ((LPCTSTR) strReplicServiceName, ServiceParms)) {
						//"Failure in user/password setup for the 'Ingres Replicator %d' service"
						msg.Format(IDS_E_USER_PASSWORD_NB,i);
						AfxMessageBox (msg);
						bOK=FALSE;
					}
				}
				return RES_ERR;
			}
		}
		if (!IsServiceRunning(strIngresServiceName)) {
			//"Ingres is currently not started as a service.\n"
			//"You must close all connections in VDBA (or Exit VDBA), "
			//"then stop Ingres, and restart it as a Service if you want "
			//"to start a replicator server on the local installation.\n"
			//"You must also make sure that the user/password for the Ingres service is correct.");
			AfxMessageBox (IDS_E_INGRES_NOT_STARTED);
			return RES_ERR;
		}
	}
#endif // MAINWIN

	// Verify if vnode name exist before start the remote command.
	VerifyAndUpdateVnodeName (&strVName);
	if (strVName.IsEmpty())
		return RES_ERR;

	_stprintf(tchszCommandLine, _T("ddstart %d"), lpReplicServerDta->serverno);

	if (!LIBMON_ExecRmcmdInBackground((TCHAR *)lpReplicServerDta->RunNode, tchszCommandLine, _T("")))
		return RES_ERR;

	// check for error (output line starting with a '*' character )
	ires=RES_SUCCESS;
	tchszCurLine=LIBMON_GetFirstTraceLine();
	while (tchszCurLine) {
		if (tchszCurLine[0]==_T('*'))
			CMnext(tchszCurLine);
		if (_tcslen(tchszCurLine)) {
			CString Msg;
			/* "Error from RMCMD server on '%s' :\n%s" */
			Msg.Format(IDS_E_ERROR_RMCMD, (LPCTSTR)strVName, tchszCurLine);
			AfxMessageBox(Msg, MB_ICONEXCLAMATION | MB_OK | MB_TASKMODAL);
			ires=RES_ERR;
		}
		tchszCurLine = LIBMON_GetNextSignificantTraceLine();
	}

	return ires;
}
Exemple #22
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;
}
Exemple #23
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPSECURITYALARMPARAMS lpsecurity = GetDlgProp (hwnd);
   HWND hwndUsers    = GetDlgItem (hwnd, IDC_SALARM_BYUSER );
   HWND hwndTables = GetDlgItem (hwnd, IDC_SALARM_ONTABLE );
   HWND hwndName   = GetDlgItem (hwnd, IDC_SALARM_NAME );        

   int idu;    
   int i, n, idt;   
   int ires;
   char szName [MAXOBJECTNAME];

   switch (id)
   {
       case IDOK:
           if (!FillStructureFromControls (hwnd, lpsecurity))
               break;
           //
           // Call the low level function to write data on disk
           //

           ires = DBAAddObject
               (GetVirtNodeName (GetCurMdiNodeHandle ()),
               OTLL_SECURITYALARM,
               (void *) lpsecurity );

           if (ires != RES_SUCCESS)
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CREATE_SECURITY_FAILED, ires);
               break;
           }
           else
               EndDialog (hwnd, TRUE);
           
           FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
           break;

       case IDCANCEL:
           EndDialog (hwnd, FALSE);
           FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
           break;

       case IDC_SALARM_BYUSER:
           if (Edit_GetText (hwndName, szName, sizeof (szName)) != 0 &&
              CAListBox_GetSelCount (hwndUsers) > 1)   {
                idu=CAListBox_GetCurSel (hwndUsers);
                n = CAListBox_GetCount (hwndUsers);
                for (i=0; i<n; i++)
                       CAListBox_SetSel (hwndUsers, FALSE, i);
               CAListBox_SetCurSel (hwndUsers, idu);
               CAListBox_SetSel (hwndUsers, TRUE, idu);
               //"Multiple auth-id is not allowed if the security alarm has a name."
               MessageBox(hwnd,
                   ResourceString(IDS_ERR_USING_CHECKPOINT),
                   NULL, MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL);
                   EnableDisableOKButton (hwnd);
             }
           else if (CAListBox_GetSelCount (hwndUsers) > 1)
                  Edit_Enable(hwndName,FALSE);
                else
                  Edit_Enable(hwndName,TRUE);
               
           EnableDisableOKButton (hwnd);
           break;

       case IDC_SALARM_ONTABLE:
           if (codeNotify == CALBN_CHECKCHANGE) {
               idt = CAListBox_GetCurSel (hwndTables);              
                n = CAListBox_GetCount (hwndTables);                
       
                for (i=0; i<n; i++)
                  CAListBox_SetSel (hwndTables, FALSE, i);      
           
               CAListBox_SetCurSel (hwndTables, idt);              
                CAListBox_SetSel (hwndTables, TRUE, idt);
               if (bNoDisplayMessageDB == FALSE) {
                  int iret;
                  //"Only one database can be checked. Previous database, if any, was unchecked.\nDon't display this message any more?"
                  iret = MessageBox(hwnd, ResourceString(IDS_ERR_DATABASE_BE_CHECKED),
                         NULL, MB_OKCANCEL | MB_ICONEXCLAMATION | MB_TASKMODAL);
                  if (iret == IDOK)
                     bNoDisplayMessageDB=TRUE;
               }
           }
           EnableDisableOKButton (hwnd);
           break;

       case IDC_SALARM_SUCCESS:
       case IDC_SALARM_FAILURE:
       case IDC_SALARM_SUCCESSFAILURE:
       case IDC_SALARM_SELECT:
       case IDC_SALARM_DELETE:
       case IDC_SALARM_INSERT:
       case IDC_SALARM_UPDATE:
       case IDC_SALARM_CONNECT:
       case IDC_SALARM_DISCONNECT:
           EnableDisableOKButton (hwnd);
           break;

       case IDC_SALARM_USER:
           if (Button_GetCheck (hwndCtl))
           {
               CAListBox_ResetContent (hwndUsers);
               CAListBoxFillUsers     (hwndUsers);
               EnableDisableOKButton (hwnd);
           }
           break;

       case IDC_SALARM_GROUP:
           if (Button_GetCheck (hwndCtl))
           {
               CAListBox_ResetContent (hwndUsers);
               CAListBoxFillGroups    (hwndUsers);
               EnableDisableOKButton (hwnd);
           }
           break;

       case IDC_SALARM_ROLE:
           if (Button_GetCheck (hwndCtl))
           {
               CAListBox_ResetContent (hwndUsers);
               CAListBoxFillRoles     (hwndUsers);
               EnableDisableOKButton  (hwnd);
           }
           break;

       case IDC_SALARM_PUBLIC:
           if (Button_GetCheck (hwndCtl))
           {
               CAListBox_ResetContent (hwndUsers);
               EnableDisableOKButton  (hwnd);
           }
           break;

       case IDC_SALARM_DBEVENT:
           if (codeNotify == CBN_SELCHANGE)
           {
               char szItem [MAXOBJECTNAME];

               ZEROINIT (szItem);
               ComboBox_GetText (hwndCtl, szItem, sizeof (szItem));

               if (x_strcmp (szItem, szSecurityDBEvent) == 0)
               {
                   lpsecurity->bDBEvent = FALSE;
                   EnableControl (hwnd, FALSE);
               }
               else
                   EnableControl (hwnd, TRUE);
           }
           break;
   }
}
Exemple #24
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;
}
Exemple #25
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;
}
Exemple #26
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPREVOKEPARAMS lprevoke = GetDlgProp (hwnd);
   HWND    hwndGrantees  = GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANTEES);

   switch (id)
   {
       case IDOK:
       {
           TCHAR tchNameObject[MAXOBJECTNAME];
           int ires;
           int max_item_number;
           
           max_item_number = CAListBox_GetSelCount (hwndGrantees);
           if (max_item_number >= 1)
           {
               lprevoke->lpgrantee = AddItemToListQuoted (hwndGrantees);
               if (!lprevoke->lpgrantee)
               {
                   ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
                   break;
               }
           }
           if (Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_USER)))
               lprevoke->GranteeType = OT_USER;
           else
           if (Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GROUP)))
               lprevoke->GranteeType = OT_GROUP;
           else
           if (Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_ROLE)))
               lprevoke->GranteeType = OT_ROLE;
           else
           if (Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PUBLIC)))
           {
               lprevoke->GranteeType = OT_PUBLIC;     // Public
               FreeObjectList (lprevoke->lpgrantee);
               lprevoke->lpgrantee = NULL;
               lprevoke->lpgrantee = APublicUser ();
               if (!lprevoke->lpgrantee)
               {
                   ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
                   break;
               }
           }
           
           lprevoke->grant_option = Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANT_OPTION));
           lprevoke->cascade      = Button_GetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_CASCADE));
           wsprintf(tchNameObject,"%s.%s",QuoteIfNeeded(lprevoke->PreselectObjectOwner),QuoteIfNeeded(lprevoke->PreselectObject));
           lprevoke->lpobject     = InsertTableName (tchNameObject);
           if (!lprevoke->lpobject)
           {
               FreeObjectList (lprevoke->lpobject);
               lprevoke->lpobject = NULL;
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               break;
           }
           
           ires = DBADropObject
                   ( GetVirtNodeName ( GetCurMdiNodeHandle ()),
                     OTLL_GRANT,
                     (void *) lprevoke);

           if (ires != RES_SUCCESS)
           {
               FreeObjectList (lprevoke->lpgrantee);
               FreeObjectList (lprevoke->lpobject);
               lprevoke->lpobject = NULL;
               lprevoke->lpgrantee= NULL;
               switch (lprevoke->ObjectType)
               {
                   case OT_TABLE:
                       ErrorMessage ((UINT)IDS_E_REVOKE_TABLE_FAILED, ires);
                       break;
                   case OT_PROCEDURE:
                       ErrorMessage ((UINT)IDS_E_REVOKE_PROCEDURE_FAILED, ires);
                       break;
                   case OT_DBEVENT:
                       ErrorMessage ((UINT)IDS_E_REVOKE_DBEVENT_FAILED, ires);
                       break;
                   case OT_SEQUENCE:
                       ErrorMessage ((UINT)IDS_E_REVOKE_SEQUENCE_FAILED, ires);
                       break;
               }
               break;
           }
           else 
           {
               EndDialog (hwnd, TRUE);
           }
           FreeObjectList (lprevoke->lpgrantee);
           FreeObjectList (lprevoke->lpobject);
           lprevoke->lpobject = NULL;
           lprevoke->lpgrantee= NULL;
       }
       break;

       case IDCANCEL:
           FreeObjectList (lprevoke->lpgrantee);
           FreeObjectList (lprevoke->lpobject);
           lprevoke->lpobject = NULL;
           lprevoke->lpgrantee= NULL;
           EndDialog (hwnd, FALSE);
           break;

       case IDC_REVOKE_TABLE_USER:
           CAListBox_ResetContent (hwndGrantees);
           lprevoke->GranteeType = OT_USER;
           FillGrantedUsers (hwndGrantees, lprevoke, HaveBeenGranted);
           EnableDisableOKButton  (hwnd);
           break;

       case IDC_REVOKE_TABLE_GROUP:
           CAListBox_ResetContent (hwndGrantees);
           lprevoke->GranteeType = OT_GROUP;
           FillGrantedUsers (hwndGrantees, lprevoke, HaveBeenGranted);
           EnableDisableOKButton  (hwnd);
           break;

       case IDC_REVOKE_TABLE_ROLE:
           CAListBox_ResetContent (hwndGrantees);
           lprevoke->GranteeType = OT_ROLE;
           FillGrantedUsers (hwndGrantees, lprevoke, HaveBeenGranted);
           EnableDisableOKButton  (hwnd);
           break;

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

       case IDC_REVOKE_TABLE_GRANTEES:
           if (lprevoke->GranteeType != OT_UNKNOWN)
               EnableDisableOKButton  (hwnd);
           else
               EnableDisableOKButton2 (hwnd);

           break;
   }
}
Exemple #27
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPREVOKEPARAMS lprevoke = (LPREVOKEPARAMS)lParam;
   HWND hwndGrantees    = GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANTEES);
   char szTitle [90];
   char szStr   [MAX_TITLEBAR_LEN];
   int  i, positive_privilege;
   BOOL bGrantAll = FALSE;
   char buffer  [MAXOBJECTNAME];
   LPUCHAR parentstrings [MAXPLEVEL];

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


   for (i = 0; i < GRANT_MAX_PRIVILEGES; i++)
   {
       if (lprevoke->PreselectPrivileges [i])
       {
           positive_privilege = i;
           break;
       }
   }

   switch (lprevoke->ObjectType)
   {
       case OT_TABLE:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_TABLE));
           break;
       case OT_VIEW:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_VIEW));
           break;
       case OT_DBEVENT:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REVOKE_DBEVENT));
           break;
       case OT_PROCEDURE:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RVKGPROC));
           break;
       case OT_SEQUENCE:
           lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_RVKGSEQUENCE));
           break;
   }

   switch (positive_privilege)
   {
       case GRANT_SELECT    :
           LoadString (hResource, (UINT)IDS_T_REVOKE_SELECT_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_SELECT] = TRUE;
           if (lprevoke->ObjectType == OT_TABLE)
               HaveBeenGranted = OT_TABLEGRANT_SEL_USER;
           else
               HaveBeenGranted = OT_VIEWGRANT_SEL_USER;
           break;
       case GRANT_INSERT    :
           LoadString (hResource, (UINT)IDS_T_REVOKE_INSERT_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_INSERT] = TRUE;
           if (lprevoke->ObjectType == OT_TABLE)
               HaveBeenGranted = OT_TABLEGRANT_INS_USER;
           else
               HaveBeenGranted = OT_VIEWGRANT_INS_USER;
           break;
       case GRANT_UPDATE    :
           LoadString (hResource, (UINT)IDS_T_REVOKE_UPDATE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_UPDATE] = TRUE;
           if (lprevoke->ObjectType == OT_TABLE)
               HaveBeenGranted = OT_TABLEGRANT_UPD_USER;
           else
               HaveBeenGranted = OT_VIEWGRANT_UPD_USER;
           break;
       case GRANT_DELETE    :
           LoadString (hResource, (UINT)IDS_T_REVOKE_DELETE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_DELETE] = TRUE;
           if (lprevoke->ObjectType == OT_TABLE)
               HaveBeenGranted = OT_TABLEGRANT_DEL_USER;
           else
               HaveBeenGranted = OT_VIEWGRANT_DEL_USER;
           break;
       case GRANT_COPY_INTO :
           LoadString (hResource, (UINT)IDS_T_REVOKE_COPYINTO_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_COPY_INTO] = TRUE;
           HaveBeenGranted = OT_TABLEGRANT_CPI_USER;
           break;
       case GRANT_COPY_FROM :
           LoadString (hResource, (UINT)IDS_T_REVOKE_COPYFROM_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_COPY_FROM] = TRUE; 
           HaveBeenGranted = OT_TABLEGRANT_CPF_USER;
           break;
       case GRANT_REFERENCE :
           LoadString (hResource, (UINT)IDS_T_REVOKE_REFERENCE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_REFERENCE] = TRUE;
           HaveBeenGranted = OT_TABLEGRANT_REF_USER;
           break;
       case GRANT_RAISE     :
           LoadString (hResource, (UINT)IDS_T_REVOKE_RAISE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_RAISE] = TRUE;
           HaveBeenGranted = OT_DBEGRANT_RAISE_USER;
           break;
       case GRANT_REGISTER  :
           LoadString (hResource, (UINT)IDS_T_REVOKE_REGISTER_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_REGISTER] = TRUE;
           HaveBeenGranted = OT_DBEGRANT_REGTR_USER;
           break;
       case GRANT_EXECUTE   :
           LoadString (hResource, (UINT)IDS_T_REVOKE_EXECUTE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_EXECUTE] = TRUE;
           HaveBeenGranted = OT_PROCGRANT_EXEC_USER;
           break;
       case GRANT_NEXT_SEQUENCE   :
           LoadString (hResource, (UINT)IDS_T_REVOKE_NEXT_SEQUENCE_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_NEXT_SEQUENCE] = TRUE;
           HaveBeenGranted = OT_SEQUGRANT_NEXT_USER;
           break;
       case GRANT_ALL       :
           LoadString (hResource, (UINT)IDS_T_REVOKE_ALL_ON, szTitle, sizeof (szTitle));
           lprevoke->Privileges [GRANT_ALL] = TRUE;
           bGrantAll = TRUE;
           switch (lprevoke->ObjectType)
           {
               case OT_TABLE:
                   break;
               case OT_PROCEDURE:
                   break;
               case OT_DBEVENT:
                   break;

           }
           HaveBeenGranted = -1;
           break;
   }

   parentstrings [0] = lprevoke->DBName;
   GetExactDisplayString (
       lprevoke->PreselectObject,
       lprevoke->PreselectObjectOwner,
       lprevoke->ObjectType,
       parentstrings,
       buffer);

   wsprintf (
       szStr,
       szTitle,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lprevoke->DBName,
       buffer);
   SetWindowText (hwnd, szStr);

   if ( lprevoke->ObjectType == OT_SEQUENCE)
   {
      //Hide control the controls not used for sequences
      ShowWindow( GetDlgItem (hwnd,IDC_REVOKE_TABLE_GRANT_OPTION) ,SW_HIDE); // Hided "With grant Option" control
      ShowWindow( GetDlgItem (hwnd,IDC_REVOKE_TABLE_PRIVILEGE)    ,SW_HIDE); 
      ShowWindow( GetDlgItem (hwnd,102)                           ,SW_HIDE);
      ShowWindow( GetDlgItem (hwnd,5020)                          ,SW_HIDE);
      // Unchecked the controls not used
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PRIVILEGE),    FALSE);
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_CASCADE),      TRUE);
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_RESTRICT),     FALSE);
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GRANT_OPTION), FALSE);
   }
   else
   {
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PRIVILEGE),TRUE);
      Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_CASCADE),  TRUE);
   }

   if (lprevoke->GranteeType == OT_UNKNOWN)
   {
       HandleUnknounObject (hwnd);
   }
   else   
   if (lprevoke->GranteeType == OT_GROUP)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_GROUP), TRUE);
       FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted);
   }
   else
   if (lprevoke->GranteeType == OT_ROLE)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_ROLE),  TRUE);
       FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted);
   }
   else
   {
       if  (x_strcmp (lprevoke->PreselectGrantee, lppublicdispstring()) == 0)
           Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_PUBLIC),  TRUE);
       else
       {
           lprevoke->GranteeType = OT_USER;
           Button_SetCheck (GetDlgItem (hwnd, IDC_REVOKE_TABLE_USER),  TRUE);
           FillGrantedUsers(hwndGrantees, lprevoke, HaveBeenGranted);
       }
   }

   if (x_strlen (lprevoke->PreselectGrantee) > 0)
   {
       CAListBox_SelectString (hwndGrantees, -1, lprevoke->PreselectGrantee);
   }

   if (lprevoke->GranteeType != OT_UNKNOWN)
       EnableDisableOKButton  (hwnd);
   
   richCenterDialog(hwnd);
   return TRUE;
}
Exemple #28
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;

   }
}
Exemple #29
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;
}
Exemple #30
0
LONG CuDlgDomPropDDb::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
  }

  ResetDisplay();
  // Get info on the object
  DATABASEPARAMS DbParams;
  memset (&DbParams, 0, sizeof (DbParams));

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

  //
  // Get Detail Info
  //
  lstrcpy ((LPTSTR)DbParams.objectname, (LPCTSTR)lpRecord->objName);
  DbParams.DbType = lpRecord->parentDbType;
  int dummySesHndl;
  int iResult = GetDetailInfo ((LPUCHAR)GetVirtNodeName(nNodeHandle),
                               OT_DATABASE,
                               &DbParams,
                               FALSE,
                               &dummySesHndl);
  if (iResult != RES_SUCCESS) {
    ASSERT (FALSE);

    // Reset m_Data
    CuDomPropDataDDb 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_csOwner  = DbParams.szOwner ;
  m_Data.m_csLocDb  = DbParams.szDbDev ;
  m_Data.m_csLocChk = DbParams.szChkpDev;
  m_Data.m_csLocJnl = DbParams.szJrnlDev;
  m_Data.m_csLocDmp = DbParams.szDmpDev;
  m_Data.m_csLocSrt = DbParams.szSortDev;

  // liberate detail structure
  FreeAttachedPointers (&DbParams, OT_DATABASE);

  //
  // Get name of Coordinator Database
  //
  int     iret;
  LPUCHAR aparentsTemp[MAXPLEVEL];

  LPUCHAR aparentsResult[MAXPLEVEL];
  UCHAR   bufParResult0[MAXOBJECTNAME];
  UCHAR   bufParResult1[MAXOBJECTNAME];
  UCHAR   bufParResult2[MAXOBJECTNAME];

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

  aparentsResult[0] = bufParResult0;
  aparentsResult[1] = bufParResult1;
  aparentsResult[2] = bufParResult2;

  memset (&bufComplim, '\0', sizeof(bufComplim));
  memset (&bufOwner, '\0', sizeof(bufOwner));
  aparentsTemp[0] = lpRecord->objName;
  aparentsTemp[1] = aparentsTemp[2] = NULL;

  iret =  DOMGetFirstRelObject(nNodeHandle,
                               OTR_CDB,
                               1,                           // level,
                               aparentsTemp,                // Temp mandatory!
                               TRUE,                        // bwithsystem
                               NULL,                        // base owner
                               NULL,                        // other owner
                               aparentsResult,
                               buf,
                               bufOwner,
                               bufComplim);
  if (iret != RES_SUCCESS) {
    ASSERT (FALSE);

    // Reset m_Data
    CuDomPropDataDDb tempData;
    m_Data = tempData;

    // Refresh display
    RefreshDisplay();

    return 0L;
  }
  m_Data.m_csCoordinator = buf;

  // Refresh display
  RefreshDisplay();

  return 0L;
}