diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-25 16:57:04 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-25 16:57:04 +0000 |
commit | 4da61dfe0faaeff7470ed7de7a0d656ff5dcd0b6 (patch) | |
tree | b14ff1c980f290b38b9cd7e5ce5588cf4ce5d04e /bin | |
parent | b76b9b5f62567fc10377ef2be47972f79f1a2147 (diff) |
Change forms that use class confirm to template
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1820 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'bin')
-rw-r--r-- | bin/jc.pl | 107 |
1 files changed, 50 insertions, 57 deletions
@@ -1217,45 +1217,42 @@ sub print_and_save_as_new { sub resave { + my %hiddens; + my @buttons; if ( $form->{print_and_save} ) { $form->{nextsub} = "print_and_save"; + @buttons = ({ + name => 'action', + value => 'print_and_save', + text => $locale->text('Print and Save Transaction'), + }); $msg = $locale->text('You are printing and saving an existing transaction!'); } else { $form->{nextsub} = "save"; + @buttons = ({ + name => 'action', + value => 'save', + text => $locale->text('Save Transaction'), + }); $msg = $locale->text('You are saving an existing transaction!'); } - $form->{resave} = 1; - - $form->header; - - print qq| -<body> - -<form method=post action=$form->{script}> - -|; - delete $form->{action}; - - $form->hide_form; - - print qq| -<h2 class=confirm>| . $locale->text('Warning!') . qq|</h2> - -<h4>$msg</h4> - -<button name="action" class="submit" type="submit" value="continue">| - . $locale->text('Continue') - . qq|</button> -</form> - -</body> -</html> -|; - + $hiddens{$_} = $form->{$_} foreach keys %$form; + $hiddens{resave} = 1; + $form->{title} = $locale->text('Warning!'); + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'form-confirmation'); + $template->render({ + form => $form, + buttons => \@buttons, + hiddens => \%hiddens, + query => $msg, + }); } sub print_and_save { @@ -1283,39 +1280,35 @@ sub print_and_save { sub delete_timecard { - $form->header; - - $employee = $form->{employee}; + my $employee = $form->{employee}; $employee =~ s/--.*//g; - $projectnumber = $form->{projectnumber}; + my $projectnumber = $form->{projectnumber}; $projectnumber =~ s/--.*//g; - print qq| -<body> - -<form method=post action=$form->{script}> -|; - delete $form->{action}; - - $form->hide_form; - - print qq| -<h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2> - -<h4>| . $locale->text('Are you sure you want to delete time card for') . qq| -<p>$form->{transdate} -<br>$employee -<br>$projectnumber -</h4> - -<p> -<button name="action" class="submit" type="submit" value="yes">| - . $locale->text('Yes') - . qq|</button> -</form> -|; - + $form->{title} = $locale->text('Confirm!'); + + my %hiddens; + $hiddens{$_} = $form->{$_} foreach keys %$form; + my @buttons = ({ + name => 'action', + value => 'yes_delete_timecard', + text => $locale->text('Delete Timecard'), + }); + my $template = LedgerSMB::Template->new_UI( + user => \%myconfig, + locale => $locale, + template => 'form-confirmation'); + $template->render({ + form => $form, + buttons => \@buttons, + hiddens => \%hiddens, + query => $locale->text( + 'Are you sure you want to delete time card for [_1] [_2] [_3]', + $form->{transdate}, + $employee, + $projectnumber), + }); } sub delete { &{"delete_$form->{type}"} } |