1 <style type="text/css">
13 /* #<% $opt{id} %> .ui-menu-item */
14 #<% $opt{id} %> > li {
18 /* #<% $opt{id} %> .ui-menu-item */
19 #<% $opt{id} %> > li.ui-state-focus {
20 border: 1px solid transparent;
23 #<% $opt{id} %> > li.ui-state-active {
24 border: 1px solid transparent;
27 #<% $opt{id} %> > li.ui-state-active > a {
29 /* if i could find something light enough that didn't look pink?
30 or is this too visually distracting and not the useful hint i think it is?
40 border: 1px solid #7e0079;
42 box-shadow: #333333 1px 1px 2px;
45 #<% $opt{id} %> ul li {
51 #<% $opt{id} %> ul a {
55 #<% $opt{id} %> li.ui-menu-divider {
56 border-color: #7e0079;
59 #<% $opt{id} %> a:hover {
60 text-decoration: underline;
64 #<% $opt{id} %> ul li.ui-state-focus {
65 background: transparent;
66 border: 1px solid transparent;
71 #<% $opt{id} %> ul li.ui-state-active {
73 border: 1px solid #7e0079;
79 #<% $opt{id} %> a .arrow {
81 background-image: url("<% $p %>images/arrow.right.black.png");
88 @-moz-document url-prefix() {
89 #<% $opt{id} %> a .arrow {
96 <ul id="<% $opt{id} %>">
97 % foreach my $submenu (@processed_menu) {
98 <li <% $opt{bgcolor} ? 'STYLE="background:'. $opt{bgcolor}.'"' : '' %>>
101 <ul class="<% $opt{class} %>">
102 % foreach my $link ( @$submenu ) {
111 <script type="text/javascript">
113 $("#<% $opt{id} %>").menu({
114 position: { my: "left top", at: "left+1 bottom+3" },
115 icons: { submenu: "ui-icon-blank" },
117 $(this).menu("option", "position", { my:"left top", at:"left+1 bottom+3" } );
119 focus: function(e,ui) {
120 if ($("#<% $opt{id} %>").get(0) !== $(ui).get(0).item.parent().get(0)) {
121 $(this).menu("option", "position", { my:"left top", at:"right+2 top"} );
131 #my $cust_main = $opt{'cust_main'};
132 #my $custnum = $cust_main->custnum;
133 #my $curuser = $FS::CurrentUser::CurrentUser;
134 #my $conf = FS::Conf->new;
136 #my %payby = map { $_ => 1 } $conf->config('payby');
138 ## cached for conditions, to avoid looking it up twice
139 #my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
142 foreach my $submenu (@{ $opt{menu} }) {
146 foreach my $entry ( @$submenu ) {
147 # if the menu head was skipped, skip the whole menu
148 last if (!$first and !@links);
151 my $a = entry2link($entry, \%opt);
152 push @links, $a if length($a);
157 push @processed_menu, \@links;
163 my( $entry, $opt ) = @_;
166 if ( $entry->{acl} ) {
168 unless $FS::CurrentUser::CurrentUser->access_right( $entry->{acl} );
170 if ( $entry->{confexists} ) {
171 if ( $entry->{confexists} =~ /^!(.*)/ ) {
172 # confexists => !foo, a negative condition
173 return '' if FS::Conf->new->exists( $1 );
175 return '' unless FS::Conf->new->exists( $entry->{confexists} );
178 if ( $entry->{condition} ) {
179 return '' unless &{ $entry->{condition} }($opt->{cust_main});
182 my $label = emt($entry->{label});
184 if ( $entry->{submenu} ) {
186 my $a = '<a href="javascript:void(0);">'. $label.
187 '<span class="arrow"></span>'.
188 '</a><ul class="customer_subsubmenu">';
189 foreach my $submenu (@{ $entry->{submenu} }) {
190 $a .= '<li>'. entry2link($submenu, $opt->{cust_main}, $opt->{show}), '</li>';
197 my $target = $entry->{content}
201 if ( ref($target) eq 'CODE' ) {
202 $target = &$target($opt->{cust_main});
205 return $target if $entry->{content}; #the coderef specified the whole thing
207 if ( $entry->{show} ) {
209 $target = $opt->{self_url}. $entry->{show};
211 my $a = qq[ <A HREF="$target"];
212 $a .= ' class="current_show"' if $opt->{show} eq $entry->{show};
213 return $a. qq[>$label</A> ];
215 } elsif ( $entry->{popup} ) {
217 #$target =~ s/\$custnum/$custnum/g;
218 $target = $p.$target;
220 return include('/elements/popup_link.html',
228 } elsif ( $entry->{url} ) {
230 #$target =~ s/\$custnum/$custnum/g;
231 $target = $p.$target;
233 return qq[ <A HREF="$target">$label</A> ];
236 die "bad entry ". join(',',%$entry). " in menu: no url, popup or content";