1 <style type="text/css">
8 % if ( $opt{id} !~ /customer_/ ) {
9 % # Fix for changes to how jQuery UI applies state classes
11 #<% $opt{id} %> .ui-state-active {
13 background-color: transparent;
14 border-color: transparent;
24 /* #<% $opt{id} %> .ui-menu-item */
25 #<% $opt{id} %> > li {
29 /* #<% $opt{id} %> .ui-menu-item */
30 #<% $opt{id} %> > li.ui-state-focus {
31 border: 1px solid transparent;
34 #<% $opt{id} %> > li.ui-state-active {
35 border: 1px solid transparent;
38 #<% $opt{id} %> > li.ui-state-active > a {
40 /* if i could find something light enough that didn't look pink?
41 or is this too visually distracting and not the useful hint i think it is?
51 border: 1px solid #7e0079;
53 box-shadow: #333333 1px 1px 2px;
56 #<% $opt{id} %> ul li {
62 #<% $opt{id} %> ul a {
66 #<% $opt{id} %> li.ui-menu-divider {
67 border-color: #7e0079;
70 #<% $opt{id} %> a:hover {
71 text-decoration: underline;
75 #<% $opt{id} %> ul li.ui-state-focus {
76 background: transparent;
77 border: 1px solid transparent;
82 #<% $opt{id} %> ul li.ui-state-active {
84 border: 1px solid #7e0079;
90 #<% $opt{id} %> a .arrow {
92 background-image: url("<% $p %>images/arrow.right.black.png");
100 <ul id="<% $opt{id} %>">
101 % foreach my $submenu (@processed_menu) {
102 <li <% $opt{bgcolor} ? 'STYLE="background:'. $opt{bgcolor}.'"' : '' %>>
103 <% shift @$submenu %>
105 <ul class="<% $opt{class} %>">
106 % foreach my $link ( @$submenu ) {
115 <script type="text/javascript">
117 $("#<% $opt{id} %>").menu({
118 position: { my: "left top", at: "left+1 bottom+3" },
119 icons: { submenu: "ui-icon-blank" },
121 $(this).menu("option", "position", { my:"left top", at:"left+1 bottom+3" } );
123 focus: function(e,ui) {
124 if ($("#<% $opt{id} %>").get(0) !== $(ui).get(0).item.parent().get(0)) {
125 $(this).menu("option", "position", { my:"left top", at:"right+2 top"} );
135 #my $cust_main = $opt{'cust_main'};
136 #my $custnum = $cust_main->custnum;
137 #my $curuser = $FS::CurrentUser::CurrentUser;
138 #my $conf = FS::Conf->new;
140 #my %payby = map { $_ => 1 } $conf->config('payby');
142 ## cached for conditions, to avoid looking it up twice
143 #my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
146 foreach my $submenu (@{ $opt{menu} }) {
150 foreach my $entry ( @$submenu ) {
151 # if the menu head was skipped, skip the whole menu
152 last if (!$first and !@links);
155 my $a = entry2link($entry, \%opt);
156 push @links, $a if length($a);
161 push @processed_menu, \@links;
167 my( $entry, $opt ) = @_;
170 if ( $entry->{acl} ) {
172 unless $FS::CurrentUser::CurrentUser->access_right( $entry->{acl} );
174 if ( $entry->{confexists} ) {
175 if ( $entry->{confexists} =~ /^!(.*)/ ) {
176 # confexists => !foo, a negative condition
177 return '' if FS::Conf->new->exists( $1 );
179 return '' unless FS::Conf->new->exists( $entry->{confexists} );
182 if ( $entry->{condition} ) {
183 return '' unless &{ $entry->{condition} }($opt->{cust_main});
186 my $label = emt($entry->{label});
188 if ( $entry->{submenu} ) {
190 my $a = '<a href="javascript:void(0);">'.
191 '<span class="arrow"></span>'.
193 '</a><ul class="customer_subsubmenu">';
194 foreach my $submenu (@{ $entry->{submenu} }) {
195 $a .= '<li>'. entry2link($submenu, $opt->{cust_main}, $opt->{show}), '</li>';
202 my $target = $entry->{content}
206 if ( ref($target) eq 'CODE' ) {
207 $target = &$target($opt->{cust_main});
210 return $target if $entry->{content}; #the coderef specified the whole thing
212 if ( $entry->{show} ) {
214 $target = $opt->{self_url}. $entry->{show};
216 my $a = qq[ <A HREF="$target"];
217 $a .= ' class="current_show"' if $opt->{show} eq $entry->{show};
218 return $a. qq[>$label</A> ];
220 } elsif ( $entry->{popup} ) {
222 #$target =~ s/\$custnum/$custnum/g;
223 $target = $p.$target;
225 return include('/elements/popup_link.html',
233 } elsif ( $entry->{url} ) {
235 #$target =~ s/\$custnum/$custnum/g;
236 $target = $p.$target;
238 return qq[ <A HREF="$target">$label</A> ];
241 die "bad entry ". join(',',%$entry). " in menu: no url, popup or content";