From 077ac32635dc0048a684ee0a40345a262e661ecc Mon Sep 17 00:00:00 2001 From: t123yh Date: Wed, 3 Aug 2016 18:19:04 +0800 Subject: luci-app-commands: Allow executing without downloading on public links Signed-off-by: t123yh --- .../luci-app-commands/luasrc/view/commands.htm | 15 ++++--- .../luasrc/view/commands_public.htm | 50 ++++++++++++++++++++++ 2 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 applications/luci-app-commands/luasrc/view/commands_public.htm (limited to 'applications/luci-app-commands/luasrc/view') diff --git a/applications/luci-app-commands/luasrc/view/commands.htm b/applications/luci-app-commands/luasrc/view/commands.htm index 73b9e6a2ce..f094e186d4 100644 --- a/applications/luci-app-commands/luasrc/view/commands.htm +++ b/applications/luci-app-commands/luasrc/view/commands.htm @@ -108,16 +108,19 @@ if (legend && output) { - var link = location.protocol + '//' + location.hostname + + var prefix = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : '') + - location.pathname.split(';')[0] + 'command/' + - id + (args ? '/' + args : ''); - + location.pathname.split(';')[0] + 'command/'; + var suffix = (args ? '/' + args : ''); + + var link = prefix + id + suffix; + var link_nodownload = prefix + id + "s" + suffix; + legend.style.display = 'none'; output.parentNode.style.display = 'block'; output.innerHTML = String.format( - '
<%:Access command with%> %s
', - link, link + '

<%:Download execution result%> %s

<%:Or display result%> %s

', + link, link, link_nodownload, link_nodownload ); location.hash = '#output'; diff --git a/applications/luci-app-commands/luasrc/view/commands_public.htm b/applications/luci-app-commands/luasrc/view/commands_public.htm new file mode 100644 index 0000000000..f20799d40f --- /dev/null +++ b/applications/luci-app-commands/luasrc/view/commands_public.htm @@ -0,0 +1,50 @@ +<%# + Copyright 2016 t123yh + Licensed to the public under the Apache License 2.0. +-%> + +<% css = [[ +.alert-success { + color: #3c763d; + background-color: #dff0d8; + border-color: #d6e9c6; +} + +.alert { + padding: 15px; + margin-bottom: 20px; + border: 1px solid transparent; + border-radius: 4px; +} + +.alert-warning { + color: #8a6d3b; + background-color: #fcf8e3; + border-color: #faebcc; +} +]] -%> + +<%+header%> + +<% if exitcode == 0 then %> + +<% else %> + +<% end %> + +<% if stdout ~= "" then %> +

<%:Standard Output%>

+
<%= stdout %>
+<% end %> + +<% if stderr ~= "" then %> +

<%:Standard Error%>

+
<%= stderr %>
+<% end %> + + + +<%+footer%> \ No newline at end of file -- cgit v1.2.3