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