merging 8374
This commit is contained in:
parent
c9946708b5
commit
2f8869292f
4 changed files with 140 additions and 5 deletions
|
|
@ -228,6 +228,10 @@ form.
|
|||
|
||||
=cut
|
||||
|
||||
# FIXME This would be better if it returned an OBJECT not the HTML
|
||||
# TODO add a toHtml sub to take the place of this sub and a getFormControl
|
||||
# And refactor to not require all these arguments HERE but rather in the
|
||||
# constructor or something...
|
||||
sub formField {
|
||||
my $self = shift;
|
||||
my $properties = $self->formProperties(shift);
|
||||
|
|
@ -245,9 +249,8 @@ sub formField {
|
|||
# start with specified (or current) user's data. previous data needed by some form types as well (file).
|
||||
$properties->{value} = $u->profileField($self->getId);
|
||||
# use submitted data if it exists
|
||||
# FIXME Is $properties->{name} or $self->getId the correct way to get the form name?
|
||||
if (defined $self->session->form->process($properties->{name}, $self->get("fieldType"))) {
|
||||
$properties->{value} = $self->session->form->process($self->getId,$self->get("fieldType"), undef, $properties);
|
||||
if ($self->formProcess($u) != $self->get('dataDefault')) {
|
||||
$properties->{value} = $self->formProcess($u);
|
||||
}
|
||||
# fall back on default
|
||||
if(!defined $properties->{value}) {
|
||||
|
|
@ -768,6 +771,7 @@ sub setCategory {
|
|||
$self->_reorderFields($categoryId);
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ use strict;
|
|||
use WebGUI::Cache;
|
||||
use WebGUI::Group;
|
||||
use WebGUI::DatabaseLink;
|
||||
use WebGUI::Exception;
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Operation::Shared;
|
||||
|
||||
|
|
@ -61,6 +62,9 @@ These methods are available from this class:
|
|||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
# TODO This stays like this until we can break API, just in case somebody
|
||||
# doesn't realize that _ means private.
|
||||
# After API unfreeze, put this in the WebGUI::User->create routine
|
||||
sub _create {
|
||||
my $session = shift;
|
||||
my $userId = shift || $session->id->generate();
|
||||
|
|
@ -157,6 +161,31 @@ sub authMethod {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 create ( session, [userId] )
|
||||
|
||||
Create a new user. C<userId> is an option user ID to give the new user.
|
||||
Returns the newly created WebGUI::User object.
|
||||
|
||||
=cut
|
||||
|
||||
sub create {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $userId = shift;
|
||||
|
||||
if ( !ref $session || !$session->isa( 'WebGUI::Session' ) ) {
|
||||
WebGUI::Error::InvalidObject->throw(
|
||||
expected => "WebGUI::Session",
|
||||
got => (ref $session),
|
||||
error => q{Must provide a session variable},
|
||||
);
|
||||
}
|
||||
|
||||
return WebGUI::User->new( $session, "new", $userId );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 cache ( )
|
||||
|
||||
Saves the user object into the cache.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue