# Copyright (c) 2000-2010 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: TextArea.pm,v 2.10 2011/03/03 18:16:09 nagler Exp $ package Bivio::Type::TextArea; use strict; use Bivio::Base 'Type.Text'; our($VERSION) = sprintf('%d.%02d', q$Revision: 2.10 $ =~ /\d+/g); sub LINE_WIDTH { return 60; } sub from_literal { my($proto, $value, $line_width) = @_; $proto->internal_from_literal_warning unless wantarray; return (undef, undef) unless defined($value) && length($value); my($pref, $req); return $proto->wrap_lines($value, $line_width || $proto->LINE_WIDTH) if defined($value) and $req = Bivio::Agent::Request->get_current and $pref = b_use('Model.RowTag')->new($req) ->row_tag_get_for_auth_user('TEXTAREA_WRAP_LINES') and $pref; return (undef, Bivio::TypeError->TOO_LONG) if length($value) > $proto->get_width; my($v) = $proto->canonicalize_charset(\$value); return length($$v) ? $$v . "\n" : (undef, undef); } sub get_width { # Max size in browsers return 0xffff; } 1;