lots of changes

This commit is contained in:
Frank Dillon 2008-11-12 23:03:42 +00:00
parent 93df39d6f6
commit 615e0e3746
28 changed files with 2883 additions and 212 deletions

View file

@ -37,6 +37,9 @@ Operations for viewing message logs and individual messages.
appends the form variables for the private message form
DEPRECATED: Do not use this method in new code. It is here for API
compatibility only
=cut
sub _appendPrivateMessageForm {
@ -55,10 +58,6 @@ sub _appendPrivateMessageForm {
$vars->{ message_to_label } = $i18n->get("private message to label");
$vars->{ message_to } = $userTo->username;
$vars->{ message_to } .= WebGUI::Form::hidden($session, {
name=>"uid",
value=>$userTo->userId
});
my $subject = $form->get("subject") || "";
if($subject eq "" && defined $message) {
@ -81,14 +80,10 @@ sub _appendPrivateMessageForm {
value=>$form->get("message") || "",
});
$vars->{ form_header } = WebGUI::Form::formHeader($session);
$vars->{ form_header } .= WebGUI::Form::hidden($session, {
name => "op",
value => "sendPrivateMessageSave"
});
$vars->{ form_header } .= WebGUI::Form::hidden($session, {
name => "messageId",
value => $form->get("messageId") || "",
my $messageId = $form->get("messageId") || $message->getId;
$vars->{'form_header' } = WebGUI::Form::formHeader($session,{
action => $session->url->page->("op=account;module=inbox;do=sendMessageSave;messageId=$messageId;userId=$userTo->userId"),
extras => q{name="messageForm"}
});
$vars->{ submit_button } = WebGUI::Form::submit($session,{});
@ -104,24 +99,29 @@ sub _appendPrivateMessageForm {
returns a hashref with internationalized values for message status.
DEPRECATED: Use WebGUI::Inbox::Message->statusCodes
=cut
sub _status {
my $session = shift;
my $i18n = WebGUI::International->new($session);
return {
"pending" =>$i18n->get(552),
"completed" =>$i18n->get(350),
"unread" =>$i18n->get("private message status unread"),
"read" =>$i18n->get("private message status read"),
"replied" =>$i18n->get("private message status replied"),
};
return WebGUI::Inbox::Message->statusCodes($session);
#my $i18n = WebGUI::International->new($session);
#return {
# "pending" =>$i18n->get(552),
# "completed" =>$i18n->get(350),
# "unread" =>$i18n->get("private message status unread"),
# "read" =>$i18n->get("private message status read"),
# "replied" =>$i18n->get("private message status replied"),
#};
}
#-------------------------------------------------------------------
=head2 www_sendPrivateMessage ( )
DEPRECATED: Use WebGUI::Account::Inbox
Form for sending private messages
=cut
@ -169,6 +169,8 @@ sub www_sendPrivateMessage {
=head2 www_sendPrivateMessageSave ( )
DEPRECATED: Use WebGUI::Account::Inbox
Post process the form, check for required fields, handle inviting users who are already
members (determined by email address) and send the email.
@ -244,6 +246,8 @@ sub www_sendPrivateMessageSave {
=head2 www_viewInbox ( )
DEPRECATED: Use WebGUI::Account::Inbox
Templated display all messages for the current user.
=cut
@ -335,6 +339,8 @@ sub www_viewInbox {
=head2 www_deletePrivateMessage ( )
DEPRECATED: Use WebGUI::Account::Inbox
Mark a private message in the inbox as deleted.
=cut
@ -356,6 +362,8 @@ sub www_deletePrivateMessage {
=head2 www_viewInboxMessage ( )
DEPRECATED: Use WebGUI::Account::Inbox
Templated display of a single message for the user.
=cut

View file

@ -46,7 +46,7 @@ These methods are available from this package:
Returns an array of hashes for required profile fields. This array is ready
to be used as template variables in the WebGUI template system.
This method is deprecated, and should not be used in new code. Use
DEPRECATED - This method is deprecated, and should not be used in new code. Use
the getRequiredFields method from WebGUI::ProfileField and specify the
translation to template variables directly instead.
@ -80,6 +80,9 @@ duplicated in the system. Returns true of false. Will return false
if the email address passed in is same as the email address of the
current user.
DEPRECATED - This method is deprecated, and should not be used in new code. Use
the isDuplicate method from WebGUI::ProfileField instead
=head3 email
email address to check for duplication
@ -103,6 +106,9 @@ sub isDuplicateEmail {
Saves profile data to a user's profile. Does not validate any of the data.
DEPRECATED - This method is deprecated, and should not be used in new code. Use
the saveProfileFields method from WebGUI::Account::Profile instead
=head3 session
WebGUI session object
@ -122,9 +128,7 @@ sub saveProfileFields {
my $u = shift;
my $profile = shift;
foreach my $fieldName (keys %{$profile}) {
$u->profileField($fieldName,${$profile}{$fieldName});
}
WebGUI::Account::Profile->saveProfileFields($session,$u,$profile);
}
#-------------------------------------------------------------------
@ -134,6 +138,9 @@ sub saveProfileFields {
Validates profile data from the session form variables. Returns processed data, warnings
and errors.
DEPRECATED - This method is deprecated, and should not be used in new code. Use
the validateProfileData method from WebGUI::Account::Profile instead
There are two levels of validation:
=over 4
@ -191,6 +198,8 @@ makes a large set of template variables which are passed to a template for prese
and styling. The default template is PBtmpl0000000000000051 and is not user
selectable.
DEPRECATED - Use WebGUI::Account::Profile::www_edit
Calls www_editProfileSave on submission.
=head3 session
@ -253,6 +262,9 @@ object.
Returns the user to WebGUI::Operation::Auth::www_auth when done.
DEPRECATED: Use WebGUI::Account::Profile::www_editSave
=head3 session
A reference to the current session.
@ -281,6 +293,8 @@ Validates that the user requesting the profile data is allowed to see it.
Similarly to www_editProfile, this method is templated. The default template
is PBtmpl0000000000000052. The template is not user selectable.
DEPRECATED: Use WebGUI::Account::Profile::www_view
=head3 session
A reference to the current session.

View file

@ -169,6 +169,12 @@ sub www_editProfileCategory {
-hoverHelp => $i18n->get('470 description'),
-value => $data->{label},
);
$f->text(
-name => "shortLabel",
-label => $i18n->get('category short name'),
-hoverHelp => $i18n->get('category short name description'),
-value => $data->{shortLabel},
);
$f->yesNo(
-name=>"visible",
-label=>$i18n->get(473),
@ -198,10 +204,11 @@ sub www_editProfileCategorySave {
my $session = shift;
return $session->privilege->adminOnly() unless canView($session);
my %data = (
label=>$session->form->text("label"),
visible=>$session->form->yesNo("visible"),
editable=>$session->form->yesNo("editable"),
);
label =>$session->form->text("label"),
shortLabel =>$session->form->text("shortLabel"),
visible =>$session->form->yesNo("visible"),
editable =>$session->form->yesNo("editable"),
);
if ($session->form->process("cid") eq "new") {
my $category = WebGUI::ProfileCategory->create($session,\%data);
} else {

View file

@ -632,8 +632,8 @@ sub www_editSettings {
# Get fieldsets for avaiable account methods
my $accountConfigs = $session->config->get("account");
foreach my $accountKey (keys %{$accountConfigs}) {
my $account = $accountConfigs->{$accountKey};
foreach my $account (@{$accountConfigs}) {
#Create the instance
my $className = $account->{className};
@ -645,7 +645,7 @@ sub www_editSettings {
}
#Get the content of the settings form from the instance
my $settingsForm = $instance->editUserSettingsForm;
my $settingsForm = $instance->editSettingsForm;
#If editUserSettingsForm is empty, skip it
next if $settingsForm eq "";
@ -698,6 +698,22 @@ sub www_saveSettings {
}
}
# Save account pluggin settings
my $accountConfigs = $session->config->get("account");
foreach my $account (@{$accountConfigs}) {
#Create the instance
my $className = $account->{className};
my $instance = eval { WebGUI::Pluggable::instanciate($className,"new",[ $session ]) };
if ( my $e = WebGUI::Error->caught ) {
$session->log->warn("Could not instantiate account pluggin $className...skipping");
next;
}
#Save the settings
$instance->editSettingsFormSave;
}
### Handle special settings
# Reset login message seen numbers
if ( $session->form->get( 'showMessageOnLoginReset' ) ) {