diff --git a/views/default.handlebars b/views/default.handlebars
index 7f9f9869..70856a05 100644
--- a/views/default.handlebars
+++ b/views/default.handlebars
@@ -5717,26 +5717,55 @@
if (n.agent) { if ((GetNodeRights(n) & 24) == 24) { agenttype = true; } if ((n.agent.id > 0) && (n.agent.id < 5)) { wintype = true; } else { linuxtype = true; } }
}
if ((wintype == true) || (linuxtype == true) || (agenttype == true)) {
- var x = options.title + '
';
+ var x = '';
+ if (options.title) { x += options.title + '
'; }
x += '';
x += '';
- x += '';
+ x += '';
+ x += '
';
+ x += 'bb
';
setDialogMode(2, "Run Commands", 3, d2groupActionFunctionRunCommands, x, options);
Q('d2runcmd').focus();
- //QE('idx_dlgOkButton', true);
d2runCommandValidate();
}
}
- function d2runCommandValidate() { QV('d2cmduser', Q('d2cmdtype').value < 4); }
+ function d2runCommandValidate() {
+ QV('d2cmduser', Q('d2cmdtype').value < 4);
+ QV('d2runcmd', Q('d2cmdsource').value == 0);
+ QV('d2runfile', Q('d2cmdsource').value == 1);
+ QV('d2runsfile', Q('d2cmdsource').value == 2);
+ var ok = false;
+ if (Q('d2cmdsource').value == 0) { if (Q('d2runcmd').value.length > 0) { ok = true; } } // From text box
+ if (Q('d2cmdsource').value == 1) { if (Q('d2runfileex').files.length == 1) { ok = true; } } // From file
+ if (Q('d2cmdsource').value == 2) { ok = false; } // From server file
+ QE('idx_dlgOkButton', ok);
+ }
function d2groupActionFunctionRunCommands(b, options) {
var type = 3;
try { type = parseInt(Q('d2cmdtype').value); } catch (ex) { }
- meshserver.send({ action: 'runcommands', nodeids: options.nodeids, type: type, cmds: Q('d2runcmd').value, runAsUser: parseInt(Q('d2cmduser').value) });
- if (options.func) { options.func(); }
+ var cmd = { action: 'runcommands', nodeids: options.nodeids, type: type, runAsUser: parseInt(Q('d2cmduser').value) };
+ if (Q('d2cmdsource').value == 0) {
+ // From text box
+ cmd.cmds = Q('d2runcmd').value;
+ meshserver.send(cmd);
+ if (options.func) { options.func(); }
+ }
+ if (Q('d2cmdsource').value == 1) {
+ // From file
+ var reader = new FileReader();
+ reader.onload = function (e) { cmd.cmds = e.target.result; meshserver.send(cmd); if (options.func) { options.func(); } }
+ reader.readAsText(Q('d2runfileex').files[0]);
+ }
+ if (Q('d2cmdsource').value == 2) {
+ // From server file
+ cmd.cmds = '';
+ }
}
function onSortSelectChange(skipsave) {
@@ -7179,7 +7208,7 @@
if (((meshrights & (4 + 8 + 64 + 262144)) != 0) && (node.mtype < 3) && ((node.agent == null) || (node.agent.id != 34))) { x += ''; }
x += '';
x += '';
- if ((node.mtype == 2) && (connectivity & 1) && (meshrights == 0xFFFFFFFF)) { x += ''; }
+ if ((node.mtype == 2) && (connectivity & 1) && ((meshrights & 131072) != 0)) { x += ''; }
if (node.mtype != 4) {
if ((meshrights & 8) && ((connectivity & 1) || ((node.pmt == 1) && ((features2 & 2) != 0)))) { x += ''; }
//if ((connectivity & 1) && (meshrights & 8) && (node.agent.id < 5)) { x += ''; }
@@ -7639,10 +7668,7 @@
}
// Run commands on current device
- function runDeviceCmd(nodeid) {
- if (xxdialogMode) return;
- d2runCommandDialog({ nodeids: [ decodeURIComponent(nodeid) ], title: "Run commands on this device." });
- }
+ function runDeviceCmd(nodeid) { if (xxdialogMode) return; d2runCommandDialog({ nodeids: [ decodeURIComponent(nodeid) ] }); }
function writeDeviceEvent(nodeid) {
if (xxdialogMode) return;