--- "a/C:\\Users\\VS2005\\AppData\\Local\\Temp\\TortoiseGit\\ses76AB.tmp\\session-b45e65c-left.cpp"
+++ "b/C:\\Code\\netxms-v1.2.16\\src\\server\\core\\session.cpp"
@@ -7269,7 +7269,15 @@ void ClientSession::executeAction(CSCPMessage *pRequest)
if (pConn != NULL)
{
pRequest->GetVariableStr(VID_ACTION_NAME, szAction, MAX_PARAM_NAME);
- dwResult = pConn->execAction(szAction, 0, NULL);
+ int argc = pRequest->getFieldAsInt32(VID_NUM_ARGS);
+ TCHAR **argv = new TCHAR*[argc];
+ for (int i = 0; i < argc; i++)
+ {
+ argv[i] = new TCHAR[256];
+ pRequest->GetVariableStr(VID_ACTION_ARG_BASE + i, argv[i], 256);
+ }
+ dwResult = pConn->execAction(szAction, argc, argv);
+ free(argv);
switch(dwResult)
{
--- "a/C:\\Users\\VS2005\\AppData\\Local\\Temp\\TortoiseGit\\NXC2518.tmp\\NXCSession-b45e65c-left.java"
+++ "b/C:\\Code\\netxms-v1.2.16\\src\\java\\netxms-client\\src\\main\\java\\org\\netxms\\client\\NXCSession.java"
@@ -4408,14 +4408,21 @@ public NetworkMapPage queryLayer2Topology(final long nodeId) throws IOException,
*
* @param nodeId Node object ID
* @param action Action name
+ * @param args Action arguments
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
- public void executeAction(final long nodeId, final String action) throws IOException, NXCException
+ public void executeAction(final long nodeId, final String action, String[] args) throws IOException, NXCException
{
NXCPMessage msg = newMessage(NXCPCodes.CMD_EXECUTE_ACTION);
msg.setVariableInt32(NXCPCodes.VID_OBJECT_ID, (int) nodeId);
msg.setVariable(NXCPCodes.VID_ACTION_NAME, action);
+ if (args != null)
+ {
+ msg.setVariableInt32(NXCPCodes.VID_NUM_ARGS, args.length);
+ for (int i=0; i<args.length; i++)
+ msg.setVariable(NXCPCodes.VID_ACTION_ARG_BASE + i, args[i]);
+ }
sendMessage(msg);
waitForRCC(msg.getMessageId());
}
--- "a/C:\\Users\\VS2005\\AppData\\Local\\Temp\\TortoiseGit\\Obj1C3B.tmp\\ObjectToolExecutor-b45e65c-left.java"
+++ "b/C:\\Code\\netxms-v1.2.16\\src\\java\\netxms-eclipse\\ObjectTools\\src\\org\\netxms\\ui\\eclipse\\objecttools\\api\\ObjectToolExecutor.java"
@@ -173,8 +173,30 @@ private static void executeTableTool(final NodeInfo node, final ObjectTool tool)
*/
private static void executeAgentAction(final NodeInfo node, final ObjectTool tool)
{
- final NXCSession session = (NXCSession)ConsoleSharedData.getSession();
- final String action = substituteMacros(tool.getData(), node);
+ final NXCSession session = (NXCSession)ConsoleSharedData.getSession();
+ String _action = substituteMacros(tool.getData(), node);
+
+ if (_action.endsWith("(*)"))
+ {
+ InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+ Messages.get().ObjectToolsDynamicMenu_Information, "Parameter", "", null); //$NON-NLS-1$
+ if (dlg.open() != Window.OK)
+ return;
+
+ _action = _action.replace("(*)", "(" + dlg.getValue() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+
+ String[] _args = null;
+ if (_action.indexOf('(') > 0)
+ {
+ String a = _action.substring(_action.indexOf('(') + 1, _action.length() - 1);
+ _args = a.split(",");
+ for (int i = 0; i < _args.length; i++) _args[i] = _args[i].trim();
+ _action = _action.substring(0, _action.indexOf('(') + 1) + "*)";
+ }
+ final String action = _action;
+ final String[] args = _args;
+
new ConsoleJob(String.format(Messages.get().ObjectToolsDynamicMenu_ExecuteOnNode, node.object.getObjectName()), null, Activator.PLUGIN_ID, null) {
@Override
protected String getErrorMessage()
@@ -185,7 +207,7 @@ protected String getErrorMessage()
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception
{
- session.executeAction(node.object.getObjectId(), action);
+ session.executeAction(node.object.getObjectId(), action, args);
runInUIThread(new Runnable() {
@Override
public void run()