- Added possibility to set confirmation messages for object tools
authorVictor Kirhenshtein <victor@netxms.org>
Wed, 11 Oct 2006 22:37:38 +0000 (22:37 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Wed, 11 Oct 2006 22:37:38 +0000 (22:37 +0000)
- Object tools "Shutdown system", "Restart system", "Restart agent" asks confirmation by default
- Minor fixes

19 files changed:
ChangeLog
doc/internal/db_format_change.txt
include/netxmsdb.h
include/nms_cscp.h
include/nxclapi.h
include/nxtools.h
sql/objtools.in
sql/schema.in
src/console/win32/ObjToolPropOptions.cpp
src/console/win32/ObjToolPropOptions.h
src/console/win32/ObjectToolsEditor.cpp
src/console/win32/nxcon.clw
src/console/win32/nxcon.cpp
src/console/win32/nxcon.rc
src/console/win32/resource.h
src/libnxcl/objtools.cpp
src/server/core/objtools.cpp
src/server/core/session.cpp
src/server/tools/nxdbmgr/upgrade.cpp

index 624b2d0..7cc965f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,9 @@
 - Added possibility to specify custom threshold rearm event instead of
   SYS_THRESHOLD_REARMED
 - Added threshold processing option "Always process all thresholds"
+- Added possibility to set confirmation messages for object tools
+- Object tools "Shutdown system", "Restart system", "Restart agent"
+  asks confirmation by default
 - Windows console:
        - Console changed to use UNICODE internally
        - Event processing policy editor improved
index bbb090f..5bbb707 100644 (file)
@@ -1,4 +1,11 @@
 *************
+* 49 ==> 50 *
+*************
+
+- Column "confirmation_text" added to table "object_tools"
+
+
+*************
 * 48 ==> 49 *
 *************
 
index 6603152..6350dfb 100644 (file)
@@ -23,6 +23,6 @@
 #ifndef _netxms_db_h
 #define _netxms_db_h
 
-#define DB_FORMAT_VERSION      49
+#define DB_FORMAT_VERSION      50
 
 #endif
index aee5399..31546c5 100644 (file)
@@ -680,6 +680,7 @@ typedef struct
 #define VID_HELPDESK_REF            ((DWORD)247)
 #define VID_REPEAT_COUNT            ((DWORD)248)
 #define VID_ALL_THRESHOLDS          ((DWORD)249)
+#define VID_CONFIRMATION_TEXT       ((DWORD)250)
 
 // Variable ranges for object's ACL
 #define VID_ACL_USER_BASE           ((DWORD)0x00001000)
index e1dbb43..4f5cc12 100644 (file)
@@ -1224,6 +1224,7 @@ typedef struct
    TCHAR szDescription[MAX_DB_STRING];
    TCHAR *pszMatchingOID;
    TCHAR *pszData;
+   TCHAR *pszConfirmationText;
 } NXC_OBJECT_TOOL;
 
 
@@ -1267,6 +1268,7 @@ typedef struct
    TCHAR szDescription[MAX_DB_STRING];
    TCHAR *pszMatchingOID;
    TCHAR *pszData;
+   TCHAR *pszConfirmationText;
    DWORD *pdwACL;
    DWORD dwACLSize;
    WORD wType;
index 83d31de..2763a0a 100644 (file)
 
 
 //
-// SNMP tool flags
+// Object tool flags
 //
 
 #define TF_REQUIRES_SNMP            ((DWORD)0x00000001)
 #define TF_REQUIRES_AGENT           ((DWORD)0x00000002)
 #define TF_REQUIRES_OID_MATCH       ((DWORD)0x00000004)
+#define TF_ASK_CONFIRMATION         ((DWORD)0x00000008)
 #define TF_SNMP_INDEXED_BY_VALUE    ((DWORD)0x00010000)
 
 
index aab8ff9..8fee9be 100644 (file)
@@ -3,29 +3,29 @@
 ** ex: syntax=sql
 */
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (1,'&Shutdown system',TOOL_TYPE_ACTION,'System.Shutdown',2,'','Shutdown target node via NetXMS agent');
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (2,'&Restart system',TOOL_TYPE_ACTION,'System.Restart',2,'','Restart target node via NetXMS agent');
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (3,'&Wakeup node',TOOL_TYPE_INTERNAL,'wakeup',0,'','Wakeup node using Wake-On-LAN magic packet');
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (4,'Restart &agent',TOOL_TYPE_ACTION,'Agent.Restart',2,'','Restart NetXMS agent on target node');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (1,'&Shutdown system',TOOL_TYPE_ACTION,'System.Shutdown',10,'','Shutdown target node via NetXMS agent','Host #25OBJECT_NAME#25 (#25OBJECT_IP_ADDR#25) will be shut down. Are you sure?');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (2,'&Restart system',TOOL_TYPE_ACTION,'System.Restart',10,'','Restart target node via NetXMS agent','Host #25OBJECT_NAME#25 (#25OBJECT_IP_ADDR#25) will be restarted. Are you sure?');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (3,'&Wakeup node',TOOL_TYPE_INTERNAL,'wakeup',0,'','Wakeup node using Wake-On-LAN magic packet','#00');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (4,'Restart &agent',TOOL_TYPE_ACTION,'Agent.Restart',10,'','Restart NetXMS agent on target node','NetXMS agent on host #25OBJECT_NAME#25 (#25OBJECT_IP_ADDR#25) will be restarted. Are you sure?');
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (5,'&Info->&Switch forwarding database (FDB)',TOOL_TYPE_TABLE_SNMP,'Forwarding database',1,'','Show switch forwarding database');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (5,'&Info->&Switch forwarding database (FDB)',TOOL_TYPE_TABLE_SNMP,'Forwarding database',1,'','Show switch forwarding database','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (5,0,'MAC Address','.1.3.6.1.2.1.17.4.3.1.1',CFMT_MAC_ADDR,0);
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (5,1,'Port','.1.3.6.1.2.1.17.4.3.1.2',CFMT_IFINDEX,0);
 
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (6,'&Connect->Open &web browser',TOOL_TYPE_URL,'http://%OBJECT_IP_ADDR%',0,'','Open embedded web browser to node','#00');
 INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (6,'&Connect->Open &web browser',TOOL_TYPE_URL,'http://%OBJECT_IP_ADDR%',0,'','Open embedded web browser to node');
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (7,'&Connect->Open &web browser (HTTPS)',TOOL_TYPE_URL,'https://%OBJECT_IP_ADDR%',0,'','Open embedded web browser to node using HTTPS');
+       VALUES (7,'&Connect->Open &web browser (HTTPS)',TOOL_TYPE_URL,'https://%OBJECT_IP_ADDR%',0,'','Open embedded web browser to node using HTTPS','#00');
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (8,'&Info->&Agent->&Subagent list',TOOL_TYPE_TABLE_AGENT,'Subagent List#7FAgent.SubAgentList#7F^(.*) (.*) (.*) (.*)',2,'','Show list of loaded subagents');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (8,'&Info->&Agent->&Subagent list',TOOL_TYPE_TABLE_AGENT,'Subagent List#7FAgent.SubAgentList#7F^(.*) (.*) (.*) (.*)',2,'','Show list of loaded subagents','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (8,0,'Name','',CFMT_STRING,1);
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
@@ -35,18 +35,18 @@ INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (8,3,'Module handle','',CFMT_STRING,3);
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (9,'&Info->&Agent->Supported &parameters',TOOL_TYPE_TABLE_AGENT,'Supported parameters#7FAgent.SupportedParameters#7F^(.*)',2,'','Show list of parameters supported by agent');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (9,'&Info->&Agent->Supported &parameters',TOOL_TYPE_TABLE_AGENT,'Supported parameters#7FAgent.SupportedParameters#7F^(.*)',2,'','Show list of parameters supported by agent','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (9,0,'Parameter','',CFMT_STRING,1);
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (10,'&Info->&Agent->Supported &enums',TOOL_TYPE_TABLE_AGENT,'Supported enums#7FAgent.SupportedEnums#7F^(.*)',2,'','Show list of enums supported by agent');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (10,'&Info->&Agent->Supported &enums',TOOL_TYPE_TABLE_AGENT,'Supported enums#7FAgent.SupportedEnums#7F^(.*)',2,'','Show list of enums supported by agent','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (10,0,'Parameter','',CFMT_STRING,1);
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (11,'&Info->&Agent->Supported &actions',TOOL_TYPE_TABLE_AGENT,'Supported actions#7FAgent.ActionList#7F^(.*) (.*) #22(.*)#22.*',2,'','Show list of actions supported by agent');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (11,'&Info->&Agent->Supported &actions',TOOL_TYPE_TABLE_AGENT,'Supported actions#7FAgent.ActionList#7F^(.*) (.*) #22(.*)#22.*',2,'','Show list of actions supported by agent','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (11,0,'Name','',CFMT_STRING,1);
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
@@ -54,8 +54,8 @@ INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (11,2,'Data','',CFMT_STRING,3);
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (12,'&Info->&Agent->Configured &ICMP targets',TOOL_TYPE_TABLE_AGENT,'Configured ICMP targets#7FICMP.TargetList#7F^(.*) (.*) (.*) (.*)',2,'','Show list of actions supported by agent');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (12,'&Info->&Agent->Configured &ICMP targets',TOOL_TYPE_TABLE_AGENT,'Configured ICMP targets#7FICMP.TargetList#7F^(.*) (.*) (.*) (.*)',2,'','Show list of actions supported by agent','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (12,0,'IP Address','',CFMT_STRING,1);
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
@@ -65,16 +65,16 @@ INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (12,4,'Average RTT','',CFMT_STRING,3);
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
        VALUES (13,'&Info->&Process list',TOOL_TYPE_TABLE_AGENT,
-                'Process List#7FSystem.ProcessList#7F^([0-9]+) (.*)',2,'','Show list of currently running processes');
+                'Process List#7FSystem.ProcessList#7F^([0-9]+) (.*)',2,'','Show list of currently running processes','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (13,0,'PID','',CFMT_STRING,1);
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (13,1,'Name','',CFMT_STRING,2);
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (14,'&Info->Topology table (Nortel)',TOOL_TYPE_TABLE_SNMP,'Topology table',1,'','Show topology table (Nortel protocol)');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (14,'&Info->Topology table (Nortel)',TOOL_TYPE_TABLE_SNMP,'Topology table',1,'','Show topology table (Nortel protocol)','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (14,0,'Peer IP','.1.3.6.1.4.1.45.1.6.13.2.1.1.3',CFMT_IP_ADDR,0);
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
@@ -82,8 +82,8 @@ INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (14,2,'Port','.1.3.6.1.4.1.45.1.6.13.2.1.1.2',CFMT_IFINDEX,0);
 
-INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description)
-       VALUES (15,'&Info->Topology table (CDP)',TOOL_TYPE_TABLE_SNMP,'Topology table',1,'','Show topology table (CDP)');
+INSERT INTO object_tools (tool_id,tool_name,tool_type,tool_data,flags,matching_oid,description,confirmation_text)
+       VALUES (15,'&Info->Topology table (CDP)',TOOL_TYPE_TABLE_SNMP,'Topology table',1,'','Show topology table (CDP)','#00');
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
        VALUES (15,0,'Device ID','.1.3.6.1.4.1.9.9.23.1.2.1.1.6',CFMT_STRING,0);
 INSERT INTO object_tools_table_columns (tool_id,col_number,col_name,col_oid,col_format,col_substr)
index 045ae09..2bddaf1 100644 (file)
@@ -803,10 +803,11 @@ CREATE TABLE object_tools
        tool_id integer not null,
        tool_name varchar(255) not null,
        tool_type integer not null,
-       tool_data SQL_TEXT,
-       description varchar(255),
+       tool_data SQL_TEXT not null,
+       description varchar(255) not null,
        flags integer not null,
-       matching_oid varchar(255),
+       matching_oid varchar(255) not null,
+       confirmation_text varchar(255) not null,
        PRIMARY KEY(tool_id)
 ) TABLE_TYPE;
 
index c3ac7f3..b243693 100644 (file)
@@ -24,6 +24,8 @@ CObjToolPropOptions::CObjToolPropOptions() : CPropertyPage(CObjToolPropOptions::
        m_bMatchOID = FALSE;
        m_bNeedSNMP = FALSE;
        m_nIndexType = -1;
+       m_bConfirmation = FALSE;
+       m_strConfirmationText = _T("");
        //}}AFX_DATA_INIT
 }
 
@@ -40,6 +42,9 @@ void CObjToolPropOptions::DoDataExchange(CDataExchange* pDX)
        DDX_Check(pDX, IDC_CHECK_MATCH_OID, m_bMatchOID);
        DDX_Check(pDX, IDC_CHECK_SNMP, m_bNeedSNMP);
        DDX_Radio(pDX, IDC_RADIO_SUFFIX, m_nIndexType);
+       DDX_Check(pDX, IDC_CHECK_CONFIRM, m_bConfirmation);
+       DDX_Text(pDX, IDC_EDIT_CONFIRM, m_strConfirmationText);
+       DDV_MaxChars(pDX, m_strConfirmationText, 255);
        //}}AFX_DATA_MAP
 }
 
@@ -47,6 +52,7 @@ void CObjToolPropOptions::DoDataExchange(CDataExchange* pDX)
 BEGIN_MESSAGE_MAP(CObjToolPropOptions, CPropertyPage)
        //{{AFX_MSG_MAP(CObjToolPropOptions)
        ON_BN_CLICKED(IDC_CHECK_MATCH_OID, OnCheckMatchOid)
+       ON_BN_CLICKED(IDC_CHECK_CONFIRM, OnCheckConfirm)
        //}}AFX_MSG_MAP
 END_MESSAGE_MAP()
 
@@ -76,7 +82,13 @@ BOOL CObjToolPropOptions::OnInitDialog()
       EnableDlgItem(this, IDC_STATIC_TEMPLATE, FALSE);
    }
        
-       return TRUE;
+   if (SendDlgItemMessage(IDC_CHECK_CONFIRM, BM_GETCHECK) != BST_CHECKED)
+   {
+      EnableDlgItem(this, IDC_EDIT_CONFIRM, FALSE);
+      EnableDlgItem(this, IDC_STATIC_CONFIRM, FALSE);
+   }
+
+   return TRUE;
 }
 
 
@@ -92,3 +104,17 @@ void CObjToolPropOptions::OnCheckMatchOid()
    EnableDlgItem(this, IDC_EDIT_TEMPLATE, bEnable);
    EnableDlgItem(this, IDC_STATIC_TEMPLATE, bEnable);
 }
+
+
+//
+// Handler for checking/unchecking "need confirmation"
+//
+
+void CObjToolPropOptions::OnCheckConfirm() 
+{
+   BOOL bEnable;
+
+   bEnable = (SendDlgItemMessage(IDC_CHECK_CONFIRM, BM_GETCHECK) == BST_CHECKED);
+   EnableDlgItem(this, IDC_EDIT_CONFIRM, bEnable);
+   EnableDlgItem(this, IDC_STATIC_CONFIRM, bEnable);
+}
index f23a771..52eceeb 100644 (file)
@@ -28,6 +28,8 @@ public:
        BOOL    m_bMatchOID;
        BOOL    m_bNeedSNMP;
        int             m_nIndexType;
+       BOOL    m_bConfirmation;
+       CString m_strConfirmationText;
        //}}AFX_DATA
 
 
@@ -44,6 +46,7 @@ protected:
        //{{AFX_MSG(CObjToolPropOptions)
        virtual BOOL OnInitDialog();
        afx_msg void OnCheckMatchOid();
+       afx_msg void OnCheckConfirm();
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
 
index 5edbdb5..468973d 100644 (file)
@@ -467,6 +467,8 @@ void CObjectToolsEditor::EditTool(NXC_OBJECT_TOOL_DETAILS *pData)
    pgOptions.m_strMatchingOID = CHECK_NULL_EX(pData->pszMatchingOID);
    pgOptions.m_nIndexType = (pData->dwFlags & TF_SNMP_INDEXED_BY_VALUE) ? 1 : 0;
    pgOptions.m_iToolType = (int)pData->wType;
+   pgOptions.m_bConfirmation = (pData->dwFlags & TF_ASK_CONFIRMATION) ? TRUE : FALSE;
+   pgOptions.m_strConfirmationText = CHECK_NULL_EX(pData->pszConfirmationText);
    psh.AddPage(&pgOptions);
 
    // Setup "Columns" page
@@ -513,6 +515,16 @@ void CObjectToolsEditor::EditTool(NXC_OBJECT_TOOL_DETAILS *pData)
       {
          pData->pszMatchingOID = NULL;
       }
+      safe_free(pData->pszConfirmationText)
+      if (pgOptions.m_bConfirmation)
+      {
+         pData->dwFlags |= TF_ASK_CONFIRMATION;
+         pData->pszConfirmationText = _tcsdup((LPCTSTR)pgOptions.m_strConfirmationText);
+      }
+      else
+      {
+         pData->pszConfirmationText = NULL;
+      }
       if (pgOptions.m_nIndexType == 1)
          pData->dwFlags |= TF_SNMP_INDEXED_BY_VALUE;
 
index 3b2d665..9966e97 100644 (file)
@@ -2,7 +2,7 @@
 
 [General Info]
 Version=1
-LastClass=CObjectCommentsEditor
+LastClass=CObjToolPropOptions
 LastTemplate=CMDIChildWnd
 NewFileInclude1=#include "stdafx.h"
 NewFileInclude2=#include "nxcon.h"
@@ -17,20 +17,20 @@ Class9=CMapView
 
 ResourceCount=179
 Resource1=IDD_CP_GENERAL (English (U.S.))
-Resource2=IDD_NEW_USER
+Resource2=IDD_CREATE_NODE
 Resource3=IDD_DCI_DATA_EXPORT (English (U.S.))
-Resource4=IDD_OBJECT_GENERAL
-Resource5=IDR_MAINFRAME
+Resource4=IDD_ACTION_PROPERTIES
+Resource5=IDD_DCI_THRESHOLDS
 Class2=CChildView
 Class5=CAboutDlg
 Class6=CControlPanel
 Class8=CMapFrame
 Class10=CLoginDialog
-Resource6=IDD_OBJECT_NETSRV_GENERAL
+Resource6=IDA_OBJECT_BROWSER
 Class11=CProgressDialog
-Resource7=IDD_EDIT_RULE_ALARM
+Resource7=IDD_OBJECT_NETSRV_GENERAL
 Class12=CObjectBrowser
-Resource8=IDD_REMOVE_TEMPLATE
+Resource8=IDD_OBJECT_NODE_GENERAL
 Class13=CObjectPropDlg
 Resource9=IDD_THRESHOLD (English (U.S.))
 Resource10=IDD_SELECT_OBJECT (English (U.S.))
@@ -46,45 +46,45 @@ Resource17=IDD_NEW_USER (English (U.S.))
 Class16=CDebugFrame
 Resource18=IDD_NEW_ACTION (English (U.S.))
 Resource19=IDD_OBJECT_PROPERTIES (English (U.S.))
-Resource20=IDD_CREATE_CONDITION
+Resource20=IDD_SELECT_USER
 Class17=CObjectPreview
 Resource21=IDA_OBJECT_BROWSER (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDA_SCRIPT_MANAGER
+Resource22=IDD_CREATE_TG
 Class21=CEditBox
 Class22=COPGeneral
 Class23=CNodePropsGeneral
 Resource23=IDD_GRAPH_PROPERTIES (English (U.S.))
 Class24=CObjectPropCaps
 Class25=CObjectPropSheet
-Resource24=IDD_REQUEST_PROCESSING
+Resource24=IDD_EDIT_IP_SUBNET
 Class26=CRequestProcessingDlg
 Resource25=IDD_SELECT_USER (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
-Resource27=IDD_SAVE_AGENT_CFG
+Resource27=IDA_DC_EDITOR
 Resource28=IDD_DCI_COLLECTION (English (U.S.))
 Class27=CObjectPropsGeneral
 Resource29=IDR_MAINFRAME (English (U.S.))
 Class28=CObjectPropsSecurity
 Resource30=IDD_SAVE_AGENT_CFG (English (U.S.))
-Resource31=IDD_CREATE_CONTAINER
-Resource32=IDD_COND_DCI_PROP
+Resource31=IDD_DCI_DATA_EXPORT
+Resource32=IDD_SELECT_ACTION
 Class29=CUserSelectDlg
-Resource33=IDD_NEW_ACTION
+Resource33=IDD_GRAPH_PROP_SETTINGS
 Class30=CUserEditor
 Resource34=IDD_DCI_PROPERTIES
 Class31=CNewUserDlg
-Resource35=IDA_PACKAGE_MGR
-Resource36=IDD_SNMP_WALK
+Resource35=IDD_GROUP_PROPERTIES
+Resource36=IDD_REQUEST_PROCESSING
 Class32=CUserPropDlg
 Resource37=IDD_EDIT_VARIABLE (English (U.S.))
-Resource38=IDA_GRAPH
+Resource38=IDD_USER_PROPERTIES
 Class33=CGroupPropDlg
-Resource39=IDD_ADD_DCI
-Resource40=IDD_SELECT_ACTION
-Resource41=IDA_DC_EDITOR
+Resource39=IDD_SET_PASSWORD
+Resource40=IDD_REMOVE_TEMPLATE
+Resource41=IDD_OBJECT_RELATIONS
 Resource42=IDA_ACTION_EDITOR (English (U.S.))
 Class34=CPasswordChangeDlg
 Class35=CNodeSummary
@@ -100,55 +100,55 @@ Class41=CGraphFrame
 Class42=CDCIThresholdsPage
 Resource46=IDA_OBJECT_TOOLS_EDITOR (English (U.S.))
 Resource47=IDM_CONTEXT (English (U.S.))
-Resource48=IDA_ALARM_BROWSER
+Resource48=IDD_EDIT_RULE_COMMENT
 Class43=CThresholdDlg
 Resource49=IDD_DESKTOP_SAVE_AS (English (U.S.))
-Resource50=IDD_OBJECT_NODE_POLL
+Resource50=IDA_EPP
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
 Resource51=IDD_SELECT_AGENT_PARAM (English (U.S.))
-Resource52=IDD_SUBMAP_BKGND
+Resource52=IDD_OBJECT_GENERAL
 Class48=CObjectSelDlg
-Resource53=IDA_AGENT_CONFIG_MANAGER
-Resource54=IDD_OBJECT_VPNC_GENERAL
+Resource53=IDD_SELECT_EVENT
+Resource54=IDA_SERVER_CFG_EDITOR
 Class49=CRuleCommentDlg
-Resource55=IDD_MIB_BROWSER
+Resource55=IDD_CREATE_VPNC
 Class50=CEventSelDlg
 Resource56=IDM_CONTEXT
 Resource57=IDA_EPP (English (U.S.))
-Resource58=IDD_DESKTOP_SAVE_AS
+Resource58=IDA_NETMAP
 Resource59=IDA_PACKAGE_MGR (English (U.S.))
 Resource60=IDD_OBJTOOL_GENERAL (English (U.S.))
 Class51=CObjectPropsPresentation
 Resource61=IDD_CREATE_TEMPLATE (English (U.S.))
 Resource62=IDM_VIEW_SPECIFIC
 Class52=CRuleSeverityDlg
-Resource63=IDD_CREATE_VPNC
+Resource63=IDA_LAST_VALUES
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
 Resource64=IDA_MDI_DEFAULT (English (U.S.))
-Resource65=IDA_MDI_DEFAULT
+Resource65=IDD_THRESHOLD
 Resource66=IDD_EDIT_IP_SUBNET (English (U.S.))
 Resource67=IDD_EDIT_RULE_SEVERITY (English (U.S.))
 Resource68=IDD_ACTION_PROPERTIES (English (U.S.))
 Class55=CConsolePropsGeneral
 Class56=CActionEditor
-Resource69=IDA_AGENT_CFG_EDITOR
-Resource70=IDD_CHANGE_IP
+Resource69=IDD_CREATE_CONTAINER
+Resource70=IDA_ACTION_EDITOR
 Class57=CNewActionDlg
-Resource71=IDD_EDIT_TRAP_ARG
+Resource71=IDD_OBJECT_COND_DATA
 Class58=CEditActionDlg
-Resource72=IDD_DCI_SCHEDULE
+Resource72=IDA_OBJECT_TOOLS_EDITOR
 Class59=CActionSelDlg
-Resource73=IDA_TRAP_EDITOR
+Resource73=IDD_LASTVAL_PROP
 Resource74=IDD_EDIT_TRAP (English (U.S.))
 Resource75=IDD_USER_PROPERTIES (English (U.S.))
-Resource76=IDD_OBJECT_PRESENTATION
+Resource76=IDD_OBJECT_COND_SCRIPT
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
-Resource77=IDD_CREATE_TG
+Resource77=IDD_CHANGE_PASSWORD
 Class62=CCreateNodeDlg
 Resource78=IDD_OBJECT_NODE_GENERAL (English (U.S.))
 Resource79=IDT_MAP (English (U.S.))
@@ -158,31 +158,31 @@ Resource81=IDD_LASTVAL_PROP (English (U.S.))
 Class64=CPollNodeDlg
 Resource82=IDD_POLL_NODE (English (U.S.))
 Class65=CNodePoller
-Resource83=IDD_DCI_COLLECTION
-Resource84=IDD_THRESHOLD
+Resource83=IDD_SELECT_INTERNAL_ITEM
+Resource84=IDD_EDIT_TRAP_ARG
 Class66=CCreateTemplateDlg
 Class67=CCreateTGDlg
-Resource85=IDD_GRAPH_PROP_SETTINGS
-Resource86=IDD_SELECT_INTERNAL_ITEM
+Resource85=IDA_EVENT_EDITOR
+Resource86=IDD_ADD_DCI
 Class68=CTrapEditor
-Resource87=IDA_ACTION_EDITOR
-Resource88=IDD_OBJTOOL_OPTIONS
-Resource89=IDD_EDIT_IP_SUBNET
+Resource87=IDD_EDIT_RULE_SEVERITY
+Resource88=IDD_ABOUTBOX
+Resource89=IDA_AGENT_CFG_EDITOR
 Class69=CDataQueryDlg
-Resource90=IDD_ABOUTBOX
+Resource90=IDD_OBJECT_PRESENTATION
 Class70=CTrapEditDlg
 Resource91=IDM_VIEW_SPECIFIC (English (U.S.))
 Class71=CTrapParamDlg
-Resource92=IDD_CP_GENERAL
-Resource93=IDD_CREATE_TEMPLATE
+Resource92=IDD_NEW_OBJECT_TOOL
+Resource93=IDD_CREATE_CONDITION
 Class72=CGraphPropDlg
 Class73=CColorSelector
 Class74=CPackageMgr
-Resource94=IDD_DATA_QUERY
+Resource94=IDD_OBJECT_COND_GENERAL
 Resource95=IDA_SCRIPT_MANAGER (English (U.S.))
 Resource96=IDD_SET_PASSWORD (English (U.S.))
 Resource97=IDD_DCI_TRANSFORM (English (U.S.))
-Resource98=IDD_EDIT_EVENT
+Resource98=IDD_EDIT_VARIABLE
 Resource99=IDD_OBJECT_NETSRV_GENERAL (English (U.S.))
 Resource100=IDD_OBJTOOL_OPTIONS (English (U.S.))
 Resource101=IDA_LAST_VALUES (English (U.S.))
@@ -244,7 +244,7 @@ Class102=CWaitView
 Class103=CWebBrowser
 Class104=CSyslogBrowser
 Class105=CLPPList
-Resource129=IDA_EVENT_EDITOR
+Resource129=IDD_OBJECT_SECURITY
 Class106=CDCISchedulePage
 Resource130=IDD_OBJECT_CAPS (English (U.S.))
 Class107=CObjectPropsStatus
@@ -270,54 +270,54 @@ Class119=CMapControlBox
 Resource138=IDD_OBJECT_GENERAL (English (U.S.))
 Class120=CSubmapBkgndDlg
 Resource139=IDD_SUBMAP_BKGND (English (U.S.))
-Resource140=IDD_ACTION_PROPERTIES
-Resource141=IDD_SET_PASSWORD
-Resource142=IDD_GROUP_PROPERTIES
-Resource143=IDD_USER_PROPERTIES
-Resource144=IDA_DATA_VIEW
-Resource145=IDD_SELECT_OBJECT
-Resource146=IDD_CREATE_NODE
-Resource147=IDD_GRAPH_PROP_DATA
-Resource148=IDD_OBJECT_NODE_GENERAL
-Resource149=IDD_DCI_TRANSFORM
-Resource150=IDD_SELECT_EVENT
-Resource151=IDD_SELECT_USER
-Resource152=IDD_SELECT_AGENT_PARAM
-Resource153=IDA_OBJECT_TOOLS_EDITOR
-Resource154=IDD_EDIT_VARIABLE
-Resource155=IDA_SERVER_CFG_EDITOR
-Resource156=IDD_OBJTOOL_COLUMNS
-Resource157=IDD_OBJTOOL_GENERAL
-Resource158=IDD_OBJECT_STATUS
-Resource159=IDA_LAST_VALUES
-Resource160=IDD_INPUT_BOX
-Resource161=IDD_LASTVAL_PROP
-Resource162=IDD_EDIT_TRAP
-Resource163=IDD_OBJECT_COND_SCRIPT
-Resource164=IDD_OBJECT_CAPS
-Resource165=IDD_CHANGE_PASSWORD
-Resource166=IDD_EDIT_RULE_COMMENT
-Resource167=IDD_NEW_OBJECT_TOOL
-Resource168=IDD_OBJECT_COND_DATA
-Resource169=IDA_OBJECT_BROWSER
-Resource170=IDD_EDIT_RULE_SEVERITY
-Resource171=IDD_DCI_THRESHOLDS
+Resource140=IDD_CHANGE_IP
+Resource141=IDD_GRAPH_PROP_DATA
+Resource142=IDD_OBJTOOL_OPTIONS
+Resource143=IDD_DATA_QUERY
+Resource144=IDD_CREATE_TEMPLATE
+Resource145=IDD_OBJECT_VPNC_GENERAL
+Resource146=IDD_SNMP_WALK
+Resource147=IDD_EDIT_EVENT
+Resource148=IDD_EDIT_RULE_ALARM
+Resource149=IDD_SUBMAP_BKGND
+Resource150=IDD_SAVE_AGENT_CFG
+Resource151=IDD_OBJECT_STATUS
+Resource152=IDD_COND_DCI_PROP
+Resource153=IDD_DCI_TRANSFORM
+Resource154=IDA_PACKAGE_MGR
+Resource155=IDD_DCI_COLLECTION
+Resource156=IDD_SELECT_OBJECT
+Resource157=IDA_DATA_VIEW
+Resource158=IDA_SCRIPT_MANAGER
+Resource159=IDD_CREATE_NETSRV
+Resource160=IDR_MAINFRAME
+Resource161=IDA_TRAP_EDITOR
+Resource162=IDD_DCI_SCHEDULE
+Resource163=IDD_CP_GENERAL
+Resource164=IDD_SELECT_AGENT_PARAM
+Resource165=IDD_EDIT_TRAP
+Resource166=IDD_INPUT_BOX
+Resource167=IDA_AGENT_CONFIG_MANAGER
+Resource168=IDD_NEW_ACTION
+Resource169=IDD_MIB_BROWSER
+Resource170=IDD_OBJECT_NODE_POLL
+Resource171=IDD_OBJTOOL_COLUMNS
 Class121=CModuleManager
 Class122=CDesktopManager
-Resource172=IDD_DCI_DATA_EXPORT
-Resource173=IDA_NETMAP
+Resource172=IDA_GRAPH
+Resource173=IDD_DESKTOP_SAVE_AS
 Class123=CCreateCondDlg
 Class124=CCondPropsGeneral
 Class125=CCondPropsScript
 Class126=CCondPropsData
-Resource174=IDD_CREATE_NETSRV
+Resource174=IDA_MDI_DEFAULT
 Class127=CAddDCIDlg
-Resource175=IDD_OBJECT_SECURITY
+Resource175=IDD_OBJTOOL_GENERAL
 Class128=CCondDCIPropDlg
-Resource176=IDD_OBJECT_RELATIONS
+Resource176=IDA_ALARM_BROWSER
 Class129=CAgentConfigMgr
-Resource177=IDD_OBJECT_COND_GENERAL
-Resource178=IDA_EPP
+Resource177=IDD_NEW_USER
+Resource178=IDD_OBJECT_CAPS
 Class130=CAgentCfgDlg
 Class131=CObjectCommentsEditor
 Resource179=IDD_AGENT_CONFIG
@@ -4619,17 +4619,21 @@ Control11=IDC_STATIC,button,1342177287
 [DLG:IDD_OBJTOOL_OPTIONS]
 Type=1
 Class=CObjToolPropOptions
-ControlCount=10
+ControlCount=14
 Control1=IDC_CHECK_AGENT,button,1342242819
 Control2=IDC_CHECK_SNMP,button,1342242819
 Control3=IDC_CHECK_MATCH_OID,button,1342242819
 Control4=IDC_EDIT_TEMPLATE,edit,1350631552
 Control5=IDC_RADIO_SUFFIX,button,1342373897
 Control6=IDC_RADIO_VALUE,button,1342177289
-Control7=IDC_STATIC,button,1342177287
-Control8=IDC_STATIC_TEMPLATE,static,1342308352
-Control9=IDC_STATIC_SNMP_OPTIONS,button,1342177287
-Control10=IDC_STATIC_SNMP_INDEX,static,1342308352
+Control7=IDC_CHECK_CONFIRM,button,1342242819
+Control8=IDC_EDIT_CONFIRM,edit,1350631552
+Control9=IDC_STATIC,button,1342177287
+Control10=IDC_STATIC_TEMPLATE,static,1342308352
+Control11=IDC_STATIC_SNMP_OPTIONS,button,1342177287
+Control12=IDC_STATIC_SNMP_INDEX,static,1342308352
+Control13=IDC_STATIC,button,1342177287
+Control14=IDC_STATIC_CONFIRM,static,1342308352
 
 [DLG:IDD_CHANGE_IP]
 Type=1
index d490915..827dafb 100644 (file)
@@ -2486,6 +2486,28 @@ void CConsoleApp::ExecuteObjectTool(NXC_OBJECT *pObject, DWORD dwIndex)
        (pObject->iClass != OBJECT_NODE))
       return;
 
+   if (g_pObjectToolList[dwIndex].dwFlags & TF_ASK_CONFIRMATION)
+   {
+      TCHAR szBuffer[4096];
+
+      if ((g_pObjectToolList[dwIndex].pszConfirmationText != NULL) &&
+          (*g_pObjectToolList[dwIndex].pszConfirmationText != 0))
+      {
+         _stprintf(szBuffer, _T("%lu"), pObject->dwId);
+         SetEnvironmentVariable(_T("OBJECT_ID"), szBuffer);
+         SetEnvironmentVariable(_T("OBJECT_IP_ADDR"), IpToStr(pObject->dwIpAddr, szBuffer));
+         SetEnvironmentVariable(_T("OBJECT_NAME"), pObject->szName);
+         ExpandEnvironmentStrings(g_pObjectToolList[dwIndex].pszConfirmationText, szBuffer, 4096);
+      }
+      else
+      {
+         _tcscpy(szBuffer, _T("This tool requires confirmation but does not provide confirmation message. Do you wish to run this tool?"));
+      }
+
+      if (m_pMainWnd->MessageBox(szBuffer, _T("Warning"), MB_YESNO | MB_ICONEXCLAMATION) != IDYES)
+         return;
+   }
+
    switch(g_pObjectToolList[dwIndex].wType)
    {
       case TOOL_TYPE_INTERNAL:
index 5264ba9..5916610 100644 (file)
@@ -2403,10 +2403,10 @@ BEGIN
     LTEXT           "->",IDC_STATIC,65,167,8,8
 END
 
-IDD_OBJTOOL_GENERAL DIALOGEX 0, 0, 257, 154
+IDD_OBJTOOL_GENERAL DIALOGEX 0, 0, 257, 199
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
 CAPTION "General"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
+FONT 8, "MS Sans Serif"
 BEGIN
     EDITTEXT        IDC_EDIT_NAME,7,16,127,14,ES_AUTOHSCROLL
     EDITTEXT        IDC_EDIT_DESCRIPTION,7,45,127,14,ES_AUTOHSCROLL
@@ -2451,7 +2451,7 @@ BEGIN
     GROUPBOX        "Tool Type",IDC_STATIC,7,41,137,59
 END
 
-IDD_OBJTOOL_OPTIONS DIALOG DISCARDABLE  0, 0, 257, 154
+IDD_OBJTOOL_OPTIONS DIALOG DISCARDABLE  0, 0, 257, 199
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
 CAPTION "Options"
 FONT 8, "MS Sans Serif"
@@ -2465,14 +2465,20 @@ BEGIN
                     WS_TABSTOP,13,45,155,10
     EDITTEXT        IDC_EDIT_TEMPLATE,65,58,178,14,ES_AUTOHSCROLL
     CONTROL         "&OID suffix of first column",IDC_RADIO_SUFFIX,"Button",
-                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,24,110,92,10
+                    BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,24,103,92,10
     CONTROL         "&Value of first column",IDC_RADIO_VALUE,"Button",
-                    BS_AUTORADIOBUTTON,24,122,79,10
-    GROUPBOX        "Availability rules",IDC_STATIC,7,7,243,73
+                    BS_AUTORADIOBUTTON,24,115,79,10
+    CONTROL         "This tool requires &confirmation before execution",
+                    IDC_CHECK_CONFIRM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
+                    13,147,164,10
+    EDITTEXT        IDC_EDIT_CONFIRM,13,171,230,14,ES_AUTOHSCROLL
+    GROUPBOX        "Availability rules",IDC_STATIC,7,7,243,71
     LTEXT           "Template:",IDC_STATIC_TEMPLATE,29,60,32,8
-    GROUPBOX        "SNMP table options",IDC_STATIC_SNMP_OPTIONS,7,87,243,52
+    GROUPBOX        "SNMP table options",IDC_STATIC_SNMP_OPTIONS,7,82,243,48
     LTEXT           "Use as index for second and subsequent columns:",
-                    IDC_STATIC_SNMP_INDEX,13,99,160,8
+                    IDC_STATIC_SNMP_INDEX,13,92,160,8
+    GROUPBOX        "Confirmation",IDC_STATIC,7,134,243,58
+    LTEXT           "Confirmation message",IDC_STATIC_CONFIRM,13,160,70,8
 END
 
 IDD_CHANGE_IP DIALOG DISCARDABLE  0, 0, 172, 46
@@ -2503,17 +2509,17 @@ BEGIN
     ICON            IDI_SEVERITY_MINOR,IDC_STATIC,7,7,21,20
 END
 
-IDD_OBJTOOL_COLUMNS DIALOGEX 0, 0, 257, 154
+IDD_OBJTOOL_COLUMNS DIALOGEX 0, 0, 257, 199
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
 CAPTION "Columns"
-FONT 8, "MS Sans Serif", 0, 0, 0x1
+FONT 8, "MS Sans Serif"
 BEGIN
     CONTROL         "List1",IDC_LIST_COLUMNS,"SysListView32",LVS_REPORT | 
                     LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_TABSTOP,7,7,
-                    243,121,WS_EX_CLIENTEDGE
-    PUSHBUTTON      "&Add...",IDC_BUTTON_ADD,86,133,50,14
-    PUSHBUTTON      "&Modify...",IDC_BUTTON_MODIFY,143,133,50,14
-    PUSHBUTTON      "&Delete",IDC_BUTTON_DELETE,200,133,50,14
+                    243,164,WS_EX_CLIENTEDGE
+    PUSHBUTTON      "&Add...",IDC_BUTTON_ADD,86,178,50,14
+    PUSHBUTTON      "&Modify...",IDC_BUTTON_MODIFY,143,178,50,14
+    PUSHBUTTON      "&Delete",IDC_BUTTON_DELETE,200,178,50,14
 END
 
 IDD_SNMP_WALK DIALOGEX 0, 0, 417, 213
@@ -3175,7 +3181,7 @@ BEGIN
         LEFTMARGIN, 7
         RIGHTMARGIN, 250
         TOPMARGIN, 7
-        BOTTOMMARGIN, 147
+        BOTTOMMARGIN, 192
     END
 
     IDD_NEW_OBJECT_TOOL, DIALOG
@@ -3191,7 +3197,7 @@ BEGIN
         LEFTMARGIN, 7
         RIGHTMARGIN, 250
         TOPMARGIN, 7
-        BOTTOMMARGIN, 147
+        BOTTOMMARGIN, 192
     END
 
     IDD_CHANGE_IP, DIALOG
@@ -3215,7 +3221,7 @@ BEGIN
         LEFTMARGIN, 7
         RIGHTMARGIN, 250
         TOPMARGIN, 7
-        BOTTOMMARGIN, 147
+        BOTTOMMARGIN, 192
     END
 
     IDD_SNMP_WALK, DIALOG
index f870010..85c5322 100644 (file)
 #define IDC_CHECK_UNMANAGED             1383
 #define IDC_CHECK_ICMP                  1386
 #define IDC_CHECK_ALL_THRESHOLDS        1388
+#define IDC_CHECK_CONFIRM               1389
+#define IDC_EDIT_CONFIRM                1390
+#define IDC_STATIC_CONFIRM              1391
 #define IDR_WEB_BROWSER                 8100
 #define IDR_SYSLOG_BROWSER              8101
 #define IDR_LPP_EDITOR                  8102
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        334
 #define _APS_NEXT_COMMAND_VALUE         33043
-#define _APS_NEXT_CONTROL_VALUE         1389
+#define _APS_NEXT_CONTROL_VALUE         1392
 #define _APS_NEXT_SYMED_VALUE           128
 #endif
 #endif
index ac4f799..3276f00 100644 (file)
@@ -61,6 +61,7 @@ DWORD LIBNXCL_EXPORTABLE NXCGetObjectTools(NXC_SESSION hSession, DWORD *pdwNumTo
             (*ppToolList)[i].dwFlags = pResponse->GetVariableLong(dwId + 4);
             pResponse->GetVariableStr(dwId + 5, (*ppToolList)[i].szDescription, MAX_DB_STRING);
             (*ppToolList)[i].pszMatchingOID = pResponse->GetVariableStr(dwId + 6);
+            (*ppToolList)[i].pszConfirmationText = pResponse->GetVariableStr(dwId + 7);
          }
       }
       delete pResponse;
@@ -87,6 +88,7 @@ void LIBNXCL_EXPORTABLE NXCDestroyObjectToolList(DWORD dwNumTools, NXC_OBJECT_TO
       {
          safe_free(pList[i].pszData);
          safe_free(pList[i].pszMatchingOID);
+         safe_free(pList[i].pszConfirmationText);
       }
       free(pList);
    }
@@ -247,6 +249,7 @@ DWORD LIBNXCL_EXPORTABLE NXCGetObjectToolDetails(NXC_SESSION hSession, DWORD dwT
          (*ppData)->dwFlags = pResponse->GetVariableLong(VID_FLAGS);
          (*ppData)->wType = pResponse->GetVariableShort(VID_TOOL_TYPE);
          (*ppData)->pszData = pResponse->GetVariableStr(VID_TOOL_DATA);
+         (*ppData)->pszConfirmationText = pResponse->GetVariableStr(VID_CONFIRMATION_TEXT);
          pResponse->GetVariableStr(VID_NAME, (*ppData)->szName, MAX_DB_STRING);
          pResponse->GetVariableStr(VID_DESCRIPTION, (*ppData)->szDescription, MAX_DB_STRING);
          (*ppData)->pszMatchingOID = pResponse->GetVariableStr(VID_TOOL_OID);
@@ -349,6 +352,7 @@ DWORD LIBNXCL_EXPORTABLE NXCUpdateObjectTool(NXC_SESSION hSession,
    msg.SetVariable(VID_FLAGS, pData->dwFlags);
    msg.SetVariable(VID_DESCRIPTION, pData->szDescription);
    msg.SetVariable(VID_TOOL_DATA, pData->pszData);
+   msg.SetVariable(VID_CONFIRMATION_TEXT, CHECK_NULL_EX(pData->pszConfirmationText));
    msg.SetVariable(VID_ACL_SIZE, pData->dwACLSize);
    msg.SetVariable(VID_TOOL_OID, CHECK_NULL_EX(pData->pszMatchingOID));
    msg.SetVariableToInt32Array(VID_ACL, pData->dwACLSize, pData->pdwACL);
index b98cf4d..c65097a 100644 (file)
@@ -530,7 +530,7 @@ DWORD UpdateObjectToolFromMessage(CSCPMessage *pMsg)
 {
    DB_RESULT hResult;
    BOOL bUpdate = FALSE;
-   TCHAR *pszName, *pszData, *pszDescription, *pszOID, *pszTmp;
+   TCHAR *pszName, *pszData, *pszDescription, *pszOID, *pszTmp, *pszConfirm;
    TCHAR szBuffer[MAX_DB_STRING], szQuery[4096];
    DWORD i, dwToolId, dwAclSize, *pdwAcl;
    int nType;
@@ -553,26 +553,32 @@ DWORD UpdateObjectToolFromMessage(CSCPMessage *pMsg)
    pszDescription = EncodeSQLString(szBuffer);
    pMsg->GetVariableStr(VID_TOOL_OID, szBuffer, MAX_DB_STRING);
    pszOID = EncodeSQLString(szBuffer);
+   pMsg->GetVariableStr(VID_CONFIRMATION_TEXT, szBuffer, MAX_DB_STRING);
+   pszConfirm = EncodeSQLString(szBuffer);
    pszTmp = pMsg->GetVariableStr(VID_TOOL_DATA);
    pszData = EncodeSQLString(pszTmp);
    free(pszTmp);
    nType = pMsg->GetVariableShort(VID_TOOL_TYPE);
    if (bUpdate)
-      _sntprintf(szQuery, 4096, _T("UPDATE object_tools SET tool_name='%s',tool_type=%d,"
-                                   "tool_data='%s',description='%s',flags=%d,"
-                                   "matching_oid='%s' WHERE tool_id=%d"),
+      _sntprintf(szQuery, 4096, _T("UPDATE object_tools SET tool_name='%s',tool_type=%d,")
+                                _T("tool_data='%s',description='%s',flags=%d,")
+                                _T("matching_oid='%s',confirmation_text='%s' ")
+                                _T("WHERE tool_id=%d"),
                 pszName, nType, pszData, pszDescription,
-                pMsg->GetVariableLong(VID_FLAGS), pszOID, dwToolId);
+                pMsg->GetVariableLong(VID_FLAGS), pszOID, pszConfirm, dwToolId);
    else
-      _sntprintf(szQuery, 4096, _T("INSERT INTO object_tools (tool_id,tool_name,tool_type,"
-                                   "tool_data,description,flags,matching_oid) VALUES "
-                                   "(%d,'%s',%d,'%s','%s',%d,'%s')"),
+      _sntprintf(szQuery, 4096, _T("INSERT INTO object_tools (tool_id,tool_name,tool_type,")
+                                _T("tool_data,description,flags,matching_oid,")
+                                _T("confirmation_text) VALUES ")
+                                _T("(%d,'%s',%d,'%s','%s',%d,'%s','%s')"),
                 dwToolId, pszName, nType, pszData,
-                pszDescription, pMsg->GetVariableLong(VID_FLAGS), pszOID);
+                pszDescription, pMsg->GetVariableLong(VID_FLAGS),
+                pszOID, pszConfirm);
    free(pszName);
    free(pszDescription);
    free(pszData);
    free(pszOID);
+   free(pszConfirm);
    DBQuery(g_hCoreDB, szQuery);
 
    // Update ACL
index 1f4a1ed..b14f8f4 100644 (file)
@@ -5381,7 +5381,7 @@ void ClientSession::SendObjectTools(DWORD dwRqId)
       }
       DBFreeResult(hResult);
 
-      hResult = DBSelect(g_hCoreDB, _T("SELECT tool_id,tool_name,tool_type,tool_data,flags,description,matching_oid FROM object_tools"));
+      hResult = DBSelect(g_hCoreDB, _T("SELECT tool_id,tool_name,tool_type,tool_data,flags,description,matching_oid,confirmation_text FROM object_tools"));
       if (hResult != NULL)
       {
          dwNumTools = DBGetNumRows(hResult);
@@ -5431,6 +5431,10 @@ void ClientSession::SendObjectTools(DWORD dwRqId)
                DBGetField(hResult, i, 6, szBuffer, MAX_DB_STRING);
                DecodeSQLStringAndSetVariable(&msg, dwId + 6, szBuffer);
 
+               // confirmation text
+               DBGetField(hResult, i, 7, szBuffer, MAX_DB_STRING);
+               DecodeSQLStringAndSetVariable(&msg, dwId + 7, szBuffer);
+
                dwNumMsgRec++;
                dwId += 10;
             }
@@ -5475,7 +5479,7 @@ void ClientSession::SendObjectToolDetails(CSCPMessage *pRequest)
    if (m_dwSystemAccess & SYSTEM_ACCESS_MANAGE_TOOLS)
    {
       dwToolId = pRequest->GetVariableLong(VID_TOOL_ID);
-      _stprintf(szQuery, _T("SELECT tool_name,tool_type,tool_data,description,flags,matching_oid FROM object_tools WHERE tool_id=%d"), dwToolId);
+      _stprintf(szQuery, _T("SELECT tool_name,tool_type,tool_data,description,flags,matching_oid,confirmation_text FROM object_tools WHERE tool_id=%d"), dwToolId);
       hResult = DBSelect(g_hCoreDB, szQuery);
       if (hResult != NULL)
       {
@@ -5498,6 +5502,10 @@ void ClientSession::SendObjectToolDetails(CSCPMessage *pRequest)
 
             DBGetField(hResult, 0, 5, szBuffer, MAX_DB_STRING);
             DecodeSQLStringAndSetVariable(&msg, VID_TOOL_OID, szBuffer);
+
+            DBGetField(hResult, 0, 6, szBuffer, MAX_DB_STRING);
+            DecodeSQLStringAndSetVariable(&msg, VID_CONFIRMATION_TEXT, szBuffer);
+
             DBFreeResult(hResult);
 
             // Access list
index 69be21d..d3e39eb 100644 (file)
@@ -78,6 +78,33 @@ static BOOL CreateConfigParam(TCHAR *pszName, TCHAR *pszValue, int iVisible, int
 
 
 //
+// Upgrade from V49 to V50
+//
+
+static BOOL H_UpgradeFromV49(void)
+{
+   static TCHAR m_szBatch[] =
+      "ALTER TABLE object_tools ADD confirmation_text varchar(255)\n"
+      "UPDATE object_tools SET confirmation_text='#00'\n"
+      "UPDATE object_tools SET flags=10 WHERE tool_id=1 OR tool_id=2 OR tool_id=4\n"
+      "UPDATE object_tools SET confirmation_text='Host #25OBJECT_NAME#25 (#25OBJECT_IP_ADDR#25) will be shut down. Are you sure?' WHERE tool_id=1\n"
+      "UPDATE object_tools SET confirmation_text='Host #25OBJECT_NAME#25 (#25OBJECT_IP_ADDR#25) will be restarted. Are you sure?' WHERE tool_id=2\n"
+      "UPDATE object_tools SET confirmation_text='NetXMS agent on host #25OBJECT_NAME#25 (#25OBJECT_IP_ADDR#25) will be restarted. Are you sure?' WHERE tool_id=4\n"
+      "<END>";
+
+   if (!SQLBatch(m_szBatch))
+      if (!g_bIgnoreErrors)
+         return FALSE;
+
+   if (!SQLQuery(_T("UPDATE config SET var_value='50' WHERE var_name='DBFormatVersion'")))
+      if (!g_bIgnoreErrors)
+         return FALSE;
+
+   return TRUE;
+}
+
+
+//
 // Upgrade from V48 to V49
 //
 
@@ -2212,6 +2239,7 @@ static struct
    { 46, H_UpgradeFromV46 },
    { 47, H_UpgradeFromV47 },
    { 48, H_UpgradeFromV48 },
+   { 49, H_UpgradeFromV49 },
    { 0, NULL }
 };