Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / fs_selfservice / FS-SelfService / cgi / myaccount_menu.html
1 <%= $url = "$selfurl?action="; ''; %>
2 <TABLE BORDER=0><TR>
3 <TD VALIGN="top" BGCOLOR="<%= $menu_bgcolor || $box_bgcolor || '#c0c0c0' %>">
4
5 <TABLE CELLSPACING=0 BORDER=0 HEIGHT="100%">
6
7 <%= 
8
9 if ( $menu_top_image ) {
10   $OUT .= '<TR><TD STYLE="padding:0px"><IMG SRC="image.cgi?menu_top_image"></TD></TR>';
11 }
12
13 my @menu = (
14   { title=>' ' },
15   { title=>'Overview', url=>'myaccount', size=>'+1', },
16   { title=>' ' },
17   { title=>'Purchase', size=>'+1', },
18 );
19
20 unless ( $access_pkgnum ) {
21   push @menu,
22     { title=>'Purchase additional package',
23       url=>'customer_order_pkg', 'indent'=>2 };
24 }
25
26 my %payby_mode;
27 @payby_mode{@cust_paybys} = @hide_payment_fields;
28 # $payby_mode{FOO} is true if FOO is thirdparty, false if it's B::OP,
29 # nonexistent if it's not supported
30
31 if ( $balance > 0 ) { #XXXFIXME "enable selfservice prepay features" flag or something, eventually per-pkg or something really fancy
32
33   if ( exists( $payby_mode{CARD} ) ) {
34     push @menu, { title  => 'Recharge my account with a credit card',
35                   url    => $payby_mode{CARD}
36                               ? 'make_thirdparty_payment&payby_method=CC'
37                               : 'make_payment',
38                   indent => 2,
39                  }
40   }
41
42   if ( exists( $payby_mode{CHEK} ) ) {
43     push @menu, { title  => 'Recharge my account with a check',
44                   url    => $payby_mode{CHEK}
45                               ? 'make_thirdparty_payment&payby_method=ECHECK'
46                               : 'make_ach_payment',
47                   indent => 2,
48                 }
49   }
50
51   if ( exists( $payby_mode{PREP} ) ) {
52     push @menu, { title  => 'Recharge my account with a prepaid card',
53                   url    => 'recharge_prepay',
54                   indent => 2,
55                 }
56   }
57
58   if ( exists( $payby_mode{PPAL} ) ) {
59     push @menu, { title  => 'Recharge my account with PayPal',
60                   url    => 'make_thirdparty_payment&payby_method=PAYPAL',
61                   indent => 2,
62                 }
63   }
64 }
65
66 push @menu,
67   { title=>' ' },
68   { title=>'View my usage', url=>'view_usage', size=>'+1', },
69   { title=>'Create a ticket', url=>'tktcreate', size=>'+1', },
70 ;
71
72 unless ( $access_pkgnum ) {
73   push @menu,
74     { title=>'Setup my services', url=>'provision', size=>'+1', },
75   ;
76 }
77
78 push @menu,
79   { title=>' ' };
80
81 push @menu,
82   { title=>'Change my information', size=>'+1', };
83
84 unless ( $access_pkgnum ) {
85   push @menu,
86     { title=>'Change billing address',      url=>'change_bill',     indent=>2 },
87     { title=>'Change service address',      url=>'change_ship',     indent=>2 },
88     { title=>'Change payment information',  url=>'change_pay',      indent=>2 },
89   ;
90 }
91
92 push @menu,
93   { title=>'Change password(s)',          url=>'change_password', indent=>2 },
94   { title=>' ' },
95   { title=>'Logout',   url=>'logout', size=>'+1', },
96 ;
97
98 my %menu_disable = map { $_=>1 } @menu_disable;
99 foreach my $item ( @menu ) {
100
101   next if ( $menu_skipblanks && $item->{'title'} =~ /^\s*$/ )
102        || ( $menu_skipheadings && ! $item->{'url'} )
103        || $menu_disable{$item->{'title'}};
104   
105   $OUT .= '<TR><TD'; 
106   if ( $menu_body_image ) {
107     if ( exists $item->{'url'} && $action eq $item->{'url'} ) {
108       $OUT .= #' BGCOLOR="'. ( $body_bgcolor || '#eeeeee' ). '" '.
109               ' STYLE="background: url(image.cgi?menu_body_image) 0 bottom; '.
110               '        color:#3366CC"; '. #XXX config
111               ' " ';
112     } else {
113       $OUT .= ' STYLE="background: url(image.cgi?menu_body_image) 0 bottom" ';
114     }
115   } else {
116     if ( exists $item->{'url'} && $action eq $item->{'url'} ) {
117       $OUT .= ' BGCOLOR="'. ( $body_bgcolor || '#eeeeee' ). '" '.
118               ' STYLE="border-top: 1px solid black;'.
119                      ' border-left: 1px solid black;'.
120                      ' border-bottom: 1px solid black"';
121     } else {
122       $OUT .= ' STYLE="border-right: 1px solid black"';
123     }
124   }
125   $OUT.='>';
126
127   if ( $menu_skipheadings ) {
128     $OUT .= '&nbsp;&nbsp;';
129   } else {
130     $OUT .= '&nbsp;' x $item->{'indent'}
131       if exists $item->{'indent'};
132   }
133
134   $OUT .= '<A HREF="'. $url. $item->{'url'}. '">'
135     if exists $item->{'url'} && $action ne $item->{'url'};
136
137   $OUT .= '<FONT SIZE="'. ( $menu_fontsize || $item->{'size'} ). '">'
138     if $menu_fontsize || exists($item->{'size'});
139
140   $item->{'title'} =~ s/ /&nbsp;/g;
141   $OUT .= $item->{'title'};
142
143   $OUT .= '</FONT>'
144     if exists $item->{'size'};
145
146   $OUT .= '</A>'
147     if exists $item->{'url'} && $action ne $item->{'url'};
148
149   $OUT .= '</TD></TR>';
150
151 }
152
153 if ( $menu_bottom_image ) {
154   $OUT .= '<TR><TD STYLE="padding:0px"><IMG SRC="image.cgi?menu_bottom_image"></TD></TR>';
155 } else {
156   $OUT .= '<TR><TD STYLE="border-right: 1px solid black" HEIGHT="100%"><BR><BR><BR><BR></TD></TR>';
157 }
158
159 %>
160
161 </TABLE>
162
163 </TD>