static void OnDestroy(HWND hwnd) { HWND hwndProcedures= GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES); CAListBoxDestroyItemData (hwndProcedures); DeallocDlgProp(hwnd); lpHelpStack = StackObject_POP (lpHelpStack); }
static void OnDestroy(HWND hwnd) { HWND hwndDBevents = GetDlgItem (hwnd, IDC_GRANT_DBEVENT_DBEVENT); CAListBoxDestroyItemData (hwndDBevents); DeallocDlgProp (hwnd); lpHelpStack = StackObject_POP (lpHelpStack); }
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; }
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) { LPSECURITYALARMPARAMS lpsecurity = GetDlgProp (hwnd); int ires; 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: FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM); EndDialog (hwnd, FALSE); break; case IDC_REFALARM_BYUSER: EnableDisableOKButton (hwnd); break; case IDC_REFALARM_DATABASE: { char szDatabaseName [MAXOBJECTNAME]; HWND hwndDatabase = GetDlgItem (hwnd, IDC_REFALARM_DATABASE); HWND hwndTables = GetDlgItem (hwnd, IDC_REFALARM_ONTABLE); switch (codeNotify) { case CBN_SELCHANGE: ComboBox_GetText (hwndDatabase, szDatabaseName, sizeof (szDatabaseName)); if (x_strlen (szDatabaseName) > 0) { x_strcpy (lpsecurity->DBName, szDatabaseName); CAListBoxDestroyItemData (hwndTables); CAListBox_ResetContent (hwndTables); if (!CAListBoxFillTables (hwndTables, lpsecurity->DBName, FALSE)) CAListBoxDestroyItemData (hwndTables); } break; } EnableDisableOKButton (hwnd); } break; case IDC_REFALARM_ONTABLE: EnableDisableOKButton (hwnd); break; case IDC_REFALARM_SUCCESS: case IDC_REFALARM_FAILURE: case IDC_REFALARM_SELECT: case IDC_REFALARM_DELETE: case IDC_REFALARM_INSERT: case IDC_REFALARM_UPDATE: EnableDisableOKButton (hwnd); break; } }