summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorjeff <jeff>2006-11-30 02:27:57 +0000
committerjeff <jeff>2006-11-30 02:27:57 +0000
commitdbb388836b7951a3db49deda05a1ff9ba5125c17 (patch)
treee0c27eb8e84c416a9a833c21977d587983c7ef9e /httemplate/edit
parent12c852be6d4cabcc89fd9db901a6b315efbc1e97 (diff)
prepaid download/upload tracking
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/prepay_credit.cgi41
-rw-r--r--httemplate/edit/process/prepay_credit.cgi8
2 files changed, 44 insertions, 5 deletions
diff --git a/httemplate/edit/prepay_credit.cgi b/httemplate/edit/prepay_credit.cgi
index f563e253b..7ce44c087 100644
--- a/httemplate/edit/prepay_credit.cgi
+++ b/httemplate/edit/prepay_credit.cgi
@@ -11,7 +11,16 @@
% 3600 => 'hours',
%;
%
-%$cgi->param('multiplier', '60') unless $cgi->param('multiplier');
+%tie my %bytemultiplier, 'Tie::IxHash',
+% 1 => 'bytes',
+% 1000 => 'Kbytes',
+% 1000000 => 'Mbytes',
+% 1000000000 => 'Gbytes',
+%;
+%
+%$cgi->param('multiplier', '60') unless $cgi->param('multiplier');
+%$cgi->param('upmultiplier', '1000000') unless $cgi->param('upmultiplier');
+%$cgi->param('downmultiplier', '1000000') unless $cgi->param('downmultiplier');
%
%
@@ -46,9 +55,11 @@ Generate
</SELECT>
-<BR>Value:
+<TABLE>
+<TR><TD>Value:
$<INPUT TYPE="text" NAME="amount" SIZE=8 MAXLENGTH=7 VALUE="<% $cgi->param('amount') %>">
-and/or
+</TD>
+<TD>and/or
<INPUT TYPE="text" NAME="seconds" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('seconds') %>">
<SELECT NAME="multiplier">
% foreach my $multiplier ( keys %multiplier ) {
@@ -57,6 +68,30 @@ and/or
% }
</SELECT>
+</TD></TR>
+<TR><TD></TD>
+<TD>and/or
+<INPUT TYPE="text" NAME="upbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('upbytes') %>">
+<SELECT NAME="upmultiplier">
+% foreach my $multiplier ( keys %bytemultiplier ) {
+
+ <OPTION VALUE="<% $multiplier %>"<% $cgi->param('upmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
+% }
+
+</SELECT> upload
+</TD></TR>
+<TR><TD></TD>
+<TD>and/or
+<INPUT TYPE="text" NAME="downbytes" SIZE=6 MAXLENGTH=5 VALUE="<% $cgi->param('downbytes') %>">
+<SELECT NAME="downmultiplier">
+% foreach my $multiplier ( keys %bytemultiplier ) {
+
+ <OPTION VALUE="<% $multiplier %>"<% $cgi->param('downmultiplier') eq $multiplier ? ' SELECTED' : '' %>><% $bytemultiplier{$multiplier} %>
+% }
+
+</SELECT> download
+</TD></TR>
+</TABLE>
<BR><BR>
<INPUT TYPE="submit" NAME="submit" VALUE="Generate" onSubmit="this.disabled = true">
diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi
index fb15fd8e4..ba4296900 100644
--- a/httemplate/edit/process/prepay_credit.cgi
+++ b/httemplate/edit/process/prepay_credit.cgi
@@ -15,8 +15,10 @@
% $error = 'Illegal number of prepaid cards: '. $cgi->param('num');
%}
%
-%$hashref->{amount} = $cgi->param('amount');
-%$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier');
+%$hashref->{amount} = $cgi->param('amount');
+%$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier');
+%$hashref->{upbytes} = $cgi->param('upbytes') * $cgi->param('upmultiplier');
+%$hashref->{downbytes} = $cgi->param('downbytes') * $cgi->param('downmultiplier');
%
%$error ||= FS::prepay_credit::generate( $num,
% scalar($cgi->param('type')),
@@ -46,6 +48,8 @@
<% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %>
<% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %>
<% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>
+ <% $hashref->{upbytes} ? FS::UI::Web::bytecount_unexact($hashref->{upbytes}) : '' %>
+ <% $hashref->{downbytes} ? FS::UI::Web::bytecount_unexact($hashref->{downbytes}) : '' %>
<br>
% }