Fix up action commands for pseudonyms and quota

This commit is contained in:
Brian Read 2024-12-16 16:15:03 +00:00
parent 34e7331845
commit ff9a84dd29
3 changed files with 43 additions and 17 deletions

View File

@ -54,19 +54,35 @@
%= t td => (class => 'sme-border') => $pseudonym->key %= t td => (class => 'sme-border') => $pseudonym->key
%= t td => (class => 'sme-border') => $account %= t td => (class => 'sme-border') => $account
% my ($actionModify, $actionRemove) = '&nbsp;'; <td class='sme-border'>
% if ($modifiable eq 'yes') { %my ($actionModify, $actionRemove) = '&nbsp;';
% $actionModify = "<a href='pseudonyms2?CsrfDef=TOKEN&trt=UPD&pseudonym=" . $pseudonym->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 ($removable eq 'yes') { %my $csrf_token = "TOKEN"; # CSRF token for security
% $actionRemove = "<a href='pseudonyms2?CsrfDef=TOKEN&trt=DEL&pseudonym=" . $pseudonym->key . "'>" . "<button class='sme-remove-button' title=".l('REMOVE').">".l('REMOVE')."</button>" . "</a>"; %my $pseudonyms_entry_name = $pseudonym->key; # pseudonyms_entry name extracted from the data structure
% } %$actionModify = qq{
% <button type='button' class='sme-modify-button' title='$modify_text'
% onclick="window.location.href='pseudonyms2?CsrfDef=$csrf_token&trt=UPD&pseudonym=$pseudonyms_entry_name'">
% $modify_text
% </button>
%};
%}
<td class='sme-border' style="min-width:15em"> %if ($removable eq 'yes') {
<%= $c->render_to_string(inline => $actionModify) %>&nbsp;<%= $c->render_to_string(inline => $actionRemove) %> %my $remove_text = l('REMOVE'); # Localized text
</td> %my $csrf_token = "TOKEN"; # CSRF token for security
</tr> %my $pseudonyms_entry_name = $pseudonym->key; # pseudonyms_entry name extracted from the data structure
%$actionRemove = qq{
% <button type='button' class='sme-remove-button' title='$remove_text'
% onclick="window.location.href='pseudonyms2?CsrfDef=$csrf_token&trt=DEL&pseudonym=$pseudonyms_entry_name'">
% $remove_text
% </button>
%};
%}
<%= $c->render_to_string(inline => $actionModify) %> <%= $c->render_to_string(inline => $actionRemove) %>
</td>
</tr>
% } % }
</tbody> </tbody>
</table> </table>
@ -75,5 +91,4 @@
</div> </div>

View File

@ -57,7 +57,18 @@
%= t td => (class => 'sme-border') => sprintf("%.2f", $bs / 1024 ) %= t td => (class => 'sme-border') => sprintf("%.2f", $bs / 1024 )
%= t td => (class => 'sme-border') => sprintf("%.2f", $bh / 1024 ) %= t td => (class => 'sme-border') => sprintf("%.2f", $bh / 1024 )
%= t td => (class => 'sme-border') => sprintf("%.2f", $bc / 1024 ) %= t td => (class => 'sme-border') => sprintf("%.2f", $bc / 1024 )
<td class='sme-border'><a href="quotad?CsrfDef=TOKEN&trt=UPD&user=<%= $user->key%>"><button class='sme-modify-button' title="<%=l('MODIFY')%>"><%=l('MODIFY') %></button></a></td> <td class='sme-border'>
%my $modify_text = l('MODIFY'); # Localized text
%my $csrf_token = "TOKEN"; # CSRF token for security
%my $quota_user_name = $user->key; # quotas_entry name extracted from the data structure
%my $actionModify = qq{
% <button type='button' class='sme-modify-button' title='$modify_text'
% onclick="window.location.href='quotad?CsrfDef=$csrf_token&trt=UPD&user=$quota_user_name'">
% $modify_text
% </button>
%};
<%= $c->render_to_string(inline => $actionModify) %>
</td>
</tr> </tr>
% } % }
</tbody> </tbody>
@ -67,4 +78,4 @@
%= hidden_field 'trt' => $quo_datas->{trt} %= hidden_field 'trt' => $quo_datas->{trt}
</div> </div>

View File

@ -37,7 +37,7 @@
%= $ic %= $ic
%=l 'quo_FILES' %=l 'quo_FILES'
%=l 'quo_OCCUPYING' %=l 'quo_OCCUPYING'
%= $bc %= $c->toMB($bc)
%=l 'quo_MEGABYTES' %=l 'quo_MEGABYTES'
</p> </p>
@ -81,4 +81,4 @@
% end % end
</div> </div>