1 # Copyright 2002-2007 Interchange Development Group and others
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
8 # $Id: warnings.coretag,v 1.9 2007-09-21 16:15:48 kwalsh Exp $
10 UserTag warning Alias warnings
12 UserTag warnings Order message
13 UserTag warnings addAttr
14 UserTag warnings PosNumber 1
15 UserTag warnings Version $Revision: 1.9 $
16 UserTag warnings Routine <<EOR
18 my($message, $opt) = @_;
21 my $param = ref $opt->{param} ? $opt->{param} : [$opt->{param}];
22 push_warning($message, @$param);
23 return unless $opt->{show};
26 return unless $Vend::Session->{warnings};
28 my $out = $opt->{header} || "";
30 $opt->{list_container} ||= 'ul';
31 $out .= "<$opt->{list_container}";
32 for(qw/ class style extra /) {
33 next unless $opt->{"list_$_"};
34 if($opt->{"list_$_"} =~ m{^\s*$_\s*=}i) {
35 $out .= ' ' . $opt->{"list_$_"};
38 $out .= qq{ $_="$opt->{"list_$_"}"};
42 $opt->{joiner} = '<li>'
43 if ! length($opt->{joiner});
44 $out .= $opt->{joiner};
46 elsif(! length($opt->{joiner})) {
47 $opt->{joiner} = "\n";
49 $out .= join $opt->{joiner}, grep /\S/, @{$Vend::Session->{warnings}};
50 $out .= "</$opt->{list_container}>" if $opt->{auto};
51 $out .= $opt->{footer} if length($opt->{footer});
52 delete $Vend::Session->{warnings} unless $opt->{keep};