| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # -*- perl -*- | 
| 2 |  |  |  |  |  |  |  | 
| 3 |  |  |  |  |  |  | # | 
| 4 |  |  |  |  |  |  | # $Id: Breadcrumb.pm,v 1.7 2004/01/12 16:33:20 eserte Exp $ | 
| 5 |  |  |  |  |  |  | # Author: Slaven Rezic | 
| 6 |  |  |  |  |  |  | # | 
| 7 |  |  |  |  |  |  | # Copyright (C) 2003 Slaven Rezic. | 
| 8 |  |  |  |  |  |  | # This is free software; you can redistribute it and/or modify it under the | 
| 9 |  |  |  |  |  |  | # terms of the GNU General Public License, see the file COPYING. | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | # | 
| 12 |  |  |  |  |  |  | # Mail: slaven@rezic.de | 
| 13 |  |  |  |  |  |  | # WWW:  http://we-framework.sourceforge.net | 
| 14 |  |  |  |  |  |  | # | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | package WE_Frontend::Plugin::Breadcrumb; | 
| 17 | 1 |  |  | 1 |  | 1264 | use base qw(Template::Plugin); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 81 |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 1 |  |  | 1 |  | 6 | use HTML::Entities; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 72 |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 | 1 |  |  | 1 |  | 5 | use WE::Util::LangString qw(langstring); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 66 |  | 
| 22 | 1 |  |  | 1 |  | 5 | use WE_Frontend::Plugin::WE_Navigation; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 23 |  | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 23 |  | 
| 25 | 1 |  |  | 1 |  | 5 | use vars qw($VERSION); | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 215 |  | 
| 26 |  |  |  |  |  |  | $VERSION = sprintf("%d.%02d", q$Revision: 1.7 $ =~ /(\d+)\.(\d+)/); | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | =head1 NAME | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | WE_Frontend::Plugin::Breadcrumb - insert a "breadcrumb" | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | my $t = Template->new({PLUGIN_BASE => "WE_Frontend::Plugin"}); | 
| 35 |  |  |  |  |  |  |  | 
| 36 |  |  |  |  |  |  | [% USE Breadcrumb %] | 
| 37 |  |  |  |  |  |  | [% Breadcrumb.out() %] | 
| 38 |  |  |  |  |  |  |  | 
| 39 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | Create a HTML breadcrumb. | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | =head2 METHODS | 
| 44 |  |  |  |  |  |  |  | 
| 45 |  |  |  |  |  |  | =over | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | =cut | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | sub new { | 
| 50 | 0 |  |  | 0 | 1 |  | my($class, $context, $params) = @_; | 
| 51 | 0 |  |  |  |  |  | my $n = WE_Frontend::Plugin::WE_Navigation->new($context, $params); | 
| 52 | 0 |  |  |  |  |  | my $self = { WE_Navigation => $n }; | 
| 53 | 0 |  |  |  |  |  | bless $self, $class; | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | =item out() | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | Format and output a breadcrumb for the current object id. The | 
| 59 |  |  |  |  |  |  | following classes are used: | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =over | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | =item breadcrumb | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | the overall breadcrumb (in a  element) | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =item breadcrum_link | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | links in the breadcrumb | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | =back | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | The links are masked with | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =cut | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | sub out { | 
| 78 | 0 |  |  | 0 | 1 |  | my($self) = @_; | 
| 79 | 0 |  |  |  |  |  | my $ancestors = $self->{WE_Navigation}->ancestors; | 
| 80 |  |  |  |  |  |  | # XXX classes ueberdenken | 
| 81 | 0 |  |  |  |  |  | '' . | 
| 82 |  |  |  |  |  |  | join(" > ", map { | 
| 83 | 0 |  |  |  |  |  | my $o = $_; | 
| 84 | 0 |  |  |  |  |  | my $url   = $o->relurl; | 
| 85 | 0 |  |  |  |  |  | my $title = $o->lang_title; | 
| 86 | 0 |  |  |  |  |  | '"; | 
| 87 |  |  |  |  |  |  | } @$ancestors) . ''; | 
| 88 |  |  |  |  |  |  | } | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | 1; | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | __END__ |