mirror of
https://github.com/webmin/webmin.git
synced 2025-07-25 01:23:45 +00:00
Add option to redirect to form
This commit is contained in:
@ -83,11 +83,13 @@ print &ui_table_row(&hlink($text{'edit_clear'},"clear"),
|
||||
|
||||
# Output format
|
||||
$fmode = $cmd->{'format'} eq 'redirect' ? 2 :
|
||||
$cmd->{'format'} eq 'form' ? 3 :
|
||||
$cmd->{'format'} ? 1 : 0;
|
||||
print &ui_table_row(&hlink($text{'edit_format'}, "format"),
|
||||
&ui_radio("format_def", $fmode,
|
||||
[ [ 0, $text{'edit_format0'} ],
|
||||
[ 2, $text{'edit_format2'} ],
|
||||
[ 3, $text{'edit_format3'} ],
|
||||
[ 1, $text{'edit_format1'}." ".
|
||||
&ui_textbox("format",
|
||||
$fmode == 1 ? $cmd->{'format'} : "", 20) ] ]));
|
||||
|
@ -61,6 +61,7 @@ edit_format=Output style
|
||||
edit_format0=Show in Webmin UI
|
||||
edit_format1=Output with MIME type
|
||||
edit_format2=Redirect to index
|
||||
edit_format3=Redirect to form
|
||||
edit_servers=Run on Webmin servers
|
||||
edit_this=this server
|
||||
edit_clone=Clone
|
||||
|
@ -34,7 +34,7 @@ else {
|
||||
@servers = &list_servers();
|
||||
|
||||
# Run and display output
|
||||
if ($cmd->{'format'} ne 'redirect') {
|
||||
if ($cmd->{'format'} ne 'redirect' && $cmd->{'format'} ne 'form') {
|
||||
if ($cmd->{'format'}) {
|
||||
print "Content-type: ",$cmd->{'format'},"\n";
|
||||
print "\n";
|
||||
@ -64,7 +64,8 @@ foreach $h (@hosts) {
|
||||
# Run locally
|
||||
($got, $out, $timeout) = &execute_custom_command(
|
||||
$cmd, $env, $export, $str,
|
||||
$cmd->{'format'} ne 'redirect');
|
||||
$cmd->{'format'} ne 'redirect' &&
|
||||
$cmd->{'format'} ne 'form');
|
||||
}
|
||||
else {
|
||||
# Remote foreign call
|
||||
@ -81,7 +82,8 @@ foreach $h (@hosts) {
|
||||
&additional_log('exec', undef, $displaystr);
|
||||
}
|
||||
if (!$remote_custom_error) {
|
||||
print $out if ($h != 0 && $cmd->{'format'} ne 'redirect');
|
||||
print $out if ($h != 0 && $cmd->{'format'} ne 'redirect' &&
|
||||
$cmd->{'format'} ne 'form');
|
||||
if (!$got && !$cmd->{'format'}) {
|
||||
print "<i>$text{'run_noout'}</i>\n";
|
||||
}
|
||||
@ -115,6 +117,9 @@ if (!$cmd->{'format'}) {
|
||||
elsif ($cmd->{'format'} eq 'redirect') {
|
||||
&redirect("");
|
||||
}
|
||||
elsif ($cmd->{'format'} eq 'form') {
|
||||
&redirect("form.cgi?id=".$in{'id'}."&idx=".$in{'idx'});
|
||||
}
|
||||
|
||||
sub remote_custom_handler
|
||||
{
|
||||
|
@ -62,6 +62,9 @@ else {
|
||||
elsif ($in{'format_def'} == 2) {
|
||||
$cmd->{'format'} = 'redirect';
|
||||
}
|
||||
elsif ($in{'format_def'} == 3) {
|
||||
$cmd->{'format'} = 'form';
|
||||
}
|
||||
else {
|
||||
$in{'format'} =~ /^[a-z0-9\.\_\-]+\/[a-z0-9\.\_\-]+/i ||
|
||||
&error($text{'save_eformat'});
|
||||
|
Reference in New Issue
Block a user