# Copyright (c) 2005 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: Link.pm,v 1.5 2008/12/10 04:29:43 nagler Exp $ package Bivio::UI::Text::Widget::Link; use strict; use Bivio::Base 'UI.Widget'; our($VERSION) = sprintf('%d.%02d', q$Revision: 1.5 $ =~ /\d+/g); my($_W) = b_use('UI.Widget'); my($_TI) = b_use('Agent.TaskId'); sub NEW_ARGS { return [qw(value)]; } sub initialize { my($self) = @_; $self->put(value => _initialize_value($self)); return shift->SUPER::initialize(@_); } sub render { my($self, $source, $buffer) = @_; my($v) = $self->render_attr('value', $source); $$buffer .= $self->req->format_http({ uri => $$v, carry_query => 0, carry_path_info => 0, }); return; } sub _initialize_value { my($self) = @_; my($v) = $self->initialize_attr('value'); return [['->req'], '->format_stateless_uri', $_TI->from_any($v)] if $_TI->is_blessed($v) || $_TI->is_valid_name($v); return $v; } 1;