| Pangloss documentation | Contained in the Pangloss distribution. |
Pangloss::Segment::LoadConcept - load concept from an OpenFrame::Request.
$pipe->add_segment( Pangloss::Segment::LoadConcept->new )
This class inherits its interface from Pipeline::Segment.
attempts to load a concept from the stored OpenFrame::Request's arguments.
Creates a new concept from the hash given. uses the following keys:
new_concept_name
new_concept_notes
new_concept_category
Returns undef if no useable keys were present.
Steve Purkis <spurkis@quiup.com>
| Pangloss documentation | Contained in the Pangloss distribution. |
package Pangloss::Segment::LoadConcept; use Pangloss::Concept; use base qw( OpenFrame::WebApp::Segment::User::Session ); our $VERSION = ((require Pangloss::Version), $Pangloss::VERSION)[1]; our $REVISION = (split(/ /, ' $Revision: 1.4 $ '))[2]; sub dispatch { my $self = shift; my $request = $self->store->get('OpenFrame::Request') || return; return $self->new_concept_from_args( $request->arguments ); } sub new_concept_from_args { my $self = shift; my $args = shift; my $user = $self->get_user_from_session; my $concept = new Pangloss::Concept(); my $modified = 0; $concept->creator( $user->key ) if ($user); foreach my $var (qw( name notes category )) { if (exists( $args->{"new_concept_$var"} )) { $concept->$var( $args->{"new_concept_$var"} ); $modified++; } } return $modified ? $concept : undef; } 1; __END__ #------------------------------------------------------------------------------