[freeside-commits] freeside/httemplate/browse payment_gateway.html, 1.5.2.1, 1.5.2.2
Ivan,,,
ivan at wavetail.420.am
Sat Mar 1 17:31:53 PST 2008
Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail.420.am:/tmp/cvs-serv16395/httemplate/browse
Modified Files:
Tag: FREESIDE_1_7_BRANCH
payment_gateway.html
Log Message:
add payment gateway disabling (and move payment gateway browse over to new template)
Index: payment_gateway.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/payment_gateway.html,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -d -r1.5.2.1 -r1.5.2.2
--- payment_gateway.html 13 Jan 2008 20:38:37 -0000 1.5.2.1
+++ payment_gateway.html 2 Mar 2008 01:31:51 -0000 1.5.2.2
@@ -1,79 +1,94 @@
-<% include("/elements/header.html",'Payment gateways', menubar(
- 'Agents' => $p. 'browse/agent.cgi',
-)) %>
+<% include( 'elements/browse.html',
+ 'title' => 'Payment gateways',
+ 'menubar' => [ 'Agents' => $p.'browse/agent.cgi', ],
+ 'html_init' => $html_init,
+ 'name' => 'payment gateways',
+ 'disableable' => 1,
+ 'disabled_statuspos' => 1,
+ 'query' => { 'table' => 'payment_gateway',
+ 'hashref' => {},
+ },
+ 'count_query' => $count_query,
+ 'header' => [ '#',
+ 'Gateway',
+ 'Username',
+ 'Password',
+ 'Action',
+ 'Options',
+ ],
+ 'fields' => [ 'gatewaynum',
+ $gateway_sub,
+ 'gateway_username',
+ sub { ' - '; },
+ 'gateway_action',
+ $options_sub,
+ ],
+ )
+%>
-<A HREF="<% $p %>edit/payment_gateway.html"><I>Add a new payment gateway</I></A><BR><BR>
+</TABLE>
-<% $cgi->param('showdisabled')
- ? do { $cgi->param('showdisabled', 0);
- '( <a href="'. $cgi->self_url. '">hide disabled gateways</a> )'; }
- : do { $cgi->param('showdisabled', 1);
- '( <a href="'. $cgi->self_url. '">show disabled gateways</a> )'; }
-%>
+<% include('/elements/footer.html') %>
+<%once>
-<% table() %>
-<TR>
- <TH COLSPAN=<% $cgi->param('showdisabled') ? 1 : 2 %>>#</TH>
- <TH>Gateway</TH>
- <TH>Username</TH>
- <TH>Password</TH>
- <TH>Action</TH>
- <TH>Options</TH>
-</TR>
-% foreach my $payment_gateway ( qsearch( 'payment_gateway', \%search ) ) {
+my $html_init = qq!
+ <A HREF="${p}edit/payment_gateway.html"><I>Add a new payment gateway</I></A>
+ <BR><BR>
+ <SCRIPT>
+ function areyousure(href) {
+ if (confirm("Are you sure you want to disable this payment gateway?") == true)
+ window.location.href = href;
+ }
+ </SCRIPT>
- <TR>
- <TD><% $payment_gateway->gatewaynum %></TD>
-% if ( !$cgi->param('showdisabled') ) {
+!;
- <TD><% $payment_gateway->disabled ? 'DISABLED' : '' %></TD>
-% }
+my $gateway_sub = sub {
+ my($payment_gateway) = @_;
- <TD><% $payment_gateway->gateway_module %>
- <FONT SIZE="-1">
- <A HREF="<%$p%>edit/payment_gateway.html?<% $payment_gateway->gatewaynum %>">(edit)</A>
- <% !$payment_gateway->disabled
- ? '<A HREF="'. $p. 'misc/disable-payment_gateway.cgi?'. $payment_gateway->gatewaynum.'">(disable)</A>'
- : ''
- %>
- </FONT>
- </TD>
- <TD><% $payment_gateway->gateway_username %></TD>
- <TD> - </TD>
- <TD><% $payment_gateway->gateway_action %></TD>
- <TD>
- <TABLE CELLSPACING=0 CELLPADDING=0>
-% my %options = $payment_gateway->options;
-% foreach my $option ( keys %options ) {
-%
+ my $gatewaynum = $payment_gateway->gatewaynum;
- <TR>
- <TH><% $option %>:</TH>
- <TD><% $options{$option} %></TD>
- </TR>
-% }
+ my $html = $payment_gateway->gateway_module. ' '. qq!
+ <FONT SIZE="-1">
+ <A HREF="${p}edit/payment_gateway.html?$gatewaynum">(edit)</A>
+ !;
- </TABLE>
- </TD>
- </TR>
-% }
+ unless ( $payment_gateway->disabled ) {
+ $html .= qq!
+ <A HREF="javascript:areyousure('${p}misc/disable-payment_gateway.cgi?$gatewaynum')">(disable)</A>
+ !;
+ }
+ $html .= '</FONT>';
-</TABLE>
+ $html;
-<% include('/elements/footer.html') %>
+};
+
+my $options_sub = sub {
+ my($payment_gateway) = @_;
+ #should return a structure instead of this manual formatting...
+
+ my $html = '<TABLE CELLSPACING=0 CELLPADDING=0>';
+
+ my %options = $payment_gateway->options;
+ foreach my $option ( keys %options ) {
+ $html .= '<TR><TH>'. $option. ':</TH>'.
+ '<TD>'. $options{$option}. '</TD></TR>';
+ }
+ $html .= '</TABLE>';
+
+ $html;
+};
+
+my $count_query = 'SELECT COUNT(*) FROM payment_gateway';
+
+</%once>
<%init>
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
-my %search;
-if ( $cgi->param('showdisabled') ) {
- %search = ();
-} else {
- %search = ( 'disabled' => '' );
-}
-
</%init>
More information about the freeside-commits
mailing list