# Copyright (c) 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: WidgetInjector.pm,v 1.1 2010/09/08 21:24:16 nagler Exp $ package Bivio::UI::View::WidgetInjector; use strict; use Bivio::Base 'View.Base'; use Bivio::UI::ViewLanguageAUTOLOAD; our($VERSION) = sprintf('%d.%02d', q$Revision: 1.1 $ =~ /\d+/g); my($_WI) = b_use('JavaScriptWidget.WidgetInjector'); my($_ULF) = b_use('Model.UserLoginForm'); sub public_xhtml_widget_js { my($self) = @_; return $self->internal_body( WidgetInjector($self->simple_package_name, 'public', 'xhtml_widget')); } sub internal_query_value { return [sub {$_WI->internal_query_value(shift)}]; } sub public_login_form_xhtml_widget { view_pre_execute(sub { $_ULF->new(shift->req)->process; return; }); return shift->internal_body(Form( 'UserLoginForm', Join([ map( { my($field) = $_; my($class) = $field =~ /(\w+)$/; DIV( Join([ SPAN_b_label(Join([ vs_text_as_prose("WidgetInjector.UserLoginForm.$field"), ': ', ])), Text({ field => $field, size => 15, class => 'b_field', }), ]), "b_$class", ); } qw(login RealmOwner.password), ), ]), { want_hidden_fields => 0, }, )); } 1;