Fix up action commands for Ibays and correct groups link

This commit is contained in:
Brian Read 2024-12-16 13:26:19 +00:00
parent 55269fd685
commit dfda47882d
2 changed files with 53 additions and 24 deletions

View File

@ -50,9 +50,9 @@
%= t td => (class => 'sme-border') => $_->{'MACAddress'}; %= t td => (class => 'sme-border') => $_->{'MACAddress'};
%= t td => (class => 'sme-border') => $_->{'Comment'}; %= t td => (class => 'sme-border') => $_->{'Comment'};
<td class='sme-border' style="min-width:15em"> <td class='sme-border' style="min-width:15em">
% my ($actionModify, $actionRemove) = '&nbsp;'; %my ($actionModify, $actionRemove) = '&nbsp;';
%my $static = $_->{'static'} || "no"; %my $static = $_->{'static'} || "no";
% if ($static ne 'yes') { %if ($static ne 'yes') {
%my $modify_text = l('MODIFY'); # Localized text %my $modify_text = l('MODIFY'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security %my $csrf_token = "TOKEN"; # CSRF token for security
%my $hostentries_name = $_->{'HostName'}; # hostentries name extracted from the data structure %my $hostentries_name = $_->{'HostName'}; # hostentries name extracted from the data structure
@ -71,7 +71,7 @@
% $remove_text % $remove_text
% </button> % </button>
%}; %};
% } %}
<%= $c->render_to_string(inline => $actionModify) %> <%= $c->render_to_string(inline => $actionRemove) %> <%= $c->render_to_string(inline => $actionModify) %> <%= $c->render_to_string(inline => $actionRemove) %>
</td> </td>
</tr> </tr>

View File

@ -46,33 +46,62 @@
<tr> <tr>
%= t td => (class => 'sme-border') => $ibay->key %= t td => (class => 'sme-border') => $ibay->key
%= t td => (class => 'sme-border') => $ibay->prop('Name') %= t td => (class => 'sme-border') => $ibay->prop('Name')
% my ($actionModify, $actionResetPw, $actionRemove) = '&nbsp;'; <td class='sme-border' style="min-width:15em">
% if ($modifiable eq 'yes') { %my ($actionModify, $actionResetPw, $actionRemove) = '&nbsp;';
% $actionModify = "<a href='ibaysd?CsrfDef=TOKEN&trt=UPD&ibay=" . $ibay->key . "'>" . "<button class='sme-modify-button' title=".l('MODIFY').">".l('MODIFY')."</button>" . "</a>"; %if ($modifiable eq 'yes') {
% } %my $modify_text = l('MODIFY'); # Localized text
% if ($passwordable eq 'yes') { %my $csrf_token = "TOKEN"; # CSRF token for security
% if ($ibay->prop('PasswordSet') ne 'yes' && $needPassword) { %my $ibays_entry_name = $ibay->key; # ibays_entry name extracted from the data structure
%# $actionResetPw .= "<a href='ibaysd?CsrfDef=TOKEN&trt=PWD&ibay=" . $ibay->key . "' class='error'>" . l('PASSWORD_RESET') . "</a>"; %$actionModify = qq{
% $actionResetPw .= "<a href='ibaysd?CsrfDef=TOKEN&trt=PWD&ibay=" . $ibay->key. "'>" . "<button class='sme-password-button' style ='border-color:red;' title=".l("Reset-Password").">".l("Reset-Password")."</button></a>"; % <button type='button' class='sme-modify-button' title='$modify_text'
% } else { % onclick="window.location.href='ibaysd?CsrfDef=$csrf_token&trt=UPD&ibay=$ibays_entry_name'">
% $actionResetPw .= "<a href='ibaysd?CsrfDef=TOKEN&trt=PWD&ibay=" . $ibay->key . "'>" . "<button class='sme-password-button' title=".l("Reset-Password").">".l("Reset-Password")."</button></a>"; % $modify_text
%# $actionResetPw .= "<a href='ibaysd?CsrfDef=TOKEN&trt=PWD&ibay=" . $ibay->key . "'>" . l('PASSWORD_RESET') . "</a>"; % </button>
% } %};
% $actionResetPw .= '&nbsp'; %}
% }
% if ($removable eq 'yes') { %if ($passwordable eq 'yes') {
% $actionRemove = "<a href='ibaysd?CsrfDef=TOKEN&trt=DEL&ibay=" . $ibay->key . "'>" . "<button class='sme-remove-button' title=".l('REMOVE').">".l('REMOVE')."</button>" . "</a>"; %my $password_text = l('PASSWORD_RESET'); # Localized text
% } %my $csrf_token = "TOKEN"; # CSRF token for security
<td class='sme-border' style="min-width:20em"> %my $ibays_entry_name = $ibay->key; # ibays_entry name extracted from the data structure
%if ($ibay->prop('PasswordSet') ne 'yes' && $needPassword) {
%$actionResetPw = qq{
% <button type='button' class='sme-password-button unset' title="$password_text - currently unset" style = background:pink;
% onclick="window.location.href='ibaysd?CsrfDef=$csrf_token&trt=PWD&ibay=$ibays_entry_name'">
% $password_text
% </button>
%};
%} else {
%$actionResetPw = qq{
% <button type='button' class='sme-password-button' title='$password_text'
% onclick="window.location.href='ibaysd?CsrfDef=$csrf_token&trt=PWD&ibay=$ibays_entry_name'">
% $password_text
% </button>
%};
%}
%}
%if ($removable eq 'yes') {
%my $remove_text = l('REMOVE'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $ibays_entry_name = $ibay->key; # ibays_entry name extracted from the data structure
%$actionRemove = qq{
% <button type='button' class='sme-remove-button' title='$remove_text'
% onclick="window.location.href='ibaysd?CsrfDef=$csrf_token&trt=DEL&ibays=$ibays_entry_name'">
% $remove_text
% </button>
%};
%}
<%= $c->render_to_string(inline => $actionModify) %> <%= $c->render_to_string(inline => $actionModify) %>
<%= $c->render_to_string(inline => $actionResetPw)%> <%= $c->render_to_string(inline => $actionResetPw)%>
<%= $c->render_to_string(inline => $actionRemove) %> <%= $c->render_to_string(inline => $actionRemove) %>
</td> </td>
</tr> </tr>
% } % }
</tbody> </tbody>
</table> </table>
<%} %> <%} %>
</div> </div>