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");
99 @-moz-document url-prefix() {
100 #<% $opt{id} %> a .arrow {
108 <ul id="<% $opt{id} %>">
109 % foreach my $submenu (@processed_menu) {
110 <li <% $opt{bgcolor} ? 'STYLE="background:'. $opt{bgcolor}.'"' : '' %>>
111 <% shift @$submenu %>
113 <ul class="<% $opt{class} %>">
114 % foreach my $link ( @$submenu ) {
123 <script type="text/javascript">
125 $("#<% $opt{id} %>").menu({
126 position: { my: "left top", at: "left+1 bottom+3" },
127 icons: { submenu: "ui-icon-blank" },
129 $(this).menu("option", "position", { my:"left top", at:"left+1 bottom+3" } );
131 focus: function(e,ui) {
132 if ($("#<% $opt{id} %>").get(0) !== $(ui).get(0).item.parent().get(0)) {
133 $(this).menu("option", "position", { my:"left top", at:"right+2 top"} );
143 #my $cust_main = $opt{'cust_main'};
144 #my $custnum = $cust_main->custnum;
145 #my $curuser = $FS::CurrentUser::CurrentUser;
146 #my $conf = FS::Conf->new;
148 #my %payby = map { $_ => 1 } $conf->config('payby');
150 ## cached for conditions, to avoid looking it up twice
151 #my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
154 foreach my $submenu (@{ $opt{menu} }) {
158 foreach my $entry ( @$submenu ) {
159 # if the menu head was skipped, skip the whole menu
160 last if (!$first and !@links);
163 my $a = entry2link($entry, \%opt);
164 push @links, $a if length($a);
169 push @processed_menu, \@links;
175 my( $entry, $opt ) = @_;
178 if ( $entry->{acl} ) {
180 unless $FS::CurrentUser::CurrentUser->access_right( $entry->{acl} );
182 if ( $entry->{confexists} ) {
183 if ( $entry->{confexists} =~ /^!(.*)/ ) {
184 # confexists => !foo, a negative condition
185 return '' if FS::Conf->new->exists( $1 );
187 return '' unless FS::Conf->new->exists( $entry->{confexists} );
190 if ( $entry->{condition} ) {
191 return '' unless &{ $entry->{condition} }($opt->{cust_main});
194 my $label = emt($entry->{label});
196 if ( $entry->{submenu} ) {
198 my $a = '<a href="javascript:void(0);">'. $label.
199 '<span class="arrow"></span>'.
200 '</a><ul class="customer_subsubmenu">';
201 foreach my $submenu (@{ $entry->{submenu} }) {
202 $a .= '<li>'. entry2link($submenu, $opt->{cust_main}, $opt->{show}), '</li>';
209 my $target = $entry->{content}
213 if ( ref($target) eq 'CODE' ) {
214 $target = &$target($opt->{cust_main});
217 return $target if $entry->{content}; #the coderef specified the whole thing
219 if ( $entry->{show} ) {
221 $target = $opt->{self_url}. $entry->{show};
223 my $a = qq[ <A HREF="$target"];
224 $a .= ' class="current_show"' if $opt->{show} eq $entry->{show};
225 return $a. qq[>$label</A> ];
227 } elsif ( $entry->{popup} ) {
229 #$target =~ s/\$custnum/$custnum/g;
230 $target = $p.$target;
232 return include('/elements/popup_link.html',
240 } elsif ( $entry->{url} ) {
242 #$target =~ s/\$custnum/$custnum/g;
243 $target = $p.$target;
245 return qq[ <A HREF="$target">$label</A> ];
248 die "bad entry ". join(',',%$entry). " in menu: no url, popup or content";