Skip to content

Commit

Permalink
Remove edit_config feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikedas committed Oct 13, 2022
1 parent 19bccf0 commit 7bba859
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 96 deletions.
62 changes: 22 additions & 40 deletions default/web_tt2/edit_config.tt2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- edit_config.tt2 -->

<div class="block">
<h2>[%|loc%]Edit robot config[%END%]</h2><br />
<h2>[%|loc%]View domain config[%END%]</h2>
<div>
<ul>
[% FOREACH confparam IN editable_params %]
Expand Down Expand Up @@ -35,45 +35,27 @@
[% SET dark='1'%]
<tr class="color0">
[% END %]
<form action="[% path_cgi %]" method="post">
<td [% IF confparam.query ~%] data-tooltip aria-haspopup="true" title="[% confparam.query %]" [%~ END %]>
<strong>[% confparam.name %]</strong>
</td>
<td>
[% IF confparam.edit == '1' && removethistesttoenblefeature == '1' %]
<input type="text" name="conf_new_value" value="[% confparam.current_value %]" style="width:75%"/>
<input type="hidden" name="conf_parameter_name" value="[% confparam.name %]" />
<input class="MainMenuLinks" type="submit" name="action_edit_config" value="[%|loc%]Set[%END%]" style="width:20%" />
[% ELSE %]
[% UNLESS confparam.obfuscated == '1' %]
[% confparam.current_value %]
[% ELSE %]
[% confparam.current_value.replace('.','*') %]
[% END %]
[% END %]
</td>
<td>
[% IF confparam.vhost == '1' ~%]
[% IF confparam.edit == '1' && removethistesttoenblefeature == '1' %]
[%~ IF robots ~%]
<select name="robot">
[% FOREACH vr = robots ~%]
<option value="[% vr.key %]" [%~ IF vr.key == robot %] selected="selected" [% END ~%]>[% vr.key %]</option>
[% END %]
</select>
[%~ ELSE ~%]
<input type="hidden" name="robot" value="[% robot %]" />
[%~ robot %]
[%~ END %]
[%~ ELSE ~%]
[% robot %]
[%~ END %]
[%~ ELSE ~%]
[%|loc%]main conf[%END%]
[%~ END %]
</td>
<td>[% confparam.default %]</td>
</form>
<td [% IF confparam.query %]
data-tooltip aria-haspopup="true"
title="[% confparam.query %]"
[%~ END %]>
<strong>[% confparam.name %]</strong>
</td>
<td>
[% UNLESS confparam.obfuscated == '1' %]
[% confparam.current_value %]
[% ELSE %]
[% confparam.current_value.replace('.','*') %]
[% END %]
</td>
<td>
[% IF confparam.vhost == '1' ~%]
[% robot %]
[%~ ELSE ~%]
[%|loc%]main conf[%END%]
[%~ END %]
</td>
<td>[% confparam.default %]</td>
</tr>
[% SET close_table = '</table>' %]
[% END %]
Expand Down
8 changes: 6 additions & 2 deletions default/web_tt2/nav.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@
[% SET class = '' %]
[% END %]
<li class="[% class %]">
<a href="[% 'serveradmin/vhosts' | url_rel %]">[%|loc%]Virtual Robots[%END%]</a>
<a href="[% 'serveradmin/vhosts' | url_rel %]">
[%|loc%]Domains[%END%]
</a>
</li>
[%~ END %]
[% IF main_robot ~%]
Expand All @@ -116,7 +118,9 @@
[% SET class = '' %]
[% END %]
<li class="[% class %]">
<a href="[% 'edit_config' | url_rel %]">[%|loc%]Edit Robot Config[%END%]</a>
<a href="[% 'edit_config' | url_rel %]">
[%|loc%]View domain config[%END%]
</a>
</li>
[%~ END %]
[% IF families -%]
Expand Down
18 changes: 4 additions & 14 deletions default/web_tt2/serveradmin.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

[% IF main_robot %]
[% IF subaction == 'vhosts' %]
<h2>[%|loc%]Virtual Robots[%END%]</h2> <br />
<h2>[%|loc%]Domains[%END%]</h2> <br />
[% IF robots %]
<p>
[%|loc%]The following virtual robots are running on this server:[%END%]
[%|loc%]The following mail domains are running on this server:[%END%]
</p>
[% FOREACH vr = robots %]
<h4>
Expand Down Expand Up @@ -56,7 +56,7 @@
</ul>
[% END %]
[% ELSE %]
<p>[%|loc%]No Virtual Robot defined on this server[%END%]</p>
<p>[%|loc%]No additional mail domains defined on this server.[%END%]</p>
[% END %]
[% END %]
[% END %]
Expand Down Expand Up @@ -266,17 +266,7 @@
[% END %]
<td>[% confparam.name %]</td>
<td>
[% IF confparam.edit == '1' %]
<form action="[% path_cgi %]" method="post">
<fieldset>
<input type="text" name="new_value" value="[% confparam.current_value %]" style="width:75%"/>
<input type="hidden" name="conf_parameter_name" value="[% confparam.name %]" />
<input class="MainMenuLinks" type="submit" name="action_set_param" value="[%|loc%]Set[%END%]" style="width:20%" />
</fieldset>
</form>
[% ELSE %]
[% confparam.current_value %]
[% END %]
[% confparam.current_value %]
</td>
<td>[% confparam.default %]</td>
<td>[% confparam.query %]</td>
Expand Down
40 changes: 0 additions & 40 deletions src/cgi/wwsympa.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -5980,46 +5980,6 @@ sub do_edit_config {
}
}

if ($in{'conf_new_value'}) {
my $editable;
my $i;
foreach my $p (@$editable_params) {
next unless $p->{'name'};

# if the parameter is editable and if the is a change
next unless $p->{'name'} eq $in{'conf_parameter_name'};
unless ($p->{'edit'} and $p->{'edit'} eq '1') {
$log->syslog(
'err',
'Ignoring change of parameter %s (value %s) because not editable',
$in{'conf_parameter_name'},
$in{'conf_new_value'}
);
last;
}
if ($in{'conf_new_value'} eq $p->{'current_value'}) {
$log->syslog(
'notice',
'Ignoring change of parameter %s (value %s) because inchanged',
$in{'conf_parameter_name'},
$in{'conf_new_value'}
);
last;
} else {
$p->{'current_value'} = $in{'conf_new_value'};
Conf::set_robot_conf($robot, $in{'conf_parameter_name'},
$in{'conf_new_value'});
$log->syslog(
'notice',
'Setting parameter %s to value %s',
$in{'conf_parameter_name'},
$in{'conf_new_value'}
);
last;
}
}
}

$param->{'editable_params'} = $editable_params;
return 1;

Expand Down

0 comments on commit 7bba859

Please sign in to comment.