Пример #1
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPLOCATEPARAMS lplocate   = GetDlgProp (hwnd);

   switch (id)
   {
       case IDOK:
           if (FillStructureFromControls (hwnd))
               EndDialog (hwnd, TRUE);
           else
           {
               break;
           }
               
           break;

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

       case IDC_LOCATE_FIND:
           if (codeNotify == EN_CHANGE)
           {
               //ProhibitString_all    (hwnd);
               EnableDisableOKButton (hwnd);
           }
           break;

       case IDC_LOCATE_OBJECTTYPE:
           if (codeNotify == CBN_SELCHANGE)
           {
               /* Comment on Sept 29'95
               ProhibitString_all    (hwnd);
               */
               EnableDisableOKButton (hwnd);
           }
           break;

       case IDC_LOCATE_DATABASE:
           if (codeNotify == CBN_SELCHANGE)
           {    
               EnableDisableOKButton (hwnd);
           }
           break;

   }
}
Пример #2
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   // Emb July 01, 97: found Useless and even gpfs with new container
   // since it sends notification messages BEFORE initdialog had a chance
   // to allocate dialog property
   //LPSTORAGEPARAMS lpstructure = GetDlgProp (hwnd);

   switch (id)
   {
       case IDOK:
           if (FillStructureFromControls (hwnd))
               EndDialog (hwnd, TRUE);
           else
               break;
           break;

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

       case IDC_RELOCATE_CONTAINER:
           switch (codeNotify)
           {
               case CN_RECSELECTED:
                   //
                   // Selection has changed
                   //
                   ContainerNewSel (hwndCtl);
                   break;

               case CN_FLDSIZED:
               case CN_HSCROLL_PAGEUP:
               case CN_HSCROLL_PAGEDOWN:
               case CN_HSCROLL_LINEUP:
               case CN_HSCROLL_LINEDOWN:
               case CN_HSCROLL_THUMBPOS:
                   ContainerUpdateCombo (hwndCtl);
                   break;

               default:
                   break;
           }
           break;
   }
}
Пример #3
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;

   }
}
Пример #4
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;
   }
}
Пример #5
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;
   }
}
Пример #6
0
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;
   }
}
Пример #7
0
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;
   }
}