[Bio] / WebApplication / WebMenu.pm Repository:
ViewVC logotype

Diff of /WebApplication/WebMenu.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5, Wed Jun 27 21:04:32 2007 UTC revision 1.6, Mon Jul 30 20:47:31 2007 UTC
# Line 7  Line 7 
7  use strict;  use strict;
8  use warnings;  use warnings;
9    
 use Carp qw( confess );  
   
 use CGI;  
   
 1;  
10    
11  =pod  =pod
12    
# Line 122  Line 117 
117      my ($self, $category, $url, $target, $right, $order) = @_;      my ($self, $category, $url, $target, $right, $order) = @_;
118    
119      unless ($category) {      unless ($category) {
120          confess 'No category given.';          die 'No category given.';
121      }      }
122    
123      unless ($order) {      unless ($order) {
# Line 130  Line 125 
125      }      }
126    
127      if (exists($self->{categories_index}->{$category})) {      if (exists($self->{categories_index}->{$category})) {
128          confess "Trying to add category '$category' which already exists.";          die "Trying to add category '$category' which already exists.";
129      }      }
130    
131      $url = '' unless ($url);      $url = '' unless ($url);
# Line 162  Line 157 
157      my ($self, $category) = @_;      my ($self, $category) = @_;
158    
159      unless ($category) {      unless ($category) {
160          confess 'No category given.';          die 'No category given.';
161      }      }
162    
163      my $i = $self->{categories_index}->{$category};      my $i = $self->{categories_index}->{$category};
# Line 224  Line 219 
219      my ($self, $category, $entry, $url, $target) = @_;      my ($self, $category, $entry, $url, $target) = @_;
220    
221      unless ($category and $entry and $url) {      unless ($category and $entry and $url) {
222          confess "Missing parameter ('$category', '$entry', '$url').";          die "Missing parameter ('$category', '$entry', '$url').";
223      }      }
224    
225      unless (exists($self->{categories_index}->{$category})) {      unless (exists($self->{categories_index}->{$category})) {
226          confess "Trying to add to non-existant category '$category'.";          die "Trying to add to non-existant category '$category'.";
227      }      }
228    
229      $target = '' unless ($target);      $target = '' unless ($target);
# Line 264  Line 259 
259      # check if a right is required to see this category      # check if a right is required to see this category
260      if (defined($right)) {      if (defined($right)) {
261        unless (defined($application) && ref($application) eq 'WebApplication') {        unless (defined($application) && ref($application) eq 'WebApplication') {
262          confess "When using rights for a menu category, an application reference must be passed.";          die "When using rights for a menu category, an application reference must be passed.";
263        }        }
264        next unless ($application->session->user && $application->session->user->has_right($application, @$right));        next unless ($application->session->user &&
265                       $application->session->user->has_right($application, @$right));
266      }      }
267    
268      my $url = ($c_url) ? qq~href="$c_url"~ : '';      my $url = ($c_url) ? qq~href="$c_url"~ : '';
# Line 295  Line 291 
291    
292    $html .= "\t</ul>\n";    $html .= "\t</ul>\n";
293    
   $html .= "<table style='position: absolute; right: 10px;'><tr>";  
   # check for search module  
   if ($self->search()) {  
     $html .= "<td>".$self->search->output()."</td>";  
   }  
   
   # display user string  
   if ($application->session->user) {  
     $html .= qq~<td><div id="user" style="padding-top: 2px;">  
                 <img height="15px" src="./Html/user.gif" title="Current User" />  
                 <strong>~ . $application->session->user->firstname . " " . $application->session->user->lastname . qq~</strong></div></td>~;  
   }  
   $html .= "</tr></table>";  
   
294    $html .= "</div>\n";    $html .= "</div>\n";
295    
296    return $html;    return $html;
297    
298  }  }
299    
300    1;

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3