[SVN-NetXMS] revision 3298

From: NetXMS.org SVN Server <svn_at_DOMAIN_REMOVED>
Date: Fri, 6 Jun 2008 01:42:22 +0300

* { font-family: Consolas, Lucida Console, Courier New; font-size: 100%; }
h1 { font-size: 150%; }
td.linenos { background-color: #f0f0f0; padding-right: 10px; }
span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
pre { line-height: 100%; width: 100%; }
.highlight span { width: 100%; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
body { background: #ffffff; }
body .c { color: #999988; font-style: italic } /* Comment */
body .err { color: #a61717; background-color: #e3d2d2 } /* Error */
body .k { font-weight: bold } /* Keyword */
body .o { font-weight: bold } /* Operator */
body .cm { color: #999988; font-style: italic } /* Comment.Multiline */
body .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
body .c1 { color: #999988; font-style: italic } /* Comment.Single */
body .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
body .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
body .ge { font-style: italic } /* Generic.Emph */
body .gr { color: #aa0000 } /* Generic.Error */
body .gh { color: #999999 } /* Generic.Heading */
body .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
body .go { color: #888888 } /* Generic.Output */
body .gp { color: #555555 } /* Generic.Prompt */
body .gs { font-weight: bold } /* Generic.Strong */
body .gu { color: #aaaaaa } /* Generic.Subheading */
body .gt { color: #aa0000 } /* Generic.Traceback */
body .kc { font-weight: bold } /* Keyword.Constant */
body .kd { font-weight: bold } /* Keyword.Declaration */
body .kp { font-weight: bold } /* Keyword.Pseudo */
body .kr { font-weight: bold } /* Keyword.Reserved */
body .kt { color: #445588; font-weight: bold } /* Keyword.Type */
body .m { color: #009999 } /* Literal.Number */
body .s { color: #bb8844 } /* Literal.String */
body .na { color: #008080 } /* Name.Attribute */
body .nb { color: #999999 } /* Name.Builtin */
body .nc { color: #445588; font-weight: bold } /* Name.Class */
body .no { color: #008080 } /* Name.Constant */
body .ni { color: #800080 } /* Name.Entity */
body .ne { color: #990000; font-weight: bold } /* Name.Exception */
body .nf { color: #990000; font-weight: bold } /* Name.Function */
body .nn { color: #555555 } /* Name.Namespace */
body .nt { color: #000080 } /* Name.Tag */
body .nv { color: #008080 } /* Name.Variable */
body .ow { font-weight: bold } /* Operator.Word */
body .w { color: #bbbbbb } /* Text.Whitespace */
body .mf { color: #009999 } /* Literal.Number.Float */
body .mh { color: #009999 } /* Literal.Number.Hex */
body .mi { color: #009999 } /* Literal.Number.Integer */
body .mo { color: #009999 } /* Literal.Number.Oct */
body .sb { color: #bb8844 } /* Literal.String.Backtick */
body .sc { color: #bb8844 } /* Literal.String.Char */
body .sd { color: #bb8844 } /* Literal.String.Doc */
body .s2 { color: #bb8844 } /* Literal.String.Double */
body .se { color: #bb8844 } /* Literal.String.Escape */
body .sh { color: #bb8844 } /* Literal.String.Heredoc */
body .si { color: #bb8844 } /* Literal.String.Interpol */
body .sx { color: #bb8844 } /* Literal.String.Other */
body .sr { color: #808000 } /* Literal.String.Regex */
body .s1 { color: #bb8844 } /* Literal.String.Single */
body .ss { color: #bb8844 } /* Literal.String.Symbol */
body .bp { color: #999999 } /* Name.Builtin.Pseudo */
body .vc { color: #008080 } /* Name.Variable.Class */
body .vg { color: #008080 } /* Name.Variable.Global */
body .vi { color: #008080 } /* Name.Variable.Instance */
body .il { color: #009999 } /* Literal.Number.Integer.Long */

Info

Revision:3298
Author:victor

Date:2008-06-06 01:42:22 +0300 (Fri, 06 Jun 2008)

Comment:Fixed problem with map save after creation; added global variables $node and $event to scripts in EPP; fixed bug in setting custom event message via CUSTOM_MESSAGE script variable

Changes
U trunk/include/netxms_maps.h
U trunk/src/libnxmap/map.cpp
U trunk/src/server/core/epp.cpp
U trunk/src/server/core/map.cpp
U trunk/src/server/core/nxsl_classes.cpp
U trunk/src/server/include/nxcore_maps.h

Diff
Modified: trunk/include/netxms_maps.h
===================================================================
--- trunk/include/netxms_maps.h 2008-06-05 21:11:53 UTC (rev 3297)
+++ trunk/include/netxms_maps.h 2008-06-05 22:42:22 UTC (rev 3298)
@@ -242,7 +242,7 @@
    DWORD m_dwNumLinks;
    OBJLINK *m_pLinkList;
 
- virtual void CommonInit(void);
+ void CommonInit(void);
 
 public:
    nxSubmap();
@@ -319,7 +319,7 @@
    MUTEX m_mutex;
    SUBMAP_CREATION_CALLBACK m_pfCreateSubmap;
 
- virtual void CommonInit(void);
+ void CommonInit(void);
 
 public:
    nxMap();

Modified: trunk/src/libnxmap/map.cpp
===================================================================
--- trunk/src/libnxmap/map.cpp 2008-06-05 21:11:53 UTC (rev 3297)
+++ trunk/src/libnxmap/map.cpp 2008-06-05 22:42:22 UTC (rev 3298)
@@ -1,7 +1,7 @@
 /*
 ** NetXMS - Network Management System
 ** Network Maps Library
-** Copyright (C) 2006 Victor Kirhenshtein
+** Copyright (C) 2006, 2007, 2008 Victor Kirhenshtein
 **
 ** This program is free software; you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by

Modified: trunk/src/server/core/epp.cpp
===================================================================
--- trunk/src/server/core/epp.cpp 2008-06-05 21:11:53 UTC (rev 3297)
+++ trunk/src/server/core/epp.cpp 2008-06-05 22:42:22 UTC (rev 3298)
@@ -282,6 +282,7 @@
    NXSL_VariableSystem *pLocals, *pGlobals = NULL;
    BOOL bRet = TRUE;
    DWORD i;
+ NetObj *pObject;
 
    if (m_pScript == NULL)
       return TRUE;
@@ -304,6 +305,14 @@
    pLocals-&gt;Create(_T(&quot;OBJECT_ID&quot;), new NXSL_Value(pEvent-&gt;SourceId()));
    pLocals-&gt;Create(_T(&quot;EVENT_TEXT&quot;), new NXSL_Value((TCHAR *)pEvent-&gt;Message()));
    pLocals-&gt;Create(_T(&quot;USER_TAG&quot;), new NXSL_Value((TCHAR *)pEvent-&gt;UserTag()));
+ pObject = FindObjectById(pEvent-&gt;SourceId());
+ if (pObject != NULL)
+ {
+ if (pObject-&gt;Type() == OBJECT_NODE)
+ m_pScript-&gt;SetGlobalVariable(_T(&quot;$node&quot;), new NXSL_Value(new NXSL_Object(&amp;g_nxslNodeClass, pObject)));
+ }
+ m_pScript-&gt;SetGlobalVariable(_T(&quot;$event&quot;), new NXSL_Value(new NXSL_Object(&amp;g_nxslEventClass, pEvent)));
+ m_pScript-&gt;SetGlobalVariable(_T(&quot;CUSTOM_MESSAGE&quot;), new NXSL_Value);
 
    // Run script
    if (m_pScript-&gt;Run(pEnv, pEvent-&gt;GetParametersCount(), ppValueList, pLocals, &amp;pGlobals) == 0)

Modified: trunk/src/server/core/map.cpp
===================================================================
--- trunk/src/server/core/map.cpp 2008-06-05 21:11:53 UTC (rev 3297)
+++ trunk/src/server/core/map.cpp 2008-06-05 22:42:22 UTC (rev 3298)
@@ -187,18 +187,33 @@
 
 
 //
+// Constructor for creating map object from scratch
+//
+
+nxMapSrv::nxMapSrv(DWORD dwMapId, DWORD dwObjectId, const TCHAR *pszName, const TCHAR *pszDescription)
+ : nxMap(dwMapId, dwObjectId, pszName, pszDescription)
+{
+ m_nRefCount = 0;
+ m_pfCreateSubmap = CreateSubmapSrv;
+}
+
+
+//
 // Constructor for creaing map object from database
 // Expected field order:
 // map_id,map_name,description,root_object_id
 //
 
 nxMapSrv::nxMapSrv(DB_RESULT hData, int nRow)
+ : nxMap()
 {
    DB_RESULT hResult;
    DWORD i;
    TCHAR szQuery[1024];
 
- CommonInit();
+ m_nRefCount = 0;
+ m_pfCreateSubmap = CreateSubmapSrv;
+
    m_dwMapId = DBGetFieldULong(hData, nRow, 0);
    m_pszName = DBGetField(hData, nRow, 1, NULL, 0);
    DecodeSQLString(m_pszName);
@@ -337,18 +352,6 @@
 
 
 //
-// Common initialization for nxMapSrv constructors
-//
-
-void nxMapSrv::CommonInit(void)
-{
- nxMap::CommonInit();
- m_nRefCount = 0;
- m_pfCreateSubmap = CreateSubmapSrv;
-}
-
-
-//
 // Check user&#39;s access level
 //
 

Modified: trunk/src/server/core/nxsl_classes.cpp
===================================================================
--- trunk/src/server/core/nxsl_classes.cpp 2008-06-05 21:11:53 UTC (rev 3297)
+++ trunk/src/server/core/nxsl_classes.cpp 2008-06-05 22:42:22 UTC (rev 3298)
@@ -144,7 +144,12 @@
    }
    else if (!strcmp(pszAttr, &quot;parameters&quot;))
    {
- value = new NXSL_Value(event-&gt;GetParameter(0));
+ NXSL_Array *array = new NXSL_Array;
+ DWORD i;
+
+ for(i = 0; i &lt; event-&gt;GetParametersCount(); i++)
+ array-&gt;Set((int)(i + 1), new NXSL_Value(event-&gt;GetParameter(i)));
+ value = new NXSL_Value(array);
    }
    return value;
 }

Modified: trunk/src/server/include/nxcore_maps.h
===================================================================
--- trunk/src/server/include/nxcore_maps.h 2008-06-05 21:11:53 UTC (rev 3297)
+++ trunk/src/server/include/nxcore_maps.h 2008-06-05 22:42:22 UTC (rev 3298)
@@ -52,11 +52,9 @@
 protected:
    int m_nRefCount;
 
- virtual void CommonInit(void);
-
 public:
    nxMapSrv(DB_RESULT hResult, int nRow);
- nxMapSrv(DWORD dwMapId, DWORD dwObjectId, const TCHAR *pszName, const TCHAR *pszDescription) : nxMap(dwMapId, dwObjectId, pszName, pszDescription) { }
+ nxMapSrv(DWORD dwMapId, DWORD dwObjectId, const TCHAR *pszName, const TCHAR *pszDescription);
 
    DWORD SaveToDB(void);
    BOOL CheckUserRights(DWORD dwUserId, DWORD dwDesiredAccess);
Received on Fri Jun 06 2008 - 01:42:22 EEST

This archive was generated by hypermail 2.2.0 : Fri Jun 06 2008 - 01:39:40 EEST