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; }
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; }
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; } }
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { LPGRANTPARAMS lpgrant = GetDlgProp (hwnd); HWND hwndGrantees = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_GRANTEES); HWND hwndDBevents = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT); 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_DBEVENT_FAILED, RES_ERR); break; } else EndDialog (hwnd, TRUE); FreeAttachedPointers (lpgrant, OTLL_GRANT); break; case IDCANCEL: EndDialog (hwnd, FALSE); break; case IDC_GRANT_DBEVENT_RAISE: case IDC_GRANT_DBEVENT_REGISTER: EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_GRANTEES: case IDC_GRANT_DBEVENT_DBEVENT: EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_USER: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_USER); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_GROUP: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_GROUP); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_ROLE: CAListBox_ResetContent (hwndGrantees); FillGrantees (hwndGrantees, OT_ROLE); EnableDisableOKButton (hwnd); break; case IDC_GRANT_DBEVENT_PUBLIC: CAListBox_ResetContent (hwndGrantees); EnableDisableOKButton (hwnd); break; } }