# Copyright (c) 2007 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: ConfirmableForm.pm,v 1.3 2008/11/16 04:18:29 nagler Exp $ package Bivio::Biz::Model::ConfirmableForm; use strict; use base 'Bivio::Biz::FormModel'; use Bivio::Agent::TaskId; our($VERSION) = sprintf('%d.%02d', q$Revision: 1.3 $ =~ /\d+/g); sub check_redirect_to_confirmation_form { my($self, $task) = @_; return if $self->unsafe_get('is_confirmed'); $self->req->server_redirect(Bivio::Agent::TaskId->from_name($task)); # DOES NOT RETURN } sub execute_unwind { my($self) = @_; if ($self->get('is_confirmed')) { return $self->validate_and_execute_ok || $self->internal_redirect_next; } return shift->SUPER::execute_unwind(@_); } sub internal_initialize { my($self) = @_; return $self->merge_initialize_info($self->SUPER::internal_initialize, { version => 1, hidden => [ { name => 'is_confirmed', type => 'Boolean', constraint => 'NONE', }, ], }); } 1;