1 <style type="text/css">
8 #<% $opt{id} %> .ui-state-active {
10 background-color: transparent;
11 border-color: transparent;
19 /* #<% $opt{id} %> .ui-menu-item */
20 #<% $opt{id} %> > li {
24 /* #<% $opt{id} %> .ui-menu-item */
25 #<% $opt{id} %> > li.ui-state-focus {
26 border: 1px solid transparent;
29 #<% $opt{id} %> > li.ui-state-active {
30 border: 1px solid transparent;
33 #<% $opt{id} %> > li.ui-state-active > a {
35 /* if i could find something light enough that didn't look pink?
36 or is this too visually distracting and not the useful hint i think it is?
46 border: 1px solid #7e0079;
48 box-shadow: #333333 1px 1px 2px;
51 #<% $opt{id} %> ul li {
57 #<% $opt{id} %> ul a {
61 #<% $opt{id} %> li.ui-menu-divider {
62 border-color: #7e0079;
65 #<% $opt{id} %> a:hover {
66 text-decoration: underline;
70 #<% $opt{id} %> ul li.ui-state-focus {
71 background: transparent;
72 border: 1px solid transparent;
77 #<% $opt{id} %> ul li.ui-state-active {
79 border: 1px solid #7e0079;
85 #<% $opt{id} %> a .arrow {
87 background-image: url("<% $p %>images/arrow.right.black.png");
94 @-moz-document url-prefix() {
95 #<% $opt{id} %> a .arrow {
103 <ul id="<% $opt{id} %>">
104 % foreach my $submenu (@processed_menu) {
105 <li <% $opt{bgcolor} ? 'STYLE="background:'. $opt{bgcolor}.'"' : '' %>>
106 <% shift @$submenu %>
108 <ul class="<% $opt{class} %>">
109 % foreach my $link ( @$submenu ) {
118 <script type="text/javascript">
120 $("#<% $opt{id} %>").menu({
121 position: { my: "left top", at: "left+1 bottom+3" },
122 icons: { submenu: "ui-icon-blank" },
124 $(this).menu("option", "position", { my:"left top", at:"left+1 bottom+3" } );
126 focus: function(e,ui) {
127 if ($("#<% $opt{id} %>").get(0) !== $(ui).get(0).item.parent().get(0)) {
128 $(this).menu("option", "position", { my:"left top", at:"right+2 top"} );
138 #my $cust_main = $opt{'cust_main'};
139 #my $custnum = $cust_main->custnum;
140 #my $curuser = $FS::CurrentUser::CurrentUser;
141 #my $conf = FS::Conf->new;
143 #my %payby = map { $_ => 1 } $conf->config('payby');
145 ## cached for conditions, to avoid looking it up twice
146 #my $invoicing_list_emailonly = $cust_main->invoicing_list_emailonly;
149 foreach my $submenu (@{ $opt{menu} }) {
153 foreach my $entry ( @$submenu ) {
154 # if the menu head was skipped, skip the whole menu
155 last if (!$first and !@links);
158 my $a = entry2link($entry, \%opt);
159 push @links, $a if length($a);
164 push @processed_menu, \@links;
170 my( $entry, $opt ) = @_;
173 if ( $entry->{acl} ) {
175 unless $FS::CurrentUser::CurrentUser->access_right( $entry->{acl} );
177 if ( $entry->{confexists} ) {
178 if ( $entry->{confexists} =~ /^!(.*)/ ) {
179 # confexists => !foo, a negative condition
180 return '' if FS::Conf->new->exists( $1 );
182 return '' unless FS::Conf->new->exists( $entry->{confexists} );
185 if ( $entry->{condition} ) {
186 return '' unless &{ $entry->{condition} }($opt->{cust_main});
189 my $label = emt($entry->{label});
191 if ( $entry->{submenu} ) {
193 my $a = '<a href="javascript:void(0);">'. $label.
194 '<span class="arrow"></span>'.
195 '</a><ul class="customer_subsubmenu">';
196 foreach my $submenu (@{ $entry->{submenu} }) {
197 $a .= '<li>'. entry2link($submenu, $opt->{cust_main}, $opt->{show}), '</li>';
204 my $target = $entry->{content}
208 if ( ref($target) eq 'CODE' ) {
209 $target = &$target($opt->{cust_main});
212 return $target if $entry->{content}; #the coderef specified the whole thing
214 if ( $entry->{show} ) {
216 $target = $opt->{self_url}. $entry->{show};
218 my $a = qq[ <A HREF="$target"];
219 $a .= ' class="current_show"' if $opt->{show} eq $entry->{show};
220 return $a. qq[>$label</A> ];
222 } elsif ( $entry->{popup} ) {
224 #$target =~ s/\$custnum/$custnum/g;
225 $target = $p.$target;
227 return include('/elements/popup_link.html',
235 } elsif ( $entry->{url} ) {
237 #$target =~ s/\$custnum/$custnum/g;
238 $target = $p.$target;
240 return qq[ <A HREF="$target">$label</A> ];
243 die "bad entry ". join(',',%$entry). " in menu: no url, popup or content";