# Copyright (c) 2000-2006 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: ImageFormButton.pm,v 2.7 2009/11/28 03:07:13 nagler Exp $ package Bivio::UI::HTML::Widget::ImageFormButton; use strict; use base 'Bivio::UI::HTML::Widget::ControlBase'; our($VERSION) = sprintf('%d.%02d', q$Revision: 2.7 $ =~ /\d+/g); my($_IDI) = __PACKAGE__->instance_data_index; sub control_on_render { my($self, $source, $buffer) = @_; my($req) = $self->get_request; my($field) = $self->resolve_ancestral_attr('form_model', $req) ->get_field_name_for_html(${$self->render_attr('field', $source)}); my($super) = ''; my($alt) = $self->render_simple_attr('alt', $source); $self->SUPER::control_on_render($source, \$super); $$buffer .= 'render_simple_attr('attributes', $source) . ' />'; return; } sub initialize { my($self) = @_; $self->put_unless_exists( field => sub { Bivio::IO::Alert->warn_deprecated('field must be specified'); return 'submit'; }); $self->map_invoke(initialize_attr => [qw(field image)]); $self->map_invoke(unsafe_initialize_attr => [qw(alt attributes)]); return shift->SUPER::initialize(@_); } sub internal_new_args { return shift->internal_compute_new_args([qw(field image ?class)], \@_); } 1;