Skip to content

Commit

Permalink
fix: [toolbox] Replace 'Cancel' button by 'Go back to list' to clarif…
Browse files Browse the repository at this point in the history
…y its real purpose
  • Loading branch information
g-bougard committed Oct 18, 2023
1 parent 53fc5d9 commit 3feb6b2
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 23 deletions.
6 changes: 2 additions & 4 deletions lib/GLPI/Agent/HTTP/Server/ToolBox/Credentials.pm
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,10 @@ sub _used_credentials {
return join(",", sort values(%used));
}

sub _submit_cancel {
sub _submit_back_to_list {
my ($self, $form) = @_;
$self->reset_edit();
delete $form->{empty};
# Select snmp version list from current selected snmp version
$form->{snmpversion} = delete $form->{'input/snmpversion'};
}

my %handlers = (
Expand All @@ -434,7 +432,7 @@ my %handlers = (
'submit/delete-v1-v2c' => \&_submit_delete_v1_v2c,
'submit/delete-v3' => \&_submit_delete_v3,
'submit/delete-remote' => \&_submit_delete_remotes,
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
);

sub handle_form {
Expand Down
4 changes: 2 additions & 2 deletions lib/GLPI/Agent/HTTP/Server/ToolBox/Inventory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ sub update_template_hash {

my %handlers = (
'submit/add' => \&_submit_add,
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
'submit/update' => \&_submit_update,
'submit/delete' => \&_submit_delete,
'submit/add-iprange' => \&_submit_addiprange,
Expand Down Expand Up @@ -281,7 +281,7 @@ sub _submit_newtag {
$self->need_save(jobs);
}

sub _submit_cancel {
sub _submit_back_to_list {
my ($self, $form) = @_;

return unless $form;
Expand Down
4 changes: 2 additions & 2 deletions lib/GLPI/Agent/HTTP/Server/ToolBox/IpRange.pm
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ sub _submit_rmcredential {
}
}

sub _submit_cancel {
sub _submit_back_to_list {
my ($self, $form) = @_;
$self->reset_edit();
delete $form->{empty};
Expand All @@ -417,7 +417,7 @@ my %handlers = (
'submit/delete' => \&_submit_delete,
'submit/addcredential' => \&_submit_addcredential,
'submit/rmcredential' => \&_submit_rmcredential,
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
);

sub handle_form {
Expand Down
10 changes: 5 additions & 5 deletions lib/GLPI/Agent/HTTP/Server/ToolBox/MibSupport.pm
Original file line number Diff line number Diff line change
Expand Up @@ -129,29 +129,29 @@ sub update_template_hash {

my %handlers = (
aliases => {
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
'submit/add/alias' => \&_submit_add_alias,
'submit/update/alias' => \&_submit_update_alias,
'submit/delete' => \&_submit_delete,
},
sysobjectid => {
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
'submit/add/sysobjectid' => \&_submit_add_sysobjectid,
'submit/update/sysobjectid' => \&_submit_update_sysobjectid,
'submit/delete' => \&_submit_delete,
'submit/add/rule' => \&_submit_add_rule_in_ruleset,
'submit/del/rule' => \&_submit_del_rule_in_ruleset,
},
sysorid => {
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
'submit/add/sysorid' => \&_submit_add_sysorid,
'submit/update/sysorid' => \&_submit_update_sysorid,
'submit/delete' => \&_submit_delete,
'submit/add/rule' => \&_submit_add_rule_in_ruleset,
'submit/del/rule' => \&_submit_del_rule_in_ruleset,
},
rules => {
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
'submit/add/rule' => \&_submit_add_rule,
'submit/update/rule' => \&_submit_update_rule,
'submit/delete' => \&_submit_delete,
Expand Down Expand Up @@ -186,7 +186,7 @@ sub handle_form {
}
}

sub _submit_cancel {
sub _submit_back_to_list {
my ($self) = @_;
$self->reset_edit();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/GLPI/Agent/HTTP/Server/ToolBox/Remotes.pm
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ sub _submit_start {
$agent->fork_exit();
}

sub _submit_cancel {
sub _submit_back_to_list {
my ($self, $form) = @_;
delete $form->{empty};
$self->reset_edit();
Expand All @@ -391,7 +391,7 @@ my %admin_handlers = (
'submit/add-remote' => \&_submit_add,
'submit/update-remote' => \&_submit_update,
'submit/delete-remote' => \&_submit_delete,
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
);

my %handlers = (
Expand Down
4 changes: 2 additions & 2 deletions lib/GLPI/Agent/HTTP/Server/ToolBox/Scheduling.pm
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ sub _submit_delete {
}
}

sub _submit_cancel {
sub _submit_back_to_list {
my ($self, $form) = @_;
$self->reset_edit();
delete $form->{empty};
Expand All @@ -336,7 +336,7 @@ my %handlers = (
'submit/add' => \&_submit_add,
'submit/update' => \&_submit_update,
'submit/delete' => \&_submit_delete,
'submit/cancel' => \&_submit_cancel,
'submit/back-to-list' => \&_submit_back_to_list,
);

sub handle_form {
Expand Down
1 change: 1 addition & 0 deletions share/html/toolbox/common-language-en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Add:
Name:
Description:
Cancel:
Go back to list:

Reset:
Reverse selection:
Expand Down
1 change: 1 addition & 0 deletions share/html/toolbox/common-language-fr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Add: Ajouter
Name: Nom

Cancel: Annuler
Go back to list: Retourner à la liste

Reset: Vider
Reverse selection: Inverser la sélection
Expand Down
2 changes: 1 addition & 1 deletion share/html/toolbox/credentials-edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
$credentials{$edit} ?
"update' alt='"._("Update") :
"add' alt='"._("Create Credential")}' value='1'><i class='primary ti ti-device-floppy'></i>{ $credentials{$edit} ? _("Update") : _("Create Credential") }</button>
<button type='submit' class='big-button secondary-button' name='submit/cancel' formnovalidate='1' value='1' alt='{_("Cancel")}'><i class='primary ti ti-x'></i>{_("Cancel")}</button>
<button type='submit' class='big-button secondary-button' name='submit/back-to-list' formnovalidate='1' value='1' alt='{_("Go back to list")}'><i class='primary ti ti-x'></i>{_("Go back to list")}</button>
</form>
<script>
function version_change() \{
Expand Down
2 changes: 1 addition & 1 deletion share/html/toolbox/inventory-edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
$jobs{$edit} ?
"update' alt='"._("Update") :
"add' alt='"._("Create inventory task")}'><i class='primary ti ti-device-floppy'></i>{$jobs{$edit} ? _("Update") : _("Create inventory task")}</button>
<button type='submit' class='big-button secondary-button' name='submit/cancel' formnovalidate='1' alt='{_("Cancel")}'><i class='primary ti ti-x'></i>{_("Cancel")}</button>
<button type='submit' class='big-button secondary-button' name='submit/back-to-list' formnovalidate='1' alt='{_("Go back to list")}'><i class='primary ti ti-x'></i>{_("Go back to list")}</button>
</form>
<script>
function jobtype_change() \{
Expand Down
2 changes: 1 addition & 1 deletion share/html/toolbox/ip_range-edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@
$ip_range{$edit} ?
"update' alt='"._("Update") :
"add' alt='"._("Add") }'><i class='primary ti ti-device-floppy'></i>{ $ip_range{$edit} ? _("Update") : _("Add IP range") }</button>
<button type='submit' class='big-button secondary-button' name='submit/cancel' formnovalidate='1' value='1' alt='{_("Cancel")}'><i class='primary ti ti-x'></i>{_("Cancel")}</button>
<button type='submit' class='big-button secondary-button' name='submit/back-to-list' formnovalidate='1' value='1' alt='{_("Go back to list")}'><i class='primary ti ti-x'></i>{_("Go back to list")}</button>
</form>
2 changes: 1 addition & 1 deletion share/html/toolbox/mibsupport-edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
$OUT .= Text::Template::fill_in_file("$template_path/$tpl", HASH => $hash)
|| "Error loading $tpl template: $Text::Template::ERROR";
}}
<button type='submit' class='big-button secondary-button' name='submit/cancel' formnovalidate='1' value='1' alt='{_("Cancel")}'><i class='primary ti ti-x'></i>{_("Cancel")}</button>
<button type='submit' class='big-button secondary-button' name='submit/back-to-list' formnovalidate='1' value='1' alt='{_("Go back to list")}'><i class='primary ti ti-x'></i>{_("Go back to list")}</button>
</form>
2 changes: 1 addition & 1 deletion share/html/toolbox/remotes-edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
<button type='submit' class='big-button' name='submit/{ $remote ?
"update-remote' value='1' alt='"._("Update")."'><i class='primary ti ti-device-floppy'></i>"._("Update") :
"add-remote' value='1' alt='"._("Add")."'><i class='primary ti ti-plus'></i>"._("Add") }</button>
<button type='submit' class='big-button secondary-button' name='submit/cancel' formnovalidate='1' value='1' alt='{_("Cancel")}'><i class='primary ti ti-x'></i>{_("Cancel")}</button>
<button type='submit' class='big-button secondary-button' name='submit/back-to-list' formnovalidate='1' value='1' alt='{_("Go back to list")}'><i class='primary ti ti-x'></i>{_("Go back to list")}</button>
</form>
2 changes: 1 addition & 1 deletion share/html/toolbox/scheduling-edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
$scheduling{$edit} ?
"update' value='"._("Update") :
"add' value='"._("Add") }'><i class='primary ti ti-device-floppy'></i>{ $scheduling{$edit} ? _("Update") : _("Add") }</button>
<button type='submit' class='big-button secondary-button' name='submit/cancel' formnovalidate='1' value='1' alt='{_("Cancel")}'><i class='primary ti ti-x'></i>{_("Cancel")}</button>
<button type='submit' class='big-button secondary-button' name='submit/back-to-list' formnovalidate='1' value='1' alt='{_("Go back to list")}'><i class='primary ti ti-x'></i>{_("Go back to list")}</button>
</form>
<script>
function type_change() \{
Expand Down

0 comments on commit 3feb6b2

Please sign in to comment.