[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1763] trunk



Revision: 1763
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1763&view=rev
Author:   tetragon
Date:     2007-10-15 15:14:50 -0700 (Mon, 15 Oct 2007)

Log Message:
-----------
Add confirmation template
Rename yes in gl.pl

Modified Paths:
--------------
    trunk/bin/bp.pl
    trunk/bin/gl.pl

Added Paths:
-----------
    trunk/UI/form-confirmation.html

Added: trunk/UI/form-confirmation.html
===================================================================
--- trunk/UI/form-confirmation.html	                        (rev 0)
+++ trunk/UI/form-confirmation.html	2007-10-15 22:14:50 UTC (rev 1763)
@@ -0,0 +1,16 @@
+<?lsmb INCLUDE 'ui-header.html' ?> 
+<?lsmb PROCESS elements.html ?>
+<body>
+<form method="post" action="<?lsmb form.script ?>">
+<h2 class="confirm"><?lsmb form.title ?></h2>
+<h4><?lsmb query ?></h4>
+<?lsmb FOREACH hidden IN hiddens.keys;
+	PROCESS input element_data={
+		type => 'hidden',
+		name => hidden,
+		value => hiddens.item(hidden)
+		}; END ?>
+<?lsmb FOREACH button IN buttons; PROCESS button element_data=button; END ?>
+</form>
+</body>
+</html>

Modified: trunk/bin/bp.pl
===================================================================
--- trunk/bin/bp.pl	2007-10-15 21:56:56 UTC (rev 1762)
+++ trunk/bin/bp.pl	2007-10-15 22:14:50 UTC (rev 1763)
@@ -178,7 +178,8 @@
 
 sub remove {
 
-    $selected = 0;
+    my $selected = 0;
+    my %hiddens;
 
     for $i ( 1 .. $form->{rowcount} ) {
         if ( $form->{"checked_$i"} ) {
@@ -191,37 +192,31 @@
 
     $form->{title} = $locale->text('Confirm!');
 
-    $form->header;
-
-    print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
     for (qw(action header)) { delete $form->{$_} }
-
-    foreach $key ( keys %$form ) {
-        print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
+    foreach my $key ( keys %$form ) {
+        $hiddens{$key} = $form->{$key};
     }
 
-    print qq|
-<h2 class=confirm>$form->{title}</h2>
+    my $query = $locale->text(
+        'Are you sure you want to remove the marked entries from the queue?');
 
-<h4>|
-      . $locale->text(
-        'Are you sure you want to remove the marked entries from the queue?')
-      . qq|</h4>
+    my @buttons = ({
+        name => 'action',
+        value => 'remove_from_queue',
+        text => $locale->text('Yes'),
+    });
+    my $template = LedgerSMB::Template->new_UI(
+        user => \%myconfig, 
+        locale => $locale, 
+        template => 'form-confirmation',
+        );
+    $template->render({
+        form => $form,
+        query => $query,
+        hiddens => \%hiddens,
+        buttons => ..hidden..,
+    });
 
-<button name="action" class="submit" type="submit" value="remove_from_queue">|
-      . $locale->text('Yes')
-      . qq|</button>
-</form>
-
-</body>
-</html>
-|;
-
 }
 
 sub remove_from_queue {

Modified: trunk/bin/gl.pl
===================================================================
--- trunk/bin/gl.pl	2007-10-15 21:56:56 UTC (rev 1762)
+++ trunk/bin/gl.pl	2007-10-15 22:14:50 UTC (rev 1763)
@@ -51,6 +51,7 @@
 
 require "bin/arap.pl";
 
+$form->{login} = 'test';
 1;
 
 # end of main
@@ -1267,35 +1268,36 @@
 
 sub delete {
 
-    $form->header;
-
-    print qq|
-<body>
-
-<form method=post action=$form->{script}>
-|;
-
+    my %hiddens;
     delete $form->{action};
+    foreach (keys %$form) {
+        $hiddens{$_} = $form->{$_} unless ref $form->{$_};
+    }
 
-    $form->hide_form;
-
-    print qq|
-<h2 class=confirm>| . $locale->text('Confirm!') . qq|</h2>
-
-<h4>|
-      . $locale->text( 'Are you sure you want to delete Transaction [_1]',
+    $form->{title} = $locale->text('Confirm!');
+    my $query = $locale->text(
+        'Are you sure you want to delete Transaction [_1]',
         $form->{reference} )
-      . qq|</h4>
 
-<button name="action" class="submit" type="submit" value="yes">|
-      . $locale->text('Yes')
-      . qq|</button>
-</form>
-|;
-
+    my @buttons = ({
+        name => 'action',
+        value => 'delete_transaction',
+        text => $locale->text('Yes'),
+        });
+    my $template = LedgerSMB::Template->new_UI(
+        user => \%myconfig, 
+        locale => $locale, 
+        template => 'form-confirmation',
+        );
+    $template->render({
+        form => $form,
+        query => $query,
+        hiddens => \%hiddens,
+        buttons => ..hidden..,
+    });
 }
 
-sub yes {
+sub delete_transaction {
 
     if ( GL->delete_transaction( \%myconfig, \%$form ) ) {
         $form->redirect( $locale->text('Transaction deleted!') );


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.