Ejemplo n.º 1
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;
}
Ejemplo n.º 2
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;
}
Ejemplo n.º 3
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;

   }
}
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
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;
}
Ejemplo n.º 6
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;
   }
}
Ejemplo n.º 7
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
    LPGROUPUSERPARAMS lpusr2grp = GetDlgProp (hwnd);

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

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

        Success = CreateObject (hwnd, lpusr2grp);

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


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

    case IDC_USR2GRP_USERBOX:
    {
        switch (codeNotify)
        {
        case CBN_SELCHANGE:
            EnableDisableOKButton (hwnd);
        }
        break;
    }
    }
}
Ejemplo n.º 8
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;
}
Ejemplo n.º 9
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;
}
Ejemplo n.º 10
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;
}
Ejemplo n.º 11
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;

   }
}
Ejemplo n.º 12
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;
   }
}
Ejemplo n.º 13
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;
}
Ejemplo n.º 14
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;
   }
}
Ejemplo n.º 15
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;
}
Ejemplo n.º 16
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   HWND hwndActionUser = GetDlgItem (hwnd, IDC_AUDITDB_ACTION_USER);
   LPAUDITDBPARAMS lpauditdb  = (LPAUDITDBPARAMS)lParam;
   char szFormat [100];
   char szTitle  [MAX_TITLEBAR_LEN];

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

   ZEROINIT (table);
   table.bRefuseTblWithDupName = TRUE;
   table.lpTable = NULL;
   lpfile        = NULL;

   LoadString (hResource, (UINT)IDS_T_AUDITDB, szFormat, sizeof (szFormat));
   wsprintf (szTitle, szFormat,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lpauditdb->DBName);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_AUDITDB));

   if (lpauditdb->bStartSinceTable)
   {
     LPOBJECTLIST obj;
     char sztemp[MAXOBJECTNAME];
     // Title
     wsprintf( sztemp ," , table %s",lpauditdb->szDisplayTableName);
     lstrcat(szTitle,sztemp);
     // Fill Object List
     obj = AddListObject (table.lpTable, x_strlen (lpauditdb->szCurrentTableName) +1);
     if (obj)
     {
       lstrcpy ((UCHAR *)obj->lpObject,lpauditdb->szCurrentTableName );
       table.lpTable = obj;
     }
     else
     {
       ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
       table.lpTable = NULL;
     }
     lpfile = AddElement (lpfile,lpauditdb->szCurrentTableName );
     AddFile (hwnd, lpfile);

     ShowWindow      (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,SW_SHOW);
     ShowWindow      (GetDlgItem (hwnd, IDC_STATIC_TABLE_NAME),SW_SHOW);
     ShowWindow      (GetDlgItem (hwnd, IDC_AUDITDB_IDTABLE)  ,SW_HIDE);
     SetWindowText   (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,lpauditdb->szDisplayTableName );
     EnableWindow    (GetDlgItem (hwnd, IDC_EDIT_TABLE_NAME)  ,FALSE );
     Button_SetCheck (GetDlgItem (hwnd, IDC_AUDITDB_TABLES)   ,BST_CHECKED);
     EnableWindow    (GetDlgItem (hwnd, IDC_AUDITDB_TABLES)   ,FALSE );
   }
   SetWindowText (hwnd, szTitle);

   InitializeControls     (hwnd);

   ComboBoxFillUsers (hwndActionUser);
   EnableDisableOKButton (hwnd);
   EnableDisableControls (hwnd);

   richCenterDialog(hwnd);
   return TRUE;
}
Ejemplo n.º 17
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;
   }
}
Ejemplo n.º 18
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;
   }
}
Ejemplo n.º 19
0
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   switch (id)
   {
     case IDOK:
     {
       int nIndex;
       int nCount;
       int nLast=0;
       int max;
       int i;
       int first=0;
       UCHAR buf[MAXOBJECTNAME];
       HWND    hwndCdds     = GetDlgItem (hwnd, IDC_CDDSNUMBER);
       HWND    hwndDbNumber = GetDlgItem (hwnd, IDC_DBNUMBER);
       HWND    hwndStartTime= GetDlgItem (hwnd, IDC_STARTTIME);
       LPRECONCILER lpreconciler = GetDlgProp(hwnd);


       // fill structure with CDDS values
       nCount = 0;
       ZEROINIT (lpreconciler->CddsNo);

       nCount = CAListBox_GetSelCount(hwndCdds);
       max    = CAListBox_GetCount(hwndCdds);
       
       if (nCount != max)
         {
         for (i=0;i<max;i++)
           {
           if (CAListBox_GetSel (hwndCdds, i))
             {
             char szName[MAX_DBNAME_LEN];
             
             CAListBox_GetText(hwndCdds, i, szName);
             
             if (first==0 && nCount>1)
               {
               x_strcat(lpreconciler->CddsNo,"'(");
               first=1;
               }
             
             x_strcat(lpreconciler->CddsNo,szName);
             
             nLast++;

             if ( nLast == nCount && nCount>1 )
               x_strcat(lpreconciler->CddsNo,")'");
             else
               {
               if (nCount>1)
                 x_strcat(lpreconciler->CddsNo,",");
               }
             }
           }
         }
       else
         x_strcat(lpreconciler->CddsNo,"all ");

       // Fill structure with Targetdbnumber
       nIndex=ComboBox_GetCurSel(hwndDbNumber);
       ComboBox_GetLBText(hwndDbNumber, nIndex, buf);
       
       GetIntFromStartofString( buf, lpreconciler->TarGetDbNumber);

       //sscanf (buf,"%s",lpreconciler->TarGetDbNumber );

       //Fill structure with the Start time
       Edit_GetText(hwndStartTime, buf, MAXOBJECTNAME );
       x_strcpy (lpreconciler->StarTime,buf);
       
       if (SendCommand(hwnd)==TRUE)
         EndDialog(hwnd, TRUE);

       break;
     }

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

     case IDC_DBNUMBER:
       if ( codeNotify == CBN_SELCHANGE)
         EnableDisableOKButton (hwnd);
       break;

     case IDC_CDDSNUMBER:
       if ( codeNotify == CALBN_CHECKCHANGE || codeNotify == CALBN_SELCHANGE ||
                           codeNotify == CALBN_KILLFOCUS )
         EnableDisableOKButton (hwnd);
       break;

     case IDC_STARTTIME:
       if (codeNotify == EN_CHANGE)
         EnableDisableOKButton (hwnd);
       break;

   }
}