# Copyright (c) 1999-2009 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: File.pm,v 2.6 2011/06/30 22:43:06 moeller Exp $ package Bivio::UI::HTML::Widget::File; use strict; use Bivio::Base 'HTMLWidget.InputBase'; our($VERSION) = sprintf('%d.%02d', q$Revision: 2.6 $ =~ /\d+/g); sub internal_attributes { return [@{shift->SUPER::internal_attributes(@_)}, qw(size)]; } sub initialize { my($self) = @_; $self->initialize_attr(class => 'b_input_file'); $self->initialize_attr(TYPE => 'file'); $self->initialize_attr('size'); return shift->SUPER::initialize(@_); } sub internal_input_base_render_attrs { my($self, $form, $field, $source, $buffer) = @_; shift->SUPER::internal_input_base_render_attrs(@_); my($size) = $self->render_simple_attr('size', $source); $$buffer .= qq{ value="@{[$form->get_field_as_html($field)]}"} . qq{ size="$size"}; return; } 1;