- Object overview tab improved
authorVictor Kirhenshtein <victor@netxms.org>
Fri, 1 Dec 2006 17:02:13 +0000 (17:02 +0000)
committerVictor Kirhenshtein <victor@netxms.org>
Fri, 1 Dec 2006 17:02:13 +0000 (17:02 +0000)
- Added option to synchronize object comments with client

12 files changed:
include/nms_cscp.h
include/nxclapi.h
src/console/win32/ObjectOverview.cpp
src/console/win32/ObjectOverview.h
src/console/win32/comm.cpp
src/console/win32/globals.h
src/console/win32/nxcon.clw
src/console/win32/tools.cpp
src/libnxcl/libnxcl.h
src/libnxcl/objects.cpp
src/server/core/session.cpp
src/server/include/nms_core.h

index 1668bdc..af6013d 100644 (file)
@@ -689,6 +689,7 @@ typedef struct
 #define VID_FAILED_DCI_INDEX        ((DWORD)251)
 #define VID_ADDR_LIST_TYPE          ((DWORD)252)
 #define VID_COMPONENT_ID            ((DWORD)253)
+#define VID_SYNC_COMMENTS           ((DWORD)254)
 
 // Variable ranges for object's ACL
 #define VID_ACL_USER_BASE           ((DWORD)0x00001000)
index 230ad5f..86a1a4a 100644 (file)
@@ -940,6 +940,7 @@ typedef struct
    int iStatusTrans[4];
    int iStatusSingleTh;
    int iStatusThresholds[4];
+   TCHAR *pszComments;
    union
    {
       struct __nxc_object_iface iface;
@@ -1564,7 +1565,8 @@ void LIBNXCL_EXPORTABLE *NXCGetClientData(NXC_SESSION hSession);
 void LIBNXCL_EXPORTABLE NXCSetClientData(NXC_SESSION hSession, void *pData);
 
 DWORD LIBNXCL_EXPORTABLE NXCSyncObjects(NXC_SESSION hSession);
-DWORD LIBNXCL_EXPORTABLE NXCSyncObjectsEx(NXC_SESSION hSession, TCHAR *pszCacheFile);
+DWORD LIBNXCL_EXPORTABLE NXCSyncObjectsEx(NXC_SESSION hSession, TCHAR *pszCacheFile,
+                                          BOOL bSyncComments);
 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectById(NXC_SESSION hSession, DWORD dwId);
 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectByIdNoLock(NXC_SESSION hSession, DWORD dwId);
 NXC_OBJECT LIBNXCL_EXPORTABLE *NXCFindObjectByName(NXC_SESSION hSession, TCHAR *pszName);
index 4d6eafa..0fe9b12 100644 (file)
@@ -12,8 +12,8 @@ static char THIS_FILE[] = __FILE__;
 #endif
 
 
-#define X_MARGIN     4
-#define Y_MARGIN     4
+#define X_MARGIN     5
+#define Y_MARGIN     5
 
 
 /////////////////////////////////////////////////////////////////////////////
@@ -33,6 +33,7 @@ BEGIN_MESSAGE_MAP(CObjectOverview, CWnd)
        //{{AFX_MSG_MAP(CObjectOverview)
        ON_WM_CREATE()
        ON_WM_PAINT()
+       ON_WM_SIZE()
        //}}AFX_MSG_MAP
    ON_MESSAGE(NXCM_SET_OBJECT, OnSetObject)
 END_MESSAGE_MAP()
@@ -57,6 +58,8 @@ BOOL CObjectOverview::PreCreateWindow(CREATESTRUCT& cs)
 
 int CObjectOverview::OnCreate(LPCREATESTRUCT lpCreateStruct) 
 {
+   RECT rect;
+
        if (CWnd::OnCreate(lpCreateStruct) == -1)
                return -1;
        
@@ -69,6 +72,17 @@ int CObjectOverview::OnCreate(LPCREATESTRUCT lpCreateStruct)
                           0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET,
                           OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
                           VARIABLE_PITCH | FF_DONTCARE, _T("MS Sans Serif"));
+   m_fontHeading.CreateFont(-MulDiv(10, GetDeviceCaps(GetDC()->m_hDC, LOGPIXELSY), 72),
+                            0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET,
+                            OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY,
+                            VARIABLE_PITCH | FF_DONTCARE, _T("MS Sans Serif"));
+
+   GetClientRect(&rect);
+   rect.top += 50;
+   m_wndListCtrl.Create(WS_CHILD | WS_VISIBLE | LVS_REPORT | LVS_NOCOLUMNHEADER, rect, this, ID_LIST_VIEW);
+   m_wndListCtrl.InsertColumn(0, _T("Name"), LVCFMT_LEFT, 100);
+   m_wndListCtrl.InsertColumn(1, _T("Value"), LVCFMT_LEFT, 400);
+   m_wndListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
        
        return 0;
 }
@@ -81,7 +95,7 @@ int CObjectOverview::OnCreate(LPCREATESTRUCT lpCreateStruct)
 void CObjectOverview::OnSetObject(WPARAM wParam, NXC_OBJECT *pObject)
 {
    m_pObject = pObject;
-   Invalidate();
+   Refresh();
 }
 
 
@@ -96,99 +110,40 @@ void CObjectOverview::OnPaint()
    if (m_pObject != NULL)
    {
       RECT rect;
-      int cy, step, w;
-      TCHAR szBuffer[64], szTemp[32];
       DWORD dwImageIndex;
+      int h;
 
       // Draw icon and objet's name right to it
       dc.FillSolidRect(X_MARGIN - 1, Y_MARGIN - 1, 34, 34, g_statusColorTable[m_pObject->iStatus]);
       dwImageIndex = GetObjectImageIndex(m_pObject);
       g_pObjectNormalImageList->Draw(&dc, dwImageIndex, CPoint(X_MARGIN, Y_MARGIN), ILD_TRANSPARENT);
-      dc.SelectObject(m_fontNormal);
+      dc.SelectObject(&m_fontNormal);
       dc.SetBkColor(RGB(255, 255, 255));
       GetClientRect(&rect);
+      h = rect.bottom;
       rect.left = X_MARGIN + 37;
       rect.top = Y_MARGIN;
       rect.bottom = Y_MARGIN + 40;
       rect.right -= X_MARGIN;
       dc.DrawText(m_pObject->szName, -1, &rect, DT_LEFT | DT_WORDBREAK | DT_NOPREFIX);
-      
-      // Current vertical position and increment
-      cy = 46;
-      step = dc.GetTextExtent(_T("X"), 1).cy + 2;
-
-      // Display object's status
-      dc.TextOut(X_MARGIN, cy, _T("Status:"), 7);
-      dc.SetTextColor(g_statusColorTable[m_pObject->iStatus]);
-      w = dc.GetTextExtent(_T("Status: "), 8).cx;
-      dc.SelectObject(m_fontBold);
-      dc.TextOut(X_MARGIN + w, cy, 
-                 g_szStatusText[m_pObject->iStatus], 
-                 _tcslen(g_szStatusText[m_pObject->iStatus]));
-      dc.SetTextColor(RGB(0, 0, 0));
-      dc.SelectObject(m_fontNormal);
-      cy += step;
-
-      // Object's ID and class
-      _stprintf(szBuffer, _T("Identifier: %d"), m_pObject->dwId);
-      dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-      cy += step;
-      _stprintf(szBuffer, _T("Class: %s"), g_szObjectClass[m_pObject->iClass]);
-      dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-      cy += step;
-
-      // Object's primary IP address
-      if (m_pObject->dwIpAddr != 0)
-      {
-         _stprintf(szBuffer, _T("IP Address: %s"), IpToStr(m_pObject->dwIpAddr, szTemp));
-         dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-         cy += step;
-      }
 
-      // Class-specific information
-      switch(m_pObject->iClass)
+      rect.left = X_MARGIN;
+      rect.top = Y_MARGIN + 45;
+      rect.bottom = rect.top + 20;
+      DrawHeading(dc, _T("Attributes"), &m_fontHeading, &rect, RGB(0, 0, 255), RGB(128, 128, 255));
+
+      rect.top = GetWindowSize(&m_wndListCtrl).cy + Y_MARGIN + 70 + 10;
+      rect.bottom = rect.top + 20;
+      DrawHeading(dc, _T("Comments"), &m_fontHeading, &rect, RGB(0, 0, 255), RGB(128, 128, 255));
+
+      if (m_pObject->pszComments != NULL)
       {
-         case OBJECT_SUBNET:
-            _stprintf(szBuffer, _T("IP NetMask: %s"), IpToStr(m_pObject->subnet.dwIpNetMask, szTemp));
-            dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-            cy += step;
-            break;
-         case OBJECT_NODE:
-            if (m_pObject->node.dwFlags & NF_IS_SNMP)
-            {
-               dc.TextOut(X_MARGIN, cy, _T("SNMP supported"), 14);
-               cy += step;
-
-               _stprintf(szBuffer, _T("OID: %s"), m_pObject->node.szObjectId);
-               dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-               cy += step;
-            }
-            break;
-         case OBJECT_INTERFACE:
-            if (m_pObject->dwIpAddr != 0)
-            {
-               _stprintf(szBuffer, _T("IP NetMask: %s"), IpToStr(m_pObject->iface.dwIpNetMask, szTemp));
-               dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-               cy += step;
-            }
-
-            _stprintf(szBuffer, _T("Index: %d"), m_pObject->iface.dwIfIndex);
-            dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-            cy += step;
-
-            _stprintf(szBuffer, _T("Type: %s"), 
-                      m_pObject->iface.dwIfType > MAX_INTERFACE_TYPE ?
-                          _T("Unknown") : g_szInterfaceTypes[m_pObject->iface.dwIfType]);
-            dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-            cy += step;
-
-            _tcscpy(szBuffer, _T("MAC: "));
-            BinToStr(m_pObject->iface.bMacAddr, MAC_ADDR_LENGTH, &szBuffer[5]);
-            dc.TextOut(X_MARGIN, cy, szBuffer, _tcslen(szBuffer));
-            cy += step;
-            break;
-         default:
-            break;
+         rect.top = rect.bottom + 5;
+         rect.bottom = h;
+         rect.left += 2;
+         rect.right -= 2;
+         dc.DrawText(m_pObject->pszComments, _tcslen(m_pObject->pszComments), &rect,
+                     DT_END_ELLIPSIS | DT_NOPREFIX | DT_WORDBREAK);
       }
    }
    else
@@ -198,3 +153,82 @@ void CObjectOverview::OnPaint()
       dc.TextOut(X_MARGIN, Y_MARGIN, _T("No object selected"), 18);
    }
 }
+
+
+//
+// WM_SIZE message handler
+//
+
+void CObjectOverview::OnSize(UINT nType, int cx, int cy) 
+{
+   RECT rect;
+
+       CWnd::OnSize(nType, cx, cy);
+
+   m_wndListCtrl.SetWindowPos(NULL, X_MARGIN, Y_MARGIN + 70, cx - X_MARGIN * 2, max(50, (cy - Y_MARGIN - 70) / 2), SWP_NOZORDER);
+   m_wndListCtrl.GetClientRect(&rect);
+   m_wndListCtrl.SetColumnWidth(1, rect.right - 100);
+}
+
+
+//
+// Refresh view
+//
+
+void CObjectOverview::Refresh()
+{
+   TCHAR szTemp[256];
+
+   m_wndListCtrl.DeleteAllItems();
+
+   InsertItem(_T("ID"), m_pObject->dwId);
+   InsertItem(_T("Class"), g_szObjectClass[m_pObject->iClass]);
+   if (m_pObject->dwIpAddr != 0)
+      InsertItem(_T("IP Address"), IpToStr(m_pObject->dwIpAddr, szTemp));
+
+   // Class-specific information
+   switch(m_pObject->iClass)
+   {
+      case OBJECT_SUBNET:
+         InsertItem(_T("Network Mask"), IpToStr(m_pObject->subnet.dwIpNetMask, szTemp));
+         break;
+      case OBJECT_NODE:
+         break;
+      case OBJECT_INTERFACE:
+         if (m_pObject->dwIpAddr != 0)
+            InsertItem(_T("IP Netmask"), IpToStr(m_pObject->iface.dwIpNetMask, szTemp));
+         InsertItem(_T("Index"), m_pObject->iface.dwIfIndex);
+         InsertItem(_T("Type"), 
+                    m_pObject->iface.dwIfType > MAX_INTERFACE_TYPE ?
+                           _T("Unknown") : g_szInterfaceTypes[m_pObject->iface.dwIfType]);
+         BinToStr(m_pObject->iface.bMacAddr, MAC_ADDR_LENGTH, szTemp);
+         InsertItem(_T("MAC Address"), szTemp);
+         break;
+      default:
+         break;
+   }
+
+   Invalidate();
+}
+
+
+//
+// Insert item into list control
+//
+
+void CObjectOverview::InsertItem(TCHAR *pszName, TCHAR *pszValue)
+{
+   int nItem;
+
+   nItem = m_wndListCtrl.InsertItem(0x7FFFFFFF, pszName);
+   if (nItem != -1)
+      m_wndListCtrl.SetItemText(nItem, 1, pszValue);
+}
+
+void CObjectOverview::InsertItem(TCHAR *pszName, DWORD dwValue)
+{
+   TCHAR szBuffer[64];
+
+   _stprintf(szBuffer, _T("%u"), dwValue);
+   InsertItem(pszName, szBuffer);
+}
index 00a8437..634ebd0 100644 (file)
@@ -31,16 +31,22 @@ public:
 
 // Implementation
 public:
+       void Refresh(void);
        virtual ~CObjectOverview();
 
        // Generated message map functions
 protected:
+       CFont m_fontHeading;
+       void InsertItem(TCHAR *pszName, DWORD dwValue);
+       void InsertItem(TCHAR *pszName, TCHAR *pszValue);
+       CListCtrl m_wndListCtrl;
        CFont m_fontBold;
        CFont m_fontNormal;
        NXC_OBJECT * m_pObject;
        //{{AFX_MSG(CObjectOverview)
        afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
        afx_msg void OnPaint();
+       afx_msg void OnSize(UINT nType, int cx, int cy);
        //}}AFX_MSG
    afx_msg void OnSetObject(WPARAM wParam, NXC_OBJECT *pObject);
        DECLARE_MESSAGE_MAP()
index ebc664f..8f462ac 100644 (file)
@@ -191,7 +191,7 @@ static DWORD WINAPI LoginThread(void *pArg)
          DeleteFile(szCacheFile);
       dwResult = NXCSubscribe(g_hSession, NXC_CHANNEL_OBJECTS);
       if (dwResult == RCC_SUCCESS)
-         dwResult = NXCSyncObjectsEx(g_hSession, szCacheFile);
+         dwResult = NXCSyncObjectsEx(g_hSession, szCacheFile, TRUE);
    }
 
    if (dwResult == RCC_SUCCESS)
index 871bdaa..2f76592 100644 (file)
@@ -275,6 +275,8 @@ DWORD WINAPI PollerThread(void *pArg);
 
 void DrawPieChart(CDC &dc, RECT *pRect, int iNumElements, DWORD *pdwValues, COLORREF *pColors);
 void Draw3dRect(HDC hDC, LPRECT pRect, COLORREF rgbTop, COLORREF rgbBottom);
+void DrawHeading(CDC &dc, TCHAR *pszText, CFont *pFont, RECT *pRect,
+                 COLORREF rgbColor1, COLORREF rgbColor2);
 
 
 //
index c88d9a9..c6216b6 100644 (file)
@@ -17,20 +17,20 @@ Class9=CMapView
 
 ResourceCount=184
 Resource1=IDD_CP_GENERAL (English (U.S.))
-Resource2=IDA_OBJECT_TOOLS_EDITOR
+Resource2=IDA_DC_EDITOR
 Resource3=IDD_DCI_DATA_EXPORT (English (U.S.))
-Resource4=IDD_EDIT_RULE_COMMENT
-Resource5=IDD_OBJECT_GENERAL
+Resource4=IDD_SELECT_OBJECT
+Resource5=IDD_REQUEST_PROCESSING
 Class2=CChildView
 Class5=CAboutDlg
 Class6=CControlPanel
 Class8=CMapFrame
 Class10=CLoginDialog
-Resource6=IDD_OBJECT_COND_DATA
+Resource6=IDD_OBJECT_COND_SCRIPT
 Class11=CProgressDialog
-Resource7=IDD_SAVE_AGENT_CFG
+Resource7=IDD_EDIT_IP_SUBNET
 Class12=CAddrEntryDlg
-Resource8=IDA_AGENT_CFG_EDITOR
+Resource8=IDA_SERVER_CFG_EDITOR
 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=IDA_AGENT_CONFIG_MANAGER
+Resource20=IDA_DATA_VIEW
 Class17=CObjectPreview
 Resource21=IDA_OBJECT_BROWSER (English (U.S.))
 Class18=CToolBox
 Class19=CObjectInfoBox
 Class20=CObjectSearchBox
-Resource22=IDD_NEW_ACTION
+Resource22=IDD_CP_GENERAL
 Class21=CEditBox
 Class22=COPGeneral
 Class23=CNodePropsGeneral
 Resource23=IDD_GRAPH_PROPERTIES (English (U.S.))
 Class24=CObjectPropCaps
 Class25=CObjectPropSheet
-Resource24=IDD_EDIT_EVENT
+Resource24=IDD_ABOUTBOX
 Class26=CRequestProcessingDlg
 Resource25=IDD_SELECT_USER (English (U.S.))
 Resource26=IDD_PROGRESS (English (U.S.))
-Resource27=IDD_CP_GENERAL
+Resource27=IDD_EDIT_RULE_ALARM
 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_GRAPH_PROP_SETTINGS
-Resource32=IDD_SELECT_EVENT
+Resource31=IDD_DESKTOP_SAVE_AS
+Resource32=IDD_EDIT_RULE_COMMENT
 Class29=CUserSelectDlg
-Resource33=IDD_DCI_THRESHOLDS
+Resource33=IDD_DCI_COLLECTION
 Class30=CUserEditor
 Resource34=IDD_DCI_PROPERTIES
 Class31=CNewUserDlg
-Resource35=IDD_OBJECT_NODE_GENERAL
-Resource36=IDD_EDIT_RULE_ALARM
+Resource35=IDD_EDIT_EVENT
+Resource36=IDD_EDIT_RULE_SEVERITY
 Class32=CUserPropDlg
 Resource37=IDD_EDIT_VARIABLE (English (U.S.))
-Resource38=IDD_EDIT_RULE_SEVERITY
+Resource38=IDD_OBJECT_PRESENTATION
 Class33=CGroupPropDlg
-Resource39=IDD_DATA_QUERY
-Resource40=IDD_OBJTOOL_GENERAL
-Resource41=IDD_INPUT_BOX
+Resource39=IDD_CREATE_TEMPLATE
+Resource40=IDD_OBJECT_STATUS
+Resource41=IDD_SELECT_AGENT_PARAM
 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=IDD_GROUP_PROPERTIES
+Resource48=IDD_USER_PROPERTIES
 Class43=CThresholdDlg
 Resource49=IDD_DESKTOP_SAVE_AS (English (U.S.))
-Resource50=IDD_COND_DCI_PROP
+Resource50=IDD_ADD_DCI
 Class44=CMIBBrowserDlg
 Class45=CEventPolicyEditor
 Class46=CRuleList
 Class47=CRuleHeader
 Resource51=IDD_SELECT_AGENT_PARAM (English (U.S.))
-Resource52=IDD_OBJECT_COND_GENERAL
+Resource52=IDD_CREATE_CONDITION
 Class48=CObjectSelDlg
-Resource53=IDD_SET_PASSWORD
-Resource54=IDA_ALARM_BROWSER
+Resource53=IDD_GROUP_PROPERTIES
+Resource54=IDA_EPP
 Class49=CRuleCommentDlg
-Resource55=IDD_OBJECT_NODE_POLL
+Resource55=IDD_OBJECT_NETSRV_GENERAL
 Class50=CEventSelDlg
-Resource56=IDA_TRAP_EDITOR
+Resource56=IDA_ACTION_EDITOR
 Resource57=IDA_EPP (English (U.S.))
-Resource58=IDD_AGENT_CONFIG
+Resource58=IDD_COND_DCI_PROP
 Resource59=IDA_PACKAGE_MGR (English (U.S.))
 Resource60=IDD_OBJTOOL_GENERAL (English (U.S.))
 Class51=CObjectPropsPresentation
 Resource61=IDD_CREATE_TEMPLATE (English (U.S.))
-Resource62=IDD_MIB_BROWSER
+Resource62=IDD_THRESHOLD
 Class52=CRuleSeverityDlg
-Resource63=IDD_CREATE_TEMPLATE
+Resource63=IDD_CREATE_TG
 Class53=CRuleAlarmDlg
 Class54=CAlarmBrowser
 Resource64=IDA_MDI_DEFAULT (English (U.S.))
-Resource65=IDD_OBJECT_COND_SCRIPT
+Resource65=IDD_OBJECT_COND_GENERAL
 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=IDD_EDIT_RULE_SCRIPT
-Resource70=IDD_DISCOVERY_TARGETS
+Resource69=IDD_AGENT_CONFIG
+Resource70=IDD_DISCOVERY_GENERAL
 Class57=CNewActionDlg
-Resource71=IDD_CHANGE_PASSWORD
+Resource71=IDD_SUBMAP_BKGND
 Class58=CEditActionDlg
-Resource72=IDA_ACTION_EDITOR
+Resource72=IDA_EVENT_EDITOR
 Class59=CActionSelDlg
-Resource73=IDD_ADD_DCI
+Resource73=IDD_OBJECT_COND_DATA
 Resource74=IDD_EDIT_TRAP (English (U.S.))
 Resource75=IDD_USER_PROPERTIES (English (U.S.))
-Resource76=IDD_SUBMAP_BKGND
+Resource76=IDD_SNMP_WALK
 Class60=CCreateObjectDlg
 Class61=CCreateContainerDlg
-Resource77=IDD_THRESHOLD
+Resource77=IDD_DCI_THRESHOLDS
 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_CREATE_TG
-Resource84=IDD_OBJECT_CAPS
+Resource83=IDD_DCI_TRANSFORM
+Resource84=IDD_OBJECT_NODE_GENERAL
 Class66=CCreateTemplateDlg
 Class67=CCreateTGDlg
-Resource85=IDD_DISCOVERY_GENERAL
-Resource86=IDD_OBJECT_NETSRV_GENERAL
+Resource85=IDD_EDIT_RULE_SCRIPT
+Resource86=IDD_CREATE_NETSRV
 Class68=CTrapEditor
-Resource87=IDA_SCRIPT_MANAGER
-Resource88=IDA_LAST_VALUES
-Resource89=IDA_NETMAP
+Resource87=IDA_OBJECT_TOOLS_EDITOR
+Resource88=IDA_PACKAGE_MGR
+Resource89=IDA_ALARM_BROWSER
 Class69=CDataQueryDlg
-Resource90=IDA_EVENT_EDITOR
+Resource90=IDA_NETMAP
 Class70=CTrapEditDlg
 Resource91=IDM_VIEW_SPECIFIC (English (U.S.))
 Class71=CTrapParamDlg
-Resource92=IDA_EPP
-Resource93=IDD_OBJTOOL_COLUMNS
+Resource92=IDA_OBJECT_BROWSER
+Resource93=IDD_REMOVE_TEMPLATE
 Class72=CGraphPropDlg
 Class73=CColorSelector
 Class74=CPackageMgr
-Resource94=IDA_SERVER_CFG_EDITOR
+Resource94=IDA_LAST_VALUES
 Resource95=IDA_SCRIPT_MANAGER (English (U.S.))
 Resource96=IDD_SET_PASSWORD (English (U.S.))
 Resource97=IDD_DCI_TRANSFORM (English (U.S.))
-Resource98=IDD_GRAPH_PROP_DATA
+Resource98=IDD_GRAPH_PROP_SETTINGS
 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_DATA_VIEW
+Resource129=IDA_SCRIPT_MANAGER
 Class106=CDCISchedulePage
 Resource130=IDD_OBJECT_CAPS (English (U.S.))
 Class107=CObjectPropsStatus
@@ -270,66 +270,66 @@ Class119=CMapControlBox
 Resource138=IDD_OBJECT_GENERAL (English (U.S.))
 Class120=CSubmapBkgndDlg
 Resource139=IDD_SUBMAP_BKGND (English (U.S.))
-Resource140=IDD_OBJECT_STATUS
-Resource141=IDD_OBJECT_RELATIONS
-Resource142=IDD_NEW_USER
-Resource143=IDM_VIEW_SPECIFIC
-Resource144=IDD_SELECT_ACTION
-Resource145=IDD_OBJECT_PRESENTATION
-Resource146=IDD_OBJTOOL_OPTIONS
-Resource147=IDD_SNMP_WALK
-Resource148=IDM_CONTEXT
-Resource149=IDD_REMOVE_TEMPLATE
-Resource150=IDD_EDIT_VARIABLE
-Resource151=IDD_OBJECT_VPNC_GENERAL
-Resource152=IDD_CREATE_CONDITION
-Resource153=IDD_DCI_COLLECTION
-Resource154=IDA_MDI_DEFAULT
-Resource155=IDD_REQUEST_PROCESSING
-Resource156=IDD_SELECT_INTERNAL_ITEM
-Resource157=IDD_CHANGE_IP
-Resource158=IDD_SELECT_AGENT_PARAM
-Resource159=IDA_DC_EDITOR
-Resource160=IDD_SELECT_USER
-Resource161=IDD_DISCOVERY_RANGES
-Resource162=IDD_CREATE_VPNC
-Resource163=IDA_GRAPH
-Resource164=IDD_DCI_TRANSFORM
-Resource165=IDD_CREATE_NODE
-Resource166=IDD_EDIT_TRAP_ARG
-Resource167=IDA_PACKAGE_MGR
-Resource168=IDD_DESKTOP_SAVE_AS
-Resource169=IDD_DCI_SCHEDULE
-Resource170=IDD_USER_PROPERTIES
-Resource171=IDD_NEW_OBJECT_TOOL
+Resource140=IDD_DCI_SCHEDULE
+Resource141=IDD_OBJECT_NODE_POLL
+Resource142=IDD_SELECT_USER
+Resource143=IDM_CONTEXT
+Resource144=IDD_ACTION_PROPERTIES
+Resource145=IDD_SELECT_EVENT
+Resource146=IDD_NEW_OBJECT_TOOL
+Resource147=IDD_OBJTOOL_COLUMNS
+Resource148=IDM_VIEW_SPECIFIC
+Resource149=IDD_CHANGE_IP
+Resource150=IDD_DCI_DATA_EXPORT
+Resource151=IDD_CREATE_VPNC
+Resource152=IDD_CHANGE_PASSWORD
+Resource153=IDD_SET_PASSWORD
+Resource154=IDR_MAINFRAME
+Resource155=IDD_OBJECT_CAPS
+Resource156=IDD_EDIT_TRAP_ARG
+Resource157=IDD_OBJTOOL_OPTIONS
+Resource158=IDD_SELECT_INTERNAL_ITEM
+Resource159=IDA_AGENT_CFG_EDITOR
+Resource160=IDD_OBJECT_SECURITY
+Resource161=IDD_DISCOVERY_TARGETS
+Resource162=IDD_EDIT_VARIABLE
+Resource163=IDA_TRAP_EDITOR
+Resource164=IDD_CREATE_NODE
+Resource165=IDD_CREATE_CONTAINER
+Resource166=IDD_EDIT_TRAP
+Resource167=IDA_GRAPH
+Resource168=IDD_OBJECT_RELATIONS
+Resource169=IDD_SAVE_AGENT_CFG
+Resource170=IDD_NEW_USER
+Resource171=IDD_OBJTOOL_GENERAL
 Class121=CModuleManager
 Class122=CDesktopManager
-Resource172=IDR_MAINFRAME
-Resource173=IDD_CREATE_NETSRV
+Resource172=IDD_DISCOVERY_RANGES
+Resource173=IDD_INPUT_BOX
 Class123=CCreateCondDlg
 Class124=CCondPropsGeneral
 Class125=CCondPropsScript
 Class126=CCondPropsData
-Resource174=IDD_SELECT_OBJECT
+Resource174=IDD_MIB_BROWSER
 Class127=CAddDCIDlg
-Resource175=IDD_EDIT_IP_SUBNET
+Resource175=IDD_OBJECT_VPNC_GENERAL
 Class128=CCondDCIPropDlg
-Resource176=IDD_DCI_DATA_EXPORT
+Resource176=IDD_LASTVAL_PROP
 Class129=CAgentConfigMgr
-Resource177=IDD_ABOUTBOX
-Resource178=IDD_CREATE_CONTAINER
+Resource177=IDA_AGENT_CONFIG_MANAGER
+Resource178=IDD_SELECT_ACTION
 Class130=CAgentCfgDlg
 Class131=CObjectCommentsEditor
-Resource179=IDD_ACTION_PROPERTIES
+Resource179=IDD_NEW_ACTION
 Class132=CRuleScriptDlg
 Class133=CDetailsView
-Resource180=IDD_LASTVAL_PROP
+Resource180=IDD_GRAPH_PROP_DATA
 Class134=CDiscoveryPropGeneral
-Resource181=IDD_OBJECT_SECURITY
+Resource181=IDD_OBJECT_GENERAL
 Class135=CDiscoveryPropTargets
-Resource182=IDD_EDIT_TRAP
+Resource182=IDD_DATA_QUERY
 Class136=CDiscoveryPropAddrList
-Resource183=IDA_OBJECT_BROWSER
+Resource183=IDA_MDI_DEFAULT
 Class138=CObjectBrowser
 Class139=CObjectView
 Class140=CObjectOverview
index eb74fe6..2d7fc14 100644 (file)
@@ -845,3 +845,44 @@ void LoadListCtrlColumns(CListCtrl &wndListCtrl, TCHAR *pszSection, TCHAR *pszPr
       wndListCtrl.SetColumn(i, &lvc);
    }
 }
+
+
+//
+// Draw text underlined by gradient-filled line
+//
+
+void DrawHeading(CDC &dc, TCHAR *pszText, CFont *pFont, RECT *pRect,
+                 COLORREF rgbColor1, COLORREF rgbColor2)
+{
+   TRIVERTEX vtx[2];
+   GRADIENT_RECT gr;
+   RECT rect;
+   CFont *pOldFont;
+
+   memcpy(&rect, pRect, sizeof(RECT));
+   rect.bottom -= 5;
+   rect.left += 2;
+   rect.right -= 2;
+   pOldFont = dc.SelectObject(pFont);
+   dc.DrawText(pszText, _tcslen(pszText), &rect, DT_LEFT | DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
+   dc.SelectObject(pOldFont);
+
+   vtx[0].x = pRect->left;
+   vtx[0].y = pRect->bottom - 3;
+   vtx[0].Red = (COLOR16)GetRValue(rgbColor1) << 8;
+   vtx[0].Green = (COLOR16)GetGValue(rgbColor1) << 8;
+   vtx[0].Blue = (COLOR16)GetBValue(rgbColor1) << 8;
+   vtx[0].Alpha = 0;
+
+   vtx[1].x = pRect->right;
+   vtx[1].y = pRect->bottom;
+   vtx[1].Red = (COLOR16)GetRValue(rgbColor2) << 8;
+   vtx[1].Green = (COLOR16)GetGValue(rgbColor2) << 8;
+   vtx[1].Blue = (COLOR16)GetBValue(rgbColor2) << 8;
+   vtx[1].Alpha = 0;
+
+   gr.UpperLeft = 0;
+   gr.LowerRight = 1;
+
+   GradientFill(dc.m_hDC, vtx, 2, &gr, 1, GRADIENT_FILL_RECT_H);
+}
index 4220d1f..e01fcd1 100644 (file)
@@ -210,7 +210,7 @@ public:
    BOOL GetUserDB(NXC_USER **ppUserList, DWORD *pdwNumUsers);
    NXC_USER *FindUserById(DWORD dwId);
 
-   DWORD SyncObjects(TCHAR *pszCacheFile);
+   DWORD SyncObjects(TCHAR *pszCacheFile, BOOL bSyncComments);
    void LockObjectIndex(void) { MutexLock(m_mutexIndexAccess, INFINITE); }
    void UnlockObjectIndex(void) { MutexUnlock(m_mutexIndexAccess); }
    NXC_OBJECT *FindObjectById(DWORD dwId, BOOL bLock);
index a9e60b3..bd868cd 100644 (file)
@@ -62,6 +62,7 @@ void DestroyObject(NXC_OBJECT *pObject)
    safe_free(pObject->pdwChildList);
    safe_free(pObject->pdwParentList);
    safe_free(pObject->pAccessList);
+   safe_free(pObject->pszComments);
    free(pObject);
 }
 
@@ -170,6 +171,7 @@ static void ReplaceObject(NXC_OBJECT *pObject, NXC_OBJECT *pNewObject)
    safe_free(pObject->pdwChildList);
    safe_free(pObject->pdwParentList);
    safe_free(pObject->pAccessList);
+   safe_free(pObject->pszComments);
    memcpy(pObject, pNewObject, sizeof(NXC_OBJECT));
    free(pNewObject);
 }
@@ -209,6 +211,7 @@ static NXC_OBJECT *NewObjectFromMsg(CSCPMessage *pMsg)
    pObject->iStatusThresholds[1] = (int)pMsg->GetVariableShort(VID_STATUS_THRESHOLD_2);
    pObject->iStatusThresholds[2] = (int)pMsg->GetVariableShort(VID_STATUS_THRESHOLD_3);
    pObject->iStatusThresholds[3] = (int)pMsg->GetVariableShort(VID_STATUS_THRESHOLD_4);
+   pObject->pszComments = pMsg->GetVariableStr(VID_COMMENTS);
 
    // Parents
    pObject->dwNumParents = pMsg->GetVariableLong(VID_PARENT_CNT);
@@ -402,7 +405,7 @@ void NXCL_Session::ProcessObjectUpdate(CSCPMessage *pMsg)
 // This function is NOT REENTRANT
 //
 
-DWORD NXCL_Session::SyncObjects(TCHAR *pszCacheFile)
+DWORD NXCL_Session::SyncObjects(TCHAR *pszCacheFile, BOOL bSyncComments)
 {
    CSCPMessage msg;
    DWORD dwRetCode, dwRqId;
@@ -419,6 +422,7 @@ DWORD NXCL_Session::SyncObjects(TCHAR *pszCacheFile)
    msg.SetCode(CMD_GET_OBJECTS);
    msg.SetId(dwRqId);
    msg.SetVariable(VID_TIMESTAMP, m_dwTimeStamp);
+   msg.SetVariable(VID_SYNC_COMMENTS, (WORD)bSyncComments);
    SendMsg(&msg);
 
    dwRetCode = WaitForRCC(dwRqId);
@@ -439,12 +443,13 @@ DWORD NXCL_Session::SyncObjects(TCHAR *pszCacheFile)
 
 DWORD LIBNXCL_EXPORTABLE NXCSyncObjects(NXC_SESSION hSession)
 {
-   return ((NXCL_Session *)hSession)->SyncObjects(NULL);
+   return ((NXCL_Session *)hSession)->SyncObjects(NULL, FALSE);
 }
 
-DWORD LIBNXCL_EXPORTABLE NXCSyncObjectsEx(NXC_SESSION hSession, TCHAR *pszCacheFile)
+DWORD LIBNXCL_EXPORTABLE NXCSyncObjectsEx(NXC_SESSION hSession, TCHAR *pszCacheFile,
+                                          BOOL bSyncComments)
 {
-   return ((NXCL_Session *)hSession)->SyncObjects(pszCacheFile);
+   return ((NXCL_Session *)hSession)->SyncObjects(pszCacheFile, bSyncComments);
 }
 
 
index 530d9ca..03a0d31 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: session.cpp,v 1.246 2006-11-14 19:49:37 victor Exp $ */
+/* $Id: session.cpp,v 1.247 2006-12-01 17:02:13 victor Exp $ */
 /* 
 ** NetXMS - Network Management System
 ** Copyright (C) 2003, 2004, 2005, 2006 Victor Kirhenshtein
@@ -557,6 +557,8 @@ void ClientSession::UpdateThread(void)
             MutexLock(m_mutexSendObjects, INFINITE);
             msg.SetCode(CMD_OBJECT_UPDATE);
             ((NetObj *)pUpdate->pData)->CreateMessage(&msg);
+            if (m_dwFlags & CSF_SYNC_OBJECT_COMMENTS)
+               ((NetObj *)pUpdate->pData)->CommentsToMessage(&msg);
             SendMessage(&msg);
             MutexUnlock(m_mutexSendObjects);
             msg.DeleteAllVariables();
@@ -1482,6 +1484,12 @@ void ClientSession::SendAllObjects(CSCPMessage *pRequest)
    SendMessage(&msg);
    msg.DeleteAllVariables();
 
+   // Change "sync comments" flag
+   if (pRequest->GetVariableShort(VID_SYNC_COMMENTS))
+      m_dwFlags |= CSF_SYNC_OBJECT_COMMENTS;
+   else
+      m_dwFlags &= ~CSF_SYNC_OBJECT_COMMENTS;
+
    // Get client's last known time stamp
    dwTimeStamp = pRequest->GetVariableLong(VID_TIMESTAMP);
 
@@ -1498,6 +1506,8 @@ void ClientSession::SendAllObjects(CSCPMessage *pRequest)
           (!g_pIndexById[i].pObject->IsHidden()))
       {
          g_pIndexById[i].pObject->CreateMessage(&msg);
+         if (m_dwFlags & CSF_SYNC_OBJECT_COMMENTS)
+            g_pIndexById[i].pObject->CommentsToMessage(&msg);
          SendMessage(&msg);
          msg.DeleteAllVariables();
       }
index 04b33de..f203c74 100644 (file)
@@ -184,6 +184,7 @@ typedef void * HSNMPSESSION;
 #define CSF_AUTHENTICATED        ((DWORD)0x0080)
 #define CSF_OBJECT_TOOLS_LOCKED  ((DWORD)0x0100)
 #define CSF_RECEIVING_MAP_DATA   ((DWORD)0x0200)
+#define CSF_SYNC_OBJECT_COMMENTS ((DWORD)0x0400)
 
 
 //