# Copyright 2002-2008 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. UserTag button Order name src text UserTag button addAttr UserTag button attrAlias value text UserTag button hasEndTag UserTag button Version 1.25 UserTag button Routine <{wait_text}) { $trigger_text = $opt->{wait_text}; } else { $trigger_text = $text; } my @js; my $image; my @from_html = qw/class id style/; if($src) { if( $opt->{srcliteral} || $src =~ m{^https?://}i ) { $image = $src; } else { my $dr = $::Variable->{DOCROOT}; my $id = $Tag->image( { dir_only => 1 } ); $id =~ s:/+$::; $id =~ s:/~[^/]+::; if( $dr and $id and $src =~ m{^[^/]} and -f "$dr$id/$src" ) { $image = $src; } elsif( $dr and $src =~ m{^/} and -f "$dr/$src" ) { $image = "$id/$src"; } else { ::logError("No image file '$src' found or image file name is invalid."); } } } my $onclick = ''; my $onmouseover = ''; my $onmouseout = ''; while($action =~ s! \[ ( j (?:ava)? s (?:cript)? ) \] (.*?) \[ / \1 \] !!xis ) { my $script = $2; $script =~ s/\s+$//; $script =~ s/^\s+//; if($script =~ s/\bonclick\s*=\s*"(.*?)"//is) { $onclick = $1; next; } if ($script =~ s/\bonmouse(\w+)\s*=\s*"(.*?)"//is) { if (lc($1) eq 'over') { $onmouseover .= ($onmouseover ? ';' : '') . $2; } elsif (lc($1) eq 'out') { $onmouseout .= ($onmouseout ? ';' : '') . $2; } else { logError(q{Skipping 'onmouse%s', invalid JavaScript event}, $1); } next; } push @js, $script; } if(! $name or $name eq 'mv_click') { $action =~ s/^\s+//; $action =~ s/\s+$//; my $set_text = HTML::Entities::decode($trigger_text); $::Scratch->{$set_text} = $action; $name = 'mv_click' if ! $name; } my $out = ''; my $confirm = ''; my $wait = ''; $opt->{extra} = $opt->{extra} ? " $opt->{extra}" : ''; if($opt->{confirm}) { $opt->{confirm} =~ s/'/\\'/g; $confirm = "confirm('$opt->{confirm}')"; } if($onclick) { $confirm .= ' && ' if $confirm; $onclick = qq{ onClick="$confirm$onclick"}; } # Constructing form button. Will be sent back in all cases, # either as the primary button or as the